-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sinatra-namespace: cannot set :layout #1254
Comments
namespace '/cms' do
helpers do
def erb(template, options={}, locals={}, &block)
options[:layout] ||= :something
super(template, options, locals, &block)
end
end
get '' do
erb :dashboard
end
end |
Oh, but it is a thing. See this right here. You can |
Ah, it's not an official setting, but you're right, I don't know why almost all settings are prohibited in namespaces. I've run into this issue myself and the workarounds are... clumsy. Perhaps someone else can chime in and explain the historical reasoning behind this decision. |
Without changing the code in The question about only allowing |
Is the Agreed about sinatra-contrib. I and other contributors have been trying to chip away at some of the bit-rot over the past months. Code coverage is pretty good, all things considered. |
No, it'd work just fine. It's just very clumsy. Not anyone's fault, since the code we're working around is just a little weird.
Agreed, I just looked into it, and git doesn't handle project-relative symlinks in any way, which wouldn't work unless everyone stores their git clones in the same path.
I might see if I can just "expand" the allowed |
I just did a minor refactor of that section, and all tests still pass. I'm putting up a PR so others can give it a test drive. |
Done in #1255 |
What's the logic behind the check at line 282? It seems you can, in fact, only
set :views
inside a namespace.I'd like to set the layout for an entire namespace, in this case a CMS-like backend. And I'd like to do so without having to pass the same
:layout
argument to theerb
method every time.EDIT: Apparently
set :layout
is not a thing at all. Perhaps it should?EDIT EDIT: Seems to be
set :erb, :layout => :something
instead, to set the default layout. But that hassinatra-namespace
complaining aboutset :erb
, which brings me back to the question above.The text was updated successfully, but these errors were encountered: