« Back to channel list

#RubyOnRails - 19 May 2017

« Back 1 day Forward 1 day »
[00:01:07] quirkycoders: has joined #RubyOnRails
[00:04:13] uksio: has joined #RubyOnRails
[00:05:58] rgr: has joined #RubyOnRails
[00:08:51] duderonomy: has joined #RubyOnRails
[00:11:27] ovaltine: Nicmavr: possibly
[00:12:08] cam27: has joined #RubyOnRails
[00:12:36] Nicmavr: Hey ovaltine, thanks :) So basically I have a text field in which I input an email address, and I have a validation which checks that the field is not blank and that it's in the correct format. The problem is that the test passes even if I don't specify a value to put into the field (ie. the validation doesn't work)
[00:12:52] Nicmavr: What are common reasons that text field validations don't work during Rspec testing?
[00:13:10] Nicmavr: The funny thing is I have another 2 fields with validations and they work just fine as they should.
[00:13:46] Nicmavr: Should also add, the validation works fine when I try the app out manually. It only fails in Rspec when it allows the test to pass when it should fail.
[00:16:31] duderono_: has joined #RubyOnRails
[00:21:08] ascarter: has joined #RubyOnRails
[00:25:33] gusrub: has joined #RubyOnRails
[00:28:07] cam27: has joined #RubyOnRails
[00:29:46] quazimodo: has joined #RubyOnRails
[00:30:51] s2013: has joined #RubyOnRails
[00:32:23] gusrub: has joined #RubyOnRails
[00:46:52] bronson: has joined #RubyOnRails
[00:52:04] cagomez: has joined #RubyOnRails
[00:52:36] apparition: has joined #RubyOnRails
[00:54:02] mwlang: has joined #RubyOnRails
[00:54:13] cagomez: has joined #RubyOnRails
[00:56:45] cam27: has joined #RubyOnRails
[01:00:52] mwlang: trying to debug an odd issue with old browsers. be nice, I’m in enough pain as it is. ;-) Here’s the deal, IE7 appears to be making valid requests to my Rails 4.1 app, but Rails is randomly failing to find perfectly valid routes. Here’s a log snapshot of back-to-back requests of same route. The first one fails, the second one succeeds and all I did was hit F5 in IE7. https://gist.github.com/mwlang/10a5c205d3befde0b383097fd296c15a
[01:02:09] mwlang: any thoughts on how to try to snuff this one out (other than obviously telling a few thousand users to upgrade their browsers…)?
[01:02:16] irishfromua: has joined #RubyOnRails
[01:02:47] juggler: has joined #RubyOnRails
[01:05:30] amperry: has joined #RubyOnRails
[01:06:56] gusrub: has joined #RubyOnRails
[01:07:09] amperry: in rails 4.3, is there a way to require a password_field and a confirmation password_field to match before sending, or should I just roll my own javascript?
[01:10:36] mwlang: amperry: client-side validations (i.e. javascript) is the only way.
[01:11:15] mwlang: there’s lots of gems out there for that so you might try those before rolling your own.
[01:12:14] mwlang: amperry: http://stackoverflow.com/questions/21102324/the-rails-way-of-doing-client-side-validation-rails-4-with-simple-form
[01:15:05] amperry: mwlang: thanks, my google-fu was weak today
[01:18:21] irishfromua: has joined #RubyOnRails
[01:21:15] sevenseacat: has joined #RubyOnRails
[01:27:02] cam27: has joined #RubyOnRails
[01:34:57] duderonomy: has joined #RubyOnRails
[01:40:11] ascarter: has joined #RubyOnRails
[01:42:02] cam27: has joined #RubyOnRails
[01:46:35] hobodave: has joined #RubyOnRails
[01:47:16] Jameser: has joined #RubyOnRails
[01:49:01] ascarter: has joined #RubyOnRails
[01:49:55] ascarter: has joined #RubyOnRails
[02:03:32] quirkycoders: has joined #RubyOnRails
[02:09:36] mwlang: amperry: I can certainly relate. I think we all have weak Google-fu days.
[02:10:17] waseem__: has joined #RubyOnRails
[02:12:16] cam27: has joined #RubyOnRails
[02:27:08] b0mbnet: has joined #RubyOnRails
[02:27:54] cam27: has joined #RubyOnRails
[02:34:47] bronson: has joined #RubyOnRails
[02:46:37] hahuang65: has joined #RubyOnRails
[02:54:21] b0mbnet: has joined #RubyOnRails
[02:57:33] b0mbnet: has joined #RubyOnRails
[02:58:17] cam27: has joined #RubyOnRails
[03:08:58] ascarter: has joined #RubyOnRails
[03:23:38] agent_white: has joined #RubyOnRails
[03:24:34] fryguy: has joined #RubyOnRails
[03:24:50] juggler: has joined #RubyOnRails
[03:27:47] cam27: has joined #RubyOnRails
[03:28:11] ascarter: has joined #RubyOnRails
[03:41:05] jerematic: has joined #RubyOnRails
[03:43:33] cam27: has joined #RubyOnRails
[03:43:39] hahuang65: Scriptonaut: if you're still around, sleep blows. wait is good
[03:43:58] hahuang65: sometimes waiting properly is difficult though
[03:44:10] hahuang65: but using `sleep` just encourages throwing it in when somethhing is flaky
[03:44:29] hahuang65: but `wait` usually requires you to specify the subject you are waiting for, so at least there's a sanity check there of "we should be waiting"
[03:46:32] xall: has joined #RubyOnRails
[03:46:43] ascarter: has joined #RubyOnRails
[03:48:15] tfitts: has joined #RubyOnRails
[03:52:59] hobodave_: has joined #RubyOnRails
[03:57:41] Technodrome: has joined #RubyOnRails
[04:05:04] SteenJobs: has joined #RubyOnRails
[04:05:05] quirkycoders: has joined #RubyOnRails
[04:06:32] Scriptonaut: hahuang65: that's what I thought
[04:06:57] Scriptonaut: our full test suite went from taking 6 minutes to 45 minutes, because one of the developers litered the specs with sleeps
[04:07:07] Scriptonaut: rather than using waits
[04:07:27] Scriptonaut: however, wait_until doesn't exist anymore, it was removed in capybara 2.0
[04:07:37] Scriptonaut: I created my own implementation
[04:07:58] Scriptonaut: I've heard that capybara methods wait for you now? But only about half of them?
[04:08:21] Scriptonaut: so the best way to do things would be to just use those methods that wait implicitly?
[04:08:56] hndk: has joined #RubyOnRails
[04:09:05] hahuang65: Scriptonaut: probably. I'm unfamiliar with the newer versions of Capybara, but I've never been satisfied with the facilities it provided for waiting.
[04:11:57] jane_booty_doe: has joined #RubyOnRails
[04:13:41] cam27: has joined #RubyOnRails
[04:14:47] Scriptonaut: hahuang65: ya, that's the issue I'm having, there doesn't seem to be a decent/easy/correct way to wait
[04:15:52] hahuang65: Scriptonaut: i would open an issue on their github and ask them
[04:16:01] hahuang65: Scriptonaut: it's always been a problem for me
[04:16:04] Scriptonaut: on capybara's github?
[04:16:13] hahuang65: yeah, if they have one. I've never checked
[04:16:22] hahuang65: basically get in contact with the devs and ask what they recommend
[04:16:27] hahuang65: and why they removed `wait_until`
[04:16:38] Scriptonaut: capybara is what everybody uses, I just don't understand how there isn't a correct way to do this
[04:16:43] Scriptonaut: people have been using capybara for what, 10 years?
[04:16:47] hahuang65: i felt the same way
[04:17:07] hahuang65: maybe they just sleep. maybe they don't have as big a problem with sleep as we do :p
[04:17:34] Scriptonaut: it gets especially hairy when you have a bunch of asynchronous server calls going on
[04:17:45] Scriptonaut: pretty much every single request on our app is done via AJAX
[04:18:11] Scriptonaut: because with turbolinks being default in rails 4, every time a user clicks a link, it's loaded async
[04:18:51] Scriptonaut: I mostly wanted to come here and ask what other devs did to solve this problem, because the other dev on my team is adamant that sleeping all over the place is a completely appropriate way to deal with this
[04:19:01] Scriptonaut: but our suite now takes 45 minutes to run
[04:19:10] Scriptonaut: which makes it pretty much impossible to use
[04:19:28] Scriptonaut: most people on the team just run the unit tests n call it good
[04:20:01] hahuang65: haha that's one way, just put the integration tests on CI
[04:20:26] Scriptonaut: ya, we have them on codeship
[04:20:39] Scriptonaut: they take forever on there, though we just got the parallel/pipe system setup
[04:20:44] hahuang65: Scriptonaut: honestly, if it's good enough for the team, I wouldn't worry about
[04:20:48] Scriptonaut: but I don't think more horesepower is the correct response to this issue
[04:20:53] hahuang65: 45 minutes for the suite to run is relatively slow
[04:20:58] hahuang65: but if it's not a pain point for you guys, who cares
[04:21:03] Scriptonaut: it's definitely a pain point
[04:21:14] hahuang65: for you, or for the team?
[04:21:20] Scriptonaut: we used to run the suite before we opened a PR, now nobody does
[04:21:26] Scriptonaut: and we're introducing bugs into our app
[04:21:28] Scriptonaut: the whole team
[04:21:44] Scriptonaut: most people have dealt with it by just not running the tests
[04:22:09] hahuang65: i mean the easy thing is, put the suite on CI and block merging until suite passes
[04:22:12] Scriptonaut: but that is an issue because now everytime we release a feature, it introduces 2 to 3 to 5+ bugs
[04:22:23] hahuang65: if the problem isn't actually runtime
[04:22:30] hahuang65: just block merges until CI finishes
[04:22:33] Scriptonaut: ya, management would be like "dafuq you mean the test doesn't passes, it looks good to me"
[04:22:57] Scriptonaut: it's a constant power struggle between the devs and management on these types of things
[04:23:01] Scriptonaut: but I do like that idea
[04:23:11] Scriptonaut: the plan is to eventually get to fully automated deploys
[04:27:17] hahuang65: Scriptonaut: it's always a struggle
[04:27:19] hahuang65: for anything
[04:27:35] hahuang65: we have a test suite that takes an hour to run
[04:27:38] hahuang65: no one cares anymore
[04:27:44] hahuang65: we just let CI do it's thing
[04:29:02] cam27: has joined #RubyOnRails
[04:29:31] muhlisbc: has joined #RubyOnRails
[04:29:41] hahuang65: i mean, it sucks
[04:29:46] hahuang65: but it's too much trouble to deal with it
[04:29:48] Scriptonaut: I dunno, only problem is, we have people opening PRs probably like once an hour
[04:29:52] Scriptonaut: and CI runs every time
[04:29:55] hahuang65: that's fine
[04:30:05] hahuang65: well depends on your team size I suppose
[04:30:18] Scriptonaut: I think we have like 13 devs now
[04:30:34] hahuang65: it'll be an issue with more devs cuz you're gonna be in rebase hell
[04:30:54] hahuang65: Scriptonaut: sorry I gotta run, but good luck dude
[04:31:43] Scriptonaut: ya, no worries, thanks for the insight
[04:38:42] Ropeney: has joined #RubyOnRails
[04:39:33] knight33: has joined #RubyOnRails
[04:43:09] patarr: has joined #RubyOnRails
[04:45:40] hobodave: has joined #RubyOnRails
[04:50:33] uks: has joined #RubyOnRails
[04:51:29] Ropeney: has joined #RubyOnRails
[04:56:11] bronson: has joined #RubyOnRails
[04:58:37] cam27: has joined #RubyOnRails
[05:22:26] xall: has joined #RubyOnRails
[05:28:58] cam27: has joined #RubyOnRails
[05:30:10] nickjj_: has joined #RubyOnRails
[05:33:09] dionysus69: has joined #RubyOnRails
[05:41:16] Scriptonaut: has left #RubyOnRails: ()
[05:43:38] cam27: has joined #RubyOnRails
[05:47:12] hobodave_: has joined #RubyOnRails
[05:56:04] bronson: has joined #RubyOnRails
[06:07:22] quirkycoders: has joined #RubyOnRails
[06:14:04] cam27: has joined #RubyOnRails
[06:24:24] AzaToth: has joined #RubyOnRails
[06:29:21] cam27: has joined #RubyOnRails
[06:29:30] mauro1254: has joined #RubyOnRails
[06:34:41] conta: has joined #RubyOnRails
[06:39:07] srinidhi: has joined #RubyOnRails
[06:43:58] patarr: has joined #RubyOnRails
[06:52:13] DrYockel: has joined #RubyOnRails
[06:55:15] DriesS: has joined #RubyOnRails
[07:03:09] alphaatom: has joined #RubyOnRails
[07:13:05] gil_: has joined #RubyOnRails
[07:20:07] fumk: has joined #RubyOnRails
[07:24:09] DriesS: has joined #RubyOnRails
[07:24:41] rgr: has joined #RubyOnRails
[07:31:40] ur5us: has joined #RubyOnRails
[07:41:24] DriesS: has joined #RubyOnRails
[07:42:10] dionysus69: has joined #RubyOnRails
[07:52:02] arBmind: has joined #RubyOnRails
[07:56:59] bronson: has joined #RubyOnRails
[08:00:50] ascarter_: has joined #RubyOnRails
[08:06:10] mikecmpbll: has joined #RubyOnRails
[08:06:45] ascarter: has joined #RubyOnRails
[08:08:41] quirkycoders: has joined #RubyOnRails
[08:11:55] marr: has joined #RubyOnRails
[08:13:24] ferr: has joined #RubyOnRails
[08:18:38] srinidhi: has joined #RubyOnRails
[08:24:40] ascarter_: has joined #RubyOnRails
[08:28:03] Voxxit: has joined #RubyOnRails
[08:40:16] lxsameer: has joined #RubyOnRails
[08:44:53] patarr: has joined #RubyOnRails
[08:53:10] shilon: has joined #RubyOnRails
[08:54:34] Technodrome: has joined #RubyOnRails
[08:56:20] mahloun: has joined #RubyOnRails
[08:56:59] shilon: Hello everyone, I’m seeding an array of Categories. And I’m using faker to create companies, each company has a category_id. I’m trying to add a random category_id to each company.
[08:57:28] shotbug: has joined #RubyOnRails
[09:12:03] FastJack: has joined #RubyOnRails
[09:16:37] gusrub: has joined #RubyOnRails
[09:18:30] sevenseacat: good to know.
[09:19:31] DrYockel1: has joined #RubyOnRails
[09:26:53] dminuoso: Faker is one of the worst things around. :|
[09:27:08] dminuoso: Unpredictable data, triggering bugs at random...
[09:39:21] Terens: has joined #RubyOnRails
[09:39:39] Terens: Starting nginx with server_name _; passenger doesn seem to work
[09:39:53] DrYockel1: has joined #RubyOnRails
[09:40:20] mikecmpbll: in the words of sevenseacat: good to know.
[09:44:35] renegadeandy: has joined #RubyOnRails
[09:47:55] b0mbnet: has joined #RubyOnRails
[09:49:52] dionysus69: has joined #RubyOnRails
[09:53:53] sevenseacat: good for exposing bugs
[09:57:53] bronson: has joined #RubyOnRails
[10:00:12] dminuoso: sevenseacat: Interesting. Can you explain why? Here we avoid it because since the data is unpredictable it's totally annoying to get randomly breaking builds in our gitlab pipeline.
[10:00:57] dminuoso: (I mean you can get *some* predictability back with seeding faker, but reordering things or inserting code in the middle has some really annoying side effects)
[10:01:05] sevenseacat: thats kind of the point, it exposes assumptions you make about the shape of your data
[10:01:37] dminuoso: sevenseacat: Even if you can't reproduce it? Or do you then pull the failed docker container and analyze it?
[10:02:22] sevenseacat: yeah that can be a pain
[10:02:58] arBmind: has joined #RubyOnRails
[10:05:48] workmad3: that's when you record the rspec seed and reuse it
[10:06:45] dminuoso: workmad3: Mm, and reset the PRNG before each test?
[10:07:10] workmad3: dminuoso: no need to if you've not got anything in that's monkeying with it in your app or test code
[10:07:46] workmad3: if you have it seeded to the same value at the start of the test run, the entire sequence is deterministic
[10:08:15] workmad3: which means faker gives you the same values each run (as long as it is the same run)
[10:08:19] dminuoso: workmad3: I dont trust rspec. :p
[10:09:32] workmad3: dminuoso: the rspec side of it is just a cli option to specify the seed... you then pass that to seed the generator in spec/spec_helper.rb
[10:10:45] sevenseacat: i wasnt aware of that the seeding would carry through to faker-generated data
[10:10:47] workmad3: and tbh, you don't need rspec for it... you just need a way to specify the seed
[10:11:06] workmad3: sevenseacat: it seeds the internal random number generator, so it hits anything that uses that
[10:11:43] workmad3: so unless faker uses SecureRandom or directly pulls from something like /dev/random (which I kinda doubt :) ) it'll get seeded by the same value :)
[10:13:26] dminuoso: workmad3: Mmm. I should probably look at it again, for now Im just using factory_girl left and right with sequences.
[10:13:26] dminuoso: "User-1", "User-2", etc. is quite sufficient.
[10:13:47] workmad3: yeah, I change my mind at different points and for different projects on using fake data
[10:13:56] workmad3: *random* fake data
[10:14:58] workmad3: but it's a useful tool to have available, and if the primary reason you're not using it is because you can't repeat the builds to investigate, then it's worth knowing that you can solve that problem :)
[10:15:28] sevenseacat: i just get annoyed at debugging tests with User 1, User 2, Product 3, etc.
[10:15:35] sevenseacat: make it a bit interesting!
[10:16:05] workmad3: sevenseacat: I wrote up some sample data for an acceptance test yesterday that was spongebob references
[10:16:28] workmad3: and then did an example in another spec where I named something "Boaty McBoatface" :)
[10:16:44] sevenseacat: I do silly things like that too
[10:16:53] sevenseacat: just for a bit of fun
[10:17:13] workmad3: A member of my team then said he could guess my current level of cynicism from how fun my test data is at any point :D
[10:17:38] sevenseacat: yeah if I stop referencing the word 'awesome' a million times in tests, probably a sign I'm not having a good day
[10:19:10] workmad3: personally, I find it easier to spot the discrepancies in test data if I'm looking for something more obvious than a change of "user 1" to "user 2"... which is how I justify it :)
[10:20:21] agent_white: Would be more fun
[10:20:38] agent_white: Why test when you expect the test and can accomodate
[10:20:42] agent_white: if not... still boaring
[10:20:50] agent_white: What about a test... an actual one.
[10:21:01] agent_white: Asked for a picture, get an mp3 file.
[10:21:10] agent_white: Those are tests.
[10:21:18] workmad3: agent_white: I think I've written some tests like that too
[10:21:31] agent_white: workmad3, I made devs pissed about it too
[10:21:49] agent_white: Lucky to have been on the stick end untl they told me to learn the stick
[10:22:23] agent_white: The best QA you'll have will be the biggest idiot attempting your platform.
[10:22:38] agent_white: Keep that guy. espeically if he makes it all crash and burn.
[10:22:49] jottr: has joined #RubyOnRails
[10:23:46] agent_white: Fun to attempt to be 'that guy'. Get him through L1-3 first. Your _bad test_ will be your own if you do shit right.
[10:24:00] workmad3: it's just getting out of the assumption that your users will be sensible and nice and know what you meant to do
[10:24:09] agent_white: If your software sucks your user will report.
[10:25:11] agent_white: Basic stuff seems bad and stupid easy to fix.
[10:25:12] workmad3: ACTION goes back to ripping out awful legacy account claim functionality
[10:25:17] agent_white: Then come the good boys.
[10:25:36] agent_white: workmad3: gg :(
[10:26:11] workmad3: it wouldn't be too bad... but I need to build a mechanism to transition transparently too, as it's integrated into invoice payments :(
[10:26:27] workmad3: and for some reason, the company likes invoices to be payable...
[10:28:03] agent_white: customers pay invoices
[10:28:06] agent_white: invoices are bills
[10:29:18] shilon: has joined #RubyOnRails
[10:29:23] jottr: has joined #RubyOnRails
[10:32:21] jottr: has joined #RubyOnRails
[10:45:24] Tempesta: has joined #RubyOnRails
[10:45:38] patarr: has joined #RubyOnRails
[10:46:57] shilon: Hello everyone, I’m seeding an array of Categories. And I’m using faker to create companies, each company has a category_id. I’m trying to add a random category_id to each company.
[10:47:07] sevenseacat: yep, you said that before.
[10:47:23] shilon: category_id: Category.rand(:id).first but no success
[10:47:38] shilon: any idea of what I’m doing wrong?
[10:48:20] shilon: sevenseacat: btw, I’ve figured out my faker problem
[10:48:25] sevenseacat: define 'no success'
[10:48:49] shilon: for some reason by default I was onyl bundling non test and dev gems
[10:49:00] shilon: I added —with development and test and now it works! :)
[10:49:24] shilon: noob errors :P
[10:49:43] sevenseacat: not sure you can call that a noob error, seeing as thats something you had to do deliberately
[10:51:01] shilon: when I seed I get this error NoMethodError: private method `rand' called for
[10:51:34] sevenseacat: because there is no public `rand` method defined on AR models
[10:51:37] sevenseacat: where did you get that from?
[10:51:49] shilon: what? the error?
[10:51:52] shilon: when trying to seed
[10:52:10] sevenseacat: yes, where did you get the idea to call `rand` from
[10:52:19] sevenseacat: because that method is not public
[10:52:53] sevenseacat: even if it was public, how many categories do you have in your test database?
[10:53:37] shilon: why? beucase they are the categories I’ve defined :P
[10:53:55] sevenseacat: but anyway, where did you get `rand` from?
[10:54:03] shilon: I was googlign
[10:54:22] sevenseacat: well now you know that it doesnt work
[10:54:39] shilon: I’ve also tried this
[10:55:11] shilon: Category.first("RANDOM()")
[10:55:24] shilon: but I get ArgumentError: invalid value for Integer(): "RANDOM()"
[10:55:45] sevenseacat: well that makes sense
[10:55:59] sevenseacat: you cant take the first RANDOM() number of elements
[10:56:44] sevenseacat: it sounds like you might want to write a random scope and use it
[10:56:48] shilon: Category.find_by_id("RANDOM()") ?
[10:56:55] sevenseacat: RANDOM() isnt an ID either
[10:58:15] shotbug: has joined #RubyOnRails
[10:58:36] sevenseacat: http://stackoverflow.com/questions/17372886/whats-the-rails-4-way-of-finding-some-number-of-random-records
[10:58:43] sevenseacat: I googled 'rails random scope'
[10:58:58] p8m: has joined #RubyOnRails
[10:59:18] shilon: hum… I was googling something completely different :P
[10:59:34] shilon: rails generate random id
[10:59:44] sevenseacat: thats not what you're trying to do
[10:59:49] sevenseacat: you have records that already have IDs
[11:01:48] shilon: ok sevenseacat thanks :)
[11:01:59] shilon: btw, I’m doing 10.times Faker
[11:02:28] shilon: but I want to have one speific item that is not faker generated
[11:03:04] shilon: I’m doing Company.create twice
[11:03:35] sevenseacat: another 10 categories? fun
[11:04:15] shilon: sorry maybe I didn’t express myself well
[11:04:21] shilon: let me gist for you to understand
[11:04:40] sevenseacat: yeah if youre having problems with specific code, it helps when you show it.
[11:05:42] shilon: https://gist.github.com/jamesalbuquerque/4fe4edfebfa2faf5c190db796e35a599
[11:05:49] shilon: can I do this?
[11:05:59] shilon: create multiple + 1?
[11:06:08] sevenseacat: sure you can. i have no idea what you're trying to do, but you can write whatever code you want.
[11:06:43] sevenseacat: i dont know why you're trying to assign 17 categories to the category_id fued
[11:07:09] sevenseacat: but if what you have works and has the effect you want, its good enough for now.
[11:07:11] shilon: ohh shait!
[11:07:23] shilon: I though that was the max num he would find..
[11:08:18] sevenseacat: in that case, it probably helps to check the documentation of any method you don't know.
[11:08:22] shilon: since I’ve added Category.order("RANDOM()").limit(1) the seed only creates the static company
[11:09:12] sevenseacat: use create! instead of create to get an exception when it fails, so you can see why
[11:09:29] quazimodo: has joined #RubyOnRails
[11:10:03] shilon: should use in all creates?
[11:10:30] sevenseacat: in tests, if you expect that data to be created successfully, then yes.
[11:10:46] shilon: thanks mate
[11:10:54] shilon: ActiveRecord::RecordInvalid: Validation failed: Category can't be blank
[11:11:21] sevenseacat: are you sure you have categories in your database?
[11:12:32] sevenseacat: doesnt look like it
[11:12:34] shilon: just made rails c - Category.all and I have them
[11:12:41] sevenseacat: yeah, thats your development database
[11:12:45] sevenseacat: not your test database
[11:12:51] shilon: but I have no companies
[11:13:24] sevenseacat: wait, are you working in test or development? faker is usually for test data
[11:13:42] shilon: development
[11:14:03] shilon: so if I’m not in test I shouldn’t use faker?
[11:14:11] shilon: but one thing
[11:14:30] shilon: I’ve managed to create all the companies if I add category_id: 1
[11:14:40] shilon: but I don’t want all companies to have the same category_id…
[11:15:00] shilon: so I know for sure it’s my random scope code that is breaking the seed
[11:15:16] sevenseacat: so in your console, what does Category.order("RANDOM()").limit(1) return?
[11:15:24] xall: has joined #RubyOnRails
[11:15:34] shilon: let me see
[11:16:05] shilon: Category id: 3, category: "Computers / Technology"
[11:16:23] sevenseacat: the whole thing. is it a category or an array of categories?
[11:16:32] shilon: an array of categories
[11:16:38] shilon: id and category name
[11:16:54] sevenseacat: so there's the problem
[11:17:05] sevenseacat: you can't assign an array to be a single category
[11:17:07] shilon: I knew it had something to do with that
[11:17:24] shilon: so I can’t do this?
[11:17:52] gusrub: has joined #RubyOnRails
[11:18:02] sevenseacat: you can, you just need a single category to assign instead of an array
[11:18:13] sevenseacat: instead of .limit(1), try .first
[11:19:02] shilon: so it first randomizes the array and gets the first item right?
[11:19:22] sevenseacat: try it and see
[11:19:48] shilon: I knew I had tried this before
[11:19:51] shilon: ActiveRecord::RecordInvalid: Validation failed: Category can't be blank
[11:20:14] sevenseacat: use the helpful words.
[11:20:31] shilon: https://gist.github.com/jamesalbuquerque/4fe4edfebfa2faf5c190db796e35a599
[11:21:05] shilon: could it be the {} in each category?
[11:21:44] sevenseacat: try it and see.
[11:21:52] sevenseacat: alternatively, check the documentation for the methods you're using.
[11:22:26] shilon: sevenseacat: thanks for everything my friend!
[11:24:44] shotbug: has joined #RubyOnRails
[11:24:49] hobodave: has joined #RubyOnRails
[11:32:18] quirkycoders: has joined #RubyOnRails
[11:33:09] chouhoulis: has joined #RubyOnRails
[11:36:32] chouhoulis: has joined #RubyOnRails
[11:37:48] dblessing: has joined #RubyOnRails
[11:43:43] patarr: has joined #RubyOnRails
[11:47:20] DrYockel1: has joined #RubyOnRails
[11:47:53] shotbug: has joined #RubyOnRails
[11:51:18] dblessing: has joined #RubyOnRails
[11:52:05] Terens: Hello. I have several devices running a ruby daemon. Which tools are appropriate to use to send them notifications from a central server?
[11:52:06] DrYockel: has joined #RubyOnRails
[11:52:30] Terens: I could use long polling etc .. Is websocket a good option ?
[11:53:29] fgielow: has joined #RubyOnRails
[11:58:13] Papierkorb: Terens: rails5 apps?
[11:59:21] bronson: has joined #RubyOnRails
[12:00:07] Archrover: has joined #RubyOnRails
[12:02:11] Jameser: has joined #RubyOnRails
[12:04:59] Jameser: has joined #RubyOnRails
[12:10:17] Technodrome: has joined #RubyOnRails
[12:12:13] Ergo: has joined #RubyOnRails
[12:13:19] srinidhi: has joined #RubyOnRails
[12:13:27] ahrs: has joined #RubyOnRails
[12:16:09] Jameser: has joined #RubyOnRails
[12:28:36] SteenJobs: has joined #RubyOnRails
[12:31:05] DriesS: has joined #RubyOnRails
[12:33:56] Terens: @Papierkorb one yes
[12:35:12] Papierkorb: Terens: If the messaging server is a rails app, or if all target apps are rails apps, you could use WebSockets through the ActiveCable stuff (Rails 5.0+). Haven't used it myself, but it's built-in
[12:35:43] Terens: But how can
[12:35:56] Terens: clients consume this websocket?
[12:35:59] Terens: ruby clients
[12:39:37] Ericx2x: has joined #RubyOnRails
[12:44:05] jerematic: has joined #RubyOnRails
[12:48:44] DrYockel1: has joined #RubyOnRails
[12:53:39] DrYockel: has joined #RubyOnRails
[12:56:11] schuylr: has joined #RubyOnRails
[12:57:59] jarr0dsz: has joined #RubyOnRails
[12:58:35] jarr0dsz: hello everyone, anyone could help me with this ActiveRecord::Base.establish_connection DB_ROUTER creating a db connection works
[12:58:44] jarr0dsz: but how could I use this to query with AR afterwards?
[12:58:55] jarr0dsz: i have an Organisation model but Organisation.all returns nil.
[12:59:06] jarr0dsz: Assuming this changes the db connection and one could do regular AR stuff but this is not true
[13:00:08] durango: has joined #RubyOnRails
[13:00:26] durango: undefined method `each_with_index' for #<ImageUploader::..> anyone have success with multiple image uploads using carrierwave?
[13:03:48] dminuoso: drcapulet: Yes.
[13:04:10] dminuoso: durango: However, "anyone have..." is a really bad way of asking about a problem.
[13:04:16] dminuoso: Show your code, and the full error including the stack trace.
[13:04:25] durango: dminuoso yeah Im ripping things apart for gist
[13:04:31] dminuoso: durango: Dont rip apart.
[13:04:40] dminuoso: durango: If you have the need to reduce, make a testcase.
[13:04:59] dminuoso: git stash; git checkout -B carrierwave_test; and start deleting stuff.
[13:06:21] durango: dminuoso https://gist.github.com/durango/60c6118ebe31f7b6cdfa5432f7c3271d heres my gist
[13:08:19] dminuoso: durango: You need to use the mount_uploaders helper for multiple images
[13:08:25] dminuoso: (rather than mount_uploader)
[13:08:55] durango: dminuoso so I tried using mount_uploaders and it says undefined method `mount_uploaders' fo
[13:09:09] dminuoso: durango: What version of carrierwave are you using?
[13:09:44] durango: dminuoso carrierwave (0.11.2)
[13:09:55] dminuoso: durango: Upgrade that then.
[13:11:07] dminuoso: durango: https://github.com/carrierwaveuploader/carrierwave/commit/62eee426ff0b012082fdb433b7cf07af0414e56e
[13:11:14] dminuoso: It's been added 3 years ago.
[13:11:18] durango: yeah im in that file now which was confusing me
[13:11:34] dminuoso: durango: What is ApplicationRecord ?
[13:11:43] dminuoso: By "what is" I mean how did you define it
[13:11:47] durango: ok, i was onboarded to this project so im not exactly sure why CW is such an old version o-o
[13:12:12] dminuoso: durango: Its not.
[13:12:23] dminuoso: durango: It should be sufficient still.
[13:12:31] durango: dminuoso https://gist.github.com/durango/87e8547ae705d86a2e41120ed2a3c06c
[13:13:06] durango: yeah still undefined method mount_uploaders hmm
[13:13:54] dminuoso: durango: Show me the stack trace of that
[13:14:00] dminuoso: Full stack trace please
[13:14:08] dminuoso: I want to see how it blows up
[13:14:30] durango: dminuoso https://gist.github.com/durango/ec93673ef40dc64ad72f3ba883f7eb81
[13:15:05] srinidhi: has joined #RubyOnRails
[13:15:50] dminuoso: durango: There's no way that can blow up.
[13:17:33] durango: dminuoso im not sure, Im only reporting to you whats on my screen
[13:17:46] dminuoso: durango: Ohh!
[13:17:58] dminuoso: durango: My bad, it was not added until 1.0.0.beta9
[13:18:03] dminuoso: the introducing commit was just very old
[13:18:14] dminuoso: But it seems like it didnt get put into a release until 1.0.0.beta9
[13:18:17] durango: so I need to grab from #master yeah?
[13:18:54] gusrub: has joined #RubyOnRails
[13:18:55] dminuoso: durango: just change the version constraint to ~1.1
[13:19:04] dminuoso: and bundle upgrade carrierwave
[13:19:07] durango: wait bundle update didnt technically update it.. still 0.11
[13:19:45] dminuoso: durango: how do you specify the gem in your Gemfile?
[13:21:20] durango: dminuoso https://gist.github.com/durango/fcaa97f52c549ed0a72703ab18bf8e2c wondering if any o fthese other gems are causing issues
[13:22:22] chouhoulis: has joined #RubyOnRails
[13:23:13] dminuoso: durango: Use a version constraint. That will force bundler to either error or install the desired version.
[13:23:35] dminuoso: durango: This makes sense becauase whenever you start using features that requires a certain version to work, you should specify that constraint in Gemfile.
[13:23:55] dminuoso: "~>1.1" should be sufficient
[13:24:20] dminuoso: durango: If not you can simply manually use the uploaders.
[13:24:34] durango: yeah 1.1 is giving me errors for background now
[13:24:37] dminuoso: durango: carrierwave consists of the entire uploader backend and a very trivial helper that you can just implement yourself
[13:25:32] dminuoso: durango: https://github.com/carrierwaveuploader/carrierwave/blob/87c37b706c560de6d01816f9ebaa15ce1c51ed58/lib/carrierwave/mount.rb#L134-L198
[13:25:41] dminuoso: durango: https://github.com/carrierwaveuploader/carrierwave/blob/c45699c318ca895f89fa3304204e48b5f1c411f1/lib/carrierwave/orm/activerecord.rb#L12-L22
[13:25:48] dminuoso: And the mount_uploaders are right beneath both
[13:27:42] dminuoso: durango: That's the price for picking dead and no-longer-maintained gems. ;-)
[13:27:56] durango: dminuoso yeah im wondering if theres a way to force it but prob not :(
[13:28:12] sevenseacat: carrierwave is dead? >_>
[13:28:49] dminuoso: sevenseacat: carrierwave_backgounder is
[13:29:12] chouhoulis: has joined #RubyOnRails
[13:29:15] dionysus69: so I am doing good if I am sticking to paperclip? :D
[13:29:26] dminuoso: dionysus69: It has nothing to do with that :|
[13:29:38] dminuoso: Im sure paperclip has tons of dead extensions and related gems too.
[13:29:53] dminuoso: If not Ill make one and stop maintaining it just to prove my point.
[13:29:54] dionysus69: oh I see, I wasn't following full conversation :)
[13:31:12] durango: dminuoso its all good now! :) thank you for your time+patience
[13:32:06] DLSteve: has joined #RubyOnRails
[13:36:36] Technodrome: has joined #RubyOnRails
[13:37:43] DriesS: has joined #RubyOnRails
[13:41:08] User458764: has joined #RubyOnRails
[13:43:45] pupsicle: has joined #RubyOnRails
[13:45:08] durango: ok new issue when I try to upload an image now https://gist.github.com/durango/ce400cc6b5f9e35cd90e6ef4fb4d2f7d I checked the input[name] value and that seems to be correct not exactly sure why Rails is trying to initialize MediaPhoto at all
[13:45:34] hobodave_: has joined #RubyOnRails
[13:46:53] EXCHGR: has joined #RubyOnRails
[13:51:40] TvL2386: has joined #RubyOnRails
[13:51:55] Technodrome: has joined #RubyOnRails
[13:54:49] DriesS: has left #RubyOnRails: ()
[13:55:00] jarr0dsz: hello everyone i see the ActiveRecord::Base.establish_connection DB_ROUTER changes systemwide
[13:55:15] jarr0dsz: i require a change of connection on a per user base.. how would I approach this?
[13:55:26] sevenseacat: I'd recommend against it.
[13:55:29] jarr0dsz: Is it possible to create a new connection and add it to the connection pool?
[13:55:47] dminuoso: jarr0dsz: I doubt that you *require* it.
[13:55:55] dminuoso: I bet that you *think* you need it to solve some problem.
[13:56:02] dminuoso: So let's start with the problem you have.
[13:57:28] jarr0dsz: my mechanism is like this: https://gist.github.com
[13:57:42] dminuoso: The website?
[13:57:42] sevenseacat: really? you wrote gist?
[13:58:10] jarr0dsz: preventing multiline spam? i have implemented this almost totally the only problem is when im switching to the router db and then this is systemwide so everything breaks for other users
[13:58:22] dminuoso: You have implemented a pastebin service?
[13:58:30] helpa: ¯\_(ツ)_/¯ Sorry, sevenseacat is not able to help you any further as they do not know.
[13:58:33] dminuoso: jarr0dsz: You accidentally gave us the link to gist.github.com in general, not some specific ode.
[13:58:40] dminuoso: sevenseacat: Oh boy.
[13:58:41] dminuoso: I love that.
[13:58:43] jarr0dsz: https://gist.github.com/anonymous/507371c45f6b4aba063e68523a643410 excuse
[13:58:45] shilon: has joined #RubyOnRails
[13:58:46] sevenseacat: i just wanted the face
[13:58:48] apparition: has joined #RubyOnRails
[13:59:01] sevenseacat: good lord that's a terrible idea jarr0dsz
[13:59:07] schuylr: dminuoso: Back to haunt you with my AR troubles. I’m writing my test case but I don’t want to have ActiveRecord::Mysql2TestCase create a bunch of other schema that I don’t want. Any suggestions?
[13:59:08] jarr0dsz: it is sevenseacat ?
[13:59:16] schuylr: ARCONN=mysql2 bundle exec ruby -Itest test/cases/adapters/mysql2/enum_gem_test.rb -n test_valid_column
[13:59:18] dminuoso: schuylr: Mmmm.
[13:59:32] sevenseacat: 'login this user like regular to a DB you're no longer connected to'
[13:59:41] jarr0dsz: i have multiple databases for each user, im only using the "router" db to lookup the corrosponding database id for that email of the user
[14:00:00] jarr0dsz: sevenseacat yes the user tables are in each seperate database
[14:00:01] sevenseacat: seriously, why?
[14:00:14] bronson: has joined #RubyOnRails
[14:00:24] jarr0dsz: multitennant solution having seperate databases for users, and no way for the codebase to get access to other's database
[14:00:36] schuylr: First thing that comes to mind with multitenancy: https://github.com/influitive/apartment
[14:00:41] sevenseacat: second thing is
[14:00:43] helpa: Multitenancy With Rails - https://leanpub.com/multi-tenancy-rails-2 - An excellent book that teaches you about building a Multitenanted Rails application. Written by Ryan Bigg.
[14:00:50] jarr0dsz: it works quite nice is lean yes i have looked at those and the book its overkill for our solution
[14:00:53] sevenseacat: both of which offer much simpler solutions
[14:01:07] schuylr: overkill vs. hacking the DB_ROUTER
[14:01:18] sevenseacat: 'schemas are too complicated. i need a whole new db'
[14:03:03] jarr0dsz: using mysql
[14:03:35] sevenseacat: databases are too hard. let's go shopping!
[14:03:51] mrbubbles: has joined #RubyOnRails
[14:04:03] mrbubbles: I'm reading a file that is arriving via FTP. It's working most of the time, but sometimes silently failing. Doesn't seem able to read the contents of the file. I suspect that the FTP is not "releasing" the file when it's finished uploading, does that sound plausible? Any way I can check that?
[14:04:04] jarr0dsz: but is there a way to do a db connection and not make it system wide? just temporarily
[14:04:18] sevenseacat: [21:55:26] sevenseacat: I'd recommend against it.
[14:04:56] dminuoso: schuylr: I dont understand what you mean by that
[14:05:38] schuylr: dminuoso: The unit test loads the helper.rb which in turn loads a whole schema.rb and mysql2_specific_schema.rb
[14:05:56] schuylr: I don’t need either. Just using with_example_table and a single column :)
[14:06:16] dminuoso: schuylr: Im completely unsure what kind of stage you are at right now.
[14:06:53] schuylr: Sorry - I’m doing a unit test against a gem that broke with an activerecord update that you recommended I git-bisect to figure out the breaking commit
[14:06:59] jarr0dsz: like so https://github.com/rails/rails/blob/801b33a4812c937a7e726d4060e2e3e9361c56fa/activerecord/test/support/connection_helper.rb#L2-L7
[14:07:29] jarr0dsz: it is possible only problem this is still systemwide, i would require a seperate connection beside the existing one assuming this is possible
[14:07:40] schuylr: dminuoso: I wrote my own test as you suggested yesterday but there’s no need for the rest of the schema (which breaks in my utf8mb4 encoded database)
[14:07:56] dminuoso: schuylr: Who cares about the rest of the schema. It an be a dirty hack.
[14:08:03] dminuoso: schuylr: Or do you have a migration problem?
[14:08:13] dminuoso: I cant recall what the exact problem was anymore
[14:08:14] schuylr: Yeah I don’t want it!
[14:08:22] dminuoso: schuylr: Then keep it.
[14:08:29] dminuoso: It doesnt influence your testcase
[14:08:43] schuylr: lol - I’ll just make a separate db in utf8 so it doesn’t break
[14:09:02] richardjohn: happy friday everyone - have a timezone question, hopefully quite simple. I want to display/input dates in the local timezone, but store them in UTC. I’ve set ‘config.time_zone = 'London’’ and ‘config.active_record.default_timezone = :utc’
[14:09:08] richardjohn: (London is currently UTC+01)
[14:09:17] richardjohn: and if I input a date local time, it correctly saves it as UTC
[14:09:26] richardjohn: but when reading it back, it’s still in UTC
[14:09:32] richardjohn: so it doesn’t do the conversion back to +01
[14:09:44] richardjohn: is there a way to get ActiveRecord to do that? the docs imply it should
[14:10:01] sevenseacat: you dont need to specify the default_timezone line - thats what Rails does by default
[14:10:17] schuylr: with_timezone ?
[14:10:27] schuylr: can’t remember the exact name
[14:10:46] sevenseacat: I have no idea what Rails does with DST
[14:11:26] richardjohn: sevenseacat: it seems to deal with DST fine, it knows London is currently +01 and takes the hour off when saving
[14:11:39] workmad3: richardjohn: I think it's because you should have 'config.active_record.default_timezone = :local'
[14:11:39] richardjohn: it’s just the retrieval that’s the issue
[14:11:39] sevenseacat: ok, so how are you outputting the date
[14:11:49] sevenseacat: workmad3: ah hah
[14:11:56] richardjohn: workmad3: afaik, that’ll save in local time not UTC
[14:12:09] sevenseacat: I've never seen that key changed, so
[14:12:17] sevenseacat: makes me think you should just remove it :)
[14:12:39] workmad3: richardjohn: no, it still saves in UTC
[14:12:51] workmad3: at least, everything I can find says it's still saved in UTC
[14:13:03] richardjohn: the display is just a formtastic field
[14:13:08] richardjohn: will check outputting it without formtastic
[14:13:31] sevenseacat: ACTION wonders why people ask questions without listening to the answers
[14:14:13] shilon: sevenseacat: hey, based on what we talked before, do you think this could be an option? http://sebastien.saunier.me/blog/2015/11/04/retrieve-a-random-record-in-a-rails-application.html
[14:14:48] richardjohn: sevenseacat: err I am listening, but if :utc is the default then setting it to :utc explicitly isn’t going to cause this issue...
[14:14:58] sevenseacat: richardjohn: remove it
[14:15:02] sevenseacat: it should be local
[14:15:12] richardjohn: if I remove it it’ll default to :utc
[14:15:17] dionysus69: has joined #RubyOnRails
[14:15:17] sevenseacat: have you tried it?
[14:15:57] sevenseacat: we'll wait while you do.
[14:16:04] richardjohn: which value should I set it to?
[14:16:29] sevenseacat: let Rails do what it normally does without you interfering
[14:16:32] workmad3: richardjohn: start by removing it, and then try it set to :local if that doesn't work... and look at what ends up in the DB at each point
[14:16:53] workmad3: i.e. try things out, don't just assume that they don't work
[14:17:23] richardjohn: sorry but there are two options for that config setting, removing it will just default it to one of the two
[14:17:28] richardjohn: I’m trying :local
[14:17:48] dangerousdave: has joined #RubyOnRails
[14:17:48] richardjohn: “remove it” is stupid advice which implies Rails is a magic box that people have no idea of the default behaviour
[14:18:08] sevenseacat: well you dont, so
[14:18:14] workmad3: richardjohn: given that `config.time_zone = "blah"` will mess with ActiveRecord, it's not a stupid suggestion
[14:18:25] sevenseacat: I don't either, because I've never had to change it.
[14:18:35] sevenseacat: it works just like you want, out of the box.
[14:18:38] workmad3: (it states in the docs for that config directive that it enables timezone awareness in AR...)
[14:18:50] sevenseacat: pfft, docs, no-one reads those
[14:19:07] dminuoso: rails has docs?
[14:19:19] workmad3: dminuoso: well, it has source code, which is the same thing, right? :P
[14:19:21] dminuoso: I thought it was all documented in stackoverflow answers.
[14:19:30] dminuoso: At least thats what some people in here would have me believe.
[14:19:53] dminuoso: workmad3: heh.
[14:19:54] workmad3: dminuoso: it also has every method ever deprecated according to apidock...
[14:20:11] sevenseacat: i heard apidock finally died
[14:20:24] sevenseacat: damn, it came back.
[14:20:27] dminuoso: workmad3: Though the official api.rubyonrails.org is pretty good.
[14:20:33] dminuoso: It just seems like nobody except me uses it.
[14:20:44] sevenseacat: I use dash like a mofo for everything.
[14:20:47] sevenseacat: including rails docs
[14:20:57] dminuoso: sevenseacat: dash?
[14:21:05] workmad3: dminuoso: I have two api.rubyonrails.org tabs open atm :)
[14:21:08] sevenseacat: https://kapeli.com/dash
[14:21:16] richardjohn: setting it to :local just returns the UTC date but with +0100 appended rather than UTC
[14:21:51] dminuoso: sevenseacat: Mmmm that looks pretty extensive.
[14:22:03] dminuoso: sevenseacat: Are you happy with it?
[14:22:09] sevenseacat: I just add gems and elixir packages and every framework I ever use
[14:22:40] sevenseacat: dminuoso: love it.
[14:27:39] srinidhi: has joined #RubyOnRails
[14:28:36] patarr: has joined #RubyOnRails
[14:29:40] ponzii: has joined #RubyOnRails
[14:29:41] ForeignBiscuit: has joined #RubyOnRails
[14:30:04] ponzii: I'm about to take a job with a company who want their in-house CodeIgniter 2 CMS rewriting in a more modern language. They're particularly proud of the performance of the sites they've built with the CMS so I'm wondering if Rails can match what they already have given the right approach to caching, turbolinks etc.
[14:30:52] schuylr: CodeIgniter 2, wow I remember that framework
[14:31:10] schuylr: Rails is a dream compared to that imo
[14:31:15] ponzii: schuylr: Not pretty, but pretty lean 'n fast with PHP7
[14:31:35] sevenseacat: the memories.... (none good)
[14:31:53] schuylr: Well I haven’t been in the PHP game for a few years now so I don’t know how PHP7’s speed is compared to Ruby. Rumour is it’s a tad bit better?
[14:31:59] ponzii: schuylr: Just don't want them firing me for producing something more elegant but slower :(
[14:32:52] schuylr: Well that’s perceptive. The framework can be slightly slower but if there’s fancy fragment caching and nice use of turbolinks, that ultimately makes the overall experience faster
[14:33:26] theunraveler: has joined #RubyOnRails
[14:33:40] sevenseacat: I don't think performance will be a problem.
[14:34:56] ponzii: sevenseacat: Guess I should just download a copy of CI2 and setup a demo for ab testing and compare with `rails new ci2replacement`
[14:35:26] schuylr: Yeah you could do a benchmark on “Hello World"
[14:35:45] sevenseacat: i dont think that kind of benchmark will be very useful <_<
[14:35:46] schuylr: maybe try adding some cases for database calls to ensure that you factor in hydration speeds and whatnot
[14:36:56] sevenseacat: rails is an entirely different beast to any PHP framework, that rebuilds your whole stack on every page load
[14:37:13] pLaToOn: has joined #RubyOnRails
[14:37:57] ponzii: sevenseacat: Yeah, I get that and that's why I'm wondering. If they've been good at optimising CI2, which is a much lighter framework than Rails, Rails might be a hard sell.
[14:38:02] schuylr: Rebuilds the WHOLE stack? What about autoloaders and initializers? I can wipe a lot of those away and they’re still in memory
[14:38:03] richardjohn: depends on which ORM they’re using tbh
[14:38:18] richardjohn: if they’re not using one, you’ve got no chance matching the performance with Rails
[14:38:24] richardjohn: if they’re using Doctrine it’s doable
[14:38:34] schuylr: blech, Doctrine
[14:38:43] ponzii: richardjohn: I use quite a bit of find_by_sql in my Rails projects.
[14:39:12] richardjohn: ponzii: there’s probably no huge performance barrier, then!
[14:39:27] richardjohn: nothing wrong with SQL
[14:39:32] sevenseacat: I'd argue that there's no benefit to using a 'modern language' if you're still going to use the same shitty practices
[14:39:51] ponzii: sevenseacat: Shitty practices?
[14:39:54] richardjohn: using SQL is not a “shitty practice” lol
[14:40:10] ponzii: sevenseacat: A lot of the SQL I have to deal with would be tortuous in AR
[14:40:11] richardjohn: it’s a good tool for a lot of things
[14:40:14] sevenseacat: using 'quite a lot of find_by_sql' is a code smell.
[14:40:23] richardjohn: there is no way you can sanely accomplish a lot of stuff in AR
[14:40:37] ascarter: has joined #RubyOnRails
[14:41:50] ponzii: sevenseacat: When you're taking-on an existing database with complex JOINs AR isn't the answer to everything.
[14:44:41] richardjohn: if someone gave you a complex search strategy, you’d try it and do it in AR because “it’s the right way”?
[14:44:56] sevenseacat: i'd reach for a search engine.
[14:44:57] richardjohn: then spend the extra money on hardware trying to get it to return in < 5 minutes...
[14:45:11] richardjohn: what does that mean
[14:45:17] schuylr: Elasticsearch, etc.
[14:45:32] richardjohn: that’s great for searching documents
[14:45:39] sevenseacat: searching anything
[14:45:42] richardjohn: not so great for doing structured searches across datasets
[14:46:02] schuylr: huh… with elasticsearch-rails those documents become full AR-ish models
[14:46:39] richardjohn: I think we’re building very different applications
[14:48:51] pupsicle: has joined #RubyOnRails
[15:02:36] Ropeney: has joined #RubyOnRails
[15:03:37] xall: has joined #RubyOnRails
[15:06:17] zepy_aq: has joined #RubyOnRails
[15:08:44] Dreamer3: has joined #RubyOnRails
[15:09:34] dangerousdave: has joined #RubyOnRails
[15:22:11] Saukk: has joined #RubyOnRails
[15:23:21] Technodrome: has joined #RubyOnRails
[15:29:41] mrbubbles: Has anyone used the "Listen" gem before?
[15:31:48] shilon: has joined #RubyOnRails
[15:35:39] cam27: has joined #RubyOnRails
[15:37:03] schuylr: has left #RubyOnRails: ()
[15:37:11] schuylr: has joined #RubyOnRails
[15:40:10] quiller: has joined #RubyOnRails
[15:47:31] tycoon177: Is there a way to get a route name from a path string?
[15:48:04] ascarter: has joined #RubyOnRails
[15:57:31] dblessing: has joined #RubyOnRails
[16:01:10] bronson: has joined #RubyOnRails
[16:03:30] shilon: has joined #RubyOnRails
[16:06:40] rakm: has joined #RubyOnRails
[16:07:12] marr: has joined #RubyOnRails
[16:08:34] hobodave: has joined #RubyOnRails
[16:10:30] hobodave: has joined #RubyOnRails
[16:11:26] hobodave: matthewd you around?
[16:16:45] dangerousdave: has joined #RubyOnRails
[16:17:39] gusrub: has joined #RubyOnRails
[16:27:31] bennyzr: has joined #RubyOnRails
[16:28:56] bennyzr: Hi, how do I get rails to run an update or validation callback when only an attr_accessor field is submitted to the server?
[16:36:15] User458764: has joined #RubyOnRails
[16:38:16] uksio: has joined #RubyOnRails
[16:38:34] cnk: has joined #RubyOnRails
[16:40:45] schuylr: dminuoso: If I run register_type on the same key as before, will it override the existing register_type for a column? i.e. register_type(%r(enum)i) to override the original one in AbstractMysqlAdapter
[16:41:15] schuylr: Ah, I think yes, since it just overwrites the key in @mapping under TypeMap
[16:42:00] uks: has joined #RubyOnRails
[16:44:43] mikecmpbll: has joined #RubyOnRails
[16:45:22] defsdoor: has joined #RubyOnRails
[16:49:26] shilon: has joined #RubyOnRails
[16:51:11] b0mbnet: has joined #RubyOnRails
[16:52:25] uksio: has joined #RubyOnRails
[16:56:57] polishdub: has joined #RubyOnRails
[16:59:24] NeoMalachi: has joined #RubyOnRails
[17:03:00] irishfromua: has joined #RubyOnRails
[17:05:51] knight33: has joined #RubyOnRails
[17:07:07] alphaatom: has joined #RubyOnRails
[17:08:54] arBmind: has joined #RubyOnRails
[17:21:24] Technodrome: has joined #RubyOnRails
[17:23:17] armyriad: has joined #RubyOnRails
[17:26:55] dionysus69: has joined #RubyOnRails
[17:28:54] mimico: has joined #RubyOnRails
[17:31:35] gusrub: has joined #RubyOnRails
[17:31:37] hobodave: forgive me if this is phrased stupidly, but how do I figure out what class is referred to by this error message? NoMethodError: undefined method `default_scope_override' for #<Class:0xc414eb3>
[17:31:49] hobodave: what is that hex ID?
[17:33:21] fryguy: hobodave: it's a memory address
[17:34:11] fryguy: the class that is being referred to there is a class of type class.
[17:34:20] hobodave: Thanks fryguy. That helps. How do I figure out what Class it refers to? Or, even simpler, if I have a candidate Class, how do I get its memory address?
[17:34:43] fryguy: memory addresses will be different on every run, that's not going to help you
[17:34:51] fryguy: the class that you are working with is called Class
[17:34:56] hobodave: this is in a rails console
[17:34:59] hobodave: so it's within the same run
[17:35:07] hobodave: I'd like to inspect that class if it's still in memory, if possible
[17:35:42] hobodave: I've been trying to debug a bizarre concurrency bug in Rails for the better part of a month and I'm getting close :D
[17:35:54] fryguy: ObjectSpace might help you
[17:36:30] hobodave: I've been avoiding that. I'm on JRuby, so I have to explicitly enable that. I'm afraid of Heisenberg. :D
[17:37:39] duderonomy: has joined #RubyOnRails
[17:37:52] hobodave: fryguy just found this: http://stackoverflow.com/questions/2402228/accessing-objects-memory-address-in-ruby
[17:37:56] hobodave: that's cool :)
[17:38:56] ascarter: has joined #RubyOnRails
[17:41:34] ascarter: has joined #RubyOnRails
[17:44:52] ascarter: has joined #RubyOnRails
[17:51:26] woods: has joined #RubyOnRails
[17:51:54] woods: good morning
[17:54:54] hobodave: morning woods
[17:55:37] woods: does anyone in here have experience with the has_friendship gem? I am working on a small social networking project
[17:56:59] ascarter: has joined #RubyOnRails
[18:00:02] montyboy: has joined #RubyOnRails
[18:02:11] bronson: has joined #RubyOnRails
[18:02:20] hobodave: you're unlikely to get help here for that
[18:04:33] woods: hobodave: fair enough, it was worth a shot, thanks
[18:18:24] raul782: has joined #RubyOnRails
[18:22:19] cam27: has joined #RubyOnRails
[18:23:51] woods: has left #RubyOnRails: ()
[18:31:40] schuylr: has left #RubyOnRails: ()
[18:31:49] tercenya: has joined #RubyOnRails
[18:40:06] Technodrome: has joined #RubyOnRails
[18:47:38] ascarter_: has joined #RubyOnRails
[19:00:02] ascarter: has joined #RubyOnRails
[19:01:11] User458764: has joined #RubyOnRails
[19:01:21] ascarter: has joined #RubyOnRails
[19:02:18] Aherin: has joined #RubyOnRails
[19:06:52] ascarter: has joined #RubyOnRails
[19:07:44] bheesham: has joined #RubyOnRails
[19:12:22] ascarter: has joined #RubyOnRails
[19:20:16] sunya7a: is it possible to direct a controller to load a view with a specific anchor? for example i know you can do something like edit_project_path(@project, anchor: "start-here")
[19:21:05] sunya7a: should i be using redirect_to or render perhaps?
[19:23:05] lxsameer: has joined #RubyOnRails
[19:28:21] ur5us: has joined #RubyOnRails
[19:29:39] gil_: has joined #RubyOnRails
[19:31:30] Technodrome: has joined #RubyOnRails
[19:32:01] futilegames: has joined #RubyOnRails
[19:41:35] ascarter: has joined #RubyOnRails
[19:44:59] _tpavel: has joined #RubyOnRails
[19:47:25] arup_r: has joined #RubyOnRails
[19:52:01] planigan: has joined #RubyOnRails
[19:55:45] choke: has joined #RubyOnRails
[19:56:23] quirkycoders: has joined #RubyOnRails
[19:56:31] amperry: has joined #RubyOnRails
[19:56:42] ascarter: has joined #RubyOnRails
[20:01:41] hobodave_: has joined #RubyOnRails
[20:03:07] bronson: has joined #RubyOnRails
[20:05:31] squaregoldfish: has joined #RubyOnRails
[20:06:11] dionysus69: has joined #RubyOnRails
[20:06:52] fernandomm: has joined #RubyOnRails
[20:07:59] pupsicle: has joined #RubyOnRails
[20:09:21] squaregoldfish: Linux/Bash: I have .ruby-version and .ruby-gemset. If I cd into the directory and run rails s, everything is happy. But if I do the same in a shell script, it doesn’t work (rails: command not found). Running gem env in the script shows that it’s not setting up the paths etc for the gemset. Any idea why it doesn’t work?
[20:09:43] ur5us: has joined #RubyOnRails
[20:10:17] amperry: hey folks, I've got a problem with an attribute that won't save. Gist: https://gist.github.com/amp108/b7178aa7a0f0acdbef4e2c74ac062e10
[20:10:41] fryguy: squaregoldfish: how is .ruby-gemset loaded usually?
[20:11:15] fryguy: amperry: and if you call `save!` instead of `save`?
[20:12:02] amperry: fryguy: no errors, still doesn't save
[20:12:14] squaregoldfish: fryguy: I’m using rvm
[20:12:27] fryguy: squaregoldfish: and is rvm being loaded in the script?
[20:13:09] fryguy: amperry: oh nm i see what you are doing
[20:13:17] fryguy: everytime you call #find you are creating a new object
[20:13:23] fryguy: assign it to a variable before manipulating it
[20:14:32] amperry: fryguy: thanks
[20:14:40] mwlang: faker rocks. good for lorem ipsum and jazzin’ up prototypes. :-)
[20:14:49] knight33: has joined #RubyOnRails
[20:15:17] ascarter: has joined #RubyOnRails
[20:16:42] squaregoldfish: fryguy: You genius. Never saw that as it’s in my bash_profile, not .bashrc. D’oh.
[20:19:53] quirkycoders: has joined #RubyOnRails
[20:23:21] quirkycoders: has joined #RubyOnRails
[20:24:47] amperry: Is it possible to do an AR query on one model, include an association, and call a scope on the associated model? If so, how does that look?
[20:26:00] amperry: without just writing the sql for the associated model/table.
[20:26:49] DrYockel1: has joined #RubyOnRails
[20:30:52] quirkycoders: has joined #RubyOnRails
[20:33:59] quirkycoders: has joined #RubyOnRails
[20:35:15] Technodrome: has joined #RubyOnRails
[20:41:48] pupsicle: has joined #RubyOnRails
[20:46:56] tercenya: has joined #RubyOnRails
[20:53:04] Aherin: has joined #RubyOnRails
[20:54:09] blackmesa: has joined #RubyOnRails
[20:59:07] quirkycoders: has joined #RubyOnRails
[21:02:12] amperry: With STI, if you were to reclassify the type of something, does that change how Rails thinks of it as a model? IOW, if I had the model 'class Chicken < ActiveRecord' and models 'Egg < Chicken' and 'CordonBleu < Chicken', can I change an Egg model to a CordonBleu model simply by altering the type? I have two models that are all-but-identical, and one literally does replace the other if instantiated.
[21:03:08] amperry: all-BUT-identical; there are a couple of small differences
[21:08:41] quirkycoders: has joined #RubyOnRails
[21:09:22] cnk: I would guess you would need to requery the changed thing so that rails builds a new object with the new type - but guessing
[21:11:27] quirkycoders: has joined #RubyOnRails
[21:11:50] tercenya: has joined #RubyOnRails
[21:15:34] ascarter: has joined #RubyOnRails
[21:21:15] ascarter: has joined #RubyOnRails
[21:31:45] tercenya: has joined #RubyOnRails
[21:35:05] hobodave: has joined #RubyOnRails
[21:41:10] shilon: has joined #RubyOnRails
[21:44:53] ascarter: has joined #RubyOnRails
[21:56:36] tercenya: has joined #RubyOnRails
[21:59:59] bheesham: has joined #RubyOnRails
[22:04:10] bronson: has joined #RubyOnRails
[22:25:21] ascarter: has joined #RubyOnRails
[22:27:19] bheesham: has joined #RubyOnRails
[22:39:16] egray: has joined #RubyOnRails
[22:44:14] Technodrome: has joined #RubyOnRails
[22:45:30] npgm: has joined #RubyOnRails
[22:48:35] rakm: has joined #RubyOnRails
[23:29:36] tanuki: has joined #RubyOnRails
[23:30:21] ascarter: has joined #RubyOnRails
[23:42:54] bheesham: has joined #RubyOnRails
[23:44:39] ascarter: has joined #RubyOnRails
[23:52:13] tanuki: has joined #RubyOnRails
[23:52:53] muhlisbc: has joined #RubyOnRails
[23:53:28] irishfromua: has joined #RubyOnRails
[23:53:48] bheesham: has joined #RubyOnRails
[23:59:00] Nicmavr: has joined #RubyOnRails