I'm using a tool(UltraSms) that required three tables named (smsin, smsout & smsparts)
I need these tables to be used in the same Rails application that has other tables. With ActiveRecrod I know that table names has to be plural of the Active record class name by convention. Is there a way to map those to an ActiveRecrod class easily or should I find manual way to do ORM for it?
Thanks,
Tam
ActiveRecord is an ORM. It's a layer of Ruby code that runs between your database and your logic code.
ActiveRecord::Base indicates that the ActiveRecord class or module has a static inner class called Base that you're extending. Edit: as Mike points out, in this case ActiveRecord is a module...
Rails Active Records provide an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables.
Seems that in Rails3.1 , the method name changed to table_name=
, e.g.
class Mouse < ActiveRecord::Base
self.table_name = "mice"
end
You can do this:
class MyClass < ActiveRecord::Base
set_table_name "smsin"
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With