scott tallarida

Joined

350 Experience
2 Lessons Completed
0 Questions Solved

Activity

Posted in Sorting Images using Active Storage

Hey Tony, checking in again if you can hook me up with your sortable implementation?

Posted in Sorting Images using Active Storage

Seriously wanna stop pestering you but I am relatively new to the whole webpacker approach to js libraries. I can't seem to get this rolling. Could you share your js implementation of jquery-ui? The js file you added as well as any declarations you may have in application.js or elsewhere?

Posted in Sorting Images using Active Storage

And......yet another question! Can you tell me how you got sortable js going? Do you have your own js controller or just add to application js? Getting noMethod error but realized I have not added to proj.

Posted in Sorting Images using Active Storage

Perfect! Thank you.

Posted in Sorting Images using Active Storage

This is what you sent before. But take a look - after your <% if product_images.present? %> it goes right to " class="ui-state-default image-box float-left"> which makes no sense. That is cut-off code. I would assume that missing bit before "class= is what I need. Sorry to be a pest! But the code that actually calls sort is where the magic will happen. Do you see that blank space on your end?

<% if product.persisted? %>
<% if product.images.present? %>

" class="ui-state-default image-box float-left">

Posted in Sorting Images using Active Storage

I think it's just the view code you pasted got cut-off. It came through like this:

<% if product.persisted? %>
<% if product.images.present? %>

" class="ui-state-default image-box float-left">

Obviously a chunk missing!

Posted in Sorting Images using Active Storage

Well that's great news! One last thing before I start hacking away. In your view, where is the url declaration for the sort_attachments ajax request? Sortable references it but I don't see in your view example.

Posted in Sorting Images using Active Storage

Thank you...I understand all this. However, you are using acts_as_list, as am I. That gem needs to be declared in the model of the items that are being sorted -in this case the attachments. That's what exposes the position update method. My question is where did you declare acts_as_list? Which model? If in Product it would assume you were sorting Products and not attachments.

Posted in Sorting Images using Active Storage

I am soooo close based on what you sent. And, yes, it is a freaking desert out there on this topic.

I pretty much have everything working except the URL call to do the re-ordering on the backend.

How did you manage to get acts_as_list added to the ActiveStorage::Attachment model?
In your example where does your "sort_attachments" method live?

Thank you SO MUCH for helping!!!

Posted in Sorting Images using Active Storage

Hey Tony! I am in the middle of tackling this EXACT issue and it's making me pretty crazy. Any chance you could share your solution? I am really struggling with getting acts_as_list into the attachments model, etc.

Posted in Trouble with part 3 of Direct Uploads to S3

I am working through your Direct Uploads to S3 series and have run into a snag that I am hoping you can help with.

Everything has worked as advertised UNTIL I added the js in episode 3. Now I am getting the following error which I understand to be a defence against cross site scripting.

XMLHttpRequest cannot load https://triggerchicago.s3.amazonaws.com/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://rails-tutorial-stallarida.c9users.io' is therefore not allowed access. The response had HTTP status code 403.

I have found a bunch of hacks to get it working but all seem to be questionable from a security standpoint. How did you get around this in your demo? I am hitting S3 from Cloud9 IDE.