Class: TentD::API::Posts::CreateAttachments
- Inherits:
-
Middleware
- Object
- Middleware
- TentD::API::Posts::CreateAttachments
- Defined in:
- lib/tentd/api/posts.rb
Instance Method Summary collapse
Methods inherited from Middleware
Methods included from Authorizable
#authorize_env!, #authorize_env?
Constructor Details
This class inherits a constructor from TentD::API::Middleware
Instance Method Details
#action(env) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/tentd/api/posts.rb', line 243 def action(env) return env unless env.params..kind_of?(Array) && env.response post = env.response version = post.latest_version(:fields => [:id]) env.params..each do || Model::PostAttachment.create(:post => post, :post_version => version, :type => .type, :category => .name, :name => .filename, :data => Base64.encode64(.tempfile.read), :size => .tempfile.size) end env.response.reload env end |