ToddT

1

votes
0

answer
86

views

Shopify API Draft Order, Order or Checkout with Custom Taxes

I'm stuck. Even though all the documentation says you can, I can't add custom taxes to a DraftOrder or a Checkout. But oddly enough I can with a regular order. This is my code, and all I change is which object I hit either Order DraftOrder or Checkout order = ShopifyAPI::Checkout.create({ line_items...
ToddT
1

votes
0

answer
516

views

Vuetify - how to create a nested multi-select box

I'm trying to create a multi-select box with Vuetify that allows the user to select the header and by selecting the header they would select everything that is child to that. Here is an example: if you click on the 'choose your countries' you'll see Europe BUT its just a title for now. I'd like to m...
ToddT
1

votes
3

answer
2.6k

views

Vuetify v-select not showing :items

I can't figure this out. I am using Vuetify to style my pages, and for some reason I can't get the data to show in my v-select select box. The data SHOULD be coming from the array marketplaces. I thought it might be a version issue, but I've upgraded everything and its still not working.. I can't ge...
ToddT
1

votes
1

answer
48

views

Pushing to a Git repo that started as public but is now private

I setup a public repo on GitHub. I pushed my code a couple times and have now made that same repo private. And when I try and push I can't. I'm getting this error: ERROR: Repository not found. fatal: Could not read from remote repository. How can I push to my newly private repo? No clue EDIT: I'm no...
ToddT
1

votes
0

answer
142

views

Using Vuelidate with v-for and props

How are you all using Vuelidate with v-for. I can't seem to get it to work correctly. It either validates each of the text-fields in my form, or it throws an error. I only want it to validate the field that is being entered, and not other fields that are created from v-for. In the below template you...
ToddT
1

votes
1

answer
420

views

Vuetify v-select will not close

I've done everything I know, and for some reason my v-select won't close after you open it. Specifically if you click the first v-select and then tab out of it, you can't close that v-select anymore. That's the same thing I'm getting. How can I force the close of the v-select after it loses focus?...
ToddT
1

votes
1

answer
222

views

Vuetify & Vue - Cannot read property 'rtl' of undefined

This is only happening on my Vuetify forms. And now my forms will not render, all my other components are fine. I even tried to throw in a v-show='true' and that didn't help. You can see a working sample of this here just page to the last page where the form is.. The odd thing is, I have a different...
ToddT
1

votes
1

answer
486

views

Rails Session not persisting after browser refresh

Navigating within the app and re-directs are all fine, its just when the browser refreshes the user has to log back in. I only want the session to expire when the browser closes and not on refresh.. My session_store.rb Rails.application.config.session_store :cookie_store, key: '_workspace_session' M...
ToddT
1

votes
2

answer
686

views

Is it possible for begin .. rescue to NOT catch an exception?

I have a process that is within a begin rescue loop, that looks like this: begin # do some stuff rescue Exception => e Rails.logger.info '#{e.response.message}' end Is it possible for this to NOT catch an exception? For some reason my process is running, not throwing errors, but randomly not working...
ToddT
1

votes
1

answer
618

views

Insert div with liquid objects and get values with jQuery

I want to get the value of the inserted liquid objects. But all I'm returning is the actual text and not the values. But if I just manually insert that same div into the head and just run the logging to the console, it works fine. I think this is a timing issue, but I can't figure it out. I am able...
ToddT
1

votes
2

answer
334

views

jQuery set flag to stop submit loop

I have a bit of a logic error that I need help with. The code works great, I'm just not sure where to set my flag to stop an infinite loop. There is a login page where I first preventDefault then pull data from the form, process the data, replace some data and then submit the form myself with the ne...
ToddT
1

votes
2

answer
56

views

Retrieve data from action in same controller created via AJAX

I'm missing something very simple, just not sure what. I have two actions in the same controller AppProxy. One action, AppProxy#return_credit is used to POST data too via AJAX, and it works great: def return_credit customer = Customer.find_by(email: params['email']) @credit_amount = customer.credit_...
ToddT
1

votes
1

answer
17

views

Strong params sent, received and then mysteriously changed (Ruby and jQuery)

I have no idea why this is happening, but it happens consistently after a page reload. I send credit_amount in my params, the controller gets them, but when updating the found record it somehow reverts to 0. Its bizarre. Here is what the server log has: Processing by CustomersController#update as JS...
ToddT
1

votes
1

answer
38

views

Create not saving record due to non-existent field

Can't figure this out. I'm running Postgres on a Ruby app and my schema looks like this: ActiveRecord::Schema.define(version: 20180518200146) do create_table 'amazons', force: :cascade do |t| t.text 'auth_token' t.text 'marketplace' t.datetime 'created_at', null: false t.datetime 'updated_at', null:...
ToddT
1

votes
1

answer
48

views

Retrieve index of just one element in v-for loop

Based on the validation response from a text-field I'm trying to disable or enable ONE button based on its index in my v-for loop. However, right now I'm disabling BOTH buttons. My idea was to get the index of the button based on the info in my v-for loop. However when I try and get the index of the...
ToddT
1

votes
3

answer
230

views

Add key value pair to Array of Hashes when unique Id's match

I have two arrays of hashes sent_array = [{:sellersku=>'0421077128', :asin=>'B00ND80WKY'}, {:sellersku=>'0320248102', :asin=>'B00WTEF9FG'}, {:sellersku=>'0324823180', :asin=>'B00HXZLB4E'}] active_array = [{:price=>39.99, :asin1=>'B00ND80WKY'}, {:price=>7.99, :asin1=>'B00YSN9QOG'}, {:price=>10, :a...
ToddT
1

votes
2

answer
102

views

Has_many relationship with custom primary key not working

I want to query the db with a Merchant.products call.. But I can't get this to work.. My primary key should be merchant_identifier on the merchants table, with the foreign key merchant_identifier on the products table. My schema: create_table 'merchants', id: false, force: :cascade do |t| t.string '...
ToddT
0

votes
0

answer
5

views

Include / require common lib file in rake task

I tried these things suggested in this post and nothing worked I give up, I've tried everything and back again and for the life of me I can't include / require my common methods file in my rake task. First I thought that if you added a file in the lib folder and made sure it was in the load path tha...
ToddT
1

votes
1

answer
107

views

SystemStackError (stack level too deep) in Model

Unsure of why this is happening?? Still a noob.. I am just updating one field in the Mine table before I save the record. All of the variables are being pulled in accurately.. The below line returns what its supposed too. CreateFulfillmentService::NON_US_MARKETPLACES.include?(self.marketplace) And...
ToddT
1

votes
1

answer
1.3k

views

Hash rocket vs colon in render json:

I am rendering a response to a POST request from a webhook. I just realized that when I render json: thingee and I log thingee it has hash rockets which are not valid json. I've seen where people puts the hash and it looks fine, but that's not what I'm doing, I'm rendering a hash as JSON in response...
ToddT
1

votes
1

answer
282

views

Vue - Is there a way to scope $refs on a form

I am passing in props to my form. So the data in the form can be populated from these props or from user entry. Because I'm using props I don't have data defined for these elements. But instead am using v-model and passing in my props. The problem then is when I want to submit, how can I get all the...
ToddT
1

votes
2

answer
49

views

Ruby array inserting mystery characters

this is bizarre.. I'm requesting data from the Amazon Product Advertising API with the Vacuum gem.. and using an array to pass the id it needs.. and for some reason between when I send it, and when the API gets it there is a back slash inserted in the id?? AND its consistently doing it.. lookup_ite...
ToddT
1

votes
1

answer
238

views

ebay BulkDataExchangeRequests API XML - UUID is missing

I'm testing a request to the LMS side of the eBay API by sending a AddFixedPriceItemRequest to BulkDataExchangeRequests via createUploadJob. When I do this I get the error: 'UUID is required' even though in the documentation that I can find it says UUID is optional. However, I am including a UUID...
ToddT
1

votes
2

answer
1.2k

views

Redis save a hash and get a hash

Can't get this to work.. I just want to save a hash to redis and then retrieve the entire hash from Redis.. not an array of values or keys, I just want the hash.. As an example: jack = Redis.new jack.hset('cart:1', 'token', '456789') pp jack.hget('cart:1', 'token').class # returns an array Is it pos...
ToddT
2

votes
1

answer
243

views

Bootstrap modal not closing and refreshing index page

My edit/update modal isn't working correctly. I want it to update the db, close the modal and return the user back to my index page where the table containing my products should be updated. Right now its just updating the db, but not closing the modal and the user has to refresh the browser to see t...
ToddT
1

votes
2

answer
2.7k

views

Create hash from variables in loop

I want to end up with an array of hashes. I am starting with an array of codes: @codes = ['123', '456', '789'] I take each of those codes and hit an API with them and it returns values that I parse into variables in a loop, like so: @codes.each do |x| @y = x.get_some_data @brand = @y[brand] @size =...
ToddT
2

votes
2

answer
1.1k

views

Make db column optional or not required so I can create record

I have a column on a table that may or may not get populated when a new record is created. Let's call it free_shipping_amount and its type integer, and it resides in the shipping_methods table. I also have a form that is backed by this ShippingMethods model. So I don't want this field to display as...
ToddT
2

votes
1

answer
2.5k

views

Datatables child row not showing

I am following this blog post on Datatables Sliding Child Rows but I can't get my rows to show when clicked.. I just want to be able to show the child row when the first column is clicked. What am I doing wrong? My jQuery $(document).ready(function(){ $('#products').DataTable({ 'lengthMenu': [[20, 5...
ToddT
4

votes
2

answer
3.3k

views

Pry like debugger for Sidekiq?

I've tried pry and remote-pry, but no luck. I'm familiar with logging, but I want to be able to step thru my code and look at variables. Does anyone know of anything I can use to debug Sidekiq?
ToddT
2

votes
1

answer
779

views

Calling helper method in services

Can't seem to call this helper method from a service I created. They look like this: # app/controllers/application_controller.rb class ApplicationController < ActionController::Base helper_method :activate_session_with_id def activate_session_with_id(domain, token) #do some stuff end end My service...
ToddT
3

votes
1

answer
460

views

record not saving when before_save action is called

Can't figure this out.. Not sure why the record isn't being saved.. the method is being called properly, and all the fields are present, and the logic is correct.. Here is my model code: class Mine < ActiveRecord::Base belongs_to :shop validates :merchant_id, presence: true validates :auth_token, pr...
ToddT
1

votes
1

answer
61

views

Where to put scratch file to be able to access Model data/methods

I have a file that I use for testing ideas and ensuring a code refactor is working. I'd like to be able to access my Shop Model data from within this scratch file. For instance I'd like to be able to do this in the tester.rb file: pp Shop.all Where would I put it, and what should it inherit from in...
ToddT
2

votes
3

answer
242

views

Inherit controller class from gem

I am using the ShopifyApp gem, which has an action called receive in its WebhooksController. As seen here: Webhooks controller In my WebhooksController controller I am trying to override that receive action by doing the following: class WebhooksController < ShopifyApp::WebhooksController def receive...
ToddT
1

votes
7

answer
89

views

javascript - How to check for existence of object in array

How can I check for the existence of an object in an array in javascript? Here is a simple example. Let's say I have an array that looks like this: let array = [{'zone': 'WV', 'zip': '56855'}, {'zone': 'SC', 'zip': '28031'}, {'zone': 'TN', 'zip': '84755'}] And now I want to add an object to my arr...
ToddT
1

votes
1

answer
26

views

Keep Unpermitted parameters from printing to log

Is there a way to stop unpermitted params from printing to my logs? Its just a huge mess and making it hard to look thru the unpermitted params in order to find issues. Any suggestions?
ToddT
2

votes
1

answer
1.7k

views

Using attr_encrypted to encrypt and store API token, but how to de-crypt in order to use

Building an app that pulls data from merchant's accounts on demand. I've setup my model, installed the attr_encrypted gem, and everything is being stored properly as encrypted. I've created a method that takes the token and sends it to the API, but I need to send the de-crypted version. The token is...
ToddT
1

votes
2

answer
31

views

Hash not being added to array

I give up, I have no idea why the hashes I'm creating are not being added to the end of the array. When I pp the hash it is correct, but for some reason the first hash is getting duplicated, while the second hash isn't being added.. The result I'm getting is this: [{:id=>'36757153479', :quantity=>1...
ToddT
1

votes
2

answer
1.4k

views

Update Shopify cart with ajax without page refresh

I am changing a users Shopify shopping cart with Ajax, the cart is being changed successfully but in order to display the updated cart the user has to refresh the page. I want to display the cart changes WITHOUT a refresh. I'm using the ajax api just fine, and I can add and remove items with: Shopif...
ToddT
2

votes
1

answer
512

views

Vuejs function in mounted lifecycle hook

I would like my hideMe() function to be called during the mounted lifecycle hook in my Vuejs code. Currently it is not, and I don't understand why. My code is below: export default { data() { return { show: 'initial' } }, methods: { hideMe() { if(this.$vuetify.breakpoint.name == 'xs') { console.log...
ToddT
1

votes
1

answer
196

views

Use max_by in Ruby to find the key for the maximum number in a hash

I need to find the category, within an array, that holds the 'largest' weight. I define the weights in an environment variable: CATEGORY_WEIGHTS = { 'small_standard': 0, 'large_standard': 1, 'small_oversize': 2, 'medium_oversize': 3, 'large_oversize': 4 } In this example, the 'largest' weighted cate...
ToddT

View additional