I am trying to update a pagination div through the remote call in the Kanimari gem. Since this is going though ajax, I want to send it to a custom controller so I am only updating one div, instead of the entire page. Unfortunately, this is the output when I click the next link.
Started GET "/technologies/pages?page=2" for 127.0.0.1 at 2014-01-30 23:14:27 -0800
Processing by TechnologiesController#show as HTML
Parameters: {"page"=>"2", "id"=>"pages"}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Technology Load (0.5ms) SELECT "technologies".* FROM "technologies" WHERE "technologies"."id" = $1 LIMIT 1 [["id", "pages"]]
Completed 404 Not Found in 5ms
ActiveRecord::RecordNotFound (Couldn't find Technology with id=pages):
app/controllers/technologies_controller.rb:59:in `show'
I am not understanding why this would be happening. Here is the partial where the pagination is happening, as well as my routes.
Partial:
= paginate @technologies, params: {controller: :technologies, action: :pages}
Routes
resources :technologies do
collection do
post :search
get :pages
end
resources :comments
end
Controller Method
def pages
technologies = query(params)
per_page = 12
#Paginate
@technologies = technologies.page(params[:page]).per(per_page)
end
EDIT
Found out that there was another resources :technologies in the beginning of the routes.rb.
Now, when I click on Next, here is the output.
Started GET "/technologies/pages?page=2" for 127.0.0.1 at 2014-01-30 23:57:11 -0800
Processing by TechnologiesController#pages as HTML
Parameters: {"page"=>"2"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Why is it processing as html and not js?