Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix uninitialized instance variable warning #570

Merged
merged 1 commit into from

4 participants

@f3nry

Ruby warns that @only and @except are not initialized because if they are not passed in, they are never assigned.

@indirect
Collaborator

I helped with this, :+1:

@steveklabnik

Thanks! Can you rebase / squash this, please?

@tbuehlmann

@letuboy ping!

@f3nry f3nry fix uninitialized instance variable warning
Ruby warns that `@only` and `@except` are not initialized because if they are not passed in, they are never assigned.

Remove circular require in array_serializer
7626386
@f3nry

Rebased and squashed! :+1:

@steveklabnik steveklabnik merged commit b9d216d into rails-api:master
@steveklabnik
Owner

Thank you so much!

@tbuehlmann

Thank you! \o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 2, 2014
  1. @f3nry

    fix uninitialized instance variable warning

    f3nry authored Paul Henry committed
    Ruby warns that `@only` and `@except` are not initialized because if they are not passed in, they are never assigned.
    
    Remove circular require in array_serializer
This page is out of date. Refresh to see the latest.
View
1  lib/active_model/array_serializer.rb
@@ -1,6 +1,5 @@
require 'active_model/default_serializer'
require 'active_model/serializable'
-require 'active_model/serializer'
module ActiveModel
class ArraySerializer
View
4 lib/active_model/serializer.rb
@@ -113,8 +113,8 @@ def initialize(object, options={})
@meta_key = options[:meta_key] || :meta
@meta = options[@meta_key]
@wrap_in_array = options[:_wrap_in_array]
- @only = Array(options[:only]) if options[:only]
- @except = Array(options[:except]) if options[:except]
+ @only = options[:only] ? Array(options[:only]) : nil
+ @except = options[:except] ? Array(options[:except]) : nil
@key_format = options[:key_format]
end
attr_accessor :object, :scope, :root, :meta_key, :meta, :key_format
View
1  lib/active_model/serializer/associations.rb
@@ -1,5 +1,4 @@
require 'active_model/default_serializer'
-require 'active_model/serializer'
module ActiveModel
class Serializer
Something went wrong with that request. Please try again.