Module: Backframe::ActsAsResource::Actions::Edit

Defined in:
lib/backframe/actioncontroller/acts_as_resource/actions.rb

Instance Method Summary collapse

Instance Method Details

#editObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/backframe/actioncontroller/acts_as_resource/actions.rb', line 34

def edit
  json = {}
  self.class.resource_opts[:allowed].each do |attribute|
    if(attribute.is_a?(Hash))
      attribute.each do |key,val|
        json[key] = @item.send(key)
      end
    else
      json[attribute] = @item.send(attribute)
    end
  end
  render json: json
end