code
stringlengths
1
1.73M
language
stringclasses
1 value
Proj4::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...
Ruby
Proj4::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 ...
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
# 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. Proj4::Application.config.session_store :cookie_store, :key => '_proj4_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 "rails ge...
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. # 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
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Proj4::Application.initialize!
Ruby
require 'zurb-foundation' # Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" cache_path = "/tmp/.sass-cache" css_dir = "public/css" sass_dir = "sass" images_dir = "public/images" javascripts_dir = "public/js" # You can select your preferre...
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
# 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
# capistrano recipe for deploying using mod_rails set :application, "HockeySite" set :domain, "ryanc.azl.name" set :user, "weberryanc" set :repository, "http://cs4350-weber.googlecode.com/svn/trunk/#{application}" set :use_sudo, false set :deploy_to, "/home/weberryanc/ryanc.azl.name/ryanc" set :scm, ...
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.0...
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| # 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
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy'
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module HomepageHelper end
Ruby
module GamesHelper def no_games(games) content_tag('li', "No Games") if games.empty? end end
Ruby
module TeamHelper def no_players(teams) content_tag('li', "No Players") if teams.empty? end end
Ruby
module PracticeHelper def no_practice(practice) content_tag('li', "No Practice") if practice.empty? end end
Ruby
class Practice < ActiveRecord::Base #show new practices def self.upcoming_practice find(:all, :conditions => "practice_date > CURRENT_TIMESTAMP()", :order => "practice_date") end #show past practices def self.past_practice find(:all, :conditions => "practice_date <= CURRENT_TIMESTAMP()", :order =...
Ruby
class Team < ActiveRecord::Base #show the roster def self.current_players find(:all, :order => "name") end #validate players name validates_presence_of :name #validates players position validates_presence_of :position #validates players number validates_presence_of :number #taggable plugin acts_as_taggable belong...
Ruby
class Manager < ActiveRecord::Base end
Ruby
class Game < ActiveRecord::Base #validation for the games location has to exist validates_presence_of :game_location #validation for the games opponent has to exist validates_presence_of :game_opponent #find and show new games def self.upcoming_games find(:all, :conditions => "game_date > CURRENT_TIMESTAMP()", ...
Ruby
class HomepageController < ApplicationController def index @game = Game.upcoming_games.first end end
Ruby
class GamesController < ApplicationController def index @upcoming_games = Game.upcoming_games @past_games = Game.past_games end #new game def new @game = Game.new end #show games def show @game = Game.find(params[:id]) end #create new games def create @game = Game.new(params[:game]) if @game.save ...
Ruby
class PracticeController < ApplicationController def index @upcoming_practice = Practice.upcoming_practice @past_practice = Practice.past_practice end def new @practice = Practice.new end def show @practice = Practice.find(params[:id]) end def create @practice = Practice.new(params[:practice]) i...
Ruby
# 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 # See ActionController::RequestForgeryProtection for details...
Ruby
class TeamController < ApplicationController def index @current_players = Team.current_players end def new @team = Team.new end def show @team = Team.find(params[:id]) end def create @team = Team.new(params[:team]) if @team.save flash[:notice] = 'Player Added to Roster' redirect_to :ac...
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
#!/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/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
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/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/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/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
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/generate'
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/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreateTeams < ActiveRecord::Migration def self.up create_table :teams do |t| t.string :name t.string :position t.string :number t.timestamps end end def self.down drop_table :teams end end
Ruby
class CreateManagers < ActiveRecord::Migration def self.up create_table :managers do |t| t.string :email t.string :password t.string :name t.timestamps end end def self.down drop_table :managers end end
Ruby
class ActsAsTaggableMigration < ActiveRecord::Migration def self.up create_table :tags do |t| t.column :name, :string end create_table :taggings do |t| t.column :tag_id, :integer t.column :taggable_id, :integer # You should make sure that the column created is...
Ruby
class CreatePractices < ActiveRecord::Migration def self.up create_table :practices do |t| t.date :practice_date t.string :practice_location t.timestamps end end def self.down drop_table :practices end end
Ruby
class CreateGames < ActiveRecord::Migration def self.up create_table :games do |t| t.date :game_date t.string :game_location t.string :game_opponent t.timestamps end end def self.down drop_table :games end end
Ruby
#!/usr/bin/ruby1.8 #!/usr/local/bin/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 performan...
Ruby
#!/usr/bin/ruby1.8 #!/usr/local/bin/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/...
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
# 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
# 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
# capistrano recipe for deploying using mod_rails set :application, "Final" set :domain, "ryanc.azl.name" set :user, "weberryanc" set :repository, "http://cs4350-weber.googlecode.com/svn/trunk/#{application}" set :use_sudo, false set :deploy_to, "/home/weberryanc/ryanc.azl.name/ryanc" set :scm, ...
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.0...
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| # 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
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy'
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module NewsHelper def no_news(news) content_tag('li', "No New News") if news.empty? end end
Ruby
module EventsHelper def no_events(events) content_tag('li', "No Events") if events.empty? end end
Ruby
module UserHelper def image_for_admin_status(user) if user.user_admin? image_tag("star.gif", :alt => "Admin", :size => "16x16") end end def user_owns_record? logged_in? && @user.id == @current_user.id end end
Ruby
module SessionsHelper end
Ruby
module HomepageHelper end
Ruby
module TeamHelper def no_players(teams) content_tag('li', "No Players") if teams.empty? end end
Ruby
module ScheduleHelper def no_games(schedule) content_tag('li', "No Games") if schedule.empty? end end
Ruby
module TicketsHelper end
Ruby
module ManagerHelper def image_for_admin_status(manager) if manager.m_admin? image_tag("star.gif", :alt => "Admin", :size => "16x16") end end end
Ruby
class Events < ActiveRecord::Base #validation for the events location has to exist validates_presence_of :event_location #find and show current events def self.upcoming_events find(:all, :conditions => "event_date >= CURRENT_TIMESTAMP()", :order => "event_date") end #format date to look like a name ...
Ruby
class News < ActiveRecord::Base #validation for the news title has to exist validates_presence_of :title #find and show current events def self.new_news find(:all, :order => "title") end #format date to look like a name def name title end end
Ruby
class Team < ActiveRecord::Base #show the roster def self.current_players find(:all, :order => "name") end #validate players name validates_presence_of :name #validates players position validates_presence_of :position #validates players number validates_presence_of :number end
Ruby
class User < ActiveRecord::Base require 'digest/sha1' # unencrypted password attr_accessor :user_password #mass update protection attr_protected :admin # validation validates_length_of :user_email, :within => 3..100 validates_uniqueness_of :user_email, :case_sensitive => false validates_pres...
Ruby
class Tickets < ActiveRecord::Base end
Ruby
class Manager < ActiveRecord::Base # unencrypted password attr_accessor :m_password # validation validates_presence_of :m_name validates_length_of :m_password, :within => 4..40, :if => :m_password_required? validates_confirmation_of :m_password, :if => :...
Ruby
class Schedule < ActiveRecord::Base #validation for the games opponent has to exist validates_presence_of :opponent #find and show home games def self.home_games find(:all, :conditions => "game_date >= CURRENT_TIMESTAMP() AND game_type = 'home'", :order => "game_date") end #find and show away games def s...
Ruby
class HomepageController < ApplicationController def index @schedule = Schedule.home_games.first @events = Events.upcoming_events.first end end
Ruby
class ManagerController < ApplicationController before_filter :find_manager, :except => [:index, :new, :create] def index @managers = Manager.find(:all, :order => "m_name") end def show end def new @managers = Manager.new end def create @managers = Manager.new(params[:manager]) ...
Ruby
class NewsController < ApplicationController before_filter :admin_required, :except => [:index, :show] def index @new_news = News.new_news end #new news def new @news = News.new end #show news def show @news = News.find(params[:id]) end #create new news def create @news = News.new(params[:news]) i...
Ruby
class ScheduleController < ApplicationController def index @home_games = Schedule.home_games @away_games = Schedule.away_games end #new game def new @schedule = Schedule.new end #show games def show @schedule = Schedule.find(params[:id]) end #create new games def create @schedule = Schedule.new(pa...
Ruby