Forum: Ruby on Rails Validation with Ruby on Rails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jonathan C. (Guest)
on 2007-01-06 10:03
Simple subject eh?  Probably a simple answer too!

Here is my code in the app/models/product.rb file.

class Product < ActiveRecord::Base
   validates_presence_of :title, :description, :image_url

However, it doesn't validate the form when I submit it, it will enter
the form as if there is stuff there... Wtf is going on?

I am working with the Agile web dev with rails book, and this is where I
am at currently... except I cant get past that.

Isn't the model layer where everything is passed through?
Mitchell H. (Guest)
on 2007-01-06 10:29
Yes, it should validate it. How do you save your data? Can you post the
code you used. Some methods of saving will bypass validation.
Jonathan C. (Guest)
on 2007-01-06 10:32
lol its very simplistic..

class AdminController < ApplicationController
        scaffold :product

See? :O
This topic is locked and can not be replied to.