class Administrate::Field::HasOne
Public Class Methods
permitted_attribute(attr, options = nil)
click to toggle source
# File lib/administrate/field/has_one.rb, line 6 def self.permitted_attribute(attr, options = nil) associated_class_name = if options options.fetch(:class_name, attr.to_s.singularize.camelcase) else attr end related_dashboard_attributes = Administrate::ResourceResolver.new("admin/#{associated_class_name}"). dashboard_class.new.permitted_attributes + [:id] { "#{attr}_attributes": related_dashboard_attributes } end
Public Instance Methods
nested_form()
click to toggle source
# File lib/administrate/field/has_one.rb, line 20 def nested_form @nested_form ||= Administrate::Page::Form.new( resolver.dashboard_class.new, data || resolver.resource_class.new, ) end
Private Instance Methods
resolver()
click to toggle source
# File lib/administrate/field/has_one.rb, line 29 def resolver @resolver ||= Administrate::ResourceResolver.new("admin/#{associated_class_name}") end