On 6 June 2012 14:34, Perry Smith <lists@ruby-forum.com> wrote:
> I have the usual:
>
> config/routes.rb:
> NewApp::Application.routes.draw do
> match('blahs/:item' => 'blahs#show', :constraints => { :item =>
> /.*/ })
> end
>
> app/view/blahs/show.html.erb:
> <%= link_to "blah", blahs_path(9999) %>
>
> But I'm getting this error:
> undefined method `blahs_path' for
> #<#<Class:0x007f96083474c0>:0x007f960509b288>
>
> I've tried blah_path, blahs_path, blah_url, and blahs_url.
>
> What am I doing wrong?
>
> I'm using Rails 3.2. This is my first Rails 3.2 app but I've used Rails
> 2.x for a long time. I can't figure out what I'm doing wrong.
I believe that if you want to use blah_path(id) (it should be blah not
blahs) then you have to have resources :blahs in your routes. If you
have not got resourceful routes then you can still say blah_path(
@blah ). See the Rails Guide on Routing. I have to say I am not 100%
certain about the above however.
Colin
--
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@googlegroups.com.
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.
No comments:
Post a Comment