Sha256: 27dbbb96b244453f84c17ca1acc6f681b3f4c12ca2dae68a5ed9fa1c3e23f90b

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 Bytes

Contents

module Droom
  class Organisation < ActiveRecord::Base
    attr_accessible :name, :description, :created_by, :owner, :url
    has_many :people
    belongs_to :owner, :class_name => 'Droom::Person'
    belongs_to :created_by, :class_name => 'Droom::User'

    def self.for_selection
      organisations = self.order("name asc").map{|f| [f.name, f.id] }
      organisations.unshift(['', ''])
      organisations
    end

    def url_with_protocol
      url =~ /^https?:\/\// ? url : "http://#{url}"
    end

    def url_without_protocol
      url.sub(/^https?:\/\//, '')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
droom-0.4.3 app/models/droom/organisation.rb
droom-0.4.2 app/models/droom/organisation.rb
droom-0.4.1 app/models/droom/organisation.rb
droom-0.2.1 app/models/droom/organisation.rb