lib/avo/fields/has_base_field.rb in avo-2.11.1.pre.2 vs lib/avo/fields/has_base_field.rb in avo-2.11.1.pre.3
- old
+ new
@@ -76,8 +76,19 @@
def component_for_view(view = :index)
view = :show if view.in? [:new, :create, :update, :edit]
super view
end
+
+ def authorized?
+ method = "view_#{id}?".to_sym
+ service = resource.authorization
+
+ if service.has_method? method
+ service.authorize_action(method, raise_exception: false)
+ else
+ true
+ end
+ end
end
end
end