Files
grecia/app/helpers/user_segments_helper.rb
Bertocq 4becd0eb35 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
2018-02-21 11:46:11 +01:00

8 lines
207 B
Ruby

module UserSegmentsHelper
def user_segments_options
UserSegments::SEGMENTS.collect do |user_segment_name|
[t("admin.segment_recipient.#{user_segment_name}"), user_segment_name]
end
end
end