Class: Marley::Joints::Tags::Resources::Tag

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/marley/joints/tags.rb

Direct Known Subclasses

PrivateTag, PublicTag

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.list_dataset(params = {}) ⇒ Object



54
55
56
# File 'lib/marley/joints/tags.rb', line 54

def self.list_dataset(params={})
  dataset.order(:tag)
end

Instance Method Details

#actions(parent_instance) ⇒ Object



61
62
63
# File 'lib/marley/joints/tags.rb', line 61

def actions(parent_instance)
  {:delete => "#{parent_instance ? parent_instance.url : ''}#{url}"}
end

#before_saveObject



64
65
66
67
68
# File 'lib/marley/joints/tags.rb', line 64

def before_save
  super
  self.tag.downcase!
  self.tag.strip!
end

#validateObject



57
58
59
60
# File 'lib/marley/joints/tags.rb', line 57

def validate
  validates_presence :tag
  validates_unique [:tag,:user_id]
end