Wrap text
Report abuse
controller action
|
|
# params = {
# :model => 'car-model',
# :id => '1',
# :attributes => {
# :name => 'Ford',
# },
# }
def update
klass = params[:model].underscore.classify.constantize
model = klass.find(params[:id])
if model.update_attributes(params[:attributes])
# success
else
# failure
end
end
|
model
|
|
class CarModel
# attributes => [:name]
end
|