Reputation: 2118
To avoid physical deletion of information, I added a "is_active" flag to my Business_Rule model, and modified the destroy method the following way:
def destroy
@business_rule.set_as_inactive(current_login)
respond_to do |format|
format.html { redirect_to business_rules_url, notice: 'Business rule was successfully deleted.' }
format.json { head :no_content }
end
end
I invoke this method through a button:
<%= button_to t('Destroy'), @business_rule, confirm: t('Sure'), method: :delete, class: "buttons mid_menu" %>
Unfortunately, the confirmation does not pop-up! Thanks a lot for your ideas to solve this!
Upvotes: 1
Views: 79
Reputation: 4709
You need to use confirm in data
attribute:
<%= button_to t('Destroy'), @business_rule, data: { confirm: t('Sure') }, method: :delete, class: "buttons mid_menu" %>
Upvotes: 4