Activity Graph

Page 1 of 514 | Next »


[03:01:01] Radar: !botsnack


[22:38:39] Radar: !botsnack


[16:49:55] Radar: *.net *.split


[19:26:44] Radar: turns out my 6:30am brain doesn't know how to speak german either
[19:27:01] Radar: P.S. GOOD MORNING


[05:01:14] Radar: baweaver: hello
[05:01:18] Radar: I've been busy today evidently


[02:17:23] Radar: what sevenseacat said
[02:17:29] Radar: [12:59:44] <hd1> the return value of require in ruby is undefined
[02:27:10] Radar: xco: in_time_zone
[02:27:22] Radar: yes that one
[02:28:31] Radar: cerberussg: and how do we do that Mr. Smarty Pants?
[21:31:42] Radar: GOOD MORNING


[02:11:56] Radar: Remote host closed the connection
[02:16:12] Radar: has joined #RubyOnRails
[02:16:14] Radar: has joined #elixir-lang
[02:16:15] Radar: has joined #logga
[02:16:17] Radar: has joined #ruby
[02:16:24] Radar: has joined #ruby-offtopic
[02:16:31] Radar: has joined #RubyonRails-offtopic
[02:22:13] Radar: GOOD AFTERNOON
[21:25:19] Radar: GOOD MORNING
[21:44:52] Radar: Slogger: What kind of integration tests? RSpec with Capybara?
[21:46:29] Radar: RJ2: I wrote an interface to Elastic Search here using the HTTPotion package: http://github.com/radar/elastic
[21:46:41] Radar: Along with the jason package for decoding/encoding JSON
[21:46:52] Radar: baweaver: yes it is me
[21:47:33] Radar: baweaver: how are things?
[21:49:54] Radar: Slogger: Ah rightio. I have an example with Capybara that I could share if you were using that. I dont' know about AD:IT
[21:50:34] Radar: Juniors loved the React + Rails work we did last week. I'm now planning some GraphQL work for them to do next time we catchup (Apr 8th). I think they'll really enjoy all the tooling around that.
[22:44:49] Radar: plsm: joyofelixir.com


[21:35:56] Radar: Inside: good morning
[21:46:35] Radar: sandfish_: good morning
[21:46:55] Radar: ss942: !rule0


[21:49:28] Radar: !botsnack
[21:50:35] Radar: GOOD MORNING
[23:02:48] Radar: https://elixirforum.com/
[23:11:12] Radar: Inside: Hey Inside :) How are things for you?
[23:24:35] Radar: hahuang65: Good morning to you too!


[03:58:15] Radar: Technodrome: seems like a good plan. I support this.
[03:58:40] Radar: greasysock: Docker container, probably on Amazon ECS.
[03:58:56] Radar: istrasci: why do you want it to deliberately fail?
[03:59:01] Radar: Technodrome: seems bad
[04:00:07] Radar: sevenseacat: that's what I sid
[10:55:56] Radar: first question is free
[10:56:06] Radar: second question, also free
[10:57:03] Radar: I would do it like this: "comment_xls".gsub(/(.*)_(.*)/) { "#{$2.upcase} #{$1}" }
[10:57:19] Radar: The block is evaluated once the gsub does its thing
[11:00:00] Radar: I am not entirely sure.
[11:01:55] Radar: $1, $2 and so on are special global variables available after a regex match
[11:02:24] Radar: !botsnack
[11:04:15] Radar: In the topic it says "this channel is logged", but doesn't say _where_. Is it more a general "some people might be logging this channel"?
[11:07:57] Radar: Nicd-: I happen to run an IRC bot that does logging, which is why I asked :) The bot itself is written in Ruby, but the site where the logs are shown is in Phoenix: http://logs.ryanbigg.com/p/Radar/activity and http://logs.ryanbigg.com/RubyOnRails are two example pages.
[11:09:33] Radar: &>> "comment_xls".gsub(/(.*)_(.*)/, '\2 \1').gsub("xls", "XLS")
[11:09:38] Radar: next question plz
[11:13:56] Radar: ryouba: that's okay. I am out of energy. I will sleep now. See you tomorrow.
[21:03:31] Radar: hahuang65: good morning. I just got on the train
[21:03:59] Radar: re: that hn article
[21:04:01] Radar: > Is Elixir/Erlang considered superior to Go for writing high concurrency web servers?
[21:04:16] Radar: lawl as if that is a common problem to have
[21:04:22] Radar: GOOD MORNING
[21:18:08] Radar: hahuang65: As far as I am aware, yes
[21:18:15] Radar: hahuang65: The people here speak Australian
[21:18:33] Radar: hahuang65: http://hipmunk.com/
[21:19:09] Radar: sylario: you may need to require byebug before you can call its method.
[21:19:22] Radar: I used to use it a bunch to find cheap airfares when I was Spree's community manager
[21:19:40] Radar: hd1: oops
[21:21:50] Radar: sylario: it's okay it is still early morning in some parts of the world. You are forgiven
[21:21:59] Radar: ACTION doles out forgiveness to Inside too
[21:22:13] Radar: sylario: that's past my bedtime.
[21:22:22] Radar: Inside: nah he was way cooler
[21:22:34] Radar: Inside: his best miracle was having 12 close friends in his 30s
[21:24:30] Radar: boom right in the feels
[22:29:41] Radar: roles_users.
[22:29:54] Radar: because it's a N-N
[22:31:22] Radar: Inside: Yeah, why is it that way?
[22:32:38] Radar: What Net saidf
[22:38:18] Radar: Inside: yes, stay Inside.


[04:08:11] Radar: srruby: no
[21:10:55] Radar: GOOD MORNING
[23:02:26] Radar: DigitalDarwin: `bundle exec rspec` is the common way to run them. You can use that to target a particular test too: `bundle exec rspec spec/models/user_spec.rb`
[23:29:44] Radar: DigitalDarwin: Different code paths that they load.
[23:29:46] Radar: DigitalDarwin: !gist


[20:57:13] Radar: GOOD MORNING


[21:06:48] Radar: hahuang65: where's the other module?
[21:08:22] Radar: hahuang65: Then you can probably do a require at the top of ApplicationHelper and then include that module directly into ApplicationHelper
[21:08:49] Radar: hahuang65: this isn't Elixir ;) You get either all or none.
[21:08:57] Radar: hahuang65: move the method into a 3rd module
[21:09:26] Radar: I long for Elixir's `import Module, only: [fun: 1]` in Ruby :D
[21:10:28] Radar: is the URL for the 3rd party system or for yours?
[21:10:40] Radar: Could you possibly have a controller action within your own project which then redirects to the 3rd party URL?
[21:10:52] Radar: then in app helper you could have a rails routing helper which goes to that controller
[21:11:08] Radar: But if it's making anything other than a GET request... a redirect won't work
[21:12:35] Radar: if you make a module method, yes.
[21:12:56] Radar: (i.e. it's defined with a self. prefix or you explicitly called module_function before that)


[21:21:40] Radar: GOOD MORNING
[22:24:47] Radar: INSIDE... chan?
[22:24:53] Radar: ACTION is not great with honorifics
[22:25:11] Radar: ramfjord: to do what?
[22:25:26] Radar: Oh I missed a line
[23:01:10] Radar: Net: Melbourne, specifically.
[23:01:20] Radar: About to jump into a 1-on-1 so I will be disappearing shortly.


[00:00:35] Radar: Net: it's deader than usual ;) Thanks for the chat also.
[21:31:20] Radar: !botsnack
[21:33:05] Radar: srruby: But seriously tho: https://gist.github.com/radar/5b1a913028a23b9610663ea78df3e1c3
[21:33:28] Radar: srruby: describe is used to describe the behaviours of the class / methods. The "#permissions" thing here would be an instance method called permissions
[21:33:45] Radar: srruby: context is used to describe different... situations, contexts? When <something is different>...
[21:34:00] Radar: The "it" is used to actually run the tests


[02:15:43] Radar: sevenseacat: jody and it was a he
[02:15:57] Radar: jody is a junior of mine
[02:16:11] Radar: :D Easy mistake to make
[02:16:52] Radar: He said that "hub" (the gem) didn't work with 2FA
[02:19:38] Radar: It was helpful to show off "hub fork" today
[02:19:53] Radar: and I've used hub pull-request in the past to build a new PR off an existing branch
[02:20:08] Radar: and at spree I used `hub am -3` to pull down PRs to my machine frequently to test them out
[21:33:18] Radar: GOOD MORNING
[21:33:23] Radar: lunarkitty: webpacker is the future
[21:33:36] Radar: Net: Step 1. Don't.
[21:33:44] Radar: thank you that will be $400
[21:34:47] Radar: (but more seriously: you can add certain directories to config.autoload_paths... but it is usually better to require files as you need them, and that way it's explicit about what's required where. Rails provides "require_dependency" for this sort of thing too -- it will reload things in between requests (iirc))
[21:35:56] Radar: In related news: my juniors are finally learning Rails this week.
[23:03:02] Radar: Net: Because autoloading has caused me a lot of pain in the past. It will load things that I do not expect it to load. Whereas I can intuit the behaviour of "require", I cannot intuit the behaviour of autoloading because a lot of how it loads things is hidden from me.
[23:03:23] Radar: With "require" I know that there is a $LOAD_PATH. I guess with autoloading there is autoload_paths, but it still isn't as clear to me.
[23:03:39] Radar: Maybe recent React experience has tainted me where everything _must_ be imported at the top of a file ion order to be used.
[23:05:48] Radar: Net: pain from incorrect constants being loaded. Most recently: we had a module in `lib/authorization.rb` called Authorization, but we also had a model with the same name (unknowingly). Autoloading loaded the model _first_ because app/models is higher up the autoload_paths than `lib` was, and so our module and its related code was never used.
[23:06:31] Radar: However, if we were _explicit_ about doing "require 'authorization'" we would've had this module loaded, and it would've conflicted with the model -- because the model is a class, and not a module -- so we wouldn't have had the exact same problems.
[23:06:54] Radar: autoloading is one of ruby's worst features in terms of POLS. It is constantly surprising to me.
[23:07:03] Radar: And then Rails complicates it by DEFINING A FUCKING MODULE automatically.
[23:07:23] Radar: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/dependencies.rb#L459-L467
[23:07:30] Radar: Rails autoloading will define modules if it cannot find them.
[23:08:16] Radar: that log line on 463 is new. I guess there is some sort of autoloading logging now in Rails master
[23:08:20] Radar: about god damned time
[23:09:24] Radar: This most recent autoloading bug with Authorization took down production for us. It could've been prevented if we weren't relying on autoloading to load constants for us, and instead required things that we needed.
[23:09:46] Radar: Net: I think require_dependency does something to track that the file / constants defined by it need to be reloaded on requests.
[23:10:33] Radar: https://github.com/rails/rails/blob/7d7372c14df4ad5b546f012a82538753c5991905/activesupport/lib/active_support/dependencies.rb#L237-L253
[23:10:47] Radar: I think that is fine to do
[23:11:37] Radar: Well, depends on what the logic does. In Exploding Rails (leanpub.com/exploding_rails) I advocate for classes outside of regular MVC, but I put them under app/ because they're a part of the application and depend on other pieces from that .
[23:11:52] Radar: `lib` just is treated like a dumping ground so often
[23:12:15] Radar: app/transactions, app/repositories, app/schemas,
[23:12:46] Radar: app/transactions/projects/create.rb, where the constant defined is Projects::Create
[23:13:02] Radar: For the same reason it's "Project" and not "Models::Project"
[23:13:26] Radar: app directories are added to the autoload path. so projects/create.rb matches Projects::Create
[23:14:26] Radar: Yes, they are a design pattern
[23:14:58] Radar: I use dry-transaction there. All the logic for "transactions" in my application lives in app/transactions, and I can call that from wherever I wish. Controllers then primarily deal with requests/responses
[23:15:04] Radar: What would go under lib/users?
[23:15:38] Radar: Thinking similar to how Phoenix structures its projects?
[23:16:24] Radar: Yeah I can see the benefits of doing that. I think it falls apart in a Rails application slightly ... because of the Active Record pattern. There is no real clear separation between structs and database queries.
[23:17:10] Radar: In my most recent Rails (side) project, I've been using the repo pattern with rom-rb and it's working out really nice.
[23:17:22] Radar: Net: Yeah, most of the domain entities represent some form of data or another from a database
[23:17:52] Radar: well, even in rom-rb
[23:18:16] Radar: AR does it too. But then it makes it easy to call out to the database whenever you want. N+1 happens in the view way too easily that way.
[23:18:33] Radar: But with rom-rb and separate structs that are actually not capable of making such database queries... well, the amount of footguns goes down
[23:19:57] Radar: Typically categorise them in terms of domain entity, but put them in directories corresponding to their ... function? app/transactions/projects/create.rb
[23:20:04] Radar: It's a transaction for creating projects.
[23:20:22] Radar: I think the directory path gets more specific left to right
[23:21:06] Radar: Not yet. I usually try out a few places and see what fits. If I can't decide I create a new directory. I don't have to live only within the bounds of what Rails provides. But still typically under app because everything else is there too.
[23:21:31] Radar: What I'd put under `lib` would probably be things that are pure-r Ruby, maybe they talk to HTTP endpoints to get back data. Or maybe 3rd party thigns.
[23:22:50] Radar: They typically don't though. app/transactions code depends on them
[23:23:28] Radar: The things then passed into the ExcelParser come from the models. ExcelParser wouldn't know how to fetch those things itself.
[23:25:58] Radar: I'd be tempted to put it into app/models, because it is a model of some data.
[23:26:04] Radar: even if it isn't a traditional model
[23:26:14] Radar: sorry, traditional _Rails_ model
[23:26:20] Radar: yeah, something like that
[23:26:34] Radar: It's a class that encapsulates business logic of a particular data struct. So probably app/models.
[23:26:52] Radar: The parser isn't a model. It acts on models. It would go into lib/excel_file/parser.rb.
[23:26:58] Radar: I know, it's not consistent.
[23:28:32] Radar: Guessing the file is uploaded somehow. I might wrap that logic in a Transaction class. It accepts a file, then passes that file to ExcelFile::Parser, which returns a Hash of the data. That Hash then gets passed to ExcelFile to get turned into a proper object.
[23:30:11] Radar: You could argue either way. I can see the merits of either returning a Hash or an ExcelFile object.
[23:30:58] Radar: ACTION agonises over returning hash or object
[23:31:43] Radar: same as I said previously: traditional rails models combine database querying, business / domain logic all within the same class. Your business logic can either intentionally or unintentionally make further database queries. This is the #1 reason of degraded performance in every Rails app I have worked on.
[23:32:07] Radar: By making "accidental" database queries harder by making the classes simply represent the data + business logic, you can prevent this sort of problem from occurring.
[23:32:46] Radar: Structs == simple classes representing data returned from a repository. In the repository pattern there's one extra layer between the model + the DB and it makes _all_ the difference. The same pattern Ecto follows. You probably know it already.
[23:40:38] Radar: yeah, business logic can be moved to different classes other than the model :)
[23:41:06] Radar: Wellllllll\
[23:41:25] Radar: I'd usually have classes that act on strings
[23:43:24] Radar: maybe they haven't caught up with our genius yet? ;)
[23:44:34] Radar: I think it's okay to break out of it.
[23:44:43] Radar: I argue for doing that here: https://www.youtube.com/watch?v=04Kq_9scT1E
[23:45:58] Radar: naeemarsalan: Can we see some code that will cause this same issue to happen on our machines?
[23:47:27] Radar: spa? Like with the water, jets and the bubbles?
[23:48:20] Radar: ?mcve naeemarsalan


[20:48:34] Radar: GOOD MORNING


[21:21:16] Radar: GOOD MORNING


[22:02:14] Radar: GOOD MORNING


[02:02:01] Radar: welcome to the house of fun


[20:45:55] Radar: GOOD MORNING
[21:07:41] Radar: xco: what database?
[21:08:17] Radar: I am not familiar with the <field> REGEXP <regexp> syntax
[21:09:25] Radar: Right, but you're using
[21:09:34] Radar: where do you see that on the page? I am not seeing it there.
[21:17:33] Radar: I see "SIMILAR TO"



[23:14:20] Radar: consider rendering a view instead.
[23:14:29] Radar: a partial, I mean
[23:21:54] Radar: yoshie902a: in the past when I have attempted to do this, I have found putting that code inside a view not only reduces the duplication, but also makes it much, much easier to read.
[23:24:12] Radar: how long does it take to render a single partial
[23:26:49] Radar: Probably a bracketing issue
[23:26:50] Radar: @template.content_tag :div, class: "input-group" do
[23:26:50] Radar: @template.label(@object_name, label)+
[23:27:09] Radar: the content_tag here doesn't have brackets around its arguments. Ruby is probably having a hard time parsing where the content_tag starts + ends.
[23:27:13] Radar: Same goes for the one beneath that too.


[02:26:56] Radar: TIL falcon
[21:34:14] Radar: tpanarch1st: what operating system are you using?
[21:34:37] Radar: tpanarch1st: Any directory under your home directory (~) will be fine
[21:34:50] Radar: on my mac, I put all my rails apps under ~/code/<company name>
[21:35:21] Radar: tpanarch1st: where can I see that?
[21:35:37] Radar: tpanarch1st: !gist
[21:37:23] Radar: I think you'll be fine with just Ruby 2.6 installed. I am not sure why you also installed Ruby 2.4.5
[21:38:16] Radar: tpanarch1st: which ones?
[21:38:22] Radar: tpanarch1st: your "gem install" appears to have installed Rails 5.0 but it thje latest version is 5.2.somehting
[21:39:47] Radar: tpanarch1st: the coder academy in Melbourne?
[21:40:38] Radar: tpanarch1st: "gem install rails" should install Rails 5.2.2. You can verify it by running `rails -v`, it should show 5.2.2
[21:41:02] Radar: tpanarch1st: oh right :) it's just that I've visited coder academy a few times as a guest speaker. I was wondering if you were one of the students
[21:41:12] Radar: tpanarch1st: suggesting to run `gem install rails` with no other options
[21:41:44] Radar: they're good instructions
[21:42:21] Radar: tpanarch1st: the latest version should take precedence. Then when you generate a Rails app, there's a file called "Gemfile" which specifies exactly which versions to use
[21:42:28] Radar: so no need to worry about having multiple versions installed
[21:42:49] Radar: not really
[21:44:02] Radar: gem uninstall rails, and answer yes to all the prompts
[21:44:09] Radar: then `gem install rails` will install the new version
[21:44:19] Radar: and yeah the learning curve is very steep
[21:44:27] Radar: I am teaching 9 junior developers at the moment so I know :)
[21:50:19] Radar: tpanarch1st: yes that should be okay


[21:36:20] Radar: All the questions have been answered.
[21:36:32] Radar: But yeah, what havenwood said.
[21:37:01] Radar: Net: welcome back.


[21:14:21] Radar: then .to_sql on the end of that
[21:59:32] Radar: baweaver: Things are good :)
[21:59:50] Radar: I'm going to run a mob programming exercise today where the juniors attempt to program a Ruby solution to calculate what a Poker hand's value is worth