Class: Taggata::Persistent::FileTag
- Defined in:
- lib/taggata/persistent/file_tag.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#file_id ⇒ Object
readonly
Returns the value of attribute file_id.
-
#tag_id ⇒ Object
readonly
Returns the value of attribute tag_id.
Class Method Summary collapse
Instance Method Summary collapse
- #file ⇒ Object
-
#initialize(db, file_id, tag_id) ⇒ FileTag
constructor
A new instance of FileTag.
- #tag ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Abstract
bulk_insert, destroy, #destroy, find, find_one, find_or_create, #invalidate_cache, #save, #show
Constructor Details
#initialize(db, file_id, tag_id) ⇒ FileTag
Returns a new instance of FileTag.
7 8 9 10 11 |
# File 'lib/taggata/persistent/file_tag.rb', line 7 def initialize(db, file_id, tag_id) @file_id = file_id @tag_id = tag_id @db = db end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
5 6 7 |
# File 'lib/taggata/persistent/file_tag.rb', line 5 def db @db end |
#file_id ⇒ Object (readonly)
Returns the value of attribute file_id.
5 6 7 |
# File 'lib/taggata/persistent/file_tag.rb', line 5 def file_id @file_id end |
#tag_id ⇒ Object (readonly)
Returns the value of attribute tag_id.
5 6 7 |
# File 'lib/taggata/persistent/file_tag.rb', line 5 def tag_id @tag_id end |
Class Method Details
.new_from_hash(db, hash) ⇒ Object
32 33 34 35 36 |
# File 'lib/taggata/persistent/file_tag.rb', line 32 def self.new_from_hash(db, hash) self.new(db, hash[:file_id], hash[:tag_id]) end |
.table ⇒ Object
13 14 15 |
# File 'lib/taggata/persistent/file_tag.rb', line 13 def self.table :taggata_file_tags end |
Instance Method Details
#file ⇒ Object
17 18 19 |
# File 'lib/taggata/persistent/file_tag.rb', line 17 def file ::Taggata::Persistent::File.find_one(db, :id => file_id) end |
#tag ⇒ Object
21 22 23 |
# File 'lib/taggata/persistent/file_tag.rb', line 21 def tag ::Taggata::Persistent::Tag.find_one(db, :id => tag_id) end |
#to_hash ⇒ Object
25 26 27 28 29 30 |
# File 'lib/taggata/persistent/file_tag.rb', line 25 def to_hash { :file_id => file_id, :tag_id => tag_id } end |