Rails里rake db:migrate出现undefined method last_comment问题的解决
2024-10-10 05:26:10
这个问题和特定的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了,动态语言必须是这么玩滴… ;)
最新文章
- C# 仿刷-框架MvcThrottle的使用
- MySql学习(三) —— 子查询(where、from、exists) 及 连接查询(left join、right join、inner join、union join)
- js+JQuery实现返回顶部功能
- Mac更换Sublime Text程序图标
- android图片缩小和放大Matrix
- project.json
- HDU 4569 Special equations(数学推论)
- ilter()和find()的区别
- UVa 1451 (数形结合 单调栈) Average
- Spring中Ioc容器的注入方式
- 自给自足:动手打造html5俄罗斯方块
- 走进C++程序世界-----函数相关(全局变量)
- Beta总结篇
- Sql JOIN 一张图说明
- supervisor 从安装到使用
- unigui的页面布局使用
- linux下软件安装的几种方式
- 雅克比迭代算法(Jacobi Iterative Methods) -- [ mpi , c++]
- windows redis 连接错误Creating Server TCP listening socket 127.0.0.1:637 9: bind: No error
- effective java——12考虑实现coparable接口