On Tue, Feb 21, 2012 at 9:48 AM, LED <[email protected]> wrote:

> >> Is there a business rule that each item must realistically have
> >> a quantity and product (and that product must have a price) ?
>
> uhm im following agile web development rails actualy the snippets are
> from the book
>
>
> > * add validations for the presence of these values
> >   (presence of quantity and product on item
> >    presence of price on product)
> i already validated the price
> of each item in CRUD
>
> model/product.rb
>  validates :price, :numericality => {:greater_than_or_equal_to =>
> 0.01}
>
>
For clarity. It is not because a validation is present that the
value is always present in memory (in the database, using the
standard techniques for saving, only valid data should ever be
really saved).

Is the data for the item valid?
* quantity
* product
* product_id

Check out the values of those 3.

HTH,

Peter

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to