Skip to content

Instantly share code, notes, and snippets.

@floehopper
Last active January 24, 2018 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floehopper/4853c87b9316612c0d9385d062a4a989 to your computer and use it in GitHub Desktop.
Save floehopper/4853c87b9316612c0d9385d062a4a989 to your computer and use it in GitHub Desktop.

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