Fernando Perez wrote:
>
>> NoMethodError: undefined method `+' for #<Class:0x22cb198>
> Somewhere in your Blog or Comment code, there is a + hanging around that
> is trying to add an apple to a car engine.
No idea what you mean... Here's the code:
class Blog < ActiveRecord::Base
validates_presence_of :user_id, :title, :content
belongs_to :user
has_many :comments,
:as => :commentable,
:dependent => :destroy
end
class Comment < ActiveRecord::Base
validates_presence_of :commentable,
:subject,
:body
belongs_to :user
belongs_to :article
belongs_to :commentable, :polymorphic => true # Kann sowohl einem
Article als auch einem Blog zugehörig sein
def html_anchor
"comment-#{id}"
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---