Hi, i am trying to build a news feed. The way information is put into it, is from when the other db i have is updated, that is all working. I am just having trouble with showing the feed in the view. I keep getting this error: NoMethodError in Admin/post#recent Showing app/views/admin/post/_feed.rhtml where line #1 raised: undefined method `fed'' for #<Array:0x35207d0> Extracted source (around line #1): 1: <%= @newsfeeds.fed %> this is my view: <div id="section"> <span id="titles">News Feed</span> <br/> <%= render :partial => "feed", :collection => @newsfeeds %> </div> And this is my controller: def recent @newsfeeds = Newsfeeds.find(:all) end It seems to work it i have it out of a partial and if the controller is newsfeed.find(:first), but i want to show everything in the db?? Any help would be appreciated, thanks Will -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 5 Dec 2007, at 16:32, Will Monk wrote:> > Hi, i am trying to build a news feed. The way information is put into > it, is from when the other db i have is updated, that is all > working. I > am just having trouble with showing the feed in the view. > I keep getting this error: > > > NoMethodError in Admin/post#recent > > Showing app/views/admin/post/_feed.rhtml where line #1 raised: > > undefined method `fed'' for #<Array:0x35207d0> > Extracted source (around line #1): > > 1: <%= @newsfeeds.fed %> > >@newsfeeds is a array (as the error message tells you). You''re rendering a collection, with a partial called ''feed'' which means that the element of the array being considered is materialised as a local variable called feed. assuming fed is the method you want to call you need feed.fed, not @newsfeeds.fed Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 5 Dec 2007, at 16:32, Will Monk wrote: > >> Showing app/views/admin/post/_feed.rhtml where line #1 raised: >> >> undefined method `fed'' for #<Array:0x35207d0> >> Extracted source (around line #1): >> >> 1: <%= @newsfeeds.fed %> >> >> > > @newsfeeds is a array (as the error message tells you). You''re > rendering a collection, with a partial called ''feed'' which means that > the element of the array being considered is materialised as a local > variable called feed. assuming fed is the method you want to call you > need feed.fed, not @newsfeeds.fed > > FredThanks for that speedy reply! You were right, now it''s all working fine. This was the first time i had named the partial something different to what it was containing, so i couldnt work that one out... but thanks again! Will -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi I''m new to rails and i have a problem with an exception. I used masterView to generate a scaffold for a model named page. list mode work fine, and i can see a row i injected with sql but when i try to click on show or new i get this exeption (other generated scaffolds are working ok) what can i make from this error message and how can i fix it ? NoMethodError in PageController#view undefined method `assign_variables_from_controller'' for #<Template:0x4896800> RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace C:/Rails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1860:in `method_missing'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:72:in `send'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:72:in `rescue_action_locally'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:29:in `rescue_action'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:109:in `perform_action'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in `send'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in `process_without_filters'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in `process_without_session_management_support'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in `process_pre_mv'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/masterview-0.3.4/lib/masterview/rails_ext/action_controller_reparse_checking.rb:25:in `process'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in `process'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:113:in `handle_dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in `service'' C:/Rails/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' C:/Rails/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in `dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/webrick.rb:59 C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 -e:2:in `load'' -e:2 C:/Rails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1860:in `method_missing'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:72:in `send'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:72:in `rescue_action_locally'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:29:in `rescue_action'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:109:in `perform_action'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in `send'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in `process_without_filters'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in `process_without_session_management_support'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in `process_pre_mv'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/masterview-0.3.4/lib/masterview/rails_ext/action_controller_reparse_checking.rb:25:in `process'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in `process'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:113:in `handle_dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in `service'' C:/Rails/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' C:/Rails/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in `dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/webrick.rb:59 C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 C:/Rails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1860:in `method_missing'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:72:in `send'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:72:in `rescue_action_locally'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:29:in `rescue_action'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:109:in `perform_action'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in `send'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in `process_without_filters'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in `process_without_session_management_support'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in `process_pre_mv'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/masterview-0.3.4/lib/masterview/rails_ext/action_controller_reparse_checking.rb:25:in `process'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in `process'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:113:in `handle_dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in `service'' C:/Rails/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' C:/Rails/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' C:/Rails/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in `dispatch'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/webrick.rb:59 C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'' C:/Rails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 -e:2:in `load'' -e:2 Request Parameters: {"id"=>"1"} Show session dump --- flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
never mind. i found the answer -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---