Permalink
Browse files

Fixed validation error with Moderatorship model.

  • Loading branch information...
1 parent a922181 commit ce0fa8c69cc36501416949608cb88227139eb3db @nbibler nbibler committed Apr 25, 2008
Showing with 2 additions and 2 deletions.
  1. +1 −1 app/models/moderatorship.rb
  2. +1 −1 spec/models/moderatorship_spec.rb
@@ -13,7 +13,7 @@ def uniqueness_of_relationship
end
def user_and_forum_in_same_site
- unless user.site_id == forum.site_id
+ if user && forum && user.site_id != forum.site_id
errors.add_to_base("User and Forum must be in the same Site.")
end
end
@@ -25,7 +25,7 @@
%w(user_id forum_id).each do |attr|
it "requires #{attr}" do
- mod = new_moderatorship(:default)
+ mod = Moderatorship.new
mod.send("#{attr}=", nil)
mod.should_not be_valid
mod.errors.on(attr).should_not be_nil

0 comments on commit ce0fa8c

Please sign in to comment.