Hi All
I have two "little" issues with my rails app that I am hopping somebody could shed some light on. Here is the first one:
Two models, a and b, both have a description attribute (varchar(255))
In a function that assigns each attribute from one model to the other, this statement fails with NoMethodError: description
a.description = b.description
yet the following code works just fine:
warn a.description warn b.description s = b.description a.description = s
I just don't get it why direct assignment fails...
The second issue has to do with model pluralization. Two Models: Event and EventCategory when declared like this:
class Event < ActiveRecord::Base has_many :EventCategories, :dependent => :destroy end
class EventCategory < ActiveRecord::Base belongs_to :Event end
everything but destroying an event works. Meaning: I can create new events, categories, enumarate through eventcategories by using event.EventCategories syntax etc. The ONLY thing that throws up is a call to event.destroy. The actual error is constant missing event_categories.
However, defined like this (notice the has_many), everything works just fine:
class Event < ActiveRecord::Base has_many :event_categories, :dependent => :destroy end
class EventCategory < ActiveRecord::Base belongs_to :Event end
Thanks
Rafael