All threads / How do I configure GlobalID in a Rails app?
Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I configure GlobalID in a Rails app?

Walter Davis asked in Rails

I am working through an elaboration on the recent screencast, using GlobalID to build references to polymorphic associations, but I need to be able to take advantage of the GlobalID.app= method, and I can't seem to find a way to hook that in the application startup. I've tried an initializer and also adding that method to the application.rb in the initialization block. Can you recommend a place where I can set the name of the app for all instances of GlobalID?

Of course, the moment I write this, I found the answer by reading the code in the railtie for the gem:

# application.rb, inside the main block:
  config.global_id.app = 'wakka'

Hope this helps someone else...

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 64,614+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.