diff --git a/lib/active_scaffold/bridges/cancan/cancan_bridge.rb b/lib/active_scaffold/bridges/cancan/cancan_bridge.rb index 882e6fecfc..145e630e07 100644 --- a/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +++ b/lib/active_scaffold/bridges/cancan/cancan_bridge.rb @@ -129,8 +129,7 @@ def authorized_for_with_cancan?(options = {}) crud_type_result, action_result = false, false end default_result = authorized_for_without_cancan?(options) - result = (crud_type_result && action_result) || default_result - result + (crud_type_result && action_result) || default_result end end end diff --git a/lib/active_scaffold/data_structures/action_columns.rb b/lib/active_scaffold/data_structures/action_columns.rb index 4c25776f61..2e01652e6c 100644 --- a/lib/active_scaffold/data_structures/action_columns.rb +++ b/lib/active_scaffold/data_structures/action_columns.rb @@ -109,15 +109,14 @@ def collect_visible(options = {}, &proc) end def skip_column?(column, options) - result = false # skip if this matches a constrained column - result = true if constraint_columns.include?(column.name.to_sym) + return true if constraint_columns.include?(column.name.to_sym) # skip this field if it's not authorized unless options[:for].authorized_for?(:action => options[:action], :crud_type => options[:crud_type] || action.try(:crud_type) || :read, :column => column.name) unauthorized_columns << column.name.to_sym - result = true + return true end - result + false end # registers a set of column objects (recursively, for all nested ActionColumns)