![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ruby
文章平均质量分 67
张华勋
勤奋好学,对技术充满激情!
展开
-
ubuntu 最简单的rvm ruby rails 安装命令
安装 RVM: $ bash -s stable 写入bashrc并 重新加载shell$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc$ source ~/.bashrc注意:如果这一步进行不了,是因为没用在写入上述文件原创 2012-02-22 08:56:24 · 1244 阅读 · 0 评论 -
rails3 使用 acts-as-taggable-on 打标签 超简单
rails 使用 acts-as-taggable-on 打标签简介:Jonathan Viney 是这个项目的最大贡献者。`标签`的作用很广,尤其是博客和搜索这两方面。1,Rails 3.x在 Gemfile添加以下内容gem 'acts-as-taggable-on', '~> 2.3.1'2,使用以下命令:rails generate acts_原创 2012-08-28 23:44:22 · 3834 阅读 · 0 评论 -
搭建开发rails环境
rvm use 1.9.3-p125rvm gemset create rails323_r193_xmcrmrvm use 1.9.3-p125@rails323_r193_xmcrmgem install rails -v 3.2.3rails new xmcrmcd xmcrm修改gemfilesource 'https://rubyg原创 2012-12-12 17:48:37 · 1302 阅读 · 0 评论 -
ruby on rails 【语法大全2】
rake 系列命令最熟悉的就是 rake db:create/migrate 对数据库的操作,也许这些也很少用的:rake -T 列出所有rake命令rake -T plugin 列出所有有关plugin的rake命令rake db:migrate version=0 清除数据库数据和结构 1.1 创建一个Rails应用程序 $ rails new app_name转载 2012-08-19 22:44:19 · 1229 阅读 · 0 评论 -
ruby on rails 【语法大全1】
0,rails new blog这个是ror初学者第一个真正的ror项目这个就是生成一个ruby on rails 项目这个就相当于C语言中的hello world1,bundle install用来安装应用的gem,这里的gem就是常说Gemfile里面定义的gem2,scaffold脚手架用来自动生成CRUD的 一个工具集 包含数据库ex: rails原创 2011-11-30 09:06:52 · 1373 阅读 · 0 评论 -
怎么单独进行一个单元测试
How to Run a Single Rails Unit TestMay 28th, 2010 | Comments This post explains how to execute a single unit test (or even a single testmethod) instead of running the complete unit test suite.翻译 2012-08-16 09:39:02 · 1186 阅读 · 0 评论 -
创建你的第一个gem
Creating Your First GemYou see gems everywhere in the Ruby world. They are the backbone of just about every Ruby app out there. I’ll admit that I was a bit intimidated the first time I tried to翻译 2012-05-28 15:09:22 · 988 阅读 · 0 评论 -
ruby on rails 【语法大全2】【模型(Models)】数据库迁移(Migrations)
数据迁移【Migrations】数据迁移能让你很方便的以一种有条理,有组织的方式更改你的数据库。当然你也可以手动更改sql语句,但是你也有责任告诉其他的开发者;让他们运行这些语句。你也要记录变化的地方不要让它在你下次部署时和你的产品机器发生冲突。Active Record 记录你已经运行的所有迁移操作,因此你所做的就是更新你的代码,然后运行 "rake db:migrate"。当Act翻译 2012-04-19 09:09:39 · 862 阅读 · 0 评论 -
Ruby【002】
Ruby有不少惯用法,这里略作一些介绍,也方便阅读他人代码:迭代一般写法:for i in (1..10)puts iend习惯写法:Java代码 (1..10).each{|i| puts i} 或 1.upto(10){|i| puts i} # from njmzhang ||=赋值一般写法:转载 2012-04-19 08:56:12 · 865 阅读 · 0 评论 -
Ruby各种枚举方法及其使用【001】
1,upto()方法 EX:irb:1.upto(5){ |x| puts(x) } 输出irb:1irb:2irb:3irb:4irb:5= >1注意:这里的x 是变量 这种枚举的方法只能遍历连续的数字,字符,而且只能是小数到大数1.1upto()和do、end 搭配使用irb:1.upto(4) do |x| pr原创 2011-12-02 18:13:40 · 2052 阅读 · 0 评论 -
rails ActiveRecord 操作数据库
RAILS3 ActiveRecord 操作数据库rails ActiveRecord 操作数据库(CRUD)C 添加记录(1) new 和 saveuser = User.newuser.name = value1user.password = value2user.save(2) create 下面增加了两条记录User.create(原创 2012-02-20 18:22:48 · 826 阅读 · 0 评论