Alan Reid

Joined

38,810 Experience
304 Lessons Completed
7 Questions Solved

Activity

Posted in Can anyone suggest me best Ruby on Rails 5 book?

No problem, Chris has release a great series on the site for beginning rails. It’s even on YouTube.

https://youtube.com/playlist?list=PLm8ctt9NhMNV75T9WYIrA6m9I_uw7vS56

Posted in Global Autocomplete Search Discussion

Is anyone else getting the following error when trying to search for a 2nd time?

TypeError: undefined is not an object (evaluating 'EasyAutocomplete.getHandle(b).getSelectedItemData')

Posted in I made a quiz game for Ruby

Would be worth posting a link to showcase your work

Posted in Intermediate JS developer looking to learn Ruby

Chris has just posted the Beginner course which should be of use - https://gorails.com/start

Posted in How to build a chat app with Ruby on Rails ?.

Post a link to the app, and I am sure other users would be happy to provide feedback.

Posted in how to unsubscribe?

If you're talking about the GoRails newsletters, there is always a link at the bottom of the email. You can unsubscribe via that.

Posted in how to make the forum lagg free

I think you may want to take a look at your internet connection, this is a common reason for lagging websites.

If other people are not reporting the same issue, then I would start with looking locally.

Thanks for the reply mate, so basically i want to store

{
  "energy_provider": {
      "name": "data",
      "renewal": "data"
  },
  "insurance_provider": {
      "name": "data",
      "renewal": "data"
  }
}

Do you think it would be best to have JSONB fields in the table to store these then? Or do you know of a more efficient way you could suggest please?

I found this article, which seems to be interesting. And maybe worth a look at.

Posted in Episode on GraphQL

I learnt all about graphQL over at How to GraphQL it's a good resource, and you can select different paths not just Ruby.

Posted in New Design!

Agreed, this new design is pretty slick Chris! I am also loving tailwind and the whole utility first CSS library.

Posted in Seed local database

Once you have made you project, you should run rails db:create to create your database.

It would then do worth looking at The Rail Tutorial which gives a great overview of the basics about Rails. Chapter 2 will give you a good idea on how to deal with migrations, and general DB stuff.

As per this Episode 191 is there any way I can add nested settings? for example:

{
"wants_reminders": true,
"wants_deals_offers": true,
"subscribed_to_newsletter": true,
"something_here": {
    "option1": "data",
    "option2": "data"
}

Posted in how to move existing body content to use action text?

Let me know how you get on. Hope it goes well.

Posted in how to move existing body content to use action text?

Of course, it seems to be working well. Saves a load of time. I sure it could be refactored to be quicker too. This was screated from a worker I am using to push updates to shopify - thus the begin, rescue, ensure

class FixProductBodyWorker
  include Sidekiq::Worker
  sidekiq_options retry: false

  def perform()
    batch_index = 1

    Product.where(x: "y")
        .find_in_batches(:batch_size => 100) do | products |

       retries = 3
       begin
         products.each do |product|
          if !product.product_body.nil?

            body_init = product.product_body

            # I added a load of editing stuff here to remove 
                        # unwanted text, or editing parts of the content.

                        # The clear out any whitespace - I do this as a lot 
                        #of the data was scraped from third-party supplier sites.
            body_edit = product.product_body.strip

            product.update(description: body_edit)
          end
         end
       rescue StandardError=>e
         puts "\tError: #{e}"
         if retries > 0
           puts "\tTrying #{retries} more times"
           retries -= 1
           sleep 20
           retry
         else
           puts "\t\tIssues processing batch #{batch_index}, so moving on"
           batch_index += 1
         end
       else
         puts "\tProceesed batch #{batch_index}."
         batch_index += 1
       ensure
         sleep 10
       end
    end
  end
end

Posted in how to move existing body content to use action text?

Quick update, made a quick worker to take my existing content, and save it to the actiontext table :D Seems to be working a treat!

Now to sit back and wait :D

Posted in how to move existing body content to use action text?

mmm, wonder if i can create a worker to do it for me basically save from :product_body to :body. I have like 32,000 records to update.

Great video though, i had it up an running in seconds! Then I sat there and went... "Oh, bugger!" hahaha

Posted in how to move existing body content to use action text?

I followed the great video Chris did on action text, however, I have an existing data structure and want to move it over to use actiontext for editing the body content.

How can i display the old content in the trix editor, if its not been moved over? Is there an easy way?

So how would you set the account_id in the URL when a user logs in? surely its not as simple as just setting Current.account = user.account_id ?

Posted in Any news on the install Rails on Catalina guide?

Currently the setup is showing how to use the bash setup, its mainly the oh-my-zsh stuff i'd like to see as im new to that.

I have set it up as much as i can so far haha :)

Posted in Any news on the install Rails on Catalina guide?

I have noticed that macOS Catalina moves to ZSH as the default shell, would be cool so get an update on the install rail guide to show this off :)

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.