Skip to content

Instantly share code, notes, and snippets.

@jonpaul
Created November 22, 2011 16:36
Show Gist options
  • Save jonpaul/1386118 to your computer and use it in GitHub Desktop.
Save jonpaul/1386118 to your computer and use it in GitHub Desktop.
class Boss::ListingsController < Boss::BaseController
def destroy
@listings = Listing.where(:listing_name => CGI::unescape(params[:listing_name]))
logger.debug "this is my object #{@listings.inspect}"
@listings.destroy
redirect_to boss_listings_path, :notice => "Successfully destroyed this group of listings."
end
end
- title 'Manage Products'
%ul
- if @listings.blank?
%p
There are no products yet!
= link_to "Upload Some!", new_listing_path
- else
- @listings.each do |listing|
%li
= listing
%span= link_to "Delete This Batch", boss_listing_path(:listing_name => CGI::escape(listing)),:method => :delete, :confirm => "Are you SURE you want to delete all listings with this identifier? This cannot be undone."
Started GET "/boss/listings" for 72.64.157.228 at 2011-11-22 16:33:25 +0000
Processing by Boss::ListingsController#index as HTML
Rendered boss/listings/index.html.haml within layouts/boss (2.8ms)
Completed 500 Internal Server Error in 535ms
ActionView::Template::Error (No route matches {:controller=>"boss/listings", :action=>"destroy", :listing_name=>"Dresser+USA..csv+-+11-21-11"}):
8: - @listings.each do |listing|
9: %li
10: = listing
11: %span= link_to "Delete This Batch", boss_listing_path(:listing_name => CGI::escape(listing)),:method => :delete, :confirm => "Are you SURE you want to delete all listings with this identifier? This cannot be undone."
app/views/boss/listings/index.html.haml:11:in `block in _app_views_boss_listings_index_html_haml___2206370417852274031_57358340__526910600560357976'
app/views/boss/listings/index.html.haml:8:in `each'
app/views/boss/listings/index.html.haml:8:in `_app_views_boss_listings_index_html_haml___2206370417852274031_57358340__526910600560357976'
Mdm::Application.routes.draw do
namespace :boss do
get 'account' => 'base#account'
resources :users
resources :organizations, :only => [:edit, :update, :destroy, :show]
get 'listings' => 'listings#index'
get 'reports' => 'listings#report'
delete 'listing/:listing_name' => 'listings#destroy', :as => 'listing'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment