I am using Ruby on Rails v3.0.9 and I would to use a method that works as-like the current_page?(options) method (included in the RoR ActionView::Helpers::UrlHelper
Class), but in my controllers. That is, I would like to check in my controllers (not in view files) if the cu开发者_开发问答rrent "browsed" page corresponds to a RoR path (eg: signup_path
, signin_path
, etc...).
Is it possible? If so, how can I accomplish that?
Something is fundamentally wrong with an action that doesn't know what the current page is, but until we see some real code I don't think we're going to get to the bottom of that.
This Railscast should give you some ideas on building the wizard that you're after.
http://railscasts.com/episodes/217-multistep-forms
My advice to you: if you are in need of this method in controller, than either you have ugly routes, or you have ugly code in your controller.
Better think what you can improve in your existing code to avoid using "current_page?" in controller.
精彩评论