Class: Admin::TaxonsController
- Includes:
- Railslove::Plugins::FindByParam::SingletonMethods
- Defined in:
- app/controllers/admin/taxons_controller.rb
Instance Method Summary collapse
Instance Method Details
#available ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/admin/taxons_controller.rb', line 50 def available if params[:q].blank? @available_taxons = [] else @available_taxons = Taxon.find(:all, :conditions => ['lower(name) LIKE ?', "%#{params[:q].downcase}%"]) end @available_taxons.delete_if { |taxon| @product.taxons.include?(taxon) } respond_to do |format| format.html format.js {render :layout => false} end end |
#remove ⇒ Object
64 65 66 67 68 69 |
# File 'app/controllers/admin/taxons_controller.rb', line 64 def remove @product.taxons.delete(@taxon) @product.save @taxons = @product.taxons render :layout => false end |
#select ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'app/controllers/admin/taxons_controller.rb', line 71 def select @product = Product.find_by_param!(params[:product_id]) taxon = Taxon.find(params[:id]) @product.taxons << taxon @product.save @taxons = @product.taxons render :layout => false end |
#selected ⇒ Object
46 47 48 |
# File 'app/controllers/admin/taxons_controller.rb', line 46 def selected @taxons = @product.taxons end |