item_controller.rb 264 B

1234567891011121314
  1. class ItemController
  2. def self.edit_item(app)
  3. item_hash = Item.from_form(app)
  4. if item = Item.find_by(edit_url: item_hash["edit_url"])
  5. item.update(item_hash)
  6. item.reload
  7. else
  8. item = Item.create(item_hash)
  9. end
  10. item
  11. end
  12. end