search for: allow_vot

Displaying 1 result from an estimated 1 matches for "allow_vot".

Did you mean: allow_vote
2006 Apr 10
4
Best way to propogate model rules to controller?
...today'' unless Date.today.wday == 2 ... end In my controller I want to show a link, but only if the user is allowed to vote. I''m wondering the best way to do this. I think the best way is to make another method, which I can call from within both the model and controller. def allow_vote? Date.today.wday == 2 end def add_vote raise ''You cannot vote today'' unless Date.today.wday == 2 ... end Then in my view I can just do <% unless game.allow_vote? %> to hide the link. In the controller actions that handle voting, I just rescue the exception and disp...