« Back to channel list

#RubyOnRails - 13 December 2018

« Back 1 day Forward 1 day »
[00:00:33] ur5us: has joined #RubyOnRails
[00:02:45] weaksauce: has joined #RubyOnRails
[00:07:28] ariedler: has joined #RubyOnRails
[00:13:25] cnsvc_: has joined #RubyOnRails
[00:18:34] orbyt_: has joined #RubyOnRails
[00:20:45] ElFerna: has joined #RubyOnRails
[00:34:00] apow: has joined #RubyOnRails
[00:37:30] Xiti: has joined #RubyOnRails
[00:43:57] TCrown: has left #RubyOnRails: ()
[00:54:53] hnanon: has joined #RubyOnRails
[00:56:41] hnanon: If I have an array: ["1234", "1123", "2345"], how can I get "1123", the value that has two consecutive identical values?
[00:57:09] hnanon: identical characters or digits, I should say.
[01:01:56] dviola: has joined #RubyOnRails
[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:27] hnanon: Radar: Let me see...
[01:05:45] Radar: arg and I should use .chars, not .split("")
[01:09:52] hnanon: Radar: each_cons is cool.
[01:10:49] hnanon: Radar: While I have you here, do you agree with this: https://medium.com/planet-arkency/the-biggest-rails-code-smell-you-should-avoid-to-keep-your-app-healthy-a61fd75ab2d3
[01:18:15] sevenseacat: has joined #RubyOnRails
[01:32:55] DTZUZO: has joined #RubyOnRails
[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:41] sevenseacat: sharp knives are a feature!
[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:34] segy: has joined #RubyOnRails
[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:42] sevenseacat: I shudder when I think what the basecamp codebase might look like
[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:50] hnanon: Radar, what about this comment: https://medium.com/@vemv/if-you-care-about-transactionality-you-cannot-beat-after-commit-in-particular-38a742efbeb3
[02:00:50] sevenseacat: codebases, rather, for all the different versions
[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:01:14] kapil____: has joined #RubyOnRails
[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:51] sevenseacat: that medium post (the post the comment is on, not the comment itself) is a good one
[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:05:29] sevenseacat: true, putting the extra class methods in the model isn't a great approach. its infinitely better than the callback approach though
[02:05:54] sevenseacat: its sort of a stepping stone - people are so used to 'model is one-stop shop for all code ever'
[02:07:01] hnanon: sevenseacat: That's how I tend view it, personally.
[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:04] hnanon: Hmm...it's a little bothersome that the "Rails Way" is not necessarily the best way, at least in the opinion of you two.
[02:09:12] Radar: sorry, got my whole che guevara attitude on today
[02:09:18] ebsen: has joined #RubyOnRails
[02:09:21] Radar: hnanon: we are only two people
[02:10:08] hnanon: Radar: I know. But I'm sure you two have your opinions for good reasons.
[02:10:22] sevenseacat: I'm less bullish about these things than Radar is, but I tend to agree with him on most code-related things :)
[02:10:55] hnanon: One would think there would at least some general consensus, at least about the major features of Rails.
[02:11:04] sevenseacat: ps. you're behind on advent of code, Radar you slacker
[02:11:08] Radar: hnanon: I suspect that sometimes I hold opinions just so I can be contrary to DHH ;)
[02:11:44] sevenseacat: there is no One True Way for any coding concept. that's why we have lots of choices :)
[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:00] hnanon: Radar: What about the idea that Rails is the way it is because it's battle-tested by Basecamp?
[02:12:12] Radar: hnanon: What works for Basecamp doesn't necessarily work well in all other situations.
[02:12:14] sevenseacat: yeah that's just silly
[02:12:36] hnanon: They had problems and DHH shaped Rails to solve those problems.
[02:13:07] hnanon: Like including ActiveStorage, for example.
[02:13:14] sevenseacat: some of us don't have the luxury of rewriting our app every time a new major version of rails comes out
[02:13:45] sevenseacat: is it three versions of basecamp they run now?
[02:21:23] DTZUZO: has joined #RubyOnRails
[02:22:12] chouhoulis: has joined #RubyOnRails
[02:23:00] aidanh010: has joined #RubyOnRails
[02:30:38] cnsvc_: has joined #RubyOnRails
[02:31:15] Puffball: has joined #RubyOnRails
[02:44:21] Radar: yeah, I think it's Basecamp Classic, Basecamp 2 and Basecamp 3.
[03:09:40] ebsen: has joined #RubyOnRails
[03:14:27] ebsen: has joined #RubyOnRails
[03:22:00] AlHafoudh: has joined #RubyOnRails
[03:22:20] cpruitt: has joined #RubyOnRails
[03:30:45] crankharder: has joined #RubyOnRails
[03:36:10] orbyt_: has joined #RubyOnRails
[03:40:35] ebsen: has joined #RubyOnRails
[03:57:52] cpruitt: has joined #RubyOnRails
[03:58:19] segy: has joined #RubyOnRails
[03:59:26] cnsvc_: has joined #RubyOnRails
[04:09:27] sphalerite: has joined #RubyOnRails
[04:09:43] braincrash: has joined #RubyOnRails
[04:17:37] darkhanb: has joined #RubyOnRails
[04:23:01] cpruitt: has joined #RubyOnRails
[04:24:29] xall: has joined #RubyOnRails
[04:40:28] ebsen: has joined #RubyOnRails
[04:51:15] beef_erikson: has joined #RubyOnRails
[05:02:08] cnsvc_: has joined #RubyOnRails
[05:07:37] xall: has joined #RubyOnRails
[05:11:18] cnsvc_: has joined #RubyOnRails
[05:21:59] cpruitt: has joined #RubyOnRails
[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.
[05:32:41] sevenseacat: :D i do that a lot in slack
[05:36:59] cpruitt: has joined #RubyOnRails
[05:38:07] xall: has joined #RubyOnRails
[05:46:18] paranoicsan: has joined #RubyOnRails
[05:53:34] gambl0r3: has joined #RubyOnRails
[05:56:08] reber: has joined #RubyOnRails
[06:11:56] KeyJoo: has joined #RubyOnRails
[06:16:20] srinidhi: has joined #RubyOnRails
[06:23:26] Bin4ry: has joined #RubyOnRails
[06:23:32] roshanavand: has joined #RubyOnRails
[06:37:13] za1b1tsu: has joined #RubyOnRails
[06:49:16] Aherin: has joined #RubyOnRails
[06:56:15] tbuehlmann: has joined #RubyOnRails
[06:59:14] lexileo: has joined #RubyOnRails
[07:00:36] p8m: has joined #RubyOnRails
[07:33:13] conta: has joined #RubyOnRails
[07:54:32] ur5us: has joined #RubyOnRails
[08:24:54] srinidhi: has joined #RubyOnRails
[08:47:01] xuyuheng: has joined #RubyOnRails
[09:02:28] mikecmpbll: has joined #RubyOnRails
[09:15:41] vovs03: has joined #RubyOnRails
[09:18:11] kapil____: has joined #RubyOnRails
[09:41:02] LightStalker: has joined #RubyOnRails
[09:44:52] paranoicsan: has joined #RubyOnRails
[09:45:57] Guest61854: has joined #RubyOnRails
[09:52:00] Bin4ry: has joined #RubyOnRails
[10:01:41] roshanavand: has joined #RubyOnRails
[10:08:49] nicolasb: has joined #RubyOnRails
[10:09:13] roshanavand: has joined #RubyOnRails
[10:21:02] roshanavand: has joined #RubyOnRails
[10:39:10] ams__: has joined #RubyOnRails
[10:51:33] hightower2: has joined #RubyOnRails
[10:51:56] hightower2: Hey, where do I see a template of the method that later becomes <class>_path?
[10:52:37] hightower2: the helper which creates <x>_path(), <x>_url() etc. for every model
[10:52:38] blackmesa: has joined #RubyOnRails
[11:07:14] mello: has joined #RubyOnRails
[11:08:58] mello: hey, im using HttParty and im trying to do a POST with a file. But i cant get it to work, if i d a byebug i can se that the file is there but its not beeing sent in the post. Is there something i need to do in the body for it to be added.
[11:10:12] TvL2386: hey guys, I have a rails project using 'activerecord-sqlserver-adapter'. Now I would also like to connect to a mysql database. I added `gem 'mysql2', '~> 0.5.2'` to my Gemfile and it loaded... In rails console I see that Mysql2 is present, however, when trying to use a model in that mysql database, I get:
[11:10:22] TvL2386: Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
[11:10:26] TvL2386: from /usr/local/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec'
[11:21:44] tbuehlmann: hightower2, should be this: https://github.com/rails/rails/blob/v5.2.2/actionpack/lib/action_dispatch/routing/route_set.rb#L319-L334
[11:25:55] Ergo: has joined #RubyOnRails
[11:28:06] conta: has joined #RubyOnRails
[11:30:11] TvL2386: I'm onto something
[11:30:57] TvL2386: it seems `bundle update` fixed it
[11:31:14] TvL2386: I did `bundle install` before
[11:31:25] hightower2: tbuehlmann, great, thanks!
[11:45:57] hightower2: hey tbuehlmann, somewhat related question -- in my controller I have "MyApp::Engine.routes.url_helpers.product_url(object)" and this works. However, in rspec tests with a dummy app, this method product_url does not exist. Any pointers as to where I should look to fix this?
[11:47:12] cpruitt: has joined #RubyOnRails
[11:55:25] ariedler: has joined #RubyOnRails
[11:58:41] cpruitt: has joined #RubyOnRails
[12:00:16] mikecmpb_: has joined #RubyOnRails
[12:43:45] nickjj: has joined #RubyOnRails
[12:44:31] sevenseacat: has joined #RubyOnRails
[12:50:35] dslegends: has joined #RubyOnRails
[12:55:26] cpruitt: has joined #RubyOnRails
[12:58:50] roshanavand: has joined #RubyOnRails
[13:00:07] mr-spoon: has joined #RubyOnRails
[13:05:08] mr-spoon: has joined #RubyOnRails
[13:09:25] Guest61854: has joined #RubyOnRails
[13:18:41] mostlybadfly: has joined #RubyOnRails
[13:21:00] mello: anyone have a minute help me solve why i cant get a file sent in my rails api with post
[13:21:29] mello: i get either this error undefined method `bytesize' for #<StringIO:0x00007f9bd04dae18>
[13:21:59] mello: or this one "#<NoMethodError: undefined method `bytesize' for #<ActionDispatch::Http::UploadedFile:0x00007f9bd2201b40>>"
[13:22:52] mello: if i do file.to_s the server dont get the file. dont know what to do to make it work
[13:26:20] tbuehlmann: ActionDispatch::Http::UploadedFile is an uploaded file, so it's working. it just doesn't have a bytesize method to respond to
[13:26:24] ElFerna: has joined #RubyOnRails
[13:27:18] mello: tbuehlmann: ok, what does that mean? how do i solve it
[13:27:58] sevenseacat: mello: you're going to have to show some code or *something*. we have no idea what you're doing.
[13:29:22] mello: tbuehlmann: i mean what do i need to be able to post the file?, my rails api is a gateway so im just taking tha params and post them to the backend where its going to get saved
[13:30:04] sevenseacat: mello: show us the code you're looking at.
[13:30:15] blackmesa: has joined #RubyOnRails
[13:31:22] mello: https://pastebin.com/QQDC7CHF
[13:32:13] sevenseacat: and what's in params["attachments"] ?
[13:32:50] TvL2386: body: attachemnts,
[13:33:12] TvL2386: ahh... consequent typo I see
[13:35:08] mello: sevenseacat: that the thing i get the "#<NoMethodError: undefined method `bytesize' for #<ActionDispatch::Http::UploadedFile:0x00007f9bd2201b40>>"
[13:35:35] sevenseacat: not sure how that's related to my question
[13:36:11] mello: sevenseacat: then im sorry i dont understand your question
[13:36:29] sevenseacat: can you gist the full error so we can see where it's coming from?
[13:36:52] paranoicsan: has left #RubyOnRails: ()
[13:37:31] Guest61854: has joined #RubyOnRails
[13:38:58] mello: https://pastebin.com/caWWdm53
[13:40:21] sevenseacat: ok so what's on app/controllers/v1/support_overview_controller.rb:142
[13:41:49] mello: multipart: true,
[13:42:19] crankharder: has joined #RubyOnRails
[13:42:53] sevenseacat: I don't think so
[13:46:55] mello: thats what it says in the edior, but i get error on 141 now and that is: post_data = HTTParty.post(ENV["baseUrl"] + "attachment",
[13:52:16] conta: has joined #RubyOnRails
[13:53:30] paranoicsan: has joined #RubyOnRails
[13:58:13] cpruitt: has joined #RubyOnRails
[14:07:01] tdelam: has joined #RubyOnRails
[14:07:59] tdelam: Any suggestions as to posting SOAP to a webservice? Savon looks like it's meant for consuming only. Should I simply create the SOAP envelope manually and use Net::HTTP?
[14:12:55] cpruitt: has joined #RubyOnRails
[14:33:44] conta: has joined #RubyOnRails
[14:34:54] reber: has joined #RubyOnRails
[14:42:17] TvL2386: I'm having mulitple databases in my rails project and would like to run a migration on :other_db instead of :development
[14:48:37] TvL2386: tdelam: usually if I need to craft xml, I resort to gem "builder". I use version 3.2.3 and is very easy to create xml documents
[14:48:49] TvL2386: maybe it can help you
[14:49:03] TvL2386: I'm using httprb to actually post it
[15:11:20] agent_white: has joined #RubyOnRails
[15:13:14] CGibsonmm: has joined #RubyOnRails
[15:15:38] CGibsonmm: Good morning, I am looking into ways to get around an issue I am having where, bootstrap sticky-top nav is interfering with passing anchors via link_to (some_link, anchor: some_post ) The link is working but the anchor is only showing at the top of the page and the sticky nav is hiding int
[15:15:54] krawchyk: has joined #RubyOnRails
[15:26:54] kreantos: has joined #RubyOnRails
[15:28:01] kreantos: I have a passenger standalone setup with multiple rails apps on the same server. when I deploy a rails-app capistrano fails, because it does not know which passenger process to restart. any idea?
[15:32:04] tdelam: TvL2386: thanks man, having good luck with nokogiri at the moment!
[15:41:50] ElFerna: has joined #RubyOnRails
[15:45:19] TvL2386: tdelam: yw!
[16:04:37] krawchyk: has joined #RubyOnRails
[16:05:01] conta: has joined #RubyOnRails
[16:20:24] mauro1254: has joined #RubyOnRails
[16:34:29] ElFerna: has joined #RubyOnRails
[16:36:31] paranoicsan: has joined #RubyOnRails
[16:38:26] ElFerna: has joined #RubyOnRails
[16:59:50] krawchyk: has joined #RubyOnRails
[17:08:51] CGibsonmm: has joined #RubyOnRails
[17:09:43] maryo: has joined #RubyOnRails
[17:13:36] darkhanb: has joined #RubyOnRails
[17:26:19] syndikate: has joined #RubyOnRails
[17:28:56] Guest61854: has joined #RubyOnRails
[17:29:07] ElFerna: has joined #RubyOnRails
[17:32:36] gambl0r3: has joined #RubyOnRails
[17:34:16] ur5us: has joined #RubyOnRails
[17:38:45] lunarkitty7: has joined #RubyOnRails
[17:48:51] eckhardt: has joined #RubyOnRails
[18:08:49] Puffball: has joined #RubyOnRails
[18:11:22] weaksauce: has joined #RubyOnRails
[18:15:37] maryo: has joined #RubyOnRails
[18:26:22] CGibsonmm: has joined #RubyOnRails
[18:28:31] CGibsonmm: While running a js function, I am calling $(document).on('turbolinks:load', function(){. console.log( $('myid')) }) only returns jquery.fn.init and will not find the element on the page. Is there a workaround for this?
[18:30:05] defsdoor: has joined #RubyOnRails
[18:43:01] mikecmpbll: has joined #RubyOnRails
[18:52:19] lxsameer: has joined #RubyOnRails
[18:59:35] Jervis_: has joined #RubyOnRails
[19:04:24] Guest61854: has joined #RubyOnRails
[19:04:44] CGibsonmm: has joined #RubyOnRails
[19:09:22] CGibsonmm: has joined #RubyOnRails
[19:18:26] srinidhi: has joined #RubyOnRails
[19:47:26] carbone5: has joined #RubyOnRails
[19:50:22] conta: has joined #RubyOnRails
[19:50:45] desperek: has joined #RubyOnRails
[19:54:58] dviola: has joined #RubyOnRails
[20:00:36] reber: has joined #RubyOnRails
[20:06:32] gavit: has joined #RubyOnRails
[20:22:50] thither: has joined #RubyOnRails
[20:23:17] thither: Will Rails have problems auto-loading a class with numbers in its name? I seem to be having that issue.
[20:25:03] eckhardt: has joined #RubyOnRails
[20:29:57] ur5us: has joined #RubyOnRails
[20:41:47] SteenJobs: has joined #RubyOnRails
[20:51:58] Guest61854: has joined #RubyOnRails
[20:52:51] gambl0r3: has joined #RubyOnRails
[21:15:01] SteenJobs: has joined #RubyOnRails
[21:17:07] SteenJobs_: has joined #RubyOnRails
[21:31:33] nopolitica: has joined #RubyOnRails
[21:39:07] hightower2: has joined #RubyOnRails
[21:56:07] thither: has joined #RubyOnRails
[21:56:15] thither: Will Rails have problems auto-loading a class with numbers in its name? I seem to be having that issue.
[21:56:26] thither: Sorry I already asked but got disconnected
[22:03:55] Ookma-Kyi: has joined #RubyOnRails
[22:05:14] Ookma-Kyi: has joined #RubyOnRails
[22:09:32] Ookma-Kyi: Did i do this right? https://github.com/Ookma-Kyi/Ookma-Kyi-Core/blob/d2067f8fe67f6978a9b1769ad1edafcb38aaa1c6/Ookma-Kyi/config/secrets.yml
[22:10:26] thither: Looks good to me
[22:12:09] Ookma-Kyi: Even though the development secret in in the clear?
[22:22:33] CGibsonmm: has joined #RubyOnRails
[22:29:23] bambanx: has joined #RubyOnRails
[22:37:28] thither: nvm, fixed my error.
[22:37:35] thither: I misunderstand .underscore
[22:43:22] gavit: has joined #RubyOnRails
[22:44:05] gavit: <%= csp_meta_tag %> is missing attribute content or property, how can I add this?
[22:48:17] CGibsonmm: has joined #RubyOnRails
[23:04:05] thunderbirdtr: has joined #RubyOnRails
[23:07:33] M4xP0w3r: has joined #RubyOnRails
[23:14:25] Puffball: has joined #RubyOnRails
[23:27:51] Puffball: has joined #RubyOnRails
[23:39:59] GodFather: has joined #RubyOnRails