- Rails 7.0.2
- stimulus js
- importmaps
- dropzone.js
- direct upload ActiveStorage
This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.
| // require materialize.css | |
| $(document).on('turbolinks:load', function() { | |
| $('.update_form .regular').on('focusout', event => $('.update_form').trigger('submit')); | |
| $('.update_form').on('submit', e => { | |
| $.ajax(e.target.action, { | |
| type: 'PUT', | |
| dataType: 'json', | |
| data: $(".update_form").serialize(), |
| class BlogEntity < ApplicationRecord | |
| belongs_to :city | |
| def posts | |
| Post.where(blog_entity_id: self.id).order_by({created_at: -1}) | |
| end | |
| def there_is_a_post_with_url(url) | |
| Post.where(url: url).exists? | |
| end |
This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.