-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ tmp | |
public/assets | ||
public/system | ||
public/uploads | ||
storage | ||
vendor/bundle | ||
|
||
# no configuration | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'active_storage/service/disk_service' | ||
|
||
module FoodsoftActiveStorageDiskService | ||
def self.included(base) # :nodoc: | ||
base.class_eval do | ||
def path_for(key) | ||
File.join root, FoodsoftConfig.scope, folder_for(key), key | ||
end | ||
end | ||
end | ||
end | ||
|
||
ActiveSupport.on_load(:after_initialize) do | ||
ActiveStorage::Service::DiskService.include FoodsoftActiveStorageDiskService | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
test: | ||
service: Disk | ||
root: <%= Rails.root.join("tmp/storage") %> | ||
|
||
local: | ||
service: Disk | ||
root: <%= Rails.root.join("storage") %> | ||
|
||
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) | ||
# amazon: | ||
# service: S3 | ||
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> | ||
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> | ||
# region: us-east-1 | ||
# bucket: your_own_bucket | ||
|
||
# Remember not to checkin your GCS keyfile to a repository | ||
# google: | ||
# service: GCS | ||
# project: your_project | ||
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> | ||
# bucket: your_own_bucket | ||
|
||
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) | ||
# microsoft: | ||
# service: AzureStorage | ||
# storage_account_name: your_account_name | ||
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> | ||
# container: your_container_name | ||
|
||
# mirror: | ||
# service: Mirror | ||
# primary: local | ||
# mirrors: [ amazon, google, microsoft ] |
27 changes: 27 additions & 0 deletions
27
db/migrate/20190101000000_create_active_storage_tables.active_storage.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This migration comes from active_storage (originally 20170806125915) | ||
class CreateActiveStorageTables < ActiveRecord::Migration[4.2][5.2] | ||
def change | ||
create_table :active_storage_blobs do |t| | ||
t.string :key, null: false | ||
t.string :filename, null: false | ||
t.string :content_type | ||
t.text :metadata | ||
t.bigint :byte_size, null: false | ||
t.string :checksum, null: false | ||
t.datetime :created_at, null: false | ||
|
||
t.index [ :key ], unique: true | ||
end | ||
|
||
create_table :active_storage_attachments do |t| | ||
t.string :name, null: false | ||
t.references :record, null: false, polymorphic: true, index: false | ||
t.references :blob, null: false | ||
|
||
t.datetime :created_at, null: false | ||
|
||
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true | ||
t.foreign_key :active_storage_blobs, column: :blob_id | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters