- 浏览: 160969 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
GunChin:
有些复杂,看得不是很懂
RAILS -
shellfish:
恩,红帽默认的SELinux的级别是强制,这个一般我不大用,装 ...
华思服务器一个奇怪问题的解决方法 -
机器人:
你说得太好了了了了了了了 子 啊啊啊啊,呼啦啦。
GIT handbook -
hbxiao135:
能介绍下 fat free crm的 流程分析吗?
(CRM)customer relationship management sysetm
1.file_column git clone git://github.com/activescaffold/file_column.git gem install rmagick model: file_column :photo, :magick => { :versions => { "thumb" => "100x100>", "medium" => "640x480>" } } view: <%= image_tag(url_for_file_column('profile', 'photo', 'thumb')) if @profile && @profile.photo %><%= file_column_field 'profile', 'photo' %> web example: Attention: I will be speaking at the Canada on Rails conference, which will be held on April 13th-14th in Vancouver, Canada. David Heinemeier-Hansson will be giving a keynote and there are a lot of other big names on the list of speakers. I'm honored to give a talk about file_column and developing plugins in general. This library makes handling of uploaded files in Ruby on Rails as easy as it should be. It helps you to not repeat yourself and write the same file handling code all over the place while providing you with nice features like keeping uploads during form redisplays, nice looking URLs for your uploaded files and easy integration with RMagick to resize uploaded images and create thumb-nails. Files are stored in the filesystem and the filename in the database. Example As you can judge a library best by looking at how to use it, here is a short example: Just make the "image" column ready for handling uploaded files... class Entry < ActiveRecord::Base file_column :image end ... generate file fields that keep uploaded images during form redisplays to your view... <%= file_column_field "entry", "image" %> ... and display uploaded images in your view: <%= image_tag url_for_file_column("entry", "image") %> It's just as easy! Why should it be any more difficult for a Rails application? So what about the RMagick integration? Have a look: To resize every uploaded image to a maximum size of 640x480, you just have to declare an additional option. class Entry < ActiveRecord::Base file_column :image, :magick => { :geometry => "640x480>" } end You can even automatically create versions in different sizes that have nice filenames... class Entry < ActiveRecord::Base file_column :image, :magick => { :versions => { "thumb" => "50x50", "medium" => "640x480>" } } end ... and display them in your view: <%= image_tag url_for_file_column("entry", "image") %> 值得注意的是,如果你用在其他的页面显示这张图片,必须存在这个实例变量@xxx eg. <% @profiles.each do |@profile|%> <%= image_tag(url_for_file_column('profile', 'photo', 'thumb')) if @profile.photo %> end bug: uninitialized constant FileColumn::ClassMethods::Inflector solution: go to file_column.rb go to line 619 add “ActiveSupport::” before “Inflector.underscore(self.name).to_s,” to give => “ActiveSupport::Inflector.underscore(self.name).to_s,”
发表评论
-
actionmailer发送邮件失败的问题解决记录
2011-05-24 14:12 2297我们公司的WLAN网管采用ruby on rails架构,同时 ... -
ROR rake
2009-10-20 14:05 997原文: Ruby on Rails Rake Tuto ... -
控制器内部对请求的操作
2009-10-20 13:41 1804控制器内部对请求的操作 一Action方法 1 ... -
在rails环境中直接执行sql语句而不需要创建MODEL
2009-09-23 10:54 2961标准格式是:ActiveRecord::Base.connec ... -
6 Steps To Refactoring Rails (for Mere Mortals)
2009-07-31 11:26 832Since December, Rails ... -
rails 中简单的创建保存一条信息
2009-07-20 09:43 685Securitylog.new( # :ses ... -
uninstall all gems
2009-07-14 11:31 840GEMS=`gem list --no-versions` ... -
rails 拖拉排序效果demo
2009-06-30 10:55 1324要為Ruby on Rails程式加入拖曳排 ... -
something about with_scope
2009-06-23 10:53 1120今天看了一点关于with_scope的知识,有点感觉,写点东西 ... -
Add jQuery datagrids to your Rails applications
2009-06-03 10:39 1488Add jQuery datagrids to your Ra ... -
Multiple Attachments in Rails
2009-06-03 10:19 1792Multiple Attachments in Rails ... -
REST on Rails之自定义路由
2009-06-03 10:03 1649REST on Rails之自定义路由 from L ... -
自定义will_paginage输出
2009-06-03 09:55 766自定义will_paginage输出 from Le ... -
Rails Cookie测试
2009-06-03 09:48 1046Rails Cookie测试 from Le ... -
配置ActionMailer使用GMail发送邮件
2009-06-03 09:45 1417配置ActionMailer使用GMail发送邮件 ... -
rails 记住跳转前的url
2009-06-02 13:44 1349def store_location ses ... -
给Non-ActiveRecord Objects进行validate
2009-06-02 09:33 856对于非ActiveRecord对象的Validation,我们 ... -
cookie + js动态修改iframe 父窗口的链接参数
2009-04-21 18:12 2788取得 由于最近自己做的项目中采用了目前较为流行的经典左右结构 ... -
git 冲突解决
2009-04-21 17:57 5134比较笨的办法就是直接改本地的代码 先git pull ,他 ... -
git 下gw来查看团队的修改
2009-04-07 15:46 823首先开启一个命令行,在命令行中输入 alias gw= ...
相关推荐
当我们设置数据库的归档路径时,就没有必要在使用db_recovery_file_dest参数,可是如果db_recovery_file_dest_size的值不为0,那么该如何设置呢?
主要介绍了zlib压缩库中函数file_compress和file_uncompress的使用方法,有挺多的测试例子,已验证完毕
JZKO_File_16_addonsJZKO_File_16_addonsJZKO_File_16_addonsJZKO_File_16_addonsJZKO_File_16_addonsJZKO_File_16_addonsJZKO_File_16_addonsJZKO_File_16_addons
__FILE__,__LINE__,FUNCTION__实现代码跟踪调试(linux下c语言编程 )
flv官方文档----video_file_format_spec_v10_1
File_System_Auditor文件系统审计软件可以实现对共享文件的审计(日志可追溯事件当天),可在Windows Server 2008 R2 64位系统及以上操作系统安装和运行。
swf_file_format_spec_v9.pdf swf_file_format_spec_v9.pdf swf_file_format_spec_v9.pdf swf_file_format_spec_v9.pdf
文件服务器文件监控审计软件
file_put_contents的使用说明
swf_file_format_spec_v9.pdf
Adobe_Flash_File_Video_Format_Specification_v10_1是adobe flash视频文件格式规范文档,用于描述flv和f4v的文件格式标准规范的文档
图片上传插件 file_upload 适用框架:Yii2.0高级版(基础版使用需要适当修改)
file_list.php,file_list.php
linksys_next_file_file_disclosure
localfile_1_0_0.dll: %1 不是有效的 Win32 应用程序。替换文件
原文链接:https://blog.csdn.net/m0_37814112/article/details/122538085 说明:基于file_sd_configs部署blackbox-exporter监控k8s服务
Http_File_Server一个非常简单的架设http的小软件 超好用
video_file_format_spec_v10 标准文件 Adobe Flash Video File Format Specification (Version 10.1) The open F4V/FLV specification documents file format information for storing media content used to ...
file_html_java,file_html_java,file_html_java
zgraphix/public/FusionCharts/FCF_Column2D.swf. Fetching contributors… Cannot retrieve contributors at this time. Raw History. executable file 18.9 KB.