Methods
Instance Public methods
create_params()
Link
Source: show
# File rhino/rhino/lib/rhino/resource/active_model_extension/params.rb 10 def create_params 11 writeable_params("create") 12 end
props_by_type(type)
Link
Source: show
# File rhino/rhino/lib/rhino/resource/active_model_extension/params.rb 23 def props_by_type(type) 24 # FIXME: Direct attributes for this model we want a copy, not to 25 # alter the class_attribute itself 26 send("#{type}_properties").dup 27 end
readable_params(_type, _refs = references)
Link
FIXME: Refs are not handled
Source: show
# File rhino/rhino/lib/rhino/resource/active_model_extension/params.rb 30 def readable_params(_type, _refs = references) 31 params = [] 32 props_by_type("read").each do |prop| 33 desc = describe_property(prop) 34 35 # Generic array of scalars 36 next params << { prop => [] } if desc[:type] == :array 37 38 # Otherwise prop and param are equivalent 39 params << prop 40 end 41 42 # Display name is always allowed 43 params << "display_name" 44 end
show_params()
Link
Source: show
# File rhino/rhino/lib/rhino/resource/active_model_extension/params.rb 14 def show_params 15 readable_params("show") 16 end
update_params()
Link
Source: show
# File rhino/rhino/lib/rhino/resource/active_model_extension/params.rb 18 def update_params 19 writeable_params("update") 20 end
writeable_params(type, _refs = references)
Link
FIXME: Refs are not handled
Source: show
# File rhino/rhino/lib/rhino/resource/active_model_extension/params.rb 47 def writeable_params(type, _refs = references) 48 params = [] 49 50 props_by_type(type).each do |prop| 51 desc = describe_property(prop) 52 53 # Generic array of scalars 54 next params << { prop => [] } if desc[:type] == :array 55 56 # Otherwise prop and param are equivalent 57 # We also accept the ref name as the foreign key if its a singular resource 58 params << prop 59 end 60 61 # Allow id in if its an update so we can find the original record 62 params << identifier_property if type == "update" 63 64 params 65 end