Please could i get some assistance as you all are very helpful!
I am trying to load the index page on a new users sign up. It should load with only requests created by them but as they have not created any yet im getting the error below.
ActionController::UnknownFormat in RequestsController#index Started GET "/requests.15" for ::1 at 2019-05-14 13:06:11 +0100 Processing by RequestsController#index as User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 15]] Completed 406 Not Acceptable in 12ms (ActiveRecord: 0.0ms)
ActionController::UnknownFormat (ActionController::UnknownFormat): app/controllers/requests_controller.rb:20:in `index'
Here is my requests index controller
class RequestsController < ApplicationController
def index
if current_user.landlord?
@requests = Request.where(house: current_user.houses).order("created_at DESC")
respond_to do |format|
format.html
format.pdf do
pdf = RequestPdf.new(@request)
send_data pdf.render, filename: "request_report.pdf",
type: "application/pdf",
disposition: "inline"
end
end
elsif current_user.tenant?
@requests = Request.where(user_id: current_user).order("created_at DESC")
else
@requests = Request.search(params[:search]).order("created_at DESC")
respond_to do |format|
format.html
format.pdf do
pdf = RequestPdf.new(@request)
send_data pdf.render, filename: "request_report.pdf",
type: "application/pdf",
disposition: "inline"
end
end
end
end
Thank you in advance!
/requests.15
is the wrong format. it must be/requests/15
or/requests15
or/requests
– Jasjeet Singh