« Back to channel list

#RubyOnRails - 30 August 2017

« Back 1 day Forward 1 day »
[00:05:31] jhfisc: has joined #RubyOnRails
[00:10:20] AntiSpamMeta: has joined #RubyOnRails
[00:20:38] cagomez: has joined #RubyOnRails
[00:20:48] cagomez: has joined #RubyOnRails
[00:20:52] milesmatthias: has joined #RubyOnRails
[00:21:48] milesmat_: has joined #RubyOnRails
[00:21:55] cagomez: has joined #RubyOnRails
[00:22:24] mtkd: has joined #RubyOnRails
[00:24:48] cagomez_: has joined #RubyOnRails
[00:25:10] GodFather: has joined #RubyOnRails
[00:37:46] hahuang65: has joined #RubyOnRails
[00:38:58] jhfisc: has joined #RubyOnRails
[00:46:50] jhfisc: has joined #RubyOnRails
[00:53:00] jhfisc: has joined #RubyOnRails
[00:55:16] fschuindt: has joined #RubyOnRails
[00:55:48] jhfisc: has joined #RubyOnRails
[01:00:59] jhfisc: has joined #RubyOnRails
[01:02:00] bronson: has joined #RubyOnRails
[01:07:01] jhfisc: has joined #RubyOnRails
[01:12:01] quazimodo: has joined #RubyOnRails
[01:13:37] jmay: has joined #RubyOnRails
[01:15:50] ResidentBiscuit: has joined #RubyOnRails
[01:20:07] pharma_joe: has joined #RubyOnRails
[01:27:57] Zinefer: has joined #RubyOnRails
[01:30:54] sevenseacat: has joined #RubyOnRails
[01:37:47] Zinefer: i'm doing a bit of complicated stuff with a partial and a block ... could someone take a look at this and maybe explain why my output is appearing out of order?
[01:37:50] Zinefer: https://gist.github.com/anonymous/a420e58d764c52b60a18a59d47b8c0bd
[01:38:58] jhfisc: has joined #RubyOnRails
[01:39:23] Jameser: has joined #RubyOnRails
[01:41:49] chouhoulis: has joined #RubyOnRails
[01:42:31] chouhoulis: has joined #RubyOnRails
[01:43:43] hahuang65: has joined #RubyOnRails
[01:46:11] jhfisc: has joined #RubyOnRails
[01:52:20] jhfisc: has joined #RubyOnRails
[01:52:52] Zinefer: https://stackoverflow.com/questions/45950682/ruby-partial-block-render-out-of-order
[01:53:17] sevenseacat: whats out of order?
[01:54:12] yoongkang: has joined #RubyOnRails
[01:54:14] sevenseacat: your code is convoluted and a wee bit fake so its hard to tell
[01:54:28] Zinefer: yeah sorry
[01:54:36] Zinefer: the `block.call` is what produces the hello-worlds
[01:54:49] Zinefer: i call that while inside the %table > %tr in the partial
[01:55:10] Zinefer: however the output places the hello-worlds before the table and table rows
[01:55:45] sevenseacat: that doesnt help
[01:56:02] sevenseacat: what are you actually trying to achieve?
[01:56:59] Zinefer: i want to define a block and pass that into a different partial, and nest that blocks output inside html in the partial
[01:57:23] Zinefer: it almost appears like the block is rendering into the context which it was defined, rather than where it was called
[01:57:58] sevenseacat: thats not what youre trying to achieve, thats how youre trying to solve some mystery problem
[01:58:03] sevenseacat: what is that problem
[01:58:08] jhfisc: has joined #RubyOnRails
[01:58:14] Zinefer: out of the scope of this conversation
[01:58:32] Zinefer: but if you must know, i am creating a class that generates a table
[01:59:10] Zinefer: originally i had a partial file for each td element, because of a mess of other constraints on the class
[01:59:32] Zinefer: that was rather inefficient (taking 1-2ms per render call) so i was playing with this block
[01:59:45] pharma_joe: has joined #RubyOnRails
[01:59:52] Zinefer: it is much faster - but it does not place it's output where i would expect
[02:00:42] Zinefer: actually, looks like this guy was having the same problem: https://stackoverflow.com/questions/8492349/rails-3-haml-block-passed-to-partial-rendered-in-original-context-instead-of-p?rq=1
[02:01:42] Zinefer: no solutions :/
[02:02:35] bronson: has joined #RubyOnRails
[02:03:08] jhfisc: has joined #RubyOnRails
[02:04:04] Zinefer: haml is indeed the problem:
[02:04:07] Zinefer: http://haml.info/docs/yardoc/Haml/Engine.html
[02:04:24] Zinefer: > Due to some Ruby quirks, if scope is a Binding or Proc object and a block is given, the evaluation context may not be quite what the user expects.
[02:08:43] jhfisc: has joined #RubyOnRails
[02:09:54] jmay: has joined #RubyOnRails
[02:14:59] jhfisc: has joined #RubyOnRails
[02:20:35] jhfisc: has joined #RubyOnRails
[02:20:38] Zinefer: aha!~!! i even got it to work!
[02:20:51] Zinefer: `= capture_haml &block`
[02:20:56] rafaeldelucena: has joined #RubyOnRails
[02:24:54] pharma_joe: has joined #RubyOnRails
[02:30:35] jhfisc: has joined #RubyOnRails
[02:35:18] hahuang65: has joined #RubyOnRails
[02:40:17] jhfisc: has joined #RubyOnRails
[02:43:15] jhfisc: has joined #RubyOnRails
[03:06:59] dblessing: has joined #RubyOnRails
[03:11:05] jhfisc: has joined #RubyOnRails
[03:14:46] kies: has joined #RubyOnRails
[03:23:58] Ropeney: has joined #RubyOnRails
[03:24:02] jhfisc: has joined #RubyOnRails
[03:27:48] ahrs: has joined #RubyOnRails
[03:29:02] jhfisc: has joined #RubyOnRails
[03:30:49] jmay: has joined #RubyOnRails
[03:39:44] jhfisc: has joined #RubyOnRails
[03:43:26] fschuindt1: has joined #RubyOnRails
[03:51:37] kies: has joined #RubyOnRails
[03:57:17] pharma_joe: has joined #RubyOnRails
[04:00:56] Jayson_Virissimo: has joined #RubyOnRails
[04:03:37] bronson: has joined #RubyOnRails
[04:07:51] jhfisc: has joined #RubyOnRails
[04:16:56] theunraveler: has joined #RubyOnRails
[04:18:15] milesmatthias: has joined #RubyOnRails
[04:18:43] umaaji: has joined #RubyOnRails
[04:21:23] xcesariox: has joined #RubyOnRails
[04:22:21] xcesariox: sevenseacat
[04:25:06] hahuang65: has joined #RubyOnRails
[04:25:37] mochiyoda: has joined #RubyOnRails
[04:26:10] jhfisc: has joined #RubyOnRails
[04:27:10] tenderlo_: has joined #RubyOnRails
[04:27:19] gusrub: has joined #RubyOnRails
[04:39:36] jhfisc: has joined #RubyOnRails
[04:46:21] alfiemax: has joined #RubyOnRails
[04:50:41] hahuang65: has joined #RubyOnRails
[04:52:06] jhfisc: has joined #RubyOnRails
[05:04:56] jhfisc: has joined #RubyOnRails
[05:11:33] juggler: has joined #RubyOnRails
[05:14:22] hahuang65: has joined #RubyOnRails
[05:16:48] jhfisc: has joined #RubyOnRails
[05:22:40] cagomez: has joined #RubyOnRails
[05:26:50] jhfisc: has joined #RubyOnRails
[05:30:00] paranoicsan: has joined #RubyOnRails
[05:30:48] jhfisc: has joined #RubyOnRails
[05:31:24] drale2k_: has joined #RubyOnRails
[05:34:09] srinidhi: has joined #RubyOnRails
[05:35:30] joelroa: has joined #RubyOnRails
[05:41:33] jhfisc: has joined #RubyOnRails
[05:47:42] jhfisc: has joined #RubyOnRails
[05:52:42] jhfisc: has joined #RubyOnRails
[05:53:32] shantanoo: has joined #RubyOnRails
[05:55:17] alfiemax: has joined #RubyOnRails
[06:02:24] Chernobuk: has joined #RubyOnRails
[06:09:05] jhfisc: has joined #RubyOnRails
[06:19:19] jhfisc: has joined #RubyOnRails
[06:24:22] jhfisc: has joined #RubyOnRails
[06:24:29] ur5us: has joined #RubyOnRails
[06:28:21] conta: has joined #RubyOnRails
[06:30:58] jhfisc: has joined #RubyOnRails
[06:39:44] foreman-n00b: has joined #RubyOnRails
[06:45:50] jhfisc: has joined #RubyOnRails
[06:46:13] lxsameer: has joined #RubyOnRails
[06:53:47] jhfisc: has joined #RubyOnRails
[06:54:33] mtkd: has joined #RubyOnRails
[06:59:12] jhfisc: has joined #RubyOnRails
[07:05:07] bronson: has joined #RubyOnRails
[07:10:43] gambl0re: has joined #RubyOnRails
[07:12:59] Arkentias: has joined #RubyOnRails
[07:15:11] hahuang65: has joined #RubyOnRails
[07:21:56] paranoicsan: has joined #RubyOnRails
[07:25:28] hahuang65: has joined #RubyOnRails
[07:27:00] jhfisc: has joined #RubyOnRails
[07:31:53] defsdoor: has joined #RubyOnRails
[07:34:46] rakm: has joined #RubyOnRails
[07:40:29] opekktar: has joined #RubyOnRails
[07:40:43] nrdb: has joined #RubyOnRails
[07:47:34] dionysus69: has joined #RubyOnRails
[07:51:37] agent_white: has joined #RubyOnRails
[07:58:58] jhfisc: has joined #RubyOnRails
[08:01:30] mikecmpbll: has joined #RubyOnRails
[08:05:43] shilon: has joined #RubyOnRails
[08:06:22] bronson: has joined #RubyOnRails
[08:07:15] paranoicsan: has joined #RubyOnRails
[08:11:16] jhfisc: has joined #RubyOnRails
[08:15:34] roshanavand: has joined #RubyOnRails
[08:23:02] hammer065: has joined #RubyOnRails
[08:24:52] workmad3: has joined #RubyOnRails
[08:31:45] foreman-n00b: has joined #RubyOnRails
[08:35:43] KeyJoo: has joined #RubyOnRails
[08:39:10] jhfisc: has joined #RubyOnRails
[08:40:25] lxsameer: has joined #RubyOnRails
[08:42:58] drale2k_: has joined #RubyOnRails
[08:45:30] dionysus69: I have a nested form and I want to not try create child object if it already exists, instead just create an association
[08:47:17] dionysus69: so this is how relationship looks https://gist.github.com/anonymous/9187364f19be07bf8cb05f1661312336
[08:48:08] dionysus69: and if tenant exists, just create evaluation and tenant_evaluation records, instead of give a validation error saying tenant already exists
[08:49:24] dminuoso: dionysus69, why not conflate tenant and tenant_evaluation?
[08:49:50] dionysus69: ye actually I was thinking about it
[08:50:04] dionysus69: but then evaluation would belong to tenant
[08:50:26] dminuoso: But doesnt it semantically anyway?
[08:50:33] dionysus69: but perhaps there's no problem in that, I dont actually know why I created association like that. but would it be easier to solve my problem in that case?
[08:50:40] marr: has joined #RubyOnRails
[08:51:04] Sylario: dionysus : you need your complex version of the @something.build that is usually made in the edit action
[08:51:11] dminuoso: Yes. Or you have to stop relying on weird magical rails features and just use active record.
[08:51:14] dionysus69: ok I ll merge it, would have to refactor my form quite a bit brb xD
[08:51:21] dminuoso: You do know that you can just manually use activerecord right
[08:51:31] dminuoso: I know some rails people refuse to acknowledge this.
[08:51:52] dionysus69: I know, but I maximally try to stick to library methods
[08:51:58] Sylario: dminuoso: what do you mean by manually use active record?
[08:52:00] dionysus69: instead of come up with stinky bombs :D
[08:53:07] dminuoso: sylario, instead of somehow relying on form builders construcing some.. magical object, passing it to some magical method and then expecting ActiveRecord to do "the right thing" I mean.
[08:53:39] dionysus69: i just used fields for helper nothing more fancy :D
[08:55:12] jhfisc: has joined #RubyOnRails
[08:58:12] dionysus69: I remembered why i had has one through has many instead of belongs to
[08:58:34] dionysus69: evaluation accepts attributes for tenant, but if evaluation belongs to tenant, how can it accept_attributes_for
[08:58:46] dionysus69: it only works for has_one or has_many doesn't it ?
[08:59:00] mtkd: has joined #RubyOnRails
[08:59:27] Sylario: dminuoso: idk, the form builder is really designed with the way AR works, you can't really go very far without understanding that
[09:00:21] jhfisc: has joined #RubyOnRails
[09:06:18] tbuehlmann_: dionysus69: I wrote an example application for what I guess is what you want (but having has_many and not has_one): https://github.com/tbuehlmann/has-many-through-selection
[09:06:18] jhfisc: has joined #RubyOnRails
[09:06:31] tbuehlmann_: might help, maybe not
[09:06:40] dminuoso: ACTION throws a SyntaxError at tbuehlmann_'s head
[09:07:06] dionysus69: ok I ll check it out :)
[09:07:27] bronson: has joined #RubyOnRails
[09:08:52] dionysus69: tbuehlmann_: ok I got the main detail, if I pass id, it updates. but how can I prevent it to update either, just ignore attributes if one unique field matches
[09:09:47] dionysus69: so if it can't find id, it will create everything the usual way, but if child exists, just create the parent and set the FK
[09:10:04] dionysus69: in my case though, parent will belong to child, child has many parents xD
[09:12:37] dionysus69: which part didn't you understand ? :)
[09:14:29] tbuehlmann_: parent belongs to child and child has_many parents sounds weird
[09:15:57] dionysus69: just because I want to deal with evaluations form
[09:16:11] dionysus69: so I want to pass info about user, from evaluations form and not vice-versa
[09:16:58] dionysus69: user wants to create new evaluation while user might already exist
[09:18:00] jhfisc: has joined #RubyOnRails
[09:22:12] tbuehlmann_: so an user creates an evaluation? sounds like a standard scenario to me
[09:23:28] dionysus69: yep but creates evaluation for tenant
[09:24:13] jhfisc: has joined #RubyOnRails
[09:24:26] dionysus69: but tenant may already exist, so I dont want to make tenant a primary form model, I want it to be created/not_updated based on if it already exists, while user creates evaluation
[09:26:43] Papierkorb: has joined #RubyOnRails
[09:36:07] jhfisc: has joined #RubyOnRails
[09:36:11] Sylario: mm, I just inherited a 8 years old rails project, there i no gemfile, how do I know the rails version
[09:36:22] Sylario: Ho do you even rails without a gemfile?
[09:36:36] Sylario: mm, I just inherited a 8 years old rails project, there is no gemfile, how do I know the rails version
[09:37:09] Maakuth: by globally installed gems I think
[09:38:06] Maakuth: is it running somewhere already? go to that box and carefully recover gem versions and ruby version from there and write yourself a Gemfile
[09:38:35] brent__: has joined #RubyOnRails
[09:39:09] jhfisc: has joined #RubyOnRails
[09:40:54] Knickelbach_: has joined #RubyOnRails
[09:42:42] Knickelbach_: I just started learning ruby and have a question regarding something like capitalize! - Is there a practical reason why I'd use capitalize! instead of capitalize? Or is the ! operator mostly for convenience?
[09:43:08] Sylario: Maakuth: it's not running anywhere, It is the problem
[09:43:14] Sylario: no ver num anywhere
[09:44:32] tbuehlmann_: Knickelbach_: there are more than one intention when using bang methods. they can identity as a dangerous method, or, when having a non-bang version as well, as a mutating method
[09:45:03] Maakuth: sylario, uh oh, I don't think there's any way to know for sure then. I think I'd start by looking at version control timestamps to make educated guesses about versions
[09:45:32] tbuehlmann_: string.capitalize will return a new (capitalized) string object. string.capitalize! will return the same object, it being changed/mutated
[09:46:19] matthewd: sylario: There was a `config.gem` thing at one point... are there any lines like that, somewhere in config/ ?
[09:46:33] Maakuth: Knickelbach_, ! or ? in method name don't by themselves do anything though, they are just part of the name. convention for their use is like what tbuehlmann_ said
[09:47:08] Maakuth: ?-methods should by convention return a boolean value
[09:47:35] Knickelbach_: tbuehlmann_, Maakuth: - Thank you both!
[09:47:49] Sylario: there is a rake config gem install, but no vzersion number
[09:48:21] Sylario: I'll just skip 2.0 and try to resurrect it in a 3.0 project
[09:48:30] Sylario: that's going to be a fun one.
[09:48:39] quazimodo: has joined #RubyOnRails
[09:48:46] Maakuth: check what was stable when it was being actively developed
[09:48:59] arBmind: has joined #RubyOnRails
[09:54:01] ams__: has joined #RubyOnRails
[09:55:14] jhfisc: has joined #RubyOnRails
[09:59:00] ferr: has joined #RubyOnRails
[09:59:38] Sylario: ok, new->project and by the power of copy paste, i'll recreate the app
[09:59:42] Sylario: it will be easier
[10:01:14] jhfisc: has joined #RubyOnRails
[10:01:21] Ergo: has joined #RubyOnRails
[10:02:13] Sylario: thx Maakuth
[10:08:04] bronson: has joined #RubyOnRails
[10:09:16] hfp_work: has joined #RubyOnRails
[10:11:07] Maakuth: sylario, np, tell us when you've figured it out :)
[10:11:27] Tempesta: has joined #RubyOnRails
[10:11:35] Sylario: In the end it's just a small app with a lot of code for user and open ID
[10:11:56] Sylario: once i'll have an ipenID gem and devise, it'l be easy peasy
[10:12:03] Sylario: once i'll have an openID gem and devise, it'l be easy peasy
[10:12:35] Sylario: old routes.rb syntax is interesting
[10:13:24] Sylario: ok, i need to stop acting like if IRC is Slack, sorry for the double lines
[10:17:20] jhfisc: has joined #RubyOnRails
[10:25:13] stamina: has joined #RubyOnRails
[10:33:01] gregf_: has joined #RubyOnRails
[10:43:35] bruno-: has joined #RubyOnRails
[10:45:39] jhfisc: has joined #RubyOnRails
[10:51:17] apparition47: has joined #RubyOnRails
[10:52:07] jhfisc: has joined #RubyOnRails
[10:55:20] shilon: has joined #RubyOnRails
[10:56:52] Sylario: Is lambda in scopes deprecated in 5 ?
[10:57:43] Papierkorb: has left #RubyOnRails: ("Konversation terminated!")
[10:59:02] DTZUZO: has joined #RubyOnRails
[10:59:06] jhfisc: has joined #RubyOnRails
[11:00:56] Knickelbach_: has joined #RubyOnRails
[11:01:06] Sylario: ok so the old lambda syntax is still valid for ruby, but in scopes it has a wrong behaviour, but the new syntax (->) works, so ruby is ok with old syntax but not rails?
[11:02:54] Knickelbach_: boolean_2 = !true && !true -- Codecademy says the value that boolean_2 holds is "false" but shouldn't it resort to "true" since the left and right side of the AND are both "!false"?
[11:03:55] Sylario: they are both false
[11:04:18] worknick: has joined #RubyOnRails
[11:04:21] Knickelbach_: yeah but wouldn't adding the && operator make it to "true" then? since both are the same?
[11:04:39] Sylario: false && false => false
[11:04:53] worknick: i have a javascript code inside my .html.haml page. how can i provide I18n value to one of the javascript variable here?
[11:05:08] worknick: options: { title: t('test') }
[11:05:09] worknick: how to do that?
[11:05:10] Knickelbach_: Ohhh, I thought adding && will compare both values and then set a true/false depending on that comparsion
[11:05:21] Sylario: Knickelbach_: http://4.bp.blogspot.com/-MX_uN_K_imI/UqzIQh7oOsI/AAAAAAAAAHo/HEgR6N6Qtfo/s1600/TruthTables.GIF
[11:05:36] Sylario: you should revisit basic boolean logic
[11:06:02] Knickelbach_: I know how truth tables work, I was confused about the function of the && operator :)
[11:07:08] sevenseacat: has joined #RubyOnRails
[11:08:47] Sylario: worknick: rails do not care about html or js in a view, only thing ot recognise is a erb tag (in erb files)
[11:08:52] bronson: has joined #RubyOnRails
[11:08:57] Sylario: just trhow a <%= %> inside the JS
[11:09:48] worknick: using haml.
[11:09:49] Sylario: Most of the time, dynamic JS is not a good idea
[11:10:02] worknick: title: "#{var}" worked
[11:10:20] worknick: sylario, why not good ideao?
[11:11:11] jhfisc: has joined #RubyOnRails
[11:12:53] NoGodDamnIdea: has joined #RubyOnRails
[11:14:51] Sylario: worknick JS and ruby lives in very different place, by making them more cohesive you lose some separation of concerns
[11:15:04] Sylario: sorry it's kinda hard to explain in english
[11:15:23] Sylario: but in the long run you are less "free"
[11:16:18] jhfisc: has joined #RubyOnRails
[11:21:29] Maakuth: better use static js and get your data into it via json api for example
[11:22:42] srinidhi: has joined #RubyOnRails
[11:23:22] AzaToth: has joined #RubyOnRails
[11:24:55] quazimodo: has joined #RubyOnRails
[11:26:50] jhfisc: has joined #RubyOnRails
[11:28:23] jonno112: has joined #RubyOnRails
[11:29:04] hahuang65: has joined #RubyOnRails
[11:29:56] quazimodo: has joined #RubyOnRails
[11:33:00] jhfisc: has joined #RubyOnRails
[11:41:11] jhfisc: has joined #RubyOnRails
[11:45:07] srinidhi: has joined #RubyOnRails
[11:46:28] chouhoulis: has joined #RubyOnRails
[11:46:41] jhfisc: has joined #RubyOnRails
[11:48:27] chouhoulis: has joined #RubyOnRails
[11:53:44] jhfisc: has joined #RubyOnRails
[11:58:36] sekmo: has joined #RubyOnRails