Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment private accessor warnings #1173

Merged
merged 1 commit into from
Sep 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/active_model_serializers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ module ActiveModelSerializers

module_function

# @note
# ```ruby
# private
#
# attr_reader :resource, :adapter_opts, :serializer_opts
# ```
#
# Will generate a warning, though it shouldn't.
# There's a bug in Ruby for this: https://bugs.ruby-lang.org/issues/10967
#
# We can use +ActiveModelSerializers.silence_warnings+ as a
# 'safety valve' for unfixable or not-worth-fixing warnings,
# and keep our app warning-free.
#
# ```ruby
# private
#
# ActiveModelSerializers.silence_warnings do
# attr_reader :resource, :adapter_opts, :serializer_opts
# end
# ```
def silence_warnings
verbose = $VERBOSE
$VERBOSE = nil
Expand Down