From: Shridhar Agarwal Date: 2013-02-01T17:56:17+09:00 Subject: Re: Why can this happen? --14dae934117b787e3404d4a5eadd Content-Type: text/plain; charset=UTF-8 i guess somthing went wrong over there.. as i also just checked and got same as expected >> controller.method(:redirect_to).owner => ActionController::Base On Fri, Feb 1, 2013 at 2:10 PM, tenten wrote: > 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: > > redirect_to :back > > 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 > => # @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"}, > @_status=200, @_request=nil, @_response=nil> > > irb(main):003:0> controller.method(:redirect_to).owner > => ActionController::Instrumentation > ------------------------- > > So I searched 'redirect_to' at http://api.rubyonrails.org/ by using > keyword "ActionController::Instrumentation". > > But the document says almost nothing but just the method signeture and > its source code. > -------------------------------------- > redirect_to(*args) > > # File actionpack/lib/action_controller/metal/instrumentation.rb, line 58 > def redirect_to(*args) > > ActiveSupport::Notifications.instrument("redirect_to.action_controller") > do |payload| > result = super > payload[:status] = response.status > payload[:location] = response.location > result > end > end > ------------------------------------- > > 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'. > > > http://api.rubyonrails.org/classes/ActionController/Redirecting.html#method-i-redirect_to > > 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. > > Regards. > > -- Shridhar Agarwal 08891474570 --14dae934117b787e3404d4a5eadd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable i guess somthing went wrong over there.. as i also just checked and got sam= e as expected

>> controller.method(:redirect_to).owner
=3D= > ActionController::Base


On Fri, F= eb 1, 2013 at 2:10 PM, tenten <tmaekawa@jcom.home.ne.jp> wrote:
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:

redirect_to :back

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 =3D ActionController::Base.new
=3D> #<ActionController::Base:0x00000004561ab8 @_routes=3Dnil,
@_action_has_layout=3Dtrue, @_headers=3D{"Content-Type"=3D>&qu= ot;text/html"},
@_status=3D200, @_request=3Dnil, @_response=3Dnil>

irb(main):003:0> controller.method(:redirect_to).owner
=3D> ActionController::Instrumentation
-------------------------

So I searched 'redirect_to' at http://api.rubyonrails.org/ by using
keyword "ActionController::Instrumentation".

But the document says almost nothing but just the method signeture and
its source code.
--------------------------------------
redirect_to(*args)

# File actionpack/lib/action_controller/metal/instrumentation.rb, line 58 def redirect_to(*args)

ActiveSupport::Notifications.instrument("redirect_to.action_controller= ")
do |payload|
=C2=A0 =C2=A0 result =3D super
=C2=A0 =C2=A0 payload[:status] =C2=A0 =3D response.status
=C2=A0 =C2=A0 payload[:location] =3D response.location
=C2=A0 =C2=A0 result
=C2=A0 end
end
-------------------------------------

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&= #39;.

http://api.rubyonrails.org/cla= sses/ActionController/Redirecting.html#method-i-redirect_to

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.

Regards.




--
Shridhar Agarwal
088= 91474570
--14dae934117b787e3404d4a5eadd--