rubyactivesupportpadrino

humanize NoMethodError on padrino-0.14.1.1


I used padrino-0.14.1.1 and activesupport-5.1.1 in combination and I generate padrino admin app. When I display the login page (/admin/sessions/new) the following error occurred and become 500 error page.

DEBUG -  TEMPLATE (0.0007s) /sessions/new
2017-11-07 20:23:01 - NoMethodError - undefined method `humanize' for "login.title":String:
    /Path/to/app/'vendor/bundle' /ruby/2.3.0/gems/padrino-admin-0.14.1.1/lib/padrino-admin/helpers/view_helpers.rb:43:in `padrino_admin_translate'
...

I think it is not a bug of Padrino, because I cannot find same problems in the Internet. And I add the following require to the beginning of view_helpers.rb provisionaly.

require 'active_support'
require 'active_support/core_ext/string'

However, I think it is not good to edit Padrino's files because of my application problem. Please let me know if you have any other good countermeasures.


Solution

  • I got the answer of this question from Padrino maintainer on Github. And I tried the suggestion in the answer, that worked well. The answer is following.

    --

    Looks like a bug due to the ongoing effort to remove the ActiveSupport dependency from Padrino.

    You don't need to update view_helpers.rb - creating a file in config/initializers should be sufficient as a temporary stop-gap until the bug is fixed.

    # config/initializers/extra_requires.rb
    require "active_support"
    require "active_support/core_ext/string"