
Ruby on Rails
文章平均质量分 79
cs08211317dn
这个作者很懒,什么都没留下…
展开
-
第一个 Rails App 从安装到创建(windows版本)
1. 在以下网址下载并运行 Rails 安装包: 点击打开链接2. 检查 ruby,sqlite 和 rails 是否安装成功2.1 查看 ruby 版本, 在命令行中输入:ruby -v运行截图如下:2.2 查看 sqlite 版本,在命令行中输入:sqlite3 --version运行截图如下:2.3 查看 rails 版本,在命令行中输原创 2015-01-29 07:41:23 · 923 阅读 · 0 评论 -
Ruby Variable Scope 简单讲解
Name Begins WithVariable Scope$A global variable@An instance variable[a-z] or _A local variable[A-Z]A constant@@A class variable以一个简单例子示例各种变量的区别:c原创 2015-06-21 02:45:57 · 1247 阅读 · 0 评论 -
Rails Marshal 简单例子讲解
1. Why use Marshal?Basically anytime you want to store a whole object in byte stream and need to retrieve the object from the byte stream later.This is the situation I encountered and also why原创 2015-06-26 07:37:52 · 1041 阅读 · 0 评论 -
用map, next 和 reject 简化代码(ruby)
For example, we have this Channel class:class Channel attr_reader :id, :name def initialize(id, name) @id = id @name = name endend1.What we have:One list of objects:原创 2015-06-23 08:24:23 · 1600 阅读 · 0 评论 -
Rails用DELETE method提交表单讲解
Sometimes we need to submit form using methods other than ‘post’, in this example, it’s ‘delete’.For example, I wanted to delete a user when a form is submitted with the user name and ‘delete’ met原创 2015-07-19 08:51:15 · 1921 阅读 · 0 评论 -
Rails 使用 Google Analytics 示例
1. 下载Google Analytics, 并且初始化 tracker。 2. 设置 tracking ID 环境变量3. 把 Google Analytics view 加入 application layout4. 在一个 javascript 文件中写入追踪页面访问代码原创 2016-02-01 07:03:23 · 686 阅读 · 0 评论 -
Rails Minitest style 指南
In the test, we should use the ‘describe’, ‘context’, ‘it’ structure.Here I use a controller test as an example.I have this my_controller.rb with two controller actions:class MyControlle原创 2015-06-23 08:46:29 · 1223 阅读 · 0 评论 -
Rails add a search function controller and route best practice
How to render the search page?How to perform the search function?How to render the item list page?How to design controller, routes, and view.原创 2016-08-11 21:07:21 · 556 阅读 · 0 评论 -
Silence output of return object in IRB console on windows
Why sometimes we may want to disable outputting return object?How to disable?原创 2017-03-04 03:17:12 · 535 阅读 · 0 评论