Permalink
Browse files

small fix for Mongoid

  • Loading branch information...
1 parent 3fd5f6f commit 31db6dfb2c801d2dd643f18f4b994b200f5ec336 @bbenezech bbenezech committed Apr 13, 2012
@@ -10,7 +10,9 @@ def authorized?(*args)
end
def current_action?(action, abstract_model = @abstract_model, object = @object)
- @action.custom_key == action.custom_key && abstract_model.try(:to_param) == @abstract_model.try(:to_param) && @object.try(:id) == object.try(:id)
+ @action.custom_key == action.custom_key &&
+ abstract_model.try(:to_param) == @abstract_model.try(:to_param) &&
+ (@object.try(:persisted?) ? @object.id == object.try(:id) : !object.try(:persisted?))
end
def action(key, abstract_model = nil, object = nil)
@@ -1,2 +0,0 @@
-module ApplicationHelper
-end
@@ -7,6 +7,6 @@ class NestedFieldTest
include Mongoid::Timestamps
- has_one :comment, :as => :commentable
+ has_one :comment, :as => :commentable, :autosave => true
accepts_nested_attributes_for :comment, :allow_destroy => true, :reject_if => proc { |attributes| attributes["content"].blank? }
end

0 comments on commit 31db6df

Please sign in to comment.