Ruby on Rails Thursday, April 24, 2014

I'm a beginner in Rails working through the Hartl tutorial while trying to work on my own project(s) at the same time.

One Project I'm trying to work on is a basic 'assembly' application because it's what I do now full time.

Right now it's a pretty basic app with 3 Models

Ingredient
Bulk
RecipeItem

There is a has_many through relationship between Ingredient and Bulk through RecipeItem

In the recipe_items table there is an additional attribute i'm calling quantity - it must be greater than 0 and less than 1.

The validation question I have is this.

Is there an easy way to set up a validation on a Bulk object that requires its related RecipeItem objects to add up to one...after all the recipeitem objects are added?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f16095c4-da9e-44bd-a094-f9539a99885c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment