Custom routing in simply_restful

Is there information on how I can define custom paths/actions other than
these:

/users/new GET new
/users/id;edit GET edit

so for example I can have my own:

/users/log_in GET log_in
/users/id;process_log_in GET process_log_in

So far I cannot find any documentations on these at all.

Sharkie L. wrote:

Is there information on how I can define custom paths/actions other than
these:

/users/new GET new
/users/id;edit GET edit

so for example I can have my own:

/users/log_in GET log_in
/users/id;process_log_in GET process_log_in

So far I cannot find any documentations on these at all.

There isn’t much documentation on SimplyRestful yet. A few people have
gone over the obvious stuff, but nothing that goes into what you’re
asking. I guess I should write some.

/users/log_in GET log_in

This isn’t supported (yet?) in SimplyRestful. You have two options that
will give you something roughly equivalent:

map.resource :user, :collection => { :log_in => :get }
=> GET /users;log_in

map.resource :user, :new => { :log_in => :get }
=> GET /users/new;log_in

/users/id;process_log_in GET process_log_in

map.resource :user, :member => { :process_log_in => :get }
=> GET /users/:id;process_log_in

Putting it all together:

map.resource :user, :collection => { :log_in => :get },
:member => { :process_log_in => :get }

Writing up some real docs on using SimplyRestful is high on my list for
things to do this week. Stay tuned!


Josh S.
http://blog.hasmanythrough.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs