Use the following link in a new
and edit
view:
link_to 'Cancel', @cat
- In the
new
view:@cat.new_record?
istrue
and the link points to the index page - In the
edit
view:@cat.persisted?
istrue
and the link points to the show view of the model