All threads / How to read database table in Application.rb

Ask A Question

Notifications

You’re not receiving notifications from this thread.

How to read database table in Application.rb

Puneet Gaur asked in Rails

I am adding CORS validation in application.rb filw where domain names are given in Environment variable but I want to keep all domain in database table and validate these domain during CORS validation. I am unable to read database table in application.rb file. Could you please help me how I can implement this. Please find the below summary of this requirement.

  1. Add domain name in Database table
  2. Application will validate Domain whether requested domain is already existing in database or not , it would be first step because if domain is not registered in DB then won't allow

Thanks for your help. I need some inputs on this asap.

Join the discussion

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

Join 39,609+ 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.

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

    © 2020 GoRails, LLC. All rights reserved.