Hi I have created a model Request and after that created the controller for that with the name Request .I have also added in routes.rb map.resources :reuests Now in app/view/requests/new.html.erb I have <% form_tag @onboarding_request do |f| %> <% f.submit "Create" %> <%end %> But this goes to the index action of requestscontroller not to the create action But in the view source it is getting as method="post" What is the problem here..Why this not going to the create action?Please help Thanks in advance Sijo
on 2009-02-18 11:20
on 2009-02-18 11:26
Hi - A couple of syntax issues here, not sure if they are just typing errors on this feed or if you have done the same in your app map.resources :requests (no 'q') submit tag should be <%= f.submit "Create" %> so it is rendered. What do you have in the create method in the controller? Perhaps it's redirecting to the index?
on 2009-02-18 11:33
No it is not going to create action(I have a puts statement there) and there is no redirect in create action
on 2009-02-18 23:18
1. Request is a reserved word in Rails; you must choose another name for your model. 2. If you're using RESTful controllers (as Rails scaffolding does by default) then your forms will POST to the plural form of your model, for example a Blog would POST to /blogs to create. Rails controllers understand the REST verbs.