Flowdock
method

set_table_name

Importance_1
Ruby on Rails latest stable (v6.1.7.7) - 1 note - Class: ActiveRecord::Base

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.1.0) is shown here.

set_table_name(value = nil, &block) public

Sets the table name. If the value is nil or false then the value returned by the given block is used.

class Project < ActiveRecord::Base
  set_table_name "project"
end
Show source
Register or log in to add new notes.
May 24, 2011
2 thanks

must be first

A little gotcha I ran into.

This must be defined before you define your relationships.

ie:

class Ticket < ActiveRecord::Base
  set_table_name 'ticket'
  belongs_to :customer
  has_one :account, :through => :customer
end

if you do the relationships first it will not use the correct table name on the lookups.