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

Reorder to make the load method available #269

Merged
merged 4 commits into from
Jan 15, 2017
Merged

Reorder to make the load method available #269

merged 4 commits into from
Jan 15, 2017

Conversation

mhenrixon
Copy link
Contributor

@mhenrixon mhenrixon commented Oct 31, 2016

We are getting the following error when trying to use require "dotenv/rails-now"

/Users/mikaelhenriksson/.rvm/gems/ruby-2.1.8/gems/activesupport-3.2.22.6/lib/active_support/dependencies.rb:243:in load': wrong number of arguments (0 for 1..2) (ArgumentError) from /Users/mikaelhenriksson/.rvm/gems/ruby-2.1.8/gems/dotenv-rails-2.0.1/lib/dotenv/rails.rb:20:in block in class:Railtie'

Reordering the file so that the methods are defined before using them fixes this problem. Our codebase is from 2005 so I am sure it could be fixed in other ways but this is verified to fix our problem.

Note 1: The errors on CI doesn't seem to be related to my changes.
Note 2: This works for us on a rails 3.2 project

We are getting the following error when trying to use `require "dotenv/rails-now"`

> /Users/mikaelhenriksson/.rvm/gems/ruby-2.1.8/gems/activesupport-3.2.22.6/lib/active_support/dependencies.rb:243:in `load': wrong number of arguments (0 for 1..2) (ArgumentError)
>	from /Users/mikaelhenriksson/.rvm/gems/ruby-2.1.8/gems/dotenv-rails-2.0.1/lib/dotenv/rails.rb:20:in `block in <class:Railtie>'

Reordering the file so that the methods are defined before using them fixes this problem. Our codebase is from 2005 so I am sure it could be fixed in other ways but this is verified to fix our problem.
@mikeantonelli
Copy link

+1 this resolved an issue for me as well.

@@ -43,5 +41,7 @@ def root
def self.load
instance.load
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuboCop has been failed below.

lib/dotenv/rails.rb:44:1: C: Trailing whitespace detected.

I think that this warning will disappear with following diff.

+    
-

cf. https://travis-ci.org/bkeepers/dotenv/jobs/172001102

Thanks.

* origin/master:
  Nokogiri 1.7 requires Ruby version >= 2.1.0
  Travis 'Ruby rbx-2' failing on master
  Use the latest rubies on Travis
  Rack 2 requires Ruby version >= 2.2.2
  CI against Ruby 2.4.0
@bkeepers bkeepers merged commit fe54f3e into bkeepers:master Jan 15, 2017
@bkeepers
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants