The following plugins are copied to the implementation of rake fckeditor: install
After the success of the resumption of the implementation of web server
<% = Javascript_include_tag: fckeditor%>
There undefined method `relative_url_root 'for ActionController:: CgiRequest
Rails2.2 because this method has not been relative_url_root
So we have to change two places
app / controllers / fckeditor_controller.rb
Find
uploaded = request.relative_url_root.to_s + "# (UPLOADED) / # (params [: Type])"
Change
uploaded =
ActionController:: Base.relative_url_root.to_s + "# (UPLOADED) / # (params [: Type])"
Find
js_path = "# (request.relative_url_root) / javascripts"
Change
js_path = "# (ActionController:: Base.relative_url_root) / javascripts"
Restart the web server
ok
Upload picture
Js error appears
app / controllers / fckeditor_controller.rb
Methods upload_file into the final return to JS
render: text =>% Q '<script> window.parent.OnUploadCompleted (# (@ errorNumber), \ "# (UPLOADED) / # (params [: Type ]}/#{ Time.now.year) / # ( Time.now.month }/#{new_file.original_filename) \ ", \" # (@ new_file.original_filename) \ ", \" \ ");</ script> '
Modify upload folder
def date_directory_path
base_dir = "# (UPLOADED_ROOT) / # (params [: Type ]}/#{ Time.now.year) / # (Time.now.month)"
FileUtils.mkdir_p base_dir
"# (base_dir)"
end







