
ruby on rails
linshao512
这个作者很懒,什么都没留下…
展开
-
rails `autodetect’: Could not find a JavaScript runtime.
解决了问题。采用了以下方法:gem install execjsgem install therubyracer或者sudo apt-get install nodejs原创 2012-05-23 16:43:45 · 288 阅读 · 0 评论 -
rails3.2.3 使用rails_kindeditor
1.将下面代码加入Gemfile:gem 'rails_kindeditor'2.运行"bundle"命令:bundle3.安装Kindeditor,运行下面的代码:rails generate rails_kindeditor:install4.在app/assets/javascripts/application.js里面为assets pipeline加入...原创 2012-05-26 20:53:58 · 160 阅读 · 0 评论 -
Rails常用的帮助函数
Rails的显示部分内容: 60, : omission => '...')).html_safe %>Rails的转换时间格式:结果:June 22 on 04:35 AM原创 2012-05-26 20:55:52 · 120 阅读 · 0 评论 -
windows 安装ruby on rails
1.到http://rubyinstaller.org/downloads/下载rubyinstall 和DevKit(可能要翻-墙)2.安装ruby3.查看gem版本并更新 gem -v gem update --system4.安装devkit,安装好后,命令行进入DevKit目录下 ruby dk.rb init ruby dk.rb revi...原创 2012-06-10 21:07:54 · 132 阅读 · 0 评论 -
rails之render与redirect_to
render:动作只是返回一个.erb模版redirect_to:动作能响应浏览器发送来的请求并带回参数展示数据。不知道总结得如何原链接:http://www.ruby-forum.com/topic/58962...原创 2012-07-27 15:06:04 · 132 阅读 · 0 评论 -
how to change the orgin remote
You cangit remote set-url origin git://new.url.here(see git help remote) or you can just edit .git/config and change the URLs there. You're not in any danger of losing history unless you do some...原创 2012-09-09 22:47:33 · 122 阅读 · 0 评论 -
rails 之 attr_accessible 与 attr_accessor
就在刚刚被这两个东西卡住了一个小时,现在总结这点小知识 attr_accessible 是一个rails方法,它可以放实例变量进一个mass assignmen 在attr_accessible之后的属性,进入了白名单,有默认的get,set方法,但是这些属性,必须在schema里面存在它们的名字,就是说要migrate添加到数据库的表里面,可以通过CRUD来操作这些属性在数据...原创 2012-09-21 22:07:39 · 155 阅读 · 0 评论 -
ruby小记录
1.a = Array.new(3,[0,0,0]) => [[0, 0, 0], [0, 0, 0], [0, 0, 0]] 实例化出来的数组其实只是只有三个数组元素的一维数组而不是所期望的二维数组,虽然它可以a[i][j]取出元素,但是不要被其所迷惑 测试下 a[0][1] = 1 => [[0, 1, 0], ...原创 2012-10-05 13:12:21 · 86 阅读 · 0 评论