One thing that I still can't get to understand is how methods like
'layout' become available on my controllers to mention one example I
supposed that the method was defined inside ActionController::Base but
reading the docs I see there is no such thing defined there.
Can you please clarify on this issue, I believe it may be something
related to the Ruby that I still don't know about.
Thanks in advance.
M.
http://apidock.com/rails/ActionController
Hope it helps.
--
Leonardo Mateo.
There's no place like ~
Ok thanks for the info, those docs seem more friendly, anyway, I still
don't understand where those methods (for ex. layout) get inherited or
injected don't know how that magic happens they aren't mentioned even
in apidock.com.
Thanks
m.
> Ok thanks for the info, those docs seem more friendly, anyway, I still
> don't understand where those methods (for ex. layout) get inherited or
> injected don't know how that magic happens
when in doubt, cd to one of your projects and e.g.
find vendor/rails -type f -exec grep -H 'def layout' {} \;
You'll see exactly how the magic happens :-) (and in this case, also
lots o' comments).
HTH,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Thanks again for the feedback, yep I already did a recursive grep
inside my gems dirs and found those definitions I guess there i'll
find the real info, anyway what I find confusing is that in the docs
those automatic inclusions are not mentioned, maybe those are obvious
or implicit and they can be derived from the module name I really
don't know because Im also new to the Ruby language.
Is it possible that because both ActionController::Base and
ActionController::Layout::ClassMethods share th 'ActionController'
module they are inside the same namespace and all public methods of
Layout are available to Base? Can I conclude that this is the case
with all clases inside ActionController?
Please excuse my enormouse ignorance on the subject
Thanks for you patience!
m.
For instance, observe that ActionController::Base includes
ActionController::UrlFor. You can follow that module to
http://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/url_for.rb,
which has the much-used url_for method (http://github.com/rails/rails/
blob/master/actionpack/lib/action_controller/metal/url_for.rb#L28-39).
Hope this helps.
-- Yehuda
Thanks Yehuda that was of help.
m.