module Syrup::Relations::InstanceMethods

Public Instance Methods

build_relations() click to toggle source
# File lib/syrup/relations.rb, line 47
def build_relations
  self.class.relations.each do |klass|
    self.send "#{klass}=", klass.to_s.camelize.constantize.new
  end
end
find_relations(params) click to toggle source
# File lib/syrup/relations.rb, line 53
def find_relations(params)
  self.class.relations.each do |klass|
    if params[klass]
      self.send "#{klass}=", klass.to_s.camelize.constantize.find(params[klass])
    end
  end
end