Go to file
David Heinemeier Hansson aaf8415188 Add attachments
2017-07-05 15:18:50 +02:00
lib Add attachments 2017-07-05 15:18:50 +02:00
test Add attachments 2017-07-05 15:18:50 +02:00
.gitignore Ignore byebug history 2017-07-01 12:09:54 +02:00
activevault.gemspec Rename from ActiveFile to ActiveVault since activefile gem name was taken 2017-07-05 13:06:29 +02:00
Gemfile Use lazy-loaded factory method for site configuration 2017-07-04 16:44:50 +02:00
Gemfile.lock Rename from ActiveFile to ActiveVault since activefile gem name was taken 2017-07-05 13:06:29 +02:00
MIT-LICENSE First sketching 2017-06-30 19:12:58 +02:00
Rakefile Extract shared tests 2017-07-04 15:28:47 +02:00
README.md Add attachments 2017-07-05 15:18:50 +02:00

Active Vault

...

Example

class Person < ApplicationRecord
  has_file :avatar
end

avatar.image.url(expires_in: 5.minutes)

class AvatarsController < ApplicationController
  def create
    # @avatar = Avatar.create \
    #   image: ActiveVault::Blob.save!(file_name: params.require(:name), content_type: request.content_type, data: request.body)
    @avatar = Avatar.create! image: Avatar.image.extract_from(request)
  end
end


class ProfilesController < ApplicationController
  def update
    @person.update! avatar: @person.avatar.update!(image: )
  end
end

License

Active Vault is released under the MIT License.