Activity Graph

Page 1 of 513 | Next »


[21:56:21] Radar: GOOD MORNING


[21:34:49] Radar: GOOD MORNING


[23:58:07] Radar: All good. It's only two lines.


[21:10:06] Radar: GOOD MORNING
[21:10:19] Radar: today I have 9 junior devs starting at CA
[21:15:52] Radar: mksybr: what's the stacktrace showing you?
[21:18:15] Radar: mksybr: /home/malik/Workspace/blog/test/controllers/articles_controller_test.rb:20:in `block (2 levels) in <class:ArticlesControllerTest>'
[21:18:20] Radar: mksybr: what is this line?
[21:18:36] Radar: (the way I found that was to look through the stacktrace until I found the first line from your application)
[21:19:06] Radar: I think you should be doing post :create there.
[21:19:18] Radar: The actual error you're seeing is: URI::InvalidURIError: bad URI(is not URI?): http://www.example.com:80#<Article:0x000055cf590f3c68>
[21:19:30] Radar: Where the end of the URL containing the .inspect'd version of the Article is invalid.
[21:20:34] Radar: Given this is a controller test, you should be making requests to the controller's actions. Therefore "post :create" instead of "post @article"
[21:22:43] Radar: morning cnsvc. What's your issue with Rails + mysql?
[21:24:19] Radar: mksybr: can you please show me the whole controller test?
[21:25:02] Radar: The post method is this one: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/integration.rb#L21
[21:25:16] Radar: You can see that file mentioned in the line above the last articles_controller_test stacktrace.
[21:25:41] Radar: Why are you inheriting a controller test from ActionDispatch::IntegrationTest? That seems strange to me. Maybe I am not up-to-date with the latest things that happen in Rails apps.
[21:25:47] Radar: I will try to reproduce this issue in a new app.
[21:27:08] Radar: Okay. In that case: post '/articles' would be the correct version.
[21:27:26] Radar: I've been using RSpec for yonks and so I'm not up-to-speed with the latest and greatest in MiniTest / Test::Unit lands.
[21:27:59] Radar: Alternatively, you can probably use the url helpers here too: post articles_path
[21:31:48] Radar: cnsvc: that's a big crash!
[21:32:15] Radar: cnsvc: I noticed two things. Your stacktrace contains this line: /usr/local/var/rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/activesupport-4.2.10
[21:32:20] Radar: Which indicates that it is loading AS 4.2.10
[21:32:22] Radar: not 5.2.2
[21:32:35] Radar: The root of the problem seems to be this: /usr/local/var/rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/mysql2-0.4.10/lib/mysql2/mysql2
[21:33:08] Radar: 0.4.10 was released in November 2017. There's a new release of mysql, 0.5.2, released in July 2018. Does upgrading this mysql2 gem fix your issue?
[21:35:07] Radar: cnsvc: Could you update the log to show the same issue with those versions? Then I can definitely confirm it is the same thing at my end.
[22:04:21] Radar: mksybr: I prefer factories.
[22:11:13] Radar: cnsvc: Thanks very much for that. I am not sure what is happening here. I would suggest filing an issue on the mysql2 repo?


[02:35:33] Radar: hays: any of them
[02:35:40] Radar: Rails doesn't care what JS framework you use
[04:19:37] Radar: comet23: https://repl.it/repls/OtherPrizeServer
[04:19:57] Radar: comet23: use each_with_object, passing it a Hash where the default value for all keys in the hash is zero.
[04:20:10] Radar: >> h = Hash.new(0); h["a"]
[04:20:32] Radar: Your issue is because your hash doesn't have that key set to any particular value.
[04:20:38] Radar: mozzarella: input and expected output plzkthx
[04:21:03] Radar: ruby[bot]: you never do.
[04:22:11] Radar: comet23: only if the entire hash is empty.
[04:22:44] Radar: I just updated my example to remove the if statement entirely.
[04:23:06] Radar: comet23: yeah, but then you find the first character, increase the count for that and then what happens to ae_chars?
[04:24:21] Radar: comet23: is it then empty?
[04:27:40] Radar: comet23: you're too kind
[04:58:57] Radar: memofun: When you call the times function on Ruby, it will evaluate the block that number of times. The function then returns itself.
[04:59:06] Radar: itself -> the object you called the function on


[10:28:44] Radar: GeorgesLeYeti: You can establish connection to a different database per model
[10:28:57] Radar: write establish_connection :other_database inside the model, as a class method call
[20:53:36] Radar: GOOD MORNING


[19:10:01] Radar: GOOD MORNING
[19:41:05] Radar: https://travis-ci.org/svenfuchs/i18n/jobs/474162776#L480
[19:41:06] Radar: Sighhhhh.
[19:41:21] Radar: I am honestly considering spinning up my own EC2 stack of build agents and running i18n's build on Buildkite.
[19:41:33] Radar: Because of shit like this. And because builds can sometimes take over an hour to run.
[19:42:03] Radar: What's stopping me is that I don't want to have _even more AWS shit_ to manage.
[21:35:20] Radar: in really weird Ruby it can be things like 1::to_s
[21:35:26] Radar: but that's really not standard at all


[03:08:32] Radar: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[03:08:36] Radar: has joined #RubyOnRails


[00:10:43] Radar: Ookma-Kyi: imgur.com too please.
[00:10:50] Radar: tinypic has lots of ads / cruft
[00:14:58] Radar: Maybe time to not do that
[01:04:17] Radar: hnanon: "1124".split("").each_cons(2).any? { |first, second| first == second }
[01:05:00] Radar: hnanon: Your homework is to work out the rest ;)
[01:05:45] Radar: arg and I should use .chars, not .split("")
[01:55:50] Radar: hnanon: strongly agree
[01:55:55] Radar: hnanon: https://leanpub.com/explodingrails
[01:56:05] Radar: I would go as far as to say Active Record is an anti-pattern
[01:56:48] Radar: In fact, I _did_ say that: https://youtu.be/04Kq_9scT1E?t=835
[01:58:25] Radar: Callbacks are a shitty solution to the problem because they're automatic, implicit and they happen _everywhere_ regardless of if you want them to run or not.
[01:58:51] Radar: For instance, do you want your after_create callback that sends an email to a user upon creation of their account to ALSO be triggered in a test? Probably not.
[01:59:58] Radar: sevenseacat: DHH believing that Rails is a good design is an exceptionally great case of bias. "I designed it, therefore it must be correct."
[02:00:45] Radar: I still vehemently believe that Rails would be so much better off without Active Record or anything that follows the Active Record pattern. Active Record has lost.
[02:00:52] Radar: sevenseacat: it's okay, they're going to re-write it again soon
[02:01:05] Radar: too bad they don't take the same approach to Rails
[02:02:05] Radar: hnanon: Strongly disagree with that one too. after_commit still gets triggered after _every_ commit. You surely don't want it happening 100% of the time your model is saved.
[02:02:56] Radar: hnanon: Wrap your business logic into dry-transaction classes like this: https://github.com/radar/exploding-rails-rom-dry-example-app/blob/master/app/transactions/create_project.rb
[02:03:06] Radar: This is a very, very simple case of one.
[02:03:28] Radar: https://github.com/radar/exploding-rails-rom-dry-example-app/blob/master/spec/transactions/create_project_spec.rb <- look at all the database queries I'm _not_ making
[02:04:51] Radar: sevenseacat: it advocates for putting additional methods in the model that have nothing to do with the actual data represented by the model itself. Therefore I disagree. The blog post itself suggests AR callbacks are bad, but then also goes on to suggest a further bad approach.
[02:05:08] Radar: (also: 4 spaces in Ruby code examples? please.)
[02:08:27] Radar: the model is the place for working with data from your database.
[02:08:50] Radar: Business logic goes into a separate file and the model is passed into the method and then things are done _with_ that model not _to_ it.
[02:09:12] Radar: sorry, got my whole che guevara attitude on today
[02:09:21] Radar: hnanon: we are only two people
[02:11:08] Radar: hnanon: I suspect that sometimes I hold opinions just so I can be contrary to DHH ;)
[02:11:51] Radar: sevenseacat: yeah I'm a bit slack this year. I've been planning for the NINE NEW JUNIORS I am hiring next year.
[02:12:12] Radar: hnanon: What works for Basecamp doesn't necessarily work well in all other situations.
[02:44:21] Radar: yeah, I think it's Basecamp Classic, Basecamp 2 and Basecamp 3.
[05:29:48] Radar: yeah, I think it's Basecamp Classic, Basecamp 2 and Basecamp 3.
[05:29:57] Radar: Hi. Up + enter is a great thing.


[00:02:03] Radar: gavit: how right was I?
[00:03:42] Radar: gavit: it's the best course of action.
[03:16:28] Radar: Ookma-Kyi: ?RubyOnRails
[03:16:31] Radar: ?RubyOnRails
[03:16:34] Radar: ?RubyOnRails
[03:16:38] Radar: oh my god
[03:16:44] Radar: We got there in the end.
[20:55:48] Radar: GOOD MORNING
[23:09:43] Radar: dmitch: how do the people running this CLI run the CLI? Do they clone down the repo and then run `bin/<your app>`?
[23:17:25] Radar: baweaver: watching your WaffleJS talk now
[23:20:06] Radar: Klabnik also wrote some of Rails 4 in Action :)
[23:20:55] Radar: fun thing: I once pretended to be Klabnik at a conference. This worked for a while, and then I was approached by a woman who said "HEY! You're not Steve!". But I said, "yes I am" and she said "No you're not!" And I said "How can you be so sure?" And she said: "Because he's my boyfriend, and you're not him!!"
[23:21:29] Radar: !ban nine_milli
[23:22:54] Radar: bsamorim: It actually uses eval.in to do that, but eval.in has... glitches.
[23:22:59] Radar: &>> puts "hi"
[23:23:08] Radar: which is why we have rubydoc instead, which runs on carc.in.
[23:23:52] Radar: yeah I follow the news :D
[23:25:03] Radar: and now I have to go be on a bodcast
[23:25:07] Radar: podcast *
[23:25:13] Radar: bodcast is that thing you do if you go the gym a lot


[23:45:48] Radar: gavit: you did resource :organization instead of resources :organizations. Singular vs plural.


[22:41:08] Radar: To get all the digits for an integer, I can call Integer#digits. Is there a comparable method for floating point numbers?
[23:04:06] Radar: &&> number = 8.15; number - number.to_i
[23:04:43] Radar: &> puts 'hi'
[23:04:48] Radar: brain fail
[23:09:41] Radar: (byebug) number
[23:09:41] Radar: 0.8000014999999999e1
[23:09:41] Radar: (byebug) decimal = BigDecimal.new(number, 16)
[23:09:57] Radar: "work with floating point numbers", he thought. "It'll be fun", he thought.
[23:14:29] Radar: phaul: am I mis-remembering the syntax for the bot?
[23:15:37] Radar: 0.8000014999999999e1
[23:15:37] Radar: (byebug) BigDecimal.new(number, 16)
[23:15:37] Radar: 0.8000015e1
[23:15:37] Radar: (byebug) BigDecimal.new(number, 15)
[23:15:44] Radar: oops my table is suddenly upside down
[23:17:31] Radar: oh it's double >>
[23:17:40] Radar: I think the other one is the ri syntax?


[01:35:20] Radar: elcontrastador: kaminari
[02:19:59] Radar: elcontrastador: sure does :D


[21:22:25] Radar: GOOD MORNING
[22:27:25] Radar: and0: define a method in those controllers that does something like:
[22:27:28] Radar: def model; @apple; end
[22:33:33] Radar: that's why they pay me the bigg bucks
[23:06:52] Radar: lowercase everything that's already there with a migration
[23:07:32] Radar: Esteth: sure.
[23:13:48] Radar: what is arr
[23:14:16] Radar: &>> arr = [{},{}]; arr.each{|n| n.each{|k,v| f = k.gsub(/node_/,''); puts f," ", v; [f, v]}.to_h }
[23:14:35] Radar: pavelz: actual input and expected output please
[23:42:32] Radar: MASTER RECIPE
[23:44:17] Radar: Inside: that's why they pay me the bigg bucks
[23:44:36] Radar: My last name is Bigg
[23:45:17] Radar: ha ha i am so funny
[23:45:25] Radar: ACTION slaps thigh
[23:55:08] Radar: Then yeah I would namespace it appropriately.
[23:55:17] Radar: product_revisions, but you can name the association "revisions" still
[23:55:23] Radar: has_many :revisions, class_name: "ProductRevisions"


[00:56:05] Radar: GOOD MORNING
[00:56:06] Radar: BUT ONLY JUST
[01:02:11] Radar: ule: Wrong hemisphere.
[01:03:38] Radar: Yeah, it's Tuesday here. Bright and sunny.
[01:08:16] Radar: ule: I've been working my way through the Advent of Code exercises by using Elixir.
[01:08:31] Radar: And at the moment I'm looking into an issue with some of our Ruby delayed jobs.


[08:54:54] Radar: adgtl: https://stripe.com/docs/checkout/rails
[08:54:59] Radar: The stripe guides are pretty great :)


[00:47:24] Radar: baweaver: hi
[00:47:37] Radar: Ruby lets you do things to it that it really shouldn't :D
[00:48:00] Radar: I'm planning a talk about these at the Feb Ruby meetup here, under the guise of a magic show.
[00:49:07] Radar: sevenseacat: of course
[00:49:21] Radar: I also find shuffle too hard to type, so I've made this possible too...
[00:49:29] Radar: => [4, 1, 6, 14, 8, 17, 15, 9, 20, 7, 11, 16, 19, 10, 3, 12, 2, 18, 13, 5]
[00:49:29] Radar: >> ~(1..20).to_a
[00:49:43] Radar: Ever wanted to have 10 of every element within an array? Me too.
[00:49:57] Radar: => [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
[00:49:57] Radar: +(1..3).to_a
[00:50:04] Radar: Where + is actually the Japanese kanji for ten.
[00:50:24] Radar: And if you want to have ten of every element but shuffled also...
[00:50:29] Radar: => [1, 2, 1, 3, 1, 1, 2, 2, 1, 3, 2, 2, 3, 1, 1, 3, 3, 1, 3, 1, 2, 2, 1, 2, 3, 3, 2, 3, 3, 2]
[00:50:29] Radar: ~+(1..3).to_a
[03:42:58] Radar: havenwood: I worked around it by assigning each key a specific card from the deck... but then towards the end I ran out of keys. To work around that, I use capitals for the rest :)
[03:44:11] Radar: yeah we're aware ;)
[03:44:42] Radar: havenwood: I suspect I could do it better in the browser tbh but since this is a _ruby_ meetup specifically, I want to do it in the purest Ruby possible
[03:46:10] Radar: baweaver: it seems the lunar phase has once again arrived at "kapil learns Rails"
[21:40:22] Radar: GOOD MORNING


[06:04:50] Radar: => [1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 3, 4, 5, 6, 7, 8, 9]
[06:04:50] Radar: irb(main):001:0> (1..20).sort
[06:04:57] Radar: Brought JS sorting to Ruby
[09:23:28] Radar: agent_white: do you really want to know?
[09:23:46] Radar: agent_white: https://gist.github.com/radar/2c06a80f10cd5d0ffc4759fcf5c210c0
[09:27:12] Radar: agent_white: Thanks mate :) We're doing really well. She's two now, so not so new anymore!
[23:26:26] Radar: GOOD MORNING


[21:58:29] Radar: How would I make a Ruby program pause, and then continue after _any_ key press? That's including modifier keys, like Cmd, Shift, etc.
[21:58:50] Radar: I can make Ruby do it for every regular key
[23:06:02] Radar: zenspider: yeah, a plain Ruby script. I don't think it's possible either. I'll just take my chances that whoever's going to press "any key" doesn't try pressing one of the modifiers.
[23:06:45] Radar: hahaha :) That'll give away my trick.
[23:07:35] Radar: I'm writing a Ruby script as a part of trick that makes it seem like a "random" algorithm always determines a selected playing card. Trying to work out the flow of the trick at the moment.
[23:08:38] Radar: Like this, but deterministic: https://gist.github.com/radar/d06939eccc3d3088b3c1ab5e74b15a68
[23:16:36] Radar: eam: has to be a terminal for this trick to be seamless (I think)
[23:16:58] Radar: I think I'll make it just so it's me typing instead of a different person


[21:27:50] Radar: GOOD MORNING



[08:49:43] Radar: dionysus69: SOME_ARRAY_CONSTANT || JSON.parse(ENV["SOME_ARRAY_STRING"])
[21:10:27] Radar: GOOD MORNING


[21:50:16] Radar: quarters: Well, I would find out what /home/user/.rvm/gems/jruby- is.
[21:50:31] Radar: quarters: But When I looked into Rails source, it's a comment. So that's not right. Something's weird there.
[21:50:34] Radar: quarters: what is it on your computer?
[21:51:25] Radar: Last week I jumped through a couple of different languages: Ruby, Elixir, JavaScript, TypeScript, Go and even some YAML. I think I'm missing some others.
[21:51:38] Radar: quarters: see that's just strange. Let me look at the gem.
[21:51:44] Radar: I mean protected_attributes_continued-1.3.0.
[21:53:02] Radar: quarters: https://github.com/westonganger/protected_attributes_continued/blob/master/lib/active_record/mass_assignment_security/validations.rb#L15
[21:53:07] Radar: Yeah, that's the right line I'm seeing too.
[21:53:19] Radar: Revisiting your stacktrace...
[21:53:29] Radar: definitely seems to be happening within the migration block
[21:53:51] Radar: tubbo: how many shows?
[21:54:20] Radar: quarters: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/inheritance.rb#L50
[21:54:31] Radar: quarters: I believe it's getting to this line, and the stacktrace is pointing to the wrong line.
[21:54:51] Radar: quarters: notice that the method definition there only takes one argument and a block. So it seems like protected_attributes_continued is wrong.
[21:55:02] Radar: https://github.com/rails/rails/blob/v5.2.1/activerecord/lib/active_record/inheritance.rb#L50
[21:55:10] Radar: Same method signature in 5.2.1 too
[21:55:29] Radar: https://github.com/rails/rails/blob/v5.0.4/activerecord/lib/active_record/inheritance.rb#L48 <- different method sig in older 5.x versions
[21:55:32] Radar: I just picked a random one.
[21:55:46] Radar: quarters: so I'd say protected_attributes_continued is not compatible with Rails 5.2.1.
[21:56:19] Radar: Latest 5.1 also has the same signature as 5.0.x: https://github.com/rails/rails/blob/v5.1.6/activerecord/lib/active_record/inheritance.rb#L49
[21:56:23] Radar: So I'm guessing this is new to 5.2.
[21:56:37] Radar: The gem also does not include 5.2 in its .travis.yml list: https://github.com/westonganger/protected_attributes_continued/blob/master/.travis.yml#L10-L14
[21:57:10] Radar: quarters: What I'd do here is to fix how protected_attributes_continued is calling that method, passing the right number of arguments (whatever those are) and then submit a patch upstream. In the meantime, use your own fork of that gem (with the fix) and that should make your problems go away.
[21:58:38] Radar: tubbo: Awesome :) That must be fun!
[22:04:06] Radar: quarters: I guess they're not needed anymore?
[22:26:59] Radar: quarters: perhaps take this as a sign that you should be moving away from attr_accessible? :)
[22:31:38] Radar: quarters: It's not migrations. It's when it goes to save the info to the schema_migrations table in the database, it uses AR's own `create`, which then relies on `new`.
[22:31:43] Radar: quarters: AR 5.2 doesn't have options anymore.
[23:10:28] Radar: strong agree with zenspider
[23:11:13] Radar: https://gist.github.com/radar/e7b5d2811fa30fb8dfd6de961ee30cf7
[23:12:27] Radar: Out of those three options I would pick B. Ternaries are good for short bits of code and I think the string there makes it too long.
[23:12:35] Radar: lines of code are cheap
[23:29:43] Radar: zenspider: fire away