Hi, I’m learning Rails and saw a strang thing for me.
Yesterday, I was told by my friend that there is a method named
‘redirect_to’. He showed how to use the method like this:
So, I wanted to find an Api document of the method on the internet,
and tried to know which class or module owns it at first…
$ rails console
irb(main)001:0> controller = ActionController::Base.new
=> #<ActionController::Base:0x00000004561ab8 @_routes=nil,
@_status=200, @_request=nil, @_response=nil>
So I searched ‘redirect_to’ at http://api.rubyonrails.org/ by using
But the document says almost nothing but just the method signeture and
its source code.
File actionpack/lib/action_controller/metal/instrumentation.rb, line
result = super
payload[:status] = response.status
payload[:location] = response.location
I tried the same search by Google, then I found
the same name method in another module and realized that it was what my
friend told me, because it explained the meaning of ‘redirect_to :back’.
But why did I fail to search such a simple thing like this?
Something must have been wrong. I’m very confused.
Was the way of checking class(or method) through irb wrong?
Please give me some advice.