Class: ContactUs::Contact

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
app/models/contact_us/contact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Contact

Returns a new instance of Contact.



13
14
15
16
17
# File 'app/models/contact_us/contact.rb', line 13

def initialize(attributes = {})
  attributes.each do |key, value|
    self.send("#{key}=", value)
  end
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



5
6
7
# File 'app/models/contact_us/contact.rb', line 5

def email
  @email
end

#messageObject

Returns the value of attribute message.



5
6
7
# File 'app/models/contact_us/contact.rb', line 5

def message
  @message
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'app/models/contact_us/contact.rb', line 5

def name
  @name
end

#subjectObject

Returns the value of attribute subject.



5
6
7
# File 'app/models/contact_us/contact.rb', line 5

def subject
  @subject
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/models/contact_us/contact.rb', line 27

def persisted?
  false
end

#saveObject



19
20
21
22
23
24
25
# File 'app/models/contact_us/contact.rb', line 19

def save
  if self.valid?
    ContactUs::ContactMailer.contact_email(self).deliver_now
    return true
  end
  return false
end