【发布时间】:2015-07-20 10:12:26
【问题描述】:
我正在尝试创建 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 %>
你能帮我看看正确的方法吗?
【问题讨论】:
标签: ruby-on-rails redmine redmine-plugins