code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class AdminCompanyController < ApplicationController
before_filter :authorize, :logevent
layout "admin"
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
... | Ruby |
class ArchitecturesController < ApplicationController
before_filter :authorize, :logevent
layout "home"
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
... | Ruby |
class AdminLangController < ApplicationController
before_filter :authorize, :logevent
layout "admin"
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
... | Ruby |
class LoginController < ApplicationController
before_filter :logevent, :authorize, :except => :login
layout "admin"
def index
end
def add_user
if request.get?
@user = User.new
else
@user = User.new(params[:user])
if @user.save
flash[:notice] = "User #{@user.username} create... | Ruby |
# copyright (C) Satsang Technologies Limited 2002 - 2007
class ApplicationController < ActionController::Base
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_aditi_session_id'
private
def redirect_to_index(msg=nil)
flash[:notice] = msg if msg
if ses... | Ruby |
class AdminController < ApplicationController
layout "admin"
active_scaffold :user
end
| Ruby |
class LayersController < ApplicationController
before_filter :authorize, :logevent
layout "home"
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:red... | Ruby |
ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# ... | Ruby |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
unless defined?(Rails::Initializer)
if File.directory?("#{RAILS_ROOT}/vendor/rails")
require "#{RAILS_ROOT}/vendor/rails/railties/lib/init... | Ruby |
# Be sure to restart your web 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 =... | 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 |
# 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.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| 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 |
# 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 =>... | Ruby |
class DefaultTrialsAndTravails < ActiveRecord::Migration
def self.up
TrialsAndTravails.delete_all
TrialsAndTravails.create(:name => 'The Hand of War')
TrialsAndTravails.create(:name => 'Press-Ganged')
TrialsAndTravails.create(:name => 'Calamity')
TrialsAndTravails.create(:name => 'Ship-Lorn')... | Ruby |
class DefaultRoles < ActiveRecord::Migration
def self.up
Role.delete_all
Role.create(:name => 'Admin')
Role.create(:name => 'Registered')
Role.create(:name => 'Guest')
end
def self.down
Role.delete_all
end
end
| Ruby |
class AddGenderToCharacters < ActiveRecord::Migration
def self.up
add_column :characters, :gender, :string
end
def self.down
remove_column :characters, :gender
end
end
| Ruby |
class AddRoleIdToUsers < ActiveRecord::Migration
def self.up
add_column :users, :role_id, :integer, :default => Role.find_by_name("Registered").id
end
def self.down
remove_column :users, :role_id
end
end
| Ruby |
class AddUsernameToUsers < ActiveRecord::Migration
def self.up
add_column :users, :username, :string
end
def self.down
remove_column :users, :username
end
end
| Ruby |
class DefaultCareers < ActiveRecord::Migration
def self.up
Career.delete_all
Career.create(:name => 'Astropath Transcendent')
Career.create(:name => 'Arch-Militant')
Career.create(:name => 'Void-Master')
Career.create(:name => 'Explorator')
Career.create(:name => 'Missionary')
Career.... | Ruby |
class AddStatsToCharacters < ActiveRecord::Migration
def self.up
add_column :characters, :weapon_skill, :integer, :null => false
add_column :characters, :ballistic_skill, :integer, :null => false
add_column :characters, :strength, :integer, :null => false
add_column :characters, :toughness, :integer, ... | Ruby |
class AddHomeWorldToCharacters < ActiveRecord::Migration
def self.up
add_column :characters, :home_world_id, :integer
end
def self.down
remove_column :characters, :home_world_id
end
end
| Ruby |
class CreateLureOfTheVoids < ActiveRecord::Migration
def self.up
create_table :lure_of_the_voids do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :lure_of_the_voids
end
end
| Ruby |
class CreateTrialsAndTravails < ActiveRecord::Migration
def self.up
create_table :trials_and_travails do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :trials_and_travails
end
end
| Ruby |
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.tok... | Ruby |
class CreateBirthrights < ActiveRecord::Migration
def self.up
create_table :birthrights do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :birthrights
end
end
| Ruby |
class AddSessionsTable < ActiveRecord::Migration
def self.up
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
def self.down
drop_table :sessions
end
end
| Ruby |
class DefaultHomeWorlds < ActiveRecord::Migration
def self.up
HomeWorld.delete_all
HomeWorld.create(:name => 'Death World')
HomeWorld.create(:name => 'Void Born')
HomeWorld.create(:name => 'Forge World')
HomeWorld.create(:name => 'Hive World')
HomeWorld.create(:name => 'Imperial World')
... | Ruby |
class AddTrialsAndTravailsToCharacters < ActiveRecord::Migration
def self.up
add_column :characters, :trials_and_travails_id, :integer
end
def self.down
remove_column :characters, :trials_and_travails_id
end
end
| Ruby |
class CreateHomeWorlds < ActiveRecord::Migration
def self.up
create_table :home_worlds do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :home_worlds
end
end
| Ruby |
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 |
# 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.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.