grabbing associated value from database

i'm posting a promo code from a form and need to grab the relavant information from the database to apply it properly to the amount be paid so that the discount is applied.

the value posted is params[:promo_code][:code]

how can i grab this from the database

Anyone know the easy way to do this?

Assuming you have a table called promo_codes (and an associated PromoCode model), you could fetch the data with:

   @row = PromoCode.find_by_code(params[:promo_code][:code])

Is that what you're asking?