When I want to delete my data in database I got this error:
Unknown action
The action 'destroy' could not be found for SampleformsController
My controller destroy action code looks like this:
def destroy
@sampleform = Sampleform.find_by_id(params[:id])
if @sampleform.destroy
redirect_to sampleforms_path
end
end
again I got that same error
again I got that same error
In your SampleformsController, you need to add a destroy method:
class SampleformsController < ApplicationController
def destroy
# destroy your record here
end
end
You can find more information on this topic in the Ruby on Rails guides.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With