module Muffin::Attributes
Constants
- Boolean
Attributes
attributes[R]
Public Class Methods
included(base)
click to toggle source
# File lib/muffin/frostings/attributes.rb, line 57 def self.included(base) base.extend ClassMethods end
Public Instance Methods
assign_attributes()
click to toggle source
# File lib/muffin/frostings/attributes.rb, line 53 def assign_attributes self.attributes = params end
attributes=(value)
click to toggle source
# File lib/muffin/frostings/attributes.rb, line 47 def attributes=(value) self.class.attributes.keys.map { |e| [e, nil] }.to_h.merge(value.to_h).each do |k, v| send("#{k}=", v) if self.class.attributes[k.to_sym] end end
persisted?()
click to toggle source
# File lib/muffin/frostings/attributes.rb, line 61 def persisted? attributes[:id].present? end
respond_to_missing?(method_name, include_private = false)
click to toggle source
fields_for checks wether an object responds to [foo_attributes=]
Calls superclass method
# File lib/muffin/frostings/attributes.rb, line 66 def respond_to_missing?(method_name, include_private = false) return true if method_name.to_s[/_attributes=\Z/] super end