#31 ✓resolved
Boban

order_by_link

Reported by Boban | November 27th, 2008 @ 08:14 AM

Hi Ben, Awesome plugin :)

ROUTES

map.resources :statuscodes

map.with_options(:path_prefix => '/myprefix') do |map|

   map.resources :statuscodes

end

MODEL has_many :something

CONTROLLER

@search = Statuscode.new_search(params[:search])

@search.order_by ||= :code

@statuscodes, @statuscodes_count = @search.all, @search.count

PROBLEM VIEW <%=order_by_link :code %> link path is

WEB_SERVER/statuscodes?search%5Border_as%5D=DESC&search%5Border_by%5D=code

<%= order_by_link :code, :html => {:href => order_by_link(:code)} %> link path

WEB_SERVER/myprefix/%3Ca%20href=%22/statuscodes?search%5Border_as%5D=DESC&search%5Border_by%5D=code%22%20class=%22order_by%20ordering%22%3ECode%C2%A0%E2%96%B2%3C/a%3E

I just couldnt make it work with a prefix

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson November 27th, 2008 @ 11:13 AM

    • State changed from “new” to “resolved”

    All that searchlogic does is pass a hash to link_to, then rails takes care of generating the full URL, which I believe uses url_for.

    Anyways, the second order_by_link you pasted doesn't make sense because order_by_link returns an a tag, you cant put an a tag in the href attribute. Checkout the searchlogic_params and searchlogic_url helpers, they might be what you are looking for.

  • Pak24tv

    Pak24tv December 9th, 2020 @ 01:59 AM

    I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. hum tv live aaj entertainment urdu1 live

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages