0

I want to be able to follow a convention closer to what Rails does with resourceful routing. For example, I'm considering "signups" to be a resource, with it's own controller containing "new" and "create" actions.

In app/controllers/signup.rb I have:

MyApp.controllers :signups do
  get :index do
    # ...
  end

  post :index do
    # ...
  end
end

Is there any way I can use these route names, while actually responding on a path other than '/signups'? It feels like Padrino's route naming system is very tightly coupled with the URLs the routes map to.

I've tried:

MyApp.controllers :signups, :map => '/another-path' do
  # ...
end

Among various other things without success. Perhaps I should just go back to using Rails... I was just getting frustrated with the startup overhead in TDD and I'm embarking on a new project at the moment (please don't refer me to Spork... that has it's own issues).

d11wtq
  • 34,788
  • 19
  • 120
  • 195
  • I've gone back to Rails to start this new project. Padrino seems more like a nice idea than a production-ready framework. Still curious if there is a way to do what I wanted though. – d11wtq Mar 25 '12 at 12:33

1 Answers1

0

This is how I would do what you are asking

# in app/controller/signups.rb
MyApp.controllers :'another-path'  do
  get '/' do
    # ...
  end
end
Mike
  • 364
  • 1
  • 9
  • But then don't you have to do `url_for(:'another-path', :index)`, which seems to entirely defeat the object of the URL helper? The namespace maps 1:1 with the path. – d11wtq Mar 30 '12 at 01:43
  • Your probably right, I do not have a need for URL helpers since I am using padrino as an api to a backbone app where I need to specify the urls exactly and url helpers are not helpful in javascript. – Mike Apr 04 '12 at 16:09