Rails Webapp Engineering

Vote on HN

The day after I came back from Australia, I started my new job at Coupa Software. I'm absolutely loving it at the moment because of the awesome people and the amount of software I'm learning. Here's just a few that I've picked up in my first week that I'd like to jot down.

Skinny Controllers, Fat Models

Here's one article about it. It really really helps out with testing.

Association

composed_of

  • cmd-k clears terminal window
  • rake stats
  • script/spec for an individual test

  • send_data, send_file

  • render_to_string - returns string, use with send_data

  • Enumerable:inject

    • same as Scheme accumulator I used in 61A
  • PDF::SimpleTable

    • really really easy to use reporter generator.
  • request.xhr? - if request is ajax-y

Getting All Tables

ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
connection = ActiveRecord::Base.connection

options[:tables] ||= connection.tables.reject { |t| %w(schema_info
sessions).include?(t) }
comments powered by Disqus