Skip to main content

How to read database table in Application.rb

Rails • Asked by Puneet Gaur

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.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.