0
base.send(:include, ::Validatable)
0
# rspec breaks if its classes have their contructor overwritten
0
- unless base.to_s.downcase =~ /
spec::example::examplegroup::subclass_\d/
0
+ unless base.to_s.downcase =~ /
(spec::example::examplegroup::subclass_\d|blah)/
0
# allow object to be created with a hash of attributes...
0
# [] allows for obj[attribute] retrieval
0
# to_s allows for stupid Rails to work
0
+ @@fields[self.class.to_s.make_key].each do |f|
0
+ instance_variable_set("@"+f[:name].to_s,[]) if f[:klass] == Array
0
def field(name, klass, arg = nil)
0
if arg && arg[:unique] == true
0
klass_sym = self.to_s.make_key
0
unless @@fields[klass_sym]
0
@@fields[klass_sym] = [{:name => name,
0
# add accessor for given field
0
- self.class_eval <<-EOS, __FILE__, __LINE__
0
+ self.class_eval <<-EOS, __FILE__, __LINE__
0
+ self.class_eval <<-EOS, __FILE__, __LINE__
0
# the resource of which this class has many
0
def has_many(resource, *args)
0
self.class_eval <<-EOS, __FILE__, __LINE__
0
#{resource.to_s.singularize.titlecase}.all("#{self.to_s.downcase}_id".to_sym.equals => self.id)
0
- # TODO: implement this
0
+ # Registers a many-to-many association using an array of +resource+
0
+ # The resource of which this class belongs to and has many
0
def has_and_belongs_to_many(resource, *args)
0
+ alias_method :habtm, :has_and_belongs_to_many
0
# Returns the first object matching +conditions+, or the first object
0
# if no conditions are specified
Comments
No one has commented yet.