Ruby on Rails
Tuesday, June 5, 2012
On 5 June 2012 18:08, Martyn W. <lists@ruby-forum.com> wrote:
Hassan Schroeder wrote in post #1063180:
> On Tue, Jun 5, 2012 at 9:56 AM, Martyn W. <lists@ruby-forum.com> wrote:Hassan,
>
>> I dont understand why after failing the save in the controller and
>> trying to render "new" it would give me a route matching error. Any
>> ideas?
>
> Yes - look at the log for that request :-)
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
I don't see anything in the logs that explains the routing error. The
controller is redirecting the failed save to the "new" view using
render. There shouldn't be any routing issues here.
Here is the log entry for this action: (sanitized a bit to read)
Started POST "/works" for 127.0.0.1 at 2012-06-05 12:04:18 -0500
Processing by WorksController#create as HTML
Parameters: {"utf8"=>"?",
"authenticity_token"=>"vrAsdpq9G04to6SgW5HNvb5NWcN8rPCy01ZwKK95lhM=",
"work"=>{"start(1i)"=>"2012", "start(2i)"=>"6", "start(3i)"=>"5",
"start(4i)"=>"17", "start(5i)"=>"04", "end(1i)"=>"2012", "end(2i)"=>"6",
"end(3i)"=>"5", "end(4i)"=>"17", "end(5i)"=>"04", "good"=>"", "bad"=>"",
"operation"=>"1", "work_ticket_id"=>"8", "shift_id"=>"1",
"operator_id"=>"1", "machine_id"=>"1"}, "commit"=>"Create Work"}
In start_must_be_before_end_time
In start_must_be_before_end_time
In start_must_be_before_end_time
In start_must_be_before_end_time
@work.save: false
@work.errors.count: 2
Rendered works/_form.html.erb (62.5ms)
Rendered works/new.html.erb within layouts/application (62.5ms)
Completed 500 Internal Server Error in 156ms
ActionController::RoutingError (No route matches
{:controller=>"works"}):
app/views/works/new.html.erb:5:in
So the error is on on line 5 of your new.html. What does that line look like?
`_app_views_works_new_html_erb__545664482_19220532'
app/controllers/works_controller.rb:136:in `block (2 levels) in
create'
app/controllers/works_controller.rb:127:in `create'
Rendered
c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb
within rescues/layout (0.0ms)
--
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.
--
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment