Search code examples
redminegitolite

ActionView::Template::Error (undefined method `page_param' for nil:NilClass)


>Environment:
  >>Redmine version                3.1.3.stable
  >>Ruby version                   2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
  >>Rails version                  4.2.5
  >>Environment                    production
  >>Database adapter               Mysql2

>SCM:
  >>Subversion                     1.8.10 
  >>Git                            2.1.4
  >>Filesystem                     
  >>Xitolite                       2.1.4
>Redmine plugins:
  >>ckeditor                       
  >>clipboard_image_paste          1.9
  >>easy_cocoon                    
  >>easy_extensions                2014.06.05
  >>easy_alerts                    2014
  >>easy_attendances               2014
  >>easy_budgetsheet               2014
  >>easy_calculation               2014
  >>easy_contacts                  2014
  >>easy_crm                       2014
  >>easy_helpdesk                  2014
  >>easy_instant_messages          2014
  >>easy_knowledge                 2014
  >>easy_money                     2014
  >>easy_printable_templates       2014
  >>easy_project_attachments       2014
  >>easy_quick_project_planner     2014
  >>easy_redmine                   
  >>easy_theme_designer            2014
  >>easy_to_do_list                2014
  >>easy_user_allocations          2014
  >>easy_xml_helper                2014
  >>easy_baseline                  2014
  >>easy_gantt                     2016.01.1000
  >>easy_gantt_pro                 2016-RC1.0
  >>redmine_bootstrap_kit          0.2.4
  >>redmine_git_hosting            1.2.0

ERROR

Started GET "/redmine/users" for 192.168.50.1 at 2016-02-17 14:35:41 +0100
Processing by UsersController#index as HTML
  Current user: admin (id=1)
  Rendered plugins/redmine_git_hosting/app/views/users/index.html.erb within layouts/admin (13.7ms)
Completed 500 Internal Server Error in 49ms (ActiveRecord: 3.7ms)

ActionView::Template::Error (undefined method `page_param' for nil:NilClass):
53:   </tbody>
54: </table>
55: </div>
56: <p class="pagination"><%= pagination_links_full @user_pages, @user_count %></p>
57:
58: <% html_title(l(:label_user_plural)) -%>
lib/redmine/pagination.rb:157:in `pagination_links_full'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Steps taken: Installed redmine (everything ok) Installed easyredmine (everything ok) Installed Gitolite3 (everything ok) Installed Git_hosting_plugin 1.2.0 (ouch)

I followed the getting started guide for the plugin. My boss wants the PassengerUser to be redmine, so I set up redmine as the redmine user account. The redmine user can communicate with gitolite through SSH as described. I also set up the sudoers.d/redmine without any trouble.

Everything seems to work at first, and logging into localIP/redmine works, with Passenger configured for the redmine user.

My problem is that when i visit the redmine/users page it gives the error described above, written into the production.log. I have no idea why page_param is undefined, or what is going wrong with pagination_links_full. I do not want to modify the ruby file because of expected trouble when updating at some later point.

I'm new to installing redmine and the other programs on linux server environments, and have little experience with UNIX systems, though I would say my understanding grows a lot by the day.It could be a nooby mistake. It could be a bug. It could be a mismatch in versions, where version A of a method is used to call upon a later improved version of another piece of code. It could be that the info has to be taken from somewhere and the redmine installation is trying to get the information without the proper configuration.

If I had to guess, my best guess would be that the ruby pagination file is not compatible with the rest of the configuration and should likely be replaced by a different version.

Can someone please explain to me what is going wrong here, or how to fix this problem (or preferably both)?

Would really appreciate it.

Reinier

UPDATE (18/02/2016): by editing the template the user page is accessible again. <= pagination_links_full @user_pages, @user_count %></p --> However, this is a dirty temporary fix which would cause problems if the amount of users would be more than fit into one page. Who can help me find a permanent solution?

@Jkraemer (19/02/2016)

Thanks a lot for your feedback. Right now I am not assigned any extra time to resolve the issue but I did have a look based on what you wrote. By the way, any plugin starting with easy_ is a standard easyredmine plugin, so the plugin list is smaller than it appears to be.

The directories which have a users/index.html.erb file:

  >/opt/redmine/redmine-3.1.3/app/views/users/index.html.erb
  >/opt/redmine/redmine-3.1.3/plugins/easyproject/easy_plugins/easy_extensions/app/views/users/index.html.erb
  >/opt/redmine/redmine-3.1.3/plugins/redmine_git_hosting/app/views/users/index.html.erb
  >/var/lib/gems/2.1.0/gems/redmine_extensions-0.0.20/spec/redmine/app/views/users/index.html.erb

The top two are redmine and easyredmine, which worked fine before installing the redmine_git_hosting plugin. The bottom one seems to be a standard redmine_extensions gem.

If I had to make a more educated guess than before, I would say that combined with the fact that the problem did not occur with the other installations, the redmine_git_hosting plugin seems to be the culprit, or atleast cause problems combined with redmine and/or easyredmine. It was also in the redmine git hosting directory and file where I implemented the dirty fix by modifying the template file, which temporarily 'fixed' the problem. Funny how a simple piece of code to determine how many pages of users to display, which is essentially obsolete unless your redmine environment has more than one page full of users, can cause the entire user management interface to be disabled.

the Plugin does seem to patch the UsersController: /opt/redmine/redmine-3.1.3/plugins/redmine_git_hosting/lib/redmine_git_hosting/patches/users_controller_patch.rb

The template I modified was the one from the error log, so it was already constructed to use @user_pages. I did not find time yet to dig deeper into the users controller. Do you think modifying the Users Controller to set the variable, testing if it works that way, and then reporting the problem and proposed solution to the authors of the redmine_git_hosting plugin would be the best way to go about it?

Sidenote: You said both, but in this case, would it not be worth mentioning it to three parties? (redmine/easyredmine/redmine_git_hosting). How would one go about reporting something like this? Would it involve making a post on their forum or sending an email with information to the company? I can think of many ways to report it but am unfamiliar with such procedures and do not know if there is a standardized way to do it outside obvious possible ways to communicate. I also do not know if I should test it on redmine without easyredmine, before reporting it to redmine. If I were working for redmine I would appreciate any heads up about possible problems with plugins, so I could archive the potential problem and test if that also applies for redmine. From my boss's perspective I do not think he is interested in assigning time he has to pay for to get to the bottom of it.

Thanks again for having someone's brain to pick.


Solution

  • From the error message I'd say @user_pages is nil when the view is rendered. Looking at app/controllers/users_controller.rb this shouldn't be the case since it's set in the index action. So the next step would be to find out if one of your plugins overwrites / patches UsersController#index or otherwise messes around with the @user_pages instance variable.

    A wild guess would be that another plugin you have installed brings its own version of UsersController#index (which doesn't set @user_pages), plus its own version of the users/index.html.erb template (which doesn't need @user_pages). This alone is bad enough already but everything might work until you install the git hosting plugin, which also brings its own version of users/index.html.erb (which needs @user_pages again, like the original users/index.html.erb of core Redmine), and things go wrong.

    So go and grep any Ruby code in your plugins folder for 'UsersController' and check for an overridden index action, and also look for files named users/index.html.erb. If my guess is right and you find the other offending plugin, report the problem to both plugin's authors. Until at least one of them fixes their plugin, stick to your dirty hack and hope there's no other hidden problems (not unlikely given the list of your plugins), or decide to throw out at least one of the conflicting plugins.