Writing to MS Access files on/via Rails app hosted on Heroku - ruby-on-rails

I'm trying to determine whether it's possible to write to an MS Access mdb file using a rails app hosted on heroku?
I'm guessing ODBC is the way to go, but am not sure of which gem etc as well as where to temporarily stick the mdb file while the rails app is operating on it.
The end result is I want to upload a csv and an access file and have the rails app import bits of the data into certain spots of the access file, then spit the edited mdb file back to the user as a download.
Any thoughts on how to attack this?

Related

Best AWS Storage Option for Exporting Directories as .zip Files?

I'm brand new to AWS products, ruby on rails, web development, and coding of any type. For my first project after a quick (and dirty) bootcamp, I'm trying to build a ruby-on-rails website that stores images and allows the user to download them as a zip file. I used the RubyZip gem to accomplish this in my EC2 dev environment, but I have deployed to Elastic Beanstalk with S3 file storage, and the RubyZip gem seems unable to handle this structure without traditional directory targets for zipping.
My question is what's the best setup to achieve this functionality in EB? Disregarding the ruby constraint, zipping an S3 directory seems tricky. Should I move to EFS or another storage system? I plan to erase the folders regularly, and limit them to ~100 photos, so long term and large size storage are not a concern. Thanks very much!
Edit: I am attached to Ruby (only language I know), but not RubyZip, AWS, or much of anything else if they are not the best approach for this task.
I think you're on the right path as far as using S3 as a solution. The problem that your facing is that when you're interacting with S3 it's not like a folder on your local system, instead you're hitting the S3 API to interact with the files. (upload, edit, delete ect). This will be a problem you'll encounter with every AWS based storage solution.
I think the solution, in your case, is to fetch all of the photos and download them to a temporary folder on your local system. Then, you could zip them using Ruby, locally. After it's zipped, upload it back to S3.
Edit: By locally I mean onto the server where the Ruby application is running (not client-side)

How do I edit .xslm file in ruby/rails without losing VBA macros?

I have some .xslm files in my project which I have to edit. My application is written in Rails. I know macro enabled files can not be edited with rubyXL or roo gem, somehow I have to edit them using Ruby/Rails gems or any tool which can be incorporated within Rails app. The application is hosted on AWS, does aws have any tool to do the same ? Plus the requirement is the macros be retained.
It turns out it is not possible to edit macro enabled excel sheets (.xlsm) files in Rails. Even though you tweaked the file somehow, MS Office will treat it as a corrupt file.

Download Excel file from web url using Ruby on Rails

I am trying to create an application that crawls a website providing free financial data in .xlsx format. They upload files once a month and not always on the same day.
Is it possible to download any new files from a specific URL and dump it into my S3 bucket, before reading it into a database? I have read up about creating a worker using Sidekiq. I expect that this will play a crucial part in the process.
Can anybody perhaps give some advice or point me to a tutorial that can help?
Yes, you can, and you don't even need Sidekiq.
Take a look at AWS SDK for Ruby, and do the following things:
Just write a ruby script that downloads the xlsx files then upload to S3. Be sure the script starts with #!/usr/bin/env ruby, and give it execute permission.
Add this script to your crontab jobs, and make it run everyday.

temporary file access using carrierwave rails?

Hi I am a ROR developer and developing an ROR application where user can upload file and share the URL to download.
I am using carrierwave for file upload and storing the file in my application (not in AWS).
I want to give permission for the user to access the upload file only for a certain period of time (for ex:1 hour).
please help me to achieve this without creating any cron jobs or before_filter method?
I found AWS has default feature for this but I am not storing the file in AWS S3. I am storing it in my local application folder, so please guide me how I can achieve this.

where should I store files in rails?

1) I am downloading datafeeds (xml) files from a URL to unzip/import them into the database. Where should I store them in the rails file structure?
2) How does the rails file structure work, can rails access the entire hosting environment? I basically mean, if I store my XML feed in /lib/files would I use that path in my models, or the longer full linux path?
Appreciate any advice!
You should probably use the tmp/ folder to store those temporary files
Its a good practice to always use the full path. You can get the rails root dir via Rails.root
Rails can access any thing that the user account under which the rails process is running, can access. ie: if you run the rails server process under root (which is not a good idea BTW), the app could access any path that root can access. This might of course be limited by whatever access control mechanisms in place by the OS(ex: SELinux).

Resources