Colin Law wrote in post #972821:
> On 6 January 2011 14:25, Jose tomas R. <[email protected]> wrote:
>
> Please quote the previous message and insert your comments at the
> appropriate point, this makes it easier to follow the thread.
>
>> I dont need @order ar params I need it as a value
>
> I have no idea what you mean by that. params[:order] *is* a value.
> You can say
> @order = params[:order]
>
> If I misunderstand your problem please try to explain again.
>
> Colin
So
---
<th><%= link_to 'cost', :action => 'search', :order_by => 'cost'
%></th>
---
def search
@order = params[:order_by]
@cars = Car.paginate :page => params[:page], :order => @order
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @cars }
end
end
---
Will order my Cars by it cost?
--
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 [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.