11 ms·
Rails has a more explicit method for hiding controller methods: hide_action. It sounds like the author wants to add methods explicitly instead. You could also
by technoweenie 17y ago
Rails has a more explicit method for hiding controller methods: hide_action. It sounds like the author wants to add methods explicitly instead.
You could also use routes for this. I never use the default ':controller/:action/:id' route in my apps.
It could get around the issue of having methods that clash with Object. #profile is a hilarious one, don't try it :)
Anyways, the author makes some valid points I suppose. One suggestion to make #layout more obvious would be using ruby Method objects:
layout "foo" # loads 'layouts/foo.html.erb'
layout instance_method(:foo) # calls #foo to get the layout string
EDIT: I'm not really serious with this suggestion -- but I can see how the difference between a string and a symbol could get confusing. Fortunately, this topic is documented pretty well too: http://rails.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html#M000468 http://rails.rubyonrails.org/classes/ActionController/Layout...
- fizx 17y agoFYI, parent is Rails committer and prolific plugin author.