Ahh - your self.getHowto method might be returning an array of howTo’s.
Arrays are not extended by acts_as_commentable, so the method is
unknown.
AR will not load the comments unless asked:
eg. @howto.comments
OR
Howto.find(params[:id], :include =" :comments)
Of course this is different to displaying them or not. You may want to
use your view to display howtos without comments first, them a use a
link to display a version with comments.
The first loads the comments into the instance variable @comments,
which can be used in your view. The second does not because .comments
is never called or stored.
If you get fancy you can create a method to spit back the comments only
and use ajax to populate a div to display them, with some fancy
animation of course. That way you do not need to create two different
views, you do not load comments by default and you can display your
web2.0 prowess with little effort (thanks to rails magic).
hi askegg, thanks for pointing out that article. what you are describing
is exacyly how i plan on implenting acts as commentable.
askegg wrote:
The first loads the comments into the instance variable @comments,
which can be used in your view. The second does not because .comments
is never called or stored.
If you get fancy you can create a method to spit back the comments only
and use ajax to populate a div to display them, with some fancy
animation of course. That way you do not need to create two different
views, you do not load comments by default and you can display your
web2.0 prowess with little effort (thanks to rails magic).
I installed&run the plugin successfully. it works with one exception
when I say @event.add_comment my_comment_object
it create 1 comment but 2 commentings.
so @event.comments returns the comments twice.