Class: MembershipType

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
ArtfullyOseHelper
Includes:
Ext::Integrations::ServiceFee
Defined in:
app/models/membership_type.rb

Constant Summary

Constants included from Ext::Integrations::ServiceFee

Ext::Integrations::ServiceFee::SERVICE_FEE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ArtfullyOseHelper

amount_and_nongift, bootstrapped_type, build_action_path, build_order_location, channel_checkbox, channel_text, check_mark, clean_full_error_messages, contextual_menu, credit_card_message, date_field_tag, datetime_field_tag, events_to_options, fully_qualified_asset_path, get_selected_class, icon_link_to, icon_tag, link_to_add_fields, link_to_remove_fields, nav_dropdown, number_as_cents, number_to_dollars, pluralize_word, refund_header, select_event_for_sales_search, select_membership_type_for_sales_search, select_pass_type_for_sales_search, select_show_for_sales_search, sorted_us_state_abbreviations, sorted_us_state_names, thanks_message, ticket_seller_name, time_ago_sentence, time_zone_description, us_states, verb_for_save, widget_script, with_kit

Methods included from LinkHelper

#active?, #active_link_to, #active_section, #calendar_active_link_to, #in_section, #in_section?, #in_sub_section

Class Method Details

.in_play(organization) ⇒ Object



42
43
44
# File 'app/models/membership_type.rb', line 42

def self.in_play(organization)
  self.find((organization.membership_types.not_ended.pluck(:id).uniq + organization.memberships.current.select(:membership_type_id).uniq.pluck(:membership_type_id)))
end

Instance Method Details

#allow_multiple_memberships?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'app/models/membership_type.rb', line 63

def allow_multiple_memberships?
  self.limit_per_transaction > 1
end

#create_list_segmentObject



56
57
58
59
60
61
# File 'app/models/membership_type.rb', line 56

def create_list_segment
  @search = organization.searches.create({:membership_type => self})
  @segment = organization.segments.create({:search => @search, :name => self.name})
  self.segment = @segment
  save
end

#membershipizeObject



46
47
48
# File 'app/models/membership_type.rb', line 46

def membershipize
  self.name.end_with?("Membership") ? self.name : self.name + " Membership"
end

#price_for(member = nil) ⇒ Object



50
51
52
53
54
# File 'app/models/membership_type.rb', line 50

def price_for(member = nil)
  return price if member.nil?

  (offer_renewal? && member.current?) ? renewal_price : price
end