text
stringlengths
10
2.61M
class User < ApplicationRecord validates :username, {presence: true, uniqueness: true} has_many :capsules has_many :articles, through: :capsules end
class Prize < ActiveRecord::Base ############################# ### ATTRIBUTES ############################# attr_accessible :status_prize_id, :build_menu_id, :category_id, :name, :redeem_value, :level, :role, :is_delete attr_accessor :array_prize, :level_delete, :status_name, :location_...
class RenameColumnByHands < ActiveRecord::Migration def self.up rename_column :vendors, :business_name, :business_name1 end end
begin puts "OK!" 0 / 0 puts "No OK!" rescue Exception => e puts "Something wrong: #{e.message}" puts e.backtrace end
class MerchantPolicy attr_reader :current_merchant, :order def initialize(current_merchant, order) @current_merchant = current_merchant @order = order end def index? @current_merchant.admin? || current_merchant.owner_of?(order) end def show? @current_merchant.admin? || @current_merchant ==@order e...
# frozen-string-literal: true require_relative 'threaded' # The slowest and most advanced connection pool, dealing with both multi-threaded # access and configurations with multiple shards/servers. # # In addition, this pool subclass also handles scheduling in-use connections # to be removed from the pool when they a...
require_relative '../lib/trees/tree' require_relative '../lib/trees/apple_tree' require_relative '../lib/trees/orange_tree' require_relative '../lib/trees/pear_tree' require_relative '../lib/fruits/fruit' require_relative '../lib/fruits/orange' require_relative '../lib/fruits/apple' require_relative '../lib/fruits/pea...
# frozen_string_literal: true require 'stannum/constraints/boolean' require 'support/examples/constraint_examples' RSpec.describe Stannum::Constraints::Boolean do include Spec::Support::Examples::ConstraintExamples subject(:constraint) do described_class.new(**constructor_options) end let(:constructor_...
class CreateVacancies < ActiveRecord::Migration[5.1] def change create_table :vacancies do |t| t.string :title t.text :description t.datetime :start_date t.integer :salary_min t.integer :salary_max t.string :location t.integer :bounty t.integer :available_position ...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def puts! args, label="" puts "+++ +++ #{label}" puts args.inspect end def create_categories_list c ...
# encoding: utf-8 class CompaniesController < ApplicationController before_filter :authenticate_user!, except: [:index, :show] before_filter :admin_user, only: [:new, :create, :edit, :update, :destroy] def index @companies = Company.all end def show @company = Company.find(params[:id]) @feed_ent...
class AddSourceToSongs < ActiveRecord::Migration def change add_column :songs, :source, :string, :default => 'direct' add_column :songs, :soundcloud_id, :integer end end
module RailsAdmin module Config module Actions class Dashboard < RailsAdmin::Config::Actions::Base RailsAdmin::Config::Actions.register(self) require "ibm_watson/authenticators" require "ibm_watson/text_to_speech_v1" require "http" include IBMWatson register_instance_option...
module ListMore class SignUp < UseCase attr_reader :params def run params @params = params unless verify_fields return failure "Please check all fields" end user = ListMore.users_repo.find_by_username params['username'] if user return failure "User already exist...
class Pic < ActiveRecord::Base belongs_to :pin belongs_to :user has_attached_file :image, :styles => {:large => "640x480>", :medium => "200x200>", :thumb => "100x100>" } end
class CreateDevelopmentalLevels < ActiveRecord::Migration def change create_table :developmental_levels do |t| t.integer :student_id t.date :observed_on t.string :recorder t.integer :duration # Facilitated By Adult, in developmental_levels/developmental_level_options #...
class CreateTasks < ActiveRecord::Migration[5.0] def up create_table :tasks do |t| t.string :name t.references :card t.boolean :done t.timestamps end end def down drop_table :tasks end end
class Api::V1::CompositionsController < ApplicationController def index compositions = Composition.all render json: CompositionSerializer.new(compositions) end def create composition = Composition.new({ characters: composition_params[:characters], colors: ...
class LikesController < ApplicationController # POST /likes # POST /likes.json def create @attendance = Attendance.find(params[:attendance_id]) @like = Like.new(:attendance_id => @attendance.id, :user_id => current_user.id, :conference_id => @attendance.conference.id) logger.info(@like.attendance_id.t...
class Session < ActiveRecord::Base belongs_to :experiment belongs_to :lab, inverse_of: :sessions has_many :registrations, :dependent => :delete_all has_many :users, through: :registrations before_validation :set_duration_if_nil after_update :check_for_suspend before_save :reset_reminder validate :valid...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| # All Vagrant configuration is done here. See: vagrantup.com. # Build against CentOS 6.4 minimal, without any config management utilities. config.vm.box = "centos64" config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/cent...
module GapIntelligence # @see https://api.gapintelligence.com/api/doc/v1/promotions.html module Promotions # Requests a list of promotions # # @param params [Hash] parameters of the http request # @param options [Hash] the options to make the request with # @yield [req] The Faraday request #...
require_relative '../../spec_helper' RSpec.describe OpenAPIParser::Schemas::RequestBody do let(:root) { OpenAPIParser.parse(petstore_schema, {}) } describe 'correct init' do subject { operation.request_body } let(:paths) { root.paths } let(:path_item) { paths.path['/pets'] } let(:operation) { pat...
# 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...
json.board do json.extract! @board, :id, :title json.userIds @board.users.ids end json.lists do @board.lists.each do |list| json.set! list.id do json.extract! list, :id, :title json.cardIds list.cards.order('ord').ids end end end json.cards do @board.lists.each do |list| list.card...
### ### Provides a hash of "cheat_prefix+hostname" => count ### Useful for functions a user may not do too often ### module Ricer::Plug::Extender::HasCheatingDetection OPTIONS ||= { max_attempts: 1 } def has_cheating_detection(options={}) class_eval do |klass| # Options merge_options(op...
# frozen_string_literal: true require 'omniauth-oauth2' require 'jwt' module OmniAuth module Strategies class Hydra1 < OmniAuth::Strategies::OAuth2 option :client_options, { site: 'https://auth-v1.raspberrypi.org', authorize_url:'https://auth-v1.raspberrypi.org/oauth2/auth', ...
class VideoGameResource < ApplicationResource attributes :title has_one :user before_create { _model.user = current_user } before_create { authorize(_model, :create?) } before_update { authorize(_model, :update?) } before_remove { authorize(_model, :destroy?) } def self.creatable_fields(context) s...
class Post < ActiveRecord::Base belongs_to :category scope :rails, -> { where(category_id: 1) } extend FriendlyId friendly_id :title, :use => [:slugged, :finders] mount_uploader :image, ImageUploader end
class AddDataToOwners < ActiveRecord::Migration def change add_reference :owners, :profile, index: true, foreign_key: true add_column :owners, :mon, :boolean, null: false, default: false add_column :owners, :tue, :boolean, null: false, default: false add_column :owners, :wed, :boolean, null: fals...
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure(2) do |config| config.vm.box =...
require 'open-uri' module Usda class Downloader TEMP_DIR = 'usda_temp' ZIP_FILE_URL = "http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip" def run download unzip end private def download puts "Downloading #{ZIP_FILE_URL}..." @zip_file = open(...
class OpenSourceStats class User attr_accessor :login def initialize(login) @login = login end # Returns an array of in-scope Events from the user's public activity feed def events @events ||= begin if self.class == OpenSourceStats::User events = client.user_public...
# frozen_string_literal: true class Course < ApplicationRecord include Auditable include Delegable include SplitMethods include TimeZonable extend FriendlyId zonable_attribute :next_start_time strip_attributes collapse_spaces: true friendly_id :name, use: [:slugged, :history] belongs_to :organizati...
class Pubsub::BaseController < ActionController::API before_action :validate_bearer_token! private def validate_bearer_token! begin token = Authenticator.access_token(request.headers["Authorization"]) unless Authenticator.validate_token(token) head :unauthorized end rescue Auth...
require 'skyrocket/version' module Skyrocket autoload :Asset, "skyrocket/asset" autoload :AssetDependency, "skyrocket/asset_dependency" autoload :AssetLocator, "skyrocket/asset_locator" autoload :AssetFactory, "skyrocket/asset_factory" autoload :AssetManager, ...
class Djoque < ApplicationRecord belongs_to :djoker has_many :likes end
require 'tempfile' module RubyMelee class FakeWardenClient def self.launch_container return 'fake-container-handle' end def self.run(container, content) # create temp file file = Tempfile.new('melee.rb') file.write content file.close # run it output = `ruby #{...
require 'rake' require 'pathname' module Lightspeed # Like Rake::FileCreationTask (which is used primarily for creating # directories), but used for creating symbolic links. This task will # always be needed until a symlink exists at the path specified by # +name+. # class SymlinkCreationTask < Rake::File...
class CreateMemberships < ActiveRecord::Migration def change create_table :memberships do |t| t.integer :donor_id, null: false t.integer :amount_in_cents, null: false t.integer :year, null: false t.foreign_key :donors, dependent: :destroy t.timestamps null: false end end end
require "test_helper" require "fluent/plugin/parser_apache" require "fluent/plugin/parser_nginx" module RegexpPreview class SingleLineTest < ActiveSupport::TestCase data("regexp" => ["regexp", Fluent::Plugin::RegexpParser, { "expression" => "(?<catefory>\[.+\])", "time_format" => "%Y/%m/%d" }], "ltsv" =...
# frozen_string_literal: true require_relative '../lib/relax.rb' describe Relax::ColorSpace::Rgba do let(:my_color) { Relax::ColorSpace::Rgba.new(1, 1, 1, 0.8) } context 'Correct instantiating' do it 'Instantiate a Relax::ColorSpace::Rgba object by default method' do expect(my_color).to be_a Relax::Col...
require 'rails_helper' RSpec.describe ContactsController, :type => :controller do login_user describe "GET new" do it "returns http success" do get :new expect(response).to have_http_status(:success) end it "renders the new template" do get :new expect(response).to render_templa...
require 'test_helper' class AnalysisRequestsControllerTest < ActionDispatch::IntegrationTest setup do @analysis_request = analysis_requests(:one) end test "should get index" do get analysis_requests_url assert_response :success end test "should get new" do get new_analysis_request_url a...
desc "Update pot/po files." task :updatepo do require 'gettext/utils' puts "Generating pot files for lib" GetText.update_pofiles("restore", Dir.glob("{lib}/**/*.{rb,rhtml}"), "restore 4.0") Dir.chdir('frontend') do puts "Generating pot files for frontend" GetText.update_pofiles("restore-frontend", D...
class Ride < ApplicationRecord belongs_to :user has_many :requests belongs_to :driver, :class_name => "User", optional: true 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 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...
class Calc::MeasureSelectionsController < SecuredController before_action :set_audit_report def create measure = Measure.find(params[:measure_selection][:measure_id]) selection = MeasureSelectionCreator.new( measure: measure, audit_report: @audit_report).create calculator = AuditReportCal...
FactoryBot.define do factory :organization do id { SecureRandom.uuid } name { Faker::Company.name } description { Faker::Company.catch_phrase } end end
class ItemSerializer include FastJsonapi::ObjectSerializer attributes :id, :name, :description, :unit_price, :merchant_id attribute :unit_price do |object| (object.unit_price.to_f.to_r / 100).to_f.to_s end end
require 'rails_helper' require 'spec_helper' describe EventsController do let(:user) { User.create(name: "numichuu", password: "test", password_confirmation: "test", phone_number: "123-123-1234", email:"numichuu@gmail.com")} let(:new_event) { Event.create(title: "BeerFest", status: "Active", creator_id: user.id) }...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable mount_uploader :user_image, ImageUploader devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable extend Act...
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru> # frozen_string_literal: true require 'openssl' require_relative 'base_client' # Usage example: # # puts PeatioAPI::Client.new(endpoint: ENTPOINT).get_public('/api/v2/peatio/public/markets/tickers') # puts client.get '/api/v2/peatio/orders', market: 'ethbtc' ...
module API module V1 class BilibilisAPI < Grape::API helpers API::SharedParams resource :bilibilis, desc: "弹幕接口" do desc "获取某个视频流的最新的一部分弹幕消息" params do requires :sid, type: String, desc: "视频ID" optional :size, type: Integer, desc: "获取记录的条数,默认为30条" ...
class CommentsController < ApplicationController before_action :authenticate_user!, except: :top_10_commenters def create @comment = movie.comments.build(comment_params) if @comment.save redirect_to movie_path(movie), notice: "Comment was successfully created." else puts @comment.errors.in...
module Cinch module Helpers # Helper method for turning a String into a {Target} object. # # @param [String] target a target name # @return [Target] a {Target} object # @example # on :message, /^message (.+)$/ do |m, target| # Target(target).send "hi!" # end def Target(targ...
# ../data.img#1771563:1 require_relative '../../lib/parser/comment' require_relative '../../templates/types/function' # Warning! This Tests have some sideeffects. All registered Tokens will create Classes, that are not # removed on unregister describe Token::Handler, ".register" do before :each do Token::Han...
require 'pry' class IntCode attr_accessor :instructions OPCODE_ADD = 1 OPCODE_MULT = 2 OPCODE_INPUT = 3 OPCODE_OUTPUT = 4 OPCODE_JUMP_IF_TRUE = 5 OPCODE_JUMP_IF_FALSE = 6 OPCODE_LESS_THAN = 7 OPCODE_EQUALS = 8 OPCODE_ADJ_REL_BASE = 9 OPCODE_END = 99 FULL_OPCODE_INSTRUCTION_LEN = 5 MAX_PARAMS...
# 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 Penyakit include Mongoid::Document field :nama, type: String field :deskripsi, type: String field :solusi, type: String has_and_belongs_to_many :gejalas has_one :klien end
class RyshDate def initialize date @date = date end def self.day_name number case (number % 7)+1 when 1; "Sunsday" when 2; "Moonsday" when 3; "Landsday" when 4; "Midweek" when 5; "Queensday" when 6; "Kingsday" when 7; "Starsday" end end end
# == Schema Information # # Table name: users # # id :integer not null, primary key # email :string(255) default(""), not null # name :string(255) # encrypted_password :string(255) default(""), not null # reset_passwo...
require 'colorize' class Word attr_accessor :guessed_letters, :blanks, :wrong_guesses, :letters, :name def initialize(word) @name = word @letters = word.chars @blanks = [] @guessed_letters = [] @guess = "" @wrong_guesses = 0 create_blank_array end def create_blank_array @lette...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception skip_before_action :verify_authenticity_token def after_sign_in_path_for(resource) #Update this when we are goi...
# manejo de excepciones en ruby def convert_number(s) begin Integer(s) rescue ArgumentError nil end end
require 'rails_helper' describe 'Channel Parser' do describe '.parse' do context 'with valid parameters' do it 'creates a new channel if one does not exist' do team = create(:team) ChannelParser.parse(create_pull_request_params, team) expect(Channel.all.size).to eq(1) end ...
module Zaypay require 'yaml' # PriceSetting instances allows you to communicate to the Zaypay platform. # # It is basically a Ruby wrapper for the Zaypay-API, which provides you a bunch of payment-related methods, as well as some utility methods. class PriceSetting include HTTParty attr_reader :pri...
cask 'ultimate-control' do version '1.2' sha256 '8f26885d60c2afc502d97039c115f6bfcd22cee34ec9741017bc4d73bc3e5498' url "http://www.negusoft.com/downloads/ultimate_control_v#{version}_mac.dmg" name 'Ultimate Control' homepage 'http://www.negusoft.com/index.php/ultimate-control' license :mpl tags :vendor =...
class Api::RentalsController < ApplicationController def index @rentals = Rental .where(lessee: current_user) .includes(:lessor, :listing, :review) .order(:start_date) end def create if (Date.parse(params[:rental][:start_date]) rescue nil).nil? return rende...
class CreateSendMessages < ActiveRecord::Migration def change create_table :send_messages, options: 'ENGINE=InnoDB, CHARSET=utf8' do |t| # 点对点的系统消息表 t.text :message # 系统消息 t.integer :m_type, :default => '0' # 是管理员发送还是用户发送(0管理员发送,1用户发送) t.integer :sender_id # 发送者id ...
class Account < ActiveRecord::Base belongs_to :account_type belongs_to :member end
class Contact < ApplicationRecord has_many :conshejointables has_many :sheets, through: :conshejointables has_many :descriptions def name self.first_name + " " + self.last_name end def order_number(sheet) Conshejointable.where(:sheet_id=> sheet.id, :contact_id => self.id).first.order_number en...
require_relative 'mongo' class CalendarItem include Mongoid::Document field :outlook_id, type: String field :google_id, type: String field :location, type: String field :organizer_name, type: String field :subject, type: String field :my_response, type: String field :start, type: DateTime field :en...
class ChatroomsController < ApplicationController before_action :authenticate_user! def index @chatrooms = current_user.chatrooms.uniq.reverse end def new @chatroom = room_exist? if @chatroom redirect_to @chatroom else create_chatroom end end def create create_chatroom ...
class Public::CartProductsController < ApplicationController before_action :authenticate_customer! def index @cart_products = current_customer.cart_products @total_price = 0 @cart_products.each do |cp| # @total_price = @total_price + (cp.quantity * cp.product.price) @total_price += cp.quan...
class UserWorker include Sidekiq::Worker def perform(user_name) puts "-"*50 puts "name: #{user_name}" puts "-"*50 end end
require "thor" require "json" require "httpclient" class Updater < Thor REPO = "artpolikarpov/fotorama" include Thor::Actions desc "fetch source files", "fetch source files from GitHub" def fetch tag = fetch_tags.last self.destination_root = "vendor/assets" remote = "http://fotorama.s3.amazonaws....
class Admin::PlayersController < ApplicationController before_action :authorize before_action :set_player, only: [:edit, :update, :destroy] # GET /players # GET /players.json def index @players = Player.all end # GET /players/1 # GET /players/1.json def show respond_to do |format| form...
class Student < ActiveRecord::Base # implement your Student model here validates :email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ } belongs_to :teacher after_save :add_field, if: :teacher def add_field Teacher.last_student_added_at = Time.now end def name first_...
class Vaso attr_accessor :cantidad_de_azucar attr_accessor :tiene_cafe attr_accessor :tiene_te attr_accessor :tiene_leche def initialize self.cantidad_de_azucar = 0 end def tiene_cafe? self.tiene_cafe end def tiene_te? self.tiene_te end def tiene_leche? self.tiene_leche end ...
require 'ruby_rhymes' require 'string_to_arpa' class Poetry_Utils def does_rhyme(line1, line2) #get the phrases' rhyme keys keys1 = line1.to_phrase.rhyme_keys keys2 = line2.to_phrase.rhyme_keys #check intersections between rhyme key arrays of the two end words if (keys1 & keys2).empty? return false els...
require 'rails_helper' RSpec.describe 'Pricing Api' do let!(:panel_provider1) { create(:panel_provider) } let!(:panel_provider2) { create(:panel_provider) } let!(:panel_provider3) { create(:panel_provider) } let(:panel_provider) { panel_provider1 } let!(:user) { create(:user, panel_provider_id: panel_prov...
require 'rails_helper' feature 'vendor onboards for site' do scenario 'by registering' do visit root_path click_link "Sign up" expect(page).to have_text('Begin accepting payments') fill_in_registration_fields expect(page).to have_content('Welcome! You have signed up successfully.') end scena...
class Fabric < ActiveRecord::Base has_many :wedding_dresses, :inverse_of => :fabric validates :fabric_type, :presence => true validates :fabric_type, length: { maximum: 45 } end
require 'rails_helper' describe LocationDate do # Constants describe "Constant" do it "Should have be this DAYSLIST constant in LocationDate" do LocationDate.should have_constant("DAYSLIST") end it "Should have proper imoprt file extension" do LocationDate::DAYSLIST.should eq([["Monday", ...
require 'wsdl_mapper/runtime/request' module WsdlMapper module Runtime module Middlewares class SimpleRequestFactory # Serializes the `message`, sets the service URL and adds SOAPAction and Content-Type headers. For serialization # it relies on {WsdlMapper::Runtime::Operation#input_s8r} to ...
Rails.application.routes.draw do get 'homes/about' get 'homes/top' root 'homes#top' devise_for :users, :controllers => { :sessions => "users/sessions", :passwords => "users/passwords", :registrations => "users/registrations" } devise_for :admins, :controllers => { :sessions => "admins/sessio...
class Comment < ActiveRecord::Base belongs_to :post belongs_to :user has_many :likes, as: :likable_object has_many :liking_users, through: :likes, source: :user attr_accessible :details def liked_by_user?(user) return user.liked_comments.include?(self) end end
module Phaseout class SEOFields attr_reader :key, :human_name attr_accessor :values, :default alias :fields :values def initialize(key, human_name, values = Hash.new, &block) @key, @human_name, @values = I18n.transliterate(key).gsub(/\s+/, '_').underscore, human_name, values yield(self) i...
# frozen_string_literal: true require 'rubocop/rake_task' require 'rake/testtask' require 'rake/packagetask' require 'rubygems/package_task' desc 'Run linter and tests' task default: %i(rubocop test) RuboCop::RakeTask.new Rake::TestTask.new do |t| t.test_files = FileList['test/spec*.rb'] # t.verbose = true end ...
# encoding: utf-8 require "logstash/outputs/base" require "logstash/namespace" require "stud/buffer" class LogStash::Outputs::AzureLogAnalytics < LogStash::Outputs::Base include Stud::Buffer config_name "azure_loganalytics" # Your Operations Management Suite workspace ID config :customer_id, :validate => :s...
class Story include Mongoid::Document field :updated_date, type: Time field :last_id, type: Integer embeds_many :texts def self.fetch_from_twitter client = AbroadTwitter.getClient if !client return end texts = [] options = { :count => 200, :trim_user => true, :exclude_replies => true, ...
require 'net/http' require 'json' module Kademy class Request attr_accessor :uri, :http, :response, :request def initialize(options = {}) end def get(path = "", options={}) @uri = build_uri(path) @http = Net::HTTP.new(@uri.host, @uri.port) @http.use_ssl = (@uri.scheme == 'https')...
require 'digest' module WebShield class ThrottleShield < Shield # Options: # period: required # limit: required # method: optional # path_sensitive: optional, defualt false allow_option_keys :period, :limit, :method, :path_sensitive, :dictatorial def filter(request) req_p...
module Filter8 class Request attr_accessor :content def initialize(content, options = {}) if content.is_a? Hash @content = content[:content] options = content.reject!{ |k| k == :content } else @content = content end raise Exception.new("No value for 'content' g...
=begin Using the following code, add the appropriate accessor methods. Keep in mind that the last_name getter shouldn't be visible outside the class, while the first_name getter should be visible outside the class. class Person def first_equals_last? first_name == last_name end end person1 = Person.new pers...
# @param {Integer} n, a positive integer # @return {Integer} def hamming_weight(n) count = 0 n.to_s(2).each_char do |char| count += 1 if char == '1' end return count end
class ClassesController < ClassesControllerBase before_action :find_clazz, except: [:new, :create] before_action :owns_clazz, except: [:new, :create, :show] def show @is_owner = owner? @clazz = @clazz.decorate NavbarConfig.instance.back_link = request.referer || profile_path(@clazz.instructor_profile...
FactoryGirl.define do sequence(:handle) { |n| "handle#{n}" } sequence(:email) { |n| "email#{n}@example.com" } factory :user do handle { generate :handle } email { generate :email } password 'password' password_confirmation 'password' end ...
namespace :seed do desc "Makes all genderless users male and all orientationless users gay, then creates valid matches" task fill_in_user_data: :environment do User.all.each do |u| u.gender = true if u.gender.nil? u.orientation = 'gay' if u.orientation.nil? u.save end Match.create_val...