Change Newsletter's segment_recipient to string
Why: Newsletter attribute `segment_recipient` is an integer to be used as enum. There's no advantage to store a number instead of an string if the ammount of elements in the table is not going to be huge, or we can take advantage of using an enum. Also maintaining both Newsletters enum paired with UserSegments::SEGMENTS would be a maintenance burden. How: * Migration to change segment_recipient column from integer to string * Removing enumeration from Newsletter model class * Using UserSegments::SEGMENTS instead of Newsletter.segment_recipients or integer values
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
class Newsletter < ActiveRecord::Base
|
||||
enum segment_recipient: { all_users: 1,
|
||||
proposal_authors: 2,
|
||||
investment_authors: 3,
|
||||
feasible_and_undecided_investment_authors: 4,
|
||||
selected_investment_authors: 5,
|
||||
winner_investment_authors: 6 }
|
||||
|
||||
validates :subject, presence: true
|
||||
validates :segment_recipient, presence: true
|
||||
|
||||
Reference in New Issue
Block a user