Displaying 4 results from an estimated 4 matches for "genericobject".
2007 Sep 20
10
Element.addMethods functions swallowing exceptions (IE6 + 7)
...if (arguments.length > 1) {
var message = arguments[1];
} else {
var message = "default message";
}
alert("Element: about to throw exception");
throw new Error(message);
alert("this should not be executed");
}
});
var genericObject = {
throwException: function() {
if (arguments.length > 0) {
var message = arguments[0];
} else {
var message = "default message";
}
alert("generic Object: about to throw exception");
throw new Error(message);
alert("this sho...
2007 Apr 14
0
has_one with reference to the one stored in this object's table?
...pe 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
has_many :generic_fields, :dependent => :destroy
end
class GenericField < ActiveRecord::Base
belongs_to :generic_object
end
I then have some more magic code in GenericObject so that subclasses
can do things like this:
class Person < GenericObject...
2007 Aug 31
2
New routing system has specs and examples
Check it out here:
http://pastie.textmate.org/92610
Let me know if you have any questions.
Duane Johnson
(canadaduane)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070830/c808d045/attachment.html
2006 Jul 02
7
Generic SingleTable inheritance
...circumvent this
restriction.
Say we have a
class AbstractGenericThing < ActiveRecord:Base
has_many :properties
end
In order to support STI the abstract_generic_things-table must have a
:type column.
Next comes the Property class
class Property < ActiveRecord:Base
belongs_to :GenericObject
end
The properties table has the following columns
:key, :string
:value, :string
-> hence we have a simple key-value-pair table.
Now any class which subclasses AbstractGenericThing inherits the
properties-array. A subclass can have as many properties as it requires.
So far we can have co...