Commit Graph

84 Commits

Author SHA1 Message Date
Koichi ITO
2b6e85c190 Should escape regexp wildcard character . 2017-08-14 22:17:50 +09:00
Matthew Draper
4ec5b7610d Merge pull request #30211 from koic/frozen_activestorage
Use frozen string literal in Active Storage
2017-08-13 21:39:38 +09:30
Ryuta Kamizono
4966b36d4c Use references to respect primary key type in active storage tables
If created active storage tables by mysql2 or postgresql adapters, a
primary key is defined as a bigint. It should be used `references` to
the reference columns to respect primary key type.
2017-08-13 13:40:39 +09:00
Koichi ITO
d02844f249 Use frozen string literal in Active Storage 2017-08-12 21:43:42 +09:00
Rafael França
4766b2da02 Merge pull request #30198 from betesh/activestorage-rack-test-uploaded-file
Activestorage rack test uploaded file
2017-08-11 17:46:02 -04:00
Rafael França
9804e4c30c Merge pull request #30147 from yhirano55/fix_trailing_blank_lines
[Active Storage] `rubocop -a --only Layout/TrailingBlankLines`
2017-08-11 17:36:22 -04:00
Rafael França
8562404c6b Merge pull request #30113 from dixpac/remove_unecessary_require_in_test_helper
ActiveStorage: Remove unnecessary require in test_helper
2017-08-11 17:35:18 -04:00
Rafael Mendonça França
1eb8f88028 Remove unnedded Active Storage installation steps
Active Storage was now merged to master and it is automatically
installed in a new application.
2017-08-11 17:19:04 -04:00
Rafael França
72e311c3db Merge pull request #30201 from kamipo/eval_active_storage_attached_name_only_once
Evaluate `@active_storage_attached_#{name}` only once
2017-08-11 14:54:47 -04:00
Rafael França
9774322246 Merge pull request #30202 from kamipo/add_null_false_to_active_storage_tables
Add `null: false` to Active Storage tables
2017-08-11 14:54:33 -04:00
Isaac Betesh
4287f089d3 Make activestorage treat Rack::Test::UploadedFile just like ActionDispatch::Http::UploadedFile 2017-08-11 14:43:19 -04:00
Ryuta Kamizono
d76b2f9e55 Add null: false to Active Storage tables
These columns aren't intended nullable.
2017-08-12 02:33:38 +09:00
Anton Khamets
e25466b142 Enable browser caching for blobs and variants (#30196) 2017-08-11 13:18:12 -04:00
Ryuta Kamizono
bef99313e9 Evaluate @active_storage_attached_#{name} only once
Currently `"@active_storage_attached_#{name}"` in `define_method` is
evaluated every call. It is better to evaluate it only once.
2017-08-12 01:59:36 +09:00
Ryuta Kamizono
de80aa6412 Microsoft Azure --> Microsoft Azure Storage [ci skip] 2017-08-12 01:20:23 +09:00
Koichi ITO
d90f261562 Fix formatting of Active Storage docs [ci skip]
Follow up of #30188.
2017-08-11 13:15:23 +09:00
yuuji.yaginuma
8458dbfa00 Fix formatting of Active Storage docs [ci skip]
* Use `+` instead of backquote.
* Remove escape from class to be link
2017-08-11 10:21:40 +09:00
George Claghorn
e43ba973a3 Run Active Storage tests in CI (#30144) 2017-08-10 15:58:30 -04:00
Dino Maric
a3f7407e7c Isolate ActiveStorage namespaces (#30095)
* Isolate ActiveStorage namespaces

* Rename migrations task

[Rafael Mendonça França + Dino Maric]
2017-08-10 14:02:29 -04:00
qsona
7cfa80f812 Fix a typo 2017-08-10 12:11:28 +09:00
dixpac
e1f1213c8b Remove unecessary require in test_helper 2017-08-09 08:45:15 +02:00
Yoshiyuki Hirano
d9a283500f [Active Storage] rubocop -a --only Layout/TrailingBlankLines 2017-08-09 14:31:15 +09:00
Rafael França
96bcaedf1d Merge pull request #30112 from dixpac/filter_minitest_backtrace
ActiveStorage:Filter out Minitest backtrace.
2017-08-08 18:38:25 -04:00
Rafael França
673fb4c433 Merge pull request #30118 from georgeclaghorn/active-storage-load-hooks
Set ActiveStorage::Blob.service when ActiveStorage::Blob is loaded
2017-08-08 17:10:58 -04:00
George Claghorn
caf7e62301 Set ActiveStorage::Blob.service when ActiveStorage::Blob is loaded
Fixes that ActiveStorage::Blob.service is unset when ActiveStorage::Blob
is reloaded.
2017-08-08 14:56:27 -04:00
Rafael Mendonça França
1422e9f9c9 Merge pull request #30135 from ffmike/azure-storage-fix-content-type
Support content_type in AzureStorageService#url
2017-08-08 14:42:03 -04:00
Dino Maric
4b72bee47b ActiveStorage:Add migrations per rails engine conventions (#30111)
* Add migrations per rails engine conventions

* Fix failing tests
2017-08-08 09:47:38 -05:00
Mike Gunderloy
6ef3794013
Support content_type in AzureStorageService#url
Add in the content_type option, which is defined as part of the generic
ActiveStorage::Service class.

Without this option, attempts to generate a URL for an attached file
fail with "ArgumentError (unknown keyword: content_type)"
2017-08-08 09:35:42 -05:00
Anton Khamets
7c89948c41 Extend image_tag to accept ActiveStorage Attachments and Variants (#30084)
* Extend image_tag to accept ActiveStorage's Attachments and Variants

* Flip resolve_image_source around

* Add tests for the new use-cases of image_tag

* Remove the higher-level test

* Update image_tag documentation

* Add error states into the test suite

* Re-raise polymorhic_url's NoMethodError as ArgumentError

* delegate_missing_to will raise DelegationError instead of NoMethodError
2017-08-07 09:38:51 -05:00
dixpac
d44e737a76 Filter out Minitest backtrace.
Filter out Minitest backtrace while allowing backtrace from other
libraries to be shown.
2017-08-07 11:40:20 +02:00
bogdanvlviv
ee0378b638
Active Storage to 5.2.0.alpha inside activestorage/package.json
Follow #30083
2017-08-06 17:23:07 +00:00
Vipul A M
1fe55e94b7 Pass over Active Storage readme [ci skip] (#30086) 2017-08-06 13:44:45 +05:30
David Heinemeier Hansson
616f3611d5 Merge branch 'master' into ast-module 2017-08-05 09:11:02 -05:00
David Heinemeier Hansson
6df24c693e Merge pull request #30068 from kamipo/user_start_with_than_regexp
Use `content_type.start_with?("...")` than `content_type =~ /^.../`
2017-08-05 09:07:38 -05:00
David Heinemeier Hansson
b360f07bd2 Merge pull request #30081 from y-yagi/fix_ruby_warnings
Fix ruby warnings
2017-08-05 09:07:07 -05:00
David Heinemeier Hansson
ea5c99dce1 Merge pull request #30080 from georgeclaghorn/active-storage-secret-key-base
Active Storage: check for `app.secrets.secret_key_base`, not `app.config.secret_key_base`
2017-08-05 09:06:32 -05:00
David Heinemeier Hansson
1c96ca2d44 Merge pull request #30083 from koic/change_gem_version_of_active_storage_to_5_2_0
Change gem version of Active Storage to 5.2.0.alpha
2017-08-05 09:05:25 -05:00
George Claghorn
1ab1f87596 Check for app.secrets.secret_key_base, not app.config.secret_key_base
By default, apps only have the former set.
2017-08-05 10:03:53 -04:00
dixpac
2b9e04b6f9 Remove unecesarry exception variable 2017-08-05 14:05:18 +02:00
Koichi ITO
10a7ae39c6 Change gem version of Active Storage to 5.2.0.alpha 2017-08-05 14:24:31 +09:00
yuuji.yaginuma
46db463d06 Fix ruby warnings
This fixes following warnings:

```
test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator
lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized
lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized
```
2017-08-05 12:22:39 +09:00
claudiob
bb7599a6c8 module ActiveStorage, not ActiveStorage::Class
The reasons for this commit are:

- uniformity with the other Rails libraries
- (possibly) behave better with respect to autoloading
- fix the index in the generated documentation

Before this commit, run `rake rdoc` generates this left sidebar
(ActiveStorage entries are indexed twice, both inside and outside the module):

<img width="308" alt="before" src="https://user-images.githubusercontent.com/10076/28939523-7c087dec-7846-11e7-9289-38ed4a2930cd.png">

After this commit, run `rake rdoc` generates this left sidebar:
(ActiveStorage entries are only indexed inside the module):

<img width="303" alt="after" src="https://user-images.githubusercontent.com/10076/28939524-7c090be0-7846-11e7-8ee5-29dfecae548e.png">
2017-08-04 16:40:10 -07:00
yuuji.yaginuma
70d0e53db7 Fix repository URL [ci skip]
changed `rails/activestorage` to `rails/rails`.
2017-08-05 08:25:29 +09:00
Ryuta Kamizono
6768390a42 Use content_type.start_with?("...") than content_type =~ /^.../
`start_with?` is a little faster than regexp for prefix matching by a
fixed string.
2017-08-05 08:10:13 +09:00
Dino Maric
3179f089be Rename Azure to AzureStorage (#30057) 2017-08-04 17:57:02 -05:00
Claudio B
b9f0eb24ed Fix tests for AWS buckets that include a . (#30059)
If an AWS bucket name includes a `.` (e.g. `bucket.name`), then the canonical
URL for an object will start with "https://s3.amazonaws.com/bucket.name/"
and not with "https://bucket.name.s3.amazonaws.com/".

The URL tests have now been separated into two separate asserts, to ensure
that both the "s3.amazonaws.com" and the "bucket.name" components are included,
but not specifically in that order.
2017-08-04 17:56:14 -05:00
Rafael Mendonça França
77be872819 Do not change the entire codebase style only because of active_storage
We are already removing the braces around hash parameters in the last
argument in other places so we should not change the entire codebase
because of two places.
2017-08-03 17:45:58 -04:00
Rafael Mendonça França
b76f4e47e8 Fix all rubocop violations 2017-08-03 17:32:59 -04:00
Rafael França
66e5bf9d07 Merge pull request #30061 from claudiob/ast-rubocop
Make Rubocop happy about ActiveStorage
2017-08-03 17:24:45 -04:00
Rafael Mendonça França
5bfff1de54 We need to require the top file before individual one 2017-08-03 17:02:43 -04:00