I am having trouble in passing ruby array in sql query. I am using ruby version 2 and rails 4.0.2.
i have a array which contains project names which is passed by the view page and i am reading it through params in my function in the controller.
This is my function :
def fetch_projects()
@projects = params[:projects]
#this is my sql query
@query = " select * from project_view where Projects in '#{@projects.map { |s| s }}'"
@results = ActiveRecord::Base.connection.select_all(@query)
end
I am not able to execute the @query.
Thanks in advance
@queryseems wrong.