Thank you so much. I still have a question: as I understand it, there is a cleverness is in <do with="&this.comments.new :owner => current_user"> By using this.comments.new, you create a comment with the right commentable_id and commentable_type. How does this work after that? On submit, the comment is merged with this new object? Are there some hidden fields in the form?
I am sorry, I could drop the snippset in my app, but I'd like to understand to learn. Thank you again very much, Best regards, Nicolas. On Thu, Jul 29, 2010 at 7:27 PM, kevinpfromnm <[email protected]> wrote: > I did this for another app so here's the relevant bits. > http://gist.github.com/498837 > > actually, should be fully droppable in but you might want to tweak > some of it or redo for learning purposes > > On Jul 29, 4:24 am, Nicolas Oury <[email protected]> wrote: >> Dear all, >> >> I am trying to add comments to a hobo project. >> I would like multiple model to be commentable. >> >> So I create a comment model with >> >> belongs_to :commentable, :polymorphic => true >> >> and to each commentable thing, I had >> >> has_many :comments, :as => :commentable >> >> I wonder now how to create comments. >> >> I would like to create a link "add comment" to the other models, and >> this link would contain the right :container_id and :container_type. >> I would also like these fields not be editable. >> >> How should I do that? >> Should I create my own new and create controllers that extract the >> right parameters? Is there something more Hobo-y to do? >> >> How to ensure that the field are not editable? (Usually, I use >> after_user_new callback + permission for create, but I can't see how >> to use it in such a setting) >> >> Best regards, >> >> Nicolas. > > -- > You received this message because you are subscribed to the Google Groups > "Hobo Users" 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/hobousers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en.
