rails
~/.gemrc
- ---
- :backtrace: false
- :benchmark: false
- :bulk_threshold: 1000
- :sources:
- - http://ruby.taobao.org
- :update_sources: true
- :verbose: true
- gem: --no-document --no-ri
安装本地包
gem install --local C:\rubygems-update-2.2.3.gem
rails new demo --skip-test-unit
rails server -b0.0.0.0 -p3000
找不到js
gem 'therubyracer'
连接postgresql 一定要指定port host ;少了连接不了
rails –console (-c)
reload! 修改model 可以重加载
form_for 如果你需要建立任意字段的HTML表单,而不绑在某一个Model上,你可以使用form_tag函式
simple_format是一个内建的View Helper,它的作用是可以将换行字符\n置换成<br />,有基本的HTML换行效果
<%= render :partial => 'form', :locals => {:f => f} %>
注意locals
_path 相对路径 _url绝对路径
bin/rake stats 行数统计
<%= debug(@event) %> 加在erb文件中
更为常见的是使用Logger来记录资讯到log/development.log
rails g migration add_status_to_events a:integer ….
会加到events 表中 add_xx_to_xxx格式是固定的
rails的更多相关文章
- Rails sanitize
The SanitizeHelper module provides a set of methods for scrubbing text of undesired HTML elements. T ...
- nginx中error_page没有生效(nginx+passenger+rails)
应用部署方式为 nginx + passenger + rails 当我想要用nginx来默认处理400以上状态时,发现在rails返回respose之后,nginx不会再次执行error_page( ...
- Ruby on Rails 创建https应用
1. 创建证书请求文件条件:私钥+证书签名请求+opensslyum install -y opensslmkdir /root/ssl/ && cd /root/ssl/openss ...
- Rails 5 开发进阶
Rails 5 开发进阶:https://www.gitbook.com/book/kelby/rails-beginner-s-guide/details cancan : http://blo ...
- rails程序文件名命名规范
1 一般文件名是用小写单词加下划线分割,但类的名字用骆驼法.例如 sessions_controller.rb中定义SessionsController. 2 helpers内的文件为辅助类,定义了许 ...
- rails中的form_for
1 form_for方法是ActionView::Helpers::FormHelper模块内的方法,所以可以在ActionView的实例中直接调用 2 from_for方法的原型为form_for( ...
- rails中的session
学rails toturial的时候,第八章一直觉得有点没吃透,后来看了两篇rails关于session和cookies源码分析的文章,cookie原理与实现(rails篇) 和session原理与实 ...
- Ubuntu配置Ruby和Rails
安装curl sudo apt-get install curl 安装RVM curl -L https://get.rvm.io | bash -s stable 通过RVM来安装Ruby rvm ...
- 安装 Ruby, Rails 运行环境 常见的错误
安装部署ruby on rails 的环境时并不是想的那么顺利 这个是我遇到的问题及解决的方式 参考安装博客: (1) https://ruby-china.org/wiki/install_ruby ...
随机推荐
- AsyncTask官方学习
异步任务学习 这两天使用到特别多的AsyncTask类,一块来学习一下吧 AsyncTask允许更方便和简单使用UI线程,这个类允许你在UI线程中进行后台操作和展示结果,而无需操作Thread或者ha ...
- <总结>delphi WebBrowser控件的使用中出现的bug
Delphi WebBrowser控件的使用中出现的bug: 1.WebBrowser.Visible=false:Visible属性不能使WebBrowser控件不可见,暂时用 WebBrowse ...
- 《Inside UE4》目录
<Inside UE4>目录 InsideUE4 UE4无疑是非常优秀的世界上最顶尖的引擎之一,性能和效果都非常出众,编辑器工作流也非常的出色,更难得宝贵的是完全的开源让我们有机会去从中吸 ...
- NopCommerce 增加 Customer Attributes
预期: Customer 新增一个自定义属性 运行站点 1.Admin -> Settings -> Customer settings -> Customer form field ...
- Android UI控件----ExpandableListView的基本用法
ExpandableListView介绍 ExpandableListView的引入 ExpandableListView可以显示一个视图垂直滚动显示两级列表中的条目,这不同于列表视图(ListVie ...
- COGS247. 售票系统[线段树 RMQ]
247. 售票系统 ★★☆ 输入文件:railway.in 输出文件:railway.out 简单对比时间限制:1 s 内存限制:128 MB [问题描述] 某次列车途经C个城市,城市 ...
- sicily vector有序插入
实现了简单的vector有序插入,这个题目值得注意的点是1.当vector为空时,需要判断再排除 2.迭代器的使用是此段代码的特点 int insertVector(vector<int> ...
- 通过trie树实现单词自动补全
/** * 实现单词补全功能 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #incl ...
- C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 忘记密码功能改进、手机短信、电子邮件
由于我们的系统接近有100000个用户账户,经常会有忘记密码的时候,用户多了,很小的一个功能,每天都会有很多人在用,每个功能都非常友善,会提高提系统的效率,提高用户体验. 一天最多能返回3次手机短信, ...
- jQuery如何在IE中更改网页标题
标准上来说,要改变title值要操作document而不是title节点.在IE下不能通过操作title节点来改变document.title. 本来用原生的JavaScript很简单就解决了: do ...