Book Image

Redmine Plugin Extension and Development

By : Alex Bevilacqua
Book Image

Redmine Plugin Extension and Development

By: Alex Bevilacqua

Overview of this book

Table of Contents (16 chapters)
Redmine Plugin Extension and Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 4. Attaching Files to Models

One very common extension we end up having to implement in our models, be it in Redmine or in another project, is the ability to attach files. As we're working on a knowledgebase plugin, our articles could be made more informative by allowing external files to be attached as reference items.

If we were writing our own Ruby on Rails application, the process of adding file attachment capabilities is generally delegated to an external library or gem such as paperclip (https://github.com/thoughtbot/paperclip) or carrierwave (https://github.com/carrierwaveuploader/carrierwave).

Redmine has conveniently abstracted this all away for us, which makes adding file upload and attachment features almost no work at all.

We will cover the following topics in this chapter:

  • How our models are updated with the internal acts_as_attachable plugin

  • How to implement the existing file attachment view partial and what options it takes

  • Using the link_to_attachments view helper

  • How to...