apsmir / custom_field_sql

redmine sql custom field
14 stars 8 forks source link

Error if I try to use a variable in a request #8

Open serberman opened 2 years ago

serberman commented 2 years ago

I get an error if I try to use a variable in a request.

@id=%id%
select subject from issues where id=@id
ActionView::Template::Error (Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@id=1331
select subject from issues where id=@id' at line 1: @id=1331
select subject from issues where id=@id):
     8: <% i = 0 %>
     9: <% split_on = (custom_field_values.size / 2.0).ceil - 1 %>
    10: <% custom_field_values.each do |value| %>
    11:   <p><%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %></p>
    12: <% if i == split_on -%>
    13: </div><div class="splitcontentright">
    14: <% end -%>

How can variables be used?