On Jan 26, 2012, at 9:51 AM, Michael Pavling wrote:

> On 26 January 2012 14:47, Walter Lee Davis <[email protected]> wrote:
>> I had it in the controller, but I didn't like the look of having to declare 
>> an instance variable inside each method that needed this (new and create and 
>> edit and update). The helper was there for the asking in each view, so it 
>> seemed DRYer. Is there a way to have my cake and eat it too?
> 
> helper_method :my_controller_method
> 
> ?

> If it is the same code in each action then set the variable in a
> before_filter in the controller.  Then it will be setup for each
> action that you specify.  Bone dry.
> 
> Colin

Thanks to both of you.

Walter

> 
> -- 
> 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.
> 

-- 
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