Giter VIP home page Giter VIP logo

Comments (1)

beerlington avatar beerlington commented on August 28, 2024

Hi @fotanus great questions! I may write a longer blog post about this, but I'll give you the short answers for now.

What are the advantages of keep using classy_enum after rails 4.1 introduced enums?

Rails 4.1 enums and ClassyEnum solve similar problems, but ClassyEnum goes way beyond what you can do with just Rails by providing OOP concepts on top (inheritance & polymorphism). The README does link to a great summary on the wiki comparing the differences between various enum implementations. Rails 4.1 enums fall into the first "Class-less enums" category that I describe.

How easy would be to migrate?

Rails 4.1 enums store the values in the database as integers, whereas ClassyEnum stores them as strings representing the enums. A migration would consist of changing the strings to integers and then swapping out classy_enum_attr with the new enum syntax. Note that you will be losing any functionality defined in your ClassyEnum classes.

Should we stop using class enum if working with rails 4.1+? Why not?

This is a matter of preference. If you're using ClassyEnum where a class-less enum would suffice, then you're welcome to migrate. However, if you're taking advantage of the OOP concepts, then there's no reason to stop using it. I use ClassyEnum in many of my own projects, as well as client projects, and plan on supporting Rails (Active Record) as long as I can. I'm currently working on an app that has an Ember.js front-end and Rails backend, and started brainstorming some ways to have better integration between the two platforms.

from classy_enum.

Related Issues (20)

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.