Sha256: a5d8e83f37f4034546444f077da5a455aef6c2bf2a7867583dea8fc84137ada1

Contents?: true

Size: 986 Bytes

Versions: 21

Compression:

Stored size: 986 Bytes

Contents

class Dorsale::UserScope
  attr_reader :user

  def initialize(user)
    @user = user
  end

  # Common

  def colleagues(context = nil)
    User.all
  end

  def comments
    Dorsale::Comment.all
  end

  # Flyboy

  def folders
    Dorsale::Flyboy::Folder.all
  end

  def new_folder(*args)
    folders.new(*args)
  end

  def tasks
    Dorsale::Flyboy::Task.all
  end

  def new_task(*args)
    tasks.new(*args)
  end

  # CustomerVault

  def individuals
    Dorsale::CustomerVault::Individual.all
  end

  def new_individual(*args)
    individuals.new(*args)
  end

  def corporations
    Dorsale::CustomerVault::Corporation.all
  end

  def new_corporation(*args)
    corporations.new(*args)
  end

  def people
    (individuals + corporations).sort_by { |e| e.name.downcase }
  end

  # ExpenseGun

  def expenses
    Dorsale::ExpenseGun::Expense.all
  end

  def new_expense(attributes = {})
    attributes = attributes.merge(user: user)
    expenses.new(attributes)
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
dorsale-3.0.3 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-3.0.2 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-3.0.1 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-3.0.0 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.7.3 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.7.2 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.7.1 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.7.0 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.8 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.7 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.6 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.5 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.4 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.3 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.2 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.1 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.6.0 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.5.0 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.4.3 spec/dummy/app/models/dorsale/user_scope.rb
dorsale-2.4.2 spec/dummy/app/models/dorsale/user_scope.rb