Class: Theman::Object
- Inherits:
-
Object
- Object
- Theman::Object
- Defined in:
- lib/theman/object.rb
Class Method Summary collapse
-
.new(table_name, parent = ::Object, conn = nil) ⇒ Object
create a new basic model object ==== Parameters *
table_name- the name of the table created by Theman::Agency *parent- optional parent object for the new basic model object usually ActiveRecord::Base *conn- optional pg connection ==== Example my_model = Theman::Object.new(agent.table_name, ActiveRecord::Base).
Class Method Details
.new(table_name, parent = ::Object, conn = nil) ⇒ Object
create a new basic model object
Parameters
-
table_name- the name of the table created by Theman::Agency -
parent- optional parent object for the new basic model object usually ActiveRecord::Base -
conn- optional pg connection
Example
my_model = Theman::Object.new(agent.table_name, ActiveRecord::Base)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/theman/object.rb', line 11 def self.new(table_name, parent = ::Object, conn = nil) Class.new(parent) do unless conn.nil? @@connection = conn end instance_eval " set_table_name \"\#{table_name}\"\n \n def table_name\n \"\#{table_name}\"\n end\n \n def inspect\n \"Agent (\#{table_name})\"\n end\n EOV\n end\nend\n", __FILE__, __LINE__ + 1 |