@search = Welcome::Search.new(params[:search])
if @search.text.blank?
time = 3.day.ago
- @arcs = Arc.where("arcs.updated_at > ?", time).order('updated_at desc').page(nil).includes(:location)
- @pmds = Pmd.where("pmds.updated_at > ?", time).order('updated_at desc').page(nil).per(15).includes(:arc => :location)
- @vmds = Vmd.where("vmds.updated_at > ?", time).order('updated_at desc').page(nil).per(15).includes(:arc => :location)
- @xes = X.where("xes.updated_at > ?", time).order('updated_at desc').page(nil).per(15).includes(:arc => :location)
- @thumbs = Thumb.where("updated_at > ?", time).order('updated_at desc').page(nil).per(15)
- @arcs = Record::Arc.paginate(:conditions => ["arcs.updated_at > ?", time], :order => 'updated_at desc', :page => nil, :include => :location)
- @pmds = Record::Pmd.paginate(:conditions => ["pmds.updated_at > ?", time], :order => 'updated_at desc', :page => nil, :per_page => 15, :include => { :arc => :location })
- @vmds = Record::Vmd.paginate(:conditions => ["vmds.updated_at > ?", time], :order => 'updated_at desc', :page => nil, :per_page => 15, :include => { :arc => :location })
- @xes = Record::X.paginate(:conditions => ["xes.updated_at > ?", time], :order => 'updated_at desc', :page => nil, :per_page => 15, :include => { :arc => :location })
- @thumbs = Record::Thumb.paginate(:conditions => ["updated_at > ?", time], :order => 'updated_at desc', :page => nil, :per_page => 15)
++ @arcs = Record::Arc.where("arcs.updated_at > ?", time).order('updated_at desc').page(nil).includes(:location)
++ @pmds = Record::Pmd.where("pmds.updated_at > ?", time).order('updated_at desc').page(nil).per(15).includes(:arc => :location)
++ @vmds = Record::Vmd.where("vmds.updated_at > ?", time).order('updated_at desc').page(nil).per(15).includes(:arc => :location)
++ @xes = Record::X.where("xes.updated_at > ?", time).order('updated_at desc').page(nil).per(15).includes(:arc => :location)
++ @thumbs = Record::Thumb.where("updated_at > ?", time).order('updated_at desc').page(nil).per(15)
else
- @arc_search = Arc::Search.new(params[:search])
- @arcs = Arc.where(@arc_search.conditions).page(nil).order('location_id, code').per(15).includes(:location)
- @pmd_search = Pmd::Search.new(params[:search])
- @pmds = Pmd.where(@pmd_search.conditions).page(nil).per(15).includes(:arc => :location)
- @vmd_search = Vmd::Search.new(params[:search])
- @vmds = Vmd.where(@vmd_search.conditions).page(nil).per(15).includes(:arc => :location)
- @x_search = X::Search.new(params[:search])
- @xes = X.where(@x_search.conditions).page(nil).per(15).includes(:arc => :location)
- @thumb_search = Thumb::Search.new(params[:search])
- @thumbs = Thumb.where(@thumb_search.conditions).page(nil).per(15)
+ @arc_search = Record::Arc::Search.new(params[:search])
- @arcs = Record::Arc.paginate(@arc_search.find_options.merge(:page => nil, :order => 'location_id, code', :per_page => 15, :include => :location))
++ @arcs = Record::Arc.where(@arc_search.conditions).page(nil).order('location_id, code').per(15).includes(:location)
+ @pmd_search = Record::Pmd::Search.new(params[:search])
- @pmds = Record::Pmd.paginate(@pmd_search.find_options.merge(:page => nil, :per_page => 15, :include => { :arc => :location }))
++ @pmds = Record::Pmd.where(@pmd_search.conditions).page(nil).per(15).includes(:arc => :location)
+ @vmd_search = Record::Vmd::Search.new(params[:search])
- @vmds = Record::Vmd.paginate(@vmd_search.find_options.merge(:page => nil, :per_page => 15, :include => { :arc => :location }))
++ @vmds = Record::Vmd.where(@vmd_search.conditions).page(nil).per(15).includes(:arc => :location)
+ @x_search = Record::X::Search.new(params[:search])
- @xes = Record::X.paginate(@x_search.find_options.merge(:page => nil, :per_page => 15, :include => { :arc => :location }))
- @thumb_search = Thumb::Search.new(params[:search])
- @thumbs = Thumb.paginate(@thumb_search.find_options.merge(:page => nil, :per_page => 15))
++ @xes = Record::X.where(@x_search.conditions).page(nil).per(15).includes(:arc => :location)
++ @thumb_search = Record::Thumb::Search.new(params[:search])
++ @thumbs = Record::Thumb.where(@thumb_search.conditions).page(nil).per(15)
end
end