<% field_names = with_fields_helper(all_attributes) field_names = field_names.select {|f| can_view?(this, f)} unless force_all field_names.each do |field| %><% if field == "this" %><% else %><% end %><% end -%> <%= field_names = with_fields_helper(all_attributes) scope.new_scope :field_name => nil, :field_path => nil do field_names.map do |n| scope.field_name = n == "this" ? (this.member_class.try.name || 'this') : n.to_s.gsub("." , "_") scope.field_path = n parameters.default end.safe_join end %>