Activity Graph

Page 1 of 7 | Next »


[08:13:16] marahin: Ping timeout: 264 seconds
[08:18:29] marahin: has joined #ruby
[08:18:29] marahin: Changing host
[08:18:29] marahin: has joined #ruby
[10:23:52] marahin: *.net *.split
[10:24:06] marahin: has joined #ruby
[10:24:12] marahin: has joined #ruby
[10:24:12] marahin: Changing host


[13:58:28] marahin: Ping timeout: 248 seconds
[14:00:46] marahin: has joined #ruby
[14:00:46] marahin: Changing host
[14:00:46] marahin: has joined #ruby


[20:53:28] marahin: Ping timeout: 252 seconds
[20:55:20] marahin: has joined #ruby
[20:55:20] marahin: Changing host
[20:55:20] marahin: has joined #ruby


[00:56:27] marahin: *.net *.split
[01:13:51] marahin: has joined #ruby


[03:12:45] marahin: *.net *.split
[03:13:02] marahin: has joined #ruby
[03:13:13] marahin: has joined #ruby
[03:13:13] marahin: Changing host


[06:50:31] marahin: *.net *.split
[07:16:47] marahin: has joined #ruby
[08:27:07] marahin: *.net *.split
[08:35:37] marahin: has joined #ruby
[08:35:40] marahin: has joined #ruby
[08:35:40] marahin: Changing host


[06:12:27] marahin: *.net *.split
[06:18:08] marahin: has joined #ruby


[11:25:46] marahin: has joined #ruby
[11:25:46] marahin: Changing host


[16:03:27] marahin: *.net *.split


[06:27:41] marahin: *.net *.split
[06:38:17] marahin: has joined #RubyOnRails
[06:38:22] marahin: has joined #ruby


[03:22:05] marahin: *.net *.split
[03:38:46] marahin: has joined #RubyOnRails
[03:38:51] marahin: has joined #ruby


[10:22:27] marahin: Ping timeout: 252 seconds
[10:23:31] marahin: has joined #ruby
[10:23:31] marahin: Changing host
[10:23:31] marahin: has joined #ruby


[13:26:28] marahin: Ping timeout: 264 seconds
[13:31:11] marahin: has joined #ruby
[13:31:11] marahin: Changing host
[13:31:11] marahin: has joined #ruby
[13:31:31] marahin: has joined #RubyOnRails


[09:29:44] marahin: Hello. I'm writing a gem that can also be hooked up with the Rails application. I'd like this gem to also Mime::Type.register when its hooked in the Rails app. Is that a good approach? Or should it have a generator that would create an explicit initializer file with that line?


[16:50:06] marahin: *.net *.split


[14:47:03] marahin: maybe I've been working in Go a bit too much lately
[14:47:08] marahin: but how is that unclear
[14:47:37] marahin: get current time, in a form of a timestamp, and make it a string


[08:21:14] marahin: Hi. I'm working on a Rails application. A service object I'm creating uses Tempfiles to download and then do something with files. The Tempfiles seem to work properly on development, however, in integration tests they always can't seem to be created, because the `Dir.tmpdir` doesn't have a `test/` subdirectory, in which the Tempfile is trying to be created.
[08:21:34] marahin: Even if I pass custom temporary directory it still tries to put it in `test/` subdirectory.


[09:56:39] marahin: I have two tables: A and B. B belongs_to A, and A has_many :b.
[09:57:06] marahin: How can I make an AR query that would select only those A records, that have NO related B records with B.column_name set to true?
[10:05:34] marahin: for now I have A.where.not(id: A.joins(:bs).where(bs: { column: true }).uniq.pluck(:id))
[10:05:48] marahin: but i bet there's a nicer, one-query way to do this
[10:06:21] marahin: actually..
[10:08:57] marahin: yeah well no
[10:09:13] marahin: first it needs to find Customers which fulfill the coniditon of bs.column = true
[10:09:25] marahin: and then it takes their IDs and puts it in the outer query
[10:16:32] marahin: oh jeebzus
[10:16:39] marahin: jhass: that's so impressive
[10:16:43] marahin: that it works this way
[10:16:53] marahin: do you have some sources so I can get to know this feature better?
[10:17:11] marahin: I didn't expect it wouldn't have fired the query
[10:17:18] marahin: more over, i didn't expect it would optimize both :P
[10:17:31] marahin: tbuehlmann: oh.
[10:17:48] marahin: tbuehlmann: wait, does it mean jhass's suggested solution wouldn't work...?
[10:18:47] marahin: i just used .to_sql and it seems fine.
[10:18:50] marahin: that's so awesome :-)
[10:18:56] marahin: thank you jhass!


[20:53:36] marahin: Hello. I have two tables, both of which have a slug column (friendly id gem). I have a single endpoint that fetches a record that has a given slug, and it should return either table1 or table2 record.
[20:54:09] marahin: Obviously there should be only one candidate, which means, I need to set up validation and a unique index on `slug` column on both of these tables, to make sure that table1.slug does not have a repeated value that already exists in table2.slug (and vice-versa).
[20:54:12] marahin: How do I do that the Rails-way?


[10:49:33] marahin: Is there any way to make rspec exit at the first usage of CTRL+C?
[10:49:40] marahin: (not wait for the graceful shutdown)
[10:50:01] marahin: I'm trying to forge a simple script to run a few scripts in the background.
[10:53:02] marahin: jhass: i dont think that fixes the issue? :)
[10:53:12] marahin: it will exit itself on the first failed example (I dont want that)
[10:53:20] marahin: i want to be able to break-up rspec on a single ^C though.
[10:53:24] marahin: without having to repeat it
[10:54:14] marahin: well then but it breaks the idea for all the tests to go through :)
[10:54:19] marahin: we're using rerun later on
[10:54:24] marahin: which re runs only failed tests, isolated


[15:25:47] marahin: hey guys. I'm doing something wrong here. This is my CI script that runs two jobs, as ruby threads. However, if any of the jobs fail, or the script is interrupted by ^C, all jobs and this script should be killed.
[15:25:53] marahin: However, it continues to run rspec.
[15:27:21] marahin: Can someone take a look at this and help?
[15:28:11] marahin: i can tell that in this case rescue is not even used
[15:45:23] marahin: havenwood: yeah I'm on a relatively modern ruby
[15:49:12] marahin: I have no idea what a subshell is?
[15:49:29] marahin: So its interesting, because it seems that the job that is spawned and still continues to run in the background isn't part of Thread.list
[15:49:33] marahin: which is why it's not killed
[15:50:09] marahin: so is there a way we can fix it, havenwood?
[15:54:10] marahin: havenwood: thank you. Do you know, if there's a way to check for status of the forked processes, like I do with threads?
[16:02:05] marahin: like, wait 0?
[16:02:10] marahin: what happens then?
[16:11:05] marahin: havenwood: I'll give these a read. Yeah, we're using Macs or anything unix like, so it shouldn't be an issue
[16:11:24] marahin: in the meantime, I'm trying to copy the example
[16:11:42] marahin:
[16:11:42] marahin: and where the example is working, when I try to apply that to a collection of jobs, its exiting my binding.pry instantly :(
[16:12:54] marahin: yes, in the map block
[16:13:22] marahin: why is it exiting though..?
[16:13:33] marahin: I haven't left pry.
[16:13:43] marahin: It should wait for pry to finish execution, shouldn't it..?
[16:14:45] marahin: havenwood what's the dependency for binding.irb?
[16:14:47] marahin: (bin/ci:19:in `<main>': undefined method `irb' for #<Binding:0x007fee8520b9f0> (NoMethodError))
[16:15:14] marahin: its 2.3.4 here
[16:15:33] marahin: well, krap
[16:16:00] marahin: Let me try to run this in IRB and see if its working :)
[16:16:27] marahin:
[16:16:32] marahin: something is not right :)
[16:16:41] marahin: yeah I think I need to educate myself
[16:16:58] marahin: i thought that maybe i can tinker with the code examples in the article you've sent me and get more or less a working result
[16:17:09] marahin: but I think I need to understand whats happening exactly with fork and Process.detach first


[21:35:57] marahin: What is the easiest way to implement ApplePay payments in my Rails app without involving Stripe (clients country is not supported)?
[21:38:41] marahin: Radar: thank you, forgot about Braintree payments!
[21:39:24] marahin: yes, I've worked with Braintree in some project like a year ago. I just forgot its even there :P been using Stripe ever since.
[21:39:26] marahin: Thank you!


[09:19:31] marahin: has joined #RubyOnRails
[09:19:31] marahin: has joined #ruby


[14:33:54] marahin: Quit: ZNC 1.6.3+deb1 -


[00:58:16] marahin: Ping timeout: 246 seconds
[00:58:33] marahin: has joined #ruby
[00:58:34] marahin: has joined #RubyOnRails
[13:26:53] marahin: Ping timeout: 268 seconds
[13:27:26] marahin: has joined #RubyOnRails
[13:27:26] marahin: has joined #ruby


[12:50:03] marahin: has joined #RubyOnRails
[12:50:18] marahin: has joined #ruby


[02:42:51] marahin: *.net *.split


[00:07:17] marahin: *.net *.split
[00:15:25] marahin: has joined #RubyOnRails
[00:15:33] marahin: has joined #ruby


[12:06:09] marahin: has joined #ruby
[12:06:09] marahin: Changing host
[12:06:54] marahin: has joined #RubyOnRails


[05:27:52] marahin: Quit: ZNC 1.6.3+deb1+xenial0 -


[02:47:20] marahin: *.net *.split
[02:47:49] marahin: has joined #RubyOnRails
[02:48:13] marahin: has joined #ruby


[12:26:03] marahin: *.net *.split
[12:27:25] marahin: has joined #ruby
[12:27:35] marahin: has joined #RubyOnRails
[15:01:34] marahin: *.net *.split
[15:03:02] marahin: has joined #RubyOnRails
[15:03:09] marahin: has joined #ruby


[13:56:48] marahin: Hello! I have a `.with_retries` method that accepts two arguments: retry_amount and &block. Is it possible to refactor it, so I can call `yield` instead of ``?
[13:58:19] marahin: OK, so just plain `yield`? :) Does it matter if `&block` stays as defined argument, or not?
[13:58:27] marahin: I assume it would stay, if I want to pass it later on to another method?
[13:58:42] marahin: actually, let me gist the code, it will be easier
[13:58:46] marahin: sorry for not doing that in the first place
[13:59:04] marahin:
[13:59:29] marahin: - so here, would it be OK to use 'yield' to pass the received block, or should it be &block then?
[13:59:39] marahin: (if the first, then I assume i can remove &block from arguments list)
[14:01:13] marahin: thank you!


[10:44:07] marahin: GeorgesLeYeti "_" stands for ANY single character.
[10:44:32] marahin: So "LIKE '_1467_'" would work for "a1467b", "_1467_", "1467" :)
[10:45:02] marahin: I think this is the source of confusion.


[11:02:32] marahin: I might be at a wrong place, but; with rspec's `double` is there a way to mimic hash method, so accessing values by key?
[11:02:43] marahin: something like `a = double(test: 1); a[:test]`
[11:07:26] marahin: phaul yes, so that's what I thought with trying to mock the `.[]` method. Thank you, I'll try that out


[11:19:48] marahin: catphish: what? No, it's not dead.


[13:57:01] marahin: dminuoso: I think you meant mauro1254 :)


[22:45:35] marahin: has joined #ruby
[22:45:35] marahin: Changing host
[22:45:49] marahin: has joined #RubyOnRails


[18:43:52] marahin: Hello! Can I safely run web-console in an AdminController (that only admins have access to)? So it'd be basically triggered in a view. I've tried it but have no success in production so far.
[18:48:15] marahin: I suppose it's not meant for that. Sorry, nevermind.


[17:29:43] marahin: Hello! I'm working with Rails and Sequel. I have a pet project that includes managing of some open-source MMO game. This game has two servers; each has one database with exact same structure. A scenario would be that user creates an account in Rails app, this account is also created on both databases; then if user creates a character, it should appear only in one of the two databases (but it's still the same class/model). Any articles or libraries
[17:29:44] marahin: that would be of use in this kind of scenario?


[12:38:14] marahin: Is anyone using VSCode for ruby development? Is there any nice way to lookup gem code?


[11:12:14] marahin: Hello! What is the most elegant way to parse 60010 to be 600.10, 600 to become 6.00, 50 to become 0.50?
[11:12:25] marahin: (So an integer or a string into a decimal number with two point precision)
[11:12:58] marahin: "#{num/100}.#{num%100}" is the basic one, but it will parse 500 into 5.0 instead of 5.00.
[11:26:10] marahin: apeiros I'm very sorry!
[11:26:23] marahin: I threw a question and expected a highlight, as most of the messages here are the join/part ones :(
[11:27:05] marahin: Well, twelve seconds were enough for me to jump into ruby docs again and look for a formatting methods :)
[11:27:24] marahin: I'm sorry again, really didn't mean anything, just tough morning where I'm struggling to focus.
[11:27:59] marahin: apeiros input is integer, output could be either float or string (basically anything that can be later casted 'to string', and will be in format of INTEGER_PART.TWO_DECIMAL_POINTS)
[11:28:50] marahin: You're correct I suppose. What I mean is that I want to get a number containing two numbers after the integer part.
[11:28:59] marahin: Yeah, that's what I managed right now
[11:29:11] marahin: sprintf("%0.02f", "#{amount / 100}.#{amount % 100}".to_f
[11:29:18] marahin: this is what I'm having now, and it seems to work fine
[11:29:23] marahin: but I'm wondering if there's any nicer solution :P.
[11:29:52] marahin: that's correct, I'm gonna change that :)
[11:31:47] marahin: I'll stick to sprintf, but it's nice to know that
[11:31:58] marahin: thank you apeiros, I really didn't mean to be rude


[15:03:57] marahin: I have two belongs_to definitions in a model: customer and a payment method. I want to make sure that particular payment method will also belong to the customer. How do I validate it?


[10:36:03] marahin: Why does AR's calculation method .sum not allow me to pass more than 2 arguments?
[10:36:07] marahin: How can I work around this?
[10:36:22] marahin: contracts.sum(:one, :two, :three) raises; .sum(:one, :two) works just fine
[10:36:35] marahin: and the raise error is ArgumentError: wrong number of arguments (given 4, expected 2..3)
[10:40:17] marahin: aeh, nevermind
[10:40:19] marahin: it doesn't work fine
[16:53:54] marahin: Hello! I'm trying to check if particular object receives a method call in rspec, using `expect(obj).to receive(:blah).once`. However I dont want to care about the output - there's some complicated logic and I can't seem to make it work using stubs. Is there a way to check if method was called, but don't really care about the output (or potentiatl raises)?
[16:56:22] marahin: fschuindt will this completely omit the logic in the method?
[16:57:05] marahin: fschuindt ah, that's another caveat - we're not using the greatness of `let`, `before` or anything like that, we're going for full-explicit non-DRY approach where we literally just have lines of code and method calls in the individual examples
[16:57:10] marahin: I'll try that nonetheless, thank you very much!
[17:07:45] marahin: fschuindt I haven't put it in a before block yet, however - would that work on a non-double object? like, a database record?
[17:08:48] marahin: sadly, it seems that even in the before block the method is still called :(
[17:12:06] marahin: i tried to use any_instance.stub, but... undefined method `any_instance' for #<Class ,_,


[14:06:05] marahin: Veejay I WOULD have a thread that has a log stack that other threads push their log messages to.
[14:06:11] marahin: And then one by one just print those messages.
[14:06:23] marahin: But then, I'm just having too much fun with golang lately :)
[14:07:11] marahin: I think that's the easiest and the safest one


[20:45:19] marahin: reber jQuery!


[13:46:53] marahin: apeiros could you make a runnable example with the use of that syntax?
[13:47:11] marahin: apeiros thx
[13:49:45] marahin: apeiros awesome!
[13:49:48] marahin: and disgusting
[13:49:50] marahin: thank you!
[14:05:41] marahin: jlebrech you could just make your webserver ignore all routes ending with *.php when it comes to that
[14:05:49] marahin: but that has nothing to do w/ Rails


[13:46:54] marahin: Hello! - having this, I want to make sure that global_tag_id is unique ALSO between two contexts: 'hq_tag' and 'office_tag'. Is there a way to achieve that?
[13:47:30] marahin: (also with previous definition remaining - so it's overall unique in scope of taggable and context)
[13:47:51] marahin: (and I should say: what IS the best way to achieve that, as it's for sure achievable one way, or another :D)


[09:51:45] marahin: has joined #RubyOnRails


[12:06:33] marahin: has joined #ruby
[12:06:33] marahin: Changing host


[18:15:50] marahin: has joined #ruby
[21:58:58] marahin: Ping timeout: 269 seconds
[22:00:15] marahin: has joined #ruby


[05:03:45] marahin: Quit: ZNC -


[14:48:37] marahin: *.net *.split
[14:55:11] marahin: has joined #ruby


[09:53:54] marahin: With let() syntax it's fine - I can call `let(:'access-token')` and it _just works_.
[09:54:18] marahin: however, I'm unsure - if I'd like to omit let syntax and instead define a local variable, how can I do that? Can I do that at all?
[09:54:37] marahin: with a memoized value too. :)
[10:36:09] marahin: Torrone have you tried `def title?` on the model itself?
[10:41:02] marahin: Torrone that's not a very nice design :-)
[10:41:42] marahin: And, well, as far as I'm concerned - as `question.answer` returns an object related to Question, and that object is an Answer - then `.title` is called onto the object.
[10:42:00] marahin: so basically, it's the same as answer = question.answer; answer.title
[10:42:06] marahin: or at least it implies to be the same.