ROR
yang_kunlun
这个作者很懒,什么都没留下…
展开
-
一些有用的rails的url资源
http://www.urbanpuddle.com/articles/2008/04/28/install-ruby-on-rails-hardy-heron http://guides.rails.info/ http://api.rubyonrails.org/ http://www.opensourcerails.com/ http://railscasts.com/ http:...原创 2008-10-30 21:37:25 · 129 阅读 · 0 评论 -
检查并显示mobile页面
根据user_agent判断是否是手机设备 request.user_agent =~ /Mobile|webOS/2010-03-05 13:39:47 · 195 阅读 · 0 评论 -
架起自己的blog, 以后我的博客将更新至 http://kunlunblogs.herokuapp.com
博客辗转几个地方, 最终还是去heroku吧 http://kunlunblogs.herokuapp.com2010-03-09 12:11:10 · 126 阅读 · 0 评论 -
radiantcms
http://radiantcms.org/overview/ 支持动态页面布局2009-12-02 17:33:24 · 118 阅读 · 0 评论 -
Sphinx 高亮实现
在配置environment中加入 Ultrasphinx::Search.excerpting_options = HashWithIndifferentAccess.new({ :before_match => '', :after_match => '', :chunk_separator => "...", :limit => 256, #s:around => 2, # T...2008-12-16 14:25:21 · 343 阅读 · 0 评论 -
copy files from original dir to other dir
[code="java"] namespace :ae do desc "Copies the ActiveExt javascripts, images and css to public. HINT: use rake ae:symlink if you are unix based systems" task :copy_assets do puts "1. C...2009-06-23 14:35:28 · 99 阅读 · 0 评论 -
file copy
[code="java"]require 'ftools' namespace :ae do task :symlink_assets => :environment do vender_dir = 'vendor/plugins/activeext/public/assets/activeext' new_dir = 'public/assets/activeext...2009-06-23 14:39:27 · 129 阅读 · 0 评论 -
在日志中过滤password
在user controller中加入 filter_parameter_logging "password" 如果想完全禁止POST logging,则可以在production.rb中修改:config.log_level = :warn原创 2010-01-28 14:00:09 · 441 阅读 · 0 评论 -
a question
目前,经理想知道从A地址(例如10.1.3.1)到B地址(例如211.54.2.45)的网络状况,让你尽快的想个办法,可以指定源地址和目标地址,并且可以指定发送包的大小或者需要发送的文件,让你计算出发送完需要多少时间。你该怎么做呢? 你晓得Trackback(引用)功能么?不知道的话可以上网上搜索下,请简要说明下Trackback的特点和实现原理;你认为目前这种 Trackback有什么不足...原创 2010-01-28 20:10:50 · 165 阅读 · 0 评论 -
rails plugin-- auto_migrations
一般我们更改表结构的时候,数据会自动清空,挺麻烦的。auto_migrations为我们解决了这个问题,增加或删除表字段只需使用 rake db:schema:load2010-03-02 12:09:41 · 103 阅读 · 0 评论 -
passenger apache 设定
sudo vim /etc/apache2/httpd.conf [code="ruby"] LoadModule passenger_module /home/yang/.gem/ruby/1.8/gems/passenger-2.2.7/ext/apache2/mod_passenger.so PassengerRoot /home/yang/.gem/ruby/1.8/gem...2010-03-02 15:56:19 · 109 阅读 · 0 评论 -
passenger 工具查看内存状态
1. inspect Phusion Passenger’s internal status sudo passenger-status 2. The tool passenger-memory-stats allows one to easily analyze Phusion Passenger’s and Apache’s real memory usage passenger...2010-03-02 15:59:18 · 209 阅读 · 0 评论 -
capistrano配置
服务器文件结构 myapp/releases myapp/current -> releases/20081019001122 myapp/shared deploy任务分类 deploy:update_code deploy:symlink_shared deploy:symlink deploy:restart set :appli...2010-03-02 16:21:55 · 108 阅读 · 0 评论 -
searchlogic
This plugin help searching. you can use these methods: Product.name_like("Video") Product.name_not_like("Video").price_gt(5).price_lt(200) Product.name_like_any(["couch", "table"]) Product.name_...2010-03-03 14:57:48 · 107 阅读 · 0 评论 -
给任务传递参数
desc 'For test params' task :test => :environment do puts "get params, I am #{ENV['who']}" end 使用方法 rake test who="yang"2010-03-05 10:45:49 · 211 阅读 · 0 评论 -
扩展paperclip 增加watermark
1. /lib/paperclip processors add watermark.rb file 2. [code="java"]module Paperclip class Watermark < Processor class InstanceNotGiven < ArgumentError; end def initialize...2010-03-05 01:46:16 · 100 阅读 · 0 评论 -
ROR安装过程
Step 1: As usual, the first thing we'll want to do is make sure your version of Hardy Heron 8.04 is up to date.: sudo apt-get update sudo apt-get dist-upgrade Step 2: We'll be installing some s...原创 2008-10-30 22:08:18 · 173 阅读 · 0 评论 -
Sphinx
robbin以前曾经在JavaEye介绍过Sphinx这个性能优异的全文检索引擎: http://www.iteye.com/topic/122696 当时Sphinx还不支持中文分词,现在情况已经完全改变了。李沫南为Sphinx开发了中文分词的插件——libmmseg。对于libmmseg,robbin以前也有介绍,不过是用在Ferret里面。 http://www.iteye.com...原创 2008-11-13 15:26:34 · 4277 阅读 · 0 评论 -
新浪编辑器
在线编辑器是web应用中最常见的东西了,关于它的作用和意义我不想多说什么了。对于编辑器的使用,之前就是随便找个简单的HTML编辑器甚至是 textarea来应付,也没花多少时间来整这个东西,但事情开始逐渐变得麻烦起来,因为我们的客户(可能就是你的老板)的要求越来越高:能不能加上点丰富的表情?能不能使编辑器再多支持几种格式排版?或许有一天客户看到了搜狐的编辑器,回来说能不能让我们的编辑器也增加本地...原创 2008-11-13 15:30:53 · 190 阅读 · 0 评论 -
Ferret + Rmmseg
首先,在ubuntu下要安装 atp-get install build-essential zlib1g-dev ruby需要安装dev包 1、安装ferret sudo gem install ferret 2、安装acts_as_ferret 可用gem sudo gem install acts_as_ferret 或用plugins ...原创 2008-11-13 18:58:11 · 189 阅读 · 0 评论 -
Rails 表单
1.表单类型一 请输入用户信息 Name: 30 %> Password: 30 %> Co...原创 2008-11-14 09:36:36 · 354 阅读 · 0 评论 -
Rails view
从文本字段读取数据 输入视图: ... ... 动作: def at @date = params[:text1] end 输出视图: Your Name is 从复选框读取数据 输入视图: .. .. 动作: def at @date = params[:check1] end 输出视图: ...原创 2008-11-16 16:37:02 · 144 阅读 · 0 评论 -
匹配所有路由
*path hehe2009-05-14 11:57:38 · 267 阅读 · 0 评论 -
Mini_magick
MiniMagick中Image对象有一个shave方法,正好可以满足这个需求。在irb中运行: require ‘mini_magick’ img = MiniMagick::Image.from_file “1.jpg” #取得宽度和高度 w,h = img[:width],img[:height] #=> [2048, 1536] shaved_off = ((w-h)/2).ro...2009-05-14 13:18:10 · 126 阅读 · 0 评论 -
Ruby rake file
[code="java"]task :import_projects => :environment do o_projects = T4uproject.find(:all) for o_project in o_projects unless TimeTree.find_by_original_id(o_project.id) new_object = o_...2009-05-14 15:20:54 · 113 阅读 · 0 评论 -
ActionMailer 发送 email
配置 environment -- development.rb # Don't care if the mailer can't send [code="java"]config.action_mailer.raise_delivery_errors = true[/code] #set delivery method to :smtp, :sendmail or :test [co...2009-05-19 18:57:52 · 285 阅读 · 0 评论 -
Ruby on Rails 2.2 发行笔记
Ruby on Rails 2.2 发行笔记 1. Infrastructure Rails 2.2 is a significant release for the infrastructure that keeps Rails humming along and connected to the rest of the world. 1.1. Internationalization...2008-11-24 15:45:29 · 127 阅读 · 0 评论 -
开始学习rails 的开源项目
beast、rforum、mephisto、typo2008-11-24 22:46:01 · 142 阅读 · 0 评论 -
rails read digital photo
1 gem install exifr 2 $ irb -rubygems >> require 'exifr' true >> EXIFR::JPEG.new('IMG_1234.JPG').exposure_time.to_s 1/5002010-03-05 01:28:48 · 91 阅读 · 0 评论 -
rails' cron rufus-scheduler
1 installation sudo gem install rufus-scheduler --source http://gemcutter.org 2 usage require 'rubygems' require 'rufus/scheduler' scheduler = Rufus::Scheduler.start_new schedul...2010-03-04 15:49:47 · 159 阅读 · 0 评论