Skip to content

Instantly share code, notes, and snippets.

View danahern's full-sized avatar

Dan Ahern danahern

View GitHub Profile
def listings_tab
conditions = ["dealership_id in (?)", "listing_status_id in (?)"]
condition_args = []
@dealerships = (User.find(params[:user_id]).all_dealerships rescue current_user.all_dealerships)
if params[:conditions]
condition_args << (params[:conditions][:dealership_id].blank? ? @dealerships.map(&:id) : params[:conditions][:dealership_id])
condition_args << (params[:conditions][:listing_status_id].blank? ? 1 : params[:conditions][:listing_status_id])
params[:conditions].delete_if{|k,v| k == "dealership_id" || k == "listing_status_id"}.each do |key, value|
if key == "inventory_age"
if value.include?("Over ")
<% if false %>
<ul>
<% ["0-15 days", "16-30 days", "31-45 days", "46-60 days", "61-75 days", "76-90 days", "Over 90 days"].each do |time_frame| %>
<li><%= check_box_tag "conditions[inventory_age][]", time_frame, false, {} %><label><%= time_frame %></label></li>
<% end %>
</ul>
<% end %>
<%=checkbox_funk ["0-15 days", "16-30 days", "31-45 days", "46-60 days", "61-75 days", "Over 75 days", "All", "0-15 days"]%>
top - 17:25:34 up 83 days, 55 min, 2 users, load average: 82.39, 72.90, 56.34
Tasks: 245 total, 72 running, 173 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 99.9%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3107024k total, 2987900k used, 119124k free, 216k buffers
Swap: 2031608k total, 2031608k used, 0k free, 2896k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
24995 root 21 0 573m 371m 296 R 2 12.2 13:37.20 /usr/bin/ruby /usr/bin/mongrel_rails start -d -e production -p 8006 -P tmp/pids/mongrel.8006.pid -l log/mongrel.8006.log
25028 root 18 0 496m 248m 316 R 17 8.2 15:06.16 /usr/bin/ruby /usr/bin/mongrel_rails start -d -e production -p 8017 -P tmp/pids/mongrel.8017.pid -l log/mongrel.8017.log
NameError in Dealerships#existing_promotion
Showing app/views/dealerships/existing_promotion.rhtml where line #15 raised:
undefined local variable or method `dealership' for #<#<Class:0x416c340>:0x416c318>
Extracted source (around line #15):
12: <label for='dealers_<%=dealership.id%>' ><%= dealership.companyname %><%= check_box(:dealers, dealership.id, {:checked => true, 'onchange' => remote_function(:url => { :controller => "dealership", :action => "update_promotion_prices"}, :with => 'Form.serialize(this.form)')}) %></label> (<%= number_to_currency(dealership.listing_type.cost) %>)<br/>
13: <% end %>
D:\helpdesk\charts
D:\helpdesk\client
D:\helpdesk\dbserver
D:\helpdesk\install
D:\helpdesk\login
D:\helpdesk\report
D:\helpdesk\tmp
D:\helpdesk\filelisting.bat
D:\helpdesk\debug.txt
D:\helpdesk\filelisting.txt
ActionView::TemplateError occurred in credit_cards#confirmation_page:
"Expected /usr/motors/app/models/credit_card.rb to define CreditCard"
On line #62 of app/views/notifier/purchase_conf_en.rhtml
59: <td align='left' colspan='2'>
60: <hr/>
61: </td>
62: </tr><% unless @purchase_log.credit_card.blank? %>
63: <tr>
> news = New.new
=> #<New:0x2228038 @attributes={"pillar_type_id"=>nil, "created_on"=>nil, "title"=>nil, "updated_on"=>nil, "content"=>nil, "user_id"=>nil, "image"=>nil}, @new_record=true>
>> news.title = 'test'
=> "test"
>> news.content = 'test'
=> "test"
>> news.id = 500
=> 500
>> news
=> #<New:0x2228038 @attributes={"pillar_type_id"=>nil, "created_on"=>nil, "title"=>"test", "updated_on"=>nil, "id"=>500, "content"=>"test", "user_id"=>nil, "image"=>nil}, @new_record=true>
1 2 3 4 5 6 7
( 0.069718) ( 0.246261) ( 0.763173) ( 1.081057) ( 1.574744) ( 1.764654) ( 5.048611)
( 0.062034) ( 0.334867) ( 0.783565) ( 1.088744) ( 1.369428) ( 1.804560) ( 5.307273)
( 0.061823) ( 0.280887) ( 0.805867) ( 1.196155) ( 1.522185) ( 1.819005) ( 5.335199)
( 0.063819) ( 0.237121) ( 0.785245) ( 1.142058) ( 1.574173) ( 1.831318) ( 7.042763)
( 0.064455) ( 0.366056) ( 0.793258) ( 1.257599) ( 1.582396) ( 2.012746) ( 5.352294)
( 0.058928) ( 0.230666) ( 0.644446) ( 1.080747) ( 1.524916) ( 1.789132) ( 5.020250)
( 0.162462) ( 0.227316) ( 0.764695) ( 1.086052) ( 1.534200) ( 1.756733) ( 4.963422)
( 0.062698) ( 0.228166) ( 0.767579) ( 1.223117) ( 1.553063) ( 1.758404) ( 4.969319)
( 0.060097) ( 0.355434) ( 0.784113) ( 1.080691) ( 1.556533) ( 1.779492) ( 5.002753)
offset = 0
time_started = Time.now
while !(listings = Listing.find(:all, :conditions => ["dealership_reference_number is not null and dealership_id is not null and created_on < ?", '2009-02-01'], :limit => 1000, :offset => offset*1000)).blank? do
time_elapsed = Time.now-time_started
puts offset.to_s+": "+time_elapsed.to_s
offset += 1
time_started = Time.now
end
module UpillarCategorization
def self.included(base)
base.extend ClassMethods
base.instance_eval do
belongs_to :seller, :polymorphic => true
include InstanceMethods
end
end
module ClassMethods