ROR 2.0.2
I have:
map.resources :blogs do |blog|
blog.resources :posts
end
in my routes.rb
I am calling the route as:
link_to "(manage)", posts_path(@blog)
I get the following error:
Undefined method `posts_path'' for #<ActionView::Base:0xb74caa38>
I am sure it is something stupid, but I can''t figure out what.
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
path should be blog_posts_path, there ''s a name prefice since rails 2. you can do "rake routes" to check your routes. regards On Dec 23, 5:29 am, "Jon Grifin" <jongriffi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ROR 2.0.2 > > I have: > map.resources :blogs do |blog| > blog.resources :posts > end > > in my routes.rb > > I am calling the route as: > link_to "(manage)", posts_path(@blog) > > I get the following error: > Undefined method `posts_path'' for #<ActionView::Base:0xb74caa38> > > I am sure it is something stupid, but I can''t figure out what. > > Thanks--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
And if you want to link to a certain post regardless of which blog it belongs to, define map.resources :posts outside of the blog block. On Dec 23, 2007 3:20 PM, Jean-Sébastien <jeansebastien.ney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > path should be blog_posts_path, there ''s a name prefice since rails 2. > you can do "rake routes" to check your routes. regards > > On Dec 23, 5:29 am, "Jon Grifin" <jongriffi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > ROR 2.0.2 > > > > I have: > > map.resources :blogs do |blog| > > blog.resources :posts > > end > > > > in my routes.rb > > > > I am calling the route as: > > link_to "(manage)", posts_path(@blog) > > > > I get the following error: > > Undefined method `posts_path'' for #<ActionView::Base:0xb74caa38> > > > > I am sure it is something stupid, but I can''t figure out what. > > > > Thanks > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Dec 22, 2007 8:29 PM, Jon Grifin <jongriffinjr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > ROR 2.0.2 > > I have: > map.resources :blogs do |blog| > blog.resources :posts > endThis is the old way. The new way: map.resources :blogs, has_many :posts end> > > in my routes.rb > > I am calling the route as: > link_to "(manage)", posts_path(@blog) > >Use rake:routes to list all the available routes and how they are mapped to an action. -- http://www.rubyplus.org/ Free Ruby Screencasts --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks to all, I am just learning this REST stuff, and am finally getting it. Jon On Dec 23, 2007 12:18 AM, Bala Paranj <bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Dec 22, 2007 8:29 PM, Jon Grifin <jongriffinjr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > ROR 2.0.2 > > > > I have: > > map.resources :blogs do |blog| > > blog.resources :posts > > end > > > This is the old way. The new way: > > map.resources :blogs, > has_many :posts > end > > > > > > > in my routes.rb > > > > I am calling the route as: > > link_to "(manage)", posts_path(@blog) > > > > > Use rake:routes to list all the available routes and how they are mapped > to an action. > > -- > http://www.rubyplus.org/ > Free Ruby Screencasts > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bala, that throws a syntax error, so something is wrong.
map.resources :blogs,
has_many :posts
end
On Dec 23, 2007 10:03 AM, Jon Grifin
<jongriffinjr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Thanks to all, I am just learning this REST stuff, and am finally getting
> it.
>
> Jon
>
>
> On Dec 23, 2007 12:18 AM, Bala Paranj
<bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> >
> >
> > On Dec 22, 2007 8:29 PM, Jon Grifin <
jongriffinjr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > >
> > > ROR 2.0.2
> > >
> > > I have:
> > > map.resources :blogs do |blog|
> > > blog.resources :posts
> > > end
> >
> >
> > This is the old way. The new way:
> >
> > map.resources :blogs,
> > has_many :posts
> > end
> >
> > >
> > >
> > > in my routes.rb
> > >
> > > I am calling the route as:
> > > link_to "(manage)", posts_path(@blog)
> > >
> > >
> > Use rake:routes to list all the available routes and how they are
mapped
> > to an action.
> >
> > --
> > http://www.rubyplus.org/
> > Free Ruby Screencasts
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Jon :> map.resources :blogs, > has_many :posts > endmap.resources :blogs, :has_many => :posts For better help, please send your questions on the Ruby on Rails Talk mailing list. -- Jean-François. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
myself :> Jon : > > map.resources :blogs, > > has_many :posts > > end > > map.resources :blogs, :has_many => :posts > > For better help, please send your questions on the Ruby on Rails Talk > mailing list.Sorry, I thought we were on Ruby Talk list ! -- Jean-François. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---