lib/jason.rb in jason-rails-0.7.3 vs lib/jason.rb in jason-rails-0.7.5
- old
+ new
@@ -49,10 +49,14 @@
if config != previous_schema[model]
puts "Config changed for #{model}"
puts "Old config was #{previous_schema[model]}"
puts "New config is #{config}"
puts "Rebuilding cache for #{model}"
- model.classify.constantize.cache_all
+
+ # This is necessary to ensure all Rails methods have been added to model before we attempt to cache.
+ Rails.configuration.after_initialize do
+ model.classify.constantize.cache_all
+ end
puts "Done"
end
end
$redis_jason.set('jason:last_schema', current_schema.to_json)