Doing things the right way, as per ActiveRecord #19

Open
wants to merge 4 commits into
from

Projects

None yet

4 participants

@weshatheleopard

No description provided.

unknown and others added some commits Apr 11, 2013
unknown Copying over a few methods that are defined on AR::AssociationReflect…
…ion.

Absence of these on EnumerationReflection causes ransack_ui to barf.
8d9aa5b
unknown I blame Mark, he told me it shold be false! :-b 82093ff
@hubrix hubrix comment out signing key
it seems broken

Errno::ENOENT: No such file or directory - gem-private_key.pem
An error occurred while installing power_enum (1.3.0), and Bundler cannot continue.
Make sure that `gem install power_enum -v '1.3.0'` succeeds before bundling.
e9075a0
@albertosaurus albertosaurus commented on the diff Apr 12, 2013
power_enum.gemspec
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
s.homepage = "http://github.com/albertosaurus/power_enum"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.25"
- s.signing_key = "gem-private_key.pem"
+ #s.signing_key = "gem-private_key.pem"
@albertosaurus
albertosaurus Apr 12, 2013

Please don't do that.

  1. This gem is signed with my private key when I build it. If you're going to go through the trouble of trying to install it locally, generate a set of signing keys. See this: http://docs.rubygems.org/read/chapter/21
  2. For better or worse, I use jeweler to develop the gem. The gemspec is generated by running rake gemspec. Any changes made to the gemspec get overwritten.
@albertosaurus
albertosaurus Apr 12, 2013

I have updated the README to better explain how setup PowerEnum in high security mode.

@albertosaurus albertosaurus commented on the diff Apr 12, 2013
lib/power_enum/reflection.rb
end
+ alias :source_macro :macro
@albertosaurus
albertosaurus Apr 12, 2013

This line of code breaks four unit tests. The source_macro for PowerEnum is defined as :belongs_to. As mentioned in the RDoc, it's necessary to make joins work.

@albertosaurus albertosaurus commented on the diff Apr 12, 2013
lib/power_enum/reflection.rb
def belongs_to?
- false
+ macro == :belongs_to
@albertosaurus
albertosaurus Apr 12, 2013

Not going to work.

@albertosaurus
albertosaurus Apr 12, 2013

I think you're better off explicitly defining macro. Something like

def macro
  :belongs_to
end

Having said that, I don't know off the top of my head what the second-order implications of that are going to be.

@adymo adymo Add PowerEnum::Reflection::EnumerationReflection::polymorphic?() func…
…tion

that just returns false for power enum reflections.

This is required (at least in Rails4) to do queries like
  where( enum: Enum[value] )
b32dd99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment