On 6 July 2010 21:38, Marnen Laibow-Koser <[email protected]> wrote:
> Jeff Cohen wrote:
> [...]
>> Good question.  Methods in controllers are considered actions only if
>> they're connected to a url.
>
> That's not true at all.  For example, if you have
>
> class PlaysController < ApplicationController
>  def write_shakespeare
>  ...
>  end
> end
>
> then (unless I'm badly mistaken) you can get to the write_shakespeare
> method by (say) calling
>
> redirect_to :controller => 'plays', :action => 'write_shakespeare'
>
> regardless of what's in your routes file.  There may not be a direct URL
> to that action, but that doesn't prevent it from being an action.

In fact would it be true to say that no method of a controller is
inherently an action or not an action?  An action is a verb not a noun
so it is not correct to say that a method is or is not an action.   An
action (initiated via a url or redirect_to for example) results in
calling a method of a controller and it is under these circumstances
that the filters are called.  Calling a method directly from code will
not result in filters being called.

Colin

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to