RailsCasts Pro episodes are now free!

Learn more or hide this

Brian Armstrong's Profile

GitHub User: barmstrong

Site: http://www.startbreakingfree.com

Comments by Brian Armstrong

Avatar

One thing I didn't see mentioned about Rack::Cache - it should be used to set a max-age on your static assets (css and js) right?

I've set this in production.rb and it seems to work:

config.static_cache_control = "public, max-age=3600"

But I'd love to see more info on this. It seems like with rail's asset compilation, the max-age could be a year or more, since the url/filename will change with new new push. But please correct me if I'm wrong.

Avatar

Great episode! Have been programming ruby a long time and never seen those global variables.

I guess we normally use constants in an initializer like ROLLOUT = ...
only difference being your can't edit the constant later I guess.

Anyway, great info - thanks!

Avatar

Great episode, thanks!

Has anyone seen a good way to automatically generate the plain text emails from the html emails?

It always seemed a bit redundant to maintain both. I imagine they wouldn't look perfect but might be good enough if the primary goal was just to improve email deliverability.

Thanks Ryan!

Avatar

I love using factories, but for some reason I got frustrated with the factory_girl syntax on a recent project and ended up justing creating my own factories.rb file in the support/ directory that didn't use an external gem.

It is surprisingly easy to do in plain old active record with a familiar syntax, so now I'm not sure it even warrants a separate gem. May just be personal preference though.

ruby
def create_user options={}
  User.create!(user_attributes.merge(options))
end

def user_attributes
  {:email => "user#{user_count}@example.com"}
end

def user_count
  @user_count = @user_count.nil? ? 0 : @user_count += 1
end
Avatar

TL;DR Use Stripe :)

Actually I really appreciate the effort you took to put this together Ryan, even if it came out a bit longer than expected. It's certainly not one of the easier pieces of rails integration and is a great choice for a pro episode. Many websites will still require this so it's a valuable addition!

Avatar

Super awesome! Ryan, have you seen any good documentation on all the methods available in capybara to do request specs?

I almost jumped into it at one point, but could never find the equivalent document for it like this one: http://guides.rubyonrails.org/testing.html

This video is a great overview, but was wondering if you knew of a capybara reference to kept open to see all available methods?

Avatar

Coffeescript looks great! One thing I don't understand: - it appears they were modeling it after ruby. So I wonder why they didn't go all the way, and use def/end, class definitions, same ternary operators etc.

Seems like this would have been a big win - write your entire web app in one language!

Avatar

Yikes! Ryan I am a huge fan of RailsCasts, but I have to say the old design was SO much cleaner and beautiful. From the comments it looks like other people like the new design - I am really surprised. The new logo is just....wow.