lib/transit/rails/engine.rb in transit-0.0.1 vs lib/transit/rails/engine.rb in transit-0.0.2
- old
+ new
@@ -1,22 +1,38 @@
require 'rails'
-require 'transit'
+require 'paperclip'
module Transit
class Engine < Rails::Engine
+
isolate_namespace Transit
+ paths['app/models'] << 'app/models/contexts'
+ paths['app/helpers'] << 'app/helpers/transit'
- ActiveSupport.on_load(:after_initialize) do
- Transit::CONTROLLERS.dup.uniq.each do |klass|
- controller_klass = "#{klass.classify.pluralize}Controller"
- unless Transit.const_defined?(controller_klass)
- Transit.const_set(controller_klass, Class.new(Transit::PackagesController))
- end
+
+ ##
+ # After initialization, dynamically create controllers for models
+ # that have been defined in application routes.
+ #
+ initializer 'transit.generate_controllers', :after => :eager_load! do
+ gen = Transit::Controller::Generator.new(:page, :post)
+ gen.generate!
+ end
+
+ initializer 'transit.paperclip' do
+ def Paperclip.logger
+ Rails.logger
+ end
+ ::Paperclip.interpolates(:uid) do |attachment, style|
+ "#{attachment.instance.uid}"
end
+ ::Paperclip.interpolates(:normalize_name) do |attachment, style|
+ "#{attachment.instance.normalize_name(attachment, style)}"
+ end
end
-
- ActiveSupport.on_load(:action_controller) do
- helper Transit::Engine.helpers
- end
-
+
end
-end
+end
+
+require 'transit/rails/railtie'
+Sprockets::Engines
+Sprockets.register_engine '.jst', Transit::Builders::JstBuilder
\ No newline at end of file