I'm Using Rails 3.2 and i wish to know a " rails way " to create an object based on parameters coming from another. I have the class StoredItem and the class RequestedItem, they are not related, but during the process to attend the requested item i wish to list all itens and qty stored from a requested part number. I thought something like
@requested_items = RequestedItem.includes(:item_description).where("item_request_id = ?", params[:id])
@stored_items = StoredItem.where("item_description_id = ?",@requested_items.item_description_id)
Obviously this seems don't work because i have a lot of descriptions id to compare, not only one, so, whats the best and correct way to make it work?
Any help will be appreciated, thank you :)