0

I have a complex SQL statement that crosses several tables. I wish to pass variables into this statement dynamically and return the data in a JSON format. Ihave tested and know the query works in PHPMyAdmin and have placed it within the manSearch method in my requests class. At present, the below query simply remarks: undefined method find_by_SQL. I know from documentation that the fin_by_SQl does exist in my version 4.0.1.

How can I make this work?

def mainSearch

    @results = Campaign.find_by_SQL("CREATE TEMPORARY TABLE ...)

    respond_to do |format|
        format.html
        format.json { render json: @results }
    end     
end
Sauron
  • 6,399
  • 14
  • 71
  • 136

1 Answers1

0

It's find_by_sql not find_by_SQL.

Hesham
  • 2,327
  • 2
  • 20
  • 24