text
stringlengths
10
2.61M
require 'spec_helper' describe "StaticPages" do let(:base_title) {"Ruby on Rails"} subject { page } describe "Home page" do before {visit root_path} it { should have_content('Sample App') } it { should have_title("#{base_title}") } it { should_not have_title(': Home') } end describe ...
require 'json' require_relative '../model/GeneralError' require_relative '../model/calendario' require_relative '../model/convertidor_json_objeto' require_relative '../model/convertidor_objeto_json' require_relative '../model/validador_evento' require_relative '../model/validador_calendario' require_relative '../model/...
class UsersController < ApplicationController include SessionsHelper before_action :authenticate!, only: [:profile] def new @user = User.new end def create user = User.create user_params redirect_to login_path end def login end def landing @user = current_user end def profil...
FactoryBot.define do factory :user do name {"ユーザー"} sequence(:email) {|n| "user#{n}@example.com"} phone_num {"000-0000-0001"} phone_ext {"001"} position_id {1} department_id {1} password {"password"} password_confirmation {"password"} admin {false} end end
#!/usr/bin/ruby def rank(scale,which_better,values) output=Array.new largest = values.max smallest = values.min m=0 case scale when "1" m=0.2 when "2" m=0.5 when "3" m=1.0 when "4" m=2.0 when "5" m...
module Chanko module Expand def self.included(obj) obj.extend(ExpandClassMethods) obj.class_eval do mattr_accessor :prefix def self.included(include_obj) if self.constants.map(&:to_s).include?("ClassMethods") cmethods = self.const_get("ClassMethods") i...
class BenefitsController < ApplicationController before_action :set_benefit, only: [:show, :edit, :update, :destroy] # GET /benefits def index @benefits = Benefit.all end # GET /benefits/1 def show end # GET /benefits/new def new @benefit = Benefit.new end # GET /benef...
module Dartt class Task attr_reader :name @@excluded_dates = [] def self.exclude(date) @@excluded_dates << date end def initialize (name) @name = name self end def ==(other) @name == other.name and get_start == other.start and get_duration =...
module Repositories module Workers class CreatePullRequest class CreatePullRequestError < StandardError; end include Sidekiq::Worker sidekiq_options queue: 'pull_requests', retry: true def perform(project_id) project = Project.find(project_id) result = Interactors::CreateP...
class Admin::ClassificationFeaturingsController < Admin::BaseController before_filter :load_classification before_filter :load_featuring, only: [:edit, :destroy] def index @tagged_editions = @classification.editions.published .with_translations ...
require 'cloudformation_mapper/resource' class CloudformationMapper::Resource::AwsPropertiesAsGroup < CloudformationMapper::Resource register_type 'AWS::AutoScaling::AutoScalingGroup' type 'Template' parameter do type 'Template' name :Properties parameter do type 'List<String>' name ...
require 'spec_helper' describe 'http_request resource' do before(:all) do expect { apply_recipe('http_request_without_curl') }.to raise_error(RuntimeError) expect { apply_recipe('http_request_client_error') }.to raise_error(RuntimeError) expect { apply_recipe('http_request_serve...
class GitTopics < Formula desc 'A collection of git commands to manage independent topic branches' homepage 'https://github.com/ajvondrak/git-topics' url 'https://github.com/ajvondrak/git-topics/releases/download/v0.2.0/git-topics-0.2.0.tar.gz' sha256 'b39509d8185ed7d592af7c190d19a4c1a89bcd2c25994bd995300a47c53...
require 'spec_helper' require 'ruby-progressbar/calculators/length' class ProgressBar module Calculators describe Length do context 'when the RUBY_PROGRESS_BAR_LENGTH environment variable exists' do before { ENV['RUBY_PROGRESS_BAR_LENGTH'] = '44' } after { ENV['RUBY_PROGRESS_BAR_LENGTH'] = nil } ...
require 'openssl' require 'open-uri' module DocusignRest class Client # Define the same set of accessors as the DocusignRest module attr_accessor *Configuration::VALID_CONFIG_KEYS attr_accessor :docusign_authentication_headers, :acct_id def initialize(options={}) # Merge the config values fro...
class Guest < ActiveRecord::Base belongs_to :event validates_presence_of :event def self.ordered order("invited_to_ceremony = true DESC, id ASC") end def self.attending where({rsvp: true}) end def self.not_attending where({rsvp: false}) end def self.attendance_unknown where({rsvp: ...
Rails.application.routes.draw do root to: "listings#index" get "/users/new", to: "users#new", as: "new_user" post "/users", to: "users#create" get "/users/:id", to: "users#show", as: "user" get "/users/:id/edit", to: "users#edit", as: "edit_user" patch "/users/:id", to: "users#update" delete "/users/:id...
#Basic Recipe Crafting v1.1a #----------# #Features: Recipe crafting! Yeesh. # #Usage: Set up your recipes, learn recipes, make items! Yay! # SceneManager.call(Scene_Crafting) - opens the Crafting meny # learn_recipe(id) - teaches that recipe # forget_recipe(id) ...
# frozen_string_literal: true class SearchController < ApplicationController before_action :set_search_term CATEGORIES = { 'Users' => [User, :name, [:profile]], 'Status updates' => [StatusUpdate, :text, [:author]], 'Comments' => [Comment, :text, %i[commentable author]], 'Images' => [Image, :descri...
require 'htph'; require 'json'; # Reads input file line by line and calls deeper methods. def index_file (infile, agencies) puts "Started #{Time.new()}"; c = 0; File.open(infile) do |f| f.each_line do |line| c += 1; if c % 25000 == 0 then puts "#{Time.new()} | #{c} records"; end ...
module MangoPayV1 class Ressource protected def self.post_request(route, data) request('POST', route, data) end def self.get_request(route, options=nil) request('GET', route, nil, options) end def self.put_request(route, data) request('PUT', route, data) end def ...
class ChangeHoursDoneInEmployeeTasks < ActiveRecord::Migration[5.2] def change change_column :employee_tasks, :hours_done, :decimal, :default => 0 end end
class TrainCar include Manufacturer include Validation ALLOWED_TYPES = [:passenger, :cargo] attr_accessor :current_train, :current_number #вагон знает о том, куда он прицеплен, и под каким номером (начиная с 0) attr_reader :occupied, :type define_validation_descriptions({max_capacity: 'вместимость вагона...
# frozen_string_literal: true require 'spec_helper' describe SFRest::Group do before :each do @conn = SFRest.new "http://#{@mock_endpoint}", @mock_user, @mock_pass end describe '#group_list' do groups_data = generate_groups_data group_count = groups_data['count'] groups = groups_data['groups'] ...
require './test/base_test' class StubbornTest < BaseTest def test_build_with_helper within_project_directory do Stubborn.new_project('stubborn-homepage') Dir.chdir('stubborn-homepage') Pathname('stubborn_helper.rb').write(<<-HELPER) def my_helper 'Written by Helper' end HELPER ...
class User < ActiveRecord::Base belongs_to :team belongs_to :account has_many :accesses, dependent: :destroy has_many :projects, through: :accesses has_many :todos, foreign_key: "doer_id" has_many :events validates :name, presence: true end
module Paperclip class Attachment def self.default_options @default_options ||= { :url => "/system/:class/:attachment/:id/:style/:basename.:extension", :path => ":rails_root/public/system/:class/:attachment/:id/:style/:basename.:extension", ...
class LanguageType < ActiveRecord::Base extend App::TokenSupport has_and_belongs_to_many :languages, join_table: :languages_language_types scope :by_tokens, ->( tokens ) { find_by_tokens( tokens ) } end
module TroleGroups module Api autoload :Core, 'trole_groups/api/core' autoload :Cache, 'trole_groups/api/cache' autoload :Config, 'trole_groups/api/config' autoload :Event, 'trole_groups/api/event' autoload :Read, 'trole_groups/api/read' autoload :Write, 'trole_g...
class BlogPostsController < ApplicationController def index @posts = BlogPost.listed.paginate(:page => params[:page], :per_page => 10) end def show @post = BlogPost.find_by_slug!(params[:slug]) end end
require 'travnoty' require 'travian' require 'travnoty_client/gui/generic_frame' require 'travnoty_client/gui/login_panel' include Wx module TravnotyClient class LoginFrame < GenericFrame def initialize super("Login", DEFAULT_POSITION, Size.new(580, 600)) @hubs_servers = [] icon_file = File.exp...
#!/usr/bin/env ruby require_relative '../../../framework/Feature' class AlertEmergencies @@name = :alert_emergencies @@feature = Feature.new(@@name) @@feature.add_alteration( :instance_method, :ERS, :alert, lambda do s = "" @emergencies.each do |e|...
require File.dirname(__FILE__) + '/../spec_helper' describe PersonasController do let(:user) { FactoryGirl.create(:user) } let(:game) { FactoryGirl.create(:game) } let (:persona){FactoryGirl.create(:persona, user:user, game:game)} before { sign_in user } fixtures :all render_views it "index action ...
# doubly-linked and circular linked list class Node attr_accessor :left, :val, :right def self.create_list(val) Node.new(nil, val, nil).tap do |n| n.left = n n.right = n end end def initialize(left, val, right) @left = left @val = val @right = right end def insert_before(n...
json.array!(@requests) do |request| json.extract! request, :id, :direcini, :direcfin, :npass, :fpago, :estado, :calif, :passenger_id, :driver_id, :route_id json.url request_url(request, format: :json) end
require 'repub/app/filter' module Repub class App class PostFilters class FileFilters include Filter # Do rx substitutions # filter :do_rxes do |s| options[:rx].each do |rx| rx.strip! delimiter = rx[0, 1] rx = rx.gs...
require './lib/linked_list' class LinkedList def find_key(key) curr = @head while curr return curr.value[1] if curr.value[0] == key curr = curr.next end nil end end class Hash attr_reader :load def initialize(size = 1024) @table = Array.new(1024) @mod = size - 1 @load ...
require "../dice" describe Dice do describe "#roll" do context "when you try to roll aan impossible dice" let(:d1) { describe_class.new(1) } let(:d0) { describe_class.new(0) } let(:dnegative1) { describe_class.new(-1) } it "throws an exception if we try to roll a d1" do expect { d1.roll }....
class Post < ActiveRecord::Base belongs_to :board belongs_to :topic, touch: true validates :post_title, length: { maximum: 140 } validates :post_description, presence: true, length: { maximum: 500 } has_attached_file :post_image, :styles => { :medium => "300x300>", :thumb => ...
# == Schema Information # Schema version: 20101228005543 # # Table name: projects # # id :integer(4) not null, primary key # name :string(255) # description :text # short_description :string(255) # created_at :datetime # updated_at :datetime # imgs_folder_name...
class AddPostAndTagToTaggings < ActiveRecord::Migration[5.0] def change add_reference :taggings, :post, index: true add_reference :taggings, :tag, index: true end end
name "ubercloud" maintainer "TheUberCloud Inc." maintainer_email "support@theubercloud.com" license "Apache 2.0" description "Installs UberCloud container cluster through CycleCloud" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version "0.1"
class Page < ActiveRecord::Base acts_as_nested_set validates_uniqueness_of :sid, :scope => :parent_id has_many :page_parts, :dependent => :destroy, :order => 'name' has_many :page_parts_revisions, :through => :page_parts, :source => :page_part_revisions, :order => 'created_at DESC, id DESC' has_many :page_...
# 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 rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
# frozen_string_literal: true class HomeworksController < ApplicationController def index @homeworks = Homework.all end def show @homework = Homework.find(params[:id]) end def new @homework = Homework.new end def create @homework = Homework.new(homework_params) if @homework.save ...
require_relative '../test_helper' require 'ostruct' require 'mocha' require 'minitest/unit' require 'mocha/mini_test' describe SamsonDeployInfrachecker::DeployInfrachecker do let(:infrachecker) { SamsonDeployInfrachecker::DeployInfrachecker.new } let(:response_body) { [] } let(:project) { mock()} let(:response...
class PeopleController < ApplicationController before_filter :authenticate_user!, :except => [:show, :index] helper_method :sort_column, :sort_direction, :per_page def index if params[:q] respond_to do |format| format.json { render :json => Person.fetch_people_by_first_name_as_array(params[:q])...
class WelcomeController < ApplicationController def index @articles = Blog.all end end
require "application_responder" class ApiController < ActionController::Base self.responder = ApplicationResponder respond_to :html protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' } after_action :flash_to_http_header helper_method :current_compa...
class Problem < ActiveRecord::Base validates :title, :statement, :presence => true has_one :permalink, :as => :linkable, :dependent => :destroy belongs_to :setter, :class_name => "User", :validate => false has_many :tasks, :dependent => :destroy, :validate => false has_many :codes has_and_belongs_to_many :c...
class PagesController < ApplicationController skip_before_action :authenticate_user!, only: [:home] def home end def dashboard @workshops = current_user.workshops @validated_workshops = current_user.student_workshops.where(status: "accepted") end end
#============================================================================== # Earthbound-ish Battle Backgrounds #------------------------------------------------------------------------------ # Version: 1.0 # Author: cozziekuns # Date: February 15, 2013 #============================================================...
require 'spec_helper' describe "devices/edit.html.haml" do before(:each) do @device = assign(:device, stub_model(Device, :new_record? => false )) end it "renders the edit device form" do render # Run the generator again with the --webrat-matchers flag if you want to use webrat matchers ...
# In tennis, a set is finished when one of the players wins 6 games and the other one wins less than 5, # or, if both players win at least 5 games, until one of the players wins 7 games. # Determine if it is possible for a tennis set to be finished with the score score1 : score2. def tennis_score_possible?(score1, sco...
# frozen_string_literal: true module Api::V1::Admin::Coaches::Avatar class CreateAction < ::Api::V1::BaseAction include ::TransactionContext[:coach] step :authorize tee :find, catch: Sequel::NoMatchingRow step :validate, with: 'params.validate' map :create private def find(input) ...
class WordsController < ApplicationController # before_action :set_word, only: [:show, :update, :destroy] before_action :set_student # GET /words def index # @words = Word.all # render json: @words # @words = @student.words @words = Word.all render json: @words end # GET /words/1 d...
unless File.exists?(node['mouse_locator_dst']) remote_file "/tmp/mouse_locator.dmg" do source node["mouse_locator_download_uri"] mode "0644" action :create_if_missing end execute "mount mouse_locator dmg" do command "hdid /tmp/mouse_locator.dmg" user WS_USER end # We're bypassing the in...
class AddCatergoryidToProduct < ActiveRecord::Migration[6.1] def change add_reference :products, :category, foreign_key: true end end
#!/usr/bin/ruby runType = "newreno" if ARGV.size < 1 puts "Usage: ./gen_tput_vs_servers_vs_block_size.rb runType" exit end runType = ARGV[0] BASEDIR = ".." puts BASEDIR DATA_DUMP_DIR = "#{BASEDIR}/data_dump/block" GRAPHDIR = "#{BASEDIR}/graphs" synchSizeInK = 256 bufSizeInPackets = 64 runTimeInSec = 20 for...
class CreateUserLandings < ActiveRecord::Migration def change create_table :user_landings do |t| t.integer :user_id t.integer :landing_id t.datetime :activated_at t.datetime :reactivate_at t.string :video_link t.boolean :has_photo, default: false t.boolean :has_vk, defaul...
class Move VALUES = ['rock', 'paper', 'scissors'].freeze def initialize(value) @value = value end def scissors? @value == 'scissors' end def rock? @value == 'rock' end def paper? @value == 'paper' end def >(other_value) (rock? && other_value.scissors?) || (paper? && ot...
class FeedMailer < ApplicationMailer def feed_mail(feed) @feed = feed mail to: @feed.author_email, subject: "画像投稿確認メール" if @feed.present? end end
class CheckinsController < ApplicationController before_filter :authenticate_comitee! before_action :set_checkin, only: [:show, :edit, :destroy] # GET /checkins # GET /checkins.json def index @checkins = Checkin.all end # GET /checkins/1 # GET /checkins/1.json def show end # GET /checkins/...
# Demo player: A pretty stupid player, just randomly returns a letter each turn. Doesn't guess the same letter twice in the same game. class StupidDemoPlayer # Returns this players name. def name "Stupid Demo Player" end # Prepares for a new game. Creates an array of letters that can be used to guess. ...
require 'uuid' class MarketplaceGatewayHelper CC_PORT = 34567 GW_PORT = 15000 GW_COMPONENT_PORT = 10000 LOCALHOST = "127.0.0.1" def initialize @override_config = {} end def set(key, value) @override_config[key] = value end def get_config config = load_config("test") config[:cloud_...
# identity type... a favorite is itself a (virtual) item , # the "item_id" column of favorite refers back to an entry in the items table # which itself points to some "real" item like a tune, resource etc class Favorite < ActiveRecord::Base has_one :item before_save :init_data def init_data self.entryDate ||...
class SchoolsController < ApplicationController def index @schools = School.all end def new @school = School.new end def create @school = School.new(school_params) if @school.save redirect_to root_url end end private def school_params params.require(:school). per...
class QuickFind attr_accessor :id, :count def initialize(n) @id = Array.new(n) { |idx| idx + 1 } @count = n end def find(p) @id[p] end def connected?(p, q) @id[p] == @id[q] end def union(p, q) return if connected?(p, q) p_id = @id[p] @id.each_with_index do |item, idx| ...
class Task < ActiveRecord::Base belongs_to :house belongs_to :member validates :task_type, :due_date, :member_id, :house_id, presence: true validate :due_date_is_in_future protected def due_date_is_in_future if due_date.present? errors.add(:due_date, "cannot be in the past") if due_date < Date....
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') require File.expand_path(File.dirname(__FILE__) + '/helpers/posts.rb') require File.expand_path(File.dirname(__FILE__) + '/helpers/comments.rb') describe "Posts" do before do @config = Posts.instance_variable_get("@r") end describe...
# frozen_string_literal: true require 'spec_helper' describe Rabbitek::CLI::SignalHandlers do describe '::setup' do let(:io_w_mock) { instance_double(IO) } before do allow(Signal).to receive(:trap) described_class.setup(io_w_mock) end it 'traps correct Signals' do expect(Signal)...
# Written by Samuel Burns Cohen # Jan 25, 2019 # # default_classes.rb # # This file defines the implementations of each built-in ftouch class # class info: # > each class has must take two arguments: param, and arguments # > the parameter argument is the instance of the Parameter class # that has this class ...
require 'spec_helper' describe Location do #describe '#ssid' do # it { should validate_presence_of(:ssid) } #end describe '#bssid' do it { should validate_presence_of(:bssid) } end describe '#capabilities' do it { should validate_presence_of(:capabilities) } end describe '#level' do it { should valida...
require 'net/http' class TVFeedSource def self.each_source(&block) self.constants.each do |k| klass = self.const_get(k) if klass.class == Class and klass.ancestors.include?(self) yield klass end end end def initialize(config) @config = config @search_method = 'GET' en...
class Notification::WebNotification < ActiveRecord::Base attr_accessible :notification belongs_to :notification delegate :user, :instance, :action, to: :notification def mark_as_read! self.read = true self.save end end
#!/usr/bin/env ruby # frozen_string_literal: true nums = {} $stdin.each_line do |line| num = line.to_i nums[num] = 1 pair = 2020 - num unless nums[pair].nil? puts(num * pair) break end end
require 'spec_helper' describe TeamsController do render_views describe "GET 'new'" do before(:each) do sign_in FactoryGirl.create(:user) end it "should be successful" do get 'new' response.should be_success end it "should have the right title" do get 'new' r...
class Urbit < Formula desc "Personal cloud computer" homepage "https://urbit.org" url "https://github.com/urbit/urbit/archive/v0.4.5.tar.gz" sha256 "ac013b5a02d250450c983a3efc0997f2a5f5675bc3e16b51ed0a54dff1caef7c" bottle do cellar :any sha256 "3ea8320910d59da1d22253cda85376570636e0c65f4d78b0ad7b79f1...
class AddColumnToWildfires < ActiveRecord::Migration def change add_column :wildfires, :fire_size, :integer end end
require 'rubygems' require 'rake' desc 'Default: run unit tests.' task :default => :test begin require 'rspec' require 'rspec/core/rake_task' desc 'Run the unit tests' RSpec::Core::RakeTask.new(:test) rescue LoadError task :test do STDERR.puts "You must have rspec 2.0 installed to run the tests" end e...
module Antlr4::Runtime class CommonTokenFactory include Singleton def initialize(copy_text = false) @copy_text = false @copy_text = copy_text end def create(source, type, text, channel, start, stop, line, char_position_in_line) t = CommonToken.create1(source, type, channel, start,...
#t.string "name", null: false class PlaceEmail < ActiveRecord::Base belongs_to :place validates_presence_of :email end
source 'http://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' # Use postgresql as the database for Active Record gem 'pg' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeS...
class Profile < ActiveRecord::Base include ApplicationHelper validates_presence_of :name, :country_id, :address validates_numericality_of :country_id validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, :on => :create #Relationships belongs_to :country has_many :educations, de...
require 'rails_helper' describe IterationsController, type: :controller do before do allow_any_instance_of(ApplicationController).to receive(:logged_in?).and_return(true) allow_any_instance_of(ApplicationController).to receive(:check_student).and_return(true) @iteration = FactoryBot.create(:iteration) ...
if ENV['CI'] require 'simplecov' SimpleCov.start end Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f } Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f } require "manageiq-providers-ibm_cloud" VCR.configure do |config| config.ignore_hosts 'codeclimate.com' if ENV['CI'] config....
# frozen_string_literal: true require_relative '../lib/deputes' describe "the deputes method" do it "should return an array" do expect(deputes).is_a?(Array) end it "should return an array, and the array is not nil" do expect(deputes).not_to be_nil end it "should return a hash in the array" do expect(dep...
# Copyright (c) 2009-2011 VMware, Inc. require "mongodb_service/common" require "mongodb_service/job/util" require "mongodb_service/job" class VCAP::Services::MongoDB::Provisioner < VCAP::Services::Base::Provisioner include VCAP::Services::MongoDB::Common def create_snapshot_job VCAP::Services::MongoDB::Snaps...
class CommentsController < ApplicationController def new @comment = Comment.new() end def create @word= Word.find(params[:comment][:word_id]) @comment = @word.comments.create!(comment_params) redirect_to word_path(@word.slug, :anchor => "comment-#{@comment.id}") end private def comment_p...
# encoding: utf-8 module HireFire module Macro module Sidekiq extend self # Counts the amount of jobs in the (provided) Sidekiq queue(s). # # @example Sidekiq Macro Usage # HireFire::Macro::Sidekiq.queue # all queues # HireFire::Macro::Sidekiq.queue("email") # only email ...
class FontMonoidNerdFont < Formula version "2.3.3" sha256 "60c4f5ddf05138cf12994deee4939d0cbbd9c9d182c7982852669aef0db533cb" url "https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/Monoid.zip" desc "Monoid Nerd Font (Monoid)" desc "Developer targeted fonts with a high number of glyphs" ho...
require_relative 'character' class CharacterZ < Character def initialize @symbol = 'Z' @height = 100 @width = 100 @ascent = 68 @descent = 0 end end
class CreateCustomerPaymentInfos < ActiveRecord::Migration[5.0] def up create_table :customer_payment_infos do |t| t.integer "customer_id", :limit => 5 t.string "card_number", :limit => 20 t.integer "ccv_number", :limit => 3 t.string "exp_date" t.timestamps ...
class Activity < ActiveRecord::Base belongs_to :user belongs_to :category has_many :comments validates_uniqueness_of :name validates_uniqueness_of :address def slug self.name.downcase.gsub(" ","-") end def self.find_by_slug(slugged_name) self.all.find {|n| n.slug == slugged_name} end end
class User < ActiveRecord::Base has_attached_file :avatar, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: "/images/:style/missing_profile_avatar.png", storage: :s3, bucket: ENV['S3_BUCKET_NAME'], s3_credentials: {access_key_id: ENV["AWS_ACCESS_KEY_ID"], secret_access_key: ENV...
class InsulinesController < ApplicationController before_action :set_insuline, only: [:show, :edit, :update, :destroy] before_filter :authenticate_user! respond_to :html def index #@insulines = Insuline.all @insulines = Insuline.where(:user_id => current_user.id).page(params[:page]).per(10) respond...
class Company < ActiveRecord::Base attr_accessible *attribute_names include Cms::TextFields boolean_scope :published boolean_scope :show_on_file_a_claim, :for_file_a_claim, false boolean_scope :show_on_online_billing, :for_online_billing, false scope :sort_by_sorting_position, -> { order("sorting_position...
require 'spec_helper' describe Apartment do let(:co_ops) { Apartment.new("2323 Shasta Dr.", "Davis", "CA", "95616", "$750", Date.new(2016,8,1), Date.new(2017,8,31))} describe ".new" do it "should have a street name" do expect(co_ops.address).to eq("2323 Shasta Dr.") end it "should reside in a...
class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? def require_user # redirects to the landing page if the user isn't signed in redirect_to '/welcome' unless current_student || current_teacher ...
class Guest attr_accessor :name @@all=[] def initialize(name) @name=name @@all<< self end def trips Trip.all.select do |trip| trip.guest == self end end def trip_count trips.count end def listings trips.map.uniq do |trip| trip.listing end end def self.pro_traveler self.all.select do |guest| gue...