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 ...
随机推荐
- cookielib和urllib2模块结合模拟网站登录
1.cookielib模块 cookielib模块的主要作用就是提供可存储cookie的对象,以便于与urllib2模块配合使用来访问internet资源,例如可以利用本模块的cookiejar类的对 ...
- 使用NPOI-创建Excel
这里简单的使用一下NPOI ,什么是NPOI? 既然你已经在需要使用了,就一定知道NPOI是干什么用的了. 开始正题吧. 我用控制台程序来给大家演示一下: 一.创建控制台程序 自行脑补 二.添加NPO ...
- WebGL之通过外部传入a_PontSize值改变点着色器vshader内置变量gl_PointSize的值
最近分配到一个看起来非常简单的优化需求.通过地图上设置工具来改变地图上显示的点的大小和透明度.无非过程就是从控件面板获取到用户设置的值保存到数据库中.然后地图上画点的时候取出设置的值渲染出点即可.前端 ...
- [LeetCode] Best Time to Buy and Sell Stock with Transaction Fee 买股票的最佳时间含交易费
Your are given an array of integers prices, for which the i-th element is the price of a given stock ...
- [LeetCode] Implement Magic Dictionary 实现神奇字典
Implement a magic directory with buildDict, and search methods. For the method buildDict, you'll be ...
- Junit简单配置
Junit简单配置的步骤如下: 1.在WEB-INF目录下的lib里面放一个junit包,我用的是junit-4.9.jar: 2.选定要测试的类,右键单击该类,新建一个Junit Test Case ...
- [Codeforces 919F]A Game With Numbers
Description 题库链接 两个人 Van♂ 游戏,每人手上各有 \(8\) 张牌,牌上数字均为 \([0,4]\) 之间的数.每个人在自己的回合选自己手牌中数字不为 \(0\) 的一张与对方手 ...
- [测试题]gene
Description Input Output Sample Input 3A+00A+A+ 00B+D+A- B-C+00C+ Sample Output bounded Hint 题解 //It ...
- bzoj 2339: [HNOI2011]卡农
Description Solution 比较难想.... 我们先考虑去掉无序的这个条件,改为有序,最后除 \(m!\) 即可 设 \(f[i]\) 表示前\(i\)个合法集合的方案数 明确一点: 如 ...
- 计蒜客NOIP2017提高组模拟赛(五)day2-蚂蚁搬家
传送门 这题可以用线段树来维护 #include<cstdio> #include<cstdlib> #include<algorithm> #include< ...