Comments (2)
When does an integer as credential name makes sense?
from rails.
Thanks for asking, Rafael.
Following is a real use case from one of my applications (using fake credentials), in which I have a "year => spreadsheet ID" mapping.
google:
credentials: config/credentials/google/development.json
spreadsheet_id:
2021: 81ab723369a5f16cb68d22f67089b4754befbb32a91b
2022: ede01aa536d886affa5a4795ff76766413f1a5b062f0
2023: e0b894384abdcbfb7549ab23907435668f7b48c7ff12
2024: a59545b56a896e821dcf8b8e6315a68c412bbbff531c
With that in place I've been used to do this for a long time:
Rails.application.credentials[:google][:spreadsheet_id][month.year]
Without accepting integer keys, I have to worry about parsing month.year to string (for example), which is not the behavior I would expect from a hash.
from rails.
Related Issues (20)
- `ActiveRecord::Persistence#becomes` does not clone eager-loading state and can raise Strict Loading violations HOT 2
- normalizes doesn't work with store / store_attributes HOT 1
- Doc Request: ActiveRecord FAQ HOT 3
- Upgrade `marcel` gem to 1.0.3 triggers `ActiveStorage::BlobTest#test_create_and_upload_extracts_content_type_from_filename` failure HOT 3
- where.first_or_create! fails with encrypted attribute fails HOT 2
- ActionView::Helpers::DateHelper #distance_of_time_in_words Leap Day bug HOT 1
- It is not possible to handle "not a valid MIME type" error using the exceptions_app = self.routes when the value of CONTENT_TYPE header is invalid HOT 4
- #update on CPK association requires an explicit reload to work correctly HOT 4
- Postgres JSONB column default and virtual column expressions are not typecasted on save HOT 3
- Avoidable resource consumption when using "in_batches(use_ranges: true)"
- how to write ruby on rails active records query on ubuntu
- Unintended Fallback to `Rails::HTML4::Sanitizer` for `ActionView::Helpers::SanitizeHelper.sanitizer_vendor` without `sprockets-rails` HOT 4
- Unexpected behaviour for CTE joins when CTE has same name as a relation HOT 1
- QueryAttributes treated as strings in exec_query HOT 5
- Configuration of config.i18n.fallbacks is not working HOT 2
- ActiveRecord::Encryption is encrypting/filtering other similar named attributes HOT 3
- Running "rails new app" fails causes a JSON LoadError HOT 4
- has_many relation with joins adding redundant inverse inner join
- Structuring the Active Record Query Guide HOT 15
- ActionCable::Channel::Broadcasting.serialize_broadcasting leads to unintentional very wide broadcast
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails.