Platinum Partner

Enums Emulation In Ruby

Type = [V1 = 'v1', V2 = 'v2']


class EntryForm 
  include ActiveModel::Validation
  Remind = [Periodically = 'periodically', Once = 'once', Never = 'never']
  validate_inclusion_of :remind, :in => Remind
  before_save {
    if @remind == Periodically
     self.schedule_yaml = create_schedule(...).to_yaml
   ...
  }
...
end



_form.html.haml:


   ...
   f.select :remind, EntryForm::Remind
   ...
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}