Module: SimpleSlug::ModelAddition::InstanceMethods

Defined in:
lib/simple_slug/model_addition.rb

Instance Method Summary collapse

Instance Method Details

#should_generate_new_slug?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/simple_slug/model_addition.rb', line 66

def should_generate_new_slug?
  simple_slug_adapter.column_names.any?{|cn| send(cn).blank? }
end

#simple_slug_generate(force = false) ⇒ Object



70
71
72
# File 'lib/simple_slug/model_addition.rb', line 70

def simple_slug_generate(force=false)
  simple_slug_adapter.generate(self, force: force)
end

#to_paramObject



62
63
64
# File 'lib/simple_slug/model_addition.rb', line 62

def to_param
  simple_slug_adapter.get_prev(self).presence || super
end