Sha256: 590bb128403255681ffe83f63b952b01d44f30292b7ffea8a328238359a74b94
Contents?: true
Size: 904 Bytes
Versions: 3
Compression:
Stored size: 904 Bytes
Contents
module Granite module Form module Model module Associations module Reflections module Singular extend ActiveSupport::Concern module ClassMethods def generate_methods(name, target) super target.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def build_#{name} attributes = {} association(:#{name}).build(attributes) end def create_#{name} attributes = {} association(:#{name}).create(attributes) end def create_#{name}! attributes = {} association(:#{name}).create!(attributes) end RUBY end end def collection? false end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems