Forum: Ruby on Rails form_tag help needed

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sijo k. (Guest)
on 2009-02-18 12:20
    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
Gavin (Guest)
on 2009-02-18 12:26
(Received via mailing list)
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?
Sijo k. (Guest)
on 2009-02-18 12:33
No it is not going to create action(I have a puts statement there) and
there is no redirect in create action
Jeff E. (Guest)
on 2009-02-19 00:18
(Received via mailing list)
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.
This topic is locked and can not be replied to.