$ rails g model User
belongs_to
has_one
| describe '#event_space_commission' do | |
| context 'there is a specific event space commission' do | |
| let :lead do | |
| lead = build(:lead, event_space_commission: 0.2) | |
| end | |
| it 'returns the commission rate specific to event space if there is one' do | |
| expect(lead.event_space_commission).to eq 0.1 | |
| end | |
| end |
| describe '#lead_total' do | |
| it 'returns the sum of the totals for all the other sections: | |
| sleeping rooms, event space, f&b, audiovisual and concessions' do | |
| lead = build(:lead) | |
| expect(lead).to respond_to(:event_space_total) | |
| expect(lead).to respond_to(:sleeping_rooms_total) | |
| expect(lead).to respond_to(:event_space_total) | |
| expect(lead).to respond_to(:food_and_beverage_total) | |
| expect(lead).to respond_to(:audiovisual_total) | |
| expect(lead).to respond_to(:concession_total) |
| class Users::InvitationsController < Devise::InvitationsController | |
| def new | |
| if current_user.pending? | |
| redirect_to root_path | |
| else | |
| super | |
| end | |
| end | |
| def create |
| Rails.application.configure do | |
| # Settings specified here will take precedence over those in config/application.rb. | |
| # Code is not reloaded between requests. | |
| config.cache_classes = true | |
| # Eager load code on boot. This eager loads most of Rails and | |
| # your application in memory, allowing both threaded web servers | |
| # and those relying on copy on write to perform better. | |
| # Rake tasks automatically ignore this option for performance. |
| class Lesson < ActiveRecord::Base | |
| belongs_to :path | |
| has_many :lesson_progresses | |
| has_many :users, :through => :lesson_progresses | |
| # This is what's called a "virtual attribute". At least I think that's the term | |
| # The lesson_progress attribute is just saved in memory, it doesn't have a corresponding entry in the database | |
| # The getter and setter methods we've assigned here are only there to make it easier | |
| # to display a user's progress in the view | |
| attr_accessor :lesson_progress |
| class PathsController < ApplicationController | |
| before_action :set_path, only: [:show, :edit, :update, :destroy] | |
| # GET /paths | |
| # GET /paths.json | |
| def index | |
| @paths = Path.all | |
| end | |
| # GET /paths/1 |
| # coding: utf-8 | |
| lib = File.expand_path('../lib', __FILE__) | |
| $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |
| require 'get_freaky/version' | |
| require 'get_freaky/info' | |
| Gem::Specification.new do |s| | |
| s.name = 'get_freaky' | |
| s.version = GetFreaky::VERSION | |
| s.executables << 'get_freaky' |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| class SubscriptionsController < ApplicationController | |
| def new | |
| end | |
| def create | |
| # Creates a Stripe Customer Object, for associating with the charge | |
| session[:return_to] ||= request.referer | |
| unless customer = Stripe::Customer.create( | |
| :email => current_user.email, |