I am quite new to ruby. I have coded in Java earlier and the code to
fire a query in ruby is a lot different and I am struggling.
I have this model
create_table “used_cars”, :force => true do |t|
I need to generate an ad for the cheapest car…I know what query to
fire, but dont know what ruby syntax to use…I want to order it by
price…and then use different fields to print the ad.
I tried few things like
car_price = UsedCar.find_by_sql"SELECT price FROM used_cars"
car_price = UsedCar.find_by_price(true,true)
Also it will be really great if anybody can direct me to right study
material. I am reading agile web dev with rails and ruby cookbook. But
need to work hard on DB syntax.
Can anybody please help!
Thanks in advance