'Ruby Sinatra Routes Not Being Recognized
I'm having some issues with Sinatra not recognizing my routes (all other routes work fine, it is just this specific set of 4 routes). The layout is: in my views, the user clicks on a filter button which corresponds to the route of /all /inactive /active or /expired, and should filter out based on this selection.
Here is the index.haml filters:
%form{method: 'GET', action: "/showings/all"}
%input#all.btn.btn-md.btn-secondary{type: 'submit', value: 'All'}
%form{method: 'GET', action: "/showings/active"}
%input#active.btn.btn-md.btn-secondary{type: 'submit', value: 'Active'}
%form{method: 'GET', action: "/showings/inactive"}
%input#inactive.btn.btn-md.btn-secondary{type: 'submit', value: 'Inactive'}
%form{method: 'GET', action: "/showings/expired"}
%input#expired.btn.btn-md.btn-secondary{type: 'submit', value: 'Expired'}
%form{method: 'DELETE', action: "/showings/delete", style: "padding-left: 45%"}
%input#delete.btn.btn-md.btn-danger{type: 'submit', value: 'Delete Expired Hosted Screenings'}
However, in my showings_routes.rb file in my controllers folder, I tried these route but they never get registered (I've tried restarting the web app):
get '/all' do
p "ALL ROUTES"
haml :'showings/index'
end
get '/active' do
p "ACTIVE ROUTES"
haml :'showings/index'
end
get '/inactive' do
p "INACTIVE ROUTES"
haml :'showings/index'
end
get '/expired' do
p "EXPIRED ROUTES"
haml :'showings/index'
end
delete '/delete' do
p "DELETE ROUTES"
redirect '/showings'
end
I'm planning on adding the filter logic later, the routes are just not being recognized when I click one of the buttons or navigate to localhost:3000/showings/all. I'm just confused because this is a built web app, so all the other routes in the showings_routes.rb file work fine (like /create /submit etc.)
Is there a thing that I'm missing when I'm handling my routes here in my application?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
