Sha256: 0d436190ea81d2eace2913dfd32f49ddccb97a793a014783d8a202f7f803cb24

Contents?: true

Size: 815 Bytes

Versions: 18

Compression:

Stored size: 815 Bytes

Contents

class AppContainer < ActiveRecord::Base
  attr_protected :created_at, :updated_at

  has_user_preferences

  belongs_to :user
  belongs_to :app_container_record, :polymorphic => true
  has_and_belongs_to_many :applications

  def preferences
    self.user_preferences.includes([:preference]).where('user_id = ?', self.user.id).map(&:preference)
  end

  def get_preference(preference_type_iid)
    get_user_preference(self.user, preference_type_iid)
  end

  def set_preference(preference_type_iid, preference_option_iid)
    set_user_preference(self.user, preference_type_iid, preference_option_iid)
  end

  def setup_default_preferences
    #template method
  end

  class << self
    def find_by_user(user)
      AppContainer.where('user_id = ?', user.id).first
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
erp_app-4.0.0 app/models/app_container.rb
erp_app-3.1.16 app/models/app_container.rb
erp_app-3.1.15 app/models/app_container.rb
erp_app-3.1.14 app/models/app_container.rb
erp_app-3.1.13 app/models/app_container.rb
erp_app-3.1.12 app/models/app_container.rb
erp_app-3.1.11 app/models/app_container.rb
erp_app-3.1.10 app/models/app_container.rb
erp_app-3.1.9 app/models/app_container.rb
erp_app-3.1.8 app/models/app_container.rb
erp_app-3.1.7 app/models/app_container.rb
erp_app-3.1.6 app/models/app_container.rb
erp_app-3.1.5 app/models/app_container.rb
erp_app-3.1.4 app/models/app_container.rb
erp_app-3.1.3 app/models/app_container.rb
erp_app-3.1.2 app/models/app_container.rb
erp_app-3.1.1 app/models/app_container.rb
erp_app-3.1.0 app/models/app_container.rb