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:in `send'' /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:in `notify'' /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:in `destroy_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:in `transaction'' /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:in `transaction'' /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:in `destroy'' ================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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg (Radar)
2008-May-22 01:04 UTC
Re: Getting errors in cached environment on destroy
Show us your model code please, specificially whatever is calling after_destroy. On Thu, May 22, 2008 at 6:07 AM, Chris Olsen < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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:in > `send'' > > /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:in > `notify'' > > /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:in > `destroy_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:in > `transaction'' > > /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:in > `transaction'' > > /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:in `destroy'' > > ================> 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. > -- > Posted via http://www.ruby-forum.com/. > > > >-- Appreciated my help? Recommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
:) There was a different sweeper that was calling the after_destroy method. I missed that one. Thanks for the help Ryan. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---