text stringlengths 10 2.61M |
|---|
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
desc 'Pull up the console with our dependencies.'
task :console do |t|
chdir File.dirname(__FILE__)
exec 'irb -I lib/ -I lib/daisy -r rubygems'
end
RSpec::Core::RakeTask.new(:spec)
desc 'Default to run the tests'
task :default => [:spec] |
# frozen_string_literal: true
module Darlingtonia
##
# A validator for correctly formatted CSV.
#
# @example
# parser = Parser.new(file: File.open('path/to/my.csv'))
#
# CsvFormatValidator.new.validate(parser: parser)
#
# @see http://ruby-doc.org/stdlib-2.0.0/libdoc/csv/rdoc/CSV/MalformedCSVError... |
require("minitest/rg")
require("minitest/autorun")
require_relative("../drink")
class DrinkTest < MiniTest::Test
def setup
@drink = Drink.new("beer", 2, "5%")
end
def test_can_create_drink
assert_equal(Drink, @drink.class())
end
end
|
class AdminUsersController < ApplicationController
before_filter :confirm_admin
def new
@admin_user = AdminUser.new
end
def edit
@admin_user = AdminUser.find(params[:id])
end
def create
@admin_user = AdminUser.new(params[:admin_user])
if @admin_user.save
redirect_to home_path, not... |
class CommentsController < ApplicationController
before_action :authenticate_user!
def create
shop = Shop.find(params[:shop_id])
comment = current_user.comments.new(comment_params)
comment.shop_id = shop.id
if comment.save
flash[:success] = "コメントしました"
redirect_to shop_path(shop)
els... |
class Bs::Backend::Kuwasys::CoursesController < Bs::Backend::Kuwasys::DashboardController
before_action :auth_action
before_action :courses_pagecontext
before_action :find_course, only: [:edit, :update, :destroy]
def new
pagecontext(t('backend.pages.kuwasys.courses.new.title'))
@course = Bs::Kuwasys::... |
require 'spec_helper'
describe "View a business support scheme" do
before do
stub_request(:get, "#{Plek.new.find('contentapi')}/graduate-start-up.json")
.to_return(:status => 200, :body => {
"id" => "https://www.gov.uk/graduate-start-up.json",
"title" => "Graduate start up",
"format... |
require "sinatra"
require "faker"
# Adding the Sinatra reloader will enable us to change code and see
# the effect of it right away without having to restart the server
# http://www.sinatrarb.com/contrib/reloader.html
# require "sinatra/reloader"
class String
def title_case
title = self.split
title.map do |... |
class PortfolioItem < ApplicationRecord
validates :user_id, :shoe_id, :size, :purchase_price, presence: true
belongs_to :user
belongs_to :shoe
end
|
module Donut
class ValidationService
attr_reader :trashable_instance
delegate :valid?, :errors, to: :trashable_instance
class << self
def errors(klass:, attributes:)
new(klass: klass, attributes: attributes).errors
end
def valid?(klass:, attributes:)
new(klass: klass, a... |
class Notification
def initialize (context, browser, hide_flag)
@context = context
@browser = browser
@hide_flag = hide_flag
@title = 'Headspace'
@sound = 'Blow'
system notification
end
private
attr_reader :context, :browser, :title, :sound
def hide_stuff?
return true if @hide_fl... |
class AddFavComposerToUsers < ActiveRecord::Migration
def change
add_column :users, :fav_cmp1, :string
add_column :users, :fav_cmp2, :string
add_column :users, :fav_cmp3, :string
end
end
|
class UsersController < ApplicationController
def index
@users = User.all
render :json => @users
end
def create
@user = User.new(allowed_params)
render :json => ( @user.save ? @user:@user.errors)
end
def update
@user = User.find(params[:id])
render :json => ( @user.update(allowed_par... |
class FollowupsController < ApplicationController
before_action :set_followup, only: [:show, :edit, :update, :destroy]
before_action :set_job, only: [:new, :create, :destroy, :edit, :update]
before_action :is_signed_in?
# GET /jobs/new
def new
@followup = Followup.new
end
# GET /jobs/1/edit
def... |
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{cron-spec}
s.version = "0.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ruby... |
require File.dirname(__FILE__) + '/../test_helper'
require 'zlib'
require 'new_relic_api'
# This test runs against our integration server, which is loaded with fixture data.
class NewrelicApiTest < ActiveSupport::TestCase
# Accounts may be identified either by their ID or by their license key.
# This is the licen... |
Gem::Specification.new do |s|
s.name = 'gaussian_naive_bayes'
s.version = '0.1.1'
s.licenses = ['MIT']
s.summary = "Implement the Gaussian Naive Bayes algorithm for classification"
s.authors = ["An Le"]
s.files = ["lib/gaussian_naive_bayes.rb", "lib/gaussian_naive_bayes/learner.r... |
# By default all new Rails 5 applications will have application_record.rb.
# If you are migrating from Rails 4, then simply create app/models/application_record.rb
# as shown below and change all models to inherit from ApplicationRecord instead of ActiveRecord::Base.
# https://stackoverflow.com/questions/41387706/un... |
class Choice < ApplicationRecord
belongs_to :poll
belongs_to :theme, optional: true
belongs_to :destination, optional: true
validate :is_date
validate :is_theme
def is_date
if self.choice_type == "date"
if self.end_date.nil?
errors.add(:end_date, "can't be blank")
end
if self... |
require 'test_helper'
class GameListsControllerTest < ActionController::TestCase
setup do
@game_list = game_lists(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:game_lists)
end
test "should get new" do
get :new
assert_response :succe... |
class Industry < ApplicationRecord
validates :slug, uniqueness: true, presence: true
before_validation :generate_slug
has_many :graphindustries
has_many :graphics, through: :graphindustries
has_many :fontindustries
has_many :fonts, through: :fontindustries
def to_param
slug
end
def generate_slug... |
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2011-2017, Sebastian Staudt
class RBzip2::IO
def initialize(io)
@io = io
@compressor = RBzip2.default_adapter::Compressor.new io
@decompressor = RBzip2.default_a... |
class RemoveColumnAuthEncryptedPasswordOnFeeds < ActiveRecord::Migration[5.2]
def change
remove_column :feeds, :auth_encrypted_password, :string
end
end
|
require 'refrepo/hash/hash'
def g5kchecks_importer(sourcedir)
puts "Importing source files from #{sourcedir} into input directory..."
net_adapter_names_mapping = YAML::load_file(File.dirname(__FILE__) + "/net_names_mapping.yaml")
if (net_adapter_names_mapping == false)
puts "failed to load net adapters mapp... |
# encoding: UTF-8
module API
module V1
class EducationalInstitutionsActions < API::V1::Base
helpers API::Helpers::V1::EducationalInstitutionsHelpers
helpers API::Helpers::V1::OthersHelpers
before do
authenticate_user
end
namespace :educational_institutions do
des... |
class Book < ApplicationRecord
has_and_belongs_to_many :authors, dependent: :destroy
has_and_belongs_to_many :groups
has_one_attached :cover
validates :title, presence: true, length: { maximum: 50 }
validates :groups, presence: true
validates :authors, presence: true
validate :correct_cover_type
pri... |
module Models
module Publishable
RSpec.shared_examples "a publishable" do
describe "#css_classes" do
it "returns 'not-published' if the publishable is not published" do
publishable = build(described_class_to_sym, published: false)
expect(publishable.css_classes).to eq("not-publi... |
class SessionsController < ApplicationController
layout false
skip_before_action :auto_sign_out
# 注册
def new
@user = User.new
end
# 登录
def sign_in
@user = User.new
end
def create
if User.find_by(mobile: params[:user][:mobile])
flash[:error] = '用户已存在!'
redirect_to new_session... |
class V1::SymptomsController < ApplicationController
def index
paginate json: Symptom.all
end
def show
render json: symptom
end
private
def symptom
Symptom.find(params[:id])
end
end
|
Rails.application.routes.draw do
root 'static_pages#home'
resources :static_pages do
collection do
get 'help'
get 'about'
end
end
end
|
require 'spec_helper'
describe 'socrates::_system' do
describe user('portaj') do
it { should exist }
describe file('/home/portaj/.ssh/authorized_keys') do
it { should be_a_file }
end
end
describe service('sshd') do
it { should be_enabled }
it { should be_running }
describe port(2... |
class Api::V1::PlantWasteReasonsController < Api::V1::BaseApiController
def index
reasons = Cultivation::PlantWasteReason.only(:name).all.to_a
render json: reasons.to_json, status: 200
end
end
|
require 'spec_helper'
describe SessionsController do
let :user do
FactoryGirl.create(:user)
end
let :credentials do
{ email: "user@email.com", password: "password"}
end
context "when no current user" do
it "logs in a user" do
user
get :create, credentials
expect(response).to... |
require 'rails_helper'
describe User do
let(:user) { User.new }
let(:user2) { User.new }
it "is invalid without a username" do
user.update_attributes(password: 'password', email: "test@gmail.com")
expect(user).to be_invalid
end
it "is invalid without a unique username" do
user.update_attributes... |
class BookInStock
attr_accessor :isbn, :price
def initialize(isbn, price)
throw ArgumentError if isbn == '' || price <= 0
@isbn = isbn
@price = price
end
def price_as_string
%Q{$#{"%.2f" % @price }}
end
end |
# Classes for specialized shapes.
# There are two different types of shapes which are used in this engine.
# It is of course possible, to extend them, but their implementation needs to be done specifically.
module SDC
class Actionshape
attr_accessor :active, :shape_index, :attributes
def initialize(active: tru... |
# == Schema Information
#
# Table name: characters
#
# id :integer not null, primary key
# name :string not null
# user_id :integer not null
# strength :integer not null
# dexterity :integer not null
# agility :integer not n... |
module MultiSchool
module AuthorizationOverrides
def self.attach_overrides
ApplicationController.send :include, MultiSchool::AuthorizationOverrides::InController
end
module InController
def self.included(base)
base.alias_method_chain :can_access_request?, :multi_school
b... |
# Create script that pushes custom metrics into Cloudwatch
instance = search("aws_opsworks_instance", "self:true").first
template_vars = {}
template_vars['region'] = instance['region']
template "/usr/local/bin/cloudwatch-custom.sh" do
source "elasticsearch.cloudwatch-custom.sh.erb"
mode "0550"
owner "root"
grou... |
class PagesController < ApplicationController
skip_before_action :authenticate_user!, only: [:home, :landing]
def home
if user_signed_in?
new_information
new_favour
new_event
# TODO build @posts array
# @posts = []
find_informations
find_events
find_favours
... |
class AddFieldsToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :facebook, :string
add_column :users, :twitter, :string
add_column :users, :linkedin, :string
add_column :users, :reddit, :string
add_column :users, :blog, :string
add_column :users, :influencer, :string
add... |
class Post < ActiveRecord::Base
before_save { title.capitalize! }
before_save { content.capitalize! }
before_destroy :delete_tags
has_many :comments, dependent: :destroy
has_and_belongs_to_many :tags, :join_table => :posts_tags
accepts_nested_attributes_for :tags
default_scope order('created_at DESC')... |
class CreateMixParts < ActiveRecord::Migration
def change
create_table :mix_parts do |t|
t.integer :ingredient_id
t.integer :juicemix_id
t.integer :parts
t.timestamps
end
end
end
|
class AddUserIdAndSchedulatorIdToSchedulatorSavedRelationships < ActiveRecord::Migration
def change
add_column :schedulator_saved_relationships, :user_id, :integer
add_column :schedulator_saved_relationships, :schedulator_id, :integer
end
end
|
require 'socket'
require_relative 'menu'
require_relative 'clientWorker'
require_relative '../server/leituras_dao.rb'
require_relative '../server/users_dao.rb'
class Server
def initialize( portClient, portTelnet)
@server = TCPServer.open portClient
@telnet = TCPServer.open portTelnet
@leituras = Leitura... |
class Owner
attr_reader :name, :species
@@all = []
def initialize(name,species="human")
@name = name
@species = species
@@all << self
end
def say_species
"I am a #{@species}."
end
def self.all
@@all
end
def self.count
count = 0
@@all.each { count += 1 }
count
end... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
require 'spec_helper'
describe TwitterCldr::Formatters::Numbers::Fraction do
describe "#apply" do
it "test: formats a fraction" do
token = TwitterCldr::Tokenizers::Token.new(value: '###.##', type: :pattern)
... |
require 'rails_helper'
describe "Manage Pairs" do
let!(:admin1) { create :user, email: "admin1@test.com", admin: true }
context "Admin#days" do
it "Navigate to page" do
login_as admin1
visit admin_days_path
expect(page).to have_text "Pairs"
end
end
end
|
class Ingredient < ApplicationRecord
has_many :user_dish_ingredients
has_many :user_dishes, through: :user_dish_ingredients
end
|
class SchedulerGame
class States
class GameWon < CyberarmEngine::GuiState
def setup
window.show_cursor = true
@game_time = @options[:game_time]
@map = @options[:map]
Gosu::Song.current_song&.stop
background 0xff_222222
flow(width: 1.0, height: 1.0) do
... |
require "rails_helper"
module Clockface
RSpec.describe Clockface::TasksController, type: :routing do
routes { Clockface::Engine.routes }
it "routes GET '/tasks' to tasks#index" do
expect(get: "/tasks").
to route_to(controller: "clockface/tasks", action: "index")
end
it "routes GET '/t... |
class UsersController < ApplicationController
before_action :authenticate_user!
def index
if current_user && current_user.user_type == "admin"
@users = User.all
else
redirect_to '/'
flash[:admin_violation]
end
end
def new
@user = User.new
if @user.save
flash[:success]... |
json.array!(@contract_partners) do |contract_partner|
json.extract! contract_partner, :id, :company_name
json.url contract_partner_url(contract_partner, format: :json)
end
|
json.array!(@spams) do |spam|
json.extract! spam, :id, :name
json.url spam_url(spam, format: :json)
end
|
class CreateNotificationAddFriends < ActiveRecord::Migration
def change
create_table :notification_add_friends do |t|
t.integer :sender_volunteer_id
t.integer :receiver_volunteer_id
t.boolean :acceptance
t.timestamps null: false
end
end
end
|
class AddArchetypeToGenres < ActiveRecord::Migration
def change
add_reference :genres, :archetype, polymorphic: true, index: true
end
end
|
class CreateSpots < ActiveRecord::Migration
def change
create_table :spots do |t|
t.string :name
t.text :rating_img_url
t.text :snippet_text
t.text :image_url
t.string :display_phone
t.text :address
t.text :cross_streets
t.string :city
t.string :neighborhoods
... |
class FontPretendard < Formula
version "1.3.6"
sha256 "fee357a594120c2c0cd6accfccb13cbc7c8089f7caa3da6e12ad9b57619a873d"
url "https://github.com/orioncactus/pretendard/releases/download/v#{version}/Pretendard-#{version}.zip"
desc "Pretendard"
desc "Alternative font to system-ui for all platforms"
homepage "... |
# encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/inputs/jdbc"
require "jdbc/derby"
require "sequel"
require "sequel/adapters/jdbc"
require "timecop"
require "stud/temporary"
require "time"
require "date"
describe LogStash::Inputs::Jdbc do
# This is a necessary change test-wide to gua... |
class Prime
def self.nth(nth)
raise ArgumentError if nth == 0
arr = []
num = 2
until arr.count == nth
arr << num if prime? num
num += 1
end
arr.last
end
def self.prime?(num)
sqrt = Math.sqrt(num).floor
arr = 1.upto(sqrt).select { |x| num % x == 0 }
arr.count == 1
... |
class AddCandiesCounterToShelves < ActiveRecord::Migration[6.1]
def change
add_column :shelves, :candies_counter, :integer
end
end
|
require "spec_helper"
describe "PlayerState" do
before(:each) do
@phrase = "abc/xyz/abc"
@pattern = "___/___/___"
@player = FakePlayerForProcessingGuess.new
@state = PlayerState.new(@player, @pattern)
end
context "processing a turn taken by a player" do
it "should lowercase and find if the... |
class CreateFeedbacks < ActiveRecord::Migration[5.0]
def change
create_table :feedbacks do |t|
t.references :request, foreign_key: true
t.string :project_name
t.string :feature_name
t.string :customer_name
t.string :customer_email
t.integer :rate
t.text :details
... |
class Vbuilder
class Generator
class Options < Hash
attr_accessor :opts, :orig_args
def initialize(args)
super()
@orig_args = args.clone
require 'optparse'
@opts = OptionParser.new do |o|
o.banner ... |
class ReportPdfPortrait < Prawn::Document
def initialize(report)
super({:page_size => 'A4'})
@report = Report.find(report.id)
@student = Student.find(report.student_id)
@term = Term.find(report.term_id)
@next_term = Term.where("startdate > ?", @term.startdate).order("startdate ASC").first
@res... |
class User < ApplicationRecord
has_many :activities
has_many :user_courses
has_many :courses
has_many :courses, through: :user_courses
has_many :user_subjects
has_many :user_tasks, dependent: :destroy
has_many :subjects, through: :user_subjects
enum role: {trainee: 0, supervisor: 1, admin: 2}
mount_u... |
class Item < ApplicationRecord
belongs_to :user
has_many :carts
has_many :wishlists
has_one :transfer
has_one :buyer, through: :transfer
has_one :seller, through: :transfer
end
|
# frozen_string_literal: true
class LocationsController < ApplicationController
before_action :authenticate_as_owner!, only: %i[update]
before_action :prohibit_virtual_location_update!, only: %i[update]
def update
render_as_json do
location.update!(update_params.except(:priority))
branch_locatio... |
class User < ApplicationRecord
validates :email, length: { minimum: 5 }
validates :name, length: { minimum:2 }
end
|
class Rarity < ApplicationRecord
validates_presence_of :name
has_many :cards
end
|
class Api::V1::RatingsController < ApplicationController
#before_action :authorized
def index
ratings = Rating.all
render json: ratings
end
def show
rating = Rating.find(params[:id])
render json: rating
end
def create
rating = Rating.create!(rating_params)
render jso... |
require "spec_helper"
describe ProfessorsController do
describe "routing" do
it "routes to #index" do
get("/professors").should route_to("professors#index")
end
it "routes to #new" do
get("/professors/new").should route_to("professors#new")
end
it "routes to #show" do
get("/p... |
#
# class AgentSessionFlowTest < AgentFlowTest
# test 'agent can not sign up' do
# sign_up
# assert_response :unauthorized
# end
#
# test 'create agent' do
# create(:admin, email: @user[:email], password: @user[:password])
# operation_with_out_sign_up do
# header = response.header
# po... |
require_relative '../feature_helper'
feature 'Only author can delete answer', %q(
In order to fix things
As an author
I want to be able to delete my answer
) do
given(:not_author) { create(:user) }
given(:author) { create(:user) }
given(:question) { create(:question) }
given!(:answer) { create(:answer, ... |
# frozen_string_literal: true
class Post < ApplicationRecord
has_attached_file :image, styles: { medium: '300x300>', thumb: '100x100>' }, default_url: '/images/:style/missing.png'
validates_attachment_content_type :image, content_type: %r{\Aimage/.*\z}
has_many :comments, dependent: :destroy
belongs_to :user
... |
service 'sshd' do
supports status: true, restart: true, reload: true
action [ :enable, :start ]
end
template '/etc/ssh/sshd_config' do
source "sshd_config.#{node['platform']}.erb"
notifies :reload, 'service[sshd]'
end
|
module Admin
class JobsController < Admin::ApplicationController
before_action :set_job, except: %i(index new create)
def index
@total_jobs = Job.by_categories(params[:categories])
@pages = (@total_jobs.count / 10.0).ceil
@jobs = Job.by_categories(params[:categories]).page(params[:page]).pe... |
class CreateVillains < ActiveRecord::Migration
def change
create_table :villains do |t|
t.string :name
t.string :gender
t.integer :intel
t.integer :str
t.integer :speed
t.integer :durab
t.integer :power
t.integer :combat
t.string :image_url
t.timestamps... |
# encoding: UTF-8
require 'pp'
require_relative '../shared'
require_relative '../../commands/role'
GoodData::CLI.module_eval do
desc 'Basic Role Management'
arg_name 'list'
command :role do |c|
c.desc 'List roles'
c.command :list do |list|
list.action do |global_options, options, args|
op... |
# 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 bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... |
#==============================================================================
# ** TDS Pause Screen
# Ver: 1.1
#------------------------------------------------------------------------------
# * Description:
# This script lets you pause the game by pressing a key.
#-----------------------------------------------... |
require "stsplatform/version"
module STSPlatform
# The Sensors resource of the STS Platform API
# Params:
# +handler+:: a client object
# +id+:: (optional) the numerical or string id of the sensor
# Returns:
# +STSPlatformResponse+:: object containing "data" and "code" parameters
# Inherits from Reques... |
#!/usr/bin/env ruby
require 'bundler'
require 'observer'
#require 'opal/browser'
require 'json'
require 'securerandom'
require 'faye/websocket'
require 'websocket/extensions'
require 'permessage_deflate'
require 'tilt/haml'
Bundler.require
require 'digest/sha1'
#require 'pry'
puts 'Loading base system...'
Mongoid.lo... |
service "rpcbind" do
action [:enable, :start]
end
directory '/root/ambari-setup'
file '/etc/yum/pluginconf.d/refresh-packagekit.conf' do
owner 'root'
group 'root'
mode '0644'
content 'enabled=0'
action :create
end
remote_file '/etc/yum.repos.d/ambari.repo' do
source "http://public-repo-1.horto... |
class CommentsController < ApplicationController
def create
comment = Comment.create(comment_params)
redirect_to comment.rehearsal
end
private
def comment_params
params.require(:comment).permit(:content, :rehearsal_id, :student_id)
end
end
|
#!/usr/bin/env ruby
#
# This script is used to see what /applications match whats installed via brew cask.
# I used this file to move most of my installed apps to brew cask installs and then generated the brewfiles
# for the repo.
# TODO: Look for a way to have less false positives in matches.
require 'fuzzy_match'
... |
class BackgroundFacade
attr_reader :id, :location
def initialize(location)
@location = location
end
def image_address
unsplash_service.image_address
end
def unsplash_service
@unsplash_service ||= UnsplashService.new(location)
end
end
|
class SearchIndexer
@queue = :search_index_queue
def self.perform(type,object_id)
begin
object = type.capitalize.constantize.find object_id
rescue
Rails.logger.debug "logging search indexer worker failed to find object..."
return
end
Rails.logger.debug "our index status is #{obj... |
# frozen_string_literal: true
require 'rails_helper'
require 'debt_management_center/financial_status_report_service'
RSpec.describe DebtManagementCenter::FinancialStatusReportService do
describe '#submit_financial_status_report' do
let(:valid_form_data) { get_fixture('dmc/fsr_submission') }
let(:malformed_... |
class LoginPageExample < ::RailsConnector::Migration
def up
page = create_login_page_obj
create_reset_password_page_obj
update_homepage_obj_class
update_homepage_obj(page)
end
private
def login_page_path
"/website/en/_configuration/login"
end
def login_page_attribute_name
'login_p... |
class Casino
attr_accessor :casinogames
def initialize(all_games)
@all_games = all_games
def display_main_menu
puts "Welcome to Casino Dev"
puts "-"*20
@all_games.each_with_index do |games, index|
puts "#{index + 1}) #{games}"
end
end
def craps
@craps=Dice.ne... |
module Reading
class Generator < Jekyll::Generator
def generate(site)
@site = site
@converter = site.find_converter_instance(Jekyll::Converters::Markdown)
site.pages.each do |p|
createAlert("tip", p.content)
createAlert("note", p.content)
createAlert("important"... |
class Ability < ActiveRecord::Base
include CanCan::Ability
def initialize(user)
can [:index, :create], Cat
can [:show, :update, :destroy], Cat do |cat|
cat.user == user
end
end
end
|
class Admin::CategoriaProdutosController < Admin::BaseController
def index
@categoria = CategoriaProduto.where("situacao = ?" , false)
end
def new
@categoria = CategoriaProduto.new
end
def create
categoria = CategoriaProduto.new(categoria_params)
if categoria.save
flash[:success] = "Categoria Criada ... |
# frozen_string_literal: true
module Robots
module DorRepo
module Accession
class SdrIngestTransfer < LyberCore::Robot
def initialize
super('accessionWF', 'sdr-ingest-transfer')
end
def perform_work
object_client.preserve(lane_id:)
LyberCore::ReturnSta... |
FactoryBot.define do
factory :destination do
id { 1 }
destination_first_name {"幸太郎"}
destination_family_name {"齋藤"}
destination_first_name_kana {"コウタロウ"}
destination_family_name_kana {"サイトウ"}
post_code ... |
class Flight < ActiveRecord::Base
has_many :passengers
end
|
module RackAttackAdmin
class KeysController < RackAttackAdmin::ApplicationController
def destroy
orig_key = params[:id]
unprefixed_key = Rack::Attack.unprefix_key(orig_key)
Rack::Attack.cache.delete unprefixed_key
flash[:success] = "Deleted #{unprefixed_key}"
redirect_to root_path
... |
class BlocksController < ApplicationController
def index
if params[:asset_id]
@asset = Asset.find(params[:asset_id])
@blocks = @asset.blocks
else
@blocks = Block.all
end
render json: { blocks: @blocks }
end
def show
@block = Block.find(params[:id])
render json: { block: ... |
require 'oauth2-auth-server/schema'
require 'oauth2-auth-server/routes'
module OAuth2
module Auth
module Server
class Engine < ::Rails::Engine
initializer "oauth2-auth-server.include_helpers" do
OAuth2::Auth::Server.include_helpers
end
end
end
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.