Look at commentable_url in BaseHelper. It calls:
        polymorphic_url([comment.recipient,
comment.commentable])+"#comment_#{comment.id}"

So it uses the recipient of the comment (which is a user) for comments on
anything other than users. You can overwrite that method to make an
exception for Games, something like (pseudo-code):

if comment.commentable_type == "Game"
  polymorphic_url([comment.commentable.member, comment])
#comment.commentable should return a Game
end

Good luck,
Bruno

On Fri, May 29, 2009 at 8:06 PM, LostyJai <[email protected]> wrote:

>
> Have you defined your model as a subclass of user in routes?
>
> On May 30, 8:52 am, angrysponge <[email protected]> wrote:
> > I have a Game model which I would like to enable comments for. Games
> > are owned by Members, which is a subclass of User. The relevant model
> > code needed thus far:
> >
> > class Game < ActiveRecord::Base
> >   belongs_to :member
> >   acts_as_commentable
> >   def owner
> >     self.member.becomes(User)
> >   end
> >
> > class Member < User
> >   has_many :games
> >
> > Saving a comment for a Game generates this error:
> > NoMethodError in CommentsController#create
> > undefined method `user_game_url' for #<CommentsController:0xb6daef9c>
> >
> > When adding a comment to a Photo, polymorphic_url() returns
> > 'user_photo_url', so 'user_game_url' looks reasonable, except that
> > Users don't own Games, Members do.
> >
> > Am I missing some route details for my Game model?
> >
> > Any suggestions?
> > Mike
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" 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/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to