rubyonrailsin

A Ruby and Rails talk

Friday, April 2, 2010


[Rails] Re: Two controllers with create using the same model

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Thanks a lot Colin, that was my problem.

From documentation I managed to make a working form_for:

<% form_for :student, @student, :url => { :action => "create" }, :html
=> { :method => :post, :id => "beiratkozok" } do |f| %>

This works, but I don't understand why do I need the :student in the
front. What does it do?

On Apr 2, 11:18 pm, Colin Law <clan...@googlemail.com> wrote:
> On 2 April 2010 21:00, WSzP <c...@ctdd.ro> wrote:
>
> > You got me wrong. I can't put the create method in the student
> > controller.
> > The question if, how could I use the create method from the
> > BeiratkozasController class, while the model is NOT Beiratkozas, but
> > Student.
>
> Have a look at the docs for form_for, you will see it has a url
> parameter which will allow you to specify the controller and action
> that you wish to be performed on the submit.
>
> Colin

--
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@googlegroups.com.
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.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive