Class: Droom::MailingListMembership

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/droom/mailing_list_membership.rb

Instance Method Summary collapse

Instance Method Details

#colObject

Translation

Mailman’s boolean columns are held as Y/N so we intervene to translate.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'app/models/droom/mailing_list_membership.rb', line 96

[:digest, :not_metoo, :nomail, :plain, :ack].each do |col|
  define_method(col) do
    read_attribute(col) == 'Y'
  end
  define_method("#{col}?") do
    read_attribute(col) == 'Y'
  end
  define_method("#{col}=") do |value|
    write_attribute(col, to_yesno(value))
  end
  define_method("#{col}_before_type_cast") do
    read_attribute(col) == 'Y' ? 1 : 0
  end
end

#membershipObject

Associations

Giving membership of a group will create a mailing list membership automatically. The activity status of the created mlm depends on the ‘Droom.mailing_lists_active_by_default` setting, and its effect depends of course on your mailman setup.



87
# File 'app/models/droom/mailing_list_membership.rb', line 87

belongs_to :membership