i have table pro_categories and i am handle add update from admins
controller but can not destroy record from there i mean using admin
controller
What happens when you try ?
Fred
it’s url is like this http://127.0.0.1:3000/pro_categories/1 but i have
no pro_categories controller so i want to define this delete method in
admin controller and i want to delete pro_categories’s record.(actually
i have procategorie model.)
it’s url is like thishttp://127.0.0.1:3000/pro_categories/1but i have
no pro_categories controller so i want to define this delete method in
admin controller and i want to delete pro_categories’s record.(actually
i have procategorie model.)
either fiddle with your routes so that you have an admin namespace (so
that you can do stuff like link_to ‘destroy’, admin_product_path
§, …) or don’t use the restful stuff.
it’s url is like thishttp://127.0.0.1:3000/pro_categories/1but i have
no pro_categories controller so i want to define this delete method in
admin controller and i want to delete pro_categories’s record.(actually
i have procategorie model.)
either fiddle with your routes so that you have an admin namespace (so
that you can do stuff like link_to ‘destroy’, admin_product_path
§, …) or don’t use the restful stuff.
Fred
ok dear i have to fix this problem
in destroy code like this
<%= link_to ‘Destroy’,:confirm => ‘Are you sure?’,:action =>
‘destroycat’,:id => p.id, :method => :delete %>
p.id it take only id only p take pro_categories so that if we r make
such type it is possible
and controller file like this
def destroycat @pro_categorie = ProCategorie.find(params[:id]) @pro_categorie.destroy
respond_to do |format|
format.html { redirect_to(admins_url) }
format.xml { head :ok }
end
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.