text
stringlengths
10
2.61M
################################################################################ # # Author: Zachary Patten <zachary@jovelabs.net> # Copyright: Copyright (c) 2012-2013 Jove Labs # License: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use th...
require 'csv' require 'time' # require 'lib/load_files' class Customer attr_reader :id, :first_name, :last_name, :created_at, :updated_at def initialize(input) puts input @id = input["id"] @first_name = input["first_name"] @last_name = input["last_name"] @created_at = Time.parse(input["create...
module KnapsackPro module Config class Env LOG_LEVELS = { 'fatal' => ::Logger::FATAL, 'error' => ::Logger::ERROR, 'warn' => ::Logger::WARN, 'info' => ::Logger::INFO, 'debug' => ::Logger::DEBUG, } class << self def ci_node_total (ENV[...
class AddAffiliateLinksToTitles < ActiveRecord::Migration def self.up add_column :titles, :affiliate_links, :text end def self.down remove_column :titles, :affiliate_links end end
require 'spec_helper' describe TemplateTasksController, :type => :routing do describe 'routing' do describe 'routes to #index' do context 'when using url,' do subject{ { get:'/template_tasks' } } it{ is_expected.to be_routable } it{ is_expected.to route_to(controller: 'template_task...
class CreateJobs < ActiveRecord::Migration def change create_table :jobs do |t| t.belongs_to :user t.belongs_to :restaurant t.datetime :employed_from t.datetime :employed_to t.string :job_title t.text :job_description t.timestamps end end end
# frozen_string_literal: true class GuildPolicy < ApplicationPolicy include(CacheHelper) attr_reader :user, :record def initialize(user, record) super @user = user @record = record end def update? owner_admin? end def create_members? owner_admin? || officer? end def create_off...
require 'spec_helper' # Specs in this file have access to a helper object that includes # the NotesHelper. For example: # # describe NotesHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # end # end # end de...
require './lib/doctor' RSpec.describe Doctor do describe 'instantiation' do it "::new" do meredith = Doctor.new({name: "Meredith Grey", specialty: "General Surgery", education: "Harvard University", salary: 100_000}) expect(meredith).to be_an_instance_of(Doctor) end it "has attributes" do ...
class AddDrawBoxToGraphic < ActiveRecord::Migration[5.2] def change add_column :graphics, :title, :string add_column :graphics, :description, :text end end
class ApplicationController < ActionController::Base add_flash_types :success, :error, :notice, :alert before_action :configure_permitted_parameters, if: :devise_controller? layout :layout_by_resource helper_method :current_user_can_edit? protected def configure_permitted_parameters devise_paramete...
# frozen_string_literal: true class ChangeImagesColumnName < ActiveRecord::Migration[5.2] def change rename_column :images, :img_url, :img_data remove_column :images, :post_id add_reference :images, :post, foreign_key: true end end
class My::FriendsController < MyController before_action :authenticate_user! def index @friends = current_user.friends respond_to do |format| format.json { render json: @friends } format.html { render 'index' } end end def toggle if current_user.friends.p...
class TasksController < ApplicationController before_action :set_task, only: [:show, :edit, :update, :destroy] # GET /tasks # GET /tasks.json def index if params[:status] @tasks = Task.where("user_id = ? and status = ?", current_user.id, Task.statuses[params[:status]]) else @tasks ...
require 'bcrypt' class User include DataMapper::Resource property :id, Serial property :username, String, :unique => true, :message => "Username already in use, please select another" property :first_name, String property :last_name, String property :email, String, :unique => true, :message => "Email...
require 'rails_helper' RSpec.describe Api::V1::Agents::ProposalsController, type: :controller do let(:agent) { FactoryBot.create(:agent) } let(:job) { FactoryBot.create(:job) } let(:proposal) { FactoryBot.create(:proposal) } describe 'GET #index' do it 'return 200 with the proposals' do agent.acquire...
class TimeCell < Apotomo::StatefulWidget transition :from => :display, :to => :shout transition :in => :shout def display respond_to_event :clockClicked, :with => :shout render end def shout render :js => "alert('The current server time is #{Time.now}')" end end
require 'spec_helper' describe Tincan::Failure do let(:dummy) do instance = DummyClass.new instance.name = 'Some Idiot' instance end # let(:message_fixture) { IO.read('spec/fixtures/message.json').strip } # let(:message) { Tincan::Message.from_json(message_fixture) } let(:failure) { Tincan::Fail...
require_relative 'spec_helper' describe MagicCards::Card do it "should parse the name of some cards" do CARDS.keys.must_include "Angel of Serenity" CARDS.keys.must_include "Jace Beleren" end it "should decode ' correctly" do CARDS.keys.must_include "Jace's Erasure" end it "should find the correc...
require 'spec_helper' describe Gitlab::GitalyClient::RepositoryService do set(:project) { create(:project) } let(:storage_name) { project.repository_storage } let(:relative_path) { project.path_with_namespace + '.git' } let(:client) { described_class.new(project.repository) } describe '#exists?' do it '...
class RemoveUnusedFieldsFromUserAssociation < ActiveRecord::Migration def change remove_column :user_associations, :household_id remove_column :user_associations, :service_provider_id remove_column :user_associations, :breeder_id remove_column :user_associations, :veterinarian_id end end
class Checkout attr_reader :items def initialize @items = [] end def view_price(item) item.price end def scan(item) @items << item end def total_to_pay total = 0 @items.each { |item| total += item.price } total end def format_prices @formatted_prices = [] @items.ea...
class AddCouponIdOrders < ActiveRecord::Migration def up add_column :orders, :coupon_id, :integer add_column :orders, :mrp, :integer end def down remove_column :orders, :coupon_id remove_column :orders, :mrp end end
class ChangeDatatypecategoriesOftops < ActiveRecord::Migration[5.0] def change change_column :tops, :categories, :text end end
# #= 閲覧管理コントローラ # class Susanoo::VisitorsController < ApplicationController include Concerns::Susanoo::VisitorsController before_action :set_advertisement, only: %i(view preview), if: -> { @page_view && @page_view.top? } before_action :set_advertisement_page_view, only: %i(preview_virtual) before_action :set_a...
require 'starcraft' module Starcraft class Nios attr_accessor :tag, :name, :html, :members def clan tag @tag = tag request = RestClient.get("http://nios.kr/sc2/us/clan/detail/#{tag}", :user_agent => 'Chrome') @html = Nokogiri::HTML(request.body) # @name = Starcraft::SC2Ranks.new(tag)...
FactoryGirl.define do factory :neighbourhood do name "Beli Brezi" city_id 1 end end
module OrientdbBinary module OperationTypes NEW_SESSION = -1 REQUEST_SHUTDOWN = 1 REQUEST_CONNECT = 2 REQUEST_DB_OPEN = 3 REQUEST_DB_CREATE = 4 REQUEST_DB_CLOSE ...
shared_examples 'openssh' do describe file '/etc/ssh/sshd_config' do its(:content) { should match /^PermitRootLogin no/ } its(:content) { should match /^PasswordAuthentication no/ } end end
class Vendor < ApplicationRecord has_and_belongs_to_many :vendor_agencies, :join_table => :vendor_vendor_agencies has_and_belongs_to_many :company_agreements, :join_table => :company_agreements_vendors has_and_belongs_to_many :companies, :join_table => :vendor_companies belongs_to :us_state enum status: [:active, ...
class TagsController < ApplicationController def index @tags = Tag.all.order(created_at: :desc) end end
class AddCapturaToGames < ActiveRecord::Migration def change add_column :games, :captura, :string end end
require 'rails_helper' RSpec.describe DependentObjectImporter do it 'should respond_to #save_and_create_dependents' do arm = double('arm') dependent_object_importer = DependentObjectImporter.new(arm) expect(dependent_object_importer).to respond_to(:save_and_create_dependents) en...
# -*- encoding : utf-8 -*- class Admin < ActiveRecord::Base belongs_to :main attr_accessible :email validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :message => ": непрваильный формат email" end
# represent a job posted by employer member class WorkspaceLancer include Mongoid::Document include Mongoid::Timestamps include Rails.application.routes.url_helpers store_in database: 'sribulancer_development', collection: 'workspaces' MINIMUM_ACTIVITY_BEFORE_CLOSING = 3 # ================================...
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = '2' Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system config.vm.box = 'ubuntu/trusty64' # Configurate the virtual machine to use 1GB of RAM config.vm.provider :virtualbox do |...
class Cart < ActiveRecord::Base belongs_to :user has_many :line_items has_many :items, through: :line_items def add_item(item_id) if line_item = self.line_items.find_by(item_id: item_id) line_item.quantity += 1 else line_item = self.line_items.build(item_id: item_id) end line_item ...
require 'set' require 'pp' class Puppet::Provider::Vclresource < Puppet::Provider initvars commands :mysql => '/usr/bin/mysql' ############ Configuration parameters ############# def self.namevar "name" end def self.protectedHashKeys [ :recurse, :step, :as, :namevar ] end def self.vcldb ...
require 'faraday' # httpclient and excon are the only Faraday adpater which support # the no_proxy environment variable atm # NOTE: this has to be set before require octokit ::Faraday.default_adapter = :httpclient require 'octokit' require_relative '../input' module Commands class Base attr_reader :input d...
require 'tty-cursor' require 'tty-spinner' class Loader def self.show_loading duration = 5, message = "Loading" spinner = TTY::Spinner.new(":spinner #{message}...", format: :dots) spinner.auto_spin sleep(duration) spinner.stop('Done!') end end
class PracticalWorksController < ApplicationController # GET /practical_works # GET /practical_works.json def index if student_signed_in? @practical_works = current_student.practical_works elsif teacher_signed_in? @practical_works = current_teacher.practical_works end end # GET /prac...
require 'pry' def consolidate_cart(cart) new_cart = {} cart.each do |item_hash| item_hash.each do |item, info| if !new_cart[item] new_cart[item] = info new_cart[item][:count] = 1 else new_cart[item][:count] += 1 end end end new_cart end # [ # {:it...
Rails.application.routes.draw do devise_for :users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'static_pages#index' resources :courses, only: [:index, :show] do resources :enrollments, only: :create end resources :lessons, only: [:show] name...
class Article < ApplicationRecord has_many :comments, dependent: :destroy has_many :figures, dependent: :destroy has_attached_file :photo,:default_url => "/images/Wikapadia_logo.jpeg" # :url => "/:attachment/:id/:style/:basename.:extension", # :path => ":rails_root/public/:attachment/:id/:style/:basename.:exten...
# frozen_string_literal: true module Parser # Filter Parser class Filter def self.for(paths) return nil if paths.count.zero? last_path = paths.pop filters = paths.map do |path| path if whitelisted?(path) end filters.push( *parse_last(last_path) ) fi...
class CreateTrips < ActiveRecord::Migration def self.up create_table :trips do |t| t.string :name t.string :destination t.integer :weekday t.time :departure t.time :arrival t.time :return t.decimal :ticket_price t.integer :sales_lead t.text :comment t.in...
require 'spec_helper' $LOAD_PATH.unshift(File.join(__dir__, '../../app/workers')) require 'oj' require 'elasticsearch' describe ElasticsearchRasi do context 'Direct idx' do before(:context) do @es_opts = { direct_idx: true, idx_write: 'index', idx_read: 'index', type: ...
class RecordSerializer < ActiveModel::Serializer attributes :id, :slug, :title, :description, :record_type, :created_at, :updated_at, :source_notes, :start_date, :completion_date embed :ids has_many :locations has_many :categories has_many :new_deal_agencies has_many :tags end
class FontCourierNew < Formula version "2.82" url "https://downloads.sourceforge.net/corefonts/courie32.exe" desc "Courier New" homepage "https://sourceforge.net/projects/corefonts/files/the%20fonts/final/" def install (share/"fonts").install "cour.ttf" (share/"fonts").install "courbd.ttf" (share/...
# 単純ベイズ分類器を用いたカテゴリ分類器 $: << File.join(File.dirname(__FILE__), "..") require "naive_bayes_classifier" require "dictionary" require "bigram_tokenizer" class NaiveBayesCategorizer def initialize(tokenizer, hash = {}) @tokenizer = tokenizer @category_dictionary = Dictionary.new(hash[:category_dictionary] || {...
# def to_hex(r,g,b) # '#' + # r.to_s(16).rjust(2, '0') + # g.to_s(16).rjust(2, '0') + # b.to_s(16).rjust(2, '0') # end def to_hex(r,g,b) hex = '#' [r,g,b].each do |n| hex +=n.to_s(16).rjust(2, '0') end hex end def to_ints(hex) r ,g ,b = hex[1..2], hex[3..4] ,hex[5..6] ints = [r,g,b].m...
class Api::V1::CommentsController < ApplicationController def index comments = Comment.all render json: comments end def show comment = Comment.find(params[:id]) render json: comment end def create comment = Comment.create(comm_params) render json: ...
require 'rails_helper' RSpec.describe "laboratories/new", type: :view do before(:each) do assign(:laboratory, Laboratory.new( :name => "MyString", :department => nil, :user => nil )) end it "renders new laboratory form" do render assert_select "form[action=?][method=?]", labor...
require 'features_helper' RSpec.describe 'Add a goal' do after do GoalRepository.new.clear end it 'creates a new goal' do goal_title = 'Learn Hanami' visit '/goals/new' within 'form#goal-form' do fill_in 'Title', with: 'Learn Hanami' fill_in 'Description', with: 'Learn to use the Ha...
require File.expand_path("../helper", __FILE__) describe 'LocalwikiClient' do before(:all) do VCR.insert_cassette 'slug', :record => :new_episodes @wiki = Localwiki::Client.new ENV['localwiki_client_server'], ENV['localwiki_client_user'], E...
class Post < DirtyDocument attr_accessor :contents attr_accessor :created_at_i belongs_to :forum_thread belongs_to :user def initialize super() end def created_at=(val) self.created_at_i = val.to_i end def created_at Time.at(self.created_at_i.to_i) end def to_json(*a) ...
require_relative "lib.rb" # Create a point for each input line points = File.read(ARGV[0]).split("\n") .map { |l| Point.new(*l.split(",").map(&:strip).map(&:to_i)) } # Find smallest rect rect = smallest_rect_for_points(points) # Create a 2D array of bools, true if total dist < 10000 # (Indexed by [left][top]) bo...
require 'sumac' # make sure it exists describe Sumac::Connection::Scheduler do # we will test the connection by setting it to all possible states and sending all possible (valid) directives for each state # under all possilbe conditions # states (chronological order): # initial # compatibility_handshak...
class Artist < ApplicationRecord validates :name, presence: true has_many :albums, dependent: :destroy has_many :songs, through: :song_artists default_scope { order(updated_at: :desc) } end
# == Schema Information # # Table name: tournaments # # id :integer not null, primary key # name :string # active :boolean default(TRUE) # created_at :datetime not null # updated_at :datetime not null # tournament_type :string # class T...
module SupplyTeachers class Journey::FTAToPermContractStart include Steppable attribute :contract_start_date_day attribute :contract_start_date_month attribute :contract_start_date_year validates :contract_start_date, presence: true validate :ensure_contract_start_date_valid PARSED_DATE_...
module RunPal class UpdateUser < UseCase def run(inputs) inputs[:user_id] = inputs[:user_id].to_i inputs[:level] = inputs[:level].to_i if inputs[:level] inputs[:rating] = inputs[:rating].to_i if inputs[:rating] user = RunPal.db.get_user(inputs[:user_id]) return failure (:user_does...
json.beacons do json.array!(@beacons) do |beacon| json.extract! beacon, :id, :uuid, :major, :minor end end
class SessionsController < ApplicationController def new render layout: false end def create user = User.find_by(email: params[:session][:email].downcase) if user && user.authenticate(params[:session][:password]) session[:user_id] = user.id flash[:success] = "Has iniciado sesion correct...
class AddTipToTip < ActiveRecord::Migration def change add_column :tips, :tip, :integer end end
class CreateTasks < ActiveRecord::Migration def change create_table :tasks do |t| t.string :task_name, null: false t.string :description t.string :status t.string :due_date #use chronic????? or t.datetime t.string :completed_on #use chronic???? t.datetime t.timestamps "created...
class DeleteMaterialTypeFromMaterial < ActiveRecord::Migration def up remove_column :materials, :material_type end def down add_column :materials, :done, :string end end
require 'spec_helper' describe StoreImage, :store_image => true do # Model & Factory Validation #---------------------------------------------------------------------------- describe "factory validation", :factory_validation => true do specify { StoreImage.new.should be_an_instance_of(StoreImage) } des...
# frozen_string_literal: true module OTWTrainings module User def user @otw_requests = current_user&.otw_trainings&.where( 'otw_training_users.created_at > ?', Time.zone.today - 6.months ) @otw_credits = @otw_trainings.select { |o| o.course_key.in?(current_user.completions.keys) } e...
class DropBacgroundJobsTable < ActiveRecord::Migration[5.0] def change drop_table :background_jobs do |t| t.date :start_date, null: false, default: Date.today t.integer :period t.integer :completed, length: 1 end end end
class AddFieldsToRecruiters < ActiveRecord::Migration def change add_column :recruiters, :rating, :integer add_column :recruiters, :date_last_contact, :date end end
class ItemDrop < Liquid::Rails::Drop attributes :id, :title, :public_price, :price, :created_at, :updated_at, :image_url, :cover_url, :image, :description, :hits, :shop_id, :sid include ImageUrl image_mount :image def link "/items/#{object.sid}" end def link_html "/items/#{object.sid}.html" end...
require "pry" def badge_maker(name) return "Hello, my name is #{name}." end def batch_badge_creator(attendees) names = [] attendees.each do |element| names.push(badge_maker(element)) end return names end def assign_rooms(array) rooms = [] array.each.with_index(1) do |attendee, counter| rooms.pu...
class CapitalBikeshareController < ApplicationController def slash begin if params[:token] == ENV['CABI_VERIFICATION_TOKEN'] || Rails.env.development? query = params[:text].sub(/^\s*(in|for|at)\s+/, '').strip if query == '' || query == 'help' response = { text: "Enter an address t...
Spree::Product.class_eval do include Spree::Concerns::Searchable include Spree::Concerns::Indexable index_name "spree_product" document_type "spree_product" after_commit :update_product_document!, on: [:update] settings dynamic: 'false', index: { :"mapping.allow_type_wrapper" => 'true' }, ...
require File.dirname(__FILE__) + '/spec_helper' describe Smsinabox::DeliveryReport do before(:each) do f = File.open( File.dirname(__FILE__) + '/fixtures/sendparam_response.xml' ) sample_response = Nokogiri::XML( f ) @report = Smsinabox::DeliveryReport.from_response( sample_response ) end it "shoul...
# frozen_string_literal: true # adds a tutorial id reference to the video table class AddTutorialsToVideos < ActiveRecord::Migration[5.2] def change add_reference :videos, :tutorial, index: true end end
require 'open-uri' require 'csv' module TradeLead class CanadaData include Importable include VersionableResource ENDPOINT = 'https://buyandsell.gc.ca/procurement-data/csv/tender/active' COLUMN_HASH = { language: :language, title: ...
Rails.application.routes.draw do # devise_for :users devise_for :users # controllers: { sessions: :sessions }, root to: "home#index" get 'users/:id', to: 'users#show', as: 'user' get 'plants/show', to: "plants#show" get 'plants/new', to: "plants#new" post 'plants/new', to: "plants#create" get 'us...
require_relative './gravatar_image_adapter' module DefaultImage extend ActiveSupport::Concern included do |klass| cattr_accessor :image_resource_proc, :image_list_urls, :image_url_adapter, :_image_options @@image_url_adapter = GravatarImageAdapt...
class Question < ActiveRecord::Base attr_accessible :answer_url, :explanation, :points_to_earn, :possible_answers, :published, :started_at, :timer_in_seconds, :title has_many :assignments has_many :games, through: :assignments has_many :attempts has_many :user...
class Admin::AdminBasicController < ApplicationController before_action :ensure_admin protected def ensure_admin unless current_user.admin? redirect_to store_index_path, notice: 'You do not have privilege to access this section' end end end
module FacetHelper def display_collection(val) obj = ActiveFedora::SolrService.query(ActiveFedora::SolrService.construct_query_for_pids([val])).first obj["desc_metadata__title_tesim"].first if obj end # Convert a 2 or 3 letter (ISO-639-1 or ISO-639-3) code to language name def display_language(val) ...
class CreateUsersTables < ActiveRecord::Migration def change create_table :users_tables do |t| t.string :firstname,:limit=> 100 t.string :lastname,:limit=> 200 t.string :rollno,:limit=> 100 t.string :mobileno,:limit=> 20 t.attachment :imagess t.timestamps null: false end end end
Sequel.migration do up do alter_table(:characters) do add_column :species_id, String, :null => false, :default => "Human" end end down do alter_table(:characters) do drop_column :species_id end end end
# frozen_string_literal: true module Rubeme # Holds a String object which made with a single character. All # characters are assumed to be in the UTF-8 encoding. # # The main purpose of this class is to distinguish a character to a # string made with a single character, when performing to convert a # Ruby...
class CreateTaxPs < ActiveRecord::Migration def self.up create_table :tax_ps do |t| t.string :nameOfBank t.string :nameOfBranch t.integer :bsrCode t.date :dateDep t.integer :srlNoOfChaln t.decimal :amt, :precision =>16 , :scale =>2 t.integer :tax_paid_and_refund_id ...
class RenameUserRecipeModelToFavoritedUserRecipe < ActiveRecord::Migration def change rename_table :user_recipes, :favorited_user_recipes end end
require 'devtools/spec_helper' require 'concord' # makes spec setup easier module Spec def self.response_data :data end class Observer def self.call(response) end end class Action class Success def self.call(request) request.success(Spec.response_data) end end ...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class ContractsController < ApplicationController include Searchable expose :contracts, -> { search(@active_company.contracts.includes_associated, sortable_fields) } expose :contract, id: ->{ params[:slug] }, scope: ->{ @active_company.contracts.includes_associated }, find_by: :slug # GET /contracts def ind...
require "spec_helper" RSpec.describe "Day 11: Hex Ed" do let(:runner) { Runner.new("2017/11") } describe "Part One" do it "calculates final distances after following a path" do expect(runner.execute!("ne,ne,ne", part: 1)).to eq(3) expect(runner.execute!("ne,ne,sw,sw", part: 1)).to eq(0) expe...
require 'series_calc/command/message' require 'logging' module SeriesCalc module Command class Serializer class << self def setup(config = {}) options = { :unbuffer => config.fetch('unbuffer') { DEFAULT_CONFIG['unbuffer'] } } create(options) end ...
class RenameTablesToGalleriesAndGalleryItems < ActiveRecord::Migration def change rename_table :galeries, :galleries rename_table :galery_items, :gallery_items end end
# coding: utf-8 # frozen_string_literal: true require 'spec_helper' require 'tempfile' describe Darlingtonia::CsvParser do subject(:parser) { described_class.new(file: file) } let(:file) { Tempfile.new(['fake', '.csv']) } shared_context 'with content' do let(:csv_content) do <<-EOS title,descri...
require_relative 'test_helper' module Gameboy class TestMMU < BaseTest def setup super MMU.reset! end def test_byte_access # bounds assert_raises(Exception) { MMU.bwrite(-1, 0) } assert_raises(Exception) { MMU.bwrite(MMU::MMU_SIZE, 0) } assert_raises(Exception) { MMU....
class User < ApplicationRecord extend Search attr_accessor :validate_name, :validate_password, :validate_shoesize, :remember_token search_fields :name, :mysize_id, :content, size_field: :size has_many :kicksposts, dependent: :destroy has_many :comments, dependent: :destroy has_many :n...
class AuthorStoryAssignment < ActiveRecord::Base validates :author, :story, presence: true validates :author, uniqueness: {scope: :story} belongs_to :author belongs_to :story end
class Car attr_reader :type, :speed, :fuel def initialize(type, engine) @type = type @speed = 0 @fuel = 100 @engine = engine end def accelerate @speed += @engine.acceleration @fuel -= @engine.fuel_use end def brake if @speed > 0 reduced_speed = @speed -= 10 else ...
class CarpoolRider < ActiveRecord::Base attr_accessible :carpool_id, :rider_id belongs_to :carpool, class_name: "Carpool" belongs_to :rider, class_name: "User" end