Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Sinatra::Namespace doesn't seem to work #47
First off, I'm sorry I can't give you more context or (even better) provide a pull request. I haven't had any luck getting any more detail or information about what's going on and understanding the source for the namespace module is a little beyond me (I've tried :/).
That said, I can't seem to get namespace to work at all outside of a contrived, single Ruby file. I have a main controller file that does a require of another file with this:
# Gemfile gem 'sinatra' gem 'sinatra-flash', require: 'sinatra/flash' gem 'sinatra-contrib', require: 'sinatra/contrib' # controller.rb Dir.glob('./**/*.rb') do |file| require file.gsub(/\.rb/, '') end get '/' do erb 'pages/home' end # sessions.rb namespace '/login' do get do "oh hey" end end
When I go to '/login' I get a "Sinatra doesn't know that ditty" 404. I'm on Sinatra 1.3.2, Sinatra-contrib 1.3.1 on Ruby 1.9.3-p125.
@l3ck the only way I could get
class App < Sinatra::Base register Sinatra::Namespace namespace '/login' do get do "oh hey" end end end
I'm registering the
did u add
if so, sinatra-contrib
rake's namespace is defined here: https://github.com/jimweirich/rake/blob/master/lib/rake/dsl_definition.rb#L96
to fix this problem: