Define enum classes in Rails and use them to enumerate `ActiveRecord` attributes.
Questions tagged [active-enum]
3 questions
6
votes
1 answer
Changing enum value in Rails without saving model
How do I change an enum value without saving the model to the database yet?
The documentation for ActiveRecord::Enum indicates that methods like conversation.active! and conversation.status = "archived" is equivalent to doing conversation.update!…

Andrew Grimm
- 78,473
- 57
- 200
- 338
2
votes
2 answers
Displaying Status In View - Rails
In my rails application I have a model called JobPosting. A job posting has a status, it can be either:
Waiting Approval
Draft
Open
Interviews Scheduled
Closed
I implemented these statuses using ActiveRecord::Enum like so:
class JobPosting <…

Robert Saunders
- 403
- 8
- 22
2
votes
1 answer
How to use active_enum enumarate in an HTML select element?
I'm using the active_enum gem in my Rails 4 application. https://github.com/adzap/active_enum
gem 'active_enum'
In my model, I have an enumerate:
class Meeting < ActiveRecord::Base
enumerate :participant_type do
value 0 => 'Juniors'
value…

sergserg
- 21,716
- 41
- 129
- 182