title: Get Redmine custom field value to a file
body: <p>I'm trying to create a text file that contains the value of a custom field I added on redmine. I tried to get it from an SQL query in the create method of the project_controller.rb (at line 80 on redmine 1.2.0) as follows :</p>
  
  <pre><code>sql = Mysql.new('localhost','root','pass','bitnami_redmine')
  rq = sql.query("SELECT value 
     FROM custom_values 
     INNER JOIN projects
     ON custom_values.customized_id=projects.id
     WHERE custom_values.custom_field_id=7
     AND projects.name='#{@project.name}'")
  rq.each_hash { |h|
    File.open('pleasework.txt', 'w') { |myfile|
      myfile.write(h['value'])
    }
  }
  sql.close
  </code></pre>
  
  <p>This works fine if I test it in a separate file (with an existing project name instead of @project.name) so it may be a syntax issue but I can't find what it is. I'd also be glad to hear any other solution to get that value.</p>
  
  <p>Thanks !</p>
  
  <p>(there's a very similar post <a href="https://stackoverflow.com/questions/3215902/redmine-ruby-looking-for-the-value-of-a-custom-field">here</a> but none of the solutions actually worked)</p>