Created
September 21, 2015 23:16
-
-
Save hegeltrigo/b986ed25a71f1d1e255c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Message | |
include ActiveModel::Validations | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
attr_accessor :name, :surname, :email, :phone, :country, :body, :subject | |
validates :name, :surname, :email, :phone, :country, :body, :presence => true | |
def initialize(attributes = {}) | |
attributes.each do |name, value| | |
send("#{name}=", value) | |
end | |
end | |
def persisted? | |
false | |
end | |
def country_name | |
if self.country | |
@country = Carmen::Country.coded(self.country) | |
@country.name | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment