Rails里rake db:migrate出现undefined method last_comment问题的解决
这个问题和特定的rake版本有关,因为Rails要使用rake的last_comment方法在较新版本的rake中已被废弃,所以很多人卸载了新版本的rake去安装旧版本的rake.
这样也能解决问题,但显然用旧的东西感觉不那么好.
好在你遇到的是ruby语言,所以没有什么不可能了,我们只需要写一个模块然后包装last_comment方法到rake中对应的新方法中即可,打开Rakefile,在其中新建一个module,最后将其include进来即可:
module TempFixForRakeLastComment
def last_comment
last_description
end
end
Rake::Application.send :include, TempFixForRakeLastComment
如果你觉得太神奇,那么你是out了,动态语言必须是这么玩滴… ;)
Rails里rake db:migrate出现undefined method last_comment问题的解决的更多相关文章
- rails使用 rake db:migrate 提示 Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue.
首先得特么建立数据库 : rake db:create 实际问题是没有int应该用integer http://www.rubycc.com/column/rails3.2.3/rails.htm
- redmine3.3.3 rake db:migrate 报错invalid byte sequence in US-ASCII (Argument Error) 解决方法
这个错误有点莫名其妙,系统默认的就是utf-8,可bundle就是不对.. rake db:migrate 结果没有任何错误,反而是网页passenger 提示了这个错误 参考:https://git ...
- rake db:migrate 与 bundle exec rake db:migrate 的区别(copy)
[说明:资料来自http://blog.csdn.net/lihuan974683978/article/details/8715414] 之前一直没弄明白rake db:migrate 与 bun ...
- Rails--bundle exec rake db:migrate
--新建表: def up create_table :[TABLE_NAME] do |t| t.column :[NUM], :integer t.column :[NAME], :string ...
- 关于rails中 rake db:create 失败的问题
提示信息: rake aborted!Could not find a JavaScript runtime. See https://github.com/sstephenson/execjsfor ...
- rails学习笔记: rake db 相关命令
rails学习笔记: rake db 命令行 rake db:*****script/generate model task name:string priority:integer script/g ...
- rails数据库操作rake db一点心得
问题描述,对于很多的新手rails lover来说,搞定db是件头疼的事情,当建立了一个model,测试了半天发现我草列名写错了,再过一会儿发现association里面竟然没有xxx_id,这下子s ...
- undefined method `environment' for nil:NilClass when importing Bootstrap into rails
今天做项目时往Gemfile里加了各gem, 然后bundle update了一下, 然后悲剧了,出现了undefined method `environment' for nil:NilClass ...
- Use “error_messages” in Rails 3.2? (raises “undefined method” error)
I am getting the following error in my Rails 3.2 functional tests: ActionView::Template::Error: unde ...
随机推荐
- git的理论基础
GIT是目前世界上最先进最牛逼的分布式版本控制系统git维护的三棵树分别是工作区域.暂存区域.git仓库工作区域:就是你平时存放项目代码的地方暂存区域:用于临时存放你的改动,事实上它只是一个文件,保存 ...
- 对Spring IOC和AOP的理解
控制反转(IOC)是什么?(理解好Ioc的关键是要明确"谁控制谁,控制什么,为何是反转(有反转就应该有正转了),哪些方面反转了") 1.Ioc-Inversion of Contr ...
- Oracle SQL Developer 免费的DB2客户端
问题地址:https://stackoverflow.com/questions/8600735/is-there-any-opensource-db2-client 软件地址:http://www. ...
- [LeetCode] Longest Line of Consecutive One in Matrix 矩阵中最长的连续1
Given a 01 matrix M, find the longest line of consecutive one in the matrix. The line could be horiz ...
- 【django之Ajax】
一.Ajax的简介 1.定义 AJAX(Asynchronous Javascript And XML)翻译成中文就是"异步Javascript和XML",是一种创建交互式网页应用 ...
- servlet之session设置
商品对象,购物车对象,servlet的实现 商品: package app02d;public class Product { private int id; private String ...
- [HNOI 2015]菜肴制作
Description 知名美食家小 A被邀请至ATM 大酒店,为其品评菜肴. ATM 酒店为小 A 准备了 N 道菜肴,酒店按照为菜肴预估的质量从高到低给予 1到N的顺序编号,预估质量最高的菜肴编号 ...
- [HNOI2005]狡猾的商人
题目描述 输入输出格式 输入格式: 从文件input.txt中读入数据,文件第一行为一个正整数w,其中w < 100,表示有w组数据,即w个账本,需要你判断.每组数据的第一行为两个正整数n和m, ...
- (⊙o⊙)…
参考:ACdreamers a > b,GCD(a,b) = 1 => GCD(a^m-b^m,a^n-b^n) = a^GCD(n,m) - b^GCD(n,m) /*没有找到推理过程Q ...
- bzoj3702二叉树 线段树合并
3702: 二叉树 Time Limit: 15 Sec Memory Limit: 256 MBSubmit: 600 Solved: 272[Submit][Status][Discuss] ...