This commit is contained in:
Robert Best 2014-05-04 15:12:38 -04:00
parent cff856688f
commit 2e5947a243
3 changed files with 53 additions and 51 deletions

View file

@ -1,6 +1,6 @@
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'rails', '3.2.17'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@ -14,8 +14,8 @@ gem 'formtastic'
gem 'json'
gem 'rails3-jquery-autocomplete'
gem 'best_in_place'
gem 'therubyracer' #optional
gem 'rb-readline'
#gem 'therubyracer' #optional
#gem 'rb-readline'
# Gems used only for assets and not required
# in production environments by default.

View file

@ -1,34 +1,35 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.11)
actionpack (= 3.2.11)
mail (~> 2.4.4)
actionpack (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
actionmailer (3.2.17)
actionpack (= 3.2.17)
mail (~> 2.5.4)
actionpack (3.2.17)
activemodel (= 3.2.17)
activesupport (= 3.2.17)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.11)
activesupport (= 3.2.11)
activemodel (3.2.17)
activesupport (= 3.2.17)
builder (~> 3.0.0)
activerecord (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
activerecord (3.2.17)
activemodel (= 3.2.17)
activesupport (= 3.2.17)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
activesupport (3.2.11)
i18n (~> 0.6)
activeresource (3.2.17)
activemodel (= 3.2.17)
activesupport (= 3.2.17)
activesupport (3.2.17)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.2)
arel (3.0.3)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32)
best_in_place (2.0.2)
jquery-rails
@ -54,51 +55,50 @@ GEM
rails (~> 3.0)
formula (0.3.3)
rails (> 3.0.0)
hike (1.2.1)
i18n (0.6.1)
hike (1.2.3)
i18n (0.6.9)
jbuilder (0.8.2)
activesupport (>= 3.0.0)
journey (1.0.4)
jquery-rails (2.1.2)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.7.6)
mail (2.4.4)
i18n (>= 0.4.0)
json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.5.0)
mime-types (1.25.1)
multi_json (1.9.3)
orm_adapter (0.4.0)
pg (0.12.2)
pg (0.12.2-x86-mingw32)
polyglot (0.3.3)
rack (1.4.3)
polyglot (0.3.4)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack-ssl (1.3.4)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.11)
actionmailer (= 3.2.11)
actionpack (= 3.2.11)
activerecord (= 3.2.11)
activeresource (= 3.2.11)
activesupport (= 3.2.11)
rails (3.2.17)
actionmailer (= 3.2.17)
actionpack (= 3.2.17)
activerecord (= 3.2.17)
activeresource (= 3.2.17)
activesupport (= 3.2.17)
bundler (~> 1.0)
railties (= 3.2.11)
railties (= 3.2.17)
rails3-jquery-autocomplete (1.0.10)
rails (~> 3.0)
railties (3.2.11)
actionpack (= 3.2.11)
activesupport (= 3.2.11)
railties (3.2.17)
actionpack (= 3.2.17)
activesupport (= 3.2.17)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12)
rake (10.3.1)
rdoc (3.12.2)
json (~> 1.4)
redis (2.2.2)
sass (3.2.7)
@ -111,12 +111,12 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
thor (0.19.1)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
tzinfo (0.3.39)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
@ -138,7 +138,7 @@ DEPENDENCIES
jquery-rails (= 2.1.2)
json
pg
rails (= 3.2.11)
rails (= 3.2.17)
rails3-jquery-autocomplete
redis
sass-rails

View file

@ -17,11 +17,13 @@ has_many :mappings
validates_uniqueness_of :name # done by devise
validates_uniqueness_of :email # done by devise
if Object.const_defined?('User')
codes = User.all.map(&:code)
else
if ActiveRecord::Base.connection.table_exists? 'users'
codes = ActiveRecord::Base.connection.execute("SELECT code FROM users").map {|user| user["code"] }
else
codes = []
end
validates :joinedwithcode, :presence => true, :inclusion => { :in => codes, :message => "%{value} is not a valid code" }, :on => :create
def generate_code