Sha256: 6d3a6d929eb18f2d8e2c12b0500e9623a9aac8909ae839305fd91fdcc89b565c

Contents?: true

Size: 423 Bytes

Versions: 28

Compression:

Stored size: 423 Bytes

Contents

Party.class_eval do
  has_many :website_party_roles, :dependent => :destroy
  has_many :websites, :through =>:website_party_roles do
    def owned
      where('role_type_id = ?',RoleType.website_owner).collect(&:website)
    end
  end

  def add_website_with_role(website, role_type)
    self.website_party_roles << WebsitePartyRole.create(:website => website, :role_type => role_type)
    self.save
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
knitkit-3.2.0 app/models/extensions/party.rb
knitkit-3.0.0 app/models/extensions/party.rb
knitkit-2.1.15 app/models/extensions/party.rb
knitkit-2.1.14 app/models/extensions/party.rb
knitkit-2.1.13 app/models/extensions/party.rb
knitkit-2.1.12 app/models/extensions/party.rb
knitkit-2.1.11 app/models/extensions/party.rb
knitkit-2.1.10 app/models/extensions/party.rb
knitkit-2.1.9 app/models/extensions/party.rb
knitkit-2.1.8 app/models/extensions/party.rb
knitkit-2.1.7 app/models/extensions/party.rb
knitkit-2.1.6 app/models/extensions/party.rb
knitkit-2.1.5 app/models/extensions/party.rb
knitkit-2.1.4 app/models/extensions/party.rb
knitkit-2.1.3 app/models/extensions/party.rb
knitkit-2.1.2 app/models/extensions/party.rb
knitkit-2.1.1 app/models/extensions/party.rb
knitkit-2.1.0 app/models/extensions/party.rb
knitkit-2.0.11 app/models/extensions/party.rb
knitkit-2.0.10 app/models/extensions/party.rb