I'm making an application in Ruby, but I create records from text files,
which contain basic information to create a record. Then I modify the
records from the website, but now validating all fields.
What I do is validate some fields when the record is created from the
text file, and then validate the other fields which are filled from the
website.
Here's an example:
# My Table
Table name: Person
Fields: id, name, address, telephone, mail
The text file only contains the id and name. From the website, add the
other fields, but I also want to validate.
So I have the model:
class Person <ActiveRecord:: Base
validates_presence_of: id
validates_presence_of name
end
How can I make previous validation from the model?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment