The third option is to make virtual attribute on the model and always
set it when needed in the controller
class Model
attr_accessor :current_user
def some_method
if current_user.admin?
#foo
else
#bar
end
end
end
class FoosController
def index
m = Model.find(...)
m.current_user = current_user
m.some_method()
end
end
Marnen: What's so 'unmaintainable' in your opinion?
Robert Pankowecki
--
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.