This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| # why? | |
| # Product is simpler - works with persistence only | |
| # names in Product directly correspond to database (product_type => type, own_videos => videos) | |
| # less error-prone - much more difficult to call wrong method. If anyone calls product_type instead of type, he will get wrong result | |
| # a lot less duplication | |
| # tests will be much more simple and fast | |
| class Product < ActiveRecord::Base | |
| has_many :videos # not own_videos - no need to have confusing names |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| class A | |
| def foo | |
| whatever | |
| end | |
| protected | |
| def bar | |
| whatever | |
| end | |
| end |
| config/environments/development.rb | |
| MyApp::Application.configure do | |
| # here are some existing settings | |
| # ... | |
| # | |
| config.action_mailer.raise_delivery_errors = true | |
| config.action_mailer.delivery_method = :smtp | |
| config.action_mailer.smtp_settings = { |
| require 'spec_helper' | |
| include ActiveMerchant::Billing | |
| describe BillingTransaction do | |
| describe "remote requests" do | |
| before :each do | |
| @response = mock("response") | |
| @response.stub!(:success?).and_return true | |
| @response.stub!(:authorization).and_return "some reference" |
| require 'spec_helper' | |
| include ActiveMerchant::Billing | |
| describe BillingTransaction do | |
| describe "remote requests" do | |
| before :each do | |
| @response = mock("response") | |
| @response.stub!(:success?).and_return true | |
| @response.stub!(:authorization).and_return "some reference" |