Getting errors in cached environment on destroy

I have a project that is having some issues in clearing cache files in
any environment that allows for data caching.

This is the error that I am getting:
ArgumentError in Admin/pagesController#destroy

wrong number of arguments (1 for 0)
RAILS_ROOT: /Users/chris/Documents/Projects/Rails/app

Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/observer.rb:157:in
after_destroy' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/observer.rb:157:insend’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/observer.rb:157:in
update' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:338:innotify’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:302:in
callback' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:296:indestroy_without_transactions’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:104:in
destroy' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:intransaction’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in
transaction' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:intransaction’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:104:in
destroy' app/controllers/admin/pages_controller.rb:41:indestroy’

=================
Here is my controller code:

class Admin::PagesController < ApplicationController
before_filter :login_required_for_staff_member, :find_account
layout “admin”

def destroy
@page = @account.pages.find(params[:id])
if @page.destroy
flash[:success] = “The page was deleted”
redirect_to admin_pages_url
else
render :action => “index”
end
end

Any ideas?

Thanks for the help.

Show us your model code please, specificially whatever is calling
after_destroy.

On Thu, May 22, 2008 at 6:07 AM, Chris O. <
[email protected]> wrote:

Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:338:in

`destroy’
@page = @account.pages.find(params[:id])
Thanks for the help.

Posted via http://www.ruby-forum.com/.


Appreciated my help?
Recommend me on Working With Rails
http://workingwithrails.com/person/11030-ryan-bigg

Unfortunately, there is nothing that is being called in the after
destroy and I don’t see anything in the acts_as_paranoid that would
cause the problem.

class Page < ActiveRecord::Base
belongs_to :account
has_many :contents
has_many :current_contents, :class_name => “Content”, :conditions =>
‘expires = false or expires_on > “#{Date.today}”’, :order => “id desc”
has_many :expired_contents, :class_name => “Content”,:conditions =>
‘expires = true and expires_on < “#{Date.today}”’, :order => “id desc”

validates_presence_of :name

acts_as_paranoid

def to_param
“#{id}-#{name.gsub(”\s", “_”)}"
end

end

:slight_smile: There was a different sweeper that was calling the after_destroy
method. I missed that one.

Thanks for the help Ryan.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs