Jelajahi Sumber

Stop requiring files that is to be autoloaded.

cf. https://github.com/rails/rails/issues/15767

Back out the move `load_types_in`, which was innocent because it does
not load anything.

Have to make sure #502 does not recur.
Akinori MUSHA 10 tahun lalu
induk
melakukan
a6c16f07ac
2 mengubah file dengan 2 tambahan dan 8 penghapusan
  1. 2 6
      app/models/agent.rb
  2. 0 2
      app/models/event.rb

+ 2 - 6
app/models/agent.rb

@@ -1,6 +1,3 @@
-require 'json_serialized_field'
-require 'assignable_types'
-require 'markdown_class_attributes'
 require 'utils'
 
 # Agent is the core class in Huginn, representing a configurable, schedulable, reactive system with memory that can
@@ -18,6 +15,8 @@ class Agent < ActiveRecord::Base
 
   markdown_class_attributes :description, :event_description
 
+  load_types_in "Agents"
+
   SCHEDULES = %w[every_1m every_2m every_5m every_10m every_30m every_1h every_2h every_5h every_12h every_1d every_2d every_7d
                  midnight 1am 2am 3am 4am 5am 6am 7am 8am 9am 10am 11am noon 1pm 2pm 3pm 4pm 5pm 6pm 7pm 8pm 9pm 10pm 11pm never]
 
@@ -404,9 +403,6 @@ class Agent < ActiveRecord::Base
     end
     handle_asynchronously :async_check
   end
-
-  # Finally load all agent classes after necessary class methods are defined.
-  load_types_in "Agents"
 end
 
 class AgentDrop

+ 0 - 2
app/models/event.rb

@@ -1,5 +1,3 @@
-require 'json_serialized_field'
-
 # Events are how Huginn Agents communicate and log information about the world.  Events can be emitted and received by
 # Agents.  They contain a serialized `payload` of arbitrary JSON data, as well as optional `lat`, `lng`, and `expires_at`
 # fields.