Skip to content

Instantly share code, notes, and snippets.

@luciuschoi
Created October 2, 2016 06:54
Show Gist options
  • Save luciuschoi/c0007b6bbd6513533cff4a2a29333cc0 to your computer and use it in GitHub Desktop.
Save luciuschoi/c0007b6bbd6513533cff4a2a29333cc0 to your computer and use it in GitHub Desktop.
환불요청 상태 표시
<div class="iux-has-hover iu-cell cell-136">
<% if @event.refund_requested_by?(current_user) %>
<%= link_to '환불 신청하기', refund_event_path(@event) %>
<% else %>
<%= link_to '환불 신청이 완료됨', '#' %>
<% end %>
</div>
@luciuschoi
Copy link
Author

class Event < ActiveRecord::Base
...
  def refund_requested_by?(user)
    !!user.event_refunds.where(event_id: id).first
  end
...
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment