flash is the instance method of class ActionController::Flash. but our
application controller is inherited from ActionController::Base, why can we
use flash in our application controller ?
to be more concrete, i guess the code has the following form:
Class ActionController{
Class Flash
def flash
end
...
end
Class Base
# can we call instance methods of Flash here??
end
end
thanks,
xiahong
2009/6/21 pharrington
<xenogenesis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> > On Jun 21, 8:04 pm, Xiahong Gao
<gaox...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > I am newb. I feel confused about how params works.
> >
> > I understand @params is an attribute of CLASS, but what is params? A
> > named parameter? Because I thought instance attributes always begin
> > with "@”, so params/request/flash/etc looks like a local
variable.
> >
> > thanks in advance
> > Xiahong
>
> params, request, etc are just instance methods that return hashes.
>
> for example, flash''es implementation (action_controller/flash.rb):
>
> def flash #:doc:
> unless defined? @_flash
> @_flash = session["flash"] ||= FlashHash.new
> @_flash.sweep
> end
>
> @_flash
> end
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---