Class: Tuttle::RailsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Tuttle::RailsController
- Defined in:
- app/controllers/tuttle/rails_controller.rb
Instance Method Summary collapse
- #assets ⇒ Object
- #controllers ⇒ Object
- #database ⇒ Object
- #helpers ⇒ Object
- #index ⇒ Object
- #instrumentation ⇒ Object
- #models ⇒ Object
- #routes ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#assets ⇒ Object
34 35 36 37 |
# File 'app/controllers/tuttle/rails_controller.rb', line 34 def assets @sprockets = Rails.application.assets @engines = @sprockets.instance_variable_get(:@engines) end |
#controllers ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/tuttle/rails_controller.rb', line 11 def controllers # TODO: Both ObjectSpace and .descendants approaches have issues with class reloading during development # It seems likely that .descendants will work best when Tuttle and Rails classes are not modified # but both approaches also require eager_load to be true # @controllers = ObjectSpace.each_object(::Class).select {|klass| klass < ActionController::Base } @controllers = ActionController::Base.descendants @controllers.reject! {|controller| controller <= Tuttle::ApplicationController || controller.abstract?} @controllers.sort_by!(&:name) end |
#database ⇒ Object
26 27 28 |
# File 'app/controllers/tuttle/rails_controller.rb', line 26 def database @conn = ActiveRecord::Base.connection end |
#helpers ⇒ Object
30 31 32 |
# File 'app/controllers/tuttle/rails_controller.rb', line 30 def helpers @helpers = ::ApplicationController.send(:modules_for_helpers,[:all]) end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/tuttle/rails_controller.rb', line 7 def index Rails::Generators.lookup! if Rails::Generators.subclasses.empty? end |
#instrumentation ⇒ Object
46 47 48 49 |
# File 'app/controllers/tuttle/rails_controller.rb', line 46 def instrumentation @events = Tuttle::Engine.events @event_counts = Tuttle::Engine.event_counts end |
#models ⇒ Object
21 22 23 24 |
# File 'app/controllers/tuttle/rails_controller.rb', line 21 def models @models = ActiveRecord::Base.descendants @models.sort_by!(&:name) end |
#routes ⇒ Object
39 40 41 42 43 44 |
# File 'app/controllers/tuttle/rails_controller.rb', line 39 def routes @routes = Rails.application.routes.routes.collect do |route| ActionDispatch::Routing::RouteWrapper.new(route) end # TODO: include engine-mounted routes end |