Displaying 2 results from an estimated 2 matches for "add_vote".
2006 Apr 10
4
Best way to propogate model rules to controller?
Hey everybody,
I''ve got a model that represents kind of a turn-based games. Certain
actions can only be made unders certain conditions. For simplicity,
we''ll say that the only condition for a particular action is that the
weekday be Tuesday.
def add_vote
raise ''You cannot vote 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 bo...
2006 Feb 19
0
looking for more idiomatic way of doing this
...action => "delete_vote" %>
<%= hidden_field_tag :id, @proposal.id%>
<%= submit_tag "Remove Vote", ''class'' => "button" %>
<%= end_form_tag %>
<% else %>
<%= start_form_tag :action => "add_vote" %>
<%= hidden_field_tag :id, @proposal.id%>
<%= submit_tag "Vote For Proposal", ''class'' => "button" %>
<%= end_form_tag %>
<% end %>
</div>
This works but is kind of ugly. Wondering if anyone has an...