I am new to ruby on rails. I am trying to retrieve data from my database and make operation in my rails application. I am stuck while trying to use find_by_sql in my class Activity < ActiveRecord::Base
I have a rates table with structure as
id | Instrument Name | Category | Time_of_usage | Rates
1 | Instrument1 | Internal | Regular | 25
2 | Instrument2 | Internal | Weekends | 15
Here is my sample code of what I am trying to achieve
sql2='SELECT Rates FROM New_billcodes_mock WHERE Category_name=?, Instrument_name=? and Time_zone_name=?'
result2= find_by_sql[sql2,'Internal','Instrument1',time_zone_name]
database_billrate_value_normal=result2['Rates']
and use the database_billrate_value_normal variable to make my operations.
Please guide me in the correct path if I am wrong.