0

I added a custom value in the user form in my redmine. It's a boolean value (a checkbox). My custom value's id is 8

I'm trying to get it's value in a view hook (view_issues_show_description_bottom)

So with this code in my hook class :

cv = CustomValue.where('custom_field_id = 8').first
context[:cv] = cv

And this code in my .view file

<% if cv.value == "1" %>

At the beginning it worked, but then after that i added other fields, and it's not working anymore.

I guess there is a better way to get the custom value from the current user ? I'm a complete beginner with ruby so i really don't know how to fix this.

Thx a lot

user
  • 539
  • 1
  • 11
  • 32

1 Answers1

2
User.current.custom_value_for(CustomField.find(cf_id)).value

where cf_id is custom field id

user
  • 539
  • 1
  • 11
  • 32
Michael Malov
  • 1,877
  • 1
  • 14
  • 20