code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class CommentsController < ApplicationController
def index
@comments = Comment.all()
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @comments }
end
end
def new
@bug = Bug.find(params[:bug_id])
@comment = @bug.comments.build
@comment.status =... | Ruby |
require 'csv'
class BugsController < ApplicationController
# GET /bugs
# GET /bugs.xml
def filter
session[:developer_to_filter] = params[:developer_to_filter] || []
session[:status_to_filter] = params[:status_to_filter] || []
session[:release_to_filter] = params[:release_to_filter] || []
redir... | Ruby |
class LoginController < ApplicationController
def authenticate
if (params[:user_id])
@members = Member.all(:conditions => "nickname = '#{params[:user_id]}'")
logger.info " **** Logged in " + @members[0].inspect
if ( @members[0] )
cookies[:user_id] = {:value => params[:user_id], ... | Ruby |
class ReleasesController < ApplicationController
def new
@release = Release.new
render :release_details, :layout => false
end
def create
@release = Release.new(params[:release])
if @release.save then
@releases = Release.all
render :release_saved
else
render :release_... | Ruby |
module MembersHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module CommentsHelper
end
| Ruby |
module ReleasesHelper
end
| Ruby |
module BugsHelper
def bug_feeling (bug)
feeling = "two_persons" if bug.status == "Code review, please!"
feeling = "bag" if bug.status == "Ready for build"
feeling = "person" if bug.status == "Working on it"
feeling = "question" if bug.status == "Pending clarification"
feeling = "locked" if ... | Ruby |
class Bug < ActiveRecord::Base
belongs_to :developer, :class_name => "Member"
belongs_to :reviewer, :class_name => "Member"
belongs_to :release
has_many :comments
belongs_to :bug_status, :class_name => "Status" , :foreign_key => "status_id"
validates_presence_of :release, :on=>:update
validate :reviewed_f... | Ruby |
class Comment < ActiveRecord::Base
belongs_to :bug
belongs_to :commenter, :class_name => "Member", :foreign_key => "commenter_id"
REVIEW = "Review"
ADDITIONAL_REQUIREMENT = "Additional-Requirement"
QA_FAILURE = "QA-Failure"
DEVELOPER_NOTE = "Developer-Note"
def review?
REVIEW.eql?(comment_type)
en... | Ruby |
class Release < ActiveRecord::Base
validates_presence_of :release_number, :release_date
has_many :bugs
def self.active_releases
Release.all(:order => "release_number", :conditions => ["release_date >= :release_date", { :release_date => Time.now }])
end
def release_info
date_format = "%d %b"
... | Ruby |
class Member < ActiveRecord::Base
def member_type
if admin?
"Administrator"
else
"User"
end
end
def status
active ? "active" : "inactive"
end
end
| Ruby |
class Status < ActiveRecord::Base
has_many :bugs
def self.find_by_user_role (admin)
if admin then
all
else
find_all_by_admin_only false
end
end
end
| Ruby |
class BugMailer < ActionMailer::Base
def status_email(bug, action_taken)
recipients ["SITA_WorldTracerWeb@mindtree.com"] #SITA_WorldTracerWeb
from "RoR_Bug_Manager@mindtree.com"
subject "Bug #{bug.defect_id} #{action_taken} (#{bug.status})"
sent_on Time.now
body :bug => bug
content_type "tex... | Ruby |
class BugObserver < ActiveRecord::Observer
def after_create(bug)
#BugMailer.deliver_status_email(bug, 'Created')
end
#def after_update(bug)
# BugMailer.deliver_status_email(bug, 'Updated')
#end
end | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::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 da... | 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.resources :comments
map.login 'login', :controller => "login", :action => "index"
map.resources :members
map.connect 'releases/report', :controller => 'releases', :action => 'report'
map.connect 'releases/taskboard', :controller => 'releases', :actio... | 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.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions 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 attacks.
Act... | 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 do debug a probl... | 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.
# 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.
ActiveReco... | Ruby |
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | 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 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
config.action_controller.consider_all_reque... | 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 |
#!/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/performance/profiler'
| 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/profiler'
| 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/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/generate'
| 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'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
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/runner'
| 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/console'
| 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/plugin'
| Ruby |
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.text :body
t.integer :commenter_id
t.string :status
t.integer :bug_id
t.timestamps
end
end
def self.down
drop_table :comments
end
end
| Ruby |
class AddDeveloperIdToBugs < ActiveRecord::Migration
def self.up
add_column :bugs, :developer_id, :integer
end
def self.down
remove_column :bugs, :developer_id
end
end
| Ruby |
class AddReleaseToBugs < ActiveRecord::Migration
def self.up
change_table :bugs do |t|
t.references :release
end
end
def self.down
change_table :bugs do |t|
t.remove_references :release
end
end
end
| Ruby |
class AddForecastDateToBugs < ActiveRecord::Migration
def self.up
add_column :bugs, :estimate, :string
add_column :bugs, :planned_completion_date, :date
end
def self.down
remove_column :bugs, :estimate, :string
remove_column :bugs, :planned_completion_date, :date
end
end
| Ruby |
class CreateReleases < ActiveRecord::Migration
def self.up
create_table :releases do |t|
t.string :release_number
t.datetime :release_date
t.timestamps
end
end
def self.down
drop_table :releases
end
end
| Ruby |
class AddReviewerIdToBugs < ActiveRecord::Migration
def self.up
add_column :bugs, :reviewer_id, :integer
end
def self.down
remove_column :bugs, :reviewer_id
end
end
| Ruby |
class AddNicknameToMembers < ActiveRecord::Migration
def self.up
add_column :members, :nickname, :string
end
def self.down
remove_column :members, :nickname
end
end
| Ruby |
class CreateBugs < ActiveRecord::Migration
def self.up
create_table :bugs do |t|
t.integer :defect_id
t.string :defect_type
t.string :priority
t.text :summary
t.string :developer
t.string :status
t.timestamps
end
end
def self.down
drop_table :bugs
end
end
| Ruby |
class AddCommentTypeToComments < ActiveRecord::Migration
def self.up
add_column :comments, :comment_type, :string
end
def self.down
remove_column :comments, :comment_type
end
end
| Ruby |
class CreateMembers < ActiveRecord::Migration
def self.up
create_table :members do |t|
t.string :employee_id
t.string :name
t.string :contact_number
t.string :email
t.timestamps
end
end
def self.down
drop_table :members
end
end
| Ruby |
class MembersController < ApplicationController
skip_before_filter :check_authentication
# GET /members
# GET /members.xml
def index
@members = Member.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @members }
end
end
# GET /members/1
# GET... | 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
before_filter :check_authentication, :except => [:login, :authenticate]
helper :all # include all helpers,... | Ruby |
class CommentsController < ApplicationController
def index
@comments = Comment.all()
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @comments }
end
end
def new
@bug = Bug.find(params[:bug_id])
@comment = @bug.comments.build
@comment.status =... | Ruby |
require 'csv'
class BugsController < ApplicationController
# GET /bugs
# GET /bugs.xml
def index
session[:status_to_filter] = params[:status_to_filter] if params[:status_to_filter]
session[:closed_ones_too] = params[:closed_ones_too]
developer_to_filter = params[:developer_to_filter] || session[:... | Ruby |
class LoginController < ApplicationController
def authenticate
if (params[:user_id])
@members = Member.all(:conditions => "nickname = '#{params[:user_id]}'")
logger.info " **** Logged in " + @members[0].inspect
if ( @members[0] )
cookies[:user_id] = {:value => params[:user_id], ... | Ruby |
class ReleasesController < ApplicationController
def new
@release = Release.new
render :release_details, :layout => false
end
def create
@release = Release.new(params[:release])
if @release.save then
@releases = Release.all
render :release_saved
else
render :release_... | Ruby |
module MembersHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module CommentsHelper
end
| Ruby |
module ReleasesHelper
end
| Ruby |
module BugsHelper
def bug_feeling (bug)
feeling = "two_persons" if bug.status == "Code review, please!"
feeling = "bag" if bug.status == "Ready for build"
feeling = "person" if bug.status == "Working on it"
feeling = "question" if bug.status == "Pending clarification"
feeling = "locked" if ... | Ruby |
class Bug < ActiveRecord::Base
belongs_to :developer, :class_name => "Member"
belongs_to :reviewer, :class_name => "Member"
belongs_to :release
has_many :comments
validates_presence_of :release, :on=>:update
validate :cant_close_if_open_comments
validate :review_comments_present
def cant_close_if_open... | Ruby |
class Comment < ActiveRecord::Base
belongs_to :bug
belongs_to :commenter, :class_name => "Member", :foreign_key => "commenter_id"
REVIEW = "Review"
ADDITIONAL_REQUIREMENT = "Additional-Requirement"
QA_FAILURE = "QA-Failure"
DEVELOPER_NOTE = "Developer-Note"
def review?
REVIEW.eql?(comment_type)
en... | Ruby |
class Release < ActiveRecord::Base
validates_presence_of :release_number, :release_date
has_many :bugs
def self.active_releases
Release.all(:order => "release_number", :conditions => ["release_date >= :release_date", { :release_date => Time.now }])
end
def release_info
date_format = "%d %b"
... | Ruby |
class Member < ActiveRecord::Base
end
| Ruby |
class BugMailer < ActionMailer::Base
def status_email(bug, action_taken)
recipients ["SITA_WorldTracerWeb@mindtree.com"] #SITA_WorldTracerWeb
from "RoR_Bug_Manager@mindtree.com"
subject "Bug #{bug.defect_id} #{action_taken} (#{bug.status})"
sent_on Time.now
body :bug => bug
content_type "tex... | Ruby |
class BugObserver < ActiveRecord::Observer
def after_create(bug)
#BugMailer.deliver_status_email(bug, 'Created')
end
#def after_update(bug)
# BugMailer.deliver_status_email(bug, 'Updated')
#end
end | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::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 da... | 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.resources :comments
map.login 'login', :controller => "login", :action => "index"
map.resources :members
map.connect 'releases/report', :controller => 'releases', :action => 'report'
map.connect 'releases/taskboard', :controller => 'releases', :actio... | 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.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions 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 attacks.
Act... | 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 do debug a probl... | 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.
# 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.
ActiveReco... | Ruby |
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | 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 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
config.action_controller.consider_all_reque... | 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 |
class AddStatsToUser < ActiveRecord::Migration
def self.up
add_column :users, :attack, :int, :default => 10
add_column :users, :defense, :int, :default => 9
add_column :users, :magic, :int, :default => 8
end
def self.down
remove_column :users, :magic
remove_column :users, :defense
remove_... | Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.column :login, :string, :limit => 40
t.column :name, :string, :limit => 100, :default => '', :null => true
t.column :email, :string, ... | Ruby |
class CreateMonsters < ActiveRecord::Migration
def self.up
create_table :monsters do |t|
t.string :name
t.integer :attack
t.integer :defense
t.integer :magic
t.integer :gold
t.integer :max_hp
t.integer :cur_hp
t.timestamps
end
# Add the maximum hitpoints a... | Ruby |
class AddGoldToUser < ActiveRecord::Migration
def self.up
add_column :users, :gold, :integer, :default => 0
# Any existing users will get the new stat just like new users. If we had
# to do any special setup for the value though, we could do it here.
end
def self.down
remove_column :users, ... | Ruby |
class AddBankgcToUser < ActiveRecord::Migration
def self.up
add_column :users, :bankgc, :integer, :default => 0
end
def self.down
remove_column :users, :bankgc
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 |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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 Fast... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat... | Ruby |
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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 Fast... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.