Sha256: 52e606058fb448673d7bf2d1eeb2b50e11854b2992e2f34379f9fdaa36d15333
Contents?: true
Size: 1001 Bytes
Versions: 21
Compression:
Stored size: 1001 Bytes
Contents
class GoAction < Action has_many :tickets, :foreign_key => "validated_action_id" def show subject end def action_type "Go" end def verb "went" end def sentence #TODO: YUK. Do we still have to do this to discriminate from manually logged actions? if subject.is_a? Show verb + " " + self.details else " to a show" end end def self.for(show, person, occurred_at=nil, &block) existing_action = GoAction.where({:subject_id => show.id, :person_id => person.id}).first return existing_action || GoAction.new.tap do |go_action| go_action.person = person go_action.subject = show go_action.details = "to #{show.event.name} on #{I18n.l show.datetime_local_to_event, :format => :short}" go_action.organization = show.organization go_action.occurred_at = ( occurred_at.nil? ? show.datetime : occurred_at ) block.call(go_action) if block.present? end end def self.subtypes [] end end
Version data entries
21 entries across 21 versions & 1 rubygems