text
stringlengths
10
2.61M
require 'rails_helper' RSpec.describe "workflowtemplates/new", type: :view do before(:each) do assign(:workflowtemplate, Workflowtemplate.new( title: "MyString", description: "MyString", responsible_party: "MyText" )) end it "renders new workflowtemplate form" do render assert...
class MarkersController < ApplicationController before_action :set_marker, only: [:show] def index respond_to do |format| format.html format.json { pluck_fields = Marker.pluck(:id, :lat, :lng) render json: Oj.dump(pluck_fields) } end end def show render "show", la...
module RailsAdminSettings module Cache extend ActiveSupport::Concern included do def cache_keys @cache_keys ||= (cache_keys_str || "").split(/\s+/).map { |k| k.strip }.reject { |k| k.blank? } end def add_cache_key(_key) unless has_cache_key?(_key) self.cache_...
class RenameVideosToTracks < ActiveRecord::Migration def up rename_table :videos, :tracks add_column :tracks, :type, :string Track.find_each do |track| track.update_attribute :type, 'ScreenTrack' end end def down remove_column :tracks, :type rename_table :tracks, :videos end end
class Fixnum def length Math.log10(self.abs).to_i + 1 end end class Bignum def length Math.log10(self.abs).to_i + 1 end end class Float def length raise ArgumentError.new("Cannot get length: \"#{self}\" is not an integer") end end class BigDecimal def length raise ArgumentError.new("Can...
require 'features_helper' feature 'Show tags in pdf report', :js do include Features::CommonSupport include Features::AuditReportSupport include Features::WebSupport before do setup_lighting_measure end let!(:user) { create(:user) } let!(:structure_type1) do create(:structure_type, n...
RSpec.feature "Users can view activities" do shared_examples "shows activities" do |params| let(:user) { create(params[:user_type]) } let(:organisation) { (params[:user_type] == :beis_user) ? create(:partner_organisation) : user.organisation } let!(:fund) { create(:fund_activity, :newton) } let!(:pro...
# require 'spec_helper' require 'rails_helper' RSpec.describe ManyToMany do describe '.create' do it 'creates an ActiveRecord object with appropriate foreign keys' do user = create(:user) skatepark = create(:skatepark) ManyToMany.create(Favorite, {user_id: user.id, skatepark_id: skatepark.id}) ...
require 'spec_helper' describe GroupDocs::Signature::Envelope do it_behaves_like GroupDocs::Api::Entity include_examples GroupDocs::Signature::DocumentMethods include_examples GroupDocs::Signature::EntityFields include_examples GroupDocs::Signature::EntityMethods include_examples GroupDocs::Signature::Field...
require 'tap/tasks/file_task' require 'ms/xcalibur/peak_file' module Ms module Xcalibur # :startdoc::task adds graph data to an exported peak file # # Peakify adds points to signify the relative intensity (ie the rounded # intensity/max_intensity) of peaks to a peak list extracted from Xcalib...
# # 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...
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.3.7' gem 'rails', '~> 5.2.1' gem 'bootsnap', require: false gem "loofah", ">= 2.2.3" gem "rubyzip", ">= 1.2.2" # web server gem 'passenger' gem 'puma', '~> 3.0' # db gem 'pg' # font end gem 'haml' ...
module ApnClient class NamedArgs def self.assert_valid!(arguments, options) arguments ||= {} options[:optional] ||= [] options[:required] ||= [] assert_allowed!(arguments, options[:optional] + options[:required]) assert_present!(arguments, options[:required]) end def self.as...
module AdvancedApplicationWindowLayoutHelper def format_date(date) date.strftime("%a %d-%h-%G") end def infrastructure_info_html(inf) return "<h1><i>Unable to locate infrastructure item details</i></h1>" if inf.nil? res = "<table>" res << "<tr><td>Created:</td><td>#{format_date(inf.created_at)...
Metasploit::Model::Spec.shared_examples_for 'Author' do context 'factories' do context author_factory do subject(author_factory) do FactoryGirl.build(author_factory) end it { should be_valid } end end context 'mass assignment security' do it { should allow_mass_assignment_o...
class Documentation < ApplicationRecord belongs_to :user has_one :course has_many :documentation_subscribers, dependent: :destroy attribute :subscribers attribute :course_subscribers attribute :students def self.categorys [["Freiarbeit", 1], ["Angebot", 2], ["Kurs", 3], ["Ausflug", 4], ["Praktikum",...
class Tracking < ActiveRecord::Base belongs_to :store belongs_to :user has_one :order validates_presence_of :url after_create :create_finalurl # def self.details # trackers = [ # ["flipkart",2,"flipkart.com","","","&affid=rohitkuruv"], # ["amazon",0,"amazon.in","","","&tag=rechargery-21"], # ["myntr...
class Admin::Help::CommentsController < Admin::AdminController before_action :set_comment, only: [:edit, :update, :destroy] def index @results ||= Comment.all if params[:keyword] @results = @results.where('content @@ :keyword', keyword: params[:keyword]) end @results = @results.newest.page(...
class ChangeColumnNameToSpaces < ActiveRecord::Migration[5.2] def change rename_column :spaces, :full_addrress, :full_address end end
class Guide::Document < Guide::Node def template partial || self.class.name.underscore end def partial end def stylesheets Guide.configuration.default_stylesheets_for_documents end def javascripts Guide.configuration.default_javascripts_for_documents end def can_be_rendered? true ...
class DocumentotiposController < ApplicationController # GET /documentotipos # GET /documentotipos.json def index @documentotipos = Documentotipo.all respond_to do |format| format.html # index.html.erb format.json { render json: @documentotipos } end end # GET /documentotipos/1 # G...
class AddSeason < ActiveRecord::Migration def self.up add_column :vouchertypes, :season, :integer, :limit => 4, :null => false, :default => 2011 Vouchertype.find(:all).each do |v| if (name =~ /20??/) season = Regexp.last_match(0) elsif v.expiration_date.year <= 2011 season = v.expi...
class Api::InfectedReportsController < ApplicationController def create Survivor.transaction do begin survivor = Survivor.find(infected_report_params[:survivor_id]) infected_report = InfectedReport.new(infected_report_params) if infected_report.save survivor_reports = Infec...
require 'rails_helper' RSpec.describe User, type: :model do it 'has a login' do unnamed = User.create(login: nil) expect(unnamed).to be_invalid expect(unnamed.errors.messages[:login]).to include 'login is required' chris = User.create(login: 'chris') expect(chris).to be_valid end it 'has a ...
class Post < ActiveRecord::Base validates :title, presence: true validates :content, length: { minimum: 250 } validates :summary, length: { maximum: 250 } validates :category, inclusion: { in: %w(Fiction Non-Fiction)} validate :click_bait def click_bait if title.nil? false elsif !title.include?("Won't Bel...
# Pad an Array # I worked on this challenge with Mason Pierce. # I spent [] hours on this challenge. # Complete each step below according to the challenge directions and # include it in this file. Also make sure everything that isn't code # is commented in the file. # # 0. Pseudocode # What is the input? # Inpu...
class BikeParkingSpotsController < ApplicationController before_action :set_bike_parking_spot, only: [:show, :edit, :update, :destroy] def index if BikeParkingSpot.has_something_near?(current_user_address) @bike_parking_spots = BikeParkingSpot.closest_to_user(current_user_address).paginate(:page => ...
class Buyer < User devise :confirmable has_many :buyer_stocks, dependent: :destroy has_many :user_transactions, dependent: :destroy has_many :broker_stocks, through: :user_transactions validates :password_confirmation, presence: true before_create :set_default_to_true def set_default_to_true self.a...
require 'spec_helper' describe Document do before do config.reset config.path ='spec/fixtures/docroot' end describe '#initialize' do context "with empty path" do let(:doc) { Document.new "" } it "sets docroot as base dir" do expect(doc.dir).to match /#{config.path}$/ end...
class IngredientCategory < ApplicationRecord has_many :ingredients, dependent: :destroy validates :name, presence: true, uniqueness: { case_sensitive: false } scope :titles_for_recipe, ->(recipe) { where() } before_save do self.name = name.downcase end self.implicit_order_colum...
class DrAvailabilitiesController < ApplicationController include DrAvailabilitiesConcern before_action :check_current_doctor before_action :check_user_login respond_to :html, :json def index @dr_availabilities = DrAvailability.where(doctor_id: @current_doctor) respond_with @dr_availabilities end...
#!/usr/bin/env ruby require_relative 'update_ptp_dev/scripts/convert_txt_to_sql.rb' if ARGV.length == 1 table_name = "#{ARGV[0]}" unless ARGV[0].nil? ConvertToSql.new(table_name).perform else puts "this script permits only 1 argument, you have given #{ARGV.length}" end
require 'spec_helper' describe Painting do let(:painting) { build(:painting) } describe "attributes and validations" do subject { painting } it { should be_valid} it { should respond_to(:name)} it { should respond_to(:description)} it { should respond_to(:position)} it { should res...
# frozen_string_literal: true class ApplicationController < ActionController::Base include DeviseTokenAuth::Concerns::SetUserByToken before_action do tokens = cookies['session'] ? JSON.parse(cookies.fetch('session')).fetch('tokens') : {} relevant_headers = tokens.symbolize_keys.slice(*DeviseTokenAuth.heade...
class MZRPresentationView < UIView attr_accessor :image, :color def touchViews @touchViews ||= [] end def self.sharedInstance @sharedInstance ||= MZRPresentationView.alloc.init end def initWithFrame(frame) super.tap do self.clipsToBounds = false UIDevice.currentDevice.beginGenera...
require 'rbconfig' include RbConfig module LogWatch # Tailer module module Tailer autoload :Bsd, 'log_watch/tailer/bsd' autoload :Linux, 'log_watch/tailer/linux' autoload :Default, 'log_watch/tailer/default' @os = RbConfig::CONFIG['host_os'] def self.logtail(filename) case @os whe...
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # Configurati...
module Encounters class Resolver class << self def on_move game, params encounter = game.active_encounter encounter.clear_results! params[:selected_moves].each do |using, move_data| execute_player_move(game, encounter, move_data) end if !encounter.complet...
require 'csv' class MenuItemImport attr_reader :row def initialize(category_import, item_type_import, row) @menu = category_import.menu @category_import = category_import @item_type_import = item_type_import @row = row end def import return unless valid? menu_item = build_menu_item ...
FactoryGirl.define do sequence(:email) { |n| "person#{n}@example.com" } sequence(:title) { |n| "podcast#{n}" } factory :podcast do email password 'foobar12' password_confirmation 'foobar12' title description 'description of podcast' itunes 'https://w...
require_relative '../../spec_helper' RSpec.describe OpenAPIParser::Schemas::Paths do let(:root) { OpenAPIParser.parse(normal_schema, {}) } describe 'correct init' do subject { root.paths } it do expect(subject).not_to be nil expect(subject.object_reference).to eq '#/paths' expect(subjec...
class AddUserIdToShred < ActiveRecord::Migration[5.2] def change add_column :shreds, :user_id, :string end end
module CaptureHelper # capture(options) { system 'ping -c 125 127.0.0.1 } def capture(options={}, &blk) timeout = options[:timeout] || 0 cap = PacketGen::Capture.new cap_thread = Thread.new { cap.start(options) } sleep 0.1 blk.call sleep timeout + 2 cap.stop cap end end
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'thor/actions' describe Thor::Actions::CreateFile do before(:each) do ::FileUtils.rm_rf(destination_root) end def invoker @invoker ||= MyCounter.new([], {}, { :root => destination_root }) end def revoker @revoker ||= M...
class CheckGameStateWorker include Sidekiq::Worker def perform(game_id) game = Game.find(game_id) if game.waiting_for_players? if game.current_round.submitted_pictures.where(flickr_id: nil).count == 0 game.waiting_for_votes! end elsif game.waiting_for_votes? if game.current_ro...
class Cage attr_accessor :animal def empty? !@animal end end
class AddColumnElementIdToLog < ActiveRecord::Migration def change add_column :logs, :element_id, :int end end
require 'rubygems' require 'sinatra' require 'phone2post' require 'test/unit' require 'rack/test' require 'ftools' begin; require 'turn'; rescue LoadError; end set :environment, :test class Phone2PostTest < Test::Unit::TestCase include Rack::Test::Methods def app Sinatra::Application end def test_it_u...
class CreateTransactions < ActiveRecord::Migration[5.1] def change create_table :transactions do |t| t.decimal :amount, precision: 15, default: 0 t.datetime :date t.text :description, limit: 255 t.integer :to_id t.timestamps end end end
# frozen_string_literal: true require_dependency 'barong/middleware/jwt_authenticator' module API::V2 module Admin class Base < Grape::API PREFIX = '/admin' use Barong::Middleware::JWTAuthenticator, \ pubkey: Rails.configuration.x.keystore.public_key cascade false format ...
Pod::Spec.new do |spec| spec.name = 'NovaMenu' spec.version = '0.8' spec.summary = 'Sweet Menu Thing' spec.homepage = 'https://github.com/netizen01/NovaMenu' spec.license = { :type => 'MIT', :file => 'LICENSE' } spec....
class UserReward < ActiveRecord::Base belongs_to :location belongs_to :reward belongs_to :sender, class_name: User, foreign_key: :sender_id belongs_to :receiver, class_name: User, foreign_key: :receiver_id attr_accessible :is_reedemed, :reward_id, :sender_id, :receiver_id, :location_id validates :reward_i...
namespace :users do desc "Checks users for out of balance portfolios, and emails if appropriate." task check_portfolio_balances: :environment do if ENV['SEND_CHECK_PORTFOLIO_BALANCE_EMAILS'].to_i == 1 puts "[CheckPortfolioBalances]: Starting CheckPortfolioBalances...." User.with_tracked_portfolios....
require 'spec_helper' require 'capybara/poltergeist' Capybara.javascript_driver = :poltergeist feature 'prevent a pageview event from being sent', js: true do before do InhouseEvents.configure do |config| config.backend_adapter = :test config.backend_path = 'support/backends' config.background...
require "uppercut" require "yaml" class LastIM < Uppercut::Agent def initialize(cfgdir = nil) @cfgdir = cfgdir @cfgdir ||= ENV["HOME"]+"/.last.im/" Dir.mkdir(@cfgdir) unless File.exist?(@cfgdir) begin @credentials = YAML::load(File.read(@cfgdir+"/credentials.yml")) rescue Errno::ENOENT ...
class CreateComments < ActiveRecord::Migration[5.2] def change create_table :post do |t| t.text :name t.text :datestamp t.text :text t.text :post_id t.timestamps end end end
# Copyright © 2011-2019 MUSC Foundation for Research Development # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this list...
require 'json' class GroupMembersController < ApplicationController load_and_authorize_resource def index @group_members = GroupMember.includes(:group).includes(:user) .where(group_id: params[:group_id]) # url = "#{Rails.root.to_s}/app/services/cities.json" # @li...
require 'rails_helper' RSpec.describe OrderItem, type: :model do it "is valid with valid attributes" do Meal.new(name: "Fish and Chips", description: "test test test") DeliveryOrder.new(order_id: "GO001", serving_datetime: "2017-11-26 06:40:00") FactoryBot.create(:delivery_order).should be_valid end...
class CreateCharacters < ActiveRecord::Migration def change create_table :characters do |t| t.references :group, index: true, null: false t.boolean :notify, null: false, default: true t.integer :order, null: false t.boolean :is_admin, null: false, default: false t.references :user, i...
# def sum_consec(number) def sum_consec(number) (1..number).inject(:+) end # def product_consec(number) def product_consec(number) (1..number).inject(:*) end # ask for integer greater than 0 puts "Please enter an integer greater than 0: " input_num = gets.to_i # ask sum or product puts "Enter 's' to compute the ...
class UsersController < ApplicationController def new @user = User.new end def create @user = User.new(user_params) if @user.save session[:user_id] = @user.id redirect_to user_path(@user.id), notice: "you have successfuly registered" else flash.now[:alert] = @user.error.full_me...
require_relative 'policy' require_relative '../../../lib/parameter' module Planning class Rank < Policy DELAY_TO_PREPARE = 1 #TODO suppress toutes les données relatives à advertiser attr :count_visits_per_day, :max_duration_scraping, :url_root, :keywords def initialize(data)...
class CreateRoles < ActiveRecord::Migration[5.2] def change create_table :roles, id: false do |t| t.string :role, primary_key: true t.string :description end end end
class SongVoteCount < ActiveRecord::Migration def change add_column :songs, :num_upvotes, :integer, default: 0 end end
class AddUsernameToSpreeUsers < ActiveRecord::Migration def change add_column :spree_users, :username, :string end end
FactoryGirl.define do factory :language do name 'Dutch' end end
require 'pry' module UI def clear_screen system('clear') || system('cls') end def puts_styled(msg) puts "--> #{msg}" end def line_break puts '' end def horizontal_line puts "----------------------------------" end def sleep_message(msg) if msg.length.positive? sleep 0.5 ...
module Magento module AutoComplete class << self def choices(type,filepath) choices = [] functions = `grep #{type} "#{filepath}"`.split("\n") functions.each do |value| # we should check to see if there isn't a space first_space = value.index...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class M1200g attr_reader :options, :name, :field_type, :node def initialize @name = "Skin and Ulcer/Injury Treatments: Application of nonsurgical dressings (with or without topical medications) other than to feet. (M1200g)" @field_type = RADIO @node = "M1200G" @options = [] @options << FieldO...
json.array!(@account_types) do |account_type| json.extract! account_type, :id, :name, :description, :max_expiry json.url account_type_url(account_type, format: :json) end
require 'spec_helper' describe Kaesen::Btcbox do before do @market = Kaesen::Btcbox.new() end describe "#ticker" do context "normal" do it 'should get ticker' do ticker = @market.ticker print Kaesen::Market.unBigDecimal(ticker) expect(ticker.class).to eq Hash expec...
class Characteristic < ActiveRecord::Base attr_accessible :micropost_id, :characteristic # Micropost belongs_to :characteristics_app # Users has_and_belongs_to_many :users end
require File.join(File.dirname(__FILE__), "spec_helper") describe "Question" do before(:all) do @required = [:text, :options, :type, :rule_base] @typed = {:rule_base => RuleBase, :text => String} @typed_collection = {:new_facts => Fact, :options => Option} @enumerated = {:type => [Question::DETERMINE...
class Booking < ApplicationRecord belongs_to :meeting_room belongs_to :user validates :meeting_room_id, :user_id, presence: true has_one :review, dependent: :destroy end
require "#{Rails.root}/lib/dtos/expedition_dto" module ExpeditionApi class Cost END_POINT = '/v1/costs'.freeze HTTP_METHOD = :post def initialize(args = {}) @rest_client = RestClient.new @cost_params = args[:cost_params] end def call uri = URI.encode "#{BASE_API}#{END_POINT}" ...
# == Schema Information # # Table name: bundles # # id :integer not null, primary key # name :string(255) # description :text # theme_id :integer # image_name :string(255) # created_at :datetime not null # upd...
class User < ActiveRecord::Base has_many :feeds def generate_session_token! self.session_token = SecureRandom.urlsafe_base64(16) return self.session_token end def self.find_by_username_and_password(username, password) user = User.find_by_username(username) return nil unless user return...
class Api::ReflectionsController < ApplicationController before_action :set_tracker before_action :set_reflection, only: [:show, :update, :destroy] def index render json: @tracker.reflections end def show render json: @reflection end def create @reflection = @tracker.days.new(reflection_par...
module Pompeu ResponseCacheData = Struct.new :url, :response, :updated_at # Stores web responses for later usage class WebResponseCache def initialize path Dir.mkdir path unless File.exist? path @path = File.join(path, "web_response_cache.yaml") load end def get url cache_res...
class ArtworksController < ApplicationController before_action :set_artwork, only: [:show, :edit, :update, :destroy] # GET /artworks # GET /artworks.json def index if params[:cat_id] @cat_id=params[:cat_id] @artworks = Cat.find(@cat_id).artworks.rank(:row_order).all else @artworks = A...
class AddRecipeToIntructions < ActiveRecord::Migration[6.0] def change add_reference :instructions, :recipe, index: true end end
#!/usr/bin/env ruby # This example takes a photo and approximates the most dominant color in the image and changes # the LED to match. Our example is using a remote image from a webcam, but you can put any # image source uri. # Install miro gem first # https://github.com/jonbuda/miro require 'miro' require 'limitless...
require 'test_helper' class LendingTest < ActiveSupport::TestCase test 'valid Lending model' do lending = Lending.new(borrower_id: 'abcedfg', lender_name: 'Bob', content: 'book') assert lending.valid? end test 'borrower_id_must_be_presence' do lending = Lending.new(lender_name: 'Bob', content: 'book...
class PostCommentsController < ApplicationController def create movie = Movie.find(params[:movie_id]) comment = current_user.post_comments.new(post_comment_params) comment.movie_id = movie.id comment.save redirect_to movie_path(movie) end def destroy PostComment.find_by(id: params[:id], ...
shared_context 'meetup_response' do let(:meetup_body_multiple_results) do {'results': [ { name: event_name, event_url: event_url, time: start_time, duration: duration, group: { name: group } }, { name: event2_name, event_u...
class BookPlacesController < ApplicationController before_filter :is_curator, only: [:new, :create] def new @book_place = BookPlace.new end def create @place = Place.find(params[:book_place][:place_id]) @book = Book.find(params[:book_place][:book_id]) @place.books << @book redirect_to book...
class AddGsNodeInformationToHuntGroup < ActiveRecord::Migration def change add_column :hunt_groups, :gs_node_id, :integer add_column :hunt_groups, :gs_node_original_id, :integer end end
require 'fileutils' class Indocker::BuildContext attr_reader :configuration, :logger, :global_logger, :helper def initialize(configuration:, logger:, global_logger:) @configuration = configuration @logger = logger @helper = Indocker::BuildContextHelper.new(@configuration, @build_server) @global_lo...
class CreateAttendanceRecords < ActiveRecord::Migration[5.1] def change create_table :attendance_records do |t| t.datetime :checkin_date t.datetime :checkout_date t.integer :membership_status t.string :membership_plan t.string :staff_on_duty t.timestamps end end end
class Topic < ActiveRecord::Base def show_url "/intro/#{self.title}" end end
require 'spec_helper_acceptance' describe 'install environment via r10k and puppetserver' do let(:master_manifest) { <<-EOF include 'iptables' # Set up a puppetserver class { 'pupmod::master': firewall => true, trusted_nets => ['ALL'] } pupmod::master::autosign { 'All Test Host...
require 'rails_helper' RSpec.describe Stats::Streak do it { is_expected.to belong_to :player } it { is_expected.to validate_presence_of :streak_type } it { is_expected.to validate_presence_of :streak_length } it "is either a winning streak or losing streak" do is_expected.to validate_inclusion_of(:streak...
require_dependency 'yt' module Jobs class PollYoutubeChannel < Autobot::Jobs::Base def poll(campaign) Autobot::Youtube::Provider.configure last_polled_at = campaign[:last_polled_at] channel = ::Yt::Channel.new id: campaign[:key] videos = channel.videos videos = videos.where(publis...
require './property_parser' describe INIStrategy do before :each do @strategy = INIStrategy.new end it "raises an exception when sections are missing" do lines = [ "a=b\n", "d=c\n" ] #no [section1] here expect {@strategy.parse(lines)}.to raise_error IniFileSectionUndefined end end describe ...
#!/usr/bin/env ruby FACTOR = 0.55 WIDTH = 1000 HEIGHT = 200 def generate_terrain(iter,range) terrain = [1,1] rn = Random.new(5239) iter.times do i = terrain.size-1 while i > 0 midpoint = (terrain[i]+terrain[i-1])/2.0 terrain.insert(i,midpoint + rn.rand*range-range/2.0) i -= 1 end range *= FACT...
# frozen_string_literal: true module Api class InvitationsController < ApplicationController before_action :authenticate_user! def create invitation = find_or_create_invitation authorize invitation save_record invitation do |saved_invitation| InvitationMailer.created(saved_invitatio...
module Moonrope class Railtie < Rails::Railtie initializer 'moonrope.initialize' do |app| # Initialize a new moonrope base from the API defined in # $RAILS_ROOT/api directory. moonrope_directory = Rails.root.join('api') if File.directory?(moonrope_directory) app.config....
#!/usr/bin/env ruby require 'digest/md5' require 'find' require 'fog' require 'optparse' require 'yaml' def invalidate_files(files, options) connection = Fog::CDN.new( :provider => "AWS", :aws_access_key_id => options[:aws_key], :aws_secret_access_key => options[:aws_secret] ) fixed_paths = [] files.each d...