lib/active_resource/associations.rb in embark-journey-0.0.6 vs lib/active_resource/associations.rb in embark-journey-0.0.7

- old
+ new

@@ -2,15 +2,15 @@ module Builder autoload :Association, 'active_resource/associations/builder/association' autoload :HasMany, 'active_resource/associations/builder/has_many' autoload :HasOne, 'active_resource/associations/builder/has_one' - autoload :BelongsTo, 'active_resource/associations/builder/belongs_to' + # autoload :BelongsTo, 'active_resource/associations/builder/belongs_to' + require_relative 'associations/builder/belongs_to' end - # Specifies a one-to-many association. # # === Options # [:class_name] # Specify the class name of the association. This class name would @@ -138,9 +138,15 @@ define_method("#{method_name}=") do |obj| instance_variable_set(ivar_name, obj) attributes["#{method_name}_id"] = obj.try(:id) end + end + + attr_accessor :embeds + def defines_belongs_to_embed(method_name, association_model) + self.embeds ||= [] + self.embeds << method_name end def defines_has_many_finder_method(method_name, association_model) ivar_name = :"@#{method_name}"