Sha256: b88c3d77274d60d1ea4ef63d17cab6509cefa44bd3088557a790c6a6bdc8b1da

Contents?: true

Size: 745 Bytes

Versions: 29

Compression:

Stored size: 745 Bytes

Contents

require 'has_vcards/railtie' if defined?(::Rails::Railtie)

module HasVcardsClassMethods
  def has_vcards(options = {})
    class_eval <<-end_eval
      scope :by_name, lambda {|name| {:include => :vcard, :order => 'vcards.full_name', :conditions => Vcard.by_name_conditions(name)}}

      has_one :vcard, :as => 'object', :autosave => true, :validate => true
      delegate :full_name, :nickname, :family_name, :given_name, :additional_name, :honorific_prefix, :honorific_suffix, :to => :vcard
      delegate :full_name=, :nickname=, :family_name=, :given_name=, :additional_name=, :honorific_prefix=, :honorific_suffix=, :to => :vcard
      
      has_many :vcards, :as => 'object', :autosave => true, :validate => true
    end_eval
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
has_vcards-0.13.2 lib/has_vcards.rb
has_vcards-0.13.1 lib/has_vcards.rb
has_vcards-0.13.0 lib/has_vcards.rb
has_vcards-0.12.9 lib/has_vcards.rb
has_vcards-0.12.8 lib/has_vcards.rb
has_vcards-0.12.7 lib/has_vcards.rb
has_vcards-0.12.6 lib/has_vcards.rb
has_vcards-0.12.5 lib/has_vcards.rb
has_vcards-0.12.4 lib/has_vcards.rb
has_vcards-0.11.1 lib/has_vcards.rb
has_vcards-0.12.3 lib/has_vcards.rb
has_vcards-0.12.2 lib/has_vcards.rb
has_vcards-0.12.1 lib/has_vcards.rb
has_vcards-0.12.0 lib/has_vcards.rb
has_vcards-0.11.0 lib/has_vcards.rb
has_vcards-0.10.0 lib/has_vcards.rb
has_vcards-0.9.0 lib/has_vcards.rb
has_vcards-0.8.1 lib/has_vcards.rb
has_vcards-0.8.0 lib/has_vcards.rb
has_vcards-0.7.2 lib/has_vcards.rb