Using Edge with scaffold_resource here. My update page is throwing a
nil error.
"You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.update_attributes"
The form loads properly with all the fields as input , but when I hit
update ..bam!
def update
respond_to do |format|
if @position.update_attributes(params[:position])
format.html { redirect_to position_url(@position) }
format.xml { render :nothing => true }
else
format.html { render :action => "edit" }
format.xml { render :xml => @position.errors.to_xml }
end
end
The log doesn''t point anything out to me but I''ll show it
regardless
in case it helps-
NoMethodError (You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.update_attributes):
/app/controllers/positions_controller.rb:93:in `update''
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:104:in
`respond_to''
/app/controllers/positions_controller.rb:92:in `update''
/vendor/rails/actionpack/lib/action_controller/base.rb:1022:in
`perform_action_without_filters''
/vendor/rails/actionpack/lib/action_controller/filters.rb:628:in
`call_filter''
/vendor/rails/actionpack/lib/action_controller/filters.rb:634:in
`call_filter''
/vendor/rails/actionpack/lib/action_controller/filters.rb:453:in
`call''
/vendor/rails/actionpack/lib/action_controller/filters.rb:633:in
`call_filter''
/vendor/rails/actionpack/lib/action_controller/filters.rb:615:in
`perform_action_without_benchmark''
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue''
C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure''
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue''
/vendor/rails/actionpack/lib/action_controller/rescue.rb:81:in
`perform_action''
/vendor/rails/actionpack/lib/action_controller/base.rb:425:in
`process_without_filters''
/vendor/rails/actionpack/lib/action_controller/filters.rb:620:in
`process_without_session_management_support''
/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in
`process''
/vendor/rails/actionpack/lib/action_controller/base.rb:328:in
`process''
/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:in
`process''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in
`process_client''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in
`process_client''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
`run''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
`run''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in
`run''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in
`run''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in
`run''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:127:in
`run''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in
`run''
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235
/vendor/rails/activesupport/lib/active_support/dependencies.rb:357:in
`load''
/vendor/rails/railties/lib/commands/servers/mongrel.rb:48
C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
/vendor/rails/activesupport/lib/active_support/dependencies.rb:364:in
`require''
/vendor/rails/railties/lib/commands/server.rb:39
script/server:3
--
http://en.wikipedia.org/wiki/Dark_ambient
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
I''m wondering if this is a bug - because I went back to earlier today
in a test app to see what scaffold_resource generated for the update
and it was like this:
def update
@article = Article.find(params[:id])
respond_to do |format|
if @article.update_attributes(params[:article])
format.html { redirect_to article_url(@article) }
format.xml { render :nothing => true }
else
format.html { render :action => "edit" }
format.xml { render :xml => @article.errors.to_xml }
end
end
end
Yet in my app it was like this:
def update
respond_to do |format|
if @position.update_attributes(params[:position])
format.html { redirect_to position_url(@position) }
format.xml { render :nothing => true }
else
format.html { render :action => "edit" }
format.xml { render :xml => @position.errors.to_xml }
end
end
end
See the difference , 2nd one has no find and the if update_params on
wrong line. So I''ve now fixed this problem but wonder if I should be
report it to trac dev.rubyonrails ? I''ve never done that before .
Stuart
Stuart
On 9/28/06, Dark Ambient
<sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Using Edge with scaffold_resource here. My update page is throwing a
> nil error.
>
> "You have a nil object when you didn''t expect it!
> You might have expected an instance of ActiveRecord::Base.
> The error occurred while evaluating nil.update_attributes"
>
> The form loads properly with all the fields as input , but when I hit
> update ..bam!
>
> def update
>
> respond_to do |format|
> if @position.update_attributes(params[:position])
>
> format.html { redirect_to position_url(@position) }
> format.xml { render :nothing => true }
> else
> format.html { render :action => "edit" }
> format.xml { render :xml => @position.errors.to_xml }
> end
> end
>
> The log doesn''t point anything out to me but I''ll show it
regardless
> in case it helps-
>
> NoMethodError (You have a nil object when you didn''t expect it!
> You might have expected an instance of ActiveRecord::Base.
> The error occurred while evaluating nil.update_attributes):
> /app/controllers/positions_controller.rb:93:in `update''
> /vendor/rails/actionpack/lib/action_controller/mime_responds.rb:104:in
> `respond_to''
> /app/controllers/positions_controller.rb:92:in `update''
> /vendor/rails/actionpack/lib/action_controller/base.rb:1022:in
> `perform_action_without_filters''
> /vendor/rails/actionpack/lib/action_controller/filters.rb:628:in
> `call_filter''
> /vendor/rails/actionpack/lib/action_controller/filters.rb:634:in
> `call_filter''
> /vendor/rails/actionpack/lib/action_controller/filters.rb:453:in
`call''
> /vendor/rails/actionpack/lib/action_controller/filters.rb:633:in
> `call_filter''
> /vendor/rails/actionpack/lib/action_controller/filters.rb:615:in
> `perform_action_without_benchmark''
> /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in
> `perform_action_without_rescue''
> C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure''
> /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in
> `perform_action_without_rescue''
> /vendor/rails/actionpack/lib/action_controller/rescue.rb:81:in
> `perform_action''
> /vendor/rails/actionpack/lib/action_controller/base.rb:425:in
> `process_without_filters''
> /vendor/rails/actionpack/lib/action_controller/filters.rb:620:in
> `process_without_session_management_support''
>
/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in
> `process''
> /vendor/rails/actionpack/lib/action_controller/base.rb:328:in
`process''
> /vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:in
> `process''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in
> `process_client''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in
> `process_client''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
> `run''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
> `run''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in
> `run''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in
> `run''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in
> `run''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:127:in
> `run''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in
> `run''
>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235
> /vendor/rails/activesupport/lib/active_support/dependencies.rb:357:in
`load''
> /vendor/rails/railties/lib/commands/servers/mongrel.rb:48
>
C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
> /vendor/rails/activesupport/lib/active_support/dependencies.rb:364:in
> `require''
> /vendor/rails/railties/lib/commands/server.rb:39
> script/server:3
> --
> http://en.wikipedia.org/wiki/Dark_ambient
>
--
http://en.wikipedia.org/wiki/Dark_ambient
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
I started getting this error when I svn upped Rails Edge the other day as well. It''s definitely slowing down my dev cycle since I''m not getting nice error reporting in the browser any more. (resource_navigator plugin is now broken as well, as a side-note) Jamie On Sep 28, 2006, at 6:01 PM, Dark Ambient wrote:> > Using Edge with scaffold_resource here. My update page is throwing a > nil error. > > "You have a nil object when you didn''t expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.update_attributes" > > The form loads properly with all the fields as input , but when I hit > update ..bam! > > def update > > respond_to do |format| > if @position.update_attributes(params[:position]) > > format.html { redirect_to position_url(@position) } > format.xml { render :nothing => true } > else > format.html { render :action => "edit" } > format.xml { render :xml => @position.errors.to_xml } > end > end > > The log doesn''t point anything out to me but I''ll show it regardless > in case it helps- > > NoMethodError (You have a nil object when you didn''t expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.update_attributes): > /app/controllers/positions_controller.rb:93:in `update'' > /vendor/rails/actionpack/lib/action_controller/mime_responds.rb: > 104:in > `respond_to'' > /app/controllers/positions_controller.rb:92:in `update'' > /vendor/rails/actionpack/lib/action_controller/base.rb:1022:in > `perform_action_without_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:628:in > `call_filter'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:634:in > `call_filter'' > /vendor/rails/actionpack/lib/action_controller/filters.rb: > 453:in `call'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:633:in > `call_filter'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:615:in > `perform_action_without_benchmark'' > /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: > 66:in > `perform_action_without_rescue'' > C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: > 66:in > `perform_action_without_rescue'' > /vendor/rails/actionpack/lib/action_controller/rescue.rb:81:in > `perform_action'' > /vendor/rails/actionpack/lib/action_controller/base.rb:425:in > `process_without_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:620:in > `process_without_session_management_support'' > /vendor/rails/actionpack/lib/action_controller/ > session_management.rb:114:in > `process'' > /vendor/rails/actionpack/lib/action_controller/base.rb:328:in > `process'' > /vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel/rails.rb:73:in > `process'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:551:in > `process_client'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:550:in > `process_client'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:636:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:636:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:625:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:956:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:955:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/bin/mongrel_rails:127:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel/command.rb:199:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/bin/mongrel_rails:235 > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 357:in `load'' > /vendor/rails/railties/lib/commands/servers/mongrel.rb:48 > C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/ > custom_require.rb:27:in > `require'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 364:in > `require'' > /vendor/rails/railties/lib/commands/server.rb:39 > script/server:3 > -- > http://en.wikipedia.org/wiki/Dark_ambient > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
See this thread: error page replaced with http 500 as of edge 5208 ? On Sep 28, 2006, at 6:01 PM, Dark Ambient wrote:> > Using Edge with scaffold_resource here. My update page is throwing a > nil error. > > "You have a nil object when you didn''t expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.update_attributes" > > The form loads properly with all the fields as input , but when I hit > update ..bam! > > def update > > respond_to do |format| > if @position.update_attributes(params[:position]) > > format.html { redirect_to position_url(@position) } > format.xml { render :nothing => true } > else > format.html { render :action => "edit" } > format.xml { render :xml => @position.errors.to_xml } > end > end > > The log doesn''t point anything out to me but I''ll show it regardless > in case it helps- > > NoMethodError (You have a nil object when you didn''t expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.update_attributes): > /app/controllers/positions_controller.rb:93:in `update'' > /vendor/rails/actionpack/lib/action_controller/mime_responds.rb: > 104:in > `respond_to'' > /app/controllers/positions_controller.rb:92:in `update'' > /vendor/rails/actionpack/lib/action_controller/base.rb:1022:in > `perform_action_without_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:628:in > `call_filter'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:634:in > `call_filter'' > /vendor/rails/actionpack/lib/action_controller/filters.rb: > 453:in `call'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:633:in > `call_filter'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:615:in > `perform_action_without_benchmark'' > /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: > 66:in > `perform_action_without_rescue'' > C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: > 66:in > `perform_action_without_rescue'' > /vendor/rails/actionpack/lib/action_controller/rescue.rb:81:in > `perform_action'' > /vendor/rails/actionpack/lib/action_controller/base.rb:425:in > `process_without_filters'' > /vendor/rails/actionpack/lib/action_controller/filters.rb:620:in > `process_without_session_management_support'' > /vendor/rails/actionpack/lib/action_controller/ > session_management.rb:114:in > `process'' > /vendor/rails/actionpack/lib/action_controller/base.rb:328:in > `process'' > /vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel/rails.rb:73:in > `process'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:551:in > `process_client'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:550:in > `process_client'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:636:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:636:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:625:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:956:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel.rb:955:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/bin/mongrel_rails:127:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/lib/mongrel/command.rb:199:in > `run'' > C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3- > mswin32/bin/mongrel_rails:235 > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 357:in `load'' > /vendor/rails/railties/lib/commands/servers/mongrel.rb:48 > C:/INSTAN~1/ruby/lib/ruby/site_ruby/1.8/rubygems/ > custom_require.rb:27:in > `require'' > /vendor/rails/activesupport/lib/active_support/dependencies.rb: > 364:in > `require'' > /vendor/rails/railties/lib/commands/server.rb:39 > script/server:3 > -- > http://en.wikipedia.org/wiki/Dark_ambient > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---