title: Passing parameters to raw SQL queries inside ruby on rails
body: <p>I want to execute a raw SQL query using rails active record, but my query takes a parameter, I can't find a proper way to safely pass that parameter into the query string. The query is as follows </p>
  
  <pre><code>def self.get_branches_by_workspace_name(workspace_name)
    branches = ActiveRecord::Base.connection.execute("
      select
        address,
        phone,
        email,
        services
      from branches as b, workspaces as w
      where b.workspace_id = w.id and w.name= :workspace_name", workspace_name).to_a
    return branches
  end
  </code></pre>
  
  <p>I would like to pass a parameter named "workspace_name". Any help? </p>