简体   繁体   中英

Ruby on Rails MySQL issues on Sierra/El Capitan Mac

Updated OS to El Capitan and then to Sierra. Now when working on an old Ruby on Rails project, all of sudden rails cannot get the data from relevant tables.

I have reinstalled Homebrew, mysql, rails, ruby, and xcode is updated with CLI installed.

I have backed up the old database which was working before and imported back into a brand new installation of mysql. Rails logs in correctly to the project (which was not doing it before) but after that getting index pages fails with 'reorder' problem for nil class.

Started GET "/admin/buildings" for 127.0.0.1 at 2016-11-20 08:36:21 -0500
Processing by Admin::BuildingsController#index as HTML
  AdminUser Load (0.3ms)  SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 2 LIMIT 1
  Rendered /Users/mh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activeadmin-0.6.2/app/views/active_admin/resource/index.html.arb (25.5ms)
Completed 500 Internal Server Error in 38.0ms

ActionView::Template::Error (undefined method `reorder' for nil:NilClass):
    1: insert_tag renderer_for(:index)

brew version Homebrew 1.1.1 Homebrew/homebrew-core (git revision 421e; last commit 2016-11-20)

ruby version (via rbenv) ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]

rails version Rails 3.2.22.5

mysql version Server version: 5.7.16 Homebrew

Hopefully not a duplicate (I have searched), but apologies if it is.

EDIT: noted that rbenv did not set ruby and rails to latest for that specific folder, although rbenv global was used. updating to latest version and will update later.

I'm not sure how your operating system update would affect this, but other people have experienced the undefined method 'reorder' error while using the ActiveAdmin gem. In particular, it seems to occur when passing an instance variable to a controller where an instance variable of the same name already exists.

For example, you might define a filter in application_controller.rb that fetches all posts, stores them in a variable named @posts, and passes them to the index route in posts_controller. ActiveAdmin has already created and populated such a variable, and the variables are conflicting. In this scenario, you should rename the instance variable that is declared in the filter.

One thing I noticed that is unique to your problem is the nil:NilClass. Most of the other people who encounter the undefined method 'reorder' error get it for an Array.

I hope this was at least somewhat helpful!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM