text
stringlengths
10
2.61M
# BWAPI Version module BWAPI VERSION = '13.5.0'.freeze end
class Allergen attr_accessor :user, :ingredient @@all = [] def initialize(user: nil, ingredient: nil) @user = user @ingredient = ingredient @@all << self end def self.all @@all end def self.ingredients self.all.map do |inst| inst.ingredient end end def self.users ...
#:nodoc: all module OshparkArrayExtensions def to_multipart key prefix = "#{key}[]" collect {|a| a.to_multipart(prefix)}.flatten.compact end def to_query key prefix = "#{key}[]" collect { |value| value.to_query(prefix) }.flatten.join '&' end def to_params collect {|a| a.to_params }.flatt...
require 'tempfile' module Backup module Adapters class Base include Backup::CommandHelper attr_accessor :procedure, :timestamp, :options, :tmp_path, :encrypt_with_password, :encrypt_with_gpg_public_key, :keep_backups, :trigger # IMPORTANT # final_file must have the value of the f...
module Mongoid::TaggableWithContext module TagCounter extend ActiveSupport::Concern module ClassMethods def count_tags_for(*args) args.each do |tag_field| field tag_field, :type => Hash, :default => {} #instance methods class_eval <<-END ...
# frozen_string_literal: true module V1 # Define actions that involves balance management class BalancesController < V1::BaseController include DateIntervalParams def index previous_criteria = search_params[:previous_criteria] period_criteria = search_params[:period_criteria] daily_group...
#Advanced Game Time + Night/Day v1.6e #----------# #Features: Provides a series of functions to set and recall current game time # as well customizable tints based on current game time to give the # appearance of night and day in an advanced and customizable way. # #Usage: Script calls: # ...
class PaymentsController < ApplicationController def index @need_to_pay = Trainee.all.select {|t| t.payment_status < 0} @past_payments = Payment.all @monthly_activities = Activity.find(Contract.where(rate_type: 'monthly').pluck(:activity_id)) end def pay Payment.create(trainee_id: params[:traine...
# frozen_string_literal: true # Playlist policy class PlaylistPolicy < ApplicationPolicy def use? record.user_id == user.id end def show? record.user_id == user.id end def update? record.user_id == user.id end def destroy? record.user_id == user.id end # Application policy default...
class Plan ## define constant, use all caps PLANS = [:free, :premium] def self.options PLANS.map {|plan| [plan.capitalize, plan]} # map method does: modifies all elements in an array ##whitelist this plan attribute end end
module Diagnosticss class Middleware MIME_TYPES = ['text/html', 'application/xhtml+xml'] CSS_PATH = '/diagnosticss.css' def initialize(app) @app = app end def call(env) @request = Rack::Request.new(env) if diagnosticss_stylesheet_request? body = File.read(File.dirname(...
class AddQuotesToPosts < ActiveRecord::Migration def change add_column :posts, :quote_author, :string add_column :posts, :quote_source, :string add_column :posts, :quote_text, :text end end
class Response def self.too_many_char puts "You typed too many characters, please type 4!" end def self.not_enough_char puts "Not enough characters, please type 4!" end def self.lose_message(generated_sequence) puts "you lose! you're out of guesses! The secret code was #{generated_sequence} would you lik...
class User < ApplicationRecord before_save { self.email = email.downcase } has_many :questions has_many :answers has_many :comments, as: :commentables has_many :votes, as: :voteables VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, uniqueness...
class WorldGrowth attr_accessor :content def initialize #Loads a word file with the World Growth Section file = find_word_file content = load_file(file) content = format_content(content) @content = content end def format_content(content) content = Sanitiz...
require 'rest_client' require 'yaml' require 'aescrypt' require 'bcrypt' require 'base64' require_relative '../app' require_relative '../models/token' require_relative '../models/device' require_relative '../models/user' require_relative './rest_shared_context' require_relative '../spec/integration_spec_helper' descr...
# frozen_string_literal: true module FacebookAds # https://developers.facebook.com/docs/marketing-api/reference/ad-account/advertisable_applications class AdvertisableApplication < Base FIELDS = %w[].freeze # belongs_to ad_account def ad_account @ad_account ||= AdAccount.find("act_#{account_id}...
require 'httparty' require 'nokogiri' require 'fedex_trakpak/helpers' module FedexTrakpak module Request class Base include Helpers include HTTParty format :xml attr_accessor :debug TEST_URL = "https://trakpak.co.uk/API/?version=3.0&testMode=1" # Fedex Production URL P...
# frozen_string_literal: true class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def google handle_oauth end def github handle_oauth end private def user @user ||= OauthService.new(request.env['omniauth.auth']).process_user end def handle_oauth sign_in_an...
class Card attr_reader :symbol, :suit, :value, :points def initialize(suit,value) @symbol = "#{value}#{suit}" @suit = suit @value = value @points = get_points end private def get_points case value when "A" return 1 when "J" ...
class Post include MongoMapper::EmbeddedDocument key :rdbms_id, Integer key :title, String key :content, String key :post_date, Time key :author_username, String belongs_to :author, :class_name => 'User' many :comments, :class_name => 'Comment' end
class Division < ActiveRecord::Base has_many :teams def sort_by_standings teams.sort_by!{ |a| [-a.points, a.display_name] } end def sort_by_name teams.sort_by!{ |a| a.display_name } end def as_json(options = nil) #:nodoc: json = super(:only => [:id, :name]) x = Array.new teams.eac...
# frozen_string_literal: true module GraphQL module Analysis module AST class FieldUsage < Analyzer def initialize(query) super @used_fields = Set.new @used_deprecated_fields = Set.new @used_deprecated_arguments = Set.new end def on_leave_fiel...
class RenameSubjects < ActiveRecord::Migration def change rename_table :subjects, :main_subjects end end
require_relative './dijkstra.rb' puts 'Enter the number of tests..' s = gets.chomp.to_i s.times do puts 'Enter the number of cities..' n = gets.chomp.to_i graph = Array.new(n) { Array.new(n) } cities = [] 0.upto(n - 1) do |i| puts 'Enter city name..' name = gets.chomp cities << name pu...
# A simple regex => response plugin. class Robut::Plugin::Sayings include Robut::Plugin class << self # A list of arrays. The first element is a regex, the second is # the reply sent if the regex matches. After the first match, we # don't try to match any other sayings. Configuration looks like the fol...
require './lib/rails_connector/cms_attributes' require './lib/rails_connector/cms_definitions' # This class represents the base class of all CMS widgets and implements behavior that all CMS # widgets have in common. class Widget < ::RailsConnector::BasicWidget include RailsConnector::CmsAttributes include RailsCon...
require 'rails_helper' describe Company do context "new" do context "has valid parameters" do let(:company) { FactoryGirl.create(:company) } it "should have a name" do company.name = "" expect(company.save).to be(false) end it "should not be a duplicate" do com...
class Article < ActiveRecord::Base belongs_to :user has_many :comments, dependent: :destroy has_many :likes, as: :likeable validates :url, presence: true validates! :user, presence: true def self.order_by_score(articles) articles.sort_by { |article| article.score }.reverse end def score self....
require_relative './piece' class Jumper < Piece @@MOVES = { 'King' => [[-1,-1], [-1,0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]], 'Knight' => [[2,1], [2,-1], [1,2], [1,-2], [-1,2], [-1,-2], [-2,1], [-2,-1]] } def valid_moves moves = @@MOVES[self.class.to_s].map { |move| [m...
FactoryGirl.define do factory :user do first_name Faker::Name.first_name last_name Faker::Name.last_name email Faker::Name.first_name + Faker::Name.last_name + "@rit.edu" password "test" factory :advisor, class: 'Advisor' do end factory :worker, class: 'Worker' do end end factory :student do ema...
class GamesController < ApplicationController def current @games = Game.where(datetime: Date.today..1.week.from_now) @teams = Team.all.sort_by(&:total_points).reverse end end
class ArticlesController < ApplicationController layout 'blog' before_action :authenticate_user!, except: [:index, :show] before_action :set_user before_action :set_article, only: [:show, :edit, :update, :destroy] before_action :check_current_user, only: [:edit, :update] def index @articles = Article.p...
class Api::V1::SessionsController < ApplicationController skip_before_action :authenticate_user_from_token!, :only => [:create], :raise => false def create begin mobile = params[:mobile] password = params[:password] @u = User.find_by_mobile(mobile) if @u && @u.valid_password?(password) ...
# prereqs: iterators, hashes, conditional logic # Given a hash with numeric values, return the key for the smallest value def key_for_min_value(name_hash) min = 100000000000 name_hash.collect do |key, val| if val < min min = val end end return name_hash.key(min) end
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
# coding: utf-8 Shindo.tests('Fog::Volume[:sakuracloud] | list_disks request', ['sakuracloud', 'volume']) do @disks_format = { 'Index' => Integer, 'ID' => Integer, 'Name' => String, 'Connection' => String, 'Availability' => String, 'SizeMB' => Integer, 'Pl...
require 'drb/drb' require '../models/vector' class SimilarityProcess def initialize(tuple_server) @tuple_server = tuple_server if @tuple_server.cosines == false cosines = {} @tuple_server.write(['cosines', cosines]) @tuple_server.cosines = true end end def main_loop loop do time = Time.now ...
require 'test_helper' class Regaliator::RateTest < Minitest::Test def setup Regaliator.configure do |config| config.api_key = 'api-key' config.secret_key = 'secret-key' config.host = 'api.regalii.dev' config.use_ssl = false end end def test_list VCR.use_cassette('...
require 'rails_helper' describe StoreService do before do @key = ENV['API_KEY'] @zip = 80202 end context '.get_stores', vcr: true do it 'returns an array of raw information' do stores = StoreService.get_stores(@key, @zip) first_store = stores[0] expect(stores).to be_an(Array) ...
class AddOfferIdToOfferPokemon < ActiveRecord::Migration[5.0] def change add_column :offer_pokemons, :offer_id, :integer end end
class Item < ActiveRecord::Base has_many :orders, through: :transactions has_many :transactions validates :name, presence: true validates :price, presence: true validates :description, presence: true def name_and_price self.name + " $" + self.price.to_s end end
def plural(palavra) "#{palavra}s" end class String def plural "#{self}s" end end puts plural("caneta") #canetas puts plural("carro") #carros puts "caneta".plural puts "carro".plural
# frozen_string_literal: true require 'bundler/setup' require 'irb' require 'dry-schema' schema = Dry::Schema.define do required(:name).filled(:string) optional(:age).maybe(:integer) end input = { name: nil, age: nil } schema.call(input).success? # => false schema.call(input).errors.to_h # => {:name=>["must be a...
class CreateCategories < ActiveRecord::Migration def change create_table :categories do |t| t.string :name t.string :subheading t.references :category t.boolean :is_active, default: true t.string :slug t.timestamps null: false end add_index :categories, :slug e...
class User < ActiveRecord::Base has_secure_password has_many :boards has_many :likes has_many :comments end
class HomeController < ApplicationController before_filter :authenticate_user def index @user = current_user end def all_article @articles = Article.all.limit(10) end end
ActiveAdmin.register Setlist do belongs_to :concert navigation_menu :concert index do selectable_column column :id column "Picture" do |setlist| image_tag setlist.picture.url(:thumb) end column :song column :artist column :itunes default_actions end form :html => { :...
class Trip < ActiveRecord::Base has_many :destinations, dependent: :destroy validates :name, presence: true belongs_to :user end
class AddTopMonthlySearchWordAndTopMonthlyVisitedLinkToSearchHistories < ActiveRecord::Migration[6.1] def change add_column :search_histories, :top_monthly_search_word, :text, array: true, default: [] add_column :search_histories, :top_monthly_visited_link, :text, array: true, default: [] end end
class Oystercard DEFAULT_BALANCE = 0 MAX_BALANCE = 90 MIN_FARE = 1 attr_reader :balance, :entry_station # def balance # @value # end def initialize @balance = DEFAULT_BALANCE @max_bal = MAX_BALANCE @entry_station = nil end def top_up(amount) fail "Max balance £90" if @balance + am...
namespace :nodes do task :load do set :cloud, Cloudpad::Cloud.new(env) cloud = fetch(:cloud) cloud.update nodes = cloud.nodes host_key = File.join(root_path, "keys", "node.key") has_host_key = File.exists?(host_key) puts "#{nodes.length} nodes found.".green role_filter = ENV['ROLES'] ...
class SubCategory < ApplicationRecord has_many :products has_many :campaigns, through: :products belongs_to :category def designation_with_category category.designation + " - " + self.designation end end
Gem::Specification.new do |s| s.name = %q{rack-routing} s.version = "0.1" s.authors = ["zzzhc"] s.date = Time.now.utc.strftime("%Y-%m-%d") s.email = %q{zzzhc.starfire@gmail.com} s.files = `git ls-files`.split("\n") s.homepage = %q{http://github.com/zzzhc/rack-routing} s.rdoc_options = ["--charset=UTF-8"...
require 'test_helper' class HolidayTest < ActiveSupport::TestCase def setup @holiday = Holiday.new(name: "some holiday") end test "date is nessesary" do assert_not @holiday.valid? end test "should be valid with date and name" do @holiday.date = Date.new(2015,1,1) assert @holiday.valid?, "a h...
FactoryGirl.define do factory :color do color_palette color_family color_number "828" name "color name" created_at Time.zone.local(2000,1,1, 0,0,0) updated_at Time.zone.local(2000,1,1, 0,0,0) end end
require 'date' module Code42 class User < Resource attribute :id, :from => 'userId' attribute :uid, :from => 'userUid' attribute :org_id attribute :updated_at, :from => 'modificationDate', :as => DateTime attribute :created_at, :from => 'creationDate', :as => DateTime attribute :status, :use...
class Answer < ActiveRecord::Base belongs_to :question validates :description, presence: true, length: { minimum: 50 } validates :user_id, presence: true validates :question_id, presence: true class << self def only_one_best_answer(new_best_answer) Question.find(new_best_answer).answers.each do |answ...
class CreateComputers < ActiveRecord::Migration[5.0] def change create_table :computers do |t| t.string :name t.string :wireless_mac t.string :wired_mac t.string :operating_system t.string :memory t.string :serial_number t.string :disk_total_space t.string :disk_fre...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Segmentation class SegmentIterator attr_reader :rule_set def initialize(rule_set) @rule_set = rule_set end def each_segment(str) return to_enum(__metho...
class AddNutritionReferenceToGoods < ActiveRecord::Migration def change rename_column :goods, :nutrition_set_id, :nutrition_id add_index :goods, :nutrition_id end end
class Geant4CX2 < Formula desc "Simulation toolkit for particle transport through matter" homepage "https://geant4.web.cern.ch" url "https://geant4-data.web.cern.ch/releases/geant4-v11.1.0.tar.gz" # version "11.0.2" # revision 3 depends_on "cmake" => [:build, :test] depends_on "boost-python3" depends_on ...
require 'nokogiri' require 'open-uri' require 'active_support/all' require 'kconv' #http://uma-blo.com/bc2012/wp-content/uploads/2014/01/BC20140105.csv class BCDownloader def initialize(year) @year = year.to_i @read_root = "http://uma-blo.com/bc2012/wp-content/uploads" @write_root = "../BCindex" e...
class TasksController < ApplicationController before_action :set_task, only: [:show, :edit, :update, :destroy] before_action :require_logged_in def index #@tasks = Task.all.reverse_order.page(params[:page]) @tasks = current_user.tasks # 並び替え if params[:sample].present? || params[:sample] == '...
class Games < Application before :ensure_authenticated, :exclude => [:index, :show] before :build_game, :only => [:new, :create] before :find_game, :only => [:show, :edit, :update, :delete, :end_game] before :ensure_author_if_game_is_draft, :only => [:show] before :ensure_author_if_no_start_time, :only =>[:sh...
class EventWine < ActiveRecord::Base attr_accessor :wine_detail_ids belongs_to :event belongs_to :wine_detail, :class_name => "Wines::Detail" # attr_accessible :title, :body class << self # 检查某只酒是否已经被添加 def check_wine_have_been_added?(event_id, wine_detail_id) find_by_event_id_and_wine_detail_...
Rails.application.routes.draw do get 'podcast/index' get 'concept/index' get 'contact/index' get 'portfolio', to: 'portfolio#index' get 'welcome', to: 'welcome#index' get 'concept', to: 'concept#index' get 'podcast', to: 'podcast#index' get 'contact', to: 'contact#index' root 'welcome#index'...
class UsersController < ApplicationController def index @novices = Novice.all end def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) if @user.update(user_params) flash[:success] = "User status changed!" redirect_to action: 'index' else ...
module Minihal class Token def initialize(description) @description = description.to_s end def to_s @description end def inspect "#<#@description>" end end end
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 before_action :authenticate_user! before_filter :configure_permitted_parameters, if: :devise_controller? protec...
require 'spec_helper' provider_class = Puppet::Type.type(:postfix_main).provider(:augeas) describe provider_class do before :each do Puppet::Type.type(:postfix_main).stubs(:defaultprovider).returns described_class FileTest.stubs(:exist?).returns false FileTest.stubs(:exist?).with('/etc/postfix/main.cf')...
class CreateFollowUsers < ActiveRecord::Migration def self.up create_table :follow_users, :force => true do |t| t.integer :follow_user_id t.integer :user_id t.string :remark,:limit=>50 t.boolean :is_fans,:default=>false t.datetime :created_at end add_index :follow_users,...
json.array!(@stus) do |stu| json.extract! stu, :id, :name, :address, :syndrome_id json.url stu_url(stu, format: :json) end
class AddDateToMeter < ActiveRecord::Migration def change add_column :meters, :date, :date, :after => :car_id end end
# frozen_string_literal: true class AvatarUploader < CarrierWave::Uploader::Base include UploaderHelper Rails.env.production? ? (storage :aws) : (storage :file) version :normal do process resize_to_fill: [260, 240] end version :mini, from_version: :normal do process resize_to_fill: [80, 75] end ...
# frozen_string_literal: true require 'spec_helper' require 'bolt_spec/files' require 'bolt_spec/pal' require 'bolt_spec/config' require 'bolt/pal' require 'bolt/inventory/inventory' require 'bolt/plugin' describe 'Vars function' do include BoltSpec::Files include BoltSpec::PAL include BoltSpec::Config befor...
class Admin::RegistrationsController < Devise::RegistrationsController rescue_from(ActiveRecord::RecordNotFound) { unauthorized_user_without_invite } layout 'admin' skip_before_filter :validate_geo_restriction def new invitation = fetch_invitation! @admin = Admin.new(:email => invitation.email) @ad...
class Uninstallpkg < Cask url 'http://www.corecode.at/downloads/uninstallpkg_1.0b6.zip' homepage 'http://www.corecode.at/uninstallpkg/' version '1.0b6' sha1 '10452fb8cb58450a4ab8909caef27dbf990d15f4' link 'UninstallPKG.app' end
class CreateApts < ActiveRecord::Migration def change create_table :apts do |t| t.string :name t.string :email t.string :street t.string :apt_num t.string :city t.string :state t.string :zip_code t.string :rent_or_buy end end end
## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # web site for more information on licensing and terms of use. # http://metasploit.com/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = ExcellentRa...
Rails.application.routes.draw do root to: "static_pages#root" resources :users, only: [:new, :create] resources :users, only: [:show, :index], defaults: { format: :json } resource :session, only: [:new, :create, :destroy] namespace :api, defaults: { format: :json } do resources :pictures do resour...
=begin #Scubawhere API Documentation #This is the documentation for scubawhere's RMS API. This API is only to be used by authorized parties with valid auth tokens. [Learn about scubawhere](http://www.scubawhere.com) to become an authorized consumer of our API OpenAPI spec version: 1.0.0 Contact: bryan@scubawhere.co...
# # Cookbook Name:: modx # Definition:: modx_site # Author:: Ed Bosher <ed@butter.com.hk> # # Copyright 2011, Digital Butter Ltd. # # 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:...
class Game < ActiveRecord::Base has_many :questions, through: :game_questions has_many :game_questions has_many :topics, through: :game_topics has_many :game_topics before_save :topics_count_within_bounds private def topics_count_within_bounds return if self.topics.blank? e...
class RemoveColumnsFromPlayerAgain < ActiveRecord::Migration[6.0] def change remove_column :players, :matches_played end end
#!/usr/bin/env ruby # encoding: utf-8 # File: table.rb # Created: 24/09/13 # # (c) Michel Demazure <michel@demazure.com> # script methods for Jacinthe Management module JacintheManagement module GuiQt # Colored items for the Table widget class TableItem < Qt::TableWidgetItem # @param [String] text te...
class CreateResidences < ActiveRecord::Migration def change create_table :residences do |t| t.integer :person_id t.integer :location_id t.string :status t.timestamps end end end
class ChangeOption1ToQnquits < ActiveRecord::Migration def change #qnquitsテーブルのoption1フィールドのデータ型をstring型に変更 change_column :enquits, :option1, :string end end
class Donation < ActiveRecord::Base MIN_AMOUNT = 1 MAX_AMOUNT = 10000 attr_accessible :amount, :charity_id acts_as_sellable belongs_to :order, :class_name => 'MerchantSidekick::PurchaseOrder' belongs_to :charity belongs_to :campaign validates :order, :charity, :presence => true money :amount,...
file ::File.join('/vagrant/.ruby-version') do content node['rocket-fuel']['chruby']['default_ruby'] owner ENV['SUDO_USER'] || node['current_user'] action :create_if_missing end
class WeeklyResult < ActiveRecord::Base belongs_to :user belongs_to :week def update(day,result='asd') self.send "#{day}_drinks=", result == 'yes' ? true : result == 'no' ? false : nil dry_days = 0 Date::DAYNAMES.map{|x| x.downcase}.each do |day| dry_days += (self.send "#{day}_drinks") == 0 ? 1...
# encoding: utf-8 module Github class Users module Emails # List email addresses for the authenticated user # # = Examples # @github = Github.new :oauth_token => '...' # @github.users.emails # def emails(params={}) get("/user/emails", params) end ...
require 'spec_helper' describe Keyrod::FedcloudClient do subject(:fedcloud_client) { described_class.new } before do Keyrod::Settings['site'] = 'https://took666.ics.muni.cz:3000' Keyrod::Settings['access-token'] = 'CiG1bjnAVeoBUcKPm2Oe' Keyrod::Settings['group'] = 'fedcloud.egi.eu' Keyrod::Setting...
require 'qbwc' class CustomerModifyWorker < QBWC::Worker # This worker was setup for testing purposes, it does work, but not reccomened to use during production. # ** make decision if you want to use this in production def requests(job) Rails.logger.info("Starting customer modify") # ...
# frozen_string_literal: true class AddDepartmentIdToProducts < ActiveRecord::Migration[6.0] def change add_reference :products, :department end end
class Book < ApplicationRecord # book likes has_many :users, through: :book_likes has_many :book_likes # book genres has_many :genres, through: :book_genres has_many :book_genres def self.s3_text_upload(params) # We want this method to: # 1. take the params hash, # 2. Make a s3 storage object named/loca...
module GetAddress class MissingFieldsError < StandardError DEFAULTS = [:sort, :format_array] def initialize(missing_fields) @missing_fields = missing_fields check_for_missing_defaults end def message [ missing_fields_message, *missing_defaults_messages ].join ...
class Sentence < ActiveRecord::Base belongs_to :test, dependent: :destroy belongs_to :quession belongs_to :answer end
# frozen_string_literal: true require 'shared/file' require './lib/log_processor/parser' RSpec.describe LogProcessor::Parser do describe '#call' do include_context 'temp file data' it 'calls the different services' do allow(LogProcessor::FileReader).to receive(:call) allow(LogProcessor::Process...
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 # https://github.com/roidrage/lograge def append_info_to_payload(payload) super payload[:request_id] = requ...