#RubyOnRails - 28 June 2018
« Back 1 day Forward 1 day »
[10:16:40] koichirose: Hello! I’ve been looking around for a while now, but I couldn’t find how to get the YAML key for a db connection. i.e. I do “establish_connection ‘my_db_yaml_key’” and I’d like something that returns “my_db_yaml_key”
[10:31:54] lupine: https://blog.acolyer.org/2018/06/28/how-_not_-to-structure-your-database-backed-web-applications-a-study-of-performance-bugs-in-the-wild/ innit
[12:43:41] dionysus69: so I am thinking about combining rails settings cached gem with rails credentials, so instead of initializing rails settings cached constants from an app.yml file, I would like to do it from rails credentials. What is the best place to do that, create an initializer perhaps?
[16:23:28] Andr3as: hello all.. i want to change my puma port for the staging env.. i found the puma.rb "config" and saw a "ENV.fetch("PORT")" in it.. so i thought i change the port in my environment/staging.rb
[16:32:00] Andr3as: another example of how the answer appears in google only after you've asked for it in an IRC channel
[16:36:53] FLeiXiuS: I have a table Country and another table System. I want System to have 2 (has many) associations Country_A and Country B. Is this possible through polymorphism? Or has_many conditions?
[16:37:47] FLeiXiuS: I was trying to get away by having a country_system table with country_id, system_id, type (a/b)
[16:45:06] Andr3as: another q - i've googled a lot this time.. i get an error with puma.. it does an initializer file out of a completely different project??
[16:45:14] Andr3as: here's a log snippet https://gist.github.com/awunder/f3668d6493004bc4bd018d2bfac3ea4c#file-puma-error-L15
[16:47:24] FLeiXiuS: They're exactly the same. Except I want to instantiate them differently, via a type.
[16:47:56] FLeiXiuS: Technically, I could do 2 tables, one for each type. The use a has_many to iterate them.
[16:48:15] FLeiXiuS: I was wondering if theres a singular way of doing this with 1 table. Then have a field distinguish the two.
[16:49:59] FLeiXiuS: I was trying to do something like this has_many :system_a, through: :country_system, source: :system, -> (where: type: 'a')
[16:52:38] Andr3as: havent read it entirely but while scanning through it looked good https://medium.com/@dcordz/single-table-inheritance-using-rails-5-02-6738bdd5101a
[16:54:04] Andr3as: yeah.. it would be a perfect match... made for things that are the same or almost the same.. but it can bite you later.. so you better be sure they stay the same
[17:09:41] spokrandt: going to start a new rails project. what is the current best versions of ruby/rails/bootstrap etc.. to use that is stable and not to cutting edge but has all the new toys?
[17:21:01] FLeiXiuS: Andr3as, I decided to just add 2 fields in the join table. system_a_id, system_b_id. Using has_many system_b, source: system in the model.
[20:03:48] HeyoRockbreaker: I'm developing an app with postgres in development. I know that I can't commit any sensative keys in .env or the decryption key used to store secrets if I put them there instead, but can I commit my database configuration in database.yml?
[20:04:08] HeyoRockbreaker: Or should I just add them to that secrets thing I need to read more about.
[20:04:39] havenwood: HeyoRockbreaker: https://www.engineyard.com/blog/rails-encrypted-credentials-on-rails-5.2
[20:05:08] havenwood: HeyoRockbreaker: "Rails 5.2 replaces both secrets with encrypted credentials. You cannot use plain text credentials. There's only credentials.yml.enc."
[20:05:59] HeyoRockbreaker: Yeah, yeah. I forgot what the reverted change was in 5.2, but should I import all sensitive credentials from that file? I'm a bit unsure about how it works
[21:10:34] HeyoRockbreaker: By the way, I want to apologize for asking the stupid question earlier. Should have read the rules
[21:36:51] Fuzai: https://hastebin.com/oqolovikem.rb I'm trying to (re) understand ActiveModel and relations. When I create a user I get an error that Player must exist, however the player table is supposed to be a list of users associated with a game. What am I doing wrong with these associations?