I would propose you to go with something like this:
@book = Book.find(params[:id])
if @book.update_attributes(params[:book])
redirect_to books_path, :notice => "You have checked #{@book.checked_out ? 'out the book' : 'the book back in'}"
else
render :action => 'show'
end
end
Or if you still want to use method from model:
@book = Book.find(params[:id])
if @book.update_attributes(params[:book])
redirect_to books_path, :notice => @book.checek_message
else
render :action => 'show'
end
end
# book model
def check_message
book.check_out ? 'You have checked out the book' : 'you have checked the book back in'
end