Hi, I recieve error "undefined method `stories_path'' for #<ActionView::Base:0x995b4ac>" when going to the view via site.com/stories/new The model is setup correctly, I can retrieve data from the db fine. I think it might be related to the helper but I have no idea where to start. It seems to think its failing on the first line of the view, i belive on the ''form_for'' method. heres the traceback: /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in `__send__'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in `polymorphic_url'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:119:in `polymorphic_path'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:269:in `apply_form_for_options!'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:248:in `form_for'' /var/www/html/railsapps/shovell/dev/app/views/stories/new.html.erb:1 controller: class StoriesController < ApplicationController def index @story = Story.find_by_name(''SitePoint Forums'') end def new @story = Story.new end end view: <% form_for @story do |f| %> <p> name: <br /> <%= f.text_field :name %> </p> <p> link: <br /> <%= f.text_field :link %> </p> <p> <%= submit_tag %> </p> <% end %> -- 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 -~----------~----~----~----~------~----~------~--~---
Is your config/routes.rb properly set up? -- Bryce Roney On 20/12/2008, at 3:27 PM, Merrick Johnson wrote:> > Hi, > > I recieve error "undefined method `stories_path'' for > #<ActionView::Base:0x995b4ac>" when going to the view via > site.com/stories/new > > The model is setup correctly, I can retrieve data from the db fine. I > think it might be related to the helper but I have no idea where to > start. It seems to think its failing on the first line of the view, i > belive on the ''form_for'' method. > > heres the traceback: > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in > `__send__'' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in > `polymorphic_url'' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:119:in > `polymorphic_path'' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:269:in > `apply_form_for_options!'' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:248:in > `form_for'' > /var/www/html/railsapps/shovell/dev/app/views/stories/new.html.erb:1 > > controller: > > class StoriesController < ApplicationController > def index > @story = Story.find_by_name(''SitePoint Forums'') > end > def new > @story = Story.new > end > end > > > view: > > <% form_for @story do |f| %> > <p> > name: <br /> > <%= f.text_field :name %> > </p> > <p> > link: <br /> > <%= f.text_field :link %> > </p> > <p> > <%= submit_tag %> > </p> > <% end %> > -- > 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 -~----------~----~----~----~------~----~------~--~---
Bryce Roney wrote:> Is your config/routes.rb properly set up? > > -- Bryce RoneyAha, fixed. Yea thanks for the tip, completely overlooked mapping the resource. The solution was: map.resources :stories -- 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 -~----------~----~----~----~------~----~------~--~---
Glad to help. I assume you''re following the SitePoint Rails book? It''s a good one – it helped me learn Rails when I was starting out (I got the free copy for Rails 2.1) -- Bryce Roney On 20/12/2008, at 3:36 PM, Merrick Johnson wrote:> > Bryce Roney wrote: >> Is your config/routes.rb properly set up? >> >> -- Bryce Roney > > Aha, fixed. Yea thanks for the tip, completely overlooked mapping the > resource. The solution was: > > map.resources :stories > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe Matching Threads
- undefined method error from atom builder
- How do I force link_to/form helpers to use the superclass name in the path instead subclass?
- 3.0.0rc ActionController::RoutingError No route matches
- Plugins/Gems taking long time to download
- rails 3.0.4 broke yield :javascript ?