Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

Create mainstream asset

$ echo `date` > tmp.txt
$ curl http://localhost:3000/assets --form "asset[file]=@tmp.txt" --form "asset[access_limited]=1" --form "asset[organisation_slug]=foo"

Rails log

Unpermitted parameters: :access_limited, :organisation_slug

Check state of new asset

irb> a = Asset.find('5a68c1873e489e7532578e2b')
=> #<Asset _id: 5a68c1873e489e7532578e2b, deleted_at(deleted_at): nil, created_at: 2018-01-24 17:25:27 UTC, updated_at: 2018-01-24 17:25:27 UTC, state: "unscanned", filename_history: [], uuid: "0c19d537-ce6a-4b55-af98-1ea96f08f023", access_limited: false, organisation_slug: nil, etag: "5a68c186-1d", last_modified: 2018-01-24 17:25:26 UTC, md5_hexdigest: "cb47b6e2dea6c82100be5217747654a2", file: "tmp.txt", _type: "Asset">

irb> a.access_limited?
=> false

irb> a.organisation_slug
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment