I have a method:

  def current_practice
    if session[:impersonating]
      Practice.find session[:impersonating]
    else
      current_user.practice
    end
  end

It is identical in both controller and helper. How could I DRY this up so I only need maintain it in one place?

I already have the line

helper:all

at the top of my ApplicationController, but when I commented out the current_practice in the controller, the one from the helper didn't step in. Maybe I'm misunderstanding what that line is meant to do.

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

Reply via email to