Hello :-), I''ve started to figure out how nested ressources are working, but I get an exception in a (i think so) simple case. The exception is: "ActionController::MethodNotAllowed - Only get, put, and delete requests are allowed." webrick tells me: 127.0.0.1 - - [19/Jul/2008:04:40:55 CEST] "POST /articles/22/comments/ new HTTP/1.1" 405 7131 http://localhost:3000/articles/22 -> /articles/ 22/comments/new I see its not a get, put or delete. routes.rb: map.resources :comments map.resources :articles, :has_many => :comments articles/views/show.html.erb: <%= link_to_remote("new comment", :update => ''editor'', :url => new_article_comment_path(@article), :complete => visual_effect(:blind_down, "editor", :duration => 2.5)) %> So why didn''t I get a get request? Is it a clean code? I read the RESTful Rails Development from b-simple, but i didn''t found a solution for the problem. Maybe the document is a bit outdated. If you have any solution for the problem or a URL I would be glad to hear it *g* Thanks for reading and have a nice day, Patrick --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I also tried: :url => { :controller => "comments", :action => "new", :params => { :article_id => @article}} But it didn''t help me out :-( --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
u can do like this in ur routes file map.resources :articles do |article| article.resources :comments end in ur view for article in @article ur - stuff --- <%= link_to_remote("new comment", :update => ''editor'', new_article_comment_path(article), :complete => visual_effect(:blind_down, "editor", :duration => 2.5)) %> end i hope it helps :) On Sat, Jul 19, 2008 at 8:40 AM, Parity <patrick.plattes-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > I also tried: > :url => { :controller => "comments", :action => "new", :params => > { :article_id => @article}} > > But it didn''t help me out :-( > > >--~--~---------~--~----~------------~-------~--~----~ 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 :-) thans for your answer, but it didn''t helps :-(. I changed the lines in my lines in routes.rb to: map.resources :articles do |article| article.resources :comments end (isn''t is the old convention?) And my view to: <%= link_to_remote("new comment", :update => ''editor'', :url => new_article_comment_path(@article), :complete => visual_effect(:blind_down, "editor", :duration => 2.5)) %> (without ":url =>" in front of, i got a compile error) But it didn''t helps. Bye, Patrick --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
:o opzz u can do like this in routes.rb map.resources :articles do |article| article.resources :comments end On Sat, Jul 19, 2008 at 2:47 PM, Parity <patrick.plattes-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Hi :-) > > thans for your answer, but it didn''t helps :-(. I changed the lines in > my lines in routes.rb to: > map.resources :articles do |article| > article.resources :comments > end >and in ur view> <%= link_to_remote("new comment", > :update => ''editor'', > :url => new_article_comments_path(@ >> >> article), >> :complete => visual_effect(:blind_down, >> "editor", :duration => 2.5)) %> >> >Note: the url will also depend up on the associations that u use in the models if still any issue :o post ur model and routes file> > (isn''t is the old convention?) > > And my view to: > > <%= link_to_remote("new comment", > :update => ''editor'', > :url => new_article_comment_path(@article), > :complete => visual_effect(:blind_down, > "editor", :duration => 2.5)) %> > > (without ":url =>" in front of, i got a compile error) > > But it didn''t helps. > > Bye, > Patrick > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Okay, I post you as much information as i can :-) This is my db layout: http://erdbeere.net/media/db_layout.png article model: class Article < ActiveRecord::Base belongs_to :blog has_many :comments end comment model: class Comment < ActiveRecord::Base belongs_to :article belongs_to :user end routes.rb: map.resources :users map.resources :subscriptions map.resources :blogs # map.resources :comments map.resources :articles do |article| article.resources :comments end If there is anything i can du to find the problem just send an E- Mails :-) Patrick On 19 Jul., 11:28, "bala kishore pulicherla" <balumc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> :o > > opzz > > u can do like this > in routes.rb > map.resources :articles do |article| > article.resources :comments > end > > On Sat, Jul 19, 2008 at 2:47 PM, Parity <patrick.plat...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > > > > > Hi :-) > > > thans for your answer, but it didn''t helps :-(. I changed the lines in > > my lines in routes.rb to: > > map.resources :articles do |article| > > article.resources :comments > > end > > and in ur view > > > <%= link_to_remote("new comment", > > :update => ''editor'', > > :url => new_article_comments_path(@ > > >> article), > >> :complete => visual_effect(:blind_down, > >> "editor", :duration => 2.5)) %> > > Note: the url will also depend up on the associations that u use in the > models > if still any issue :o post ur model and routes file > > > > > (isn''t is the old convention?) > > > And my view to: > > > <%= link_to_remote("new comment", > > :update => ''editor'', > > :url => new_article_comment_path(@article), > > :complete => visual_effect(:blind_down, > > "editor", :duration => 2.5)) %> > > > (without ":url =>" in front of, i got a compile error) > > > But it didn''t helps. > > > Bye, > > Patrick--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
un comment the map.resources :comments :) and in the view file> <%= link_to_remote("new comment", > :update => ''editor'', > :url => new_article_comment_path(@ >> >> article), >> :complete => visual_effect(:blind_down, >> "editor", :duration => 2.5)) %> >> >On Sun, Jul 20, 2008 at 7:03 PM, Parity <patrick.plattes-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Okay, I post you as much information as i can :-) > > This is my db layout: > http://erdbeere.net/media/db_layout.png > > article model: > class Article < ActiveRecord::Base > belongs_to :blog > has_many :comments > end > > comment model: > class Comment < ActiveRecord::Base > belongs_to :article > belongs_to :user > end > > routes.rb: > map.resources :users > map.resources :subscriptions > map.resources :blogs > # map.resources :comments > map.resources :articles do |article| > article.resources :comments > end > > If there is anything i can du to find the problem just send an E- > Mails :-) > > Patrick > > > On 19 Jul., 11:28, "bala kishore pulicherla" <balumc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > :o > > > > opzz > > > > u can do like this > > in routes.rb > > map.resources :articles do |article| > > article.resources :comments > > end > > > > On Sat, Jul 19, 2008 at 2:47 PM, Parity <patrick.plat...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > wrote: > > > > > > > > > Hi :-) > > > > > thans for your answer, but it didn''t helps :-(. I changed the lines in > > > my lines in routes.rb to: > > > map.resources :articles do |article| > > > article.resources :comments > > > end > > > > and in ur view > > > > > <%= link_to_remote("new comment", > > > :update => ''editor'', > > > :url => new_article_comments_path(@ > > > > >> article), > > >> :complete => visual_effect(:blind_down, > > >> "editor", :duration => 2.5)) %> > > > > Note: the url will also depend up on the associations that u use in the > > models > > if still any issue :o post ur model and routes file > > > > > > > > > (isn''t is the old convention?) > > > > > And my view to: > > > > > <%= link_to_remote("new comment", > > > :update => ''editor'', > > > :url => new_article_comment_path(@article), > > > :complete => visual_effect(:blind_down, > > > "editor", :duration => 2.5)) %> > > > > > (without ":url =>" in front of, i got a compile error) > > > > > But it didn''t helps. > > > > > Bye, > > > Patrick > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---