Hi, I want to display a drop down list of categories from my database, and
I want to give a link to delete the selected category in drop down list. I
have written the following code, but its not working, please help me out
How to delete a drop down select value by using link_to option.
*My code is:*
*index.html.erb*
<%= collection_select(:catvalue, :id, @catvalues, :id, :v_name, {}, class:
'drop-down')%>
<%= link_to 'Destroy', {:catvalue => :id},method: :delete, data:
{ confirm: 'Are you sure?' } %>
and my
*controller is:*
class CatvaluesController < ApplicationController
def index
@catvalue = Catvalue.new
@catvalues = Catvalue.all
@categories = Category.all
end
def destroy
@catvalue_del = Catvalue.find(params[:id])
@catvalue_del.destroy
redirect_to catvalues_path
endend
but its not working
please help me..
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-core+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.