Sha256: b565d5eba274d5ec54b5399ff80a589e0a9f83199e2c868ad509179a9bd8ddd2
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require "active_support/concern" module Protobuf module ActiveRecord module MassAssignmentSecurity module Persistence extend ::ActiveSupport::Concern module ClassMethods # :nodoc: def create(attributes, options = {}) attributes = attributes_from_proto(attributes) if attributes.is_a?(::Protobuf::Message) super(attributes, options) end # :nodoc: def create!(attributes, options = {}) attributes = attributes_from_proto(attributes) if attributes.is_a?(::Protobuf::Message) super(attributes, options) end end # :nodoc: def assign_attributes(attributes, options = {}) attributes = attributes_from_proto(attributes) if attributes.is_a?(::Protobuf::Message) super(attributes, options) end # :nodoc: def update_attributes(attributes, options = {}) attributes = attributes_from_proto(attributes) if attributes.is_a?(::Protobuf::Message) super(attributes, options) end # :nodoc: def update_attributes!(attributes, options = {}) attributes = attributes_from_proto(attributes) if attributes.is_a?(::Protobuf::Message) super(attributes, options) end end # Override Active Record's initialize method so it can accept a protobuf # message as it's attributes. # :noapi: def initialize(*args, &block) args[0] = attributes_from_proto(args.first) if args.first.is_a?(::Protobuf::Message) super(*args, &block) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
protobuf-activerecord-3.6.1 | lib/protobuf/active_record/mass_assignment_security/persistence.rb |