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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to