Class: Spree::ContactUs::Contact

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Contact

Returns a new instance of Contact.



16
17
18
19
20
# File 'app/models/spree/contact_us/contact.rb', line 16

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

Instance Attribute Details

#emailObject

Returns the value of attribute email.



8
9
10
# File 'app/models/spree/contact_us/contact.rb', line 8

def email
  @email
end

#messageObject

Returns the value of attribute message.



8
9
10
# File 'app/models/spree/contact_us/contact.rb', line 8

def message
  @message
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'app/models/spree/contact_us/contact.rb', line 8

def name
  @name
end

#subjectObject

Returns the value of attribute subject.



8
9
10
# File 'app/models/spree/contact_us/contact.rb', line 8

def subject
  @subject
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/models/spree/contact_us/contact.rb', line 30

def persisted?
  false
end

#saveObject



22
23
24
25
26
27
28
# File 'app/models/spree/contact_us/contact.rb', line 22

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