text stringlengths 10 2.61M |
|---|
require 'rails_helper'
describe Comment do
it "is valid with a message" do
comment = Comment.new(
message: "you're great"
)
expect(comment).to be_valid
end
it "is invalid without a message" do
comment = Comment.new(
message: nil
)
expect(comment).not_to be_valid
end
it "b... |
class ChangeCallsAddCallType < ActiveRecord::Migration
def up
add_column :calls, :call_type_id, :integer
end
def down
remove_column :call, :call_type_id
end
end
|
# frozen_string_literal: true
require 'csv'
class AdminController < ApplicationController
before_action :authenticate_user_as_admin!
ADMIN_EMAILS = ['hephzi@kiteka.com', 'emmavioletmakinson@gmail.com', 'Liam@goddard.co.uk'].freeze
def index
@questions = Question.all
@allowed_users = AllowedUser.all
... |
class StoresController < ApplicationController
before_action :authenticate_user!
def user_not_authorized
flash[:error] = "You are not authorized to perform this action."
if policy(:store).index?
redirect_to stores_path
else
redirect_to dashboard_path
end
end
def filter
if... |
# frozen_string_literal: true
class TestStudent
extend ActiveModel::Callbacks
define_model_callbacks :initialize, only: :after
include ActiveModel::Model
include Defaults
attr_accessor :name, :token, :_destroy
default :name, "Krystian"
default(:token) { SecureRandom.hex }
def initialize(*)
run_... |
class AppointmentStatus < ActiveRecord::Base
acts_as_paranoid
belongs_to :appointment
end |
# frozen_string_literal: true
require 'spec_helper'
require 'bolt_spec/config'
require 'bolt_spec/conn'
require 'bolt_spec/files'
require 'bolt_spec/integration'
require 'bolt/util'
describe "catch_errors", ssh: true do
include BoltSpec::Integration
include BoltSpec::Config
include BoltSpec::Conn
after(:each... |
class Api::ReportsController < Api::BaseController
before_action :authenticate_user!
def create
report = current_user.reports.build(params.permit(:service_id, :content))
if report.save
return render json: {}, status: 201
else
return render json: {}, status: 422
end
end
end |
class TattoosController < ApplicationController
def new
@tattoo = Tattoo.new
end
def create
@piercing = Piercing.new
@tattoo = Tattoo.new(tattoo_params)
if @tattoo.valid?
WaiverMailer.new_tattoo_waiver(@tattoo).deliver_now
flash[:success] = "Your waiver was sent"
redirec... |
class RoutesController < ApplicationController
http_basic_authenticate_with :name => ENV['ADMIN_NAME'], :password => ENV['ADMIN_PASSWORD']
def index
@routes = Route.order("origin_airport_id ASC")
end
def new
@route = Route.new
end
def create
convert_airport_ids_to_code
convert_price_to_in... |
class BbsMemo < ActiveRecord::Base
has_many :interested_people
has_many :people, :through => :interested_people
belongs_to :template
validates_color_format_of :color
before_save :validate_checked
def self.num_of_need_check
BbsMemo.count(:conditions => ["checked = ? AND (select count(*) from interested... |
class Account < ActiveRecord::Base
has_many :addresses
has_many :orders
has_many :transfers
def hold(amount)
self.balance -= amount
self.held_balance += amount
end
def unhold(amount)
self.balance += amount
self.held_balance -= amount
end
end
|
require "spec_helper"
describe "form items" do
let(:user) { create(:user, role_name: "coordinator") }
let(:form) { create(:form, question_types: ["text", ["text", "text"]]) }
let(:qing) { form.sorted_children.select{ |c| c.type == "Questioning" }.first }
let(:qing_group) { form.sorted_children.select { |c| c.t... |
class FontIosevkaAile < Formula
version "18.0.0"
sha256 "e636114de245a42cc7a071db301ff6eaec2588ebee82ae4373b219afbd2e395c"
url "https://github.com/be5invis/Iosevka/releases/download/v#{version}/ttc-iosevka-aile-#{version}.zip"
desc "Iosevka Aile"
desc "Sans-serif, slab-serif, monospace and quasi‑proportional ... |
namespace :worklists1 do
desc "clone all v1 lists and recreate them in worklists2"
task :clone_all, :needs => :environment do
XmlUtilities.clone_all_v1_lists
end
end |
Given(/^The app is running$/) do
@current_page = page(HelloWorldScreen).await
end
When(/^I click on the Action 1 button$/) do
@current_page.tap_action1_button
end
Then(/^I should see the text "(.*?)"$/) do |arg1|
@current_page.assert_text_is_displayed(arg1)
end |
begin
require 'ptools' # Used to test if a file is binary or not.
rescue LoadError => e
puts e; puts "Install with gem install #{e}"
end
require 'etc'
require 'find'
module Find
TEMPFILE_EXP = /(\._|\~$)/
def match(paths, &block)
matched=[]
excluded_paths = Set.new(paths[:excluded_paths])
excluded_... |
class Car < ApplicationRecord
has_many :answers
mount_uploader :image, ImageUploader
end
|
require 'spec_helper'
describe Figroll do
let(:storage) {described_class::Storage.new}
let(:config) {described_class::Config.new}
before(:each) do
allow(described_class).to receive(:storage).and_return(storage)
allow(described_class).to receive(:config).and_return(config)
allow(described_class).to r... |
module Hubber
module Command
class ApplicationCommand < Base
desc "perform", "Generate new hubber project"
def perform(*args)
puts "Generate new hubber project"
end
end
end
end |
class Concert < ActiveRecord::Base
belongs_to :headliner, class_name: "Artist"
belongs_to :venue
has_many :opening_acts
has_many :comments, as: :commentable
has_many :photos, dependent: :destroy
has_many :rsvps
has_many :attendings, through: :rsvps, source: :fan
validates :opening_acts, presence: true... |
class String
attr_accessor :hash
def hashcode
return @hash if @hash
@hash = 0
i = 0
while i < self.length
@hash = self[i].ord + (31*@hash)
i += 1
end
@hash
end
end
class Fixnum
def hashcode
return self
end
end
class TrueClass
def hashcode
return 1231
end
end
... |
class AddTagListColumnToHero < ActiveRecord::Migration
def change
add_column :heros, :tag_list, :string
end
end
|
class DropInstructorIdFromCourseReviews < ActiveRecord::Migration
def up
remove_column :course_reviews, :instructor_id
end
def down
end
end
|
class PostPolicy < ApplicationPolicy
def update?
record.user_is == user.id || user.type =='AdminUser'
end
end |
class Player
attr_reader :lives
def initialize(player_number)
@player_number = player_number
@lives = 3
end
def lose_life
@lives -= 1
end
end
# two instances of this class will be created: player1 and player2 |
class Install < ApplicationRecord
def self.for_session session
Install.where(session: session.id).first_or_create
end
end
|
# Exercise: Calculating the median of an array of numbers
# Write a method median which takes an Array of numbers as its input and returns the median value.
# You might want to look up the definition of "median."
# For example,
# median([1,2,3]) # => 2
# median([4.5, 0, -1]) # => 0
# median([-100, 100]) # => 0... |
class PlacesController < ApplicationController
def index
if params.has_key? :cuisine_id
respond_with paginate Cuisine.find(params[:cuisine_id]).places
elsif params.has_key? :query
respond_with Place.search(params[:query], params[:location])
else
respond_with paginate Place.all
end
... |
class HashWithMethod < Hash
def self.from(hash)
instance = self.new
hash.symbolize_keys.each do |key, value|
case value
when Hash
value = self.from(value)
when Array
value = value.map { |v| from_any(v) }
end
instance[key] = value
instance.send :define_refer_... |
desc 'Delete friend-volunteer associations that are more than 3 months old'
task :remove_stale_friend_volunteer_associations => :environment do
old_relations = UserFriendAssociation.where('created_at < ?', 3.months.ago)
old_relations.destroy_all
end
|
# == Schema Information
#
# Table name: champion_scores
#
# id :integer not null, primary key
# points :string
# championid :string
# main_champion_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryGirl.define d... |
class Api::AttachmentsController < ApplicationController
before_action :authenticate_user!, only: [:create, :update]
def show
attachment = AttachmentFile.find(params[:id])
@link = attachment.source.expiring_url(10)
@title = attachment.source_file_name
respond_to do |format|
format.html { rend... |
class User < ActiveRecord::Base
has_many :user_games
has_many :answers
end
|
class CreateCountries < ActiveRecord::Migration
def change
create_table :countries do |t|
t.column :country_id, :bigint
t.column :cup_id, :bigint
t.column :active_teams, :bigint
t.timestamps
end
end
end
|
class RenglonReporte
#Lectura de los atributos estado, columnas
attr_reader :estado
attr_reader :columnas
attr_reader :id_columnas
attr_reader :total
#Inicializacion de un objeto RenglonReporte, donde estado es el identificador del reporte
#y total es el total de los valores de las columnas que contiene
def i... |
module Geotab
class IncorrectCredentialsError < StandardError; end
class MissingOrInvalidConnectionError < StandardError; end
class ApiError < StandardError; end
end
|
class FindFour
attr_accessor :currPlayer
INVALID_CHIP_PLACEMENT = -1
CHIP_PLACED = 0
FOUND_FOUR = 1
TIE = 2
FOUR_NOT_FOUND = 3
def initialize
@boardMap = [
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0... |
class AddActionToControllerAction < ActiveRecord::Migration
def change
add_column :controller_actions, :action, :string
end
end
|
class Card < Array
def apr
APR
end
def limit
LIMIT
end
def draw i
raise "amount must be positive" if i[:amount] <= 0
add_transaction :on_day => i[:on_day], :amount => i[:amount]
end
def make_payment i
raise "amount must be positive" if i[:amount] <= 0
add_transaction :on_day =... |
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'main', 'ruby', 'maven', 'tools', 'gem_project.rb')
describe Maven::Tools::GemProject do
before :each do
@project = Maven::Tools::GemProject.new("test")
end
it 'should setup an empty gem project' do
@project.to_xml.should == <<-XML
<p... |
require "spec_helper"
require "rspec_api_documentation/dsl"
resource "Publishing Linx Videos and Sharing With The World" do
let(:user) { project.user }
let(:project) do
project = create(:project)
create(:project_upload, project: project, uploaded_by: project.user)
project
end
put "/api/v1/project... |
module FeatureSharedContexts
# Anonymous
#----------------------------------------------------------------------------
shared_context "as anonymous" do
let!(:registered_store) { FactoryGirl.create(:store) }
let!(:registered_admin) { FactoryGirl.create(:admin) }
before(:each) do
reset_email
e... |
class User < ActiveRecord::Base
has_many :events
has_one :card
has_many :contacts
has_secure_password
validates :firstname, presence: true
validates :lastname, presence: true
validates :email, presence: true# , uniqueness: true
validates :password, length: { in: 1..20}, on: :create
end
|
require 'test_helper'
class NavFlowsTest < ActionDispatch::IntegrationTest
test 'home has nothing selected' do
visit '/'
assert page.has_no_selector?('.navbar li.active')
end
test 'students has students selected' do
assert clicking_on_nav_activates('Students')
end
test 'tips has tips selected' ... |
require "consult_management/susanoo/exports/json_creator"
module ConsultManagement
module Susanoo
module Export
extend ActiveSupport::Concern
included do
action_method :create_consult_json
end
#
#=== 相談窓口管理機能用JSON作成
#
# Jobのアクションに'create_consult_json'が入っている時に、s... |
class Answer < ActiveRecord::Base
belongs_to :question
validates :question_id, presence: true
validates :value, length: { in: 1..200 }
end
|
RailsAdmin.config do |config|
config.main_app_name = ['Hello Work API', 'Admin']
config.current_user_method { current_admin }
config.authorize_with :cancan
end
|
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'homes#index'
resources :sessions, only: [:create]
delete :logout, to: "sessions#logout"
get :logged_in, to: "sessions#logged_in"
namespace :api do
namespace :v1 do
... |
#Single line comment#
=begin a lot of lines
wow
lines
=end
print "hello world"
print "hi again"
puts "this is my third line with puts"
puts "this is another puts line"
#special escape characters
# \t (tab) \n(new line) \\ (show/char) \" (print the char)
puts "Name:\t\t Joey"
puts "1st line
2nd line
3rd line"
# quot... |
# -*- encoding : utf-8 -*-
require 'rubygems'
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment"
require 'rspec/rails'
# Requires shared example groups.
Dir["#{File.dirname(__FILE__)}/shared/**/*.rb"].each { |f| require f }
# Requires supporting files with custom matchers and macro... |
FactoryBot.define do
factory :unread_msg do
room {build(:room)}
user {build(:user)}
msg {build(:msg, user: user, room: room)}
end
end
|
class Stack
attr_accessor :stack
def initialize
@stack = []
end
def push(el)
stack << el
end
def pop
stack.pop
end
def show
stack.dup
end
end
class Queue
attr_accessor :queue
def initialize
@queue = []
end
def enqueue(el)
queue << el
end
def dequeue
... |
$:.push File.expand_path("../lib", __FILE__)
require 'mediatype_directory/version'
Gem::Specification.new do |s|
s.name = 'mediatype_directory'
s.version = MediatypeDirectory::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['James Lavin']
s.email = ['mediatyp... |
# 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 Ride
attr_accessor :driver, :passenger, :distance
@@all =[]
def initialize(driver, passenger, distance)
@driver = driver
@passenger = passenger
@distance = distance
@@all << self
end
def self.all
@@all
end
def self.average_distance
distances = @@all.map {|ride| ride.dist... |
class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.column :message, :string
t.column :thought, :string
t.column :forumid, :integer
end
end
def self.down
drop_table :posts
end
end
|
require 'test_helper'
class SubmissionGroupTest < ActiveSupport::TestCase
setup do
@profile = profiles(:dragon_profile_1)
end
test "submission image should return a submission image class" do
sg = SubmissionGroup.create(profile: @profile)
image = submissions(:dragon_image_1)
sg.add_s... |
class UtilizationMetricName < ActiveRecord::Base
acts_as_authorizable
acts_as_audited
named_scope :def_scope
acts_as_reportable
acts_as_commentable
has_many :nodes
validates_presence_of :name
validates_uniqueness_of :name
def self.default_search_attribute
'name'
end
end
|
class CategoryBrandgroup < ApplicationRecord
belongs_to :category
belongs_to :brand_group
end
|
CarrierWave.configure do |config|
if Rails.env.staging? || Rails.env.production?
config.storage = :fog
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => Rails.application.secrets.S3_KEY, # required
... |
class Show < ApplicationRecord
has_many :setlists
has_many :songs, through: :setlists
has_many :tracks, through: :songs
has_many :artists, through: :tracks
end
|
class PersonalfeedsController < ApplicationController
before_filter :authenticate_user!
before_filter :edit_check, :only => [:edit, :update]
before_filter :delete_check, :only => [:destroy]
def index
activity_permissions = current_user.view_list
if current_user.admin?
@unauth_posts = Post.paginate... |
class AddFrequencyToHabits < ActiveRecord::Migration
def change
add_column :habits, :frequency, :text
end
end
|
# encoding: utf-8
# Класс ResultPrinter, печатающий состояние и результаты игры.
class ResultPrinter
# В конструкторе мы прочитаем все изображения виселиц и запишем каждое из низ
# в отдельный элемент массива.
def initialize(game)
# Создадим переменную экземпляра @status_image — массив, хранящий
# изобра... |
class CampgroundController < ApplicationController
helper_method :current_campground
private
def current_campground
return @current_campground if defined?(@current_campground)
@current_campground = Campground.find_by_subdomain!(request.subdomain)
end
end |
#!/bin/ruby
# Expected input, via 1st command-line argument: URL for the service being
# used, including the needed http query in the format expected by the
# service
require 'open-uri'
# Functionality for querying a historical data server and, optionally,
# preprocessing the result, and then sending the resulting d... |
# Recreate search index for game_ids
#
# Open up console and queue the job like this
# Game.find_in_batches do |games|
# game_ids = games.map {|game| game.id}
# Delayed::Job.enqueue(RecreateSearchIndexJob.new(game_ids))
# end
#
# This will enqueue about 20 batches of 1000 games in each
# with a total size of 20000 ... |
module FilterHelper
def show_filter?(controller, action)
%w[ships pilots ship_combos upgrades squadrons].include?(controller) && %w[index show].include?(action)
end
def preset_dates
[
['', nil],
[I18n.t('shared.filter_configurator.dates.launch'), Date.new(2018, 9, 13)],
[I18n.t('shared.... |
require "rails_helper"
describe User do
describe "#create" do
it "is invalid without a email" do
user = build(:user, email: "")
user.valid?
expect(user.errors[:email]).to include("can't be blank")
end
it "is invalid email without XXX@YYYY " do
user = build(:user, email: "aaaaaaa")
... |
class Pa < ActiveRecord::Base
has_many :pa_coverages, :dependent => :destroy
belongs_to :book
acts_as_taggable # Alias for acts_as_taggable_on :tags
validates :name, presence: true
scope :master, ->(){ where(pa_type: 'master')}
def is_master?
self.pa_type == 'master'
end
# copied_attributes copies only s... |
module Jekyll
module RelativeSrcFilter
def relative_src_filter(input, url)
url = url.strip
base = Pathname.new(url).dirname.to_s()
input.gsub(/(src|href)="([^"]*)"/) { |s|
path = $2
if !path.start_with? '/', 'http://', 'https://' then
s.gsub(path, base + '/' + path)
... |
class AddCourseIdToCourseCategoryParameters < ActiveRecord::Migration
def up
change_table :course_category_parameters do |t|
t.change :value, :float, null: false
t.change :series, :integer, null: false
t.column :constant, :boolean, null: false, default: false
t.column :course_id, :integer,... |
# frozen_string_literal: true
require 'shared/file'
require './lib/log_processor/formatter/base'
require './lib/log_processor/formatter/total'
RSpec.describe LogProcessor::Formatter::Total do
describe 'formatter value' do
it 'returns the formatter value to visits' do
expect(described_class::FORMATTER).to ... |
require_relative 'function.rb'
RSpec.describe do
describe "fold_array" do
it "responds to array with fold iteration returning array containing 6, 6, 3" do
original_array = [1, 2, 3, 4, 5]
fold_iteration = 1
expect(fold_array(original_array, fold_iteration)).to eq([6, 6 ,3])
end
it "res... |
module CommonActions
extend ActiveSupport::Concern
def current_user
@current_user ||= User.find_by(id: session[:user_id])
end
def logged_in?
!current_user.nil?
end
def login_check
unless logged_in?
flash[:danger] = "ログインしてください"
redirect_to login_url
end
end
end |
Vagrant.configure(2) do | config |
config.ssh.insert_key = false
config.ssh.username = 'vagrant'
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
# Ubuntu 14.04
config.vm.define "ubuntu14" do |conf|
conf.vm.hostname = "ubuntu14.dev"
conf.vm.box = "ub... |
module Fog
module Terremark
class Real
# Get details for a public ip
#
# ==== Parameters
# * public_ip_id<~Integer> - Id of public ip to look up
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'PublicIpAddresses'<~Array>
# ... |
FactoryGirl.define do
factory :item do
shop
category
brand
association :shop_category, factory: :shop_category#, shop: shop
sequence(:price, 20) { |n| n }
sequence(:inventory, 30) { |n| n }
sequence(:sid, 1) { |n| n }
sequence(:title) { |n| "item_title_#{n}" }
sequence(:public_pr... |
class TipousersController < ApplicationController
before_filter :require_login
# GET /tipousers
# GET /tipousers.json
def index
@tipousers = Tipouser.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @tipousers }
end
end
# GET /tipousers/1
# GET ... |
## Author:: BastienMor
## Developers: BastienMor
## Version:: 0.1
## Copyright:: © 2017
## License:: Distributes under the same terms as Ruby
##
##
## Génération de grille de Sudoku (création de difficulté)
##
class Generateur
@grid
@difficulte
attr_reader :grid, :difficulte
##
... |
Rails.application.routes.draw do
get '/about' ,to: 'static_pages#about'
get '/login', to: 'sessions#new'
post '/login', to: 'sessions#create'
delete '/logout', to: 'sessions#destroy'
post 'post_create', to: 'posts#create'
get '/signup', to: 'users#new'
post 'content_create', to: 'contents#create'
... |
describe "New Deal Agencies API" do
describe "GET /api/new_deal_agencies" do
it "returns all the New Deal Agencies" do
FactoryGirl.create :new_deal_agency, name: "WPA"
FactoryGirl.create :new_deal_agency, name: "CCC"
get "/api/new_deal_agencies"
expect(response.status).to eq 200
n... |
class ShelterUser < ActiveRecord::Base
belongs_to :user
belongs_to :shelter
end
|
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.2'
# Use Puma as the app server
gem 'puma', '3.8.2'
# ... |
class ArticleSweeper < ActionController::Caching::Sweeper
observe Article
def after_save(article)
expire_cache(article)
end
def after_destroy(article)
expire_cache(article)
end
# TODO: why is it redundant, rubocop? I'm pretty sure I've had Heroku crashes without it.
def expire_cache(article)
... |
module DeviseOverride
# Helps user to complete registration by email confirmation
class SessionsController < Devise::SessionsController
private
def after_sign_in_path_for(resource)
library_path(resource.own_library)
end
end
end
|
class AddMerchandiseTable < ActiveRecord::Migration[5.0]
def change
create_table :merchandises do |m|
m.integer :album_id
m.integer :format_id
m.integer :quantity
m.decimal :price
end
create_table :formats do |t|
t.string :type
end
end
end
|
class FirmwaresController < ApplicationController
before_action :require_admin
before_action :set_firmware, only: [:edit, :update, :show]
def index
@firmwares = Firmware.all.order(:version)
end
def new
@firmware = Firmware.new
end
def show
end
def edit
end
def update
if @firmware.update(fi... |
# http://projecteuler.net/index.php?section=problems&id=37
#
# The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.
#
# Fin... |
# frozen_string_literal: true
require "generators/devise_authy/devise_authy_generator"
RSpec.describe DeviseAuthy::Generators::DeviseAuthyGenerator, type: :generator do
destination File.expand_path("../../tmp", __FILE__)
after(:all) do
prepare_destination
end
def prepare_app
FileUtils.mkdir_p(File.jo... |
class AddUserIdToProducts < ActiveRecord::Migration
def change
add_column :products, :user_id, :integer
end
|
class StageGateway < GatewayBase
def source
@source ||= [
FactoryGirl.build(:remote_stage,
:stage_id => 'stage_0',
:match_ids => %w(match_0)
),
FactoryGirl.build( :remote_stage,
:stage_id => 'stage_1',
:match_ids => %w(match_0)
)
]
end
def fet... |
class AttendancesController < ApplicationController
def index
end
def new
@attendance = Attendance.new
end
def create
@attendance = Attendance.create(attendance_params)
if @attendance.save
redirect_to :back, alert: "You have successfully joined an event."
else
redirect_to :back, al... |
module Admin
class ResourceController < AdminController
# Some voodoo to help with dry restful controllers
# http://railsforum.com/viewtopic.php?id=3756
before_filter :find_or_initialize, :only => [:show, :new, :create, :edit, :update, :destroy]
before_filter :update_attributes, :only... |
# frozen_string_literal: true
require 'nokogiri'
require 'uri'
require 'shreds/feed'
module Shreds
module Feed
module Filters
class << self
# Run all filters against this entry,
# entry is assumed to be an instance of Newsitem model
def apply(entry)
permalink = Shreds::F... |
# frozen_string_literal: true
module GraphQL
module StaticValidation
module MutationRootExists
def on_operation_definition(node, _parent)
if node.operation_type == 'mutation' && context.warden.root_type_for_operation("mutation").nil?
add_error(GraphQL::StaticValidation::MutationRootExistsE... |
require 'rails_helper'
RSpec.describe AccessibilityController do
it 'allows a non-logged in user to access the page' do
session[:auth_id] = nil
get :index
expect(response).to have_http_status(:ok)
end
end
|
require_relative "cultivo"
require_relative "cereal"
o
class EcoCereal < Cereal
include Comparable
attr_reader :minerales
def initialize(n,g,t,p,c,tip,e, npmc, pmg, pg, pu, gl, pml, ds, minerales)
super(n,g,t,p,c,tip,e, npmc, pmg, pg, pu, gl, pml, ds)
@minerales = minerales
end
def to_s()
s = "Cereal ->"
... |
class CreateBargains < ActiveRecord::Migration[5.1]
def change
create_table :bargains do |t|
t.references :album, foreign_key: true
t.references :bargain_type, foreign_key: true
t.references :shop, foreign_key: true
t.references :currency, foreign_key: true
t.references :medium_type,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.