KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm building a simple app and want to be able to store json strings in a db. I have a table Interface with a column json, and I want my rails model to validate the value of the string. So something like: class Interface < ActiveRecord::Base attr_accessible :name, :json validates :name, :presence => true, :length => { :minimum => 3, :maximum => 40 }, :uniqueness => true validates :json, :presence => true, :type => json #SOMETHING LIKE THIS :contains => json #OR THIS end How do I do that?
Tags (comma-separated)
Save Edits
Cancel