Is there anyway to pull the current url inside a controller?
I'm doing some serious hacking. And at a certain point in my row of methods, all my params are lost, and there's no way for me to differentiate between two objects innapropriately sharing the same controller.
I thought I could do it 开发者_开发问答by calling something like params[:foo] == "bar"
, but at this point in the series of methods, there are no params available. That is because it is a method called before create.
create.before :create_before
However! They would have different URL's! So if I can just find a way to pull the params of the current url, I can solve this problem.
Any takers?
This is Rails 2.3.5
If you're actually in the controller, you can call request.path
, which will return the currently requested path. However, given that params
is not available, you may not actually be in a controller at that point. You have any code you can share?
精彩评论