On Oct 6, 2011, at 10:27 AM, Frederick Cheung wrote:

> 
> 
> On Oct 6, 1:32 pm, Walter Lee Davis <[email protected]> wrote:
>> On Oct 5, 2011, at 3:48 PM, Walter Lee Davis wrote:
>> 
>>> I'm trying to add paging parameters to link_to inside an application_helper 
>>> method.
>> 
>>>  def index_show_link(elm, link_text = 'Show')
>>>    (can?(:read, elm)) ? link_to( link_text, elm ) : '&nbsp;'.html_safe
>>>  end
>> 
>>> I want to add the :page => params[:page]  pair into the link, but I can't 
>>> seem to find a way to add it. If I use the long-hand syntax: {:id => 
>>> elm.id, :controller => controller_name, :action => :show, :page => 
>>> params[:page]} then it works, but that also horses around with friendly_id.
>> 
>> I found that substituting to_param for id makes FriendlyId work correctly 
>> again, and this one is solved. Still seems awfully long-hand.
>> 
> 
> link_to 'text', blah
> 
> is a more convenient way of writing link_to 'text',
> polymorphic_path(blah) or link_to 'text', blah_path(blah) (assuming
> you have resources :blahs).
> Both of those two _path helpers should allow you to specify extra
> options (i.e. polymorphic_path(blah, :page => 2))

So are you saying that if I'm in the application helper, I can use a 
polymorphic_path, even though I am not declaring anything to be polymorphic? 
That's a new one on me. 

Walter

> 
> Fred
>> Walter
> 
> -- 
> 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.
> 

-- 
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