fix object de-authorize failed.

This commit is contained in:
Matt K. Fu 2013-06-25 18:36:42 +08:00
parent 465d417c35
commit 869f3b6815
3 changed files with 28 additions and 3 deletions

View File

@ -53,7 +53,7 @@ gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
gem 'rb-readline','~> 0.4.2' if RUBY_PLATFORM.downcase.include?("linux") gem 'rb-readline','~> 0.4.2' if RUBY_PLATFORM.downcase.include?("linux")
gem "impressionist", :git => 'git://github.com/charlotte-ruby/impressionist.git' gem "impressionist",'1.2.0'
#gem 'contacts' #gem 'contacts'
#gem 'event-calendar', :require => 'event_calendar'#, :git => 'git://github.com/elevation/event_calendar.git' #gem 'event-calendar', :require => 'event_calendar'#, :git => 'git://github.com/elevation/event_calendar.git'

View File

@ -51,8 +51,9 @@ class PrototypeAuth
end end
def remove_operation(item,obj) def remove_operation(item,obj)
if (self.send item).include? obj item = (item.to_s.singularize == item.to_s) ? "#{item.to_s}_id" : "#{item.to_s.singularize}_ids"
(self.send item).delete obj if (self.send item).include? obj.id
(self.send item).delete obj.id
self.save! self.save!
else else
false #should put error message for user not existed in list false #should put error message for user not existed in list

24
config/mongoid.yml Normal file
View File

@ -0,0 +1,24 @@
defaults: &defaults
host: localhost
# slaves:
# - host: slave1.local
port: 27017
# - host: slave2.local
# port: 27019
development:
<<: *defaults
database: demo_site_development
test:
<<: *defaults
database: test_site
# set these environment variables on your prod server
production:
# host: <%= ENV['MONGOID_HOST'] %>
# port: <%= ENV['MONGOID_PORT'] %>
# username: <%= ENV['MONGOID_USERNAME'] %>
# password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults
database: demo_site_production