Sha256: acd1d2e2d6d4a4fcb25829871756657d58cac193f5b626e52532afb3556390b2

Contents?: true

Size: 410 Bytes

Versions: 4

Compression:

Stored size: 410 Bytes

Contents

module Binda
  class Binding < ApplicationRecord

  	# Associations
  	belongs_to :asset
  	belongs_to :gallery

		# Validations
		validates :name, presence: true

  	# Slug
		extend FriendlyId
		friendly_id :name, use: [:slugged, :finders]


		# CUSTOM METHODS
		# --------------
	  # https://github.com/norman/friendly_id/issues/436
	  def should_generate_new_friendly_id?
	    slug.blank?
	  end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
binda-0.0.6 app/models/binda/binding.rb
binda-0.0.5 app/models/binda/binding.rb
binda-0.0.3 app/models/binda/binding.rb
binda-0.0.2 app/models/binda/binding.rb