ruby on rails 3 - Getting input from view to scope an index -


so trying add ability select user in view, , return lists associated user. can hard coded in controller.

  def show    @some_lists = list.sort(:boolean => true, :user_id => 3)      respond_to |format|       format.html # show.html.erb       format.json { render json: @some_list }     end end 

but want able choose user views

        <% @some_lists.each |list| %>       <tr>         <td><%= list.id_name %></td>         <td><%= list.day %></td>         <td><%= list.start_time %></td>         <td><%= list.end_time %></td>       </tr>     <% end %> 

what best way go doing this, plan on adding ability sort list.start_time , list.end_time well

you'll want ajax. specific thing want (filtering/sorting table) there's javascript plugin recommend:

datatables

(you'll want check out documentation on server-side processing)

there's nice tutorial using rails in railscast #340


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -