lib/destroyed_at/mapper.rb in destroyed_at-0.3.0 vs lib/destroyed_at/mapper.rb in destroyed_at-0.3.1
- old
+ new
@@ -12,10 +12,12 @@
ActionDispatch::Routing::Mapper.send(:prepend, DestroyedAt::Routes)
module DestroyedAt::Resource
def default_actions
actions = super
- if self.name.camelcase.singularize.constantize.included_modules.include?(DestroyedAt)
+ class_name = self.name.camelcase.singularize
+
+ if Module.const_defined?(class_name) && class_name.constantize.included_modules.include?(DestroyedAt)
actions << :restore
end
actions
end