# Undefined method \`stories\_path'

**URL:** <https://www.ruby-forum.com/t/undefined-method-stories-path/156079>\
**Category:** Rails\
**Created:** [December 20, 2008, 5:27am UTC](https://www.ruby-forum.com/t/undefined-method-stories-path/156079 "2008-12-20T05:27:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![merrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58956e/32.png) [@merrick](https://www.ruby-forum.com/u/merrick)\
**Post date:** [December 20, 2008, 5:27am UTC](https://www.ruby-forum.com/t/undefined-method-stories-path/156079/1 "2008-12-20T05:27:14Z")

</div>

Hi,

I recieve error “undefined method `stories\_path’ for  
#ActionView::Base:0x995b4ac” when going to the view via  
[site.com/stories/new](http://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| %\>

name:   
 \<%= f.text\_field :name %\>

link:   
 \<%= f.text\_field :link %\>

\<%= submit\_tag %\>

\<% end %\>

---

<div class="post-metadata">

**Author:** ![merrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58956e/32.png) [@merrick](https://www.ruby-forum.com/u/merrick)\
**Post date:** [December 20, 2008, 5:31am UTC](https://www.ruby-forum.com/t/undefined-method-stories-path/156079/2 "2008-12-20T05:31:24Z")

</div>

Is your config/routes.rb properly set up?

– Bryce R.

---

<div class="post-metadata">

**Author:** ![merrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58956e/32.png) [@merrick](https://www.ruby-forum.com/u/merrick)\
**Post date:** [December 20, 2008, 5:36am UTC](https://www.ruby-forum.com/t/undefined-method-stories-path/156079/3 "2008-12-20T05:36:53Z")

</div>

Bryce R. wrote:

> Is your config/routes.rb properly set up?
> 
> – Bryce R.

Aha, fixed. Yea thanks for the tip, completely overlooked mapping the  
resource. The solution was:

map.resources :stories

---

<div class="post-metadata">

**Author:** ![merrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58956e/32.png) [@merrick](https://www.ruby-forum.com/u/merrick)\
**Post date:** [December 20, 2008, 6:25am UTC](https://www.ruby-forum.com/t/undefined-method-stories-path/156079/4 "2008-12-20T06:25:09Z")

</div>

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 R.
