mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-16 03:41:41 +00:00
* Ensure admin attribute can not be set at sign up and the agents user_id is not changeable * Remove ACCESSIBLE_ATTRIBUTES from the User model * Remove side effect on agent_params from AgentsController#build_agent
11 lines
464 B
Ruby
11 lines
464 B
Ruby
# A Link connects Agents in a directed Event flow from the `source` to the `receiver`.
|
|
class Link < ActiveRecord::Base
|
|
belongs_to :source, :class_name => "Agent", :inverse_of => :links_as_source
|
|
belongs_to :receiver, :class_name => "Agent", :inverse_of => :links_as_receiver
|
|
|
|
before_create :store_event_id_at_creation
|
|
|
|
def store_event_id_at_creation
|
|
self.event_id_at_creation = source.events.limit(1).reorder("id desc").pluck(:id).first || 0
|
|
end
|
|
end
|