I''m trying to figure this. in my schools controller i want to do this.... # implement a create action to create just the review for the School... def create_review_for_a_school @review = Review.new @school = School.find(params[:school_id]) @review = @school.reviews.build(params[:review]) if @review.save # The creation worked....do this flash[:notice] = ''Review was successfully updated.'' format.html { redirect_to(@school) } # format.xml { head :ok } else # if it didnt save do this... format.html { render :action => "show" } end end as a result I think i need a route...something like this.... map.connect ''/schools/:school_id/reviews/new'', :controller => ''schools'', :action => ''create_review_for_a_school'' and also my form submit button for creating a review - how should that look ? I guess like this... <% form_for [@school, Review.new] do |f| %> ------ But it''s still going to the reviews new action I''d like it to go to the def create_review_for_a_school action? any tips? -- 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-/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 -~----------~----~----~----~------~----~------~--~---
bingo bob wrote:> > I''m trying to figure this. > > in my schools controller i want to do this.... > > result I think i need a route...something like this.... > > map.connect ''/schools/:school_id/reviews/new'', :controller => ''schools'', > :action => ''create_review_for_a_school'' > > > ------ > > But it''s still going to the reviews new action I''d like it to go to the > def create_review_for_a_school action? > > > any tips?Here you can find the way of routing, I think It help''s you. http://rdr.rubyforge.org/ -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Anyone provide any insight? -- 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-/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 there, I have a photo gallery wich i paginate with "will_paginate". I added this line to my routes file, to make "will_paginate" work with friendly url''s: map.paginated_gallery ''gallery/page/:page'', :controller => ''gallery'', :action => ''index'', :page => nil And it works perfectly. Now when one click any thumbnail of the gallery i want to generate friendly url''s like these: http://localhost:3000/gallery/page/1/product/49 http://localhost:3000/gallery/page/1/product/50 http://localhost:3000/gallery/page/1/product/51 So that means that i am in the gallery controller, located at page number 1, and viewing thumbnails of the 49(or 50 or 51 etc) product. I added this line for that purpose: map.connect ''gallery/page/:page/product/:product_id'', :controller => ''gallery'', :action => ''index'', product_id => nil So with this, i can use http://localhost:3000/gallery/page/1/product/49 without any problem......... but: I do not know how to generate the thumbnails links in the correct way, i generate them like: <%= link_to "something here", params[:page] + "/ product/" + product_picture.id.to_s %> so when i clicked in the first thumbnail i get a good url like: http://localhost:3000/galeria/page/1/product/49 but when i clicked a second one the url comes like: http://localhost:3000/galeria/page/1/product/1/product/52 1- Am i generating right the links?? 2- The "map.connect ''gallery/page/:page/ product/:product_id'', :controller => ''gallery'', :action => ''index'', product_id => nil" is correct? Any ideas? Regards --~--~---------~--~----~------------~-------~--~----~ 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, ok the i think i found out the answer of my first question: "how to generate the links in a correct way", just: <%= link_to image_tag(product_picture.public_filename (:mediano)), :controller => "gallery", :action => "index", :page => params[:page], :product_id => product_picture.id %> that worked for me. Now my second question: "The "map.connect ''gallery/page/:page/ product/:product_id'', :controller => ''gallery'', :action => ''index'', product_id => nil" is correct? ) i noted that when i want to start mongrel it tells me: "Route segment ":page" cannot be optional because it precedes a required segment. This segment will be required." Any idea what is this? regards On 16 feb, 02:47, fRAnKEnSTEin <shirkav...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi there, > > I have a photo gallery wich i paginate with "will_paginate". I added > this line to my routes file, to make "will_paginate" work with > friendly url''s: > > map.paginated_gallery ''gallery/page/:page'', :controller => > ''gallery'', :action => ''index'', :page => nil > > And it works perfectly. Now when one click any thumbnail of the > gallery i want to generate friendly url''s like these: > > http://localhost:3000/gallery/page/1/product/49http://localhost:3000/gallery/page/1/product/50http://localhost:3000/gallery/page/1/product/51 > > So that means that i am in the gallery controller, located at page > number 1, and viewing thumbnails of the 49(or 50 or 51 etc) product. I > added this line for that purpose: > > map.connect ''gallery/page/:page/product/:product_id'', :controller => > ''gallery'', :action => ''index'', product_id => nil > > So with this, i can usehttp://localhost:3000/gallery/page/1/product/49 > without any problem......... but: > > I do not know how to generate the thumbnails links in the correct way, > i generate them like: <%= link_to "something here", params[:page] + "/ > product/" + product_picture.id.to_s %> > so when i clicked in the first thumbnail i get a good url like: > > http://localhost:3000/galeria/page/1/product/49 > > but when i clicked a second one the url comes like: > > http://localhost:3000/galeria/page/1/product/1/product/52 > > 1- Am i generating right the links?? > 2- The "map.connect ''gallery/page/:page/ > product/:product_id'', :controller => ''gallery'', :action => ''index'', > product_id => nil" is correct? > > Any ideas? > > Regards--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---