Created
March 24, 2010 20:49
-
-
Save LRDesign/342778 to your computer and use it in GitHub Desktop.
Revisions
-
LRDesign created this gist
Mar 24, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # doesn't include any joins from the :include => eager load call! Payment Load (0.3ms) SELECT * FROM `payments` WHERE (`payments`.`paid_at` BETWEEN '2010-03-01 00:00:00' AND '2010-03-31 23:59:59') ORDER BY paid_at ASC 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ class Admin::PaymentsController < Admin::AdminController def index if params[:date] @show_only = DateTime.new(params[:date]['show_only(1i)'].to_i, params[:date]['show_only(2i)'].to_i) conditions = { :paid_at => (@show_only.beginning_of_month..@show_only.end_of_month) } joins = :cart order = 'paid_at ASC' @payments = Payment.find(:all, :conditions => conditions, :order => order, :include => joins).paginate else @payments = Payment.paginate :order => 'paid_at DESC', :page => params[:page] end end def show 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ class Cart < ActiveRecord::Base belongs_to :person has_many :event_registrations, :dependent => :destroy has_many :membership_applications, :dependent => :destroy has_one :payment, :dependent => :destroy 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ class Payment < ActiveRecord::Base belongs_to :cart end