I have what I think is a non standard model strcture (i know that it is bad, but its neccessary). Given the following migration :
create_table :MODELS, :primary_key => :MOD_ID do |t| t.integer :MOD_ID t.integer :MOD_MFA_ID t.integer :MOD_CDS_ID t.integer :MOD_PCON_START t.integer :MOD_PCON_END t.integer :MOD_PC t.integer :MOD_CV t.integer :MOD_AXL t.binary :MOD_PC_CTM t.binary :MOD_CV_CTM t.timestamps
The MOD_MFA_ID corresponds to an association to another table/model (manufacturers). I would like to retrieve models based on the manufacturer's brand column.
def getmanufacturer
@manufacturer = Manufacturers.find(params[:manufacturer])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @manufacturer }
end
end
I can't figure out how to modify my controller and routing to handle this use case. I'd like to query the app using this kind or URL : /models?manufacturer=audi&&model=a6