code
stringlengths
1
1.73M
language
stringclasses
1 value
# 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| map.with_options( :controller => 'events') do |m_user| #m_user.connect "user/new", :action => 'new' m_user.connect 'profile/:login', :action => 'show' m_user.connect '', :action => 'index' end # The priority is based upon order of creation: first created -> ...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def logged_in? return true if session[:user] return false; end end
Ruby
module EventTimeHelper end
Ruby
module EventHelper end
Ruby
module UserHelper end
Ruby
module FreeHelper end
Ruby
class Event < ActiveRecord::Base has_many :users has_many :event_times validates_presence_of :name #validates_presence_of : description validates_presence_of :duration #validates_ end
Ruby
class User < ActiveRecord::Base has_many :frees belongs_to :event validates_numericality_of :event_id validates_presence_of :name #validates_presence_of :login #validates_presence_of :password #validates_presence_of :email #validates_confirmation_of :email #validates_uniqueness_of :login #validates_uniquene...
Ruby
class EventTime < ActiveRecord::Base belongs_to :event validates_presence_of :date_begin validates_presence_of :date_end validates_numericality_of :event_id end
Ruby
class Free < ActiveRecord::Base belongs_to :user validates_presence_of :date_begin validates_presence_of :date_end end
Ruby
require 'rubygems' # Unless you install from the tarball or zip. require 'icalendar' require 'date' #require 'test/unit' #require 'rio' include Icalendar # Probably do this in your class to limit namespace overlap class FreeController < ApplicationController layout 'standard' # list returns the information needed f...
Ruby
class UserController < ApplicationController layout 'standard' # list returns the information needed for user/list.rhtml def list @event = Event.find(params[:id]) @user = User.find(:all, :conditions => ["event_id = ?", params[:id]]) end # show is called for each item in @users in user/list.rhtml def show...
Ruby
class EventsController < ApplicationController layout 'standard' def new @event = Event.new @event_times = EventTime.find(:all, :conditions => "event_id = 0") end def create @event = Event.new(params[:event]) @event_times = EventTime.find(:all, :conditions => "event_id = 0") if @event.save @event_ti...
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 EventTimeController < ApplicationController layout 'standard' def create @event_times = EventTime.new(params[:event_times]) #@event_times[:date_begin] = params["date_begin"] #@event_times[:date_end] = params["date_end"] @event_times[:event_id] = 0 if @event_times.save redirect_to :controlle...
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 CreateEvents < ActiveRecord::Migration def self.up create_table :events do |t| t.string :name t.string :description t.integer :duration t.timestamp :created_at t.timestamp :updated_at end end def self.down drop_table :events end end
Ruby
class CreateFrees < ActiveRecord::Migration def self.up create_table :frees do |t| #t.column :user_id, :integer t.column :date_begin, :string t.column :date_end, :string t.column :created_at, :timestamp t.column :updated_at, :timestamp end end def self.down drop_table :frees end end
Ruby
class CreateEventTimes < ActiveRecord::Migration def self.up create_table :event_times do |t| t.column :event_id, :integer t.column :date_begin, :string t.column :date_end, :string t.column :count, :integer, :default => 0 t.column :updated_at, :timestamp t.column :created_at, :timestamp end e...
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.column :event_id, :integer t.column :name, :string #t.column :login, :string #t.column :password, :string #t.column :email, :string t.column :created_at, :timestamp t.column :updated_at, :timestamp end # add a c...
Ruby
class CreateSessions < 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 CreateEvents < ActiveRecord::Migration def self.up create_table :events do |t| t.column :name, :string t.column :description, :string t.column :duration, :string t.column :date_begin, :string t.column :date_end, :string t.column :created_at, :timestamp t.column :updated_at, :timestamp end ...
Ruby
#!C:/InstantRails-2.0-win/ruby/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 performance...
Ruby
#!C:/InstantRails-2.0-win/ruby/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 performance...
Ruby
#!C:/InstantRails-2.0-win/ruby/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/lo...
Ruby
#!C:/InstantRails-2.0-win/ruby/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 performance...
Ruby
#!C:/InstantRails-2.0-win/ruby/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 performance...
Ruby
#!C:/InstantRails-2.0-win/ruby/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/lo...
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
# 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
# callimachus-finalize.ru # PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-se...
Ruby
# callimachus-origin.ru # PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-serv...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
# callimachus-webapp.ru # # read by Setup.java to determine initial Callimachus webapp path # @webapp </callimachus/1.3/> # PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/ow...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
Ruby
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX owl:<http://www.w3.org/2002/07/owl#> PREFIX skos:<http://www.w3.org/2004/02/skos/core#> PREFIX sd:<http://www.w3.org/ns/sparql-service-description#> PREFIX v...
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 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
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') unless RUBY_PLATFORM =~ /mswin32/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end RAILS...
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
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module ChartHelper end
Ruby
module RecordsHelper end
Ruby
module DesktopHelper end
Ruby
module HomeHelper end
Ruby
module ActivitiesHelper end
Ruby
module FinancialsHelper end
Ruby
class Activity < ActiveRecord::Base has_many :fiscal_transactions, :order => "created_at DESC" has_and_belongs_to_many :records def self.upcoming_activities find(:all, :conditions => "start_time >= now()", :limit => 5, :order => "start_time ASC") end end
Ruby
class FiscalTransaction < ActiveRecord::Base belongs_to :activity belongs_to :record belongs_to :election belongs_to :account def self.recent_fiscal_transactions find(:all, :conditions => "created_on <= now()", :limit => 5, :order => "created_on DESC") end def self.upcomi...
Ruby
class Record < ActiveRecord::Base acts_as_taggable end
Ruby
class Activities < ActiveRecord::Base end
Ruby
class HomeController < ApplicationController require 'SWFChart' def index @title = "Home" @Description_1 = "Income by Type" @swf = SWFChart.new session[:swfchart1] = @swf #set data headings @swf.data_array = Array.new @swf.data_array[0] = [nil] @swf.data_array[1] = [''] @swf.data_array[...
Ruby
class ChartController < ApplicationController def getchart1 #get the swfchart object out of the session and render swf = session[:swfchart1] render :text => swf.get_source_xml end end
Ruby
class FinancialsController < ApplicationController 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 ], :redirect_to => { :action => :list } def list @fi...
Ruby
class ActivitiesController < ApplicationController 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 ], :redirect_to => { :action => :list } def list @ac...
Ruby
class RecordsController < ApplicationController def index @title = 'Search Records' search render :action => 'search' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :actio...
Ruby
# Filters added to this controller will be run for all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base end
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/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/runner'
Ruby