Skip to content

Commit

Permalink
Removed r_c traces
Browse files Browse the repository at this point in the history
  • Loading branch information
romul committed Jul 6, 2011
1 parent 850ba4a commit cf5ada1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
19 changes: 4 additions & 15 deletions app/controllers/admin/store_credits_controller.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
class Admin::StoreCreditsController < Admin::BaseController
resource_controller
class Admin::StoreCreditsController < Admin::ResourceController
before_filter :check_amounts, :only => [:edit, :update]
before_filter :set_remaining_amount, :only => [:create, :update]

create.response do |wants|
wants.html { redirect_to collection_url }
end

update.response do |wants|
wants.html { redirect_to collection_url }
end

destroy.success.wants.js { render_js_for_destroy }
prepend_before_filter :set_remaining_amount, :only => [:create, :update]

private
def check_amounts
if (object.remaining_amount < object.amount)
if (@store_credit.remaining_amount < @store_credit.amount)
flash[:error] = "Can't be edit, b/c already was used."
redirect_to collection_url
redirect_to admin_store_credits_path
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users_controller_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
private

def find_orders_with_store_credit
@orders_with_store_credit = object.orders.joins(:adjustments).where(:adjustments => {:source_type => 'StoreCredit'})
@orders_with_store_credit = @user.orders.joins(:adjustments).where(:adjustments => {:source_type => 'StoreCredit'})
end
end

0 comments on commit cf5ada1

Please sign in to comment.