转自 http://iterat.ive.ly/index.php/2010/09/03/upgrading-your-authlogic-gem-for-rails3/
If you’re using Authlogic in Rails3 (or if you’re upgrading your existing app from 2.3.8 to Rails3) you really need to be using the rails3 branch of the Authlogic gem. If you’re using Bundler, this is super-easy because you just need to update your Gemfile.
In your Gemfile, update the authlogic line to be:
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'
Now you should run $ bundle install to grab the new gem. Then, there are just a few more deprecated things in Rails3 that you’ll need to change in your upgraded app. I’ll try to enumerate here from memory, so please forgive me if I forget something.
First, you need to update your ApplicationController because #requesturi is outdated. Replace it with #fullpath:
def store_location
session[:return_to] = request.fullpath
end
Second, you need to drop the filter_parameter_logging setting from your ApplicationController because it’s now handled in the new application.rb file. Just remember to add the :password_confirmation field to the default array like so:
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password, :password_confirmation]
Third, if your migration script (or the steps you followed manually) didn’t get rid of the /config/initializers/cookie_verification_secret.rb file, delete it now. Cookie secrets are now handled in the /config/initializers/secret_token.rb file.
Fourth, the f.error_message construct isn’t available anymore in core rails, so you should take this opportunity to create your own better more customizable error messages. If you really really want to keep using f.error_message you can install the dynamic_form plugin, but don’t do that. Railscast.com did a very nice explanation of how to create your own shared _error_messages.html.erb view (along with some other validation-related stuff.)
Finally, you need to make sure your generated pages include the csrf_meta_tag. Check out my previous post if you’re getting an InvalidAuthenticityToken error when you hit the Logout link.
That should be all you need to do to have Authlogic working in Rails3 without deprecated warnings.
分享到:
相关推荐
3. **复制升级法(Clone Upgrade)** 复制升级法通过创建源数据库的完整副本,然后在副本上进行升级。一旦升级成功,可以将新数据库作为生产数据库,而旧数据库则可以用于回滚操作。这种方法适合于需要回滚能力或...
3. **联机升级法(Upgrade in Place)**:如果原有系统资源充足,且数据库不包含复杂的定制化,可以直接在原系统上进行升级。Oracle提供了一个内置的Upgrade Advisor工具来评估现有环境的兼容性,然后通过Enterprise...
See UPGRADING.rdoc for more details and alternative instructions. If you don t have RubyGems installed, you can still do it manually: Download from: rubygems.org/pages/download Unpack into a ...
标题中提到的“Microsoft.Press.Exam.Ref.70-417.Upgrading Your Skills to MCSA”指的是为通过70-417考试做准备的一本参考书籍。这本书是微软官方出版社出版的,用于帮助读者更新或升级他们的技能以达到MCSA(微软...
Adobe Creative Suite 3 Web Premium AIO Desk Reference For Dummies.pdf Adobe Creative Suite AIO Desk Reference For Dummies.chm Adobe Illustrator Cs For Dummies (2004).chm Adobe Premiere Elements For ...
Upgrading and Repairing Servers Pages: 1128
For 25 years, Upgrading and Repairing PCs has been the world’s #1 guide to PC hardware: The single source for reliable information on troubleshooting and fixing problems, adding hardware, optimizing ...
这款"mp3固件升级工具(Mp3player Firmware Upgrading Tool)"是一款专为此目的设计的中文绿色版软件,简化了用户对MP3播放器进行固件更新的过程。 固件,全称固件程序,是存储在电子设备内部ROM或闪存中的控制程序,...
At the end of the book, you should be able to build a site on your own or have the confidence and knowledge to hire a professional to develop a site for you which meets your business needs. You will ...
Make the most of the SAP Crystal Reports, developer version for Microsoft Visual Studio runtime by designing your reports in SAP Crystal Reports 2011 software. Utilize Crystal Reports 2011 and spend ...
for d1-7C1-6k1-3srcBoost Your Modem & Browser Speed up to 400% & Optimize your Internet Experience. Easy-to-use, Internet Optimizer for Windows 95, 98, ME, NT, 2000 and XP designed to automatically ...
Make the most of the SAP Crystal Reports, developer version for Microsoft Visual Studio runtime by designing your reports in SAP Crystal Reports 2011 software. Utilize Crystal Reports 2011 and spend ...
升级至DB2版本9.7:详尽指南与关键知识点 在IT领域,数据库管理系统(DBMS)的更新换代是确保数据处理效率、安全性及功能性的关键步骤之一。IBM的DB2作为全球广泛使用的数据库软件之一,其每一次版本升级都备受关注。...
Make the most of the SAP Crystal Reports, developer version for Microsoft Visual Studio runtime by designing your reports in SAP Crystal Reports 2011 software. Utilize Crystal Reports 2011 and spend ...
Make the most of the SAP Crystal Reports, developer version for Microsoft Visual Studio runtime by designing your reports in SAP Crystal Reports 2011 software. Utilize Crystal Reports 2011 and spend ...
Make the most of the SAP Crystal Reports, developer version for Microsoft Visual Studio runtime by designing your reports in SAP Crystal Reports 2011 software. Utilize Crystal Reports 2011 and spend ...
阅读UPGRADING.md 安装 从2.x开始,Asset Sync取决于gem fog-core而不是fog 。 这是由于fog包含许多未使用的存储提供程序gem作为其依赖项。 Asset Sync不知道将使用哪个提供商, 因此,您有责任为要使用的提供程序...