Created
August 14, 2011 15:23
-
-
Save Hakon/1144978 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this one does NOT work | |
params[:wine] = {:bulk_price_per_dozen => 50} | |
@wine = Wine.new(params[:wine]) | |
# this one ALSO does NOT work | |
@wine = current_seller.wines.build(params[:wine]) | |
# this one does work | |
@wine = current_seller.wines.build | |
@wine.attributes = params[:wine] | |
Class Wine < ActiveRecord::Base | |
belongs_to :seller | |
before_validation :do_something_with_seller | |
def do_something_with_seller | |
# Here you have seller available | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment