> *blink* Yes, but no. I mean.. Yes, but no! You're abusing the concept of
> the many:many relationship. As long as you're aware of that, let's move
> on...

Since the comments table has both the article and user id's it just
lends itself to be thought of that way, dont you think?
What else would you suggest given that
> Okay, so we have:
> Article has many comments
> Comment belongs to article
> Comment belongs to user
> User has many comments

The user_article_comment_path([...@user, @article])
will point to the "new" action in the comment controller and rails
knows to use user_id and article_id from the [...@user, @article]

On Jan 29, 10:27 am, Aldric Giacomoni <li...@ruby-forum.com> wrote:
> Maulin pa wrote:
>
> > Well, in my model articles dont have a user association. They just
> > have comments and users can post comments to different articles
>
> Okay, so we have:
> Article has many comments
> Comment belongs to article
> Comment belongs to user
> User has many comments
>
> > So basically article and user have a many to many relationship with
> > the comments being the join table (it contains both article_id and
> > user_id). The comments table also has an additional attribute, the
> > actual comment.
>
> *blink* Yes, but no. I mean.. Yes, but no! You're abusing the concept of
> the many:many relationship. As long as you're aware of that, let's move
> on...
>
>
>
> > So, given this, when a new comment is being created, I would like to
> > be able to use a path like
> > user_article_comment_path([...@user, @article])
> > What should I put in my routes file to get this?
>
> Well, I'm not all that good at routes yet, so can you tell me what you
> expect this path to do for you?
> --
> Posted viahttp://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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to