Sha256: a6146bbccd4e52b544b21f144fcd4e438cc4b7ae90481d21b062c9a0b7303f09
Contents?: true
Size: 612 Bytes
Versions: 20
Compression:
Stored size: 612 Bytes
Contents
# this is needed for now to make mass assignment security compatible with the translation of globalize3 # Globalize::ActiveRecord::Translation.class_eval do # attr_accessible :locale # end class Tag < ActiveRecord::Base has_many :taggings, :dependent => :destroy has_many :pages, through: :taggings translates :name scope :alphabetically, -> { order('name') } def to_param name ? "#{id}-#{name.to_url}" : id end def self.with_taggings taggings = Tagging.select("DISTINCT tag_id") ids = taggings.map { |tagging| tagging.tag_id } tags = Tag.order('name').find(ids) end end
Version data entries
20 entries across 20 versions & 1 rubygems