On Apr 3, 2006, at 21:03, zac elston wrote:> I have to use names like tbl_Transfer & tbl_User. In my tests on the
> console, I am trying
>
> myvar = tbl_Transfer.find_by_sql("select top 1 * from
tbl_Transfer")
>
> NameError: undefined local variable or method `tbl_Transfer'' for
> #<Object:0xb7fec970>
> from (irb):1
>
> what should go into the myvar= section? the TableName correct?
In the above case, my guess is you need a model like:
class Transfer < ActiveRecord::Base
set_table_name ''tbl_Transfer''
end
Then you''d be able to do
all_my_transfers = Transfer.find(:all)
Tablenames are generally abstracted away from your Rails application.
It just happens to be that models are usually named after your
tables. Your variables you can name anything.
--
Jakob Skjerning - http://mentalized.net