Problem after maj 3.1 = "undefined method time_entries_visibility"

Added by Le Distordu about 6 years ago

NoMethodError (undefined method `time_entries_visibility' for #<Role:0x007f72a9464f60>):
app/models/user.rb:649:in `block in allowed_to_view_all_time_entries?'
app/models/user.rb:610:in `block in allowed_to?'
app/models/user.rb:607:in `allowed_to?'
app/models/user.rb:648:in `allowed_to_view_all_time_entries?'
app/controllers/projects_controller.rb:147:in `show'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'


ActionView::Template::Error (undefined method `time_entries_visibility' for #<Role:0x007f72ade9dcd0>):
11: <% end >
12:
13: <
unless @role.anonymous? >
14: <p><
= f.select :time_entries_visibility, Role::TIME_ENTRIES_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} ></p>
15: <
end >
16:
17: <p><
= f.select :users_visibility, Role::USERS_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} %></p>
lib/redmine/views/labelled_form_builder.rb:38:in `select'
app/views/roles/_form.html.erb:14:in `_app_views_roles__form_html_erb___2734550625845527890_70065271466080'
app/views/roles/edit.html.erb:4:in `block in app_views_roles_edit_html_erb__1848941711447579449_70065271391160'
app/helpers/application_helper.rb:1027:in `labelled_form_for'
app/views/roles/edit.html.erb:3:in `_app_views_roles_edit_html_erb___1848941711447579449_70065271391160'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'


Can you help me ?

Replies (7)

RE: Problem after maj 3.1 = "undefined method time_entries_visibility" - Added by Alexandre Tolstenko Nogueira about 6 years ago

I am having this same issue in the 3.1.0 update when I try to change the roles and permissions.

ActionView::Template::Error (undefined method `time_entries_visibility' for #<Role:0x007f24de2e1788>):
    11:   <% end %>
    12:
    13:   <% unless @role.anonymous? %>
    14:     <p><%= f.select :time_entries_visibility, Role::TIME_ENTRIES_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} %></p>
    15:   <% end %>
    16:
    17:   <p><%= f.select :users_visibility, Role::USERS_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} %></p>  
  lib/redmine/views/labelled_form_builder.rb:38:in `select'   
  app/views/roles/_form.html.erb:14:in `_app_views_roles__form_html_erb__3281614492599584857_45875800'
  app/views/roles/edit.html.erb:4:in `block in _app_views_roles_edit_html_erb__3276990142325154232_45475840'
  app/helpers/application_helper.rb:1027:in `labelled_form_for'
  app/views/roles/edit.html.erb:3:in `_app_views_roles_edit_html_erb__3276990142325154232_45475840'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

RE: Problem after maj 3.1 = "undefined method time_entries_visibility" - Added by Go MAEDA about 6 years ago

Have you completed database migrations by executing following command?

bundle exec rake db:migrate RAILS_ENV=production

RE: Problem after maj 3.1 = "undefined method time_entries_visibility" - Added by Matthias Reinhardt about 6 years ago

Same problem here.
I did execute this line.

What I found out is that the table "roles" is not extended by the two new fields "time_entries_visible" and "all_roles_managed".
After adding them manually it worked.
It seems that this is missing in the migration script.

RE: Problem after maj 3.1 = "undefined method time_entries_visibility" - Added by Eugen Morgunov about 6 years ago

Matthias Reinhardt wrote:

Same problem here.
I did execute this line.

What I found out is that the table "roles" is not extended by the two new fields "time_entries_visible" and "all_roles_managed".
After adding them manually it worked.
It seems that this is missing in the migration script.

Same problem too - and the mentioned fields are too missing from the roles table.
What exactly did you do? What is type of those two fields and rest ?

RE: Problem after maj 3.1 = "undefined method time_entries_visibility" - Added by Matthias Reinhardt about 6 years ago

'time_entries_visibility' is varchar 30 with def. value = 'all'
'all_roles_managed' is tinyint 1 with def. value '1'

RE: Problem after maj 3.1 = "undefined method time_entries_visibility" - Added by Mikhail Bakhterev about 6 years ago

Matthias Reinhardt wrote:

'time_entries_visibility' is varchar 30 with def. value = 'all'
'all_roles_managed' is tinyint 1 with def. value '1'

Could you, please, clarify where to put this to make my Redmine setup on sqlight3 database to work again.

P.S. I am complete newbie in DB, Ruby, Redmine, so, please, excuse me for my silly questions.

RE: Problem after maj 3.1 = "undefined method time_entries_visibility" - Added by Matthias Reinhardt about 6 years ago

SQLite DB files can be opened with SQLiteStudio.
There you can find the table roles.
I'm not quite sure which data type corresponds to tinyint. Those where the ones in MySQL.
But you can have a look at the existing fields in this or other tables.

(1-7/7)