This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Link < ActiveRecord::Base | |
| belongs_to :artist | |
| def url | |
| end | |
| end | |
| class Link::Myspace < Link | |
| def url | |
| "http://www.myspace.com/#{ value }" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Before | |
| def duration_format(duration) | |
| whole_minutes = duration / 1.minutes | |
| seconds = duration - whole_minutes.minutes.seconds | |
| "#{ whole_minutes }:#{ seconds }" | |
| end | |
| # After | |
| def duration_format(duration) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Application name | |
| set :application, "my-domain.com" | |
| # Remote deploy directory | |
| set :deploy_to, "/var/www/#{application}" | |
| # Don't prepend each command with `sudo' | |
| set :use_sudo, false | |
| # SSH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'test_helper' | |
| class VideosControllerTest < ActionController::TestCase | |
| context 'Given a video' do | |
| setup { @video = Factory(:uploaded_video) } | |
| context 'when updating the video' do | |
| setup do | |
| @new_attributes = Factory.attributes_for(:video) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'test_helper' | |
| class MonkeysControllerTest < ActionController::TestCase | |
| 100.times do |i| | |
| context "Test #{ i }" do | |
| setup do | |
| 2.times { Factory.build :monkey } | |
| get :index | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Video < ActiveRecord::Base | |
| default_scope :order => 'id DESC' | |
| named_scope :processed, :conditions => { :processed => true } | |
| named_scope :unprocessed, :conditions => { :processed => false } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| rescue_from Cart::ExpiredError, :with => :redirect_to_session_expired | |
| def redirect_to_session_expired | |
| respond_to do |format| | |
| format.html { redirect_to expired_cart_path } | |
| # Will correctly redirect AJAX requests to carts/expired.js.erb. | |
| format.js { redirect_to expired_cart_path(:format => 'js') } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="bar-top"> | |
| <%= yield(:top_bar) %> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !blueprint_grid_columns = 30 | |
| !blueprint_grid_width = 30px | |
| !blueprint_grid_margin = 10px | |
| @import blueprint/reset.sass | |
| @import blueprint | |
| +blueprint | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| map.resource :session, :collection => { :forgot_password => :post, :sign_out => :get } do |session| | |
| session.connect 'reset_password/:token', :controller => 'sessions', :action => 'reset_password' | |
| session.connect 'activate_account/:token', :controller => 'sessions', :action => 'activate_account' | |
| end | |
| map.resource :cart, :collection => { :expired => :get } do |cart| | |
| cart.resource :checkout, :collection => [ :pickup_order, :update_shipping_address, :update_shipping_method, :update_payment ] do |checkout| | |
| checkout.resources :complete, :only => :show | |
| end | |
| end |