On Sun, Jun 7, 2009 at 4:24 AM, Charlie Bowman<charlesmbow...@gmail.com> wrote: > On Jun 6, 2009, at 10:02 PM, Zach Dennis <zach.den...@gmail.com> wrote:
>> For example, if I need to display a piece of information for an admin, >> but not a normal user then I have no problem doing the "if >> current_user.admin?" check in a view: >> >> <% if current_user.admin? %> >> Foo bar baz >> <% end > > def foo_message > "foo bar baz" if current_user.admin? > end > > That's how I handle that. If for no other reason but easier testing. But that refactoring is less intention revealing since it hides the fact than only admins will see that message. If I couldn't come up with a better name for foo_message which revealed that, I'd probably prefer leaving the if test in the view. Resolving the tensions between things like "dumb views" and "intention revealing names" is why they pay us the big bucks! <G> -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users