Comments (1)
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)
- How to update many records at once? HOT 2
- Eager loading with inludes() returns String, not Enum HOT 6
- Wierd failure when using with jruby HOT 6
- Enum by default are empty in DB? HOT 4
- Drop support for Ruby 1.8.7 HOT 1
- Drop support for Rails 3.x HOT 1
- Clean up specs
- Clean up how code is injected into Active Record HOT 1
- Remove Arel hacks for Active Record scopes HOT 1
- Problem with default value HOT 7
- Update the readme to include a step about autoload_paths HOT 6
- Uninitialized Constant when Loading Classy Enum in 4.0.0 HOT 3
- Undocumented breaking change (Cannot visit <Enum>) HOT 3
- Question: Using classy enum to query with AR? HOT 6
- Classy_enum with actual enum fields? HOT 1
- Enum inside other Enum HOT 5
- Add support for validation :on and :if options HOT 5
- Rails 5.x update HOT 2
- ClassyEnum build method performance
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classy_enum.