text stringlengths 10 2.61M |
|---|
class Workflow < ActiveRecord::Base
attr_accessible :name, :description, :start_state_id, :area_id, :service_id, :img
attr_accessible :states_attributes
belongs_to :area
has_many :states, dependent: :destroy
has_many :encouragements, dependent: :destroy
belongs_to :service
accepts_nested_attributes_for :s... |
class Discount < ActiveRecord::Base
include DiscountConcern
has_paper_trail
belongs_to :user, required: true
belongs_to :area, required: true
validates :user, :value, :area, presence: true
validates :area_id, uniqueness: { scope: :user_id }
validates :value, numericality: { greater_than_or_equal_to: 0, ... |
require 'series_calc/timeframe'
require 'series_calc/dimension'
module SeriesCalc
class Controller
attr_reader :timeframe
attr_reader :dimension_types
attr_reader :dimensions
attr_reader :updated_dimensions
def initialize(timeframe, dimension_types = {})
@timeframe = timeframe
@dimen... |
FactoryGirl.define do
factory :female_animal, parent: :animal, aliases: [:ewe], class: 'FemaleAnimal' do
type 'FemaleAnimal'
end
end
|
require 'spec_helper'
describe ClustersController do
describe "access control" do
it "denies access to new" do
get :new
response.should redirect_to(new_user_session_path)
end
it "denies access to create" do
post :create
response.should redirect_to(new_user_session_path)
... |
# frozen_string_literal: true
module Admin
# Handle physician action like rate policies etc.
class PhysicianController < ApplicationController
before_action :find_physician, only: %i[charges update]
def charges; end
def update
@physician.update(physician_params)
respond_to do |format|
... |
# frozen_string_literal: true
require 'statistic_calcs/inference/mean'
require 'statistic_calcs/distributions/normal'
module StatisticCalcs
module Inference
# If you know the standard deviation of the population
# The population mean have a standard Normal behavior
class KnownSigmaMean < Mean
attr... |
module AnonymousController
protected
def current_anonymous_or_user
@current_user ||= current_user
@current_user || anonymous
end
def anonymous
if session[:anonymous]
@anonymous = User.anonymous(session[:anonymous])
else
@anonymous = User.anonymous
session[:anonymous] = @anon... |
class AnswersController < ApplicationController
# index: works with a logged in user only
def index
@answers = Answer.where(email: current_user.email)
end
# show: only works directly with UUID, user does not have to be logged in
def show
@answer = Answer.find_by_uuid(params[:id])
@question = @an... |
class PersonType < ActiveRecord::Base
self.table_name = :person_type
self.primary_key = :person_type_id
has_many :core_person, foreign_key: "person_type_id"
include EbrsMetadata
end
|
module UsersHelper
def admin?(user)
"ADMIN" if user.admin
end
end
|
module CurrentUserConcern
extend ActiveSupport::Concern
def current_user
super || guest_user
end
def guest_user
OpenStruct.new(first_name:"Guest",
lastname:"User",
email:"guest@guest.com" )
end
end
|
module Geoq
module Commands
class Base
attr_reader :global_opts, :opts, :args, :instream
def initialize(instream, global_opts = {}, opts = {}, args = [])
@global_opts = global_opts
@opts = opts
@args = args
@instream = instream
end
def output
raise ... |
require 'rails_helper'
describe Api::V1::ItemsController do
# #def setup_user
# @user = FactoryBot.create(:user, email: Time.now.getutc.to_i.to_s + "@example.com" )
# puts "User id: " + @user.id.to_s
# puts "Name: " + @user.name
# puts "Account: " + @user.current_account_id.to_s
# auth_headers = @user.cre... |
class AdminController < ApplicationController
before_filter :require_admin
def show
@activities = Activity.order('created_at desc').page(params[:page])
end
private
def require_admin
unless current_user.admin?
redirect_to root_path, :notice => 'Hey now.'
end
end
end
|
Rails.application.routes.draw do
resources :words
root "words#index"
resources :dictionaries
resources :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
require 'elan_parser'
class TemplatesController < ApplicationController
before_filter :authenticate_user!
def index
@templates = Template.all
respond_to do |format|
format.html # index.html.erb
end
end
# GET /templates/1/edit
def edit
@template = Template.find(params[:id... |
class AddDataToOrder < ActiveRecord::Migration
def change
add_column :orders, :data, :jsonb
end
end
|
# frozen_string_literal: true
class Cordinate < ApplicationRecord
belongs_to :user, optional: true
has_many :items
has_many :comments, dependent: :destroy
has_many :notifications, dependent: :destroy
has_many :likecordinates, dependent: :destroy
has_many :users, through: :likecordinates
validates :seaso... |
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
def after_sign_in_path_for(resource)
user_path(resource)
end
protected
def configure_permitted_parameters
added_attrs = [:name, :image, :remove_image, :email, :introduce, :pas... |
class Complaint < ApplicationRecord
belongs_to :user
has_many :complaint_chat
validates :subject, :description, :user_id, presence:true
end
|
class AdjustFieldLength < CamaManager.migration_class
def change
post_table = CamaleonCms::Post.table_name
change_column post_table, :title, :text
remove_index(post_table, :slug) if index_exists?(post_table, :slug)
change_column post_table, :slug, :text
add_index post_table, :slug, length: 255
... |
require 'test_helper'
class LecLoginTestTest < ActionDispatch::IntegrationTest
def setup
@lec = lecturers(:naish)
@admin = lecturers(:ritah)
end
test "login with invalid info" do
get loginlec_path
post loginlec_path, params: {
session_lec: {
email: "",
password: ""
}
}
... |
class UserAmistad < ActiveRecord::Base
belongs_to :user
belongs_to :amigo, class_name: 'User', foreign_key: 'amigo_id'
attr_accessible :user, :amigo, :user_id, :amigo_id, :state
state_machine :state, initial: :pending do
after_transition on: :accept, do: [:enviar_aceptacion_mail, :aceptar_mutua_amistad!]
... |
class NodeGroupNodeGroupAssignment < ActiveRecord::Base
acts_as_authorizable
acts_as_audited
named_scope :def_scope
acts_as_reportable
belongs_to :parent_group, :foreign_key => 'parent_id', :class_name => 'NodeGroup'
belongs_to :child_group, :foreign_key => 'child_id', :class_name => 'NodeGroup'
... |
require "envconfig"
module Envconfig
class Railtie < Rails::Railtie
envconfig = Envconfig.load(ENV)
initializer "envconfig.smtp" do |app|
if envconfig.smtp?
envconfig_log "Using #{envconfig.smtp.provider.name} for SMTP"
app.config.action_mailer.smtp_settings = envconfig.smtp.to_h
... |
class AddT3dIdToDataincludes < ActiveRecord::Migration
def up
add_reference :dataincludes, :t3d, index: true, foreign_key: true
add_reference :datasubcategories, :t3d, index: true, foreign_key: true
add_reference :taggings, :t3d, index: true, foreign_key: true
add_reference :screenshots, :t3d, index: ... |
# frozen_string_literal: true
# == Schema Information
#
# Table name: restaurant_reviews
#
# id :integer not null, primary key
# rating :integer
# review :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
# rest... |
class CreateJointureIngredients < ActiveRecord::Migration[6.0]
def change
create_table :jointure_ingredients do |t|
t.belongs_to :ingredient, index: true
t.belongs_to :meal, index: true
t.timestamps
end
end
end
|
class Admin::Studios::Reports::MoviesController < AdminController
def show
@filter = Filter::DateFilter.new(params[:filter])
@studio = Studio.find(params[:studio_id])
if params[:series]
@reports = @studio.series.map do |series|
series.report(@filter.date)
end
else
@reports = ... |
require "application_system_test_case"
class PreWinsTest < ApplicationSystemTestCase
setup do
@pre_win = pre_wins(:one)
end
test "visiting the index" do
visit pre_wins_url
assert_selector "h1", text: "Pre Wins"
end
test "creating a Pre win" do
visit pre_wins_url
click_on "New Pre Win"
... |
# frozen_string_literal: true
module WasteExemptionsShared
class ApplicationController < ActionController::Base
# This form does NOT seem to work - helpers cause missing method in views
# helper Engine.helpers
# This form seems to work - helpers now available in views
include WasteExemptionsShared:... |
class RenameColumnUsersinTableProjectsUserstoUser < ActiveRecord::Migration
def up
rename_column :projects_users ,:users_id, :user_id
rename_column :projects_users ,:projects_id , :project_id
end
def down
end
end
|
class Node
attr_reader :nodes
attr_accessor :meta
def initialize
@nodes = []
@meta = []
end
def <<(node)
@nodes << node
end
def branch
[self] + descendants
end
def descendants
@nodes.map{ |n| [n] + n.descendants}.flatten
end
def value
if @nodes.any?
@meta.map{ |m... |
class Admin::SeancesController < Admin::BaseController
def index
@seances = Seance.all
end
end
|
module Features
def sign_in_as(user)
visit root_path
click_link "Login"
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_on "Log in"
end
def sign_in
@admin = create(:admin)
sign_in_as(@admin)
end
def sign_in_as_staff(college = nil)
@college = c... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Ipizza::Provider do
describe '.get' do
it 'returns LHV provider for "lhv" attribute' do
Ipizza::Provider.get('lhv').should be_a(Ipizza::Provider::Lhv)
end
it 'returns swedbank provider for "swedbank" attribute' do
... |
require 'webex/user/partner'
require 'webex/user/registration'
require 'webex/user/activation'
require 'webex/user/file'
require 'webex/user/report'
module Webex
# comment
module User
PATH_URL = 'p.php'.freeze
def post_url
URI.join(CONFIGURATION.host_url + PATH_URL)
end
end
end
|
class CampaignsController < ApplicationController
before_filter :load_charity, only: [:show]
ssl_required :show
layout 'bootstrap/campaigns'
def show
@donation_order = DonationOrder.new
@campaign = Campaign.for_charity(@charity).with_tiers.find_by_slug!(params[:id])
@campaign_stat = CampaignSta... |
class Candidate < ActiveRecord::Base
after_commit { CandidateBroadcastJob.perform_later self }
STATUS_VALUES = %W(to_book interview)
validates :first_name, presence: true
validates :last_name, presence: true
validates :status, presence: true, inclusion: { in: STATUS_VALUES }
end |
Rails.application.routes.draw do
resources :messages
resources :groups
root 'groups#index'
end
|
class CreatePickUps < ActiveRecord::Migration
def change
create_table :pick_ups do |t|
t.string :pincode
t.string :city
t.string :address
t.references :parent, index: true
t.integer :subscription
t.datetime :start_time
t.datetime :end_time
t.datetime :accepted_at
... |
class ProfileController < ApplicationController
include TheRole::Requires
before_filter :login_required
alias_method :login_required, :authenticate_user!
after_filter :update_member_logo, :only => [:update_member]
def me
@user = current_user
@errors = @user.errors
end
def update_me
@user ... |
class City < ApplicationRecord
acts_as_paranoid
belongs_to :country
has_many :artists
has_many :bargains
validates_presence_of :in_use, :name
end
|
require 'spec_helper'
describe "Authentication" do
subject { page }
describe "Signup page" do
before { visit new_user_registration_path }
let(:submit) { "Sign up" }
describe "with invalid information" do
it "should not create a user" do
expect { click_button su... |
class ChangeIntegerToFloatInBrands < ActiveRecord::Migration[6.0]
def change
change_column :brands, :environmental_score, :float
change_column :brands, :overall_score, :float
change_column :brands, :social_score, :float
change_column :brands, :quality_score, :float
end
end
|
class CreateNexmoApps < ActiveRecord::Migration[6.0]
def change
create_table :nexmo_apps do |t|
t.string :api_key
t.string :app_id
t.string :name
t.text :public_key
t.text :private_key
t.string :inbound_url
t.string :inbound_url_method
t.string :status_... |
class Kiosk < ActiveRecord::Base
geocoded_by :address
validates :latitude, :longitude, presence: true
def address
"#{street}, #{city}, #{state} #{zip_code}"
end
def to_coordinates
[latitude, longitude]
end
def to_gmap
"https://maps.google.com/?q=#{latitude},#{longitude}"
end
# used wit... |
json.array!(@bankruptcies) do |bankruptcy|
json.extract! bankruptcy, :id, :name, :govern_org, :status, :period_of_search
json.url bankruptcy_url(bankruptcy, format: :json)
end
|
class Application < ActiveRecord::Base
belongs_to :user
has_many :job_applications
has_many :jobs, through: :job_applications
before_create :create_from_cart
enum status: %w(ordered paid cancelled completed)
attr_accessor :cart_data
private
def create_from_cart
if cart_data
cart_data.each... |
require 'rails_helper'
RSpec.describe "product_costs/edit", type: :view do
before(:each) do
@product_cost = assign(:product_cost, ProductCost.create!(
:product_id => 1,
:category => "MyString",
:name => "MyString",
:cost_cents => 1,
:cost_currency => "MyString",
:cost_percenta... |
# Analyze the Errors
# I worked on this challenge by myself.
# I spent [2] hours on this challenge.
# --- error -------------------------------------------------------
#"Screw you guys " + "I'm going home." = cartmans_phrase
cartmans_phrase = "Screw you guys " + "I'm going home."
# This error was analyzed in the REA... |
#!/usr/bin/ruby
#enables using path to classes without installed in path
$LOAD_PATH.unshift( File.join( File.dirname(__FILE__), '.' ) )
require 'set'
require 'psych'
# require 'gchart'
require 'uri'
require 'net/http'
require 'lib/homologenie/homolog'
require 'lib/homologenie/protein'
require 'lib/homologenie/taxonom... |
class CommentsController < ApplicationController
before_action :authenticate_user!
before_action :set_post, only: :create
before_action :set_comment, only: [:destroy, :edit, :update]
authorize_resource
def create
@comment = @post.comments.new(comment_params)
@comment.user = current_user
@commen... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
BASE_BOX = "centos/7"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = BASE_BOX
config.ssh.insert_key = false
config.vm.provider "virtualbox"
config.vm.define "master0" do |master0|
master0.vm.box = BASE_BOX
... |
class Musterb::Evaluator
include Musterb::ExtractValues
attr_reader :context
def initialize(context)
@context = context
end
def current
@context.value
end
def block_if(value)
return if is_falsy? value
case value
when Hash
switch_context(value) { |v| yield v }
when Enum... |
puts "Be-vindo ao Cookbook, sua rede social de receitas"
receitas = []
while(true) do
puts "Digite o nome da receita: "
nome = gets.chomp()
receitas << nome
puts
puts"Receita #{nome} cadastrada com sucesso!"
puts
puts "======== Receitas cadastradas ========"
puts
# aqui é um for ... |
class Admin::IssuesController < ApplicationController
before_action :authenticate_user!
before_action :require_is_admin
layout "admin"
def index
@issues = Issue.all
end
def new
@issue = Issue.new
end
def create
@issue = Issue.new(issue_params)
@issue.user = current_user
if @issu... |
# frozen_string_literal: true
module Files
class SupportRequest
attr_reader :options, :attributes
def initialize(attributes = {}, options = {})
@attributes = attributes || {}
@options = options || {}
end
# int64 - ID
def id
@attributes[:id]
end
def id=(value)
@a... |
class IngredientsController < ApplicationController
def new
end
def create
if @ingredient.save
redirect_to recipes_path
else
render action: 'new'
end
end
private
def ingredient_params
params.require( 'ingredient' ).permit( 'name', 'kj', 'carbohydrate', 'protein', ... |
# Write a method that takes two arguments, a string and a positive integer, and prints the string as many times as the integer indicates.
def repeat(string, number)
num.times { puts string }
# puts ("#{string}\n" * number)
end
puts repeat("hello", 3)
|
class Api::V1::PackagingsController < Api::V1::BaseController
before_action :set_packaging, only: [:show, :update, :destroy]
# GET /packagings
def index
@packagings = Packaging.all.paginate(page: params[:page], per_page: 20)
json_response(@packagings)
end
# GET /packagings/:id
def show
json_re... |
Gretel::Crumbs.layout do
crumb :applicants_admins_show do
link I18n.t('applicant_regi_label'), {:controller=>"applicants_admins", :action=>"show"}
end
crumb :applicants_admins_applicants do |registration_course|
link registration_course.course.full_name, {:controller=>"applicants_admins", :action=>"applic... |
class CreateLearningTracks < ActiveRecord::Migration
def change
create_table :learning_tracks do |t|
t.references :learning_cycle, index: true
t.string :name
t.string :tags, array: true
t.timestamps null: false
end
add_index :learning_tracks, :name
add_index :learning_tracks,... |
##
# A single headline. Headlines should really be accessed through the owning Story object.
# It is intended that a Story object has several headlines, and one active headline that can
# be accessed through the Story.
#
# @!attribute content
# @return [String] the headline, limited to 140 chars
class Headline < A... |
class SessionsController < ApplicationController
before_action :set_session, only: [:show, :update, :destroy]
# GET /sessions
def index
@sessions = Session.all
render json: @sessions
end
# GET /sessions/1
def show
render json: @session
end
# POST /sessions
def create
user = User.fi... |
module Astrails
module Safe
class Mysqldump < Source
def command
@commanbd ||= "mysqldump --defaults-extra-file=#{mysql_password_file} #{@config[:options]} #{mysql_skip_tables} #{@id}"
end
def extension; '.sql'; end
protected
def mysql_password_file
Astrails::Safe... |
# encoding: utf-8
class AdminMailer < ActionMailer::Base
default from: ENV['MAILER_DEFAULT_FROM']
def notify_new_organization(organization)
@organization = organization
mail to: 'equipo@codeandomexico.org', subject: 'Nueva organizacion registrada'
end
end
|
class BillingAddressAddColumn < ActiveRecord::Migration
def change
remove_reference :bills, :delivery, index: true, foreign_key: true
add_reference :bills, :cart, index: true, foreign_key: true
end
end
|
# encoding: UTF-8
module CDI
module V1
class TokenAuthenticationService < AuthenticationService
def initialize(token, provider, options={})
super(nil, nil, options)
@token = token
@provider = provider
end
def execute
if valid_provider?
@auth_token... |
class ChangeBusStopDataAndBoardings < ActiveRecord::Migration
def change
change_column :bus_stops, :boardings, :float
change_column :bus_stops, :month_beginning, :string
end
end
|
# frozen_string_literal: true
require './lib/board.rb'
require './lib/pieces/pieces.rb'
RSpec.describe Board do
describe '#include_nil?' do
board = Board.new
it 'returns true when given a hash containing nil in its values' do
moves = [{ from: [1, 2], to: [3, nil] },
{ from: [1, 2], to:... |
require 'test_helper'
class TabsControllerTest < ActionController::TestCase
setup do
@binder=binders(:one)
@tab = tabs(:one)
end
test "should get index" do
get :index, :binder_id=> @binder.id
assert_response :success
assert_not_nil assigns(:tabs)
end
test "should get new" do
get :ne... |
# frozen_string_literal: true
class AddAttributesToDicom < ActiveRecord::Migration[5.0]
def change
add_column :dicoms, :pixel_spacing, :float
add_column :dicoms, :slice_thickness, :float
add_column :dicoms, :tags, :json
end
end
|
#Given 2 sequences, find longest common subsequence in it(sequence in increasing order)
#ABCDEFGH and PAPORODPPEEGH is ADEGH
#Solution
#================================================
#1Recursive approach
# if last char of a == last char of b lcs = 1 + lcs(a[0..size-1], b[0..size-1])
# else
# lcs = max (
#
def lc... |
json.array!(@tasks) do |task|
json.extract! task, :id, :taskname, :taskinotherlanguage, :taskdesc, :shortname, :complexitylvl, :taskpriority, :gender, :asset
json.url task_url(task, format: :json)
end
|
require 'bundler'
Bundler.require
require 'sinatra/reloader' if development?
require './models'
require './api'
require 'json'
require 'securerandom'
unless development?
set :environment, :production
set :port, 80
end
use Rack::Session::Cookie
enable :sessions
set :server, 'thin'
EVENT_TYPES = {
mousemove: "m... |
class CreateStudies < ActiveRecord::Migration
def change
create_table :studies do |t|
t.string :title
t.string :number
t.text :objective
t.integer :NoOfSites
t.integer :NoOfSections
t.integer :total
t.decimal :average
t.integer :range
t.references :project
... |
class CreateCharacterEvents < ActiveRecord::Migration
def change
create_table :character_events do |t|
t.references :character, index: true
t.references :event, index: true
t.boolean :paid
t.boolean :cleaned
t.timestamps null: false
end
add_foreign_key :character_events, :ch... |
class Screen < ApplicationRecord
has_many :showings, dependent: :destroy
end
|
class FontLora < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/lora"
desc "Lora"
homepage "https://fonts.google.com/specimen/Lora"
def install
(share/"fonts").install "Lora-Italic[wght].ttf"
(share/"fonts").install "Lora[wght].tt... |
class HomeController < ApplicationController
def show
if current_user != nil
flash[:alert] = 'You must log out before visiting the home page'
redirect_to '/dashboard'
end
end
end
|
class CreateStartups < ActiveRecord::Migration[5.0]
def change
create_table :startups do |t|
t.string :name
t.string :image_url
t.string :address
t.float :funding
t.string :industry
t.string :intro
t.string :founder
t.text :description
t.timestamps
end
... |
class DepartmentsController < ApplicationController
#layout 'admin'
before_action :set_department, only: [:show, :edit, :update, :destroy]
before_filter :find_store, only: [:index]
# GET /departments
# GET /departments.json
def index
@departments = Department.all.order("name ASC").where(:store_id... |
class Meme
def i_can_has_cheezburger?
"OHAI!"
end
def will_it_blend?
"YES!"
end
end
meme = Meme.new
meme.i_can_has_cheezburger?
meme.will_it_blend?
class TestClassR1
SOME_CONSTANT = "CONST"
def hello
end
end
class TestClassR2
def hello_again
"hi"
end
def pass_message(message)
"... |
module InlineSettings
class Configuration
def initialize(*args, &block)
options = args.extract_options!
klass = args.shift
raise ArgumentError unless klass
@klass = klass
@klass.class_attribute :inline_settings_field_name, :inline_settings_fields, :inline_settings_prefix
@kla... |
require 'spec_helper'
describe FbopenParser do
let(:fixtures_dir) { "#{Rails.root}/spec/fixtures/trade_leads/fbopen" }
let(:results_dir) { "#{File.dirname(__FILE__)}/fbopen" }
let(:subject) { FbopenParser.new }
describe '#convert' do
let(:srcsgt) { open("#{fixtures_dir}/srcsgt_source").read ... |
class SectionsController < ApplicationController
def index
@sections = Section.alphabetical.paginate(:page => params[:page]).per_page(8)
end
def show
@section = Section.find(params[:id])
@section_students = @section.students.alphabetical
@registration = Registration.new
end
def for_tourna... |
require 'parslet'
# require "searchtree"
module SearchParser
# Just some basic definitions that are widely useful
module ParseBasics
include Parslet
rule(:lp) { str('(') >> space? }
rule(:rp) { space? >> str(')') }
rule(:space) { match['\\s'].repeat(1) }
rule(:space?) { space.maybe }
ru... |
module Csv
class CampaignSerializer
private
attr_reader :campaign, :specification,
:campaign_methods,
:product_methods,
:category_methods,
:sub_category_methods,
:mechanisms_columns_headers
public
def initialize(campaign, specification)
@campaign = campaign... |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative 'config/application'
require 'asciidoctor'
require 'pathname'
Rails.application.load_tasks
task docs: %w[doc/func_spec.html]
rule '.adoc' => ... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = "ubuntu-osb"
# Forward Oracle port
config.vm.network :forwarded_port, guest: 7001, host: 7001
config.vm.network :forw... |
require "bcrypt"
class Company < ActiveRecord::Base
has_many :cashes
has_many :tfls
has_many :employees
has_many :reports
validates_presence_of :name
def password=(new_password)
@password = new_password
self.encrypted_password = BCrypt::Password.create(@password)
end
def password
@passwor... |
# (c) Copyright 2017 Ribose Inc.
#
# This is a middleware to check for invalid user's request path and request
# parameters.
module Rack
class Cleanser
class InvalidURIEncoding
include Regexps
# Escapes lone percent signs, that is percent sign characters which are
# not followed by two hex dig... |
require 'test_helper'
module Search
class GradeSearchTest < ActiveSupport::TestCase
@@initial_setup = true
setup do
index = Indices::GradesIndex.new
if @@initial_setup || !index.index_exists?
index.reset_index!
@@initial_setup = false
end
end
def index_objects
... |
require 'omf_base/lobject'
require 'rack'
require 'omf-web/session_store'
module OMF::Web::Rack
class AuthenticationFailedException < Exception
end
# This rack module maintains a session cookie and
# redirects any requests to protected pages to a
# 'login' page at the beginning of a session
#
# Calls... |
require 'rubygems'
require 'wx'
module Nobbie
module Wx
module ApplicationUnderTest #:nodoc:
def init_timer
@aut_timer = Timer.new(self, -1)
@aut_timer.start(10)
evt_timer(@aut_timer.object_id) {|e| self.yield; Thread.pass }
end
#todo: think about adding... |
class OrderMailer < ApplicationMailer
def order_received(order)
@order = order
mail to: order.email, subject: "Your order confirmation"
end
end
|
class StoresController < ApplicationController
before_action :set_store, only: [:show, :edit, :update, :details]
before_action :check_login
authorize_resource
def index
unless current_user.role?(:employee)
@active_stores = Store.active.paginate(:page => params[:page]).per_page(5)
@inactive_store... |
module Accountable
module Generators
class AccountableGenerator < Rails::Generators::NamedBase
argument :arguments, :type => :hash, :default => {}
include Rails::Generators::ResourceHelpers
namespace "accountable"
source_root File.expand_path("../templates", __FILE__)
desc "Generat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.