我想创建Redmine插件,并在该插件中我想上传文件或图像,并在显示操作中显示图像或下载文件。谁能帮我。Redmine如何上传和下载插件内的文件?
在模型
class UserInformation < ActiveRecord::Base
unloadable
belongs_to :project
acts_as_attachable :view_permission => :view_files,
:edit_permission => :manage_files,
:delete_permission => :manage_files
在控制器
class UserInformationsController < ApplicationController
unloadable
require File.dirname(__FILE__) + '/../../../../app/helpers/attachments_helper'
include AttachmentsHelper
helper :attachments
在new.html.erb
<p> <%= render :partial => 'attachments/form' %></p>
在show.html.erb
<%= link_to_attachments @info, :thumbnails => true %>
你能帮我是正确的方法?
哇这为我工作。现在我能够上传文件,但如何下载文件。我面临错误您无权访问此页面。现在看到我按照你的建议添加了模型代码 –
我最近添加了附件,并且仍然有相同的错误 我还没有弄清楚,但很可能它是通过编辑init.rb中的权限来解决的'文件: ... project_module:your_plugin做 权限:PERMISSION_NAME,{:your_model => [:actions_array]}:公众=>真正 结束 .... 外观http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial#Adding-new-permissions –
在添加init权限后面临同样的问题。 –