« Back to channel list

#RubyOnRails - 01 June 2018

« Back 1 day Forward 1 day »
[00:00:46] mices: has joined #RubyOnRails
[00:02:06] mices: even though i'm using bootstrap-sass and sass-rails my app still looks for files ending in css and postpends css to whatever filename i give it
[00:08:31] dustinm`: has joined #RubyOnRails
[00:16:40] cagomez: has joined #RubyOnRails
[00:23:05] eckhardt: has joined #RubyOnRails
[00:35:42] blackmesa1: has joined #RubyOnRails
[00:38:43] eckhardt: has joined #RubyOnRails
[00:43:26] deevil: has joined #RubyOnRails
[00:47:08] johndunn: has left #RubyOnRails: ()
[00:49:38] orbyt_: has joined #RubyOnRails
[01:04:33] GodFather: has joined #RubyOnRails
[01:25:57] BlopMonster: has joined #RubyOnRails
[01:32:00] BloopMonsterOMG: has joined #RubyOnRails
[02:04:32] Jameser: has joined #RubyOnRails
[02:08:44] agent_white: has joined #RubyOnRails
[02:26:32] roshanavand: has joined #RubyOnRails
[03:15:02] braincrash: has joined #RubyOnRails
[03:18:17] EXCHGR: has joined #RubyOnRails
[03:40:54] cagomez: has joined #RubyOnRails
[03:50:00] lypsis: has joined #RubyOnRails
[03:54:43] BloopMonsterOMG: has joined #RubyOnRails
[03:59:21] sevenseacat: has joined #RubyOnRails
[04:00:21] BloopMonsterOMG: has joined #RubyOnRails
[04:04:36] apeiros: has joined #RubyOnRails
[04:10:38] chalmagean: has joined #RubyOnRails
[04:14:41] BloopMonsterOMG: has joined #RubyOnRails
[04:40:29] kt: has joined #RubyOnRails
[04:46:19] dblessing: has joined #RubyOnRails
[04:52:00] jane_booty_doe: has joined #RubyOnRails
[04:57:30] kt: has joined #RubyOnRails
[05:03:23] conta: has joined #RubyOnRails
[05:06:29] conta: has joined #RubyOnRails
[05:07:37] lord4163: has joined #RubyOnRails
[05:07:41] psychoslave: has joined #RubyOnRails
[05:15:21] reber: has joined #RubyOnRails
[05:26:37] zave: has joined #RubyOnRails
[05:28:43] zave: hi all, how can i force my rails app to load the new environment variable secret_key_base? i've confirmed it's there by doing env | grep secret_key_base, and by doing RAILS_ENV=production bundle exec rails c, then Rails.application.secrets ... and it's there. and i've restarted nginx and unicorn. yet, my unicorn log still says it can't find it.
[05:28:47] cschneid: has joined #RubyOnRails
[05:40:03] chalmagean: your nginx environment might be different than the one you run your rails app from, did you check that one too?
[05:44:37] vedu_: has joined #RubyOnRails
[05:50:43] sagax: has joined #RubyOnRails
[05:52:46] eckhardt: has joined #RubyOnRails
[05:55:30] KeyJoo: has joined #RubyOnRails
[05:55:52] Cork: hmm in rails 5.2 errors.added?() doesn't match the message added to a validates_*_of line
[05:58:01] Cork: validates_format_of :email, with: /.../, message: :bad_format
[05:58:11] Cork: becomes .errors.details = {:email=>[{:error=>:invalid}]}
[06:00:36] Technodrome: has joined #RubyOnRails
[06:02:23] fp-: has joined #RubyOnRails
[06:03:13] kapil___: has joined #RubyOnRails
[06:17:18] sandstrom: has joined #RubyOnRails
[06:36:37] snickers: has joined #RubyOnRails
[06:38:07] mtkd: has joined #RubyOnRails
[06:44:42] conta: has joined #RubyOnRails
[06:51:43] conta: has joined #RubyOnRails
[06:54:21] eckhardt_: has joined #RubyOnRails
[07:24:35] snickers: has joined #RubyOnRails
[07:43:45] sandstrom: has joined #RubyOnRails
[07:47:37] segy: has joined #RubyOnRails
[07:47:37] Fire-Dragon-DoL: has joined #RubyOnRails
[07:47:37] nickjj: has joined #RubyOnRails
[07:47:37] phon: has joined #RubyOnRails
[07:47:37] sikachu: has joined #RubyOnRails
[07:47:37] hpfmn: has joined #RubyOnRails
[07:47:37] Prira: has joined #RubyOnRails
[07:47:37] dnyy: has joined #RubyOnRails
[07:47:37] craysiii: has joined #RubyOnRails
[07:47:37] podman: has joined #RubyOnRails
[07:47:37] bphogan: has joined #RubyOnRails
[07:47:37] webdestroya: has joined #RubyOnRails
[07:47:37] Diabolik: has joined #RubyOnRails
[07:47:37] Scient: has joined #RubyOnRails
[07:47:38] mcr1: has joined #RubyOnRails
[07:47:38] JJonah: has joined #RubyOnRails
[07:47:38] Travis-42: has joined #RubyOnRails
[07:47:38] codepete: has joined #RubyOnRails
[07:47:38] Fridtjof: has joined #RubyOnRails
[07:47:38] FooBarWidget: has joined #RubyOnRails
[07:47:38] hellekin: has joined #RubyOnRails
[07:47:38] Guest52854: has joined #RubyOnRails
[07:47:38] Guest53256: has joined #RubyOnRails
[07:47:38] DukeDave: has joined #RubyOnRails
[07:47:38] tycoon177: has joined #RubyOnRails
[07:47:38] baweaver: has joined #RubyOnRails
[07:47:38] fryguy: has joined #RubyOnRails
[07:48:52] Fridtjof: has joined #RubyOnRails
[07:52:14] Technodrome: has joined #RubyOnRails
[07:53:38] lord4163: has joined #RubyOnRails
[08:04:13] mikecmpbll: has joined #RubyOnRails
[08:26:10] Technodrome: has joined #RubyOnRails
[08:34:09] jottr: has joined #RubyOnRails
[08:36:25] srinidhi: has joined #RubyOnRails
[08:41:31] trautwein: has joined #RubyOnRails
[08:41:39] roshanavand: has joined #RubyOnRails
[08:42:45] blackmesa1: has joined #RubyOnRails
[08:52:21] NL3limin4t0r: has joined #RubyOnRails
[08:57:38] wethu: has joined #RubyOnRails
[09:08:07] EXCHGR: has joined #RubyOnRails
[09:10:45] thesubr00t: has joined #RubyOnRails
[09:13:21] thesubr00t: How to optimize ActiveRecord::Base.connection.execute() for a large data. I'm experiencing a memory bloat on production loading ~ 50k row on a server with ~60kmb of RAM !
[09:13:26] mtkd: has joined #RubyOnRails
[09:14:50] thesubr00t: I use Postgresql
[09:15:57] Puffball: has joined #RubyOnRails
[09:20:35] blackcross_: do it in chunks
[09:24:09] thesubr00t: blackcross_, im storing the result in an Enumerator to stream it as a CSV file, something like "result.each_row { |row| yielder << CSV.generate_line(row) }. How to do that in chunks ?
[09:25:06] thesubr00t: result = ActiveRecord::Base.connection.execute(raw_sql)
[09:30:11] alfiemax: has joined #RubyOnRails
[09:52:34] alfiemax: has joined #RubyOnRails
[09:57:58] hammer065: has joined #RubyOnRails
[10:05:31] trautwein: has joined #RubyOnRails
[10:06:18] trautwein: has joined #RubyOnRails
[10:09:03] trautwein: has joined #RubyOnRails
[10:09:38] trautwein: has joined #RubyOnRails
[10:10:13] trautwein: has joined #RubyOnRails
[10:12:07] trautwein_: has joined #RubyOnRails
[10:13:35] KeyJoo: has joined #RubyOnRails
[10:14:13] dionysus69: has joined #RubyOnRails
[10:14:33] KeyJoo: has joined #RubyOnRails
[10:29:46] cschneid: has joined #RubyOnRails
[10:30:07] chalmagean: has joined #RubyOnRails
[10:31:05] trautwein: has joined #RubyOnRails
[10:41:59] eelster: has joined #RubyOnRails
[10:45:41] GodFather: has joined #RubyOnRails
[10:48:21] dionysus69: has joined #RubyOnRails
[10:51:16] psychoslave: has joined #RubyOnRails
[11:02:56] trautwein: has joined #RubyOnRails
[11:06:07] jottr: has joined #RubyOnRails
[11:27:21] roshanavand: has joined #RubyOnRails
[11:40:02] Cavallari: has joined #RubyOnRails
[11:45:18] rfoust: has joined #RubyOnRails
[11:46:24] fmcgeough: has joined #RubyOnRails
[11:47:49] Technodrome: has joined #RubyOnRails
[11:54:10] za1b1tsu: has joined #RubyOnRails
[12:08:53] KevinSjoberg: has joined #RubyOnRails
[12:10:16] KevinSjoberg: I'm having an interesting problem. I have a `Rule` model that has many `RuleAction`s. There are different kinds of `RuleAction` so I'm using STI, e.g., `SetRuleAction < RuleAction` and `SkipRuleAction < RuleAction`. In my form, I can create one or more rule actions using `accepted_nested_attributes`. Now, the problem comes when I want to permit the values. Depending on `type` for each association I want to permit specific
[12:10:16] KevinSjoberg: values. For instance, `SetRuleAction` permits `type`, `field` and `value`. `SkipRuleAction` permits nothing other than it's `type`. So, given `{ "rule"=>{"name"=>"", "active"=>"1", "actions_attributes"=>{"1527853308564"=>{"type"=>"SetRuleAction", "field"=>"vat_percentage","value"=>"abc", "_destroy"=>"false"}, "1527853309215"=>{"type"=>"SkipRuleAction", "_destroy"=>"false"}}}`. I want to permit `field` and `value`. But for the
[12:10:16] KevinSjoberg: second element it should not be permitted.
[12:13:47] fmcgeough: has joined #RubyOnRails
[12:15:50] FernandoBasso: has joined #RubyOnRails
[12:16:53] za1b1tsu: has joined #RubyOnRails
[12:24:02] jottr: has joined #RubyOnRails
[12:25:36] Ryzokuken: has joined #RubyOnRails
[12:32:57] NL3limin4t0r: kevinsjoberg: Something like this might do the trick: https://gist.github.com/3limin4t0r/cf0116411543ee5fde91a4b2b4c8f91a
[12:37:35] za1b1tsu: has joined #RubyOnRails
[12:41:19] KevinSjoberg: NL3limin4t0r: Thank you. I solved it myself (forgot to inform the chat). Appreciate the help though. :)
[12:41:51] KevinSjoberg: For reference: I permitted the common values, name, active of the rules. For each element in the array I permitted the hash based on type.
[12:41:54] KevinSjoberg: Similar to what you did.
[12:43:31] DrYockel1: has joined #RubyOnRails
[12:44:29] chalmagean: has joined #RubyOnRails
[12:47:02] mikecmpb_: has joined #RubyOnRails
[12:50:44] eelster: has joined #RubyOnRails
[12:57:20] rfoust: has joined #RubyOnRails
[12:58:14] jscheel: has joined #RubyOnRails
[13:03:19] mikecmpbll: has joined #RubyOnRails
[13:07:48] Jameser: has joined #RubyOnRails
[13:16:27] fmcgeough: has joined #RubyOnRails
[13:23:52] mtkd: has joined #RubyOnRails
[13:24:39] saltlake: has joined #RubyOnRails
[13:25:08] saltlake: has left #RubyOnRails: ()
[13:25:20] saltlake: has joined #RubyOnRails
[13:25:43] saltlake: Hi, is rails good to make a personal blog? Or is wordpress better for this?
[13:31:07] eelster: I mean you certainly can make a personal blog in rails and it's not particularly hard to do so, but learning rails is a bit more difficult than using a wordpress blog on the whole.
[13:32:05] saltlake: But people say wordpress is not secure, their password storing method is not secure
[13:34:18] dminuoso: saltlake: Honestly the majority of webdevs dont know enough about security to really evaluate their own security methods.
[13:35:31] dminuoso: saltlake: For just a blog Id probably go for wordpress because its less effort.
[13:35:33] eelster: But if you're writing your own application for the first time in rails you're probably going to have security holes as well. No insult to you at all, major companies have that.
[13:36:21] dminuoso: eelster: I've med "experts" who didnt really understand how TLS worked - they tried telling me that its based on asymmetric encryption.
[13:37:05] eelster: dminuoso: Yeah. I immediately distrust most people who call themselves "experts". I've found that the people who know enough to know they're not experts are generally much better at giving advice.
[13:37:17] dminuoso: eelster: No they were good in their respective fields
[13:37:38] eelster: dminuoso: Ahh wow. Still that's bad.
[13:37:39] dminuoso: It's just that security is hard. Its really hard. Its freaking hard.
[13:37:46] dminuoso: And I get it, I dont blame them
[13:38:01] eelster: Yep. It is really hard. That's why companies pay tons and tons of money for pen testing.
[13:38:29] dminuoso: eelster: I've dabbled a bit (as a hobby) in crypto schemes - the amount of how many things you can screw up is incredible.
[13:39:41] eelster: I'm certain. I had this boss once that would dismiss any security concerns you brought to him saying "IPSec handles this". To this day, I don't know why he thought that was a good answer. This dude was sending plaintext passwords over port 80 "IPSec will take care of this".
[13:40:23] dminuoso: That can be perfectly fine.
[13:41:00] dminuoso: eelster: How do you think a password login works on a website?
[13:41:06] dminuoso: You send the password in regular plaintext over the wire.
[13:41:15] dminuoso: It's TLS that guarantees privacy.
[13:41:48] eelster: But it wasn't with TLS.
[13:42:34] eelster: Like, if you were packet sniffing you could've gotten the password as I demonstrated to him in wireshark.
[13:42:45] dminuoso: Your point being?
[13:43:10] dminuoso: If you can packet sniff it means you have root access
[13:43:18] dminuoso: If you have root access, then you can do ring escalation
[13:43:23] dminuoso: You can just read any processes raw memory
[13:43:43] eelster: True, true.
[13:44:15] dminuoso: eelster: The question is merely what kind of attacks you are trying to defend yourself against.
[13:44:22] dminuoso: If you have a trusted network on one side, and a trusted network on the other side
[13:44:32] dminuoso: then IPsec is a valid means of ensuring privacy over an untrusted network
[13:45:50] eelster: Oh. It sounds like he was actually correct about that IPSec stuff. He was so wrong about most of everything else I had just assumed he was making that up as well.
[13:45:52] dminuoso: eelster: In fact Id argue that bit makes IPsec a bit less annoying because you can at least debug with wireshark easily
[13:47:21] dminuoso: Though some vpn clients like Fortishit do some annoying things to prevent that
[13:48:30] saltlake: has left #RubyOnRails: ()
[13:48:59] johndunn: has joined #RubyOnRails
[14:04:00] Sylario: has joined #RubyOnRails
[14:05:23] trautwein: has joined #RubyOnRails
[14:09:17] Cavallari1: has joined #RubyOnRails
[14:28:50] Saukk: has joined #RubyOnRails
[14:32:38] DTZUZO: has joined #RubyOnRails
[14:33:01] trautwein: has joined #RubyOnRails
[14:35:00] za1b1tsu: has joined #RubyOnRails
[14:35:01] trautwein: has joined #RubyOnRails
[14:35:48] Dbugger: has joined #RubyOnRails
[14:38:28] jerematic: has joined #RubyOnRails
[14:41:21] jane_booty_doe: has joined #RubyOnRails
[14:48:01] vedu_: has joined #RubyOnRails
[14:57:53] rfoust: has joined #RubyOnRails
[14:59:23] pandavore: has joined #RubyOnRails
[15:04:18] eelster: has joined #RubyOnRails
[15:07:17] jane_booty_doe: Is StripeMock supposed to be able to test callbacks that persist in ActiveRecord like this? https://github.com/tansengming/stripe-rails#responding-to-webhooks
[15:09:25] KevinSjoberg: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[15:09:35] KevinSjoberg: has joined #RubyOnRails
[15:09:40] jane_booty_doe: Every example just tests the stripe objects created in the test. When I try to test something like that the changes don't persist
[15:10:49] Technodrome: has joined #RubyOnRails
[15:11:23] jane_booty_doe: Ah nevermind. You have to query the user again in the test after sending the event
[15:23:46] chouhoulis: has joined #RubyOnRails
[15:24:55] vedu_: has joined #RubyOnRails
[15:33:55] DoubleMalt: has joined #RubyOnRails
[15:46:30] rfoust: has joined #RubyOnRails
[15:52:19] troys: has joined #RubyOnRails
[16:10:58] Terens: has joined #RubyOnRails
[16:11:19] Terens: is is 1sec respond for requests good?
[16:11:41] Terens: we have some that take 5sec (index page) and they seem acceptable
[16:14:15] jcarl43: has joined #RubyOnRails
[16:21:21] ur5us: has joined #RubyOnRails
[16:26:39] fryguy: 1 sec for rails to respond, or 1 sec for your browser to render the page?
[16:26:54] fryguy: aka, how are you measuring this
[16:29:37] johndunn: has left #RubyOnRails: ()
[16:31:35] psychoslave: has joined #RubyOnRails
[16:31:54] desperek: has joined #RubyOnRails
[16:40:16] alfiemax: has joined #RubyOnRails
[16:41:31] cagomez: has joined #RubyOnRails
[16:49:24] eelster: has joined #RubyOnRails
[16:59:28] Cavallari: has joined #RubyOnRails
[17:00:04] Sylario: On my dev station I have the following error : Failed to open TCP connection to https://redacted_url:443 (getaddrinfo: Name or service not known)
[17:00:24] Sylario: But I can wget https://redacted_url:443
[17:00:45] Sylario: I copy pasted the URL for the wget from the error log
[17:01:10] Sylario: Is it possible to have trouble reaching URL from ruby?
[17:06:02] tdy: has joined #RubyOnRails
[17:18:32] defsdoor: has joined #RubyOnRails
[17:20:56] zave: has joined #RubyOnRails
[17:25:14] mtkd: has joined #RubyOnRails
[17:26:22] coolblade: has joined #RubyOnRails
[17:33:52] Sylario: Is it a ruby error or a system error ? : https://stackoverflow.com/questions/50648477/i-cannot-use-http-net-on-my-dev-machine
[17:36:48] mikecmpbll: has joined #RubyOnRails
[17:42:20] havenwood: sylario: try omitting the http://
[17:43:29] Sylario: havenwood: you are right
[17:43:34] havenwood: sylario: use www or follow redirect as well
[17:43:47] Sylario: other examples were Using URI object
[17:43:52] Sylario: that's why
[17:46:07] eckhardt: has joined #RubyOnRails
[17:59:42] trautwein: has joined #RubyOnRails
[18:02:37] trautwein: has joined #RubyOnRails
[18:03:02] dtzuzu: has joined #RubyOnRails
[18:04:26] eckhardt: has joined #RubyOnRails
[18:05:17] tdy: has joined #RubyOnRails
[18:05:32] orbyt_: has joined #RubyOnRails
[18:05:49] trautwein: has joined #RubyOnRails
[18:10:08] fox_mulder_cp: has joined #RubyOnRails
[18:11:24] MrPunkin: has joined #RubyOnRails
[18:11:43] kt: has joined #RubyOnRails
[18:15:23] MrPunkin: It seems that direct “connection.execute(…)” calls in an AR model break the transaction rollback during testing and persist between tests. Is there any way to prevent this and ensure that my database / fixtures start fresh each test?
[18:28:18] VeryBewitching: has joined #RubyOnRails
[18:29:07] MrPunkin: Sorry, rather it seems that calling truncate, which isn’t transactional with MySQL, persists between rails unit tests. Any way to force rebuilding of the fixtures / table at certain points in my test code after calling truncate?
[18:41:07] panda47: has joined #RubyOnRails
[18:44:27] gen3212: has joined #RubyOnRails
[18:45:01] gen3212: Hey guys! my name is Boris and i'am rails/elixir dev from russia. Nice to meet you all!
[18:45:09] dminuoso: Hello gen3212.
[18:49:28] garyserj: has joined #RubyOnRails
[18:50:13] garyserj: I heard that controller should be plural and model singular, but at this link https://github.com/rails/rails/issues/24530 I see he made the controller singular. Which should it be? Thanks
[18:55:55] MrPunkin: garyserj: that generate command will still generate a ‘comments_controller’ I believe.
[18:56:16] sandstrom: has joined #RubyOnRails
[18:56:16] mtkd: has joined #RubyOnRails
[18:57:00] MrPunkin: but the wording of the generate command is inteionally reflecting the model the controller will interface with in a RESTful setting
[18:57:12] MrPunkin: intentionally*
[18:58:44] gen3212: I have a question about proper Request testing when my api starts Active job
[18:59:34] gen3212: In request spec, should i just ensure that job received corret parameters, and then test job separatly
[19:00:07] gen3212: or just test everything inside request spec
[19:09:28] apeiros__: has joined #RubyOnRails
[19:09:49] sandstrom: has joined #RubyOnRails
[19:11:19] tdy: has joined #RubyOnRails
[19:15:49] kt: has joined #RubyOnRails
[19:18:30] GodFather: has joined #RubyOnRails
[19:20:32] KeyJoo: has joined #RubyOnRails
[19:26:04] dviola: has joined #RubyOnRails
[19:27:09] mikkel-: has joined #RubyOnRails
[19:27:34] KevinSjoberg: has joined #RubyOnRails
[19:29:23] KevinSjoberg: Today I stumbled across an interesting strong_parameters use-case. I've summarised and included my current solution. Any obvious improvements that can be made?
[19:29:24] KevinSjoberg: https://gist.github.com/KevinSjoberg/dd1cbd1b68ee9e83ebe44a7c689736f7
[19:29:53] mikkel-: Hey, I have a sidekiq worker that polls for a status change from an external api. When the status has changed, the sidekiq worker updates the status. Currently I have I have a while loop that just loops (with one minute sleep) until the status changes. Is is a better practice to spawn the same worker, like Worker.perform_in(1.minute, id) or is the while okay?
[19:31:34] gen3212: I guess that's not ok. Cuz your job might fail, i think better way is to start job every N minutes
[19:31:43] gen3212: with something like sidekiq-scheduler
[19:32:52] mtkd: has joined #RubyOnRails
[19:39:32] shenghi: has joined #RubyOnRails
[19:41:13] uks: has joined #RubyOnRails
[19:42:23] cagomez: has joined #RubyOnRails
[19:51:38] ellcs: has joined #RubyOnRails
[19:53:36] jerematic: has joined #RubyOnRails
[19:54:29] jerematic: has joined #RubyOnRails
[20:02:03] roshanavand: has joined #RubyOnRails
[20:17:05] MrPunkin: has joined #RubyOnRails
[20:17:21] cagomez: has joined #RubyOnRails
[20:18:08] mtkd: has joined #RubyOnRails
[20:18:26] MrPunkin: Is there a way I can programmatically reset the test database mid test? Like does AR offer any hooks to rebuild the test dabase in rails 5.1?
[20:18:55] mjolnird: has joined #RubyOnRails
[20:19:55] alfiemax: has joined #RubyOnRails
[20:35:31] srinidhi: has joined #RubyOnRails
[20:40:28] Inside: has joined #RubyOnRails
[20:46:38] mtkd: has joined #RubyOnRails
[20:47:26] dminuoso: MrPunkin: rspec? minitest?
[20:48:31] dminuoso: MrPunkin: You can put each test inside a database transaction.
[20:48:42] dminuoso: And just roll it back at the end.
[20:49:29] MrPunkin: dminuoso: I believe that’s the default, but things like “truncate” aren’t transactional with MySQL and thus don’t get rolled back. This is a table that gets truncated as part of the code, and thus my tests, and I need to forcibly reset the database to it’s initial state at a few points in my testing
[20:50:00] dminuoso: MrPunkin: Are you sure you really want to use truncate
[20:50:17] MrPunkin: dminuoso: yep.
[20:50:22] dminuoso: The lack of transactionality means this can badly interact with other code. Just imagine what happens when truncate is being run concurrently with another request.
[20:50:38] dminuoso: I'd expect MySQL to misbehave.
[20:51:19] MrPunkin: This table is just a read-only table for use to duplicate report data only to be used in the case of an emergency. It doens’t receive writes except from this same model via a single bulk insert from a CSV.
[20:51:32] dminuoso: MrPunkin: Id say ditch mysql and get a proper database.
[20:51:54] dminuoso: I find it kind of amusing that `TRUNCATE` is not transactino safe
[20:52:00] MrPunkin: dminuoso: I’ll accept the suggestion, however this is a production app that I can’t just switch currently.
[20:52:17] dminuoso: (I mean in postgresql its not MVCC safe, but that function needs to do some brutal things in order to be effective)
[20:52:23] MrPunkin: So was hoping for a way to force rails to rebuild the testing DB when I need it to since it can’t roll back my truncation
[20:52:35] dminuoso: MrPunkin: You could invoke the appropriate rake task
[20:52:57] MrPunkin: I thought I had read in rails 5 they removed the rake db:test:prepare task which is what is generally suggested for this stuff
[20:53:12] vedu_: has joined #RubyOnRails
[20:53:32] dminuoso: MrPunkin: Do you have any fixtures?
[20:54:50] dminuoso: MrPunkin: Afaik `db:test:prepare` still exists
[20:55:12] dminuoso: MrPunkin: Just type `rails` to see all existing rake tasks
[20:55:52] dminuoso: MrPunkin: but yeah, you might want to look into some locking mechanism for this
[20:56:03] eckhardt: has joined #RubyOnRails
[20:57:57] dminuoso: (a table lock at the very least)
[20:58:31] dminuoso: Oh mm. Mysql requires a WRITE lock for that already
[21:07:29] vedu_: has joined #RubyOnRails
[21:12:22] michael_mbp: has joined #RubyOnRails
[21:16:42] Inside: What am I doing wrong with this stub? https://gist.github.com/Insood/866519e069b788412412348a9f08619f
[21:19:44] MrPunkin: dminuoso: any chance you know where I can find the source code for the various rake tasks to know what they are actually doing?
[21:20:07] SteenJobs: has joined #RubyOnRails
[21:21:34] weaksauce: has joined #RubyOnRails
[21:24:13] Inside: ACTION facepalms.
[21:26:38] GodFather: has joined #RubyOnRails
[21:28:04] Inside: Looks like I need to install Mocha so that I get a User.any_instance.stub ... :/
[21:28:22] Terens: has joined #RubyOnRails
[21:28:40] Terens: is there a thread safe way to skip callbacks ?
[21:38:28] gen3212: Refactor them?)
[22:01:00] cagomez: has joined #RubyOnRails
[22:04:56] gen3212: terens well there is a few posibilities here. it's hard to recomend something without code. but in general, If you have after create callback, you can call you code in controller after you create a record.
[22:06:00] gen3212: or if u have huge app with complecated callback logic i recomend using pub/sub service like rabbitmq
[22:08:20] mtkd: has joined #RubyOnRails
[22:21:57] johndunn: has joined #RubyOnRails
[22:24:39] MrPunkin: seriously how on earth can I repopulate a table from fixtures midway through a test? Is this really something nobody has done before?
[22:25:16] dminuoso: MrPunkin: Like I said - run the rake tasks.
[22:25:37] MrPunkin: It won’t work. Throws an error about some SAVEPOINT issue
[22:26:00] dminuoso: "it won't work"
[22:26:26] dminuoso: MrPunkin: You have to ensure you do this outside a database transaction.
[22:26:40] dminuoso: MrPunkin: Also "error about some SAVEPOINT issue" is very nondescript.
[22:27:43] MrPunkin: Well my understanding is that each rails test runs within a transaction, right? So I either need to turn off transactions altogether in this test, which is not what I want, or I need to find a way to just recreate the data within a transaction… right?
[22:28:40] dminuoso: MrPunkin: Recreating the data within a transaction would mean repopulating in each test.
[22:28:59] dminuoso: MrPunkin: Does minitest allow you to reorder tests?
[22:29:32] MrPunkin: I’m not sure about that. It seems random when it is run but I’m not sure if there is a way to order them manually
[22:30:17] gen3212: https://stackoverflow.com/questions/29991869/how-do-you-specify-the-exact-order-of-minitest-tests
[22:30:51] dminuoso: MrPunkin: If all fails I have a few hacks in mind.
[22:31:01] gen3212: But i guess you just doing something wrong
[22:31:03] dminuoso: Does minitest execute tests in parallel?
[22:31:33] gen3212: I guess no by default. but i think there is async option
[22:31:42] dminuoso: MrPunkin: If not you could use `after/teardown` to invoke the rake task
[22:37:13] dviola: has joined #RubyOnRails
[22:37:36] MrPunkin: dminuoso: but I don’t need to rebuild the whold DB structure, just reload fixtures. I put a call to db:fixtures:load in the teardown task which I can confirm is being called but the fixtures don’t re-populate once the truncation happened during my test execution.
[22:37:43] MrPunkin: no errors, just no data in the table either
[22:39:21] Inside: So - I've got a legacy table which has lots of columns. I've also got some controllers & models which have no associated table, they just do lots of validation/intermediate calculation before populating that large table when save() is called on them. https://gist.github.com/Insood/554bfe38970ad4bfe5de27d8974e9db3
[22:39:28] dminuoso: MrPunkin: I dont know the details of that rake task. Just try resetting the entire database for the sake of discussion.
[22:39:41] Inside: How do I pull the validations & some of the logic out into a module of some sort..
[22:39:57] Inside: so that I can reuse the validations/data access stuff in other controllers which act on this data
[22:40:02] dminuoso: Inside: included hook maybe
[22:40:29] MrPunkin: dminuoso: it works fine, but leaves the entire DB blank without any fixtures loaded.
[22:40:45] MrPunkin: that was just db:reset
[22:40:52] dminuoso: MrPunkin: This is the point where I'd use the source, luke.
[22:41:43] MrPunkin: dminuoso: I was trying. The rake tasks load fixtures using ActiveRecord::FixtureSet.create_fixtures() and I can call that just fine but it doesn’t actually populate the DB. It caches the fixtures and everything but never inserts the rows or throws an error.
[22:43:21] MrPunkin: invoking just db:fixtures:load from the command line populates it all fine. invoking it from the teardown callback doesn’t. Something else is wonky with what my truncate does to the transaction or something.
[22:44:47] dminuoso: MrPunkin: try `ActiveRecord::FixtureSet.reset_cache`
[22:45:40] MrPunkin: Yep, that did it.
[22:49:31] Inside: dminuoso: hmmm, I'm not sure I follow
[22:49:45] samosaphile: has joined #RubyOnRails
[22:50:34] dminuoso: Inside: Write a module that in an included hook will register validations to the base module its included to.
[22:54:09] Inside: It just kinda works(tm)
[22:54:10] Inside: I'm a little scared
[22:56:11] wethu: has joined #RubyOnRails
[22:56:47] malide: has joined #RubyOnRails
[22:57:41] samosaphile: why are there no rails tutorials which don't deal with registration / login ? not everyone is trying build something to force users to register
[22:58:23] malide: Any chance somebody knows where rails-assets puts the js files it pulls? I can't require it and I don't know where it should exist
[22:59:06] malide: samosaphile: it's a fairly simple tutorial, but rails for zombies doesn't touch registration (iirc)
[23:03:03] samosaphile: malide: no longer free :\
[23:04:27] malide: samosaphile: really? I just did it a few days ago to refresh my knowledge? Unless there are more lessons that I've never seen
[23:04:28] nogic: has joined #RubyOnRails
[23:05:36] malide: huh, you're right
[23:07:18] coolblade: has joined #RubyOnRails
[23:09:02] samosaphile: yea, i was shocked at the change now too. i tried it a few months ago and just tried it today and completely different site
[23:14:29] cschneid: has joined #RubyOnRails
[23:17:10] samosaphile: it's also beginning to annoy me that the few resources left for rails ... like half of them are paid? not funny ... and why on earth would you? like now of all the times? who exactly is trying to learn rails now? (besides like me) no one in 2018 lol
[23:21:24] MrPunkin: without a ton of additional code I’m curious, is it possible to intercept one class method and redirect to another class? Obviously I can just return the other class’ method results within my Class A method but I’m thinking more metaprogramming here where if Class B contains the same method name use that otherwise try and call it on Class A
[23:21:40] MrPunkin: Sort of like method_missing metaprogramming without relying on not defining the methods
[23:27:28] cagomez: is Foo.preload(:bar) essentially a left join?
[23:47:15] orbyt_: has joined #RubyOnRails
[23:57:16] SteenJobs: has joined #RubyOnRails