Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Craig Read's Profile

GitHub User: Catharz

Comments by Craig Read

Avatar

Brett, I used:

drops_datatable.rb
if params[:sSearch].present?
  drops = drops.where("items.name like :search or characters.name like :search", search: "%#{params[:sSearch]}%")
end

Nested routes took me a little longer to get working.
eg.

routes.rb
resources :characters do
  resources :drops
end

When I went to /characters/1/drops, I was getting the full list of drops.

The index action was being called twice and then fetch. On the first call, the index action had all of the parameters, but params didn't have the character_id on the subsequent call to index or the call to fetch.

To resolve that, I changed the table tag in my view code to:

drops/index.html.haml
%table#dropsTable{:data => {:source => "#{ drops_url(params.merge!(format: "json")) }"}}