I''ve a problem in, my view where the object found via find method, cant be seen i get a You have a nil object when you didn''t expect it! The error occurred while evaluating nil.to_sym Error every time i try to edit the record, the weird thing is that in the debugger the object is created I use restful routing for news in routes.rb map.resources :news, :singular=>:news_instance In the view <% form_for @news do |n| %> <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} %> <% end %> I gues this could be a bug (?) Anyway to get around it? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Can you post the full trace dump? On May 19, 4:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve a problem in, my view where the object found via find method, > cant be seen > i get a > > You have a nil object when you didn''t expect it! > The error occurred while evaluating nil.to_sym > > Error every time i try to edit the record, the weird thing is that in > the debugger the object is created > I use restful routing for news > > in routes.rb > map.resources :news, :singular=>:news_instance > > In the view > <% form_for @news do |n| %> > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > %> > <% end %> > > I gues this could be a bug (?) > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Can you post the backtrace? On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve a problem in, my view where the object found via find method, > cant be seen > i get a > > You have a nil object when you didn''t expect it! > The error occurred while evaluating nil.to_sym > > Error every time i try to edit the record, the weird thing is that in > the debugger the object is created > I use restful routing for news > > in routes.rb > map.resources :news, :singular=>:news_instance > > In the view > <% form_for @news do |n| %> > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > %> > <% end %> > > I gues this could be a bug (?) > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
What he said! Great minds think alike! On May 19, 8:52 am, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Can you post the backtrace? > > On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I''ve a problem in, my view where the object found via find method, > > cant be seen > > i get a > > > You have a nil object when you didn''t expect it! > > The error occurred while evaluating nil.to_sym > > > Error every time i try to edit the record, the weird thing is that in > > the debugger the object is created > > I use restful routing for news > > > in routes.rb > > map.resources :news, :singular=>:news_instance > > > In the view > > <% form_for @news do |n| %> > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > > %> > > <% end %> > > > I gues this could be a bug (?) > > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
here it goes: /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:27:in `symbolize_keys'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in `each'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in `inject'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in `symbolize_keys'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:69:in `url_for'' (eval):17:in `news_path'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:27:in `polymorphic_url'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:31:in `polymorphic_path'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:200:in `apply_form_for_options!'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:179:in `form_for'' app/views/news/edit.html.erb:4:in `_run_erb_47app47views47news47edit46html46erb'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_view/base.rb:637:in `compile_and_render_template'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/base.rb:1100:in `render_for_file'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/base.rb:836:in `render'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/layout.rb:262:in `render_with_a_layout'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: 293:in `measure'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/base.rb:1153:in `default_render'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/base.rb:1159:in `perform_action'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_with_filters'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: 293:in `measure'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_with_rescue'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action_with_caching'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ query_cache.rb:33:in `cache'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action_with_caching'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_with_filters'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process_with_session_management_support'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ rails-2.0.2/lib/webrick_server.rb:78:in `service'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ httpserver.rb:104:in `service'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ httpserver.rb:65:in `run'' /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb: 173:in `start_thread'' :1:in `start'' On 19 Maj, 18:04, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What he said! Great minds think alike! > > On May 19, 8:52 am, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Can you post the backtrace? > > > On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''ve a problem in, my view where the object found via find method, > > > cant be seen > > > i get a > > > > You have a nil object when you didn''t expect it! > > > The error occurred while evaluating nil.to_sym > > > > Error every time i try to edit the record, the weird thing is that in > > > the debugger the object is created > > > I use restful routing for news > > > > in routes.rb > > > map.resources :news, :singular=>:news_instance > > > > In the view > > > <% form_for @news do |n| %> > > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > > > %> > > > <% end %> > > > > I gues this could be a bug (?) > > > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The backtrace shows that there''s a problem in line 4 but you''ve only shown 3 lines from the template. My guess is that there is something wonky in the partial that you''re including (which means there are two lines before the render :partial). If you can show the partial and the edit method we might get somewhere. On May 19, 2:59 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> here it goes: > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:27:in > `symbolize_keys'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > `each'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > `inject'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > `symbolize_keys'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:69:in `url_for'' > (eval):17:in `news_path'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:27:in > `polymorphic_url'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:31:in > `polymorphic_path'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:200:in > `apply_form_for_options!'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:179:in > `form_for'' > app/views/news/edit.html.erb:4:in > `_run_erb_47app47views47news47edit46html46erb'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_view/base.rb:637:in > `compile_and_render_template'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/base.rb:1100:in > `render_for_file'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/base.rb:836:in `render'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/layout.rb:262:in > `render_with_a_layout'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > `render_with_benchmark'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > 293:in `measure'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > `render_with_benchmark'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/base.rb:1153:in > `default_render'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/base.rb:1159:in > `perform_action'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/filters.rb:697:in > `call_filters'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/filters.rb:689:in > `perform_action_with_filters'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > `perform_action_with_benchmark'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > 293:in `measure'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > `perform_action_with_benchmark'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/rescue.rb:199:in > `perform_action_with_rescue'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/caching.rb:678:in > `perform_action_with_caching'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ > query_cache.rb:33:in `cache'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/caching.rb:677:in > `perform_action_with_caching'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/filters.rb:685:in > `process_with_filters'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/session_management.rb:123:in > `process_with_session_management_support'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in > `handle_request'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in > `dispatch_cgi'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > rails-2.0.2/lib/webrick_server.rb:78:in `service'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > httpserver.rb:104:in `service'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > httpserver.rb:65:in `run'' > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb: > 173:in `start_thread'' > :1:in `start'' > > On 19 Maj, 18:04, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > What he said! Great minds think alike! > > > On May 19, 8:52 am, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Can you post the backtrace? > > > > On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I''ve a problem in, my view where the object found via find method, > > > > cant be seen > > > > i get a > > > > > You have a nil object when you didn''t expect it! > > > > The error occurred while evaluating nil.to_sym > > > > > Error every time i try to edit the record, the weird thing is that in > > > > the debugger the object is created > > > > I use restful routing for news > > > > > in routes.rb > > > > map.resources :news, :singular=>:news_instance > > > > > In the view > > > > <% form_for @news do |n| %> > > > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > > > > %> > > > > <% end %> > > > > > I gues this could be a bug (?) > > > > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
<%= render :partial=>''menu'' %> <%= error_messages_for :news %> <%unless @news.nil?%> <% form_for @news do |n| %> <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''} %> <% end %> <%end%> the partial _menu <div class="submenu"> <ul> <li class=''label''> news </li> <%= ''<li>'' + link_to(''add'',new_news_instance_path, {:class=>:add}) + ''</li>'' if session[:user_level]>1 %> <li> <%= link_to ''list'',news_path, {:class=>:list,:title=>"list"} %> </li> </ul> <div class="clear"></div> </div> On 19 Maj, 21:22, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The backtrace shows that there''s a problem in line 4 but you''ve only > shown 3 lines from the template. My guess is that there is something > wonky in the partial that you''re including (which means there are two > lines before the render :partial). If you can show the partial and > the edit method we might get somewhere. > > On May 19, 2:59 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > here it goes: > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:27:in > > `symbolize_keys'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > `each'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > `inject'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > `symbolize_keys'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:69:in `url_for'' > > (eval):17:in `news_path'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:27:in > > `polymorphic_url'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:31:in > > `polymorphic_path'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:200:in > > `apply_form_for_options!'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:179:in > > `form_for'' > > app/views/news/edit.html.erb:4:in > > `_run_erb_47app47views47news47edit46html46erb'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_view/base.rb:637:in > > `compile_and_render_template'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/base.rb:1100:in > > `render_for_file'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/base.rb:836:in `render'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/layout.rb:262:in > > `render_with_a_layout'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > `render_with_benchmark'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > 293:in `measure'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > `render_with_benchmark'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/base.rb:1153:in > > `default_render'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/base.rb:1159:in > > `perform_action'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/filters.rb:697:in > > `call_filters'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/filters.rb:689:in > > `perform_action_with_filters'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > `perform_action_with_benchmark'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > 293:in `measure'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > `perform_action_with_benchmark'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/rescue.rb:199:in > > `perform_action_with_rescue'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/caching.rb:678:in > > `perform_action_with_caching'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ > > query_cache.rb:33:in `cache'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/caching.rb:677:in > > `perform_action_with_caching'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/filters.rb:685:in > > `process_with_filters'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/session_management.rb:123:in > > `process_with_session_management_support'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in > > `handle_request'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in > > `dispatch_cgi'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > rails-2.0.2/lib/webrick_server.rb:78:in `service'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > httpserver.rb:104:in `service'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > httpserver.rb:65:in `run'' > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb: > > 173:in `start_thread'' > > :1:in `start'' > > > On 19 Maj, 18:04, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > What he said! Great minds think alike! > > > > On May 19, 8:52 am, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Can you post the backtrace? > > > > > On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I''ve a problem in, my view where the object found via find method, > > > > > cant be seen > > > > > i get a > > > > > > You have a nil object when you didn''t expect it! > > > > > The error occurred while evaluating nil.to_sym > > > > > > Error every time i try to edit the record, the weird thing is that in > > > > > the debugger the object is created > > > > > I use restful routing for news > > > > > > in routes.rb > > > > > map.resources :news, :singular=>:news_instance > > > > > > In the view > > > > > <% form_for @news do |n| %> > > > > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > > > > > %> > > > > > <% end %> > > > > > > I gues this could be a bug (?) > > > > > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I am thinking that one of the items in the @news object is nil You check to see if the object is nil, but not each item <%unless @news.nil?%> <% form_for @news do |n| %> #<%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''} %> <%= (render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''}) if n %> <% end %> <%end%> Just my guess. Lets see what Andy finds. On May 19, 1:01 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <%= render :partial=>''menu'' %> > <%= error_messages_for :news %> > <%unless @news.nil?%> > <% form_for @news do |n| %> > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''} %> > <% end %> > <%end%> > > the partial _menu > <div class="submenu"> > <ul> > <li class=''label''> > news > </li> > <%= ''<li>'' + link_to(''add'',new_news_instance_path, > {:class=>:add}) + ''</li>'' if session[:user_level]>1 %> > <li> > <%= link_to ''list'',news_path, > {:class=>:list,:title=>"list"} %> > </li> > </ul> > <div class="clear"></div> > </div> > > On 19 Maj, 21:22, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > The backtrace shows that there''s a problem in line 4 but you''ve only > > shown 3 lines from the template. My guess is that there is something > > wonky in the partial that you''re including (which means there are two > > lines before the render :partial). If you can show the partial and > > the edit method we might get somewhere. > > > On May 19, 2:59 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > here it goes: > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:27:in > > > `symbolize_keys'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > `each'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > `inject'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > `symbolize_keys'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:69:in `url_for'' > > > (eval):17:in `news_path'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:27:in > > > `polymorphic_url'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:31:in > > > `polymorphic_path'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:200:in > > > `apply_form_for_options!'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:179:in > > > `form_for'' > > > app/views/news/edit.html.erb:4:in > > > `_run_erb_47app47views47news47edit46html46erb'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_view/base.rb:637:in > > > `compile_and_render_template'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/base.rb:1100:in > > > `render_for_file'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/base.rb:836:in `render'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/layout.rb:262:in > > > `render_with_a_layout'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > > `render_with_benchmark'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > > 293:in `measure'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > > `render_with_benchmark'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/base.rb:1153:in > > > `default_render'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/base.rb:1159:in > > > `perform_action'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/filters.rb:697:in > > > `call_filters'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/filters.rb:689:in > > > `perform_action_with_filters'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > > `perform_action_with_benchmark'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > > 293:in `measure'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > > `perform_action_with_benchmark'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/rescue.rb:199:in > > > `perform_action_with_rescue'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/caching.rb:678:in > > > `perform_action_with_caching'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ > > > query_cache.rb:33:in `cache'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/caching.rb:677:in > > > `perform_action_with_caching'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/filters.rb:685:in > > > `process_with_filters'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/session_management.rb:123:in > > > `process_with_session_management_support'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in > > > `handle_request'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in > > > `dispatch_cgi'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > rails-2.0.2/lib/webrick_server.rb:78:in `service'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > > httpserver.rb:104:in `service'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > > httpserver.rb:65:in `run'' > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb: > > > 173:in `start_thread'' > > > :1:in `start'' > > > > On 19 Maj, 18:04, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > What he said! Great minds think alike! > > > > > On May 19, 8:52 am, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Can you post the backtrace? > > > > > > On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I''ve a problem in, my view where the object found via find method, > > > > > > cant be seen > > > > > > i get a > > > > > > > You have a nil object when you didn''t expect it! > > > > > > The error occurred while evaluating nil.to_sym > > > > > > > Error every time i try to edit the record, the weird thing is that in > > > > > > the debugger the object is created > > > > > > I use restful routing for news > > > > > > > in routes.rb > > > > > > map.resources :news, :singular=>:news_instance > > > > > > > In the view > > > > > > <% form_for @news do |n| %> > > > > > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > > > > > > %> > > > > > > <% end %> > > > > > > > I gues this could be a bug (?) > > > > > > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
I did that check after the errors started to pop out and i couldn''t find the solution ;/ On 19 Maj, 22:12, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am thinking that one of the items in the @news object is nil > You check to see if the object is nil, but not each item > > <%unless @news.nil?%> > <% form_for @news do |n| %> > #<%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''} > %> > <%= (render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''}) > if n %> > <% end %> > <%end%> > > Just my guess. Lets see what Andy finds. > > On May 19, 1:01 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > <%= render :partial=>''menu'' %> > > <%= error_messages_for :news %> > > <%unless @news.nil?%> > > <% form_for @news do |n| %> > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''} %> > > <% end %> > > <%end%> > > > the partial _menu > > <div class="submenu"> > > <ul> > > <li class=''label''> > > news > > </li> > > <%= ''<li>'' + link_to(''add'',new_news_instance_path, > > {:class=>:add}) + ''</li>'' if session[:user_level]>1 %> > > <li> > > <%= link_to ''list'',news_path, > > {:class=>:list,:title=>"list"} %> > > </li> > > </ul> > > <div class="clear"></div> > > </div> > > > On 19 Maj, 21:22, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > The backtrace shows that there''s a problem in line 4 but you''ve only > > > shown 3 lines from the template. My guess is that there is something > > > wonky in the partial that you''re including (which means there are two > > > lines before the render :partial). If you can show the partial and > > > the edit method we might get somewhere. > > > > On May 19, 2:59 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > here it goes: > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:27:in > > > > `symbolize_keys'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > > `each'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > > `inject'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > > `symbolize_keys'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:69:in `url_for'' > > > > (eval):17:in `news_path'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:27:in > > > > `polymorphic_url'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:31:in > > > > `polymorphic_path'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:200:in > > > > `apply_form_for_options!'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:179:in > > > > `form_for'' > > > > app/views/news/edit.html.erb:4:in > > > > `_run_erb_47app47views47news47edit46html46erb'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_view/base.rb:637:in > > > > `compile_and_render_template'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/base.rb:1100:in > > > > `render_for_file'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/base.rb:836:in `render'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/layout.rb:262:in > > > > `render_with_a_layout'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > > > `render_with_benchmark'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > > > 293:in `measure'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > > > `render_with_benchmark'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/base.rb:1153:in > > > > `default_render'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/base.rb:1159:in > > > > `perform_action'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/filters.rb:697:in > > > > `call_filters'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/filters.rb:689:in > > > > `perform_action_with_filters'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > > > `perform_action_with_benchmark'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > > > 293:in `measure'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > > > `perform_action_with_benchmark'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/rescue.rb:199:in > > > > `perform_action_with_rescue'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/caching.rb:678:in > > > > `perform_action_with_caching'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ > > > > query_cache.rb:33:in `cache'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/caching.rb:677:in > > > > `perform_action_with_caching'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/filters.rb:685:in > > > > `process_with_filters'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/session_management.rb:123:in > > > > `process_with_session_management_support'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in > > > > `handle_request'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in > > > > `dispatch_cgi'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > rails-2.0.2/lib/webrick_server.rb:78:in `service'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > > > httpserver.rb:104:in `service'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > > > httpserver.rb:65:in `run'' > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb: > > > > 173:in `start_thread'' > > > > :1:in `start'' > > > > > On 19 Maj, 18:04, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > What he said! Great minds think alike! > > > > > > On May 19, 8:52 am, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Can you post the backtrace? > > > > > > > On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > I''ve a problem in, my view where the object found via find method, > > > > > > > cant be seen > > > > > > > i get a > > > > > > > > You have a nil object when you didn''t expect it! > > > > > > > The error occurred while evaluating nil.to_sym > > > > > > > > Error every time i try to edit the record, the weird thing is that in > > > > > > > the debugger the object is created > > > > > > > I use restful routing for news > > > > > > > > in routes.rb > > > > > > > map.resources :news, :singular=>:news_instance > > > > > > > > In the view > > > > > > > <% form_for @news do |n| %> > > > > > > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > > > > > > > %> > > > > > > > <% end %> > > > > > > > > I gues this could be a bug (?) > > > > > > > Anyway to get around it?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I am a little confused about how you are calling the partial. I think Rails will interate through all the items in the @news array (if it is an array) in the partial without you having to do so explicitly. I am not at a spot where I can look it up right now. On May 19, 1:37 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I did that check after the errors started to pop out and i couldn''t > find the solution ;/ > > On 19 Maj, 22:12, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I am thinking that one of the items in the @news object is nil > > You check to see if the object is nil, but not each item > > > <%unless @news.nil?%> > > <% form_for @news do |n| %> > > #<%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''} > > %> > > <%= (render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''}) > > if n %> > > <% end %> > > <%end%> > > > Just my guess. Lets see what Andy finds. > > > On May 19, 1:01 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > <%= render :partial=>''menu'' %> > > > <%= error_messages_for :news %> > > > <%unless @news.nil?%> > > > <% form_for @news do |n| %> > > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''add''} %> > > > <% end %> > > > <%end%> > > > > the partial _menu > > > <div class="submenu"> > > > <ul> > > > <li class=''label''> > > > news > > > </li> > > > <%= ''<li>'' + link_to(''add'',new_news_instance_path, > > > {:class=>:add}) + ''</li>'' if session[:user_level]>1 %> > > > <li> > > > <%= link_to ''list'',news_path, > > > {:class=>:list,:title=>"list"} %> > > > </li> > > > </ul> > > > <div class="clear"></div> > > > </div> > > > > On 19 Maj, 21:22, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > The backtrace shows that there''s a problem in line 4 but you''ve only > > > > shown 3 lines from the template. My guess is that there is something > > > > wonky in the partial that you''re including (which means there are two > > > > lines before the render :partial). If you can show the partial and > > > > the edit method we might get somewhere. > > > > > On May 19, 2:59 pm, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > here it goes: > > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:27:in > > > > > `symbolize_keys'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > > > `each'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > > > `inject'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > activesupport-2.0.2/lib/active_support/core_ext/hash/keys.rb:26:in > > > > > `symbolize_keys'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:69:in `url_for'' > > > > > (eval):17:in `news_path'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:27:in > > > > > `polymorphic_url'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/polymorphic_routes.rb:31:in > > > > > `polymorphic_path'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:200:in > > > > > `apply_form_for_options!'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:179:in > > > > > `form_for'' > > > > > app/views/news/edit.html.erb:4:in > > > > > `_run_erb_47app47views47news47edit46html46erb'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_view/base.rb:637:in > > > > > `compile_and_render_template'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/base.rb:1100:in > > > > > `render_for_file'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/base.rb:836:in `render'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/layout.rb:262:in > > > > > `render_with_a_layout'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > > > > `render_with_benchmark'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > > > > 293:in `measure'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in > > > > > `render_with_benchmark'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/base.rb:1153:in > > > > > `default_render'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/base.rb:1159:in > > > > > `perform_action'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/filters.rb:697:in > > > > > `call_filters'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/filters.rb:689:in > > > > > `perform_action_with_filters'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > > > > `perform_action_with_benchmark'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb: > > > > > 293:in `measure'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > > > > > `perform_action_with_benchmark'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/rescue.rb:199:in > > > > > `perform_action_with_rescue'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/caching.rb:678:in > > > > > `perform_action_with_caching'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > activerecord-2.0.2/lib/active_record/connection_adapters/abstract/ > > > > > query_cache.rb:33:in `cache'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/caching.rb:677:in > > > > > `perform_action_with_caching'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/filters.rb:685:in > > > > > `process_with_filters'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/session_management.rb:123:in > > > > > `process_with_session_management_support'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in > > > > > `handle_request'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in > > > > > `dispatch_cgi'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/ > > > > > rails-2.0.2/lib/webrick_server.rb:78:in `service'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > > > > httpserver.rb:104:in `service'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/ > > > > > httpserver.rb:65:in `run'' > > > > > /usr/local/netbeans-6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb: > > > > > 173:in `start_thread'' > > > > > :1:in `start'' > > > > > > On 19 Maj, 18:04, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > What he said! Great minds think alike! > > > > > > > On May 19, 8:52 am, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Can you post the backtrace? > > > > > > > > On May 19, 7:51 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I''ve a problem in, my view where the object found via find method, > > > > > > > > cant be seen > > > > > > > > i get a > > > > > > > > > You have a nil object when you didn''t expect it! > > > > > > > > The error occurred while evaluating nil.to_sym > > > > > > > > > Error every time i try to edit the record, the weird thing is that in > > > > > > > > the debugger the object is created > > > > > > > > I use restful routing for news > > > > > > > > > in routes.rb > > > > > > > > map.resources :news, :singular=>:news_instance > > > > > > > > > In the view > > > > > > > > <% form_for @news do |n| %> > > > > > > > > <%= render :partial=>''form'', :locals=>{:n=>n,:btn_name=>''dodaj''} > > > > > > > > %> > > > > > > > > <% end %> > > > > > > > > > I gues this could be a bug (?) > > ... > > read more »--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
And yet, you still haven''t shown us the controller code! Please do. -- Appreciated my help? Reccommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
the controller for the edit action def edit @news = News.find(params[:id]) end def update @news = News.find(params[:id]) respond_to do |format| if @news.update_attributes(params[:news]) format.html { redirect_to(@news) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @news.errors, :status => :unprocessable_entity } end end end On 20 Maj, 01:43, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And yet, you still haven''t shown us the controller code! > > Please do. > > -- > Appreciated my help? > Reccommend me on Working With Railshttp://workingwithrails.com/person/11030-ryan-bigg--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
I have a feeling that the root of the problem is with the name of your class. "news".puralize #=> "news" If I am correct, the code is having trouble with an ambiguous route on line 8 of your partial: <%= link_to ''list'',news_path, {:class=>:list,:title=>"list"} %> The framework is assuming that ''news_path'' is the name of a _singular_ route (rather than the name of the collection/index) and it''s looking for an instance of the News class upon which to call to_param so that it can build a path along the lines of news_path(:news_id=>@news). The ''rails-magic'' that transforms the instance into a symbolized key for the hash is unhappy. On May 20, 4:59 am, Adam <anlauf.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> the controller for the edit action > > def edit > @news = News.find(params[:id]) > end > > def update > @news = News.find(params[:id]) > > respond_to do |format| > if @news.update_attributes(params[:news]) > format.html { redirect_to(@news) } > format.xml { head :ok } > else > format.html { render :action => "edit" } > format.xml { render :xml => @news.errors, :status > => :unprocessable_entity } > end > end > end > > On 20 Maj, 01:43, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > And yet, you still haven''t shown us the controller code! > > > Please do. > > > -- > > Appreciated my help? > > Reccommend me on Working With Railshttp://workingwithrails.com/person/11030-ryan-bigg--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---