semantically-taggable 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
data/lib/railtie.rb CHANGED
@@ -6,19 +6,5 @@ module SemanticallyTaggable
6
6
  rake_tasks do
7
7
  load File.join(File.dirname(__FILE__), 'tasks/import.rake')
8
8
  end
9
-
10
- unless defined? SEMANTICALLYTAGGABLE_SPECRUNNING
11
- # No idea why this loads too late if it's a railtie initializer
12
- ActiveSupport.on_load :active_record do
13
- # Workaround for semantically-taggable's habtm
14
- database_yml = File.expand_path('config/database.yml')
15
- if File.exists?(database_yml)
16
- active_record_configuration = YAML.load_file(database_yml)[Rails.env]
17
- ActiveRecord::Base.establish_connection(active_record_configuration)
18
- else
19
- raise "Please create #{database_yml} first to configure your database."
20
- end
21
- end
22
- end
23
9
  end
24
10
  end
@@ -1,5 +1,10 @@
1
1
  module SemanticallyTaggable
2
2
  require "railtie" if defined?(Rails)
3
+ # Tag has a HABTM which causes all sorts of ructions
4
+ # https://rails.lighthouseapp.com/projects/8994/tickets/6233-habtm-join-requires-an-active-connection
5
+ # So we defer the availability of tag. Hopefully nothing references it during startup.
6
+ # (this, if you hadn't guessed, is properly hacky)
7
+ autoload :Tag, "semantically_taggable/tag"
3
8
  end
4
9
 
5
10
  require 'active_record'
@@ -11,7 +16,6 @@ require "semantically_taggable/semantically_taggable/core"
11
16
  require "semantically_taggable/semantically_taggable/collection"
12
17
  require "semantically_taggable/semantically_taggable/cache"
13
18
 
14
- require "semantically_taggable/tag"
15
19
  require "semantically_taggable/synonym"
16
20
  require "semantically_taggable/tag_parentage"
17
21
  require "semantically_taggable/scheme"
@@ -27,5 +31,5 @@ if defined?(ActiveRecord::Base)
27
31
  end
28
32
 
29
33
  if defined?(ActionView::Base)
30
- # ActionView::Base.send :include, SemanticallyTaggable::TagsHelper
34
+ ActionView::Base.send :include, SemanticallyTaggable::TagsHelper
31
35
  end