search for: generic_field

Displaying 3 results from an estimated 3 matches for "generic_field".

Did you mean: generic_fields
2006 Sep 09
2
why doesn't this work (setting attribute in "before_create")
...te" line, which definitely gets called * I tried a few different ways to set the "created_by" attribute in the model but it doesn''t seem to work, i.e. doesn''t appear in the database ============================= class Contact < ActiveRecord::Base before_create :generic_fields private def generic_fields created_by="test text" <=== DOESN''T SET IT self.created_by="test text" <=== DOESN''T SET IT @created_by="test text" <=== DOESN''T SET IT end end ============================= =...
2007 Apr 14
0
has_one with reference to the one stored in this object's table?
...h, on top of AR itself. The idea is to define one base class, and use AR''s automatic single table inheritance to have it create the right class. Here''s what I have so far: table generic_objects: id int(11) not null auto_increment primary key type varchar(255) table generic_fields: id int(11) not null auto_increment primary key generic_object_id int(11) not null <-- points to its owner name varchar(255) not null string_value varchar(255) object_value_id int(11) object_value_type varchar(255) class GenericObject < ActiveRecord::Base...
2006 Sep 09
13
best way to add "created_by" entries to all tables???
Hi, I want to automate somewhat the addition of created_by/updated_by fields on my models (i.e. to include username). What''s the best/recommended way to do this? Would it be to: a) Find out how to extend the ActiveRecord::Base itself (I haven''t extended a class before yet) b) Use a plugin type approach where you have to add a tag manually to each model file which then