Hi, all! I''m new in Rails. I''ve read "Agile web development" and now I want made my very first rails application - photo album. But I don''t know how to design it RESTful. For example I have 3 chapters and 100 photos on each one and i want list only 10 photos on page. How should look request for such resource? Maybe: site.my/chapter/2/4 (controller:chapter, action: chapter_id=2, page=4) If its good then how to send to controller 2 parameters ? Or maybe you can explain me how it can be done right way? And now I also want know in general how to process request like site.my/say/hello/to/homer I know if it just site.my/say/hello - then ''say'' - it''s controller and'' hello'' - it''s action, but what when ''to'' and ''homer''? How exactly tell my rails application whet I want say hello to Homer? Thanks in advance! PS sorry for so many stupid questions but I don''t have any one next to me who about Rails(( -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
DmitryPush wrote:> Hi, all! > I''m new in Rails. > I''ve read "Agile web development" and now I want made my very first > rails application - photo album. > But I don''t know how to design it RESTful. > > For example I have 3 chapters and 100 photos on each one and i want > list only 10 photos on page.Forget about trying to engineer your URLs (save that for later if you want). Take a look at mislav-will_paginate for showing N items per page. Mix that with good use of the in_groups_of, and you can have a nice layout in rows and columns if that''s your desire.> And now I also want know in general how to process request like > site.my/say/hello/to/homer > I know if it just site.my/say/hello - then ''say'' - it''s controller > and'' hello'' - it''s action, but what when ''to'' and ''homer''? > How exactly tell my rails application whet I want say hello to Homer? >You''ll want to read up on specifying routes in rails to accomplish that task. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
DmitryPush wrote:> site.my/chapter/2/4It is my opinion that people often go overboard with the REST concepts. As far as I''m concerned there''s nothing non-RESTful about: http://host/chapter/2/photos?page=4&per_page=10 The URL still identifies the resource, which would be the collection of photos (nested under the chapter identified by 2). The query string is just for controlling the paging. I don''t see this as part of the resource identifier URL, so the query string is a good place for it to live. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Mar 9, 2010 at 3:59 PM, Robert Walker <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> As far as I''m concerned there''s nothing non-RESTful about: > > http://host/chapter/2/photos?page=4&per_page=10I agree, but all the question marks and ampersands pretty much guarantee Google won''t index it. -- Greg Donald destiney.com | gregdonald.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald wrote:> On Tue, Mar 9, 2010 at 3:59 PM, Robert Walker <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> As far as I''m concerned there''s nothing non-RESTful about: >> >> http://host/chapter/2/photos?page=4&per_page=10 > > I agree, but all the question marks and ampersands pretty much > guarantee Google won''t index it.I certainly get that point. However, that''s a different issue, unrelated to the RESTfulness of a URI. There are cases where it''s probably a good thing that Google doesn''t index certain pages. There''s way to much garbage that people force Google to index that just makes finding what you really want next to impossible. Forums that get indexed come to mind. It drives me nuts that such a large percentage of what I''m looking for gets obscured by a bunch of useless hits on forum discussions. Blogs, yes. Forum posts I could live without in my search results! SEO is great, and useful, for sites that provide really useful search content, but there much that needs to be put on the web that really has no business showing up in Google results. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thx! Sounds good. I''ll try it and later I''ll post hear where it drive me to:) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, you can try from other perspective, if you already have the functionality to paginate the records in your model or controller and the only need that you have are the parameters, you can try with a simple map.connect like this => map.connect ":controller/:id_chapter/:page" and ActionController will map => i rann it in the rails console =>>> rs.recognize_path "chapter/2/4"{:action => ''index'', :page => "2", :id_chapter => "4", :controller=>"chapter") this variables are aviable in your @params. but you''ll be better if take the paginate-plugin approach, don´t put that kind of logic in your route sistem. Pdta: Sorry by mi English Cristian Vasquez Medellín-Colombia -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.