Sha256: 358b3beff91ee5d58371aeb8ec326d2a6bf0f7434799f8b541dc904d79e0bf49

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

module C80SocialNetworks
  class Link < ActiveRecord::Base

    has_and_belongs_to_many :types#, :join_table => 'c80_social_networks_links_types'
    scope :ord_asc, -> {order(:ord => :asc)}

    def type_title
      res = ''
      if self.types.count > 0
        res = self.types.first.title
      end
      res
    end

    def type_awesome_icon_code
      res = ''
      if self.types.count > 0
        res = self.types.first.awesome_icon_code
      end
      res
    end

    def type_image_url
      res = ''
      if self.types.count > 0
        if self.types.first.image.present?
          res = self.types.first.image.url
        end
      end
      res
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
c80_social_networks-0.1.0.2 app/models/c80_social_networks/link.rb