RailsCasts Pro episodes are now free!

Learn more or hide this

jay thompson's Profile

GitHub User: jaytho

Comments by jay thompson


Also the new.js.erb title incorrectly has the view/templates directory and should be /app/views/tasks/new.js.erb instead of /app/templates/tasks/new.js.erb


$('#new_link').hide().after('<%= j render("form") %>');

This helper should go down in the Rails Gallery of Art/Hall of Fame- It looks so simple, but there so much going on right in front of your face.... I have revisited it several time to remember all of the mechanisms. These patterns have helped me trim a lot ofugly out from my views. Thanks!!!



in my case- (i may not be completely pristine with this railscast)

ActionMailer::Base.default_url_options[:host] = "www.productionsite.com"


  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.default_url_options = { :host => "www.productionsite.com" }

I am humbled by how simple the implementation ended up to add some very complex functionality, simply invoked I think that this is the best episode you have on this site. I await your return, eagerly- don't Why out on us!


When I upgraded to Rails 3.2 I had issues with running the seed tasks, only in production. When the seed file ran, it would not find any ActiveRecord models; but would work fine when called from the console.

Turns out, threadsafe was enabled in production, and rake tasks would get tripped up. To fix I had to do:

   # Enable threaded mode
   config.threadsafe!  unless $rails_rake_task

also a good thing for capistrano recipes.

  • in case anyone wants to use VCR for just a piece of a larger test suite, VCR blocks any unapproved HTTP access- and will get in the way of the other tests and they will fail with a warning from VCR (unless hidden behind a rescue block-another story). This was unexpected for me- I want to pick and choose which tests are recorded. I was thinking that the :all option would work, but do not desire to signup for housecleaning on all of the recorded cassettes.

VCR behavior can be modified with the flag set in the config block:

in vcr_config.rb
c.allow_http_connections_when_no_cassette = true

and pass through is allowed for these tests, and what I want.

I hope this helps someone else- this is a great tool thank you so much this cast and this gem.


Thanks Myron: Now my vcr_config looks like this from Ryan's:


require 'vcr'

  VCR.configure do |c|
    c.cassette_library_dir = Rails.root.join("spec", "vcr")
    c.hook_into :webmock
    #was :webmock
    #c.filter_sensitive_data('<WSDL>') { "http://www.webservicex.net:80/uszip.asmx?WSDL" }

  RSpec.configure do |c|
    c.treat_symbols_as_metadata_keys_with_true_values = true
#    c.around(:each, :vcr) do |example|
#      name = example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_")
#      options = example.metadata.slice(:record, :match_requests_on).except(:example_group)
#      VCR.use_cassette(name, options) { example.call }
#    end

and spec_helper.rb has changed the fakeweb include to webmock

require 'webmock/rspec'

+1 and thanks for this- (i know this is old, but think this fix is important and deserves a little more amplification)....

this version has the quotation fix for two word menu entries and initializes properly with the trigger "change"


I was having troubles with throwing errors with ascii cast example:

@CommentPoller ->
  poll: ->
    setTimeout @request, 5000

turns out that needs to be as in the shownotes:

@CommentPoller =
  poll: ->
    setTimeout @request, 5000

I get undefined errors with the '->'