FCKeditor
#undefined method `relative_url_root' for #<ActionController::CgiRequest:0x23b026>
#There is been a Fix for Rails 2.2
#in the file app/controllers/fckeditor_controller.rb
#look for
uploaded = request.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"
#replace it with this
uploaded =
ActionController::Base.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"
#similarly in the file lib/fckeditor.rb
#replace
js_path = "#{request.relative_url_root}/javascripts"
#with
js_path = "#{ActionController::Base.relative_url_root}/javascripts"
Decompression to the vendor \ plugins, rename FCKeditor
>rake fckeditor:install
Usage
#view中添加
<%= javascript_include_tag :fckeditor %>
#textarea替换为
<%= fckeditor_textarea("book", "desc",
{ :toolbarSet => 'Simple', :width => '100%', :height => '200px' }) %>
Paging
will_paginate
>gem sources -a http://gems.github.com >gem install mislav-will_paginate
Usage
Picture
RMagick
http://rubyforge.org/projects/rmagick/
Rmagick-win32 download
Install windows-dll.exe & gem
Verification Code Rmagick
#ImageMagick_root/config/type.xml, 注释掉 <include file="type-ghostscript.xml" />
http://world.javaeye.com/blog/40766
* If out of ruby.exe compiler errors reported Backgrounds can not read pictures, for an earlier version of RMagick-2.7.1-ImageMagick-6.4.5-3-Q8.zip
Upload
file_column
#rails2.2 uninitialized constant FileColumn::ClassMethods::Inflector #找到 vender/plugins/file_column/lib/file_column.rb 的 619行 my_options = FileColumn::init_options(options, Inflector.underscore(self.name).to_s, attr.to_s) #改成 my_options = FileColumn::init_options(options, ActiveSupport::Inflector.underscore(self.name).to_s, attr.to_s) #in the file lib/file_column_helper.rb 找到 url << request.relative_url_root.to_s << "/" #改成 url << ActionController::Base.relative_url_root.to_s << "/"
Usage
Decompression to the vendor \ plugins;
Modify vendor \ plugins \ file_column \ lib \ file_column_helper.rb
Ways url_for_file_column ri @ request into a request
Modify
#找到vendor\plugins\file_column\lib\file_column.rb 的 FileUtils.mv(local_file_path, new_local_file_path) unless new_local_file_path == local_file_path #改成 FileUtils.mv(local_file_path, new_local_file_path) unless new_local_file_path.downcase == local_file_path.downcase
* vendor under the plug-ins are required to amend the entry into force restart Mongrel.
#model里添加:
validates_format_of :image,
:with=>/^.*(.jpg|.JPG|.gif|.GIF)$/,
:message => "只允许上传JPG或GIF"
file_column :image, :magick => {
:versions => { "thumb" => "50x50", "medium" => "640x480>" }
}
#_form里:
<%= file_column_field 'entry', 'image' %>
#show里:
<%= image_tag url_for_file_column 'entry', 'image' ,'thumb'%>








Responses to “Practical Rails plug-ins”