Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding helper to generate App Zip File #7

Merged
merged 1 commit into from

1 participant

@creativepsyco

No description provided.

@creativepsyco creativepsyco merged commit ec368ae into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2013
This page is out of date. Refresh to see the latest.
View
4 app/controllers/apps_controller.rb
@@ -1,5 +1,6 @@
class AppsController < ApplicationController
- before_filter :authenticate_user!
+ include AppsHelper
+ before_filter :authenticate_user!, :except => [:index, :show]
# GET /apps
# GET /apps.json
def index
@@ -18,6 +19,7 @@ def show
respond_to do |format|
format.html # show.html.erb
+ format.zip { generate_zip(@app) }
format.json { render json: @app }
end
end
View
3  app/helpers/apps_helper.rb
@@ -1,2 +1,5 @@
module AppsHelper
+ def generate_zip(app)
+ send_file "#{Rails.root}/public#{app.appFile.url(:original, false)}"
+ end
end
View
2  config/initializers/mime_types.rb
@@ -3,3 +3,5 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
+
+Mime::Type.register "application/zip", :zip
Something went wrong with that request. Please try again.