diff --git a/app/models/contact.rb b/app/models/contact.rb index 6e4c04b..20f762f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -11,11 +11,10 @@ class Contact attributes.each do |key, value| self.send("#{key}=", value) end - @attributes = attributes end def read_attribute_for_validation(key) - @attributes[key] + self.send(key) end def save diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index fc5c2c6..0800ade 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -6,4 +6,5 @@ describe Contact do it { should validate_presence_of(:message) } it { should allow_value("test@test.com").for(:email) } + it { should_not allow_value("test@test").for(:email) } end