![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ruby
brown_zyn
这个作者很懒,什么都没留下…
展开
-
ruby怎么取html代码中的img标签
##取html代码中的第一张图片 def get_pic con="" if self.content!=nil self.content=self.content.force_encoding('utf-8') con=/(/.match(self.content) con=con.to_s.split("/>")[0]+"/>...原创 2011-10-18 19:19:42 · 133 阅读 · 0 评论 -
ruby condition
class.new 新建class.find 查询class.destroy 删除变量查询a="hahaha"Product.find(:all,:conditions=>["title like ?","%#{a}%"])Product.find(:all,:conditions=>["title like :title",:title=>"%#{a}%"])Pro原创 2011-12-12 09:58:11 · 75 阅读 · 0 评论 -
rails 自己定时间,抛出时间异常
1.抛出时间异常 begin resp, body=3Dh.get('/index.html') puts body rescue Timeout::Error => e puts "Timed Out" end 2.自己定时间,抛出时间异常 require 'ti...原创 2011-12-29 13:48:07 · 116 阅读 · 0 评论 -
rails 上传文件和删除文件
文件上传,页面代码:<%form_tag '/project/add_attach',:multipart=>true do%> <%=file_field 'path'%> <%=submit '提交'%><%end%> #文件上传处理,只需在数据库表中,记录路径就可以了,下面代码写在controlle...原创 2011-12-02 20:10:03 · 189 阅读 · 0 评论 -
ruby 新浪oauth2.0 error:redirect_uri_mismatch
注意:oauth2.0不能用localhost进行测试 1.解决新浪微博api错误(error:redirect_uri_mismatch),如下图上所显: 2.申请api地方修改基本信息中,修改“应用实际地址”改为你回调的网站路径就可以了。 ...原创 2012-07-10 13:53:52 · 111 阅读 · 0 评论 -
linux rails3 项目不行不起来
环境:linux操作系统, ruby1.9.3+rails3.2 如果出现下面问题:however, when i try to activate the server with 'rails s' or 'rails server' , I still get: /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs/runtime...原创 2012-04-06 17:01:35 · 105 阅读 · 0 评论 -
ruby 又拍云上传图片(form_api)
1.所用到的插件#cdngem 'carrierwave'gem 'rest-client'gem 'carrierwave-upyun' 2.在config/initializers文件夹下添加carrierwave.rb文件,内容:CarrierWave.configure do |config| config.storage = :upyun ...原创 2012-12-18 13:29:14 · 169 阅读 · 0 评论 -
linux 安装imagemagick + RTesseract图片解析软件
1.安装imagemagick之前,先安装tar -zxvf jpegsrc.v9.tar.gztar -zxvf libpng-1.5.2.tar.gztar -zxvf tiff-4.0.3.tar.gztar -zxvf freetype-2.4.10.tar.gz进入每个目录,安装./configuremakemake install 2.安...原创 2013-10-21 21:01:47 · 100 阅读 · 0 评论