Module: Tagalong

Defined in:
lib/tagalong/tagger.rb,
lib/tagalong/sunspot.rb,
lib/tagalong/version.rb,
lib/tagalong/taggable.rb,
lib/tagalong/exceptions.rb,
lib/tagalong/tag_manager.rb,
lib/tagalong/tagalong_tag.rb,
lib/tagalong/tagalong_tagging.rb,
lib/generators/tagalong/migration/migration_generator.rb

Defined Under Namespace

Modules: Taggable, Tagger Classes: MigrationGenerator, TagAlreadyInUse, TagCannotBeBlank, TagManager, TagNotFound, TagalongTag, TagalongTagging, TaggableNotPersisted

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.enable_sunspotObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tagalong/sunspot.rb', line 9

def self.enable_sunspot
  Sunspot::Adapters::InstanceAdapter.register(Sunspot::Rails::Adapters::ActiveRecordInstanceAdapter, ActiveRecord::Base)
  Sunspot::Adapters::DataAccessor.register(Sunspot::Rails::Adapters::ActiveRecordDataAccessor, ActiveRecord::Base)
  ActiveRecord::Base.module_eval { include(Sunspot::Rails::Searchable) }
  Tagalong::TagalongTag.searchable do
    integer :tagger_id
    integer :number_of_references
    string :tagger_type
    text :name
  end
end

.reindex_sunspotObject



25
26
27
# File 'lib/tagalong/sunspot.rb', line 25

def self.reindex_sunspot
  Tagalong::TagalongTag.reindex
end

.sunspot_enabled?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/tagalong/sunspot.rb', line 21

def self.sunspot_enabled?
  Tagalong::TagalongTag.searchable? ? true : false
end