RegistrationsController#

RegistrationsController#

本文介绍了LoadError in Devise :: RegistrationsController#create的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用devise的宝石,我在Devise :: RegistrationsController#中收到错误的LoadError#create无法加载这样的文件 - bcrypt_ext ..我试图对这个问题做一些研究,并且还试图遵循给定的指令



但是仍然有这个问题。任何建议?



注意:我使用的指南是,我在windows 7上的rails上使用ruby



宝石文件


 源'https://rubygems.org'

git_source(:github)do | repo_name |
repo_name =#{repo_name} /#{repo_name},除非repo_name.include?(/)
https://github.com/#{repo_name}.git
end
#error in devise
gem'bcrypt-ruby','〜> 3.1','> = 3.1.5'
#验证捆绑
宝石'devise','〜> 4.2','> = 4.2.1'
#捆绑边Rails代替:gem'rails',github:'rails / rails'
gem'rails','〜> 5.1.0.rc1'
#使用postgresql作为Active Record的数据库
gem'pg','〜> 0.18'
#使用Puma作为应用服务器
gem'puma','〜> 3.7'
#使用SCSS作为样式表
gem'sass-rails',github:rails / sass-rails

#使用Uglifier作为JavaScript资产的压缩器
gem'uglifier','> = 1.3.0'
#请参阅https://github.com/rails/execjs#readme了解更多支持的运行时
#gem'therubyracer',平台: ruby

#使用CoffeeScript为.coffee资产和视图
gem'coffee-rails','〜> 4.2'
#Turbolinks更快地导航您的Web应用程序。阅读更多:https://github.com/turbolinks/turbolinks
gem'turbolinks','〜> 5'
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder','〜> 2.5'
#使用Redis适配器在生产中运行Action Cable
#gem'redis','〜> 3.0'
#使用ActiveModel has_secure_password
#gem'bcrypt','〜> 3.1.7'

#使用Capistrano进行部署
#gem'capistrano-rails',group::development

group:development,:test do
#在代码中的任何地方调用'byebug'以停止执行并获取调试器控制台
gem'byebug',平台:[:mri,:mingw,:x64_mingw]
#添加对Capybara系统的支持测试和硒驱动
gem'capybara','〜> 2.13.0'
gem'selenium-webdriver'
end

group:development do
#在异常页面上访问IRB控制台,或使用<%=控制台%>代码中的任何地方
gem'web-console','> = 3.3.0'
end

#Windows不包含zoneinfo文件,所以捆绑tzinfo-data gem
gem'tzinfo-data',平台:[:mingw,:mswin,:x64_mingw,:jruby]


解决方案

我也有同样的错误,我的问题解决了,请尝试解决方案3



问题是编译的windows gem。如果它被删除并且只包括纯粹的红宝石版本会更好。



解决方案一:



您可以将bcrypt_ext.so从\lib\2.1复制到\lib与bcrypt.rb相同的文件夹



解决方案两个:



您可以使用gem install bcrypt --platform = ruby​​,即使我有麻烦选择它始终使用编译版本的rails



解决方案三:



git clone



cd bcrypt-ruby



gem build bcrypt.gemspec



gem install gem-compiler

宝石编译bcrypt-3.1.10.gem



宝石安装bcrypt-3.1.10-x64-mingw32.gem - 本地


I am using the gem of devise and I am getting error LoadError in Devise::RegistrationsController#create cannot load such file -- bcrypt_ext.. I tried to do some research regarding to this problem and also tried to follow the instruction given(http://stackoverflow.com/questions/35422463/loaderror-in-deviseregistrationscontrollercreate-cannot-load-such-file-bc)

But still having this problem. Any suggestion?

NOTE: The guide that I am using is video guide and I am using ruby on rails on windows 7

Gem File

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end
# error in devise
gem 'bcrypt-ruby', '~> 3.1', '>= 3.1.5'
# Bundle for authentication
gem 'devise', '~> 4.2', '>= 4.2.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.0.rc1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', github: "rails/sass-rails"

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13.0'
  gem 'selenium-webdriver'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
解决方案

I was also having the same error, and my problem got fixed, please try solution 3

The problem is the compiled windows gem. It would be better if it were deleted and only include the pure ruby version.

Solution one:

You can copy bcrypt_ext.so from \lib\2.1 to \lib the same folder where is bcrypt.rb

Solution two:

You can use the gem install bcrypt --platform=ruby even if I had trouble to select that from rails which it always use the compiled version

Solution three:

git clone https://github.com/codahale/bcrypt-ruby.git

cd bcrypt-ruby

gem build bcrypt.gemspec

gem install gem-compiler

gem compile bcrypt-3.1.10.gem

gem install bcrypt-3.1.10-x64-mingw32.gem --local

这篇关于LoadError in Devise :: RegistrationsController#create的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 13:29