diff --git a/Gemfile b/Gemfile index 9c29c7bf9..fdac95d57 100644 --- a/Gemfile +++ b/Gemfile @@ -10,8 +10,10 @@ module Bundler::SharedHelpers end end -def rails4? - !!ENV["RAILS4"] +module ::Kernel + def rails4? + !!ENV["RAILS4"] + end end if rails4? @@ -36,6 +38,7 @@ if rails4? gem 'rails-observers' gem 'protected_attributes' gem 'actionpack-action_caching' + gem 'seed-fu' , github: 'mbleigh/seed-fu' else # we had pain with the 3.2.13 upgrade so monkey patch the security fix # next time around we hope to upgrade @@ -45,6 +48,7 @@ else # REVIEW EVERY RELEASE gem 'sprockets', git: 'https://github.com/SamSaffron/sprockets.git', branch: 'rails-compat' gem 'redis-rails' + gem 'seed-fu' end gem 'redis' @@ -105,7 +109,6 @@ gem 'rest-client' gem 'rinku' gem 'sanitize' gem 'sass' -gem 'seed-fu' gem 'sidekiq' gem 'sidekiq-failures' gem 'sinatra', require: nil diff --git a/Gemfile_rails4.lock b/Gemfile_rails4.lock index bcb7b7f2b..f7fdae95b 100644 --- a/Gemfile_rails4.lock +++ b/Gemfile_rails4.lock @@ -17,6 +17,14 @@ GIT redis-activesupport (>= 3.2.3) redis-store (~> 1.1.0) +GIT + remote: git://github.com/mbleigh/seed-fu.git + revision: f89ea306472c500ec7911c7be111a4aad9c1bc78 + specs: + seed-fu (2.2.0) + activerecord (>= 3.1, < 4.1) + activesupport (>= 3.1, < 4.1) + GIT remote: https://github.com/CodeMonkeySteve/fast_xor.git revision: 85b79ec6d116f9680f23bd2c5c8c2c2039d477d8 @@ -398,8 +406,6 @@ GEM railties (>= 4.0.0.beta, < 5.0) sass (>= 3.1.10) sprockets-rails (~> 2.0.0) - seed-fu (1.2.3) - rails (>= 2.1) shoulda (3.5.0) shoulda-context (~> 1.0, >= 1.0.1) shoulda-matchers (>= 1.4.1, < 3.0) @@ -547,7 +553,7 @@ DEPENDENCIES sanitize sass sass-rails - seed-fu + seed-fu! shoulda sidekiq sidekiq-failures diff --git a/app/models/topic.rb b/app/models/topic.rb index d57e539de..0bde49f43 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -51,7 +51,11 @@ class Topic < ActiveRecord::Base self.title = TextCleaner.clean_title(TextSentinel.title_sentinel(title).text) if errors[:title].empty? end - serialize :meta_data, ActiveRecord::Coders::Hstore + if rails4? + store_accessor :meta_data + else + serialize :meta_data, ActiveRecord::Coders::Hstore + end belongs_to :category has_many :posts diff --git a/config/application.rb b/config/application.rb index 9fd458820..676f7bcf6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -93,7 +93,7 @@ module Discourse # dumping rack lock cause the message bus does not work with it (throw :async, it catches Exception) # see: https://github.com/sporkrb/spork/issues/66 # rake assets:precompile also fails - config.threadsafe! unless $PROGRAM_NAME =~ /spork|rake/ + config.threadsafe! unless rails4? || $PROGRAM_NAME =~ /spork|rake/ # route all exceptions via our router config.exceptions_app = self.routes diff --git a/config/environments/development.rb b/config/environments/development.rb index cd91e41ab..11458f74a 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -7,7 +7,8 @@ Discourse::Application.configure do config.cache_classes = false # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + config.whiny_nils = true unless rails4? + config.eager_load = false if rails4? # Show full error reports and disable caching config.consider_all_requests_local = true diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e9f2a0ffc..fa5e13a3e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -49,9 +49,8 @@ Spork.prefork do Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - # let's not run seed_fu every test - SeedFu.quiet = true + SeedFu.quiet = true if SeedFu.respond_to? :quiet SeedFu.seed RSpec.configure do |config|