« Back to channel list

#RubyOnRails - 22 May 2018

« Back 1 day Forward 1 day »
[00:11:37] alfiemax: has joined #RubyOnRails
[00:14:39] ElFerna: has joined #RubyOnRails
[00:14:49] cagomez: has joined #RubyOnRails
[00:16:25] Skull0Inc: Ok so - apparently its a turbolinks issue. where <meta name="turbolinks-visit-control" content="reload"> should be placed in <head> to force reload. just in case anyone comes across it.
[00:25:15] alfiemax: has joined #RubyOnRails
[00:31:09] cagomez: has joined #RubyOnRails
[00:44:04] cagomez: has joined #RubyOnRails
[00:48:30] alfiemax: has joined #RubyOnRails
[01:03:06] ElFerna: has joined #RubyOnRails
[01:09:39] harrycs: has joined #RubyOnRails
[01:11:38] cagomez: has joined #RubyOnRails
[01:12:54] Technodrome: has joined #RubyOnRails
[01:18:55] tpendragon: has joined #RubyOnRails
[01:24:51] mices: has joined #RubyOnRails
[01:25:39] mices: how do i make a meta tag in my view to render this html <meta http-equiv="X-UA-Compatible" content="IE=edge" />
[01:28:27] sevenseacat: has joined #RubyOnRails
[01:29:47] uksio: has joined #RubyOnRails
[01:44:53] Ericx2x: has joined #RubyOnRails
[01:55:07] creature: mices: Presuming you'd want that on every page, you could put it in app/views/layouts/application.html.erb.
[01:56:58] mices: just the html?
[01:59:46] havenwood: mices: In the <head> tag of your layout html, yes.
[02:09:39] havenwood: puts tag :meta, 'http-equiv': 'X-UA-Compatible', content: 'IE=edge' #>> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
[02:22:29] mices: has joined #RubyOnRails
[02:22:46] mices: if the script contains: `return res.token;` how do i see if token is success in my controller? ... if token.success?
[02:26:27] borodin: has joined #RubyOnRails
[02:39:14] borodin: has joined #RubyOnRails
[02:44:55] xuyuheng: has joined #RubyOnRails
[02:52:22] cagomez: has joined #RubyOnRails
[02:59:02] kapil___: has joined #RubyOnRails
[03:09:49] safetypin: has joined #RubyOnRails
[03:10:22] sysfault: has joined #RubyOnRails
[03:16:41] Saukk: has joined #RubyOnRails
[04:28:55] rafaeldelucena: has joined #RubyOnRails
[04:41:52] mtkd: has joined #RubyOnRails
[05:04:06] podlech: has joined #RubyOnRails
[05:11:20] reber: has joined #RubyOnRails
[05:16:33] DoubleMalt: has joined #RubyOnRails
[05:24:04] sidx64: has joined #RubyOnRails
[05:29:33] apeiros: has joined #RubyOnRails
[05:38:58] dionysus69: has joined #RubyOnRails
[05:43:48] darkhanb: has joined #RubyOnRails
[05:48:12] quazimodo: lets say we have a sufficiently large db that we want to denormalize some aggergate data into differente organisations root accounts, but the procedure to do so is fairly complex and already coded in rails. One way is for us to call this operation in rails each place we need to, another is to have the postgres db trigger on some rules and run some sql query to do the same thing
[05:48:49] quazimodo: my question is, can the postgresdb trigger a callback on the rails app, conceptually like a webhook, to cause the rails app to do that operation that's already built & tested?
[05:49:40] quazimodo: this idea could also push a job into a sidekiq queue to do the thing, which is probably what I'd want to happen
[05:56:06] conta: has joined #RubyOnRails
[06:04:40] roshanavand: has joined #RubyOnRails
[06:08:38] sagax: has joined #RubyOnRails
[06:21:48] tomoyuki28jp: has joined #RubyOnRails
[06:22:35] tomoyuki28jp: Can anybody answer this question? https://stackoverflow.com/questions/50460459/mountable-engine-capybara-with-rspec-main-app-helpers?noredirect=1#comment87934347_50460459
[06:23:12] tomoyuki28jp: My rspec on a moutable engine cannot find main_app's helper merthods.
[06:28:46] nemesit: has joined #RubyOnRails
[06:29:06] nemesit: how can I make rails not set a session cookie?
[06:36:03] lupine: quazimodo: it can, but it's not well-supported. See pg_notify and so on.
[06:36:27] lupine: I'd probably prefer to update a column to show stale data and poll those on a cron
[06:36:40] lupine: either way, you're going to have to handle the stale case
[06:37:41] fox_mulder_cp: has joined #RubyOnRails
[06:45:27] mtkd: has joined #RubyOnRails
[06:48:33] srinidhi: has joined #RubyOnRails
[06:48:54] tomoyuki28jp: has joined #RubyOnRails
[06:57:01] sidx64: has joined #RubyOnRails
[07:03:13] sidx64: has joined #RubyOnRails
[07:06:08] mikecmpbll: has joined #RubyOnRails
[07:07:13] sidx64: has joined #RubyOnRails
[07:08:20] dionysus69: has joined #RubyOnRails
[07:12:46] sidx64_: has joined #RubyOnRails
[07:22:06] sandstrom: has joined #RubyOnRails
[07:23:43] sidx64: has joined #RubyOnRails
[07:25:43] conta: has joined #RubyOnRails
[07:33:25] schneider: has joined #RubyOnRails
[07:34:24] bga57: has joined #RubyOnRails
[07:44:17] fox_mulder_cp: has joined #RubyOnRails
[07:49:03] fsmauri21: has joined #RubyOnRails
[07:49:08] sandstrom: has joined #RubyOnRails
[07:50:05] marr: has joined #RubyOnRails
[07:55:32] sandstrom: has joined #RubyOnRails
[07:56:57] DoubleMalt: has joined #RubyOnRails
[07:57:27] mikecmpb_: has joined #RubyOnRails
[08:02:24] samosa: has joined #RubyOnRails
[08:02:32] samosa: has left #RubyOnRails: ()
[08:03:01] samosaphile: has joined #RubyOnRails
[08:14:17] sandstrom: has joined #RubyOnRails
[08:15:52] ur5us: has joined #RubyOnRails
[08:18:04] schneider: has joined #RubyOnRails
[08:19:11] conta1: has joined #RubyOnRails
[08:35:52] jottr: has joined #RubyOnRails
[08:37:43] conta: has joined #RubyOnRails
[08:42:55] Dbugger: has joined #RubyOnRails
[08:50:30] mtkd: has joined #RubyOnRails
[08:50:55] schneider: has joined #RubyOnRails
[09:03:08] jackhum: has joined #RubyOnRails
[09:15:26] lxsameer: has joined #RubyOnRails
[09:29:48] axilaris: has joined #RubyOnRails
[09:40:55] catbusters: has joined #RubyOnRails
[09:41:21] Tempesta: has joined #RubyOnRails
[09:49:15] NL3limin4t0r: has joined #RubyOnRails
[09:52:00] NL3limin4t0r: Quick question, I'm looking through the formtastic documentation for a way to set `required: false` for every field in the form. Instead of doing that per field. Does anybody know if there is such a setting?
[10:05:22] Fernando-Basso: has joined #RubyOnRails
[10:05:44] mjolnird: has joined #RubyOnRails
[10:08:35] dminuoso: has joined #RubyOnRails
[10:13:42] dminuoso: samosaphile: One of the main issues that web development has had is the emergence of dumb technologies. The bar of quality software has been massively lowered.
[10:14:03] dminuoso: Just think about what a fucking mess JavaScript is in. Not well defined, not well implemented, it's a bunch of bullshit not designed to write good or fast software.
[10:15:02] dminuoso: Web Apps dont have to be correct. They just have to "kind of work"
[10:15:14] dminuoso: Which is a terribly low threshold for any technology.
[10:16:14] srinidhi: has joined #RubyOnRails
[10:17:19] dminuoso: If you just go through https://www.npmjs.com/browse/depended about 90% of those packages are not packages solving software problems
[10:17:36] dminuoso: they are packages fixing core deficiencies of the language, browsers, JS implementations in browsers, etc
[10:20:29] apeiros: has joined #RubyOnRails
[10:21:04] conta: has joined #RubyOnRails
[10:21:25] mtkd: has joined #RubyOnRails
[10:22:37] mikecmpbll: has joined #RubyOnRails
[10:27:12] tvw: has joined #RubyOnRails
[10:32:18] samosaphile: ACTION takes a deep breath
[10:32:32] samosaphile: IMO, one of reason(s) why there is so much money in web dev stuff now is because of the emergence of technologies like nodejs which enable more powerful like web apps.
[10:32:44] samosaphile: If you know how to deploy web app's like on cloud (e.g. AWS, GCP, etc) you're basically doing devops stuff almost. Atm right now, there is allot of money for knowing how to setup, config web apps in containers. Yes, if you just know 1997 HTML no one is going to care, just in the same way knowing 1997 python will get you nowhere.
[10:32:55] samosaphile: If you stay stagnant in any field you'll get nowhere (especially in tech field) but it is a stepping stone. Just like you can't break into ML / DL field without knowing the foundations of python. Knowing the foundations of web dev / JS help enable you to understand devops / cloud. (because 90% of the stuff being deployed on AWS is stuff like JS web apps and mobile apps)
[10:34:08] ElFerna: has joined #RubyOnRails
[10:34:16] samosaphile: or it's one way anyway
[10:34:37] samosaphile: I guess sys admin is another route
[10:36:07] samosaphile: you can hate web dev stuff all you want but the future is all about collaboration and openness
[10:37:14] samosaphile: dev stuff didn't really get big or mainstream until stuff like github came around imo
[10:37:49] dminuoso: Sorry that's just bullshit.
[10:37:58] dminuoso: Node is not really a technology.
[10:38:02] dminuoso: Node did not change anything.
[10:38:23] dminuoso: Node just allowed dumb web devs to solve programming tasks we've had 50 years worth of programming languages already without extra training
[10:39:26] dminuoso: samosaphile: Let's look at what technology is about.
[10:39:29] dminuoso: samosaphile: Look at Erlang.
[10:40:40] tbuehlmann: I'd be careful with this elitist thinking. it's for a reason we build frameworks and libraries so you don't _have_ to know everything, opening the filed for a larger audience with all kinds of backgrounds and by far not all being experts or good at it
[10:41:33] tbuehlmann: (not saying it's all fine, it isn't.)
[10:44:19] dminuoso: tbuehlmann: The JS world tries to build stacks of frameworks and libraries to make the language fit to a problem domain.
[10:45:15] roshanavand: has joined #RubyOnRails
[10:47:10] tbuehlmann: "they are packages fixing core deficiencies of the language" - that's what I really dislike about js, it's missing a lot of core functionality that I like from other languages
[10:47:52] conta: has joined #RubyOnRails
[10:50:18] samosaphile: dminuoso: ok, lets look at Erlang
[10:50:37] samosaphile: what's built with erlang?
[10:50:46] samosaphile: i don't know of anything
[10:51:22] lupine: various ridiculous proprietary things
[10:52:03] conta: has joined #RubyOnRails
[10:52:10] samosaphile: yeah, never heard of it
[10:55:14] dminuoso: samosaphile: Erlang is one of the primary languages in telecommunications and networking areas.
[10:55:41] dminuoso: It's favoured for immutable data and what is the most mature multi machine concurrency solution with things like hot patching capabilities.
[10:55:46] dminuoso: It's technology.
[10:59:08] dminuoso: samosaphile: OTP brings things like extremely cheap threads, actor model concurrency, hot/live module/code patching, high fault tolerance and other things.
[10:59:11] dminuoso: samosaphile: What does node give you?
[10:59:16] dminuoso: What makes "node" such an emerging technology?
[11:01:43] Charliebr73: has joined #RubyOnRails
[11:02:33] samosaphile: companies are using it
[11:02:47] samosaphile: industry is using it
[11:02:55] samosaphile: ACTION shrugs
[11:04:41] samosaphile: all those features that erlang has may sound nice and all, but where is the industry mass adoption
[11:07:54] samosaphile: i guess it comes down to right tool for right job in the end
[11:08:16] dionysus69: has joined #RubyOnRails
[11:09:28] samosaphile: the features i want the problems am trying to solve don't see how stuff like erlang or haskell would help at all
[11:12:40] lupine: maybe it wouldn't
[11:12:54] lupine: industry mass adoption does exist, though. just in different industries
[11:20:36] samosaphile: but lol dminuoso i don't know how you ended up here in rails in the first place with your hate of web xD .. surprised you're in ruby ... instead of like rust or somewhere
[11:21:53] samosaphile: anyways, my point was just to show that there is money in web dev stuff. think i proved this point. so mission accomplished.
[11:25:42] samosaphile: but i suppose there is money in anything if you're good at it... just that you said avg. salary in us was 60k / yr. yes, it is, but it can easily be doubled switching to learning devops stuff. i guess you could say the same about erlang or haskell, but i just don't know or am aware even of erlang/haskell being popular in cloud to deploy stuff on aws and stuff
[11:26:11] arup_r: has joined #RubyOnRails
[11:27:34] samosaphile: altho im not even sure why i keep mentioning devops as it seems dead boring and something only companies care about
[11:27:45] samosaphile: but this started about money
[11:28:05] samosaphile: ML / DL is one way, so is devops
[11:28:42] samosaphile: don't see money in erlang/haskell :/
[11:29:06] NL3limin4t0r: samosaphile: Isn't WhatsApp using Erlang on their servers?
[11:29:52] dionysus69: I don't get it, what does it matter what language one uses to do anything
[11:30:12] dionysus69: I think anything is possible in any language, the question is, is it worth your time?
[11:31:50] NL3limin4t0r: It doesn't. The question is what is: what problem are you trying to solve and what language makes that the most easy to do?
[11:37:03] conta: has joined #RubyOnRails
[11:38:13] ur5us: has joined #RubyOnRails
[11:39:11] dionysus69: has joined #RubyOnRails
[11:39:12] Cavallari: has joined #RubyOnRails
[11:40:15] ldnunes: has joined #RubyOnRails
[11:54:53] dminuoso: samosaphile: Im spending most of my time writing Haskell code at the moment.
[11:55:02] dminuoso: samosaphile: And I have deep hate for Ruby.
[11:55:24] dminuoso: The main reason we still use Ruby is actually just because we have a Ruby codebase and not yet decided to deprecate things for replacement.
[12:02:35] alfiemax: has joined #RubyOnRails
[12:05:40] DrYockel: has joined #RubyOnRails
[12:13:53] borodin: has joined #RubyOnRails
[12:14:48] GodFather: has joined #RubyOnRails
[12:17:28] duderonomy: has joined #RubyOnRails
[12:21:10] conta: has joined #RubyOnRails
[12:25:50] dionysus69: Never realized you hated ruby, unless this is another instance of your dark sarcasm ^.^
[12:29:03] alfiemax: has joined #RubyOnRails
[12:29:11] dminuoso: dionysus69: Im currently writing a RADIUS Server. In my last programming session I wrote about 400 lines straight off the bat. The second it type checked, the code was bug free (as far as my testsuite can detect). This happens regularly.
[12:29:24] dminuoso: It gives so much more confidence than this "write a line of ruby code, run it and pray it works"
[12:30:39] dionysus69: If you can test haskell code so efficiently, why can't you test ruby code the same way?
[12:30:54] dminuoso: dionysus69: Because Ruby has no type system at all.
[12:31:00] conta1: has joined #RubyOnRails
[12:31:12] dminuoso: dionysus69: And Ruby has the ability to sneak in side effects everywhere.
[12:31:36] dminuoso: Strictly speaking its not a Ruby issue, because any language that doesn't have any type system suffers from thijs.
[12:31:53] dionysus69: I rarely get problems with types :P If I do, I just run once and see what it returns and there I go xD
[12:32:10] dminuoso: dionysus69: So you never have NoMethodErrors?
[12:32:17] dminuoso: dionysus69: Never try to pass more arguments than you should?
[12:32:23] dminuoso: Or pass less arguments than you need?
[12:32:27] dminuoso: Try to treat an array as a hash?
[12:32:34] dminuoso: Refer to the wrong method?
[12:32:36] dminuoso: Refer to the wrong constant?
[12:32:40] dionysus69: I mean, I do of course but as time goes, I resolve them faster and faster
[12:33:11] dminuoso: dionysus69: The thing is, I can encode domain specific invariants into types.
[12:33:17] dminuoso: Which goes deep into testing territory.
[12:33:23] dionysus69: haskell in my mind is lower level language, whatever it offers, you can say same about c# or java too then :D
[12:33:32] dminuoso: dionysus69: Haskell is definitely not lower level.
[12:33:58] dminuoso: dionysus69: And no you cant.
[12:34:06] dminuoso: dionysus69: C# and Java have gargabge type systems.
[12:34:19] dionysus69: not really into them so I wouldn't know
[12:34:21] dminuoso: They are the prime reason why people dont like type systems much.
[12:34:44] dminuoso: dionysus69: Let me give you a taste.
[12:35:37] dionysus69: haha, anyways most of the programming I have done by now is in ruby so, I dont even remember last time I used types in java
[12:35:41] dminuoso: dionysus69: https://gist.github.com/dminuoso/c69dea6552207ea77928346c76e4eea1 this is a type level description of one of my API endpoints. It's a raw type.
[12:36:47] dionysus69: ok, as if I understood what that does :D
[12:37:01] dminuoso: dionysus69: So :<
[12:37:13] dminuoso: dionysus69: So :<|> combines two API type descriptions.
[12:37:49] dminuoso: dionysus69: `"users" :> Capture "name" String :> Get '[JSON] Account` is a _type_ that describes an API endpoint `/users/:name` that accepts JSON for content-type
[12:37:55] dminuoso: `:name` is considered a String
[12:37:59] dminuoso: and it operates on the method Get
[12:38:02] dminuoso: and it returns an Account
[12:38:28] dminuoso: dionysus69: These types automatically flow through the program and ensure that each request handler for each endpoint knows about the _exact_ possible types.
[12:39:11] dminuoso: And the thing you are looking at is not a value description.
[12:39:23] dminuoso: It lives entirely at the type level and is used by the compiler to statically verify certain assumptions about my program.
[12:39:27] dminuoso: With totality.
[12:39:38] wethu: has joined #RubyOnRails
[12:40:40] dionysus69: still vague though, which exact problem is being tackled, if let's say I had same thing in Rails
[12:41:16] dionysus69: let's say I have a rails route that returns json /users/:id
[12:41:58] dminuoso: dionysus69: Prove to me that your controller treats `id` as a string, and that it _always_ produces a JSONfied Account
[12:42:04] dminuoso: dionysus69: Emphasis on _prove_
[12:42:14] dminuoso: dionysus69: The second I save my file, I have that guarantee. I dont need to write a test for it.
[12:42:52] dminuoso: dionysus69: The second I make a modification to my API type description, say because I no longer produce an Account object, but maybe some (Account, Identification) pair, Im instantly shown every piece of code that conflicts with that change.
[12:43:11] dionysus69: well I don't know, if you are building an app for a martian probe maybe it needs to be proven, but in my experience, I can safely assume the expected behavior
[12:43:22] dminuoso: dionysus69: Until you make a change.
[12:43:30] dminuoso: dionysus69: The thing is
[12:43:41] dminuoso: dionysus69: I rarely specify types. Inference guarantees they flow through my program.
[12:43:46] dminuoso: So I get type checking for free.
[12:43:53] dminuoso: I get much higher coverage with less work.
[12:44:50] dionysus69: ok I guess that is important for you :D
[12:44:55] dminuoso: dionysus69: I like writing correct software.
[12:44:58] dminuoso: I dont like bug reports.
[12:45:08] dminuoso: And I hate writing tests.
[12:45:17] DrYockel1: has joined #RubyOnRails
[12:45:18] dminuoso: Mostly because tests are written by yourself.
[12:45:29] dminuoso: So you end up writing test scnearios you have already thought of.
[12:45:38] dionysus69: yea, writing tests sounds like writing 2 apps at the same time
[12:45:39] dminuoso: Which is somewhat redundant and more useful for regression bugs really
[12:45:49] dminuoso: But the cases you havent thought of you cant really test against.
[12:46:04] dminuoso: Types can cover a lot of parts of that in a static manner.
[12:46:30] dminuoso: they are no silver bullets in the end, but there's no value in _not_ having them except for some exotic use cases
[12:46:33] dionysus69: well, even software like ssl had bugs so, until human is the programmer, bugs will always exist
[12:46:54] dminuoso: dionysus69: Well you can take this to the extremes: Coq allows you to write _verifiably_ correct programs
[12:47:07] dminuoso: (Up to the assumptions of the proof of course)
[12:47:56] mtkd: has joined #RubyOnRails
[12:48:37] dionysus69: btw, if you are good at Haskell you should try work with Cardano team, I heard they hired a guy who created Haskell :D
[12:49:23] dminuoso: Far from it. Been at it for maybe 6 months. But Im comfortable enough with it to solve most daily problems with. :)
[12:49:50] dionysus69: ok I guess levels of "good" are relative :D
[12:58:02] macay: has joined #RubyOnRails
[13:22:14] dminuoso: dionysus69: In the end you already do the "program behavior" that tests verify in your head already. It's the menality "When I call `.foo()` I get something back that responds to `.bar()`, or maybe even more accurately "I get a String back". There's very little value in refusing to have the implementation check that things will work out.
[13:22:49] dminuoso: You have to think these thoughts to program anyway. I mean you don't just randomly .openSocket().readBytes().sendToDatabase() and pray these methods exist and do what you want.
[13:24:07] dionysus69: I do have rubocop actually and I get warnings before I have to run the code
[13:24:14] dionysus69: no method errors specifically
[13:25:10] dminuoso: dionysus69: Rubocop just quickly breaks at any dynamic barrier of course.
[13:25:30] dminuoso: dionysus69: If Rubocop becomes so essential and useful, why not somehow glue it into the language itself. ;)
[13:26:08] dionysus69: well I see it as a choice
[13:26:23] dminuoso: dionysus69: Ask differently: what value do you have from not having it?
[13:26:25] dionysus69: like linux lets you rm -rf the root partition
[13:26:31] dminuoso: What value do you have from _not_ having invariants checked across your entire code?
[13:26:40] context: rm doesnt remove partitions
[13:26:54] context: it removes files and directories from a filesystem
[13:26:57] dionysus69: whatever it does, it deletes everything on it fine :D
[13:27:18] dminuoso: dionysus69: Before you answer this, let me give you the most definite and accepted definition of a type system in type theory
[13:27:43] dionysus69: it's a libertarian vs socialism kind of debate now
[13:27:47] context: dionysus69: so, rm is bad for doing its job?
[13:27:59] dminuoso: dionysus69: "A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."
[13:28:14] dionysus69: I think people have right to commit suicide if they want to, no need to have compiler check before someone decides to :D
[13:28:25] dminuoso: dionysus69: Think differently.
[13:28:29] dminuoso: dionysus69: Imagine you have an obviously wrong program.
[13:28:35] dminuoso: What value do you have from having the implementation accept it?
[13:28:52] KeyJoo: has joined #RubyOnRails
[13:28:55] dionysus69: anyways I get what you are saying
[13:29:13] context: dionysus69: and with ruby you can do just that. if you want to shoot yourself in the foot by calling functions that dont exist use a language that lets you.
[13:29:17] dionysus69: but obviously not enough rubyists think that way, because by now core team would have implemented rubocop into the language perhaps
[13:29:22] dminuoso: It usually boils down to "type systems sometimes filter out good programs", which sucks. If you hit one of those cases then fine, a type system might be in the way. But sufficiently advanced type systems are extremely flexible already.
[13:29:42] KeyJoo: has joined #RubyOnRails
[13:29:58] dminuoso: So it's the "it looks wrong but its not" case. Those happen to be fairly rare from what I can observe
[13:30:00] dionysus69: well and I do, I just know what I am calling :D, I always run the code once at least before delploying, or 100 times if I am not sure
[13:30:12] Prira: has joined #RubyOnRails
[13:30:30] srinidhi: has joined #RubyOnRails
[13:30:41] apparition: has joined #RubyOnRails
[13:31:43] brendan-: has joined #RubyOnRails
[13:40:43] kapil___: has joined #RubyOnRails
[13:50:29] Technodrome: has joined #RubyOnRails
[13:52:44] apeiros: has joined #RubyOnRails
[13:55:15] catbusters: has joined #RubyOnRails
[13:57:27] conta2: has joined #RubyOnRails
[14:03:12] safetypin: has joined #RubyOnRails
[14:06:28] fsmauri21: Question what does % do in Ruby?
[14:06:41] fsmauri21: I did an exercise and it has us place puts "Roosters #{100 - 25 * 3 % 4}"
[14:06:48] macay: has joined #RubyOnRails
[14:06:53] fsmauri21: after running the file it gives me roosters 97
[14:06:57] fsmauri21: How does it work?
[14:07:11] tbuehlmann: that's modulo
[14:07:17] fryguy: it's remainder after division, aka modulus
[14:19:59] chouhoulis: has joined #RubyOnRails
[14:24:27] dviola: has joined #RubyOnRails
[14:26:23] conta: has joined #RubyOnRails
[14:41:04] Cavallari: has joined #RubyOnRails
[14:45:52] macay: has joined #RubyOnRails
[14:53:04] mtkd: has joined #RubyOnRails
[14:55:49] orbyt_: has joined #RubyOnRails
[15:08:43] marr: has joined #RubyOnRails
[15:11:14] RougeR: has joined #RubyOnRails
[15:26:37] cschneid: has joined #RubyOnRails
[15:31:12] ldnunes: has joined #RubyOnRails
[15:40:04] cagomez: has joined #RubyOnRails
[15:47:35] cagomez: has joined #RubyOnRails
[15:50:19] dionysus69: has joined #RubyOnRails
[15:56:02] apeiros: has joined #RubyOnRails
[15:56:15] RougeR: what is the best way of doing a radio button in an edit form
[15:56:23] RougeR: where the current value is the one default selected
[15:56:27] DrYockel: has joined #RubyOnRails
[15:57:14] RougeR: its a boolean form
[15:57:32] jcarl43: has joined #RubyOnRails
[16:01:32] npgm: has joined #RubyOnRails
[16:01:53] conta: has joined #RubyOnRails
[16:16:33] orbyt_: has joined #RubyOnRails
[16:16:53] KeyJoo: has joined #RubyOnRails
[16:17:37] [Butch]: has joined #RubyOnRails
[16:17:47] apeiros: has joined #RubyOnRails
[16:26:21] darkhanb: has joined #RubyOnRails
[16:28:40] apeiros: has joined #RubyOnRails
[16:56:52] Silox|: has joined #RubyOnRails
[16:57:42] mtkd: has joined #RubyOnRails
[16:57:50] Silox|: What's currently the hippest way/gem to stream a CSV file to the browser?
[16:58:28] Silox|: Files of < 1 mb
[16:58:38] dminuoso: Silox|: react with virtual tables
[16:58:46] dminuoso: Is what I'd use
[16:59:00] Silox|: No view is needed, just a plain old .csv file download
[16:59:15] dminuoso: Silox|: What does "stream" mean
[16:59:42] srinidhi: has joined #RubyOnRails
[16:59:53] dminuoso: Or rather, what do you mean by it.
[17:00:02] Silox|: Serve, I guess?
[17:01:18] Silox|: Just a `format.csv { send_data ... }` will do perhaps?
[17:02:32] dtzuzu: has joined #RubyOnRails
[17:06:32] Puffball: has joined #RubyOnRails
[17:23:49] conta: has joined #RubyOnRails
[17:29:08] brendan-: has joined #RubyOnRails
[17:43:10] conta: has joined #RubyOnRails
[17:43:28] bryanculver: has joined #RubyOnRails
[17:45:48] mtkd: has joined #RubyOnRails
[17:47:16] GodFather: has joined #RubyOnRails
[17:48:33] bryanculver: has joined #RubyOnRails
[17:50:42] RougeR: heya quick xpost from #ruby, i could do with some help or a guide on how to work with data in a join table (has many :through)
[17:52:32] defsdoor: has joined #RubyOnRails
[17:58:32] Technodrome: has joined #RubyOnRails
[18:02:59] Saukk: has joined #RubyOnRails
[18:03:17] dviola: has joined #RubyOnRails
[18:26:42] conta: has joined #RubyOnRails
[18:34:55] Cavallari: has joined #RubyOnRails
[18:35:12] mtkd: has joined #RubyOnRails
[18:36:32] borodin: has joined #RubyOnRails
[18:45:45] sandstrom: has joined #RubyOnRails
[18:56:34] charlielor: has joined #RubyOnRails
[18:57:16] charlielor: I tried rails console and I got this error: .rvm/gems/ruby-2.4.4/gems/activerecord-5.2.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `Connection' for ActiveRecord::Base:Class (NoMethodError)
[18:57:25] charlielor: any help is much appreciated
[18:59:13] chouhoulis: has joined #RubyOnRails
[19:10:46] fryguy: charlielor: well, where are you calling `Connection`, which looks like it's capitalized and shouldn't be
[19:11:15] mjolnird: has joined #RubyOnRails
[19:12:30] charlielor: fryguy: the only place
[19:12:32] MrCrackPotBuilde: has joined #RubyOnRails
[19:12:45] RougeR: anyone got a link to how to work with has_many, through:
[19:12:47] charlielor: ‘Connection’ is mentioned is in the app/application_cable/connection.rb
[19:14:22] charlielor: the connection.rb class declaration: class Connection < ActionCable::Connection::Base
[19:14:28] MrCrackPotBuilde: hi i know this is js channel but i have a problem with turbo links and js. https://gist.github.com/scope2229/6ea4d5d2a42f48f1af1538b580359a68 in this file the script element is created every time i reload the page is there a way to turn that into an if to
[19:14:48] RougeR: MrCrackPotBuilde: this is rails/...
[19:15:22] jarnalyrkar: has joined #RubyOnRails
[19:15:23] MrCrackPotBuilde: ive googled and googled and googled and it seems the error You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors. is due to turbolinks
[19:15:32] MrCrackPotBuilde: so i thought maybe someone here has seen it
[19:15:48] MrCrackPotBuilde: for sure someone here in rails has seen it its google maps api
[19:16:24] charlielor: fryguy: oh, I found another place where it reference the ‘Connection’ class and that is in the application.rb. ActiveRecord::Base.Connection
[19:18:00] charlielor: I commented out this line ActiveRecord::Base.Connection and rails console works now.
[19:18:00] fryguy: MrCrackPotBuilde: probably stop using turbolinks unless you have a good reason to
[19:19:27] MrCrackPotBuilde: gah thats what i always do since rails 3 its time to stop that hahah a
[19:19:46] MrCrackPotBuilde: i spent all week getting the map to show in the first place when i switch links
[19:20:07] MrCrackPotBuilde: then the problem was when i clicked another link and back again i got two You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.
[19:20:25] MrCrackPotBuilde: turbolinks.clearcache removed one of those errors
[19:20:41] MrCrackPotBuilde: the next is the js itself that is adding multiple scripts
[19:20:59] MrCrackPotBuilde: so now i need to see if the script is there first as noted in the gist
[19:21:58] MrCrackPotBuilde: but to do this im at a loss would i just use a getelementbytag and select the body then check is script is there but that will always come back as true
[19:22:08] MrCrackPotBuilde: this i tested already
[19:22:56] MrCrackPotBuilde: always comes back because of the whole rails doesnt reload a page it jus changes the content. also my .css once compiled to html becomes <script>
[19:24:27] mikecmpbll: has joined #RubyOnRails
[19:26:13] mices: has joined #RubyOnRails
[19:27:19] MrCrackPotBuilde: i also cant check if the specific script is loaded as its that script that is needed in the first place
[19:27:30] MrCrackPotBuilde: so if its not loaded the map wont load
[19:28:57] mices: a javascript that ends with `return res.token` will send what parameter name to the controller?
[19:29:44] _aeris_: has joined #RubyOnRails
[19:31:05] MrCrackPotBuilde: where does res.token link to
[19:31:51] mices: return paypal.request.post(SETEC_URL).then(function(res) {
[19:31:51] mices: return res.token;
[19:32:24] MrCrackPotBuilde: id need to see the whole file please its still a little to vague
[19:32:41] mices: SETEC_URL gets replaced with my controller's url
[19:33:13] alfiemax: has joined #RubyOnRails
[19:34:07] MrCrackPotBuilde: by the looks of it res is a list of some sort with a member named token
[19:34:24] MrCrackPotBuilde: what ever the value of that token is thats what will be returned
[19:36:50] cagomez: has joined #RubyOnRails
[19:38:30] mices: MrCrackPotBuilde https://gist.github.com/mices/cb2ddb39fe630b1d377dcfa81b946300
[19:39:22] MrCrackPotBuilde: res wont return anything
[19:39:50] MrCrackPotBuilde: so there is no token within res
[19:40:19] charlielor: has joined #RubyOnRails
[19:40:46] charlielor: has left #RubyOnRails: ()
[19:40:51] mices: sounds like it needs work
[19:40:51] MrCrackPotBuilde: if you have used a paypal gem check inside github see what res.token is
[19:41:24] MrCrackPotBuilde: where are you hoping to take the token from
[19:41:41] MrCrackPotBuilde: where do you think this value is
[19:43:31] mices: i dunno i haven't looked at this closely enough yet, i dunno if i should use this or the paypal-ruby-sdk
[19:43:39] mices: this is express checkout
[19:45:19] mices: how many times a day do you think paypal backs up their database?
[19:46:11] mices: or any site where users have accounts containing money or credits otherwise
[19:47:21] RougeR: i need my rails has_many through associations looking at im getting unitialized constant
[19:48:14] GodFather: has joined #RubyOnRails
[19:48:21] mices: its your singular vs plural names for your models and relationships
[19:48:37] RougeR: yeah im seeing that said
[19:48:41] RougeR: but it looks right
[19:48:56] RougeR: as in i cant spot an error
[19:49:04] RougeR: ill look again one last time
[19:50:08] mices: join tables have to be named using singular for both tables example "person_address"
[19:50:30] mices: belongs to person, belongs to address
[19:50:59] RougeR: im copying the rails doc and it looks right
[19:51:01] mices: sorry "address_person" i think
[19:51:07] RougeR: im open to being wrong
[19:51:10] RougeR: ill post models
[19:51:21] RougeR: https://github.com/CodePint/SendRoute/blob/master/app/models/gym.rb
[19:51:21] dionysus69: what is this for? config.require_master_key = true
[19:51:29] RougeR: https://github.com/CodePint/SendRoute/blob/master/app/models/membership.rb
[19:51:30] mices: then person has_many :address_people
[19:51:30] dionysus69: what if it's false, app won't launch or what?
[19:51:30] mices: has_many :addresses, through: :address_people
[19:51:35] RougeR: https://github.com/CodePint/SendRoute/blob/master/app/models/user.rb
[19:51:41] RougeR: https://github.com/CodePint/SendRoute/blob/master/db/migrate/20180502150841_create_memberships.rb
[19:52:07] RougeR: http://guides.rubyonrails.org/association_basics.html
[19:52:40] MrCrackPotBuilde: mices before you ever use a new gem always take a look through especially a third party gem
[19:53:21] MrCrackPotBuilde: a lot of the time they may either a need tweeking b you creating your own gem instead c just works for basic and or overkill functionallity \
[19:53:50] RougeR: what is the correct syntax to assign a user to a gym membership
[19:53:55] mices: i read that 3rd party gems had better docs than paypal
[19:54:00] RougeR: just to make sure im doing that right
[19:54:18] MrCrackPotBuilde: theres been many times ive found a gem for a third party api but it just doesnt do or does too much of what i want
[19:54:30] mices: @gym_membership+@user
[19:54:39] MrCrackPotBuilde: its more you should learn how to create your own gems for your own use
[19:55:11] RougeR: mices: how does it know the gym to assign to the user
[19:55:39] mices: you create an object for the gym membership and add the user object to it
[19:55:48] MrCrackPotBuilde: roouger that will be done in your model
[19:55:58] RougeR: MrCrackPotBuilde: what will be done in my model..
[19:56:24] MrCrackPotBuilde: taking the gym from the database to which the user is a memver of
[19:57:07] RougeR: pretty sure id assign it in the controller...
[19:57:26] MrCrackPotBuilde: your controller should just be passing info to the view
[19:57:38] MrCrackPotBuilde: all functionality or logic should be in the model
[19:57:40] RougeR: and saving it.
[19:58:17] MrCrackPotBuilde: in the controller you would have def view end def save end def create end etc
[19:58:29] MrCrackPotBuilde: then in those you would reference the data from the model
[19:58:33] RougeR: yeah and create is saving it to a database
[19:58:40] MrCrackPotBuilde: the controller would then pass that to the view
[19:59:05] RougeR: if i had a method for assigning a user to a gym after creation
[19:59:16] MrCrackPotBuilde: as to which gym the user is from that would be down to how you have set up the database and how you set up the logic of the model
[19:59:17] RougeR: but if i was assigning a user to a gym on creation then no
[19:59:34] MrCrackPotBuilde: assigning a user to a gym is model
[19:59:47] MrCrackPotBuilde: it would be the same as a registration form etc
[20:00:22] darkhanb: has joined #RubyOnRails
[20:00:22] MrCrackPotBuilde: you would on initial creation have a input field asking which gym the user is a member of
[20:00:33] MrCrackPotBuilde: then you have this updated to the database
[20:00:35] RougeR: well, not for this i wont
[20:00:47] RougeR: its a more casual association
[20:00:48] MrCrackPotBuilde: if you have ten gyms all in different locations
[20:00:52] RougeR: the user doesnt assign themselves
[20:00:57] RougeR: nor does the owner
[20:00:59] RougeR: its implicit
[20:01:08] MrCrackPotBuilde: then you create a helper
[20:01:21] MrCrackPotBuilde: each gym will have its own helper
[20:01:31] MrCrackPotBuilde: so for ten gyms you have ten helpers
[20:01:39] MrCrackPotBuilde: or something similar
[20:01:49] MrCrackPotBuilde: so the gym set up is automatic
[20:01:58] MrCrackPotBuilde: and no need for a input field
[20:02:03] RougeR: anyway, yeah i can see that
[20:02:10] RougeR: my issues is still on this join table
[20:02:17] RougeR: i can worry about where the code can go after
[20:02:18] eckhardt: has joined #RubyOnRails
[20:02:22] MrCrackPotBuilde: that is down to your sql
[20:02:34] RougeR: yeah, ive posted my models and migrations
[20:02:37] MrCrackPotBuilde: all down to your queries on the db and the setup
[20:02:38] RougeR: i cant see the issue.
[20:02:53] RougeR: im not sure how you are mean to do setup after
[20:02:56] MrCrackPotBuilde: make sure the primary keys are both unique
[20:02:58] RougeR: the rails docs are unclear
[20:03:10] RougeR: ive read the docs and setup as per docs
[20:03:15] MrCrackPotBuilde: then its a simple sql join statment
[20:03:27] RougeR: its not working, im not sure why
[20:03:31] jarnalyrkar: (Just wanting to say that as a rails beginner I'm following this conversation closely, and you MrCrackPotBuilde are now my hero :)D
[20:03:45] MrCrackPotBuilde: haha noooooo im a noob
[20:03:56] MrCrackPotBuilde: i cant even get google maps to work with turbolinks
[20:04:00] jarnalyrkar: Still, your patience
[20:04:10] mices: RougeR you can create an object representing the groups users and then just add a list of @users to it with @membership.users + @users
[20:04:12] MrCrackPotBuilde: kids and being a cto
[20:05:04] mices: RougeR then @membership.save
[20:05:22] RougeR: mices: thankyou. ill try that in rails console now
[20:06:19] RougeR: undefined users
[20:06:26] MrCrackPotBuilde: try in your models
[20:06:30] fragamus: has joined #RubyOnRails
[20:06:48] RougeR: ive posted them up. it looks correct to me. ill post them again
[20:07:01] mices: RougeR then you can create a checkbox list of users and check all the users you wanna add and click submit once
[20:07:04] MrCrackPotBuilde: has_many user through ->gyms
[20:07:35] RougeR: MrCrackPotBuilde: through memberships
[20:07:52] MrCrackPotBuilde: https://stackoverflow.com/questions/7606124/using-join-tables-in-ruby-on-rails?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
[20:08:03] RougeR: https://github.com/CodePint/SendRoute/blob/master/app/models/gym.rb
[20:08:03] RougeR: https://github.com/CodePint/SendRoute/blob/master/app/models/membership.rb
[20:08:07] MrCrackPotBuilde: heres a reference i used a while back for when i created a app for spas
[20:08:08] mices: through membership_user
[20:08:14] cagomez: has joined #RubyOnRails
[20:08:22] MrCrackPotBuilde: which ever you wish to join
[20:08:27] RougeR: mices: ive called it memberships
[20:08:33] RougeR: logic is the same
[20:08:47] jarnalyrkar: has_many always in plural, belongs_to and through always singular :)
[20:08:53] jarnalyrkar: ... correct me if I'm wrong.
[20:09:17] mices: the names of the join tables in has_many_through have to be singular for both tables and in alphabetical order
[20:09:24] MrCrackPotBuilde: can you post your migration
[20:09:34] MrCrackPotBuilde: i need the table name and columns
[20:10:08] RougeR: hang on just going to throw something up
[20:10:53] RougeR: jarnalyrkar: you are right. they should be
[20:10:58] RougeR: i knew i was missing something
[20:11:02] RougeR: let me see if that resolves it
[20:11:39] RougeR: just need to drop and migrate
[20:12:38] MrCrackPotBuilde: so any one able to help with turbolinks and google maps api hahahah
[20:13:02] RougeR: whats up with it, ive done a little maps api stuff ages ago
[20:13:34] MrCrackPotBuilde: basically my js file controls the lot no scripts anywhere and in contact just div id map
[20:14:16] MrCrackPotBuilde: https://gist.github.com/scope2229/6ea4d5d2a42f48f1af1538b580359a68
[20:14:56] MrCrackPotBuilde: when it finds map it runs the code
[20:15:21] MrCrackPotBuilde: map isnt identicle to null so the script is added to body
[20:15:49] MrCrackPotBuilde: which removed the error of the map only loading when the page was refreshed
[20:16:20] MrCrackPotBuilde: now though if i go from contact to home to contact i get the error two instances of api
[20:16:53] RougeR: having a look now
[20:17:24] MrCrackPotBuilde: since the only place in the entire app the script created is the js file my conclusion is turbolinks when changing page is adding a second script then after moving again removing so i always have two scripts
[20:17:37] MrCrackPotBuilde: if i remove the turbolinks clearcache
[20:17:55] MrCrackPotBuilde: then i get two errors at the same time meaning 3 scripts on the page
[20:18:42] RougeR: could you add an if statement to not run the script if there is already an isntance running
[20:19:02] RougeR: but yeah its weird that its doing that
[20:19:15] MrCrackPotBuilde: no because im too stupid to know how to do it due to the fact i have so many script elements becaue of turbolinks
[20:19:50] mices: MrCrackPotBuilde in these examples i should replace return with something= i think
[20:20:20] mices: to contain what's been returned no?
[20:20:27] RougeR: also i got my membership table to work with the following: @gym.users << @user
[20:20:32] MrCrackPotBuilde: i thought about first looking for scripts but that failed because css is also script then i thought about looking for the exact script but that failed after link clicking
[20:20:48] RougeR: + throws type error
[20:20:52] RougeR: its treated as an array
[20:21:35] MrCrackPotBuilde: i dont have a return statement
[20:21:59] MrCrackPotBuilde: that very first return is for is the control and action dont match
[20:22:19] RougeR: i hope you get it sorted MrCrackPotBuilde. sorry if im a bit short tempered. Im working on my own to learn this and ive been working for hours.
[20:23:32] MrCrackPotBuilde: hahaha its no worries
[20:23:49] MrCrackPotBuilde: ive been at it since 12
[20:23:51] RougeR: ahh 10pm here. been working since mid day
[20:24:10] RougeR: i did a rails boot camp, and the guy who ran it really fucked us over lol
[20:24:23] RougeR: so im now having to teach myself everything they didnt and looking for job.
[20:24:40] RougeR: aye im sure you will MrCrackPotBuilde
[20:24:54] MrCrackPotBuilde: try remote work and if you are no good as a designer try to find someone who is
[20:25:13] MrCrackPotBuilde: i started out like that and told my friend also starting out i can only pay if i sell
[20:25:22] RougeR: i am soo not a designer haha, i cant stand front end work. I want to work contract/remote eventually
[20:25:32] RougeR: i like design, i just cant stand frontend tbh
[20:25:34] MrCrackPotBuilde: yer best to do the above im the same
[20:26:03] MrCrackPotBuilde: i code all my front end but i get an artist to do the design for me
[20:26:10] RougeR: Im errr...not a fan of javascript as a language lol. and css drives me up the wall. Im great at ruby/python
[20:26:14] MrCrackPotBuilde: then all the back i do
[20:26:18] RougeR: ahh nice one
[20:26:21] jarnalyrkar: MrCrackPotBuilde why does your javascript file has an erb filename?
[20:26:33] RougeR: coffeescript?
[20:26:43] RougeR: yeah im not a fan either
[20:26:54] MrCrackPotBuilde: because i like security
[20:26:56] RougeR: i dont like js, but id rather write straight js than compile down
[20:27:01] MrCrackPotBuilde: and .env doesnt work with js
[20:27:17] MrCrackPotBuilde: and when i move to production ill use my hosts env
[20:27:33] MrCrackPotBuilde: this way no matter where it goes with .erb it will run smoothly
[20:27:55] MrCrackPotBuilde: i get very confused with scss css sass less
[20:27:56] RougeR: im guna take a break, then get the CRUD and validaions for membership table setup. Ive brought a couse on udemy for CSS/JS going to try learn it even though i hate it
[20:28:25] RougeR: i just dislike how overcomplicated and fractured front end is...why are there seven million js/css frameworks
[20:28:35] RougeR: its literally rendering a document
[20:28:45] MrCrackPotBuilde: when i first learn js css and html way back i actually called companies up asking what they wanted then learnt it hahah
[20:29:08] RougeR: ahhh i used to do that with network stuff. ive got a security/systems background
[20:29:10] MrCrackPotBuilde: it all renders to js and css in the end anyway
[20:29:14] MrCrackPotBuilde: but it is simpler
[20:29:29] MrCrackPotBuilde: like graphs etc animations or weird funky canvas
[20:29:31] RougeR: i want to learn straight js/css and then ill look at frameworks
[20:29:44] RougeR: its a tool to get jobs done, thats all.
[20:29:51] RougeR: i might not like it, but its useful to know
[20:29:51] MrCrackPotBuilde: writing 0 - 100 start and 0- 100 end with angles is a pain
[20:30:14] MrCrackPotBuilde: id go for both tbh or at least css js and scss
[20:30:17] RougeR: yeah i can imagine that. vanilla js can be very code intensive
[20:30:36] RougeR: MrCrackPotBuilde: aye im going too. although jobs im looking for are backend/devops
[20:30:53] MrCrackPotBuilde: really i worked on a element yesterday that just 4 cirlces its over 800 lines of css or 20 scss
[20:31:09] alfiemax: has joined #RubyOnRails
[20:31:25] RougeR: aye, that is quite impressive and annoying at the same time
[20:31:27] RougeR: right brb
[20:31:29] RougeR: beer oclock
[20:32:56] mikecmpbll: has joined #RubyOnRails
[20:34:28] uks: has joined #RubyOnRails
[20:40:50] MrCrackPotBuilde: one thing the api defines when its called is google
[20:41:51] MrCrackPotBuilde: so just before the insert of the script i check to see if google has been defined then if it has run initMap if not insert the script that bloody simple but took over 12 hours
[20:44:43] dblessing: has joined #RubyOnRails
[20:48:58] darkhanb: Does anybody speaks Latvian here?
[20:49:26] darkhanb: Or fluent in Latvian grammar?
[20:50:30] Dbugger: has joined #RubyOnRails
[20:50:38] darkhanb: I'm i18n-ing the Rails app and according to these plural rules Latvian, Prussian languages use :zero plural form for 10-20
[20:50:39] darkhanb: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#Cardinal-Integer
[20:51:07] darkhanb: * when count is 10-20 that is
[20:52:54] darkhanb: I did some research myself with google translate, which was not the case.
[20:53:28] darkhanb: But maybe Latvian language has certain words...
[20:55:34] fragamus: has joined #RubyOnRails
[20:57:01] cagomez: has joined #RubyOnRails
[20:58:47] duderonomy: has joined #RubyOnRails
[20:59:35] NoGodDamnIdea: has joined #RubyOnRails
[21:04:03] RougeR: ACTION sighs
[21:04:06] RougeR: stuck again
[21:06:06] RougeR: trying to understand why i cant access attributes on a has many through join table
[21:06:39] RougeR: i.e @member = Membership.find(1)
[21:06:47] RougeR: @member.user_id
[21:07:57] jarnalyrkar: hmm, I don't have any relations of that kind in my current project, so I wouldn't know :/
[21:08:03] RougeR: ahhh i think ive got it
[21:08:07] jarnalyrkar: However, this article helped me one time I was stuck
[21:08:08] jarnalyrkar: http://theartandscienceofruby.com/2016/01/13/confused-about-has_many-through-associations-heres-what-they-look-like-in-the-database/
[21:08:12] RougeR: im using where and its returning an array
[21:09:23] RougeR: i was doing @recrd.where(user_id: 1, gym_id: 2)
[21:09:32] RougeR: which was giving [record]
[21:09:40] RougeR: nice gotcha
[21:09:57] RougeR: it twigged when .find was working which was just a single instance
[21:10:22] jarnalyrkar: Well, good luck :) i'm off to bed, have a good day / night whatever!
[21:10:29] RougeR: will do, thanks rubber ducky
[21:11:53] MrCrackPotBuilde: do you have the three models ???
[21:12:15] MrCrackPotBuilde: one for gym one for membership one for gymmembership
[21:12:35] havenwood: has joined #RubyOnRails
[21:12:47] MrCrackPotBuilde: the two singular are the has_many and the dual is the belongs_to
[21:13:56] MrCrackPotBuilde: dam 5 am nope im out sorry RougeR hopefully you get it sorted
[21:18:31] tdy: has joined #RubyOnRails
[21:19:23] RougeR: MrCrackPotBuilde: yeah i do man
[21:19:28] RougeR: MrCrackPotBuilde: im there i think
[21:19:38] RougeR: its all working fine now
[21:20:17] RougeR: was trying to call active record methods on an array. hopped in a pry debugger n got it
[21:24:13] chouhoulis: has joined #RubyOnRails
[21:32:16] GodFather: has joined #RubyOnRails
[21:38:23] amperry: has joined #RubyOnRails
[21:38:56] _aeris_: has joined #RubyOnRails
[21:39:56] alfiemax: has joined #RubyOnRails
[21:42:56] amperry: Hi folks, in addition to STI, how can you model OO-style inheritance between tables with Rails? (I might be fine with STI alone, but I'm looking for options.)
[21:45:38] dgsan: has joined #RubyOnRails
[21:49:39] Radar: GOOD MORNING
[21:50:13] amperry: GOOD MORNING, RADAR
[21:51:22] regedit: has joined #RubyOnRails
[22:02:19] eckhardt: has joined #RubyOnRails
[22:04:36] regedit: I have a Messages model and ContactNumber model. I'd like to add ContactNumber.opted_out_message_id column which should refer to a single Messages record
[22:04:48] regedit: The idea being i need to record whether a ContactNumber is considered "opted out", and if so which Message record is the one that "opted out" the ContactNumber
[22:05:55] regedit: i'm fumbling around not sure how to achieve this, messing with belongs_to / has_one, add_reference with custom column name, no foreign keys etc...
[22:06:38] cagomez: has joined #RubyOnRails
[22:06:53] dionysus69: activestorage doesn't have option to attach remote file?
[22:07:02] dionysus69: there's even a pending PR https://github.com/rails/rails/pull/30834/files
[22:11:45] orbyt_: has joined #RubyOnRails
[22:12:17] alfiemax: has joined #RubyOnRails
[22:25:08] wethu: has joined #RubyOnRails
[22:26:43] Technodrome: has joined #RubyOnRails
[22:35:30] alfiemax: has joined #RubyOnRails
[22:37:34] Radar: literally unusable
[22:37:40] dviola: has joined #RubyOnRails
[22:38:04] Radar: dionysus69: I couldn't see this being abused at all.
[22:38:39] dionysus69: what is unusable?
[22:38:42] dionysus69: activestorage?
[22:39:03] Radar: Sorry, it's a meme.
[22:39:14] Radar: http://knowyourmeme.com/memes/literally-unplayable
[22:39:59] Radar: `curl <remote url> | ruby <active storage upload script>`
[22:40:03] Radar: bro do you even bash script
[22:40:20] dionysus69: so you are saying I should stop using activestorage right now ? :D I just spent half an hour trying to download and attach to activestorage
[22:40:45] dionysus69: had to do that in one line though, and inside a activerecord save block
[22:40:55] Radar: Eh. It doesn't matter. Active Storage will work fine.
[22:41:16] dionysus69: where.first_or_create ..... ..... do |user| user.avatar.attach(auth.info.image) end
[22:41:33] dionysus69: thing is that attach expects file, not url
[22:42:04] dionysus69: so how do I download file with auth.info.image url and convert it into file object, all that inline
[22:43:01] Radar: I'd use a HTTP library (like http.rb), download the file and then save it to a tmp directory. Then I would attach that file using AStor's methods
[22:43:52] fragamus: has joined #RubyOnRails
[22:43:53] dionysus69: I already tried 5 different ways :D that's my problem :P
[22:44:21] Radar: A+ for effort
[22:44:32] Radar: So how did you try with the best http library (http.rb)
[22:45:07] dionysus69: yea, I actually skipped over that one :D
[22:45:41] amperry: is there a method or command in the rails console to list an object/model's associations?
[22:47:44] Radar: amperry: Model.reflections
[22:50:51] amperry: Radar: groovy, thx
[22:58:08] amperry: does it make sense for one model to 'has_many' another model, and the other model to 'has_many' that model, without either of them 'has_and_belongs_to_many'? I'm tempted to try something, but the idea sounds dumb to me.
[23:01:46] dionysus69: you are probably talking about has_many through relationship
[23:02:04] dionysus69: whatever you are saying doesn't make sense because non of them have a reference id
[23:03:21] Radar: amperry: Can you talk in more absolute terms? Perhaps using the names of your models?
[23:04:17] amperry: dionysus69: yeah. right now I have a have a model, Placement, which has_many Residents, which (most of the time) act like they belong_to that one Placement. But a Resident can move, and get a new Placement. Placement is a container for everything rental related, including Lease, Apt, Residents, and Ledger.
[23:04:48] moei: has joined #RubyOnRails
[23:05:26] amperry: they can also sign a Lease before moving, or renew a Lease (which is not really 'renewing' it, but it's really signing a new one), so they can still be in their current Placement while awaiting the move to the new one.
[23:05:41] dionysus69: Placement has many residents through placement_residents join table, that is generic and works in all cases
[23:06:06] dionysus69: but you can optimize it by coming up with better model names :D placement seems general so it will be hard to optimize that
[23:07:56] amperry: Placement is a container; I would have gone with Lease, but a Resident can be associated with an Apt by placing a deposit on it before they actually sign. This is based on an old app that didn't even have a Lease table, but instead (a) listed everybody on the Lease as a single resident, and (b) created a new Resident every time they moved or re-signed.
[23:08:05] amperry: to give you a taste of the insanity I'm working with.
[23:09:33] amperry: so I needed a way to group people together and conditionally associate them with an Apt, even if they don't sign a Lease, because a non-refundable deposit fee is associated with the Apt and I need to account for that.
[23:11:56] amperry: 19/20 times or more, I'll be querying their present location; but there are some reports and some odd processes that need to see their past locations (including two roommates who go their separate ways) and possible future/prospective one.
[23:12:54] amperry: sorry for the info dump, but you asked :S
[23:25:05] Vasa: has joined #RubyOnRails
[23:41:47] fragamus: has joined #RubyOnRails
[23:49:34] dionysus69: heh yea, that data modeling is horrible from the first glance
[23:53:49] alfiemax: has joined #RubyOnRails
[23:58:14] amperry: has left #RubyOnRails: ("ERC (IRC client for Emacs 24.5.1)")
[23:58:47] amperry: has joined #RubyOnRails
[23:58:58] amperry: well, that was unintended