开发者

Authlogic: How to gracefully rename the default routes?

So Authlogic ships with some pretty confusingly (for an end user) named routes. For example, instead of /login/new, you get /user_session/new, and so on. Then, when a user can't login, the error message appears as "This user session could not be saved."

It's a small thing, but that's just kind of.开发者_C百科.. ugly, to me. What's a graceful way to rename the default session routes to something more meaningful (and easier to type)?

BTW, we are totally invested in Authlogic, so replacing it is a no-go


Rails lets you rename routes to your hearts desire. Assuming you're using Rails 2.x, the following routes should do the trick:

map.login, 'login', :controller =>'user_sessions', :action => 'new'
map.logout, 'logout', :controller => 'user_sessions', :action => 'destroy'
map.signup, 'signup', :controller => 'users', :action => 'new'

You can call them by using the following:

login_path
logout_path
signup_path
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜