I need some help with routes and params. I am developming some forums for a web. I want to be able to create new replies once a post has been created. So I create a post and then I have to put a link named "Reply". What I want to do is Reply.create, and pass post_id as a param to this Reply.create action. How can I make this link? How can I get this param in replies controller? I think I can create a whole new action, but I would like to use Reply.create. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi John, I highly suggest you take a peek as the associations that Rails provides. A good place to start is the Rails Guides. http://guides.rubyonrails.org/association_basics.html and also the guide on routes (particularly the part on nested resources) http://guides.rubyonrails.org/routing_outside_in.html These will make life much easier for you if you follow them. Sorry for not really answering your question... :) Again, I would go this route though. :) On Feb 9, 12:46 pm, John Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I need some help with routes and params. I am developming some forums > for a web. I want to be able to create new replies once a post has been > created. So I create a post and then I have to put a link named "Reply". > What I want to do is Reply.create, and pass post_id as a param to this > Reply.create action. How can I make this link? How can I get this param > in replies controller? > I think I can create a whole new action, but I would like to use > Reply.create. > -- > 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think you have to have a look at Rails basics. A basic forum would
be something like:
forums has_many categories
categories has_many topics
topics has_many replies
then you have has_many routes like /forums/1/categories/1/topic and in
your routes.rb you would do
map.resources :forums do |forum|
  forum.resources :categories do |cat|
    cat.resources :topics
  end
end
You could add :has_many => :topics but if you need members and/or
collections later its better this way.
On Feb 9, 1:26 pm, John Yerhot
<joyer...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi John,
>
> I highly suggest you take a peek as the associations that Rails
> provides.  A good place to start is the Rails
Guides.http://guides.rubyonrails.org/association_basics.html
> and also the guide on routes (particularly the part on nested
> resources)http://guides.rubyonrails.org/routing_outside_in.html
> These will make life much easier for you if you follow them.
>
> Sorry for not really answering your question... :)
>
> Again, I would go this route though.  :)
> On Feb 9, 12:46 pm, John Smith
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
> wrote:
>
> > I need some help with routes and params. I am developming some forums
> > for a web. I want to be able to create new replies once a post has
been
> > created. So I create a post and then I have to put a link named
"Reply".
> > What I want to do is Reply.create, and pass post_id as a param to this
> > Reply.create action. How can I make this link? How can I get this
param
> > in replies controller?
> > I  think I can create a whole new action, but I would like to use
> > Reply.create.
> > --
> > 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---