public
Created

Example2

  • Download Gist
ddd_example2.rb
Ruby
1 2 3 4 5 6 7 8
def sell_book
@book = Book.find(params[:id])
if book.sold?
book.errors.add :base, "The book is already sold"
else
book.sell
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.