source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/config/initializers/session_store.rb
Ruby
mit
47
master
451
# Be sure to restart your server when you modify this file. Rails3::Application.config.session_store :cookie_store, :key => '_rails3_session', :httponly => false, :secure => false # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/config/environments/development.rb
Ruby
mit
47
master
986
Rails3::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 the webser...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/config/environments/production.rb
Ruby
mit
47
master
1,755
Rails3::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/config/environments/test.rb
Ruby
mit
47
master
1,510
Rails3::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 test s...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/test/functional/other_controller_test.rb
Ruby
mit
47
master
562
require 'test_helper' class OtherControllerTest < ActionController::TestCase test "should get test_locals" do get :test_locals assert_response :success end test "should get test_object" do get :test_object assert_response :success end test "should get test_collection" do get :test_colle...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/test/functional/home_controller_test.rb
Ruby
mit
47
master
1,303
require 'test_helper' class HomeControllerTest < ActionController::TestCase test "should get index" do get :index assert_response :success end test "should get test_params" do get :test_params assert_response :success end test "should get test_model" do get :test_model assert_respon...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/app/models/user.rb
Ruby
mit
47
master
689
class User < ActiveRecord::Base #Should not raise a warning def unused_sql if true @x = z elsif somethingelse @x = "name like '%#{params[:name]}%'" else @x ="foo" end User.where(@x) if true x = z elsif false x = "name like '%#{params[:name]}%'" else ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/app/models/notifier.rb
Ruby
mit
47
master
459
class Notifier < ActionMailer::Base def nsfree_deactivation_heroku(account, allowed, used) # ... subject "#{Zerigo.service_provider[:company_name]} add-on at Heroku: #{Zerigo.sites[:ns][:app_name]} service deactivated" from Zerigo.service_provider[:company_support_email] recipients rcpts bcc Ze...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/app/models/account.rb
Ruby
mit
47
master
554
class Account < ActiveRecord::Base validates_format_of :name, :with => /^[a-zA-Z]+$/ validates_format_of :blah, :with => /\A[a-zA-Z]+$/ validates_format_of :something, :with => /[a-zA-Z]\z/ validates_format_of :good_valid, :with => /\A[a-zA-Z]\z/ #No warning validates_format_of :not_bad, :with => /\A[a-zA-Z]\...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/app/controllers/products_controller.rb
Ruby
mit
47
master
2,064
class ProductsController < ApplicationController # GET /products # GET /products.xml def index @products = Product.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @products } end end # GET /products/1 # GET /products/1.xml def show @produc...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/app/controllers/other_controller.rb
Ruby
mit
47
master
1,711
class OtherController < ApplicationController def test_locals render :locals => { :input => params[:user_input] } end def test_object render :partial => "account", :object => Account.first end def test_collection users = User.all partial = "user" render :partial => partial, :collection =...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/app/controllers/home_controller.rb
Ruby
mit
47
master
3,716
class HomeController < ApplicationController before_filter :filter_it, :only => :test_filter def index end def test_params @name = params[:name] @indirect = indirect_method(params[:input]) end def test_model @name = User.first.name end def test_cookie @name = cookies[:name] end ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3/app/controllers/before_controller.rb
Ruby
mit
47
master
772
class BeforeController < ApplicationController before_filter :filter1 before_filter :filter2 before_filter :filter3, :only => [:use_filter3, :use_filter12345] prepend_before_filter :filter4, :only => [:use_filter12345] append_before_filter :filter5, :only => [:use_filter12345] def use_filters12 end de...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/Rakefile
Ruby
mit
47
master
251
# 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__) Rails4::Application.load_tasks
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/Gemfile
Ruby
mit
47
master
967
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.0' gem 'pg' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 4.0.0' gem 'coffee-rails', '~> 4.0.0' # See https://github....
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/test/test_helper.rb
Ruby
mit
47
master
490
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase ActiveRecord::Migration.check_pending! # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. # # Note: You'll currently still have to decl...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/models/user.rb
Ruby
mit
47
master
1,917
class User < ActiveRecord::Base def test_sql_sanitize(x) self.select("#{sanitize(x)}") end scope :hits_by_ip, ->(ip,col="*") { select("#{col}").order("id DESC") } def arel_exists where(User.where(User.arel_table[:object_id].eq(arel_table[:id])).exists) end def symbol_stuff self.where(User.tab...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/models/phone.rb
Ruby
mit
47
master
238
class Phone < ActiveRecord::Base PHONE_NUMBER_REGEXP = %r{ \A +\d+ # counter prefix \ * # space \(\d+\) # city code \ * # space (\d+-)*\d+ \z }x validates_format_of :number, with: PHONE_NUMBER_REGEXP end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/models/account.rb
Ruby
mit
47
master
1,322
class Account < ActiveRecord::Base attr_accessible :name, :account_id, :admin def sql_it_up_yeah connection.exec_update "UPDATE `purchases` SET type = '#{self.type}' WHERE id = '#{self.id}'" sql = "UPDATE #{self.class.table_name} SET latest_version = #{version} where id = #{self.id}" self.class.connec...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/models/email.rb
Ruby
mit
47
master
485
class Email < ActiveRecord::Base attr_accessible :email belongs_to :user EMAIL_REGEX = /^[a-z0-9]+@[a-z0-9]+\.[a-z]+$/ validates_format_of :email, with: EMAIL_REGEX scope :assigned_to_user, ->(user) { task_table = User.table_name joins("INNER JOIN #{task_table} ON #{task_table}.user_id...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/controllers/application_controller.rb
Ruby
mit
47
master
1,062
class ApplicationController < ActionController::API # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. # protect_from_forgery with: :exception def show_detailed_exceptions? true end def redirect_to_created_model if create @model = User.crea...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/controllers/users_controller.rb
Ruby
mit
47
master
3,167
class UsersController < ApplicationController def test_sql_sanitize User.where("age > #{sanitize params[:age]}") end before_action :set_page prepend_before_action :safe_set_page, :only => :test_prepend_before_action append_before_action :safe_set_page, :only => :test_append_before_action skip_before_...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/controllers/another_controller.rb
Ruby
mit
47
master
1,455
class AnotherController < ApplicationController def overflow @test = @test.where.all end before_filter do eval params[:x] end skip_before_action :set_bad_thing, :except => [:also_use_bad_thing] def use_bad_thing # This should not warn, because the filter is skipped! User.where(@bad_thing)...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/app/controllers/friendly_controller.rb
Ruby
mit
47
master
2,493
class FriendlyController some_helper_thing do @user = User.current_user end def find @user = User.friendly.find(params[:id]) redirect_to @user end def some_user_thing redirect_to @user.url end def try_and_send User.stuff.try(:where, params[:query]) User.send(:from, params[:table...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/config/application.rb
Ruby
mit
47
master
979
require File.expand_path('../boot', __FILE__) require 'rails/all' # Assets should be precompiled for production (so we don't need the gems loaded then) Bundler.require(*Rails.groups(assets: %w(development test))) module Rails4 class Application < Rails::Application # Settings in config/environments/* take prec...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/config/routes.rb
Ruby
mit
47
master
1,561
Rails4::Application.routes.draw do resources not_a_symbol, :controller => :whatever namespace also_not_a_symbol do resource :thing end get ':controller/stuff/:id/:user_id' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake ro...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/config/environments/test.rb
Ruby
mit
47
master
1,559
Rails4::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 test su...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/config/environments/production.rb
Ruby
mit
47
master
3,253
Rails4::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 # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web serve...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/config/environments/development.rb
Ruby
mit
47
master
1,008
Rails4::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 the web se...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/config/initializers/secret_token.rb
Ruby
mit
47
master
652
# 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 atta...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/config/initializers/i18n.rb
Ruby
mit
47
master
834
require 'i18n' # Override exception handler to more carefully html-escape missing-key results. class HtmlSafeI18nExceptionHandler Missing = I18n.const_defined?(:MissingTranslation) ? I18n::MissingTranslation : I18n::MissingTranslationData def initialize(original_exception_handler) @original_exception_han...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/lib/sweet_lib.rb
Ruby
mit
47
master
364
class SweetLib def do_some_cool_stuff bad `ls #{bad}` end def test_command_injection_in_lib IO.popen(['ls', params[:id]]) #Should not warn system("rm #{@bad}") #Should warn about command injection end def test_net_http_start_ssl Net::HTTP.start(uri.host, uri.port, :use_ssl => true, :verify_m...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4/external_checks/check_external_check_test.rb
Ruby
mit
47
master
346
require 'railroader/checks/base_check' #Verify that checks external to the checks/ dir are added by the additional_checks_path options flag class Railroader::CheckExternalCheckTest < Railroader::BaseCheck Railroader::Checks.add_optional self @description = "An external check that does nothing, used for testing" ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/Gemfile
Ruby
mit
47
master
2,182
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.3.1' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.0.beta2' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use Puma as the app server gem 'puma', '~> 3.11' # Us...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/config/application.rb
Ruby
mit
47
master
594
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Rails52 class Application < Rails::Application # Initialize configuration defaults for originally generated Rails v...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/config/initializers/content_security_policy.rb
Ruby
mit
47
master
816
# Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy Rails.application.config.content_security_policy do |p| p.default_src :self, :https p.font_src :self, :https, :data ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/config/environments/development.rb
Ruby
mit
47
master
2,062
Rails.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 the web serv...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/config/environments/production.rb
Ruby
mit
47
master
3,938
Rails.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 # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/app/models/user.rb
Ruby
mit
47
master
755
class User < ActiveRecord::Base def not_something thing where.not("blah == #{thing}") end SUBQUERY_TABLE_ALIAS = "my_table_alias".freeze # This is used inside a larger query by using `inner_query.to_sql` def inner_query self.class. select("#{SUBQUERY_TABLE_ALIAS}.*"). from("#{table_name} ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/app/controllers/users_controller.rb
Ruby
mit
47
master
492
class UsersController < ApplicationController def index index_params = params.permit(:name, friend_names: []).to_hash User.where(index_params).qualify.all end def show show_params = params.permit(:id, :name).to_hash.symbolize_keys User.where(show_params).qualify.all end ALLOWED_FOOS = [:bar,...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5.2/lib/shell.rb
Ruby
mit
47
master
1,529
class ShellStuff def initialize(one, two) @one = Shellwords.shellescape(one) @two = Shellwords.escape(two) end def run(ip) ip = Shellwords.shellescape(ip) `dig +short -x #{ip} @#{@one} -p #{@two}` end def backticks_target(path) `echo #{path}`.chomp end def process_pid # should n...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/app/controllers/users_controller.rb
Ruby
mit
47
master
3,394
class UsersController < ApplicationController before_filter :require_logged_in, :only => [:edit, :destroy, :update] # GET /users # GET /users.xml def index @users = User.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @users } end end # GET /us...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/app/controllers/posts_controller.rb
Ruby
mit
47
master
2,096
class PostsController < ApplicationController before_filter :require_logged_in, :except => [:index, :show] # GET /posts # GET /posts.xml def index @posts = Post.all(:conditions => { :in_reply_to => nil }) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @p...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/app/controllers/application_controller.rb
Ruby
mit
47
master
801
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time #protect_from_forgery # See ActionController::RequestForgeryP...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/app/helpers/application_helper.rb
Ruby
mit
47
master
227
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def authorized? (@user and @current_user == @user[:id]) or (@current_user and @current_user.admin?) end end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/app/models/user.rb
Ruby
mit
47
master
312
class User < ActiveRecord::Base has_many :posts validates_uniqueness_of :user_name validates_format_of :user_name, :with => /^\w+$/ validates_length_of :user_name, :maximum => 10 validates_format_of :display_name, :with => /^(\w|\s)+$/ validates_presence_of :user_name, :display_name, :password end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/config/routes.rb
Ruby
mit
47
master
2,272
ActionController::Routing::Routes.draw do |map| map.resources :posts map.resources :users map.connect 'login', :controller => 'users', :action => 'login' map.connect 'logout', :controller => 'users', :action => 'logout' map.connect 'results', :controller => 'users', :action => 'results' map.connect 's...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/config/environment.rb
Ruby
mit
47
master
1,980
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/config/initializers/cookie_verification_secret.rb
Ruby
mit
47
master
505
# 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 atta...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/config/initializers/session_store.rb
Ruby
mit
47
master
799
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions 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 attacks. Act...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/config/initializers/single_quote_workaround.rb
Ruby
mit
47
master
549
class ERB module Util if "html_safe exists".respond_to?(:html_safe) def html_escape(s) s = s.to_s if s.html_safe? s else Rack::Utils.escape_html(s).html_safe end end else def html_escape(s) s = s.to_s Rack::Utils.escape_htm...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/config/initializers/yaml_parsing.rb
Ruby
mit
47
master
271
#Enable YAML parsing (bad) ActionController::Base.param_parsers[Mime::YAML] = :yaml #Disable YAML in XML (good) ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING.delete('symbol') ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING.delete('yaml')
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/test/functional/posts_controller_test.rb
Ruby
mit
47
master
983
require 'test_helper' class PostsControllerTest < ActionController::TestCase test "should get index" do get :index assert_response :success assert_not_nil assigns(:posts) end test "should get new" do get :new assert_response :success end test "should create post" do assert_differenc...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/test/functional/users_controller_test.rb
Ruby
mit
47
master
983
require 'test_helper' class UsersControllerTest < ActionController::TestCase test "should get index" do get :index assert_response :success assert_not_nil assigns(:users) end test "should get new" do get :new assert_response :success end test "should create user" do assert_differenc...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/db/schema.rb
Ruby
mit
47
master
1,255
# This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your data...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/db/migrate/20120312065023_create_posts.rb
Ruby
mit
47
master
269
class CreatePosts < ActiveRecord::Migration def self.up create_table :posts do |t| t.integer :user_id t.string :title t.string :body t.integer :in_reply_to t.timestamps end end def self.down drop_table :posts end end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails_with_xss_plugin/db/migrate/20120312064721_create_users.rb
Ruby
mit
47
master
325
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :display_name t.string :user_name t.string :signature t.string :profile t.string :password t.boolean :admin t.timestamps end end def self.down drop_table :users end...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/config.ru
Ruby
mit
47
master
311
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) # Action Cable uses EventMachine which requires that all classes are loaded in advance Rails.application.eager_load! require 'action_cable/process/logging' run Rails.application
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/Gemfile
Ruby
mit
47
master
1,498
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '>= 5.0.0.beta1', '< 5.1' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and vie...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/app/controllers/mixed_controller.rb
Ruby
mit
47
master
885
class BaseController < ActionController::Base # No protect_from_forgery call, but one mixed in include ForgeryProtection include Concerning Statistics::AdminWithdrawal::BANK_LIST = [:deutsche, :boa, :jpm_chase, :cyprus] def another_early_return bank_name = params[:filename].first unless Statistics::...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/app/controllers/users_controller.rb
Ruby
mit
47
master
2,316
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] # GET /users # GET /users.json def index @users = User.all end # GET /users/1 # GET /users/1.json def show end # GET /users/new def new @user = User.new end # GET /users/1...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/app/controllers/widget_controller.rb
Ruby
mit
47
master
2,946
class WidgetController < ApplicationController def show end def dynamic_constant identifier_class = params[:IdentifierClass] namespace = identifier_class.constantize::IDENTIFIER_NAMESPACE # should warn end def render_thing render params[:x].thing? end def render_inline render :inline =>...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/app/models/user.rb
Ruby
mit
47
master
455
class User < ApplicationRecord def self.evaluate_user_input eval(params) end def evaluate_user_input self.class.evaluate_user_input end def test_stuff if Rails.env.test? User.where(params) end end has_many :things, -> { where(Thing.canadian.where_values_hash) } def self.all...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/app/models/thing.rb
Ruby
mit
47
master
893
class Thing < ApplicationRecord def self.self_and_descendants_for(id) where(<<-SQL, id: id) #{quoted_table_name}.#{quoted_primary_key} IN ( WITH RECURSIVE descendant_tree(#{quoted_primary_key}, path) AS ( SELECT #{quoted_primary_key}, ARRAY[#{quoted_primary_key}] FROM #{quote...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/db/seeds.rb
Ruby
mit
47
master
356
# 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 (or created alongside the db with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/lib/a_lib.rb
Ruby
mit
47
master
539
class JustAClass def do_sql_stuff joins("INNER JOIN things ON id = #{params[:id]}"). joins("INNER JOIN things ON stuff = 1") end def divide_by_zero whatever / 0 # warns x = 100 y = x - 100 z = x / y # warns 1.0 / 0 # does not warn end def tempfile FileUtils.move(params.perm...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/test/controllers/users_controller_test.rb
Ruby
mit
47
master
940
require 'test_helper' class UsersControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:one) end test "should get index" do get users_url assert_response :success end test "should get new" do get new_user_url assert_response :success end test "should create user" ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/config/routes.rb
Ruby
mit
47
master
306
Rails.application.routes.draw do resources :users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # Serve websocket cable requests in-process # mount ActionCable.server => '/cable' if Rails.env.test? match '/:controller/:action' end end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/config/application.rb
Ruby
mit
47
master
505
require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Rails5 class Application < Rails::Application # Settings in config/environments/* take preced...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/config/initializers/active_record_belongs_to_required_by_default.rb
Ruby
mit
47
master
331
# Be sure to restart your server when you modify this file. # Require `belongs_to` associations by default. This is a new Rails 5.0 default, # so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading. Rails.application.config.active_record.belongs_to_required_by_defa...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/config/initializers/cookies_serializer.rb
Ruby
mit
47
master
273
# Be sure to restart your server when you modify this file. # This is a new Rails 5.0 default, so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading. Rails.application.config.action_dispatch.cookies_serializer = :json
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/config/initializers/callback_terminator.rb
Ruby
mit
47
master
326
# Be sure to restart your server when you modify this file. # Do not halt callback chains when a callback returns false. This is a new Rails 5.0 default, # so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading. ActiveSupport.halt_callback_chains_on_return_false = ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/config/environments/production.rb
Ruby
mit
47
master
3,459
Rails.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 # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails5/external_checks/check_external_check_test.rb
Ruby
mit
47
master
273
require 'railroader/checks/base_check' class Railroader::CheckExternalCheckConfigTest < Railroader::BaseCheck Railroader::Checks.add_optional self @description = "An external check for testing" def run_check raise "This should not have been loaded!" end end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/Rakefile
Ruby
mit
47
master
272
#!/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__) Rails32::Application.load_tasks
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/Gemfile
Ruby
mit
47
master
782
source 'https://rubygems.org' gem 'rails', '3.2.9.rc2' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' gem 'json' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffe...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/routes.rb
Ruby
mit
47
master
2,492
Rails32::Application.routes.draw do resources :users do get 'mixed_in' member do put 'update_password' => redirect('/settings/update_password') end end match 'remove' => 'removal#remove_this_too' match 'implicit' => 'removal#implicit_render' match 'exec' => 'exec#exec_this' # Routes fo...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/application.rb
Ruby
mit
47
master
2,917
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...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/environments/production.rb
Ruby
mit
47
master
2,772
Rails32::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 config.action...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/environments/development.rb
Ruby
mit
47
master
1,374
Rails32::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 the web se...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/environments/test.rb
Ruby
mit
47
master
1,527
Rails32::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 test su...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/initializers/session_store.rb
Ruby
mit
47
master
417
# Be sure to restart your server when you modify this file. Rails32::Application.config.session_store :cookie_store, :key => '_rails3.2_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 table with "rai...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/initializers/secret_token.rb
Ruby
mit
47
master
498
# 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...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/config/initializers/header_dos_protection.rb
Ruby
mit
47
master
527
# https://groups.google.com/d/msg/ruby-security-ann/A-ebV4WxzKg/KNPTbX8XAQUJ ActiveSupport.on_load(:action_view) do ActionView::LookupContext::DetailsKey.class_eval do class << self alias :old_get :get def get(details) if details[:formats] details = details.dup syms...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/app/models/multi_model.rb
Ruby
mit
47
master
226
module MultiModel class Model1 < ActiveRecord::Base def model_exec system params[:user_input] end end class Model2 < ActiveRecord::Base def model_exec system params[:user_input2] end end end
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/app/controllers/users_controller.rb
Ruby
mit
47
master
2,278
class UsersController < ApplicationController include UserControllerMixin # GET /users # GET /users.json def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render :json => @users } end end # GET /users/1 # GET /users/1.json def show ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails3.2/app/controllers/removal_controller.rb
Ruby
mit
47
master
426
class RemovalController < ApplicationController def change_lines <<-X this method is here for line numbers X end def remove_this redirect_to params[:url] end def remove_this_too @some_input = raw params[:input] @some_other_input = Account.first.name render 'r...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/config/environment.rb
Ruby
mit
47
master
1,980
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/config/routes.rb
Ruby
mit
47
master
2,377
ActionController::Routing::Routes.draw do |map| #Default routes are set for everything, #so these routes are testing for specific problems map.with_options :controller => 'other', :action => 'nothing' do |r| r.connect 'blah' end map.connect 'something', :controller => "something#{dynamic}" map.resourc...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/config/initializers/session_store.rb
Ruby
mit
47
master
709
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions 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 attacks. Act...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/config/initializers/cookie_verification_secret.rb
Ruby
mit
47
master
505
# 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 atta...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/app/controllers/home_controller.rb
Ruby
mit
47
master
3,858
class HomeController < ApplicationController before_filter :filter_it, :only => :test_filter before_filter :or_equals, :only => :test_mass_assign_with_or_equals def index; end def test_params @name = params[:name] @indirect = indirect_method(params[:input]) end def test_model @name = User.fir...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/app/controllers/other_controller.rb
Ruby
mit
47
master
1,713
class OtherController < ApplicationController def test_locals render :locals => { :input => params[:user_input] } end def test_object render :partial => "account", :object => Account.first end def test_collection users = User.all partial = "user" render :partial => partial, :collection =...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/app/controllers/application_controller.rb
Ruby
mit
47
master
1,381
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time #protect_from_forgery # See ActionController::RequestForgeryP...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails2/app/models/user.rb
Ruby
mit
47
master
1,443
class User < ActiveRecord::Base named_scope :dah, lambda {|*args| { :conditions => "dah = '#{args[1]}'"}} named_scope :phooey, :conditions => "phoeey = '#{User.phooey}'" named_scope :with_state, lambda {|state| state.present? ? {:conditions => "state_name = '#{state}'"} : {}} named_scope :safe_phooey, :con...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/gems.rb
Ruby
mit
47
master
937
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.0' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 4.0.0' gem 'coffee-rails', '~> 4.0.0' # See https://gi...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/config/routes.rb
Ruby
mit
47
master
1,410
Rails4::Application.routes.draw do # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". # You can have the root of your site routed with "root" # root to: 'welcome#index' # Example of regular route: # get 'products/:id' ...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/config/initializers/nested_attributes_bypass_fix.rb
Ruby
mit
47
master
873
module ActiveRecord module NestedAttributes private def reject_new_record?(association_name, attributes) will_be_destroyed?(association_name, attributes) || call_reject_if(association_name, attributes) end def call_reject_if(association_name, attributes) return false if will_be_destroyed...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/config/environments/production.rb
Ruby
mit
47
master
3,664
Rails4::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 # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web serve...
github
david-a-wheeler/railroader
https://github.com/david-a-wheeler/railroader
test/apps/rails4_with_engines/engines/user_removal/lib/user_removal.rb
Ruby
mit
47
master
459
module UserRemoval class Engine < Rails::Engine initializer :assets do |config| Rails.application.config.assets.precompile += Dir.glob(root.join('app/assets/stylesheets/**/*.css*')).collect {|f| f.gsub(%r{.*/app/assets/stylesheets/}, "").gsub(/\.css.*/, '.css') } Rails.application.config.assets.preco...