I have proposals and members can vote for them. In my proposal view I
have a little div
where the currently logged in member can vote:
Your vote:
<% if @member_vote %>
You have voted for this proposal
<%= start_form_tag :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 %>
<%= start_form_tag :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 %>
This works but is kind of ugly. Wondering if anyone has any more
rails-idiomatic way of
doing this?
b