text
stringlengths
10
2.61M
# # @author Kristian Mandrup # # Valid roles module # Adds methods for operating on/with valid roles # module Troles::Common class Config module ValidRoles # Add a list of valid roles # @param [Array<Symbol>] names of roles to make valid def add_valid_roles *roles valid_roles =valid...
#!/usr/bin/env ruby # This file is under the BSD 3 Clause (BSD-3-Clause) License # vim: set ts=2 sw=2 sts=2 noet: # # ---BEGIN COPYRIGHT NOTICE--- # Copyright 2017 Christopher L. Ramsey # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following co...
class RemoveUsersIdFromTweets < ActiveRecord::Migration[6.0] def change remove_column :tweets, :use_id, :string end end
class ApplicationController < ActionController::Base protect_from_forgery respond_to :json helper_method :current_user helper_method :authorize private def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end def authorize unless current_user ...
require 'rails_helper' RSpec.describe WordsKey, type: :model do it 'has a valid factory' do expect(create :words_key).to be_valid end it { should belong_to :client_segment } end
# frozen_string_literal: true require "spec_helper" RSpec.describe Milestoner::CLI do include_context "with Git repository" using Refinements::Pathnames describe ".start" do subject(:cli) { described_class.start command_line } let(:version) { "0.0.0" } let(:options) { [] } let(:command_line) ...
# encoding: utf-8 class WinesController < ApplicationController before_action :set_wine, only: [:show, :edit, :update, :destroy] before_action :set_winetypes, :set_winevarieties, :set_situations, only: [:new, :edit, :create, :update] protect_from_forgery :except => [:create] UNKNOWN_COUNTRY_OR_LOCALREGION_ID =...
class CreateAdministrators < ActiveRecord::Migration[5.0] def change create_table :administrators, force:true do |t| t.timestamps null:false # The email used to log into this account t.string :email, null:false, index:true # Visible information about this account t.string :name, ...
#!/usr/bin/env ruby module Hive class Tester include Bug # Are we touching any colors that aren't our own color? def legal_placement? @sides.each{|side| return false if side.bug != false && side.bug.color? != self.color? } return true end end end
class PassionCareer < ActiveRecord::Base belongs_to :passion belongs_to :career end
module Api module V1 class TranslationsController < ApplicationController include Errors include SevadaarFinder include BaaniFinder include TranslationFinder include FormObjectGenerator before_action :check_if_sevadaar! before_action :check_for_translation_params, only: ...
# frozen_string_literal: true # json.events @events json.events @events do |event| json.id event.id json.name event.name json.date event.date.strftime('%Y-%m') end
# -*- coding: binary -*- require 'rex/peparsey/exceptions' require 'rex/struct2' module Rex module PeParsey class PeBase # #define IMAGE_DOS_SIGNATURE 0x5A4D // MZ IMAGE_DOS_SIGNATURE = 0x5a4d IMAGE_DOS_HEADER_SIZE = 64 # Struct # typedef struct _IMAGE_DOS_HEADER { // DOS .EXE...
require 'test_helper' class OauthTest < SystemTest setup do ensure_site_host_setup end test "admin users may create applications" do user = create(:user, email: Gemcutter.admins.first, password: "secret123", handle: "nick1") sign_in(user) oauth_path = url_helpers.new_oauth_application_path ...
require 'rails_helper' RSpec.describe "Movie show page", :vcr do before :each do |test| @user = User.create!(email: "123@email.com", password: "1111") allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(@user) unless test.metadata[:logged_out] end it "shows a movie's detail...
# frozen_string_literal: true # NilClass class NilClass # NilClass to bool # # @example # nil.to_bool # => false # # @return [FalseClass] def to_bool false end end # String class String # String to bool # # @example # 'yes'.to_bool # => true # # 'no'.to_bool # => fals...
# frozen_string_literal: true module GraphQL class Schema class Addition attr_reader :directives, :possible_types, :types, :union_memberships, :references, :arguments_with_default_values def initialize(schema:, own_types:, new_types:) @schema = schema @own_types = own_types @...
class LeagueSeason < ApplicationRecord belongs_to :league has_many :team_seasons has_many :teams, through: :team_seasons has_many :matches def league_top_scorers scorers = PlayerSeason.where.not(total_goals: nil) scorers.sort_by(&:total_goals).reverse.first(10) end def league_top_assists ...
RSpec.describe DistributionUpdateService, type: :service do describe "call" do # TODO: this function was extracted to the service object - do we need a parallel test? let!(:distribution) { FactoryBot.create(:distribution, :with_items, item_quantity: 10) } let!(:new_attributes) { { line_items_attributes: ...
#!/usr/bin/env ruby require_relative '../lib/riak-rooms' extend RiakRooms::Client def clear_bucket(bucket) keys_to_clear = get_keys(bucket) pb = ProgressBar.create(title: 'Deleting', total: keys_to_clear.size, format: '%e |%b>>%i| %p%% %t') keys_to_clear.each_with_index do |key, i| get_bucket(bucket).del...
require 'rubygems' begin require 'jeweler' Jeweler::Tasks.new do |gemspec| gemspec.name = "movable_erb" gemspec.summary = "A General-purpose CSV to ERB template formatter" gemspec.description = "A General-purpose CSV to ERB template formatter. Useful for converting legacy CSV data to an importable blog...
require 'spec_helper' feature 'Viewing the Outcome of the game' do let!(:user) do User.create(name: 'Iain', email: 'iain@example.com', password: 'blue', password_confirmation: 'blue') end scenario 'player wins' do sign_in(email: user.email, password: user...
class User < ApplicationRecord devise :database_authenticatable, :token_authenticatable has_many :posts before_save :ensure_authentication_token end
module Cultivation class QueryTasksByDate prepend SimpleCommand def initialize(args = {}) raise ArgumentError, 'date is required' if args[:date].blank? raise ArgumentError, 'facility_ids is required' if args[:facility_ids].blank? raise ArgumentError, 'facility_ids must be an array' unless a...
# 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...
# == Schema Information # # Table name: users # # id :integer not null, primary key # name :string # email :string # created_at :datetime not null # updated_at :datetime not null # password_digest :string # require 'spec_helper' describe User ...
class Movie < ActiveRecord::Base belongs_to :product belongs_to :movie_site validates_presence_of :name, :movie_site,:keyword def content(option=:normal) case true when option == :mini width = "100" height = "60" when option == :normal width = self.movie_site.width....
FactoryBot.define do factory :micropost, class: Micropost do content { "test" } picture { File.new("spec/factories/test_picture.jpg") } end end
class CreateCreditCardCharges < ActiveRecord::Migration def change create_table :credit_card_charges do |t| t.float :amount t.string :unique_code t.boolean :paid t.boolean :refunded t.references :user, index: true t.references :company, index: true t.timestamps null: fal...
class Post < ApplicationRecord validates :content, presence: { message: 'Content is required' }, length: { minimum: 100, maximum: 500 } validates :title, presence: { message: 'Title is required' }, length: { minimum: 10, maximum: 50 } belongs_to :user has_many :comments end
require 'rails_helper' RSpec.describe AdminMailer, type: :mailer do describe '.user_details' do subject(:email) { described_class.user_details user } let(:user) { build_stubbed :user } it 'sets email Subject header' do expect(email.subject).to eq "User Admin: details of user ##{user.id}" end ...
module TicTacToe class Board attr_reader :grid def initialize(input={}) #Board class can be instantiated with input hash or default value @grid = input.fetch(:grid, default_grid) end def get_cell(x,y) grid[y][x] end def set_cell(x,y,value) get_cell(x,y).value = value end def game_ov...
# frozen_string_literal: true require 'webmock/rspec' require_relative '../../lib/main' # rubocop:disable Metrics/BlockLength describe Main do context 'for input sanitation' do it 'drops commas' it 'trims whitespaces' it 'removes duplicates' it 'removes URL hostile characters' end # I don't mi...
# frozen_string_literal: true require 'spec_helper' RSpec.describe Robots::DorRepo::Accession::ResetWorkspace do let(:druid) { 'druid:oo000oo0001' } let(:robot) { described_class.new } let(:object_client) { instance_double(Dor::Services::Client::Object, workspace: workspace_client) } let(:workspace_client) { ...
class UsersController < ApplicationController respond_to :html skip_login :only => [:new, :create] logout :only => [:new, :create] def new @user = User.new end def create @user = User.new params[:user] if @user.save UserMailer.welcome(@user).deliver flash[:notice] = "Hello #{@user...
class CreateEvents < ActiveRecord::Migration[5.1] def change create_table :events do |t| t.text :event_id t.text :event_name t.text :category t.datetime :start_date_time t.datetime :end_date_time t.timestamps end end end
class CreateMyLists < ActiveRecord::Migration[5.2] def change create_table :my_lists do |t| t.integer :movie_id, null: false t.integer :profile_id, null: false t.timestamps end add_index :my_lists, [:movie_id, :profile_id], unique: true end end
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable before_save :ensure_a...
# frozen_string_literal: true require "tempfile" RSpec.describe(Dry::Monads::Maybe) do before(:all) do Dry::Core::Deprecations.set_logger!(Tempfile.new("dry_deprecations")) end maybe = described_class some = maybe::Some.method(:new) none = maybe::None.new result = Dry::Monads::Result success = resu...
if defined?(ChefSpec) ChefSpec.define_matcher :mysql_config ChefSpec.define_matcher :mysql_service ChefSpec.define_matcher :mysql_client # mysql_client_client_installation_package def install_mysql_client_installation_package(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:mysql_client_installati...
require_relative '../lib/order' RSpec.describe 'Order' do subject(:order) { Order.new('VS5', 24) } context 'process' do it 'should return the correct output, breakdown, and cost' do output = "24 VS5 $55.92\n\t8 x 3 $6.99" breakdown = ['8 x 3 $6.99'] cost = '55.92' expect(order.process...
class QuizzesController < ApplicationController http_basic_authenticate_with :name => 'quizadmin', :password => 'YotQuiz2014', :only => [:new, :edit, :create, :update, :destroy] # GET /quizzes # GET /quizzes.json def index @search = Quiz.sortById.search(params[:q]) @quizzes = @search.result.page(params[...
require 'bundler/setup' require_relative './lib/itamae_executor' roles = Dir.glob('./roles/*').map { |dir| File.basename(dir) }.sort roles.each do |role| desc "configure #{role}" task role do ItamaeExecutor.execute_role(role) end end desc 'apply configuretion for current OS' task :apply do ItamaeExecutor....
class TaskListsController < ApplicationController def index @lists = TaskList.all @list = TaskList.find_by(params[:id]) end def show @list = TaskList.find_by(params[:id]) end def new @lists = TaskList.new end def create @tasklist = TaskList.new task_list_params @tasklist.user =...
require File.dirname(__FILE__) + '/../test_helper' require 'old_node_controller' class OldNodeControllerTest < ActionController::TestCase api_fixtures # # TODO: test history # ## # test the version call by submitting several revisions of a new node # to the API and ensuring that later calls to version ...
class Invitation < ActiveRecord::Base belongs_to :user validates_presence_of :user end
module Gollum class Macro class Video < Gollum::Macro def render (fname) "<video width=\"100%\" height=\"100%\" src=\"#{CGI::escapeHTML(fname)}\" controls=\"true\"> HTML5 video is not supported on this Browser.</video>" end end end end
require 'airport' describe Airport do context 'taking off and parking' do it 'a plane can park' do subject.park(:plane) expect(subject.planes).to eq([:plane]) end it 'a plane cannot be parked twice' do subject.park(:plane) expect { subject.park :plane }.to raise_error 'Plane is ...
class AddFrontPageToBlocks < ActiveRecord::Migration[5.0] def change add_column :blocks, :front_page, :boolean, index: true end end
require 'spec_helper' describe Notification do describe :notify do it "should be able to notify users directly" do user = create(:user) nr = build(:notification_receiver, model_name: "MDB::User", action: "create") nr.receiver = user nr.save Notification::Handles::Base.default...
class DailySystemNotificationWorker include Sidekiq::Worker sidekiq_options queue: 'low' attr_reader :current_time # NOTE: This worker is responsible to send out system notifications # E.g. # - batch about to start # - unassigned task in batch def perform(*args) time_travel @current_time = Tim...
class CreateJobs < ActiveRecord::Migration def change create_table :jobs do |t| t.string :title t.text :description t.date :posted_date t.integer :company_id t.integer :min_ex t.integer :max_ex t.integer :job_source_id t.string :job_link t.timestamps end ...
#A program which, given a dictionary, generates two output files, 'sequences' and 'words'. 'sequences' contains every sequence of four letters that appears in exactly one word of the dictionary, one sequence per line. 'words' contains the corresponding words that contain the sequences, in the same order, again one per ...
module Stores class V1 < Grape::API resource :stores do # GET /api/v1/stores desc 'Returns all stores' get do Product.all end end # resource :stores end end
# encoding: utf-8 # # © Copyright 2013 Hewlett-Packard Development Company, L.P. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
class CreateOrganizationCustomers < ActiveRecord::Migration def change create_table :organization_customers do |t| t.string :name t.integer :organzation_id t.integer :gender t.string :ethnic_name t.date :birth t.string :id_no t.string :id_address t.integer :hukou_ty...
require 'aws-sdk-v1' require 'json' require 'net/http' module DCC class EC2 def initialize(runs_on_ec2) @runs_on_ec2 = runs_on_ec2 end def add_tag(name, value) instance.add_tag(name, value: value) if runs_on_ec2? end def remove_tag(name) instance.tag(name).delete if runs_on_ec2? end def n...
module Usermanagement class ApplicationController < ::ApplicationController layout 'usermanagement/layouts/application' # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. # ToDo: protect_from_forgery with: :exception protected def redirect...
class PresidentsController < ApplicationAdminsController before_action :set_company def new; end def create if User.where(company_id: @company.id).where(president: true).empty? User.create(params.permit(:email, :name, :password).merge(president: true, company_id: @company.id)) end redirect_to ...
require 'csv' class Post < ActiveRecord::Base belongs_to :user, autosave: true belongs_to :postable, :polymorphic => true, autosave: true, optional:true validates_presence_of :body scope :visible, -> { where(:visible => true) } after_create :update_postable_freshness after_destroy :update_postable_on_destr...
class GossipController < ApplicationController before_action :authenticate_user, only: [:new, :edit, :destroy] before_action :verify_user_rights, only: [:edit, :destroy] def index @all_gossip = Gossip.all end def show @gossip = Gossip.find(params[:id]) @comments = @gossip.comments @comment = Com...
class Card attr_reader :rank, :suit, :value, :orientation def initialize(rank, suit, value) @rank, @suit, @value = rank, suit, value @orientation = :face_down end def toggle_value return @value unless [1,11].include?(@value) @value = @value == 1 ? 11 : 1 end def name "#{@rank.to_s.cap...
class Event < ApplicationRecord belongs_to :user scope :ordered, -> { order(:start_at) } scope :between, ->(start_date, end_date) do where( "start_at >= ? and end_at <= ?", start_date.beginning_of_day.to_datetime, end_date.end_of_day.to_datetime ) end end
# frozen_string_literal: true # (c) Copyright 2018 AlgoSec Systems # # Licensed under the Apache License, Version 2.0 (the "License"); # You may not use this file except in compliance with the License. # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
Rails.application.routes.draw do root to: "directories#index" resources :directories do resources :file_uploads, only: [:new, :create, :destroy] get 'sub-directory/new', to: 'directories#new', as: :new_sub_directory get 'sub-directory/create', to: 'directories#create', as: :create_sub_directory ...
class AccessController < ApplicationController def enter_index setup_stats setup_log end def enter if permitted_params[:ilsid].present? id = permitted_params[:ilsid].strip.upcase timestamp = Time.zone.now Person.enter(id, timestamp) AccessLog.create(ilsid: id, timestamp: tim...
class AddLatitudeAndLongitudeToMaster < ActiveRecord::Migration def change add_column :masters, :latitude, :float add_column :masters, :longitude, :float end end
Rails.application.routes.draw do root 'sessions#new' get '/help', to: 'static_pages#help' get '/comments', to: 'static_pages#comments' get '/home', to: 'static_pages#home' get '/admin', to: 'static_pages#admin' get '/login', to: 'sessions#new' post '/login', to: 'sessions#cr...
# from 172.16.0.0 to 172.31.255.255 IP_ADDRESS_REGEX = /^((?:(?:^|\.)(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){4})$/ def is_valid_ip_address (ip) ip =~ IP_ADDRESS_REGEX end p is_valid_ip_address("999.16.0.0") ? "Valid" : "Invalid" p is_valid_ip_address("168.16.1.2") ? "Valid" : "Invalid" p is_valid_ip_address("168.3...
module Substation module Processor # A processor to evaluate a chain's request input data class Evaluator include Incoming # Initialize a new instance # # @param [Environment] env # the substation environment used to build chains # # @param [#call] handler ...
require "update_recent_records" require_relative "../../app/models/record_type" class Single; end class CubingAverage; end class Record; end describe UpdateRecentRecords do subject { UpdateRecentRecords } let(:user) { stub(:id => 2) } let(:puzzle) { stub(:id => 3) } describe ".for" do it "calls for_amoun...
require "rails_helper" feature "Create a post comment" do include_context "current user signed in" let!(:post) { create :post } background do visit edit_post_path(post) end scenario "User creates a comment" do fill_in "comment_text", with: "some user comment" click_on "Create Comment" exp...
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 include ApplicationHelper include ActionView::Helpers::TagHelper include ActionView::Context helper_method :cur...
class CreatePositions < ActiveRecord::Migration def change create_table :positions do |t| t.integer :recruiter_id t.string :title t.string :number t.string :location t.string :hiring_mgr t.text :job_summary t.text :primary_resp t.text :required_exp t.text :pre...
module Grammar class T attr_accessor :word def initialize word @word = word end def to_s @word end end class NT attr_accessor :symbol, :index def initialize symbol=nil, index=-1 @symbol = symbol @index = index end #FIXME? symbol should not contain [, ] or ", # else we're...
require "pr_geohash" require "rgeo" require "rgeo/geo_json" module Geoq BASE_32 = %w(0 1 2 3 4 5 6 7 8 9 b c d e f g h j k m n p q r s t u v w x y z).join("") class GeomReader attr_reader :wkt GH_REGEX = Regexp.new(/\A[#{BASE_32}]+\z/) LAT_LON_REGEX = /\A-?\d+\.?\d*,-?\d+\.?\d*\z/ ...
class FileSplitsController < ApplicationController before_action :set_file_split, only: [:show, :edit, :update, :destroy] def index authorize FileSplit end def show @file_split = FileSplit.find(params[:id]) authorize @file_split end def new @file_split = FileSplit.new authorize @file_...
require 'rails_helper' RSpec.describe "Check JSON Status", type: :request do describe "/healthcheck.json" do it "responds with status" do get '/healthcheck.json' expect(JSON.parse(response.body, symbolize_names: true)).to eq(status: "ok") end end describe "/ping.json" do it "responds wi...
require 'rails_helper' require 'capybara/rails' RSpec.describe 'Sign Up', type: :model do scenario 'Sign up with valid inputs' do visit '/users/sign_up' fill_in 'Fullname', with: 'Tester3' fill_in 'Username', with: 'tester3' fill_in 'Email', with: 'tester3@test.com' fill_in 'Password', with: '123...
# e.g. I want to create 10 mock users # $ FactoryGirl.create_list(:user, 10) FactoryGirl.define do sequence :name do |n| "Hansel#{n}" end sequence :email do |n| "hansel#{n}@mail.com" end factory :user do provider "twitter" name { generate(:name) } email { generate(:email) } nickname "...
# frozen_string_literal: true require_relative './ansi_color.rb' module TaggedTimestampFormatter extend ANSIColor ERROR = 'ERROR' WARN = 'WARN' module_function def call(severity, time, _progname, message) "#{format_timestamp(time, severity)} #{tags_text}#{message}\n" end def format_timestamp(tim...
class CreateRecords < ActiveRecord::Migration def change create_table :records do |t| t.datetime :started_at t.datetime :ended_at t.integer :score t.references :exam t.references :student t.timestamps end add_index :records, :exam_id add_index :records, :student_id...
require_relative "./piece" class Slider < Piece @@MOVES = {'Rook' => [[-1,0], [0,1], [1,0], [0,-1]], 'Bishop' => [[-1, -1], [-1, 1], [1, 1], [1, -1]], 'Queen' => [[-1,0], [0,1], [1,0], [0,-1], [-1, -1], [-1, 1], [1, 1], [1, -1]]} def valid_moves moves = [] @@MOVES[...
node(:status) { 'success' } node(:users) do child @users, :object_root => false do attributes :username, :city, :state, :uuid node(:image_url) { |user| user.profile_image.url } node(:created_at) { |user| user.created_at.utc.strftime("%Y-%m-%d %H:%M:%S") } end end
# I had some problems with Thread interactions with Sys::Proctable (which uses # WMI) causing faults in the interpreter, with 'handle is invalid' type errors. # Rewrote using the lower level ToolHelp32Snapshot style, and for FFI practice. # # Bear in mind that PROCESSENTRY32 contains much less information than you ...
class RenameTaskDates < ActiveRecord::Migration def change rename_column :tasks, :created_at, :created_on rename_column :tasks, :completed_at, :completed_on end end
require 'spec_helper' describe SoManyFeeds::Manager::TryIt do after(:all) do User.delete_all end subject { page } context 'from the home page I click on "get started!"' do before do visit '/' click_link_or_button 'get started' end it { should have_css('li.current', text: 'step ...
class Member < ActiveRecord::Base has_many :devices has_many :users has_many :member_preferences accepts_nested_attributes_for :member_preferences, :allow_destroy => true def pref(pref_name) # return the value of the passed preference for this member self.member_preferences.find_by_pref(pref_name...
class FontTextMeOne < Formula head "https://github.com/google/fonts/raw/main/ofl/textmeone/TextMeOne-Regular.ttf", verified: "github.com/google/fonts/" desc "Text Me One" homepage "https://fonts.google.com/specimen/Text+Me+One" def install (share/"fonts").install "TextMeOne-Regular.ttf" end test do en...
class Contact < ApplicationRecord validates :name, presence:true validates :email, presence:true validates :content ,presence:true end
require "dotenv" Dotenv.load class Fumimi; end Dir[__dir__ + "/**/*.rb"].each { |file| require file } require "danbooru" require "active_support" require "active_support/core_ext" require "dentaku" require "discordrb" require "google/cloud/storage" require "pg" require "pry" require "pry-byebug" require "mechanize" ...
module WpImportDsl module Wxr # Item's comment class Comment < Base attr_accessor :comment_id, :comment_author, :comment_author_email, :comment_author_url, :comment_author_IP, :comment_date, :comment_date_gmt, :comment_content, :comment_approved, :comment_type, :c...
# frozen_string_literal: true module RubyNext VERSION = "0.12.0" end
class Micropost < ActiveRecord::Base belongs_to :user validates :content, length: {maximum: 140} end
#============================================================================== # Price Formulas # Version: 1.0.1 # Author: modern algebra (rmrk.net) # Date: 1 January 2013 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Description: # # This script lets you calcula...
class Category < ApplicationRecord has_many :line_items scope :expenses, -> { where.not(name: ["Mortgage", "Income", "Reimbursements"]) } validates :name, presence: true def to_s name end def average(range) range = (range || 12).to_i set = gather_all(range) (set.sum / set.count).round(2...
require_relative('../db/sql_runner.rb') require_relative('group_class.rb') require_relative('booking.rb') class Member attr_reader :id attr_accessor :first_name, :last_name, :membership_type def initialize(options) @id = options['id'].to_i if options['id'] @first_name = options['first_name'] @last_...
class CommentsController < ApplicationController def new @topic=Topic.find(params[:topic_id]) @comment=Comment.new end def create @topic = Topic.find(params[:topic_id]) @comment = @topic.comments.build(content_params) if @comment.save redirect_to new_topic_comment_path, success: 'コメ...
require 'rubygems' require 'page-object' class AccountPage include PageObject image(:logo, :css => 'div.usa-brand-img > img') span(:pageTitle,:css => 'span.usa-brand-name') #CashFlow div(:logInName, :css => 'div.usa-navabr-user-badge.ng-binding') h1(:myAccountHeader, :css => 'div.usa-width-one-half > h1') ...
class CreateBingos < ActiveRecord::Migration def change create_table :bingos do |t| t.string :lectivo t.string :rne t.string :recibo t.date :fechapago t.decimal :montopago t.string :posteadopor t.timestamps end end end