Skip to content

Instantly share code, notes, and snippets.

View kenton's full-sized avatar

Kenton Newby kenton

View GitHub Profile
@kenton
kenton / gist:2982787
Created June 24, 2012 10:42
error running rake assets:precompile in production using theme_for_rails gem
$ RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/kentonnewby/.rvm/rubies/ruby-1.9.3-p0/bin/ruby /Users/kentonnewby/.rvm/gems/ruby-1.9.3-p0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
@kenton
kenton / _sidebar.html.erb
Created July 25, 2012 13:43
issue with precompiling assets
<div id="sidebar">
<h3>Request Service:</h3>
<p>Fill out the form below to have us contact you for a quote. You'll receive a response within 1 business day.</p>
<%= simple_form_for [@account,@contact] do |f| %>
<%= f.input :first_name, :label => "First Name" %>
<%= f.input :last_name, :label => "Last Name" %>
<%= f.input :home_phone, :label => "Home Phone" %>
<%= f.input :work_phone, :label => "Work Phone" %>
<%= f.input :email, :label => "Email Address" %>
source 'https://railskits.com/gems/c2997254-9fa6-f774-f9b6-83703425ccda'
source 'http://rubygems.org'
gem 'rails', '3.2.1'
gem 'pg', "~> 0.13.2"
gem "simple_form", "~> 2.0"
gem "simplecov", ">= 0.3.5", :require => false
gem 'themes_for_rails', "~> 0.5"
gem 'annotate', "~> 2.4.0" # annotate model schema at the top of model files
Error message
Net::SMTPAuthenticationError: 535-5.7.1 Application-specific password required. Learn more at
Stack trace (show Rails)
…y/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/smtp.rb: 960:in `check_auth_response'
…y/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/smtp.rb: 737:in `auth_plain'
…y/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/smtp.rb: 729:in `authenticate'
…y/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/smtp.rb: 564:in `do_start'
1) Failure:
test_job_gets_enqueued_when_a_reservation_is_returned_inside_the_345-360_minute_window(SendOpDriverNagEmailsJobTest)
[/test/unit/send_op_driver_nag_email_job_test.rb:41:in `test_job_gets_enqueued_when_a_reservation_is_returned_inside_the_345-360_minute_window'
/Users/kentonnewby/.rvm/gems/ruby-1.8.7-p334@ldc/gems/after_commit-1.0.10/lib/after_commit/connection_adapters.rb:14:in `transaction'
/test/unit/send_op_driver_nag_email_job_test.rb:36:in `test_job_gets_enqueued_when_a_reservation_is_returned_inside_the_345-360_minute_window']:
not all expectations were satisfied
unsatisfied expectations:
- expected exactly once, not yet invoked: Resque Client connected to redis://localhost:6379/0.enqueue(any_parameters)
satisfied expectations:
- allowed any number of times, not yet invoked: Resque Client connected to redis://localhost:6379/0.enqueue(any_parameters)
if self.respond_to?(:current_user) && current_user.present?
is_operator_facing = current_user.is_operator?
elsif local_assigns[:is_operator_facing]
is_operator_facing = local_assigns[:is_operator_facing]
else
is_operator_facing = false
end
#### ... some other unrelated code ####
test 'A Lead based ad hoc charge should be applied to the selected credit card if admin selects a specific card on file with the operator' do
Operator.transaction do
operator = Operator.find(1)
cpm = operator.card_payment_methods.first
mes_response = BillingOperations.charge_single_operator(:operator_id => operator.id,
:amount => 42.42,
:is_initial_account_load => false,
:is_subscription => false,
:card_payment_method_id => cpm.id)
@kenton
kenton / gist:3919263
Created October 19, 2012 16:45
sql query
SQL (0.5ms) SET SQL_AUTO_IS_NULL=0
ReservationPricing Load Including Associations (3.6ms) SELECT `reservation_pricings`.`id` AS t0_r0, `reservation_pricings`.`version` AS t0_r1, `reservation_pricings`.`reservation_pricing_stage` AS t0_r2, `reservation_pricings`.`pricing_type` AS t0_r3, `reservation_pricings`.`reservation_request_id` AS t0_r4, `reservation_pricings`.`min_hours` AS t0_r5, `reservation_pricings`.`rate_hours` AS t0_r6, `reservation_pricings`.`priced_base_hours` AS t0_r7, `reservation_pricings`.`priced_base_expanded` AS t0_r8, `reservation_pricings`.`priced_base_drive_time` AS t0_r9, `reservation_pricings`.`priced_extra_hours` AS t0_r10, `reservation_pricings`.`priced_extra_expanded` AS t0_r11, `reservation_pricings`.`priced_extra_drive_time` AS t0_r12, `reservation_pricings`.`base_rate` AS t0_r13, `reservation_pricings`.`extra_rate` AS t0_r14, `reservation_pricings`.`gratuity_pct` AS t0_r15, `reservation_pricings`.`service_fee_pct` AS t0_r16, `reservation_pricings`.`surcharge_pct` AS t0_r17
@kenton
kenton / gist:3919601
Created October 19, 2012 17:48
users
=> #<User id: 3176837, email: "sdsmmm@mail.ru", remember_token: nil, crypted_password: nil, salt: nil, forgot_password_code: nil, hashed_identifier: nil, has_ever_logged_in: false, remember_token_expires_at: nil, password_reset_at: nil, created_at: "2012-10-18 23:28:40", updated_at: "2012-10-18 23:57:30", is_subscribed: true, phone_num: "4085157002", login_count: 0, last_login_date: nil, email_validation_result: nil, source_status: 0, is_password_strong: false, first_name: "leo", last_name: "pekker", session_id: nil, travel_preferences: nil, role: nil, company_group_id: 43361, uuid: "J30YC5", blacklisted_status: 0, is_reviewer: true, phone_num_alt: nil, phone_num_digits: nil, preferred_contact_type: nil, mobile_security_token: nil>
>> User.find(us.last)
=> #<User id: 3176838, email: "sdmmm@mail.ru", remember_token: nil, crypted_password: nil, salt: nil, forgot_password_code: nil, hashed_identifier: nil, has_ever_logged_in: false, remember_token_expires_at: nil, password_reset_at: nil, created_at: "2012-10-18
@kenton
kenton / gist:3933925
Created October 22, 2012 20:27
SQL queries
ReservationPricing.with_promo_code
SELECT reservation_pricings.promo_code_id, reservation_pricings.reservation_request_id FROM `reservation_pricings` INNER JOIN reservation_requests ON reservation_requests.id = reservation_pricings.reservation_request_id WHERE (reservation_pricings.reservation_pricing_stage = 30 AND reservation_pricings.promo_code_id = 1 AND reservation_requests.parent_id IS NULL AND reservation_pricings.created_at >= '2012-10-19 20:47:57')
ReservationPricing.with_promo_code_and_user
SELECT reservation_pricings.promo_code_id, reservation_pricings.reservation_request_id, reservation_requests.user_id, reservation_requests.parent_id, users.id FROM `reservation_pricings` INNER JOIN reservation_requests ON reservation_requests.id = reservation_pricings.reservation_request_id INNER JOIN users ON reservation_requests.user_id = users.id WHERE (reservation_pricings.reservation_pricing_stage = 30 AND reservation_pricings.promo_code_id = 1 AND reservation_requests.parent_id IS NULL AND reservation_requ