Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3 - Form submission issues
    primarykey
    data
    text
    <p>I'm having trouble getting a for to submit from my show.html.erb page. It is a nested form that sends from /event/1/ticketbuilder/1 to the same page, However, when i submit the form, Ig et a Routing Error (No route matches "/event/1/ticketbuilder/1") even though going to that url directly works just fine.</p> <pre><code>#show.html.erb &lt;%= form_for @section, :url =&gt; event_ticketbuilder_path(@event) do |s| %&gt; &lt;%= s.text_field(:name) %&gt; &lt;%= submit_tag("Add Section") %&gt; &lt;% end %&gt; #ticketbuilder_controller.rb class TicketbuilderController &lt; ApplicationController def show @event = Event.find(params[:event_id]) @section = Section.new end def create @event = Event.new(params[:event_id]) @section = @event.sections.build(params[:name]) if @section.save @section = Section.new end render :action =&gt; :show end end </code></pre> <p>When linking directly to the page, it succeeds and i get </p> <pre><code>Started GET "/event/1/ticketbuilder/1" for 206.248.211.83 at Sun Mar 27 15:02:24 -0400 2011 Processing by TicketbuilderController#show as HTML Parameters: {"event_id"=&gt;"1", "id"=&gt;"1"} Event Load (0.3ms) SELECT "events".* FROM "events" WHERE "events"."id" = 1 LIMIT 1 Section Load (0.3ms) SELECT "sections".* FROM "sections" WHERE ("sections".event_id = 1) Location Load (0.3ms) SELECT "locations".* FROM "locations" WHERE ("locations".section_id = 1) User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 Rendered ticketbuilder/show.html.erb within layouts/application (52.2ms) Completed 200 OK in 85ms (Views: 56.8ms | ActiveRecord: 1.4ms) </code></pre> <p>When submitting the form on that page i get</p> <pre><code>Started POST "/event/1/ticketbuilder/1" for 206.248.211.83 at Sun Mar 27 15:02:26 -0400 2011 ActionController::RoutingError (No route matches "/event/1/ticketbuilder/1"): Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.0ms) </code></pre> <p>It seems as though I can access the page with the "GET" method but not "POST" I assume this has something to do with the variables being sent through the URL, but I don't have enough knowledge of rails currently to solve this.</p> <pre><code>event_ticketbuilder_index GET /event/:event_id/ticketbuilder(.:format) {:controller=&gt;"ticketbuilder", :action=&gt;"index"} POST /event/:event_id/ticketbuilder(.:format) {:controller=&gt;"ticketbuilder", :action=&gt;"create"} new_event_ticketbuilder GET /event/:event_id/ticketbuilder/new(.:format) {:controller=&gt;"ticketbuilder", :action=&gt;"new"} edit_event_ticketbuilder GET /event/:event_id/ticketbuilder/:id/edit(.:format) {:controller=&gt;"ticketbuilder", :action=&gt;"edit"} event_ticketbuilder GET /event/:event_id/ticketbuilder/:id(.:format) {:controller=&gt;"ticketbuilder", :action=&gt;"show"} PUT /event/:event_id/ticketbuilder/:id(.:format) {:controller=&gt;"ticketbuilder", :action=&gt;"update"} DELETE /event/:event_id/ticketbuilder/:id(.:format) {:controller=&gt;"ticketbuilder", :action=&gt;"destroy"} event_index GET /event(.:format) {:controller=&gt;"event", :action=&gt;"index"} POST /event(.:format) {:controller=&gt;"event", :action=&gt;"create"} GET /event/new(.:format) {:controller=&gt;"event", :action=&gt;"new"} GET /event/:id/edit(.:format) {:controller=&gt;"event", :action=&gt;"edit"} GET /event/:id(.:format) {:controller=&gt;"event", :action=&gt;"show"} PUT /event/:id(.:format) {:controller=&gt;"event", :action=&gt;"update"} DELETE /event/:id(.:format) {:controller=&gt;"event", :action=&gt;"destroy"} </code></pre> <p>Any help or ideas would greatly appreciated</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload