Created
November 17, 2011 17:11
-
-
Save jonpaul/1373784 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%ul | |
= @listings.inspect | |
- @listings.each do |l| | |
%li | |
= l | |
%span= link_to "Delete This Batch", boss_listing_path(l), :method => :delete, :confirm => "Are you SURE you want to delete all listings with this identifier? This cannot be undone." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Boss::ListingsController < Boss::BaseController | |
def index | |
@listings = current_user.organization.try(:listings).try(:distinct, :listing_name) | |
end | |
def destroy | |
@listings = Listing.where(:listing_name => params[:listing_name]) | |
@listings.destroy | |
redirect_to organizations_url, :notice => "Successfully destroyed this group of listings." | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionController::RoutingError in Boss/listings#index | |
Showing /Users/derek/glide_projects/mdm/app/views/boss/listings/index.html.haml where line #6 raised: | |
No route matches {:controller=>"boss/listings", :action=>"destroy", :listing_name=>""} | |
Extracted source (around line #6): | |
3: - @listings.each do |listing| | |
4: %li | |
5: = listing | |
6: %span= link_to "Delete This Batch", boss_listing_path(:listing_name => "#{listing}"),:method => :delete, :confirm => "Are you SURE you want to delete all listings with this identifier? This cannot be undone." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boss_listings GET /boss/listings(.:format) {:action=>"index", :controller=>"boss/listings"} | |
boss_listing DELETE /boss/listing/:listing_name(.:format) {:controller=>"boss/listings", :action=>"destroy"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :boss do | |
root :to => "base#index" | |
get 'account' => 'base#account' | |
resources :users | |
get 'listings' => 'listings#index' | |
delete 'listing/:listing_name' => 'listings#destroy', :as => 'listing' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment