Is your Rails app the only access point to this data? If it is, then going
solely with the model validations would work. If there is the slightest
chance that another application will access the data directly, then you
should apply contraints to the database as well.
Model validation, IIRC, support the great feedback you can give to users who
enter data through a form.
Both would be my vote, though I would tend toward business rule validations
and contraints being located in the model class.
Ken
On 10/13/05, Mike <mbarsalou-gwwlNbBYuTWB+jHODAdFcQ@public.gmane.org>
wrote:>
> I asked on IRC and wanted to run this by the folks that lurk here...
>
> Are there long term downsides to only using Model validation? I could
> also put field restrictions in the db schema.
>
> Is there a best practice?
>
> I am using ruby/rails to do a file import and thought that using model
> validation would be a great way to weed out bad import data.
>
> However, when using TDD, my fixtures wouldn''t load if they had
data
> that didn''t agree with the db schema.
>
> I''m not set either way...just wondering what folks think.
>
> Thanks.
>
> Mike B.
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails