Sha256: 19c22d19bd04a1e574a02d1a802dac89ee9725b5b18425ae0c2ace37cdad749e
Contents?: true
Size: 1.38 KB
Versions: 5
Compression:
Stored size: 1.38 KB
Contents
module MessageTrain # Extended when message_train mixin is run module ClassMethods def message_train_address_book(for_participant) method = MessageTrain.configuration.address_book_methods[ message_train_table_sym ] method ||= MessageTrain.configuration.address_book_method if method.present? && respond_to?(method) send(method, for_participant) else all end end def find_by_message_train_slug(slug) find_by(slug_column => slug.strip) end def where_slug_starts_with(string) return where(nil) unless string.present? pattern = Regexp.union('\\', '%', '_') string = string.gsub(pattern) { |x| ['\\', x].join } where("#{slug_column} LIKE ?", "#{string}%") end def slug_column MessageTrain.configuration.slug_columns[message_train_table_sym] || :slug end def name_column MessageTrain.configuration.name_columns[message_train_table_sym] || :name end def valid_senders_method MessageTrain.configuration .valid_senders_methods[message_train_table_sym] || :self_collection end def valid_recipients_method MessageTrain.configuration .valid_recipients_methods[message_train_table_sym] || :self_collection end def collective? valid_senders_method != :self_collection end end end
Version data entries
5 entries across 5 versions & 1 rubygems