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

Fix sharing options between models #17

Merged
merged 1 commit into from
Apr 27, 2017

Conversation

iNecas
Copy link
Contributor

@iNecas iNecas commented Apr 27, 2017

@@class_variables are one of the worst ideas ever in Ruby and
they should burn in hell. Please don't use it ever again in any
software, unless you intend to make others' life miserable :)

Explanation: compare

module A
  def hello
    @@hello
  end

  def set_hello
    @@hello = self.name
  end
end

class B
  extend A
end

class C
  extend A
end

B.set_hello
C.set_hello
puts B.hello
puts C.hello

with

module A1
  def hello
    @hello
  end

  def set_hello
    @hello = self.name
  end
end

class B1
  extend A1
end

class C1
  extend A1
end

B1.set_hello
C1.set_hello
puts B1.hello
puts C1.hello

@@class_variables are one of the worst ideas ever in Ruby and
they should burn in hell. Please don't use it ever again in any
software, unless you intend to make others' life miserable :)
@rubiety
Copy link
Owner

rubiety commented Apr 27, 2017

Yep, looks like this was introduced in contributing pull request #12 and I didn't catch it. Thanks for the fix.

@rubiety rubiety merged commit a11215f into rubiety:master Apr 27, 2017
@iNecas
Copy link
Contributor Author

iNecas commented Apr 27, 2017

Thanks for quick merge: if a new release could follow, that would be appreciated :)

@rubiety
Copy link
Owner

rubiety commented Apr 27, 2017

Just cut a release for v0.5.1 - enjoy!

@iNecas
Copy link
Contributor Author

iNecas commented Apr 28, 2017

@rubiety++

@iNecas
Copy link
Contributor Author

iNecas commented Apr 28, 2017

Seems there is still some issue with STIs, that can lead to undefined method []' for nil:NilClass
/usr/local/rvm/gems/ruby-2.1.5@test_plugin_pull_request-1/gems/validates_lengths_from_database-0.5.1/lib/validates_lengths_from_database.rb:37:in validate_lengths_from_database', working on fixing it now

@iNecas
Copy link
Contributor Author

iNecas commented Apr 28, 2017

The additional issue should be handled in #18

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.

None yet

2 participants