Ruby on Rails Wednesday, January 5, 2011

On 5 January 2011 01:03, Jose tomas R. <lists@ruby-forum.com> wrote:
> i need something like this
>
> index.html.erb
>
> <th><%= link_to 'cost', :action => 'search', :order => 'cost'
> %></th>
>
> cars_controller.rb
>
>  def search
>    @order = :order

Look in the log file (development.log assuming you are in development
mode) and you will see the parameters passed to the controller when
you click the link. The parameters passed are then available in the
params hash. So your :order variable should be available as
params[:order].

I suggest you run through some tutorials to get an understanding of
basic Rails operation. The one at railstutorial.org (available free
online) is good.

Also have a look at the Rails Guides.

Colin

--
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@googlegroups.com.
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.

No comments:

Post a Comment