I have a Ruby on Rails application where users can upload files. We run this application in production on home-rolled linux servers. (No Heroku or anything like that.) Using the carrierwave gem, they get stored on AWS S3. Very simple and straight-forward.
If someone wanted to view or modify those files that are stored on S3 without having to download them, open them in Word or Excel, and then reupload- how could that be done?
The only people who have seemed to implement something like this are Dropbox and Citrix ShareFile. They did it using Office Online.
I don't mind moving file storage off S3 to somewhere else (or even something home-rolled) to implement this feature- but it needs to be as reliable and robust as S3.
We've tried to something with WebDAV, but it is fragile and seems to be deprecated.
We would consider any solution, paid or free.
You can indeed use the WOPI framework for this. There are quite a lot of resources and code samples for this, of which the most useful might be This Github Repo. The framework allows you to programmatically integrate into the Word Online viewer/editor.
Hope this helps,
Jesse
Related
Active Storage stores uploads in a file structure like so:
This is great if the rails app is the only software that needs to use these files.
But what if the app simply serves as a means to upload the images to S3 so that some other (completely separate) service can consume them?
The problem being, other developers wouldn't be able to make any sense of the directory and files, since they're labelled in a way rails can understand, but which a human cannot (e.g. what does folder named "O2" mean?).
Is there some way to ensure uploads are stored in a human-friendly way? e.g. each folder could be a user_id, with their assets inside? (or similar)
As far as I remember, you would have to implement an own service that somehow replace the key used to something else (e.g. S3Service), or patch ActiveStorage to create the key itself in a different way. I am not sure that this would suffice though, as the key is most likely used for other critical functionality outside of the Service.
Alternatively you might poke in ActiveStorage::Blob to fiddle with the key. That said, ActiveStorage does not support what you'd like out of the box and you would have to take the risk of messing with its internals.
A solution to the problem (but not answer to you question) might be implementing an API as outlined in the comments to your question.
I have developed a relatively simple Rails web application that others (non-programmers) may find useful. I would like to provide a web interface for anyone who wants to create their own copy of my app and change some minor settings, like the appearance, the name of the app and some of its resources, that type of thing. What kind of technology would allow me to do this? Thank you in advance!
GitHub is probably one of the most popular tools to support this, but there are many others such as SourceForge. I'd start from there and do some research to decide the best one for your purposes.
The best way to collaborate code online is through git. The most popular sites for git management include GitHub and BitBucket. Here's a good article suggesting nine alternatives.
However, you stated it would be used by "non-programmers". I can't tell if they will find it useful through the function of the application or the simplicity of the code, so it seems reasonable to also suggest non-git options.
You could use something like Amazon Web Services or Google Cloud to host the static files. See the AWS S3 docs regarding creating a bucket and adding an object.
If you would like to host the entire application online and allow users to easily edit and view the application in-browser, check out cloud9.
I need a tiny (less than 100 total) document store in a Rails 3.2 app where a user can create, edit, save, and delete rich text documents (ideally including images and other attached items). There is no file system available. Everthing must go in PostgreSQL database tables. The documents will serve as system-wide email and message banner templates.
My approach has been CKEditor. But the ckeditor gem seems wired for attachments as files. Also, it does not provide create/update storage of the document itself, just attachments.
I know how to roll my own model/controller/view the CKEditor but surely there's a simpler way.
So what is the most direct way to my goal of the rich text document store? Is there a plugin or gem?
More CKEditor references: This thread makes it look like a major project, but it's 2 years old. This one makes it sound like the default, but no other document does.
More
Using S3, Dropbox as suggested are also nogo. As I said, data must reside in PgSQL tables. Good news: found the paperclip_database gem. Bad news: doesn't work seamlessly with the ckeditor gem. The main issue boils out to this bit in the source file database.rb:
def setup_paperclip_files_model
#TODO: This fails when your model is in a namespace.
Indeed it does, as in the Ckeditor::Asset model! Trying a monkey patch now. If anyone has already made these three gems work together correctly, I'll give you the bounty for a pointer!
Pretty sure CKEditor makes it fairly simple to edit database form fields, which is all you'd need for editing the document itself, correct?
As far as attachment storage, you can use paperclip to manage the attachments -- file storage is just the default. If you use paperclip, you can then use one of many storage options from there, such as Amazon S3 storage, Dropbox, or create your own.
Hope that helps.
The first thread you linked to has it correctly: you need to (find or) write a custom server connector, and configure CKEditor to use it. You can find the relevant updated docs here:
http://docs.ckeditor.com/#!/guide/dev_file_browser_api
I've looked at the available options and it seems like everything is optimized for image uploading as display. I just need simple file upload and retrieval. Are there any good options?
Paperclip is a popular choice for uploading and sizing images, but you can upload any type of file with it (doc, zip, txt, pdf... anything). Highly recommended. https://github.com/thoughtbot/paperclip
I like carrierwave. It has built in support for s3, has no workaround for setting up apps on heeroku unlike paperclip.
I use Carrierwave for mine and have been happy with it. I am just uploading general files, not specifically images. It is easy to implement and has good advanced features if you need them later. It also integrates with Fog to make using remote storage sources (like s3 or rackspace cloud files) easy.
Carrierwave benefits:
With carrierwave, the attachment is a seperate model instead of an attribute on an existing model, which might make things cleaner to work with.
It comes with the ability to attach a file via url (user passes in a url to a file) instead of uploading with a form).
It comes with some sort of way to remember files across form validation failures, although I've never used this and I'm not sure how it's done... maybe with two forms and ajax?
It seems to have a more engaged and enthusiastic community around it, with more projects extending it.
For S3, they use fog instead of aws-s3, and fog has much more active development.
That said, paperclip is pretty great and is actively maintained, and might come with handier default image manipulation stuff, I'm not sure.
Is there a defacto way of doing an Ajaxy file upload in Rails? (I say "Ajaxy" because it can't really use XHR).
I've read about various approaches and plugins. Wondering what's the cleanest/most approved of by the community.
Thanks!
SWFUpload is a common tool for Ajaxy uploads.
Here are a couple links that should integration with Rails.
http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload
http://thewebfellas.com/blog/2008/12/22/flash-uploaders-rails-cookie-based-sessions-and-csrf-rack-middleware-to-the-rescue
If you dont want the uploader bases on flash, you can check http://blueimp.github.com/jQuery-File-Upload/ its pretty cool.
I've used responds_to_parent with success on several projects.
The idea is that you're doing a full POST to an iframe embedded on the page. The responds_to_parent plugin adds some helpful functionality to then execute success or failure javascript in the context of the main page.
I've had a good time with Plupload. There is a plupload-rails gem (I don't trust the plupload-rails3, it's too automated, but might be fine). It offers several runtimes (html5,html4,flash,silverlight,gears,...) and they can be setup as fallbacks for each other, so you can support all clients no matter if they have silverlight or flash or even if they use internet explorer.
jQuery-File-Upload looked nice, and I almost used it in mu last project, but I had a very hard time getting it to play nicely with Internet Explorer. (I was also using Amazon S3, which complicated things)
I just saw the date, I hope new comers find this useful.