Module: ActsAsBookable::Booker::ClassMethods

Defined in:
lib/acts_as_bookable/booker.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_booker(opts = {}) ⇒ Object

Make a model a booker. This allows an instance of a model to claim ownership of bookings.

Example:

class User < ActiveRecord::Base
  acts_as_booker
end


16
17
18
19
20
21
22
23
# File 'lib/acts_as_bookable/booker.rb', line 16

def acts_as_booker(opts={})
  class_eval do
    has_many :bookings, as: :booker, dependent: :destroy, class_name: '::ActsAsBookable::Booking'
  end

  include ActsAsBookable::Booker::InstanceMethods
  extend ActsAsBookable::Booker::SingletonMethods
end

#booker?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/acts_as_bookable/booker.rb', line 25

def booker?
  false
end