8000 Non query string params not available in before filter · Issue #417 · sinatra/sinatra · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Non query string params not available in before filter #417
Closed
@evanleck

Description

@evanleck

As I understood it, the before and route blocks share the same scope (which is why you can set an instance variable in the before filter and have it respected in the route). I've noticed, however, that non query string params aren't picked up in the before filter block. Take this example:

require 'sinatra'

before do
  if params[:sucka]
    @sucka = "set in before"
  end
end

get '/hey/:sucka/sup' do
  if params[:sucka] && !@sucka
    @sucka = "set in route"
  end

  @sucka
end

If you hit /hey/man/sup it's always set in route rather than the before block, but it seems like it ought to be set in the before block. Sorry for not having a patch for it, after looking through the code I was at a loss as to where this gets put together :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0