Thanks a lot Colin,
First of all, I'm using Rails 2.3.5. and Ruby 1.8.7.
The generated HTML looks like this: <form method="post"
id="beiratkozok" action="/beiratkozas">
The option suggested by you: <% form_for :student, @student, :url =>
{:controller => 'beiratkozas', :action => "create" }, :html =>
{ :method => :post, :id => "beiratkozok" } do |f| %> gives the very
same result, so somehow the form_for assumes that controller is
'beiratkozas'. Maybe because the path is: Views/beiratkozas/
new.html.erb to the view that contains the form_for.
And works, since I have:
map.connect 'beiratkozok', :controller => 'beiratkozas', :action =>
'new'
map.connect 'hallgato/:id', :controller => 'beiratkozas', :action =>
'show'
map.connect 'beiratkozas', :controller => 'beiratkozas', :action =>
'create'
I know that map.resources :beiratkozas would be a more Rails like
approach, but it's more human readable for Hungarians if I use
meaningful Hungarian words.
The html is added since I need the ID for CSS, and I wanted a
meaningful word as ID, since it makes CSS easier to read. On the other
hand :method => :post was added since I saw something like that
somewhere, and it made sense, since I want to use the POST verb in
this case. Right?
Peter
P.S.: What do you mean putting my comments inline with the previous
post? I'm simply hitting reply.
--
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