instance method
destroy
Ruby on Rails 2.12.0
Since v2.11.5 Last seen in v2.14.1Signature
destroy()
No documentation comment.
Source
# File lib/generators/rails/templates/controller.rb, line 56
def destroy
@<%= orm_instance.destroy %>
respond_to do |format|
format.html { redirect_to <%= index_helper %>_url, notice: <%= %("#{human_name} was successfully destroyed.") %> }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_<%= singular_table_name %>
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
end
# Only allow a list of trusted parameters through.
def <%= "#{singular_table_name}_params" %>
<%- if attributes_names.empty? -%>
params.fetch(<%= ":#{singular_table_name}" %>, {})
<%- else -%>
params.require(<%= ":#{singular_table_name}" %>).permit(<
Defined in lib/generators/rails/templates/controller.rb line 56
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object