I was stuck for quite a while on this:
class Something< ActiveRecord::Base
table_name= "different_name"
end
and it didn’t work, saying table ‘Something’ does not exist (which is true), until I changed that doomed line to
set_table_name "different_name"
This would be OK, except that Rails Guide claims that set_table_name is ‘Also aliased as: table_name=’.
Now, I am new to rails, but what does that ‘also aliased’ mean? Or is this just a bug?
You need to do
self.table_name = "different_name"to use that form. This is a ruby thing: it is assigning a local variabletable_namerather than actually calling the method.