code
stringlengths
1
1.73M
language
stringclasses
1 value
# This migration comes from spree (originally 20120905145253) class AddTaxRateLabel < ActiveRecord::Migration def change add_column :spree_tax_rates, :name, :string end end
Ruby
# This migration comes from spree_gateway (originally 20130213222555) class UpdateStripePaymentMethodType < ActiveRecord::Migration def up Spree::PaymentMethod.where(:type => "Spree::Gateway::Stripe").update_all(:type => "Spree::Gateway::StripeGateway") end def down Spree::PaymentMethod.where(:type => ...
Ruby
# This migration comes from spree_api (originally 20120530054546) class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration def change unless defined?(User) rename_column :spree_users, :api_key, :spree_api_key end end end
Ruby
# This migration comes from spree_auth (originally 20101026184950) class RenameColumnsForDevise < ActiveRecord::Migration def up return if column_exists?(:spree_users, :password_salt) rename_column :spree_users, :crypted_password, :encrypted_password rename_column :spree_users, :salt, :password_salt r...
Ruby
# This migration comes from spree (originally 20121107184631) class AddCurrencyToLineItems < ActiveRecord::Migration def change add_column :spree_line_items, :currency, :string end end
Ruby
# This migration comes from spree (originally 20121009142519) class AddLockVersionToVariant < ActiveRecord::Migration def change add_column :spree_variants, :lock_version, :integer, :default => 0 end end
Ruby
# This migration comes from spree (originally 20120831092320) class SpreeOneTwo < ActiveRecord::Migration def up # This migration is just a compressed version of all the previous # migrations for spree_core. Do not run it if one of the core tables # already exists. Assume the best. return if table_exi...
Ruby
# This migration comes from spree (originally 20121126040517) class AddLastIpToSpreeOrders < ActiveRecord::Migration def change add_column :spree_orders, :last_ip_address, :string end end
Ruby
# This migration comes from spree (originally 20121010142909) class AddStatesRequiredToCountries < ActiveRecord::Migration def change add_column :spree_countries, :states_required, :boolean,:default => true end end
Ruby
# This migration comes from spree (originally 20130203232234) class AddIdentifierToSpreePayments < ActiveRecord::Migration def change add_column :spree_payments, :identifier, :string end end
Ruby
# This migration comes from spree_api (originally 20100107141738) class AddApiKeyToSpreeUsers < ActiveRecord::Migration def change unless defined?(User) add_column :spree_users, :api_key, :string, :limit => 40 end end end
Ruby
# This migration comes from spree (originally 20121107194006) class AddCurrencyToOrders < ActiveRecord::Migration def change add_column :spree_orders, :currency, :string end end
Ruby
# This migration comes from spree (originally 20130114053446) class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration def self.up add_column :spree_payment_methods, :display_on, :string end def self.down remove_column :spree_payment_methods, :display_on end end
Ruby
# This migration comes from spree_auth (originally 20101214150824) class ConvertUserRememberField < ActiveRecord::Migration def up remove_column :spree_users, :remember_created_at add_column :spree_users, :remember_created_at, :datetime end def down remove_column :spree_users, :remember_created_at ...
Ruby
# This migration comes from spree (originally 20121031162139) class SplitPricesFromVariants < ActiveRecord::Migration def up create_table :spree_prices do |t| t.integer :variant_id, :null => false t.decimal :amount, :precision => 8, :scale => 2, :null => false t.string :currency end Spr...
Ruby
# This migration comes from spree (originally 20121124203911) class AddPositionToTaxonomies < ActiveRecord::Migration def change add_column :spree_taxonomies, :position, :integer, :default => 0 end end
Ruby
# This migration comes from spree_auth (originally 20120605211305) class MakeUsersEmailIndexUnique < ActiveRecord::Migration def up add_index "spree_users", ["email"], :name => "email_idx_unique", :unique => true end def down remove_index "spree_users", :name => "email_idx_unique" end end
Ruby
# This migration comes from spree (originally 20121107003422) class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration def up change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => true end def down change_column :spree_prices, :amount, :decimal, :precision => 8,...
Ruby
# This migration comes from spree_api (originally 20120411123334) class ResizeApiKeyField < ActiveRecord::Migration def change unless defined?(User) change_column :spree_users, :api_key, :string, :limit => 48 end end end
Ruby
# This migration comes from spree (originally 20121017010007) class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration def up change_column :spree_products, :count_on_hand, :integer, :null => true change_column :spree_variants, :count_on_hand, :integer, :null => true end def down cha...
Ruby
# This migration comes from spree_gateway (originally 20130415222802) class UpdateBalancedPaymentMethodType < ActiveRecord::Migration def up Spree::PaymentMethod.where(:type => "Spree::Gateway::Balanced").update_all(:type => "Spree::Gateway::BalancedGateway") end def down Spree::PaymentMethod.where(:ty...
Ruby
# This migration comes from spree (originally 20120929093553) class RemoveUnusedPreferenceColumns < ActiveRecord::Migration def change # Columns have already been removed if the application was upgraded from an older version, but must be removed from new apps. remove_column :spree_preferences, :name if ...
Ruby
# This migration comes from spree_promo (originally 20120831092359) class SpreePromoOneTwo < ActiveRecord::Migration def up # This migration is just a compressed migration for all previous versions of spree_promo return if table_exists?(:spree_products_promotion_rules) create_table :spree_products_promot...
Ruby
# This migration comes from spree_gateway (originally 20111118164631) class CreateSkrillTransactions < ActiveRecord::Migration def change create_table :spree_skrill_transactions do |t| t.string :email t.float :amount t.string :currency t.integer :transaction_id t.integer :customer_id...
Ruby
# This migration comes from spree (originally 20120905151823) class AddToggleTaxRateDisplay < ActiveRecord::Migration def change add_column :spree_tax_rates, :show_rate_in_label, :boolean, :default => true end end
Ruby
# This migration comes from spree_auth (originally 20101026184949) class CreateUsers < ActiveRecord::Migration def up unless table_exists?("spree_users") create_table "spree_users", :force => true do |t| t.string "crypted_password", :limit => 128 t.string "salt", ...
Ruby
# This migration comes from spree (originally 20130120201805) class AddPositionToProductProperties < ActiveRecord::Migration def change add_column :spree_product_properties, :position, :integer, :default => 0 end end
Ruby
# This migration comes from spree_auth (originally 20120203010234) class AddResetPasswordSentAtToSpreeUsers < ActiveRecord::Migration def change Spree::User.reset_column_information unless Spree::User.column_names.include?("reset_password_sent_at") add_column :spree_users, :reset_password_sent_at, :date...
Ruby
# This migration comes from spree_gateway (originally 20121017004102) class UpdateBraintreePaymentMethodType < ActiveRecord::Migration def up Spree::PaymentMethod.where(:type => "Spree::Gateway::Braintree").update_all(:type => "Spree::Gateway::BraintreeGateway") end def down Spree::PaymentMethod.where(...
Ruby
# This migration comes from spree (originally 20121012071449) class AddOnDemandToProductAndVariant < ActiveRecord::Migration def change add_column :spree_products, :on_demand, :boolean, :default => false add_column :spree_variants, :on_demand, :boolean, :default => false end end
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
#!/usr/bin/env rake # 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 File.expand_path('../config/application', __FILE__) Coffee2GoForFun::Application.load_tasks
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.13' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3...
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
module ApplicationHelper end
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby
# Be sure to restart your server when you modify this file. # # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters ...
Ruby
# Configure Spree Preferences # # Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart. # If you would like users to be able to update a setting with the Admin it should NOT be set here. # # In order to initialize a setting...
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. Coffee2GoForFun::Application.config.session_store :cookie_store, key: '_coffee-2-go-for-fun_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session...
Ruby
Coffee2GoForFun::Application.routes.draw do # This line mounts Spree's routes at the root of your application. # This means, any requests to URLs such as /products, will go to Spree::ProductsController. # If you would like to change where this engine is mounted, simply change the :at option to something differen...
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Coffee2GoForFun::Application.initialize! ActiveRecord::Base.include_root_in_json = true
Ruby
Coffee2GoForFun::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false confi...
Ruby
Coffee2GoForFun::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart th...
Ruby
Coffee2GoForFun::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Coffee2GoForFun::Application
Ruby
#!/usr/bin/env rake # 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 File.expand_path('../config/application', __FILE__) Coffee2GoForFun::Application.load_tasks
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" # You can select your preferred output style here (can be overridden via the command line): # o...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # i...
Ruby
Paperclip.interpolates :instance_id do |attachment, style| attachment.instance.update.incident.instance.to_param end Paperclip.interpolates :incident_id do |attachment, style| attachment.instance.update.incident.to_param end Paperclip.interpolates :update_id do |attachment, style| attachment.instance.update.to_...
Ruby
# ActionMailer::Base.smtp_settings = { # :enable_starttls_auto => true, # :address => 'smtp.gmail.com', # :port => 587, # :domain => 'collabbit.org', # :authentication => :plain, # :user_name => 'notifications@collabbit.org', # :password => 'password' # }
Ruby
SIGNUP_NOTICE = "Success! There's one more step. You need to check your email for the confirmation link we sent you. Click on that link to continue into Collabbit." ACCOUNT_SETUP_ERROR = 'There was an error setting up your account. Try again or <a href="mailto:support@collabbit.org">contact the su...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone Mime::Type.register 'text/x-vcard', :vcf
Ruby
# A Site key gives additional protection against a dictionary attack if your # DB is ever compromised. With no site key, we store # DB_password = hash(user_password, DB_user_salt) # If your database were to be compromised you'd be vulnerable to a dictionary # attack on all your stupid users' passwords. With a site...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Be sure to restart your server when you modify this file # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present #RAILS_GEM_VERSION = '2....
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :admins, :only => [:index, :create, :update, :destroy] map.login 'login', :controller => 'admin_sessions', :action => 'new' map.resource :admin_session map.logout 'logout', :controller => 'admin_sessions', :action => 'destroy' map....
Ruby
module GroupTypesHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def active(cond) ' class="active" ' if cond end def flashes f = '' for k in [:error, :warning, :notice, :message] f += content_tag(:div, content_tag(:div, flash[k]), :id => k) if ...
Ruby
module InstancesHelper def permission_checkbox(role, action, model) checked = !!role.permissions.find(:first, :conditions => {:model => model, :action => action}) check_box_tag("permissions[#{role.id}][#{model}][#{action}]",1,checked) end end
Ruby
module PrivilegesManagerHelper end
Ruby
module MembershipsHelper end
Ruby
module UsersHelper # # Use this to wrap view elements that the user can't access. # !! Note: this is an *interface*, not *security* feature !! # You need to do all access control at the controller level. # # Example: # <%= if_authorized?(:index, User) do link_to('List all users', users_path) end %> ...
Ruby
module UpdatesHelper def issuer_link(u) if u.issuing_type == :user link_to u.user.full_name, instance_user_url(@instance, u.user) else link_to u.issuing_group.name, instance_group_type_group_url(@instance, u.issuing_group.group_type, u.issuing_group) end end end
Ruby
module TagsHelper end
Ruby
module SessionsHelper end
Ruby
module AttachmentsHelper end
Ruby
module AdminsHelper end
Ruby
module HomeHelper end
Ruby
module IncidentsHelper end
Ruby
module GroupsHelper end
Ruby
module PrivilegesHelper end
Ruby
module RolesHelper end
Ruby
# Prepares welcome and activation messages to newly-registered users # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License:: http://www.gnu.org/copyleft/l...
Ruby
# A join model between roles and permissions. # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License:: http://www.gnu.org/copyleft/lesser.html GNU Lesser G...
Ruby
# Represents a collection of groups. For example, agencies or committees. # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License:: http://www.gnu.org/copyl...
Ruby
# Represents a unique, brandable, sandboxed version of the site for a specific organization or purpose # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License::...
Ruby
# Represents an action that a user might need authorization to access # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License:: http://www.gnu.org/copyleft...
Ruby
class WhitelistedDomain < ActiveRecord::Base belongs_to :instance end
Ruby
# Represents an update, the core piece of data within the application # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License:: http://www.gnu.org/copyleft/...
Ruby
# Represents a phone carrier # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License:: http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public Lic...
Ruby
# Provides a model for site-wide administrators. Note that while these are not # actual users, in many places the logic dealing with them is quite similar. # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (h...
Ruby
# A join model between users and groups # # Author:: Eli Fox-Epstein, efoxepstein@wesleyan.edu # Author:: Dimitar Gochev, dimitar.gochev@trincoll.edu # Copyright:: Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009. # License:: http://www.gnu.org/copyleft/lesser.html GNU Lesser General...
Ruby