fable_controller.rb 259 B

12345678910111213
  1. class FableController
  2. def self.edit_fable(params)
  3. f_hash = Fable.from_form(params)
  4. fable = Fable.find_by(edit_url: f_hash["edit_url"])
  5. if fable
  6. fable.update(f_hash)
  7. fable.reload
  8. else
  9. Fable.create(f_hash)
  10. end
  11. end
  12. end