Need syntax to submit a new form entry

I am trying to define my own new view, but having trouble with the
syntax to submit a new record via html form.

This is what I’m doing (and its wrong):

This results in:
Routing Error

no route found to match “/create/” with {:method=>:post}

Any help? I know I must just have the syntax wrong.

On Apr 21, 9:24 am, “Tony M.” [email protected]
wrote:

I am trying to define my own new view, but having trouble with the
syntax to submit a new record via html form.

Tony,
Try letting Rails generate the route. I’m not sure exactly what
you’re doing, but the view should probably look a little more like
this:

<% form_tag :action => ‘create’ do %>
<%= hidden_field_tag “roster[id]”, @roster.id %>
<%= submit_tag ‘Create’ %>
<% end %>

Make sure your controller has a corresponding ‘create’ action.

Dan M.
http://www.dcmanges.com/blog

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs