Coder Social home page Coder Social logo

enum_accessor's People

Contributors

kenn avatar lest avatar maicolben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

enum_accessor's Issues

Allow nil?

  • sorry: eyes wide shut *

I like this little gem.
I tried to use it but I would like to allow a null value (with means it hasn't yet or shouldn't been set). The problem is that enum_accessor triggers an 'is not included in the list' validation error.
Solved my problem by using the option: validation_options: {allow_nil: true}
which IS documented...

Negative Scope

User.where.not(approval_status: :approved)

Makes the following SQL (the problem is :approved is changed to NULL)

User Load (0.4ms) SELECTusers.* FROMusersWHERE (users.approval_status!= NULL)

Doesn't play well with choices containing leading digits?

Given

class ShipmentCharge < Charge #STI
   enum_accessor :container_type, ['20GP','20HC','40GP','40HC','9BOX','4BOX', 'LCL', 'OTHER']
end

I get the following problem with this:
Symbols vs string vs leading digits

c.container_type= '20GP'
c.container_type # => :"20GP" Beurk!

Maybe an option not to use symbols would be great.

Can we query to get raw value of enum ?

Hi there,
Has any solution to get raw value of enums instead string value when query collection of active record objects ? I know we can get raw value by _raw each object but how to get this raw value when select ?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.