...slightly misleading — a 406 would be more appropriate. Option: Declare supported formats in your routes You can define your routes for certain formats only: # routes.rb contraints(:format => /html/) do
...own app as the application responsible for showing error pages by adding config.exceptions_app = routes to your config/application.rb. Add routes for the error pages, by appending this to your config/routes.rb...
If you are using the routing-filter gem in your Rails 7.1 app for managing URL segments for locales or suffixes, you will notice that the filters do no longer...
...apply, routes are broken and the necessary parameters are no longer extracted. That is because routing-filter patches Rails' find_routes-method to get the current path and apply its...
...are some ways to shoot yourself in the foot during maintenance: If all your routes send a "200 OK" with a HTML body "We're back soon", Google will index...
...We're back soon" as the text for all your URLs. If all your routes send a "404 Not Found", Google will remove all your URLs from its index.
...why the IDP logout is not working. Calling current_user within the after logout route results in an exception This might show up as a exception Issuer of the Response...
...is just different. As there should never be a current user present for this route, I solved this by overwriting #current_user within the SamlSessionsController and just returning nil for...
IGNORE_MESSAGES = [ # We have some JS libraries with missing source maps %r{No route matches .*"[^"]+\.map"}i, # CarrierWave may delete cache files before the browser tries to load them...
...r{No route matches .*"/uploads/test/\d+-[\d\-]+/[^"]+"}i, ].freeze def raise_server_error! super rescue StandardError => e # Ignore errors about missing source maps unless IGNORE_MESSAGES.any? { |ignore_message| e.message =~ ignore_message...
Some people are seeing leaks when using ng-animate. Use the ui-router Some users of the angular-ui router are getting leaks on every state change.
Only test that the download link's [href] attribute points to a particular route. Then test that route with a request spec. Or, if the uploaded file lives in...
You can use constraints in your routes.rb to avoid getting ActionView::MissingTemplate errors when wrong routes are called. Instead, the user will see a 404. If you want multiple routes...
resources :pages resources :images end If you want constraints only on certain routes, you can do: get '/users/account' => 'users#account', constraints: { format: 'html' } Tip You can also avoid...
...you have different session secrets for your stages Issues with Clearance Clearance may install routes we don't need, e.g. a sign_up_url for internal-only sites. : - override each...
...route in routes.rb: match 'sign_up' => redirect('/') (redirects to home page) if you don't want any of the routes from clearance-0.8: simply remove Clearance::Routes.draw(map) from config/routes.rb...
...is lazy. It yields the same matches as a greedy quantifier, but takes another route there. Lazy quantifiers will make the shortest possible match for the subpattern it repeats. Only...
...before calling to_file. Alternatively you can use PDFKit::Middleware and all your Rails routes automagically respond to the .pdf format. This is awesome to get started fast, but details...
...development, you might experience that your application "locks up" whenever you request a .pdf route. This behavior is caused by a deadlock: The Rails process is trying to render the...
...payload[:error] job = payload[:job] url = begin job_path = GoodJob::Engine.routes.url_helpers.job_path(job) URI.join(Router.instance.root_url, job_path).to_s rescue StandardError; end ExceptionNotifier.notify_exception( exception, data: { event_name: event...
Rails middlewares are small code pieces that wrap requests to the application. The first middleware gets passed the request, invokes...
...your stylesheets (background-image: url(/path/to/asset)) and sometimes in your Javascripts. You need to route all these paths through Rails or you won't get hashed paths. Techniques to do...
...our applications anyway. Features A nice "Dashboard" The "Request Analysis" screen Aggregated requests by route Separately lists view rendering and DB query durations Good for spotting problematic endpoints
...you don't accidentally offer a sign-up for an internal application. Check rake routes. Reviewing authentication in a legacy app? There are a lot of footguns with authentication when...
...will raise if there are unpermitted parameters. Variant B You can also use ActionDispatch::Routing::Redirection#redirect in the routes.rb file: get 'old_location', redirect(path: '/new_location') This will:
...these specs is, that your are not going through the controller by using the routes as you would with request specs. This means that you are creating a faked state...
...Cookie'].should_not include('; Secure') end end Note that /test/set_cookie must be an existing route that sets a cookie...
...Sidekiq (like queue sizes, last run of Sidekiq) your application should have a monitoring route which returns a json looking like this: { "sidekiq": { "totals": { "failed": 343938, "processed": 117649167 }, "recent_history...
when 'the homepage' root_path when /^the list of (.*?)$/ models_prose = $1 route = "#{model_prose_to_route_segment(models_prose)}_path" send(route) when /^the (page|form) for...
...the (.*?) above$/ action_prose, model_prose = $1, $2 route = "#{action_prose == 'form' ? 'edit_' : ''}#{model_prose_to_route_segment(model_prose)}_path" model = model_prose_to_class(model_prose) send(route...
Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...
Why Writing a controller spec I encountered this error: Failure/Error: get :index ActionController::RoutingError: No route matches {:controller=>"people"} caused by this route definition resources :people, :concerns => :trashable
...renders strange routes: trash_person PUT /people/:id/trash(.:format) people#check {:concerns=>:trashable} people GET /people(.:format) people#index {:concerns=>:trashable} POST /people(.:format) people#create {:concerns=>:trashable} new_person...