ruby on rails
ltl3885
这个作者很懒,什么都没留下…
展开
-
rails jcode
由于当前的ruby并不支持unicode, 所以中文相关的处理在ruby中一直比较模糊,基本上是各自尝试的路子, 我也列出一些帮助自己整理思路utf8和unicode的关系utf其实是(Unicode Translation Format), 也就是unicode在传输时候的编码, 有utf8和utf16等多种编码, 其实uf8是一个对中文字很不友好的编码, 为什么呢,因为在utf...2010-05-04 14:06:58 · 102 阅读 · 0 评论 -
vim ruby 格式化代码
1)复制 /usr/share/vim/vim72/indent/ruby.vim 至 /usr/share/vim/vimfiles/indent (indent目录可能需要自己创建)2)在indent目录中修改ruby.vim 最后一行添加 set sw=23)在 ~/.vimrc 中添加如下代码 [code="ruby"]if has("a...原创 2012-04-10 14:39:39 · 212 阅读 · 0 评论 -
imagemagick rmagick
1. 安装ImageMagick:sudo apt-get install imagemagick 2. 查看安装结果:dpkg -l | grep magick 3. 更新软件包列表:sudo apt-get update 4. 安装图片处理软件包libmagick9-dev:sudo apt-get install libmagick9-dev ruby1.8-d...原创 2011-11-13 20:46:19 · 122 阅读 · 0 评论 -
Rails3 Route 用法集锦[转]
http://blog.sina.com.cn/s/blog_6721c4c70100ooeb.html默认路由:Ruby代码# Rails3: match '/:controller(/:action(/:id))' # Rails2: map.connect ':controller/:action/:id' 正则路由:Ruby代码# Rai...原创 2011-11-13 13:52:34 · 125 阅读 · 0 评论 -
file path
一直能看到一些gem里面会有这样一句代码:$:.unshift File.expand_path('..', __FILE__)这句话是干什么用的呢$:就是ruby的一个全局变量,也叫$LOAD_PATH,功能就是java中的classpath,用来加载类库的,当你require某个文件时,ruby就会从这个变量的值去查找,找不到会报LoadError。这个值其实就是一个包含了类库绝对...原创 2011-11-09 22:31:20 · 209 阅读 · 0 评论 -
Useful Rails3 Commands – Cheatsheet
Some of useful Rails3 Commands and their descriptions are listed below:rails new ApplicationName – Create a new applicationrails new ApplicationName -d mysql - Create a new application use MySQ...原创 2011-11-04 11:39:23 · 63 阅读 · 0 评论 -
ruby irb方向键 delete等
如果是ubuntu下面apt-get install libreadline5 libreadline5-dev原创 2011-11-01 13:45:44 · 196 阅读 · 0 评论 -
Rspec
http://www.iteye.com/topic/166208http://www.ibm.com/developerworks/cn/web/wa-rspec/index.html原创 2011-10-31 21:07:43 · 53 阅读 · 0 评论 -
ruby发布gem包
uby中有很多插件以gem包的形式提供,方便了插件的安装,卸载,升级,也方便了插件的调用。随着对ruby的深入应用,未免自己也会开发一些有用的插件,这里提供gem包的制作方法。1) 创建Gem包结构创建命令为:gpgen yourgem,执行命令后会自动生成一个标准的gem包结构:yourgem│ COPYING│ LICENSE│ Rakefile│ README...原创 2011-08-04 10:00:04 · 206 阅读 · 0 评论 -
memoization 性能
http://rails-bestpractices.com/posts/59-use-memoization原创 2010-12-10 14:38:21 · 68 阅读 · 0 评论 -
ruby script/console readline报错
/usr/local/lib/ruby/1.8/i686-linux/readline.so: libreadline.so.5: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/1.8/i686-linux/readline.so (LoadError) from /usr/loc...原创 2010-11-17 16:30:28 · 77 阅读 · 0 评论 -
select_tag写法
[code="ruby"]record.type_id))%>[/code]原创 2010-10-29 17:58:14 · 135 阅读 · 0 评论 -
rail链接oracle乱码
在environment.rb中 ENV['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.AL32UTF8'原创 2010-10-13 15:11:59 · 81 阅读 · 0 评论 -
安装curb
如果gem intall curb失败了可以:wget http://curl.haxx.se/download/curl-7.16.2.tar.gztar xvfz curl-7.16.2.tar.gzcd curl-7.16.2makemake installgem install curb原创 2010-07-05 09:17:45 · 287 阅读 · 0 评论 -
ruby 读取网上的文件
require 'net/http'require 'uri'url = URI.parse('http://www.infoq.com/') (1..53).each do |i| res = Net::HTTP.start(url.host, url.port) {|http| http.get("/resource/p...原创 2010-06-04 10:13:11 · 109 阅读 · 0 评论 -
ActionController::InvalidAuthenticityToken解决办法
第一种:Ror代码 1. class FooController < ApplicationController 2. protect_from_forgery :except => :index 3. 4. # you can disable csrf protection on controller-by-controller ...原创 2010-08-09 10:45:26 · 97 阅读 · 0 评论 -
install snipMate
# install snipMatecd /tmpwget http://www.vim.org/scripts/download_script.php?src_id=10801 -O vim_plugin_snipMate.ziprm -rf vim_plugin_snipMateunzip -d vim_plugin_snipMate vim_plugin_snipMate....原创 2012-04-10 14:42:48 · 204 阅读 · 0 评论