code
stringlengths
1
1.73M
language
stringclasses
1 value
class SyllabusController < ApplicationController def index if authorize #@course = Course.find_course if session[:loginrole] == "Admin" @dashboard = "Go to Gradebook" end @course_material = CourseMaterial.find(:first, :conditions => ["doc_type = 1"]) end end ...
Ruby
class AssignemntsController < ApplicationController # GET /assignemnts # GET /assignemnts.xml def index @assignemnts = Assignemnt.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @assignemnts } end end # GET /assignemnts/1 # GET /assignemn...
Ruby
class DashboardController < ApplicationController def index @total_score = 0 if authorize == true @assignments = Assignemnt.find_all_assignemnts() @students = Person.find_by_sql("select p.* from people p, users u where u.role = 2 AND u.username = p.user order by p.surname") ...
Ruby
class PeopleController < ApplicationController # GET /people # GET /people.xml def index @people = Person.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @people } end end # GET /people/1 # GET /people/1.xml def show @person = Perso...
Ruby
class GradeEntriesController < ApplicationController # GET /grade_entries # GET /grade_entries.xml def index @grade_entries = GradeEntry.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @grade_entries } end end # GET /grade_entries/1 # GET...
Ruby
class MaterialsController < ApplicationController def index if authorize @listing = CourseMaterial.find_all_materials if session[:loginrole] == "Admin" @dashboard = "Go to Gradebook" end end end def authorize unless session[:l...
Ruby
class ClassStandingsController < ApplicationController # GET /class_standings # GET /class_standings.xml def index @class_standings = ClassStanding.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @class_standings } end end # GET /class_stan...
Ruby
class LoginController < ApplicationController def index end def make_user user = User.find(:first, :conditions => [ "username = ?", params[:username]]) if params[:password] == "" or params[:password] == nil #check password validity flash[:notice] = "Password can not be empty." redirec...
Ruby
class RateController < ApplicationController def index if authorize if session[:loginrole] == "Admin" @dashboard = "Go to Gradebook" end end @profName = getProfName if(session[:performance].nil?) @performance = "" else @performance = session[:performance] end if(session[:improvem...
Ruby
class RatingSubmittedsController < ApplicationController # GET /rating_submitteds # GET /rating_submitteds.xml def index @rating_submitteds = RatingSubmitted.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @rating_submitteds } end end # GET...
Ruby
class RatingsController < ApplicationController # GET /ratings # GET /ratings.xml def index @ratings = Rating.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @ratings } end end # GET /ratings/1 # GET /ratings/1.xml def show @rating ...
Ruby
class CommunicationsController < ApplicationController def index if authorize @users = getUsers if session[:loginrole] == "Admin" @dashboard = "Go to Gradebook" end end if(session[:message].nil?) @email_message = "" else @email_message = sessi...
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 MajorsController < ApplicationController # GET /majors # GET /majors.xml def index @majors = Major.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @majors } end end # GET /majors/1 # GET /majors/1.xml def show @major = Major.f...
Ruby
class UsersController < ApplicationController # GET /users # GET /users.xml def index @users = User.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @users } end end # GET /users/1 # GET /users/1.xml def show @user = User.find(params...
Ruby
class ContactsController < ApplicationController # GET /contacts # GET /contacts.xml def index @contacts = Contact.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @contacts } end end # GET /contacts/1 # GET /contacts/1.xml def show ...
Ruby
class AnnouncementsController < ApplicationController # GET /announcements # GET /announcements.xml def index @announcements = Announcement.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @announcements } end end # GET /announcements/1 # ...
Ruby
#!usr/bin/env/ruby system "ruby script/generate scaffold user username:string password:string role:integer" system "ruby script/generate scaffold role type:string" system "ruby script/generate scaffold person user:string surname:string firstname:string gender:string age:integer class_standing:integer major:integer" ...
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/dbconsole'
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' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
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' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!usr/bin/env/ruby system "ruby script/generate scaffold user username:string password:string role:integer" system "ruby script/generate scaffold role type:string" system "ruby script/generate scaffold person user:string surname:string firstname:string gender:string age:integer class_standing:integer major:integer" ...
Ruby
class CreateMajors < ActiveRecord::Migration def self.up create_table :majors do |t| t.string :name, :null => false t.timestamps end end def self.down drop_table :majors end end
Ruby
class CreateRatingSubmitteds < ActiveRecord::Migration def self.up create_table :rating_submitteds do |t| t.integer :person_id, :null => false t.timestamps end end def self.down drop_table :rating_submitteds end end
Ruby
class CreateClassStandings < ActiveRecord::Migration def self.up create_table :class_standings do |t| t.string :standing, :null => false t.timestamps end end def self.down drop_table :class_standings end end
Ruby
class CreateRatings < ActiveRecord::Migration def self.up create_table :ratings do |t| t.text :performance, :null => false t.text :improvement, :null => false t.decimal :hours, :null => false t.timestamps end end def self.down drop_table :ratings end end
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 CreateCourseMaterials < ActiveRecord::Migration def self.up create_table :course_materials do |t| t.string :title, :null => false t.string :document_url, :null => false t.timestamp :time_posted, :null => false t.binary :document, :limit => 2.megabyte t.timestamps end end...
Ruby
class CreateContacts < ActiveRecord::Migration def self.up create_table :contacts do |t| t.integer :person_id, :null => false, :options => "CONSTRAINT fk_contact_people REFERENCES people(id)" t.string :address, :null => false t.string :address, :null => false t.string :state, :null => fals...
Ruby
class CreateAssignemnts < ActiveRecord::Migration def self.up create_table :assignemnts do |t| t.string :title, :null => false t.decimal :points_possible, :null => false t.text :description, :null => false t.timestamps end end def self.down drop_table :assignemnts end end
Ruby
class CreateAnnouncements < ActiveRecord::Migration def self.up create_table :announcements do |t| t.timestamp :creation, :null => false t.text :content, :null => false t.timestamps end end def self.down drop_table :announcements end end
Ruby
class CreateGradeEntries < ActiveRecord::Migration def self.up create_table :grade_entries do |t| t.integer :person_id, :null => false, :options => "CONSTRAINT fk_grade_entry_people REFERENCES people(id)" t.integer :assignment_id, :null => false, :options => "CONSTRAINT fk_grade_entry_assignment...
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :username, :null => false t.string :password, :null => false t.integer :role, :null => false, :options => "CONSTRAINT fk_user_roles REFERENCES roles(id)" t.timestamps end end def self.down...
Ruby
class CreatePeople < ActiveRecord::Migration def self.up create_table :people do |t| t.string :user, :null => false t.string :surname, :null => false t.string :firstname, :null => false t.string :gender, :null => false t.integer :age, :null => false t.integer :class_standing, :...
Ruby
class CreateCourses < ActiveRecord::Migration def self.up create_table :courses do |t| t.string :name, :null => false t.text :description, :null => false t.string :logo_url, :null => false t.string :term, :null => false t.datetime :scheduled_time, :null => false t.string :sylla...
Ruby
class CreateRoles < ActiveRecord::Migration def self.up create_table :roles do |t| t.string :type, :null => false t.timestamps end end def self.down drop_table :roles end end
Ruby
#!/usr/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 is severely impaired re...
Ruby
#!/usr/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 is severely impaired re...
Ruby
#!/usr/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/log/fastcgi.crash.log # an...
Ruby
#!/usr/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 is severely impaired re...
Ruby
#!/usr/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 is severely impaired re...
Ruby
#!/usr/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/log/fastcgi.crash.log # an...
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): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full clas...
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
# 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 # Enable threaded mode # config.threadsafe! # Use a different logger for distributed setups # config....
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.2...
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
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
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
# 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/dbconsole'
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' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
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