Skip to content

Dynamically-Generating Predicates Methods bug #62

@aklein-dex

Description

@aklein-dex

I think there is a bug with theses predicated methods. Kind of confusion.

In my model:

  enum_attr :gender, %w(^none male female) do
    label :none => ''
    label :male => '男性'
    label :female => '女性'
  end

I set my model gender to :male.
Look at the result in the console:

1.9.3-p0 :018 > s.gender
 => :male 
1.9.3-p0 :019 > s.gender_male?
 => true 
1.9.3-p0 :020 > s.gender_female?
 => true 
1.9.3-p0 :021 > s.gender_none?
 => false 

Why does it return "true" for female ?
Is it because in "female" there is the word "male" so it is confused ?

I'm using:
Using enumerated_attribute (0.3.0.beta1) from https://github.com/jeffp/enumerated_attribute.git (at master)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions