class Object

Public Class Methods

scoped_to_account() click to toggle source
# File lib/mtdevise/active_record_extensions.rb, line 3
  def self.scoped_to_account
    belongs_to :account, :class_name => "Mtdevise::Account"
    association_name = self.to_s.downcase.pluralize
    Mtdevise::Account.has_many association_name.to_sym, :class_name => self.to_s

    instance_eval <<-HERE
    def scoped_to(account)
    where(:account_id => account.id)
    end
    HERE
  end