Fixes #312
This commit is contained in:
parent
cff856688f
commit
2e5947a243
3 changed files with 53 additions and 51 deletions
6
Gemfile
6
Gemfile
|
@ -1,6 +1,6 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'rails', '3.2.11'
|
gem 'rails', '3.2.17'
|
||||||
|
|
||||||
# Bundle edge Rails instead:
|
# Bundle edge Rails instead:
|
||||||
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
||||||
|
@ -14,8 +14,8 @@ gem 'formtastic'
|
||||||
gem 'json'
|
gem 'json'
|
||||||
gem 'rails3-jquery-autocomplete'
|
gem 'rails3-jquery-autocomplete'
|
||||||
gem 'best_in_place'
|
gem 'best_in_place'
|
||||||
gem 'therubyracer' #optional
|
#gem 'therubyracer' #optional
|
||||||
gem 'rb-readline'
|
#gem 'rb-readline'
|
||||||
|
|
||||||
# Gems used only for assets and not required
|
# Gems used only for assets and not required
|
||||||
# in production environments by default.
|
# in production environments by default.
|
||||||
|
|
90
Gemfile.lock
90
Gemfile.lock
|
@ -1,34 +1,35 @@
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.11)
|
actionmailer (3.2.17)
|
||||||
actionpack (= 3.2.11)
|
actionpack (= 3.2.17)
|
||||||
mail (~> 2.4.4)
|
mail (~> 2.5.4)
|
||||||
actionpack (3.2.11)
|
actionpack (3.2.17)
|
||||||
activemodel (= 3.2.11)
|
activemodel (= 3.2.17)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.17)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.4)
|
journey (~> 1.0.4)
|
||||||
rack (~> 1.4.0)
|
rack (~> 1.4.5)
|
||||||
rack-cache (~> 1.2)
|
rack-cache (~> 1.2)
|
||||||
rack-test (~> 0.6.1)
|
rack-test (~> 0.6.1)
|
||||||
sprockets (~> 2.2.1)
|
sprockets (~> 2.2.1)
|
||||||
activemodel (3.2.11)
|
activemodel (3.2.17)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.17)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
activerecord (3.2.11)
|
activerecord (3.2.17)
|
||||||
activemodel (= 3.2.11)
|
activemodel (= 3.2.17)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.17)
|
||||||
arel (~> 3.0.2)
|
arel (~> 3.0.2)
|
||||||
tzinfo (~> 0.3.29)
|
tzinfo (~> 0.3.29)
|
||||||
activeresource (3.2.11)
|
activeresource (3.2.17)
|
||||||
activemodel (= 3.2.11)
|
activemodel (= 3.2.17)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.17)
|
||||||
activesupport (3.2.11)
|
activesupport (3.2.17)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6, >= 0.6.4)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
arel (3.0.2)
|
arel (3.0.3)
|
||||||
|
bcrypt-ruby (3.0.1)
|
||||||
bcrypt-ruby (3.0.1-x86-mingw32)
|
bcrypt-ruby (3.0.1-x86-mingw32)
|
||||||
best_in_place (2.0.2)
|
best_in_place (2.0.2)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
@ -54,51 +55,50 @@ GEM
|
||||||
rails (~> 3.0)
|
rails (~> 3.0)
|
||||||
formula (0.3.3)
|
formula (0.3.3)
|
||||||
rails (> 3.0.0)
|
rails (> 3.0.0)
|
||||||
hike (1.2.1)
|
hike (1.2.3)
|
||||||
i18n (0.6.1)
|
i18n (0.6.9)
|
||||||
jbuilder (0.8.2)
|
jbuilder (0.8.2)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
journey (1.0.4)
|
journey (1.0.4)
|
||||||
jquery-rails (2.1.2)
|
jquery-rails (2.1.2)
|
||||||
railties (>= 3.1.0, < 5.0)
|
railties (>= 3.1.0, < 5.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
json (1.7.6)
|
json (1.8.1)
|
||||||
mail (2.4.4)
|
mail (2.5.4)
|
||||||
i18n (>= 0.4.0)
|
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mime-types (1.19)
|
mime-types (1.25.1)
|
||||||
multi_json (1.5.0)
|
multi_json (1.9.3)
|
||||||
orm_adapter (0.4.0)
|
orm_adapter (0.4.0)
|
||||||
pg (0.12.2)
|
pg (0.12.2)
|
||||||
pg (0.12.2-x86-mingw32)
|
pg (0.12.2-x86-mingw32)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.4)
|
||||||
rack (1.4.3)
|
rack (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-ssl (1.3.2)
|
rack-ssl (1.3.4)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.11)
|
rails (3.2.17)
|
||||||
actionmailer (= 3.2.11)
|
actionmailer (= 3.2.17)
|
||||||
actionpack (= 3.2.11)
|
actionpack (= 3.2.17)
|
||||||
activerecord (= 3.2.11)
|
activerecord (= 3.2.17)
|
||||||
activeresource (= 3.2.11)
|
activeresource (= 3.2.17)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.17)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.11)
|
railties (= 3.2.17)
|
||||||
rails3-jquery-autocomplete (1.0.10)
|
rails3-jquery-autocomplete (1.0.10)
|
||||||
rails (~> 3.0)
|
rails (~> 3.0)
|
||||||
railties (3.2.11)
|
railties (3.2.17)
|
||||||
actionpack (= 3.2.11)
|
actionpack (= 3.2.17)
|
||||||
activesupport (= 3.2.11)
|
activesupport (= 3.2.17)
|
||||||
rack-ssl (~> 1.3.2)
|
rack-ssl (~> 1.3.2)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (>= 0.14.6, < 2.0)
|
||||||
rake (10.0.3)
|
rake (10.3.1)
|
||||||
rdoc (3.12)
|
rdoc (3.12.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
redis (2.2.2)
|
redis (2.2.2)
|
||||||
sass (3.2.7)
|
sass (3.2.7)
|
||||||
|
@ -111,12 +111,12 @@ GEM
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
thor (0.16.0)
|
thor (0.19.1)
|
||||||
tilt (1.3.3)
|
tilt (1.4.1)
|
||||||
treetop (1.4.12)
|
treetop (1.4.15)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.35)
|
tzinfo (0.3.39)
|
||||||
uglifier (1.3.0)
|
uglifier (1.3.0)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (~> 1.0, >= 1.0.2)
|
multi_json (~> 1.0, >= 1.0.2)
|
||||||
|
@ -138,7 +138,7 @@ DEPENDENCIES
|
||||||
jquery-rails (= 2.1.2)
|
jquery-rails (= 2.1.2)
|
||||||
json
|
json
|
||||||
pg
|
pg
|
||||||
rails (= 3.2.11)
|
rails (= 3.2.17)
|
||||||
rails3-jquery-autocomplete
|
rails3-jquery-autocomplete
|
||||||
redis
|
redis
|
||||||
sass-rails
|
sass-rails
|
||||||
|
|
|
@ -17,11 +17,13 @@ has_many :mappings
|
||||||
|
|
||||||
validates_uniqueness_of :name # done by devise
|
validates_uniqueness_of :name # done by devise
|
||||||
validates_uniqueness_of :email # done by devise
|
validates_uniqueness_of :email # done by devise
|
||||||
if Object.const_defined?('User')
|
|
||||||
codes = User.all.map(&:code)
|
if ActiveRecord::Base.connection.table_exists? 'users'
|
||||||
else
|
codes = ActiveRecord::Base.connection.execute("SELECT code FROM users").map {|user| user["code"] }
|
||||||
|
else
|
||||||
codes = []
|
codes = []
|
||||||
end
|
end
|
||||||
|
|
||||||
validates :joinedwithcode, :presence => true, :inclusion => { :in => codes, :message => "%{value} is not a valid code" }, :on => :create
|
validates :joinedwithcode, :presence => true, :inclusion => { :in => codes, :message => "%{value} is not a valid code" }, :on => :create
|
||||||
|
|
||||||
def generate_code
|
def generate_code
|
||||||
|
|
Loading…
Reference in a new issue