code
stringlengths
1
1.73M
language
stringclasses
1 value
class DefaultMotivations < ActiveRecord::Migration def self.up Motivation.delete_all Motivation.create(:name => 'Endurance') Motivation.create(:name => 'Fortune') Motivation.create(:name => 'Vengeance') Motivation.create(:name => 'Renown') Motivation.create(:name => 'Pride') Motivatio...
Ruby
class AddMotivationToCharacters < ActiveRecord::Migration def self.up add_column :characters, :motivation_id, :integer end def self.down remove_column :characters, :motivation_id end end
Ruby
class CreateCharacters < ActiveRecord::Migration def self.up create_table :characters do |t| t.string :name t.integer :user_id t.integer :career_path_id t.integer :experience_to_spend, :default => 500 t.integer :experience_spent, :default => 4500 t.timestamps end end ...
Ruby
class AddBirthrightToCharacters < ActiveRecord::Migration def self.up add_column :characters, :birthright_id, :integer end def self.down remove_column :characters, :birthright_id end end
Ruby
class CreateCareers < ActiveRecord::Migration def self.up create_table :careers do |t| t.string :name t.timestamps end end def self.down drop_table :careers end end
Ruby
class AddCareerToCharacters < ActiveRecord::Migration def self.up add_column :characters, :career_id, :integer end def self.down remove_column :characters, :career_id end end
Ruby
class AddLureOfTheVoidToCharacters < ActiveRecord::Migration def self.up add_column :characters, :lure_of_the_void_id, :integer end def self.down remove_column :characters, :lure_of_the_void_id end end
Ruby
class DefaultLureOfTheVoids < ActiveRecord::Migration def self.up LureOfTheVoid.delete_all LureOfTheVoid.create(:name => 'Tainted') LureOfTheVoid.create(:name => 'Criminal') LureOfTheVoid.create(:name => 'Renegade') LureOfTheVoid.create(:name => 'Duty Bound') LureOfTheVoid.create(:name =>...
Ruby
class CreateRoles < ActiveRecord::Migration def self.up create_table :roles do |t| t.string :name t.timestamps end end def self.down drop_table :roles end end
Ruby
class CreateMotivations < ActiveRecord::Migration def self.up create_table :motivations do |t| t.string :name t.timestamps end end def self.down drop_table :motivations end end
Ruby
class DefaultBirthrights < ActiveRecord::Migration def self.up Birthright.delete_all Birthright.create(:name => 'Scavenger') Birthright.create(:name => 'Scapegrace') Birthright.create(:name => 'Stubjack') Birthright.create(:name => 'Child of the Creed') Birthright.create(:name => 'Savant'...
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
source 'http://rubygems.org' gem 'rails', '3.0.0.beta4' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql' gem 'devise', '1.1.rc2' gem 'warden', '0.10.7' gem 'cancan', '1.1.1' gem 'nifty-generators', '0.4.0' gem 'formtastic-rails3', '0.9.10.0' gem 'pg' # Use unicorn a...
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
module HomeWorldsHelper end
Ruby
module LureOfTheVoidsHelper end
Ruby
module ErrorMessagesHelper # Render error messages for the given objects. The :message and :header_message options are allowed. def error_messages_for(*objects) options = objects.extract_options! options[:header_message] ||= "Invalid Fields" options[:message] ||= "Correct the following errors and try a...
Ruby
module BirthrightsHelper end
Ruby
module CharactersHelper end
Ruby
module OriginPathStagesHelper end
Ruby
module TrialsAndTravailsHelper end
Ruby
module CareersHelper end
Ruby
module RolesHelper end
Ruby
module OriginPathsHelper end
Ruby
# These helper methods can be called in your template to set variables to be used in the layout # This module should be included in all views globally, # to do so you may need to add this line to your ApplicationController # helper :layout module LayoutHelper def title(page_title, show_title = true) content_for...
Ruby
module MotivationsHelper end
Ruby
class Character < ActiveRecord::Base attr_accessible :name, :user_id, :experience_to_spend, :experience_spent, :id, :weapon_skill, :ballistic_skill, :strength, :toughness, :agility, :intelligence, :perception, :will_power, :fellowship, :home_world_id, :lure_of_the_void_id, :motivation_id, :birthright_id, :car...
Ruby
class TrialsAndTravails < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class Career < ActiveRecord::Base attr_accessible :name end
Ruby
class OriginPathStage < ActiveRecord::Base attr_accessible :name has_many :origin_paths end
Ruby
class LureOfTheVoid < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class HomeWorld < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class Birthright < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class OriginPath < ActiveRecord::Base attr_accessible :origin_path_stage_id, :name, :description belongs_to :origin_path_stage end
Ruby
class User < ActiveRecord::Base belongs_to :role has_many :characters # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, :lockable and :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable ...
Ruby
class Ability include CanCan::Ability def initialize(user) user ||= User.new(:role_id => Role.find_by_name("Guest").id) if user.role.name == 'Admin' can :manage, :all else if user.role.name == 'Registered' can :read, :all can :create, Character can :update, Ch...
Ruby
class Role < ActiveRecord::Base has_many :users attr_accessible :name, :id end
Ruby
class Motivation < ActiveRecord::Base attr_accessible :name has_many :characters end
Ruby
class CharactersController < ApplicationController load_and_authorize_resource def index @characters = Character.all end def show end def new session[:character_params] = {} @character.user_id = current_user.id @character.weapon_skill = Character.generate_stat @character.ballisti...
Ruby
class OriginPathStagesController < ApplicationController load_and_authorize_resource def index @origin_path_stages = OriginPathStage.all end def show end def new end def create if @origin_path_stage.save flash[:notice] = "Successfully created origin path stage." redirect_t...
Ruby
class BirthrightsController < ApplicationController load_and_authorize_resource def index @birthrights = Birthright.all end def show end def new end def create if @birthright.save flash[:notice] = "Successfully created birthright." redirect_to @birthright else re...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery layout 'application' rescue_from CanCan::AccessDenied do |exception| flash[:error] = "Access Denied." redirect_to root_url end end
Ruby
class OriginPathsController < ApplicationController load_and_authorize_resource def index @origin_paths = OriginPath.all end def show end def new end def create if @origin_path.save flash[:notice] = "Successfully created origin path." redirect_to @origin_path else ...
Ruby
class HomeWorldsController < ApplicationController load_and_authorize_resource def index @home_worlds = HomeWorld.all end def show end def new end def create if @home_world.save flash[:notice] = "Successfully created home world." redirect_to @home_world else rend...
Ruby
class LureOfTheVoidsController < ApplicationController load_and_authorize_resource def index @lure_of_the_voids = LureOfTheVoid.all end def show end def new end def create if @lure_of_the_void.save flash[:notice] = "Successfully created lure of the void." redirect_to @lure...
Ruby
class RolesController < ApplicationController load_and_authorize_resource def index @roles = Role.all end def show end def new end def create if @role.save flash[:notice] = "Successfully created role." redirect_to @role else render :action => 'new' end end ...
Ruby
class MotivationsController < ApplicationController load_and_authorize_resource def index @motivations = Motivation.all end def show end def new end def create if @motivation.save flash[:notice] = "Successfully created motivation." redirect_to @motivation else re...
Ruby
class CareersController < ApplicationController load_and_authorize_resource def index @careers = Career.all end def show end def new end def create if @career.save flash[:notice] = "Successfully created career." redirect_to @career else render :action => 'new' ...
Ruby
class TrialsAndTravailsController < ApplicationController load_and_authorize_resource def index @trials_and_travails = TrialsAndTravails.all end def show end def new end def create if @trials_and_travails.save flash[:notice] = "Successfully created trials and travails." re...
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
require 'formtastic' ActionView::Base.send :include, Formtastic::SemanticFormHelper # Set the default text field size when input is a string. Default is 50. # Formtastic::SemanticFormBuilder.default_text_field_size = 50 # Set the default text area height when input is a text. Default is 20. # Formtastic::SemanticForm...
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. # 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...
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. Rails.application.config.session_store :cookie_store, :key => '_rtcg_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 "rake db:se...
Ruby
# Use this hook to configure devise mailer, warden hooks and so forth. The first # four configuration values can also be set straight in your models. Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in DeviseMailer. config.mailer_sender = "please-change-me@con...
Ruby
Rtcg::Application.routes.draw do |map| resources :careers resources :motivations resources :trials_and_travails resources :birthrights resources :lure_of_the_voids resources :home_worlds resources :characters resources :roles devise_for :users # The priority is based upon order of creation:...
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. gemfile = File.expand_path('../../Gemfile', __FILE__) begin ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup rescue Bundler::GemNotFound => e STDERR.puts e.message STDERR.puts "Try running `bundle install`." exit! end if File.exist?(gem...
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) module Rtcg class Application < Rails::Application # Se...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Rtcg::Application.initialize!
Ruby
Rtcg::Application.configure do # 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 # Full error reports are disabled and caching is turned on ...
Ruby
Rtcg::Application.configure do # 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 webserve...
Ruby
Rtcg::Application.configure do # 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 sui...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Rtcg::Application
Ruby
# 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__) require 'rake' Rails::Application.load_tasks
Ruby
class CreateReservations < ActiveRecord::Migration def self.up create_table :reservations do |t| t.column :date, :date t.column :user_id, :integer t.column :space_id, :integer t.column :note, :text end end def self.down drop_table :reservations end end
Ruby
class CreateUsersSpaces < ActiveRecord::Migration def self.up create_table :spaces_users do |t| t.column :user_id, :integer t.column :space_id, :integer end remove_column :spaces_users, :id end def self.down drop_table :spaces_users end end
Ruby
class AddCapacityToSpace < ActiveRecord::Migration def self.up add_column :spaces, :capacity, :integer end def self.down remove_column :spaces, :capacity end end
Ruby
class CreateSeats < ActiveRecord::Migration def self.up create_table :seats do |t| t.column :space_id, :integer end end def self.down drop_table :seats end end
Ruby
class AddNoteToSpacesUsers < ActiveRecord::Migration def self.up add_column :spaces_users, :note, :text end def self.down remove_column :spaces_users, :note end end
Ruby
class CreateResources < ActiveRecord::Migration def self.up create_table :resources do |t| t.column :name, :string t.column :description, :text end create_table :resources_spaces do |t| t.column :resource_id, :integer t.column :space_id, :integer end remove_column :resource...
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table "users", :force => true do |t| t.column :login, :string t.column :email, :string t.column :crypted_password, :string, :limit => 40 t.column :salt, :str...
Ruby
class AddAdminToUsersSpaces < ActiveRecord::Migration def self.up add_column :spaces_users, :admin, :string remove_column :spaces_users, :note end def self.down remove_column :spaces_users, :admin add_column :spaces_users, :note, :text end end
Ruby
class AddStatusToSpacesUsers < ActiveRecord::Migration def self.up add_column :spaces_users, :status, :string end def self.down remove_column :spaces_users, :status end end
Ruby
class CreateEvents < ActiveRecord::Migration def self.up create_table :events do |t| t.column :name, :string t.column :description, :text t.column :date, :date t.column :space_id, :integer end end def self.down drop_table :events end end
Ruby
class CreateUsersOld < ActiveRecord::Migration def self.up create_table :users do |t| t.column :login, :string t.column :password, :string end end def self.down drop_table :users end end
Ruby
class CreateSpaces < ActiveRecord::Migration def self.up create_table :spaces do |t| t.column :name, :string t.column :address, :string t.column :description, :text t.column :hours, :string end end def self.down drop_table :spaces end end
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test datab...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaire...
Ruby
#!/usr/bin/env ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log ...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaire...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaire...
Ruby
#!/usr/bin/env ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log ...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaire...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby