
Ruby on Rails
文章平均质量分 54
Jesse_4th
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Sandi Metz' Rules For Developers
Classes can be no longer than one hundred lines of code.()Methods can be no longer than five lines of code.Pass no more than four parameters into a method. Hash options are parameters.Controller原创 2014-06-24 17:46:05 · 456 阅读 · 0 评论 -
rails migration
add_columnadd_indexchange_columnchange_tablecreate_tabledrop_tableremove_columnremove_indexrename_column原创 2014-07-14 12:09:15 · 555 阅读 · 0 评论 -
Assertions
AssertionPurposeassert( test, [msg] )Ensures that test is true.assert_not( test, [msg] )Ensures that test is false.assert_equal( expected, actual, [ms原创 2014-07-04 13:51:25 · 977 阅读 · 0 评论 -
RAILS关于 NIL? PRESENT? EMPTY? ANY? BLANK?
nil? nil? 判断一个具体的对象是不是为空值的。在rails常用的就是activerecord的对象判断啦。例如a查出来不是空的判断a = User.find(1) => a.nil? => true => a.present? => false但是字符串,空数组 ,空hash查不出来。=> "".nil?=> false=> [].n原创 2014-07-24 09:54:18 · 892 阅读 · 0 评论 -
Rails Model验证及自定义验证
自定义验证:可以自定义validate(), 这个方法在每次保存数据时都会被调用.如:代码 def validate if name.blank? && email.blank? errors.add_to_base("You mustspecify a name or an email address") end end原创 2014-07-02 15:44:32 · 2206 阅读 · 0 评论 -
ruby on rails g scaffold table 回滚
rails3中 应用 rails g scaffold 之后发现了错误原创 2014-06-27 11:07:00 · 753 阅读 · 0 评论 -
从php到Ruby
原文 https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-php/翻译 2014-06-24 15:20:24 · 905 阅读 · 0 评论 -
git/github初级运用
之前初学过一点git版本控制工具,利用github做仓库,照着github上的文档练习的了一下。不过那只篇只是照虎画猫(我的水平只能照着老虎画个猫模样,嘻嘻!)。最近在学hibernate,公司与家之间都要调用我练习的小项目,交给git/github来管理,我只想说真的爽歪歪了。本文在我之前的那篇《git/github学习笔记》的基础上,属于那个的升级加强版,欢迎对照阅读:http转载 2014-06-23 10:03:06 · 505 阅读 · 0 评论 -
Ruby全局变量
以$开始的变量是全局变量,全局变量可以在程序的任何地方加以引用。全局变量无需变量声明。引用尚未初始化的全局变量时,其值为nil。 Ruby运行时环境预定义了一系列的全局变量,有关预定义的全局变量的信息,请参见附表。 $! 最近一次的错误信息 $@ 错误产生的位置 $_ gets最近读的字符串 $. 解释器最近读的行数(line number) $& 最近一次与正则原创 2014-06-24 11:59:16 · 654 阅读 · 0 评论