Skip to content
Permalink
Browse files

applied the rails 3.2 generator

  • Loading branch information...
linki committed Aug 31, 2012
1 parent ff829a4 commit 40cecc66a31fe9273559a9ad7d4e982d6561f1ce
15 Gemfile
@@ -1,6 +1,6 @@
source 'http://rubygems.org'
source 'https://rubygems.org'

gem 'rails', '3.1.8'
gem 'rails', '3.2.8'

gem "coderay", "~> 0.9.7"
gem "rubytree", "~> 0.8.3"
@@ -27,12 +27,8 @@ gem 'loofah'
gem 'htmldiff'

group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'

gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end

@@ -49,9 +45,6 @@ group :test do

gem 'ruby-debug', :platforms => [:mri_18, :mingw_18]
gem 'debugger', :platforms => [:mri_19, :mingw_19]

# remove in rails 3.2
gem 'turn', '~> 0.8.3', :require => false
end

group :openid do
@@ -14,48 +14,46 @@ GIT
paper_trail (~> 2)

GEM
remote: http://rubygems.org/
remote: https://rubygems.org/
specs:
actionmailer (3.1.8)
actionpack (= 3.1.8)
mail (~> 2.3.3)
actionpack (3.1.8)
activemodel (= 3.1.8)
activesupport (= 3.1.8)
actionmailer (3.2.8)
actionpack (= 3.2.8)
mail (~> 2.4.4)
actionpack (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.6)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.4)
activemodel (3.1.8)
activesupport (= 3.1.8)
sprockets (~> 2.1.3)
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.8)
activemodel (= 3.1.8)
activesupport (= 3.1.8)
arel (~> 2.2.3)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.1.8)
activemodel (= 3.1.8)
activesupport (= 3.1.8)
activesupport (3.1.8)
multi_json (>= 1.0, < 1.3)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
ansi (1.4.3)
arel (2.2.3)
arel (3.0.2)
awesome_nested_set (2.1.4)
activerecord (>= 3.0.0)
builder (3.0.0)
builder (3.0.4)
bullet (4.1.6)
uniform_notifier (~> 1.0.0)
coderay (0.9.8)
coffee-rails (3.1.1)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
@@ -85,7 +83,8 @@ GEM
fastercsv (1.5.5)
hike (1.2.1)
htmldiff (0.0.1)
i18n (0.6.0)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.1)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
@@ -98,15 +97,17 @@ GEM
rbx-require-relative (> 0.0.4)
loofah (1.2.1)
nokogiri (>= 1.4.4)
mail (2.3.3)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
method_source (0.6.7)
ruby_parser (>= 2.3.1)
mime-types (1.19)
mocha (0.12.3)
metaclass (~> 0.0.1)
multi_json (1.2.0)
multi_json (1.3.6)
mysql (2.8.1)
mysql2 (0.3.11)
nokogiri (1.5.5)
@@ -117,37 +118,40 @@ GEM
polyglot (0.3.3)
prototype-rails (3.1.0)
rails (~> 3.1)
rack (1.3.6)
pry (0.9.7.4)
coderay (~> 0.9.8)
method_source (~> 0.6.7)
ruby_parser (>= 2.3.1)
slop (~> 2.1.0)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack-test (0.6.2)
rack (>= 1.0)
rails (3.1.8)
actionmailer (= 3.1.8)
actionpack (= 3.1.8)
activerecord (= 3.1.8)
activeresource (= 3.1.8)
activesupport (= 3.1.8)
rails (3.2.8)
actionmailer (= 3.2.8)
actionpack (= 3.2.8)
activerecord (= 3.2.8)
activeresource (= 3.2.8)
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.1.8)
railties (= 3.2.8)
rails-dev-tweaks (0.6.1)
actionpack (~> 3.1)
railties (~> 3.1)
rails-footnotes (3.7.8)
rails (>= 3.0.0)
rails_autolink (1.0.9)
rails (~> 3.1)
railties (3.1.8)
actionpack (= 3.1.8)
activesupport (= 3.1.8)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rbx-require-relative (0.0.9)
rdoc (3.12)
@@ -159,42 +163,43 @@ GEM
ruby-debug-base (0.10.4)
linecache (>= 0.3)
ruby-openid (2.1.8)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubytree (0.8.3)
json (>= 1.7.5)
structured_warnings (>= 0.1.3)
safe_attributes (1.0.8)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
sass (3.2.1)
sass-rails (3.1.6)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3.2)
tilt (~> 1.3)
sexp_processor (3.2.0)
shoulda (3.1.1)
shoulda-context (~> 1.0)
shoulda-matchers (~> 1.2)
shoulda-context (1.0.0)
shoulda-matchers (1.2.0)
activesupport (>= 3.0.0)
sprockets (2.0.4)
slop (2.1.0)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
sqlite3-ruby (1.2.5)
structured_warnings (0.1.3)
thor (0.14.6)
thor (0.16.0)
tilt (1.3.3)
tinymce-rails (3.5.6)
railties (>= 3.1.1)
tinymce-rails-langs (0.1)
tinymce-rails (>= 3.4.9)
treetop (1.4.10)
treetop (1.4.11)
polyglot
polyglot (>= 0.3.1)
turn (0.8.3)
ansi
tzinfo (0.3.33)
uglifier (1.2.4)
execjs (>= 0.3.0)
@@ -211,7 +216,7 @@ DEPENDENCIES
awesome_nested_set
bullet
coderay (~> 0.9.7)
coffee-rails (~> 3.1.1)
coffee-rails (~> 3.2.1)
database_cleaner
debugger
delayed_job_active_record
@@ -230,7 +235,8 @@ DEPENDENCIES
object-daddy!
pg
prototype-rails
rails (= 3.1.8)
pry
rails (= 3.2.8)
rails-dev-tweaks (~> 0.6.1)
rails-footnotes (>= 3.7.5.rc4)
rails_autolink
@@ -240,11 +246,10 @@ DEPENDENCIES
ruby-openid (~> 2.1.4)
rubytree (~> 0.8.3)
safe_attributes
sass-rails (~> 3.1.5)
sass-rails (~> 3.2.3)
shoulda (~> 3.1.1)
sqlite3
sqlite3-ruby (< 1.3)
tinymce-rails
tinymce-rails-langs
turn (~> 0.8.3)
uglifier (>= 1.0.3)
@@ -1,9 +1,15 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery-ui
//= require jquery.menu_expand
@@ -18,6 +18,10 @@
class ApplicationController < ActionController::Base
helper :all

class_attribute :model_object
class_attribute :model_scope
class_attribute :accept_key_auth_actions

protected

include Redmine::I18n
@@ -228,7 +232,7 @@ def find_project_from_association
end

def find_model_object
model = self.class.read_inheritable_attribute('model_object')
model = self.class.model_object
if model
@object = model.find(params[:id])
self.instance_variable_set('@' + controller_name.singularize, @object) if @object
@@ -239,7 +243,7 @@ def find_model_object

def find_model_object_and_project
if params[:id]
model_object = self.class.read_inheritable_attribute('model_object')
model_object = self.class.model_object
instance = model_object.find(params[:id])
@project = instance.project
self.instance_variable_set('@' + model_object.to_s.downcase, instance)
@@ -254,7 +258,7 @@ def find_model_object_and_project
# TODO: this method is right now only suited for controllers of objects that somehow have an association to Project
def find_object_and_scope
model_object = params[:id].present? ?
model_object = self.class.read_inheritable_attribute('model_object').find(params[:id]) :
model_object = self.class.model_object.find(params[:id]) :
nil

associations = self.class.model_scope + [Project]
@@ -289,18 +293,14 @@ def find_belongs_to_chained_objects(associations, start_object = nil)
end

def self.model_object(model, options = {})
write_inheritable_attribute('model_object', model)
self.model_object = model
if options[:scope]
self.model_scope = options[:scope].is_a?(Array) ? options[:scope] : [options[:scope]]
end
end

def self.model_scope
read_inheritable_attribute('model_scope')
end

def self.model_scope=(scope)
write_inheritable_attribute('model_scope', scope)
self.model_scope = scope
end

# Filter for bulk issue operations
@@ -442,11 +442,11 @@ def render_feed(items, options={})

def self.accept_key_auth(*actions)
actions = actions.flatten.map(&:to_s)
write_inheritable_attribute('accept_key_auth_actions', actions)
self.accept_key_auth_actions = actions
end

def accept_key_auth_actions
self.class.read_inheritable_attribute('accept_key_auth_actions') || []
self.class.accept_key_auth_actions || []
end

# Returns the number of objects that should be displayed
@@ -15,10 +15,10 @@
class Watcher < ActiveRecord::Base
belongs_to :watchable, :polymorphic => true
belongs_to :user

#attr_protected :user_id

validates_presence_of :user
attr_accessible :watchable, :user

validates_presence_of :watchable, :user
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]

validate :validate_active_user
@@ -39,7 +39,8 @@ def self.prune(options={})
protected

def validate_active_user
errors.add :user_id, :invalid if user.present? && !user.active?
return if user.blank?
errors.add :user_id, :invalid unless user.active?
end

private

0 comments on commit 40cecc6

Please sign in to comment.
You can’t perform that action at this time.