« Back to channel list

#RubyOnRails - 04 April 2017

« Back 1 day Forward 1 day »
[00:01:14] uksio: has joined #RubyOnRails
[00:02:04] jusa: has joined #RubyOnRails
[00:02:33] hahuang61: has joined #RubyOnRails
[00:06:14] mrbubbles: Long shot - has anyone done any DB partitioning of massive data sets?
[00:09:05] pickle_: has joined #RubyOnRails
[00:11:01] eightlimbed: has joined #RubyOnRails
[00:11:03] rakm: has joined #RubyOnRails
[00:11:16] gusrub: has joined #RubyOnRails
[00:11:23] aperkins81: has joined #RubyOnRails
[00:12:43] eightlimbed: i'm just starting out with rails.
[00:12:55] eightlimbed: new to programming and web development
[00:13:17] eightlimbed: just wanted to see what's going on here and maybe get pointed in a direction that will help me learn
[00:13:57] eightlimbed: i'm doing micheal hartl's tutorial @ railstutorial.org
[00:14:08] GodFather: has joined #RubyOnRails
[00:18:32] havenwood: eightlimbed: nice. welcome!
[00:18:55] havenwood: eightlimbed: This is a good place to ask any Rails questions or there's the #ruby channel for Ruby questions.
[00:22:32] SkinnyFart: has joined #RubyOnRails
[00:24:52] eightlimbed: hi @havenwood - thank you!
[00:25:12] eightlimbed: havenwood: thank you!
[00:27:11] aperkins81: has joined #RubyOnRails
[00:28:44] havenwood: eightlimbed: you're welcome, happy coding!
[00:34:13] superlou: has joined #RubyOnRails
[00:38:42] quazimodo: has joined #RubyOnRails
[00:44:42] dblessing: has joined #RubyOnRails
[00:50:16] coatezy: has joined #RubyOnRails
[00:56:07] sevenseacat: has joined #RubyOnRails
[01:00:19] ResidentBiscuit: has joined #RubyOnRails
[01:03:43] Omnilord: has joined #RubyOnRails
[01:05:00] GodFather: has joined #RubyOnRails
[01:05:53] Technodrome: has joined #RubyOnRails
[01:14:07] aajjbb: has joined #RubyOnRails
[01:17:14] ResidentBiscuit: has joined #RubyOnRails
[01:19:57] cam27: has joined #RubyOnRails
[01:21:41] cam27: Have people been talking about Jason Seifer’s passing on here?
[01:23:49] irishfromua: has joined #RubyOnRails
[01:36:52] irishfromua: has joined #RubyOnRails
[01:39:09] Rodya_: has joined #RubyOnRails
[01:44:29] duderonomy: has joined #RubyOnRails
[01:45:58] irishfromua: has joined #RubyOnRails
[01:49:11] hahuang61: has joined #RubyOnRails
[01:51:42] ErhardtMundt: has joined #RubyOnRails
[01:54:40] tomas_w: has joined #RubyOnRails
[01:56:46] quazimodo: has joined #RubyOnRails
[01:59:33] irishfromua: has joined #RubyOnRails
[02:02:43] jusa: has joined #RubyOnRails
[02:07:40] libastral: has joined #RubyOnRails
[02:14:14] DoctorMonocular: has joined #RubyOnRails
[02:18:38] HoierM: has joined #RubyOnRails
[02:19:01] r3vDev: has joined #RubyOnRails
[02:21:53] Kristis: has joined #RubyOnRails
[02:24:45] bruce_lee: has joined #RubyOnRails
[02:24:45] bruce_lee: has joined #RubyOnRails
[02:24:45] Kristis: has left #RubyOnRails: ()
[02:25:33] Kristis: has joined #RubyOnRails
[02:31:30] jenrzzz: has joined #RubyOnRails
[02:35:53] hndk: has joined #RubyOnRails
[02:40:02] Rodya_: has joined #RubyOnRails
[02:48:49] aajjbb: has joined #RubyOnRails
[02:54:53] irishfromua: has joined #RubyOnRails
[02:55:27] crankharder: has joined #RubyOnRails
[02:58:06] crankharder: Kernel#exec replaces the current process with the given command, so it keeps the current environment. Is there a way to exit and start a new process such that the env gets blown away and/or reset?
[03:00:15] Radar: crankharder: I think Bundler does something similar to this with Bundler.clean_env?
[03:03:23] crankharder: thats interesting (clean_env is deprecated in favor of original_env) http://www.rubydoc.info/gems/bundler/1.14.5/Bundler#original_env-class_method
[03:03:56] crankharder: but, we're talking exiting and invoking a shell script... thinking how to use that ^^
[03:08:33] hndk: has joined #RubyOnRails
[03:09:51] HoierM: has joined #RubyOnRails
[03:24:49] pickle_: has joined #RubyOnRails
[03:29:27] fugee: has joined #RubyOnRails
[03:31:23] fschuindt1: has joined #RubyOnRails
[03:46:31] arBmind1: has joined #RubyOnRails
[03:46:43] madebymarkca: has joined #RubyOnRails
[03:49:57] irishfromua: has joined #RubyOnRails
[03:50:04] hahuang61: has joined #RubyOnRails
[03:53:39] jusa: has joined #RubyOnRails
[03:54:44] mazeinmaze_: has joined #RubyOnRails
[04:01:43] irishfromua: has joined #RubyOnRails
[04:02:51] djbkd: has joined #RubyOnRails
[04:10:46] irishfromua: has joined #RubyOnRails
[04:29:00] hipertracker: has joined #RubyOnRails
[04:29:26] patarr: has joined #RubyOnRails
[04:29:50] jbermudes: has joined #RubyOnRails
[04:32:18] Rodya_: has joined #RubyOnRails
[04:37:46] Destru: has joined #RubyOnRails
[04:45:07] fugee: a link_to with method path and paramaters can be used in substitution of a form?
[04:45:18] fugee: s/path/patch
[04:50:57] hakash: has joined #RubyOnRails
[05:04:55] peterhil`: has joined #RubyOnRails
[05:04:58] pupsicle1: has joined #RubyOnRails
[05:05:28] alexggor1on: has joined #RubyOnRails
[05:05:45] fcser__: has joined #RubyOnRails
[05:06:18] RubyNewbey______: has joined #RubyOnRails
[05:06:41] joaomdmoura___: has joined #RubyOnRails
[05:06:58] tycoon177_: has joined #RubyOnRails
[05:07:01] Yonk__: has joined #RubyOnRails
[05:07:14] daxroc1: has joined #RubyOnRails
[05:07:14] alethea__: has joined #RubyOnRails
[05:07:15] tfittsy: has joined #RubyOnRails
[05:07:21] jxf_: has joined #RubyOnRails
[05:07:44] LyndsySimon_: has joined #RubyOnRails
[05:08:16] lxkm_: has joined #RubyOnRails
[05:08:28] imanc__: has joined #RubyOnRails
[05:08:30] boshhead_: has joined #RubyOnRails
[05:08:32] jbermudes: has joined #RubyOnRails
[05:08:32] jbermudes: has joined #RubyOnRails
[05:08:51] haydenmuhl: has joined #RubyOnRails
[05:08:52] ErhardtMundt_: has joined #RubyOnRails
[05:09:37] creature_: has joined #RubyOnRails
[05:09:46] nej: has joined #RubyOnRails
[05:09:51] ejnahc_: has joined #RubyOnRails
[05:09:55] fsc: has joined #RubyOnRails
[05:10:28] xall: has joined #RubyOnRails
[05:10:50] jgt: has joined #RubyOnRails
[05:11:28] machuga_: has joined #RubyOnRails
[05:11:28] machuga_: has joined #RubyOnRails
[05:11:57] \13k_: has joined #RubyOnRails
[05:12:00] xibalba_: has joined #RubyOnRails
[05:12:09] werd-driven: has joined #RubyOnRails
[05:12:35] swav_: has joined #RubyOnRails
[05:12:54] tjvc_: has joined #RubyOnRails
[05:12:56] Tralin_: has joined #RubyOnRails
[05:12:58] ghormoon_: has joined #RubyOnRails
[05:13:08] loglaunc-: has joined #RubyOnRails
[05:13:13] braidn_: has joined #RubyOnRails
[05:14:02] bga57: has joined #RubyOnRails
[05:15:49] zz_timnovinger: has joined #RubyOnRails
[05:16:00] jhfisc: has joined #RubyOnRails
[05:20:20] shaman42: has joined #RubyOnRails
[05:21:07] hahuang61: has joined #RubyOnRails
[05:21:11] spectra: has joined #RubyOnRails
[05:21:15] kies: has joined #RubyOnRails
[05:21:26] xybr_: has joined #RubyOnRails
[05:21:42] Pumukel: has joined #RubyOnRails
[05:21:48] iceden: has joined #RubyOnRails
[05:21:49] lukas_[m]: has joined #RubyOnRails
[05:24:34] Pumukel: has joined #RubyOnRails
[05:31:16] jeyraof^mbpr: has joined #RubyOnRails
[05:33:18] rubyonrails545: has joined #RubyOnRails
[05:36:09] madgoat: has joined #RubyOnRails
[05:36:38] madgoat: has left #RubyOnRails: ()
[05:42:47] r3vDev: has joined #RubyOnRails
[05:49:42] pLaTo0n: has joined #RubyOnRails
[05:57:30] xall_: has joined #RubyOnRails
[06:05:59] spyder55: has joined #RubyOnRails
[06:06:35] spyder55: has joined #RubyOnRails
[06:06:58] xall_: has joined #RubyOnRails
[06:07:31] tildes: has joined #RubyOnRails
[06:07:43] roshanavand: has joined #RubyOnRails
[06:08:07] xall: has joined #RubyOnRails
[06:10:02] markh: has joined #RubyOnRails
[06:11:31] volix: has joined #RubyOnRails
[06:13:25] joelyou: has joined #RubyOnRails
[06:17:36] coder2000: has joined #RubyOnRails
[06:17:46] ResidentBiscuit: has joined #RubyOnRails
[06:24:41] coder2000: I was trying to start a new project with 5.0.2 and it would end up installing 5.1 and using that instead. Is this normal?
[06:25:04] sevenseacat: it can be, it depends on what you did
[06:25:56] coder2000: I installed 5.0.2 and created a new project with RubyMine. By the end of the project generation the version in the gemfile was 5.1.
[06:26:12] sevenseacat: that sounds very Rubymine-specific
[06:28:07] sevenseacat: if you were using just the command line to create a project, using `rails new` by default would use the latest version of Rails you have installed (but can be configured to use a different version if you have multiple installed)
[06:30:16] patarr: has joined #RubyOnRails
[06:31:26] coder2000: I used the command line with the specific version and it still created a 5.1 project
[06:33:46] sevenseacat: what command did you run?
[06:34:16] coder2000: rails _5.0.2_ new block
[06:34:27] coder2000: unless it has changed recentl;y
[06:34:36] sevenseacat: yeah thats exactly what it should be
[06:34:36] coder2000: as that is the same command used by RubyMine
[06:35:11] matthewd: You may have a bad version of rubygems, or a binstub created by same
[06:35:48] matthewd: There was a period where it would ignore the _n_ version due to a bug
[06:36:14] coder2000: I have gem version 2.5.2
[06:36:26] sevenseacat: yeah I just tested it and I have the exact same problem
[06:36:34] sevenseacat: tried to create a 4.2.8 app and got 5.0.2
[06:36:45] sevenseacat: also on rubygems 2.5.2
[06:37:13] conta: has joined #RubyOnRails
[06:37:13] sevenseacat: just upgraded gem to 2.6.11,will see if it fixes it
[06:38:16] matthewd: I think you now need to do a thing to regenerate the binstub
[06:38:42] sevenseacat: I've never actually used binstubs - had no end of problems with them
[06:38:52] matthewd: I mean the system one
[06:40:29] sevenseacat: I didn't even know system binstubs were a thing
[06:40:49] edago: has joined #RubyOnRails
[06:41:16] matthewd: It's the trampoline that's providing the _n_ behaviour, before handing off to the appropriate version-specific file from the real installed gem
[06:42:22] coder2000: So how would we recreate these binstubs?
[06:42:23] sevenseacat: ok, so how do we fix this so coder2000 can get a rails 5.0.2 app
[06:44:05] sevenseacat: googling is just giving me bundler, rbenv or rails-specific info, not system ingo
[06:48:25] matthewd: Looks like `gem pristine --all --only-executables` might do it
[06:48:39] sevenseacat: I tried that for rails, it didnt help - will try for all
[06:49:19] sevenseacat: hey that did do it 👍
[06:49:51] phikes: has joined #RubyOnRails
[06:50:21] coder2000: that did work
[06:58:36] Rodya_: has joined #RubyOnRails
[07:00:34] zero1one0: has joined #RubyOnRails
[07:00:45] Pumukel: has joined #RubyOnRails
[07:01:18] darutoko: has joined #RubyOnRails
[07:04:16] Destru: has joined #RubyOnRails
[07:04:54] cheeti: has joined #RubyOnRails
[07:05:10] dminuoso: In a corporate environment, is there a reason to have sessions expire ever?
[07:05:40] antgel: has joined #RubyOnRails
[07:06:07] dminuoso: I mean it can be argued that computers have to be locked when absent, to the case of someone hijacking a desktop and gaining full access to tools does not really apply.
[07:06:25] dminuoso: And if its not locked, chances are you have been at the computer recently enough to have sessions anyway
[07:06:41] cheeti: Hi how to set httponly and secure flag for all cookies using rails 4?
[07:06:42] sevenseacat: 'chances are' may not be an acceptable risk
[07:07:11] Terens: I create a model and persist it to database from a rake task. Although persisted? is true when quering from main app it isnt there
[07:08:33] sevenseacat: terens: what query are you running from your app?
[07:09:06] dminuoso: sevenseacat: Well google at least seems to think that long lived sessions improve user experience, haven't been logged out of my mail accounts in ages.
[07:09:28] Andr3as: morning everyone
[07:09:31] sevenseacat: thats not corporate though :)
[07:09:41] Terens: Model.all for example
[07:09:41] sevenseacat: my work google account logs out every 30 days
[07:10:39] sevenseacat: terens: let's not talk with examples, and let's talk about the actual problem
[07:10:49] sevenseacat: what query are you running from the app?
[07:11:03] dionysus69: has joined #RubyOnRails
[07:11:47] Andr3as: i have a large table (more than 100 rows and 26 or so columns) where i need some filtering and sorting.. right now i am using jquery datatables
[07:11:53] dminuoso: sevenseacat: Mmm. I'm trying to figure out how to tackle authorization and authentication, it's pretty annoying the more I think about it.
[07:12:12] Andr3as: it works OK... but not snappy.. but in IE it just sucks.. takes forever to load
[07:12:14] dminuoso: If I removed session management it would become easy.
[07:12:21] sevenseacat: dminuoso: they're a pain in the ass, indeed.
[07:13:17] Andr3as: so i thought maybe a json source might speed it up.. however, there are a couple buttons in each cell and dependent of the data saved, they show or hide or dont show up... - here's a gist of my tbody https://gist.github.com/awunder/5e3ee9aa1bfc0b329e342afad4b3d18b
[07:13:21] cheeti: Hi how to set httponly and secure flag for all cookies using rails 4?
[07:13:21] dminuoso: sevenseacat: At the very least doing stuff like refreshing can be handled transparently by redux-saga. I think relying on OAuth2 with the resource owner password credentials grant is definitely a save step (and it opens up the possibility of reusing the API)
[07:13:59] Jameser: has joined #RubyOnRails
[07:14:14] Andr3as: anyone a tip how to speed things up or where to start to put it into a json string? especially some infos about the pundit and button part would be very helpfull
[07:14:37] dminuoso: ACTION pokes Radar 
[07:14:52] amitchellbullard: has joined #RubyOnRails
[07:17:02] mark_66: has joined #RubyOnRails
[07:17:34] aganov: has joined #RubyOnRails
[07:18:37] r3vDev: has joined #RubyOnRails
[07:20:35] Loy_Chan: has joined #RubyOnRails
[07:21:59] agit0: has joined #RubyOnRails
[07:26:04] tetraktys: has joined #RubyOnRails
[07:28:12] artto: has joined #RubyOnRails
[07:28:50] cheeti: Hi how to set httponly and secure flag for all cookies using rails 4?
[07:32:51] Andr3as: cheeti: http://bfy.tw/B1hd - first result...
[07:36:40] arBmind: has joined #RubyOnRails
[07:40:38] Toledo: has joined #RubyOnRails
[07:40:51] aperkins81: has joined #RubyOnRails
[07:41:30] arBmind1: has joined #RubyOnRails
[07:45:50] Qchmqs: has joined #RubyOnRails
[07:53:48] raz: has joined #RubyOnRails
[07:54:05] raz: what is the best column type to store ip addresses (ipv4 and ipv6) with postgres? it seems :ip_address is not supported (anymore?). google gives me conflicting info...
[07:57:13] kassav_: has joined #RubyOnRails
[07:58:01] matthewd: raz: I don't know what :ip_address is/was
[07:58:02] itsgokul: has joined #RubyOnRails
[07:58:52] Andr3as: raz, you might wanna check https://www.postgresql.org/docs/current/static/datatype-net-types.html
[07:59:11] matthewd: raz: The obvious choice would seem to be the built-in inet type -- but it's only really useful/relevant if you intend to manipulate the address in some way. If you're just logging a raw value, a string would be just fine.
[07:59:22] raz: Andr3as: thx
[07:59:24] matthewd: http://guides.rubyonrails.org/active_record_postgresql.html#network-address-types
[07:59:39] raz: matthewd: yep, apparently :ip_address used to(?) map to inet
[08:00:07] raz: http://stackoverflow.com/a/17918118
[08:00:37] raz: but if i try to use it in a migration right now, it just generates invalid SQL (tries to put ip_address verbatim as the column type)
[08:00:55] raz: and yep, this is for manipulation. i'd like a type that magically maps to IPAddr (or such) in rails
[08:01:06] raz: but maybe i'm wanting too much here
[08:02:14] raz: anyway, i'll try where 'inet' gets me :)
[08:03:24] matthewd: Oh cool, two SO answers that each contain different incorrect info
[08:04:18] matthewd: AFAIK neither of :ip_address or :inet_address have ever been a thing
[08:05:49] harfangk: has joined #RubyOnRails
[08:06:17] blackmesa: has joined #RubyOnRails
[08:12:47] dminuoso: Exciting stuff! I get to rm -rf this rails app, and rebuild it from scratch. :)
[08:17:29] sevenseacat: you're rebuilding it in elixir, right? *runs
[08:18:21] dminuoso: sevenseacat: I wish actually.
[08:18:56] dminuoso: sevenseacat: Seeing as I work for a telecommunications company it would actually be relatively easy to sell Erlang to my boss. ;)
[08:19:23] dminuoso: Jokes aside, why does rails hate me? https://gist.github.com/dminuoso/cf8bcea11fb7508e6cbb610967024c07
[08:20:38] matthewd: head -1 `which rails`
[08:21:48] dminuoso: matthewd: Puts out the correct 2.4.1 ruby bin
[08:22:43] dminuoso: matthewd: I mean it seems like there's some issue about the shell Im in. If I open a fresh shell all is good, but this seems like a bug. All I did was ruby-install ruby-2.4.1, modify my .bash_profile to chruby to 2.4.1 by default, source it, gem install rails and use the rails binstub.
[08:22:58] dminuoso: (All of that in the same shell)
[08:23:42] matthewd: Yeah, sounds like a chruby thing
[08:24:05] matthewd: That's presumably your system ruby it's ending up with somehow
[08:24:13] matthewd: path not exported?
[08:24:30] Guest96: has joined #RubyOnRails
[08:24:46] fugee: anyone can tell why this transaction rolls back please? https://gist.github.com/mices/d922664e45b27cf0a0ae846ef2e9fe32
[08:24:52] dminuoso: matthewd: Its exported properly. There's some minor differences in the PATH, but those are only related to yarn
[08:25:45] donnib: has joined #RubyOnRails
[08:26:17] zpe: has joined #RubyOnRails
[08:26:17] dminuoso: fugee: Im guessing you are trying to .save or .create something?
[08:26:18] sevenseacat: fugee: check the errors on the object that got rolled back.
[08:26:31] dminuoso: fugee: ^- or use the bang methods instead.
[08:26:36] matthewd: If you're not checking for the result, you should be using save! / update!
[08:26:53] donnib: so i have found this nice project https://bitbucket.org/nmuldoon/moodapp2/src and i am interested to add some additional functionality
[08:27:24] dminuoso: matthewd: Im not entirely sure this is chruby related. All chruby does is modify PATH, but the PATH is set correctly.
[08:27:36] dminuoso: Other than environment variables, what other state does a shell hold?
[08:27:47] donnib: i would like to be able to schedule (on time, specific time or a cron description) when to show what survey or if an location is active, and i am unsure what the best approach is
[08:27:54] fugee: dminuoso, sevenseacat @address.update(current: true)
[08:28:09] sevenseacat: so check @address.errors after that call
[08:28:14] donnib: could somebody maybe give an idea how i could attack this
[08:28:25] Velizar: has joined #RubyOnRails
[08:28:35] phikes: dminuoso: There is something called the hash table IIRC
[08:28:41] dminuoso: donnib: Use cron with a rails runner.
[08:28:43] fugee: sevenseacat: in console?
[08:28:53] sevenseacat: in wherever you're calling @address.update
[08:29:05] matthewd: dminuoso: If it works in another shell, I don't see how it can be anything else
[08:29:08] fugee: how do i "check" it
[08:29:25] phikes: dminuoso: http://www.informit.com/articles/article.aspx?p=169504&seqNum=8
[08:29:26] sevenseacat: thats one way.
[08:29:31] dminuoso: fugee: You just check it however you like.
[08:29:34] matthewd: Well.. shell in general -- I'm just accusing chruby in particular because it's the thing most likely to be involved in that difference, whatever it is
[08:29:42] sevenseacat: see what value it holds.
[08:29:50] deur-: has joined #RubyOnRails
[08:30:00] donnib: dminuoso: thx, i mentioned cron but i am not sure i need cron but that's my best guess since the user should be able to define when and at what time he wants to change survey on a location
[08:30:06] dminuoso: matthewd: Yeah but the thing is, its about the most non-intrusive solution. If which ruby reports the correct gem, then it cant be the PATH.
[08:30:41] matthewd: The shell should re-hash automatically when you modify the path.. I think?
[08:30:48] dminuoso: donnib: You could also look at "whenever" -> but that's just a ruby wrapper around cron.
[08:31:08] matthewd: dminuoso: bash or zsh?
[08:31:11] patarr: has joined #RubyOnRails
[08:31:22] dminuoso: matthewd: bash. And rehashing manually fixed it.
[08:31:45] dminuoso: Great, this feels much better than avoiding the issue. Thanks. :)
[08:32:02] matthewd: Is which not a built-in in bash? :/
[08:32:54] jsrn_: has joined #RubyOnRails
[08:33:15] phikes: dminuoso: So maybe ruby is called before chruby, which leads to the shell hashing it?
[08:33:52] dminuoso: phikes: I did do so indeed.
[08:33:56] dminuoso: Now that I think about it.
[08:34:01] artto: has joined #RubyOnRails
[08:34:06] dminuoso: Makes me wonder about matthewd's comment that changing the PATH should rehash.
[08:34:54] donnib: dminuoso: ok that looks good but how would it work in practice ? I mean let's pressume the user has UI to set a a schedule that at 1PM the location with ID 1 should change to survey ID 1, does the cron job call ruby or how would this work ?
[08:34:56] phikes: Oh, I did not see the message :O..
[08:35:10] matthewd: My guess is that ruby was right (because of the chruby path change), but the subsequent gem install rails didn't cause a rehash, so ended up with the system one
[08:36:51] matthewd: I guess we should've been using `type` instead of `which`; I'm used to zsh, where `which` is a built-in
[08:40:56] fluxsource: has joined #RubyOnRails
[08:42:04] dminuoso: matthewd: Mmmm, so should gem actually rehash?
[08:42:16] fugee: sevenseacat how do i print the @address.errors before the redirect or include them in the redirect
[08:42:39] fugee: notice: ' ' requires quotes
[08:42:49] dminuoso: matthewd: Though the weird thing is that even the rails binstub had the 2.4.1 ruby glued in the shebang
[08:43:06] dminuoso: I really dont understand how the system ruby was ever used.
[08:43:12] sevenseacat: fugee: `puts @address.errors` will work
[08:43:48] sevenseacat: Radar really needs to finish Debugging Ruby, such a sorely needed book
[08:45:08] dminuoso: sevenseacat: I think part of the problem is not the lack of books, but the habit of Ruby developers to spoonfeed and have other developers guessstimate and bisect to find errors.
[08:45:59] keerthana: has joined #RubyOnRails
[08:45:59] dminuoso: "Try this, try that. XYZ fixes ArgumentError for me"
[08:46:05] dminuoso: It's horrible.
[08:46:16] sevenseacat: I can agree with that. its not limited to Ruby though
[08:46:16] matthewd: dminuoso: *That* rails binstub had 2.4.1 in there... I'm theorising it was using a different rails binstub
[08:46:42] dminuoso: matthewd: Mmm. Well there is no rails binstub with the system gem.
[08:46:50] phikes_: has joined #RubyOnRails
[08:47:02] sevenseacat: critical thinking helps too. if I wrote code that says if X then Y, if Y happens, then X must have been true
[08:47:10] matthewd: I'm out of theories then :)
[08:47:11] sevenseacat: I don't know how to teach that though
[08:47:17] dminuoso: matthewd: I'll reproduce this issue later on and debug it.
[08:47:30] matthewd: But yes, you theoretically need to rehash after gem install
[08:47:33] dminuoso: matthewd: So as to not do the same mistake that sevenseacat and me are critisizing. ;-)
[08:48:06] dminuoso: Wait a second..
[08:48:23] dminuoso: 10:46 < matthewd> dminuoso: *That* rails binstub had 2.4.1 in there... I'm theorising it was using a different rails binstub
[08:48:25] naftilos76: has joined #RubyOnRails
[08:48:34] matthewd: My version management system takes care of that for me, because it's not the minimum thing that could possibly work :trollface:
[08:48:41] dminuoso: I just looked and confirmed. I'd have to reproduce to be sure, but Im fairly sure you nailed it there.
[08:48:48] fugee: sevenseacat undefined method `error' for #<Address::ActiveRecord_Relation:0xde76ba4>
[08:49:09] fugee: same for errors
[08:49:19] sevenseacat: @address is actually a relation of objects?
[08:49:21] fugee: undefined method errors
[08:49:23] sevenseacat: not just a single object?
[08:49:31] sevenseacat: you can't call `update` on a relation
[08:49:45] fugee: form_for[@user, @address]
[08:49:57] dminuoso: sevenseacat: Actually you can :S
[08:50:19] naftilos76: Is it a good practice to keep a small amount of data per session in a global var like $global[session.id] = {} where i could keep for example user's preferences of some kind?
[08:50:34] matthewd: naftilos76: No.
[08:50:37] dminuoso: naftilos76: I wouldn't call it good practice.
[08:50:41] gloscombe: has joined #RubyOnRails
[08:51:02] sevenseacat: dminuoso: no you can't
[08:51:04] naftilos76: Do you have any suggestions towards that?
[08:51:08] sevenseacat: call update on a relation, that is
[08:51:28] matthewd: naftilos76: It's also not particularly good practice to self-invent a solution to a problem, then ask people whether X is good practice, instead of actually describing the problem you want to solve.
[08:51:33] artto: has joined #RubyOnRails
[08:51:39] phikes_: naftilos76: Use your models for that. There are even gems targeted at settings
[08:51:40] matthewd: naftilos76: !xy (approximately)
[08:51:40] helpa: naftilos76: It seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[08:52:16] matthewd: sevenseacat: http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-update
[08:52:18] Jasaka|NA: has joined #RubyOnRails
[08:52:23] phikes_: naftilos76: e.g. https://github.com/ledermann/rails-settings
[08:52:41] dminuoso: sevenseacat: Yes you can.
[08:52:41] fugee: what is a relation
[08:52:42] sevenseacat: odd. that's not working in my experimentation in the console
[08:52:51] dminuoso: sevenseacat: http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-update http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-update_all
[08:53:37] fugee: i'm using nested resources
[08:53:38] sevenseacat: yeah I knew about update_all
[08:53:39] matthewd: sevenseacat: The single-hash-argument form is new... 5.0 maybe?
[08:53:45] sevenseacat: ahhhhhh right
[08:53:52] sevenseacat: I'm back on my 4.2 branch, that explains it
[08:54:45] sevenseacat: fugee: what is @address? how are you defining it in the controller action you're updating it in?
[08:55:24] fugee: @address=Address.where(" user_id = ? and id = ? ", params[:user_id], params[:id])
[08:55:40] sevenseacat: right, so it's a relation, a list of zero or more objects
[08:56:25] fugee: or in orm rows lol
[08:56:25] dionysus69: has joined #RubyOnRails
[08:56:38] fugee: so then each can have methods
[08:56:44] fugee: including update
[08:56:55] sevenseacat: we're in Ruby, so each element is an object
[08:57:04] sevenseacat: representing a row of the database
[08:57:08] matthewd: fugee: No, not rows.. objects. "lol".
[08:57:30] fugee: i mean it's just words
[08:57:33] gusrub: has joined #RubyOnRails
[08:57:34] fugee: orm mapping
[08:57:48] sevenseacat: the wrong ones can cause much confusion and miscommunication
[08:58:08] fugee: cause object can be many rows
[08:58:11] cgfbee: has joined #RubyOnRails
[08:58:21] sevenseacat: there is no concept of a row in Ruby.
[08:59:49] naftilos76: dminuoso, helpa: OK, here is a case. A user logs in into a website builder (built on rails :) and loads a website (one out of many) to edit further. During his session many of the actions, he calls, need to know the name of the website or even the website obj itself. The name of the website is not always in the queries. It is only met during loading a website for the first time. So i was thinking storing the website obj in a $global[session.id]
[08:59:50] naftilos76: and have handy until the user logs out or loads another website where the $global[session.id] overwritten. How does that sound?
[09:00:38] matthewd: naftilos76: If it's session-specific transient data, why not just store it in the session directly?
[09:00:40] phikes_: naftilos76: why not store it in the session directly?
[09:01:27] naftilos76: because sometimes i need more than just the website name. So i have to save the whole obj
[09:01:51] naftilos76: and we all know that session size has limitations
[09:02:28] sevenseacat: I'd store the ID of the website in the session, and then fetch the data on each page load
[09:02:42] sevenseacat: or even put the ID in the URL, like any other resource
[09:03:04] artto: has joined #RubyOnRails
[09:03:40] naftilos76: sevenseacat, why does everybody hate global vars?
[09:04:21] matthewd: naftilos76: If you just came to convince us of your solution, wouldn't it be easier to just go ahead with it?
[09:05:42] tedwing: has joined #RubyOnRails
[09:06:22] naftilos76: matthewd, i am just trying to do it the right way. I am not a know-everything guy. I am not even close.
[09:09:29] matthewd: naftilos76: Okay... it's just.. "why are global variables bad" seems like a question Google could answer far more informatively than anything we throw together in conversation
[09:10:11] raz: ugh... rubycop should never recommend String#casecmp over foo.downcase == 'x'
[09:10:58] dminuoso: raz: rubocop should never come with defaults at all.
[09:11:11] naftilos76: matthewd, thanks for your time.
[09:11:27] dminuoso: raz: Or rather it should force users to at least configure whatever it should look for.
[09:11:28] raz: casecmp is extremely dangerous because people expect it to return a boolean, when in reality it returns and int *and nil*
[09:11:44] raz: dminuoso: most of the defaults seem reasonable to me, but not this one
[09:12:20] matthewd: Does it claim it's a drop-in replacement?
[09:12:33] raz: the language implies it, yes
[09:12:56] matthewd: I mean.. if you actually care about getting literal-true and literal-false, you're probably doing something wrong elsewhere anyway..
[09:13:14] raz: if foo.casecmp('bar') ...
[09:13:26] raz: ^ that's the bug i'm seeing for the nth time
[09:13:41] matthewd: What's the bug? :/
[09:14:14] raz: it's true whether it matches or not...
[09:14:22] raz: because casecmp returns an int, remember? ;)
[09:14:53] matthewd: Ohh, right, I failed to actually think through what the int meant, sorry :P
[09:15:09] raz: yea well.. not just you... that's why i'm lamenting here ;)
[09:15:40] raz: principle of least surprise much violated there
[09:16:19] matthewd: Does that just mean the message should be including the ` == 0` in its recommendation?
[09:16:41] raz: yes, definitely. or a warning.
[09:16:46] dminuoso: Oh man Im doing too much JavaScript development.
[09:16:49] matthewd: The part it's replacing is a full equality expression, so having the same in the replacement seems fine
[09:16:57] dminuoso: matthewd: I was about to correct you "You mean ==="
[09:17:22] matthewd: Yeah, I'd suggest just PRing an improvement to the message
[09:17:55] raz: yup, might do that sometime
[09:19:44] matthewd: I'm personally not a fan of that recommendation just because my brain recognises what's happening in downcase== much faster, allocations be damned
[09:21:52] raz: exactly
[09:22:03] matthewd: Oh, casecmp? was added in 2.4, so I guess that's the new best choice
[09:22:13] raz: especially with casecmp being a trap
[09:23:53] tvw: has joined #RubyOnRails
[09:24:41] Terens1: has joined #RubyOnRails
[09:25:08] matthewd: Oh, which is implemented as downcase == downcase. Hmmpf.
[09:33:18] cschneid: has joined #RubyOnRails
[09:33:57] arBmind: has joined #RubyOnRails
[09:35:33] tetraktys: has joined #RubyOnRails
[09:35:53] workmad3: has joined #RubyOnRails
[09:40:24] keerthana: has joined #RubyOnRails
[09:43:52] artto: has joined #RubyOnRails
[09:45:25] kassav_: has joined #RubyOnRails
[09:46:58] Brando753-o_O_o: has joined #RubyOnRails
[09:50:03] teddysmoker: has joined #RubyOnRails
[09:50:25] phikes: has joined #RubyOnRails
[09:51:38] teddysmoker: Quick question about capistrano: How exactly should I make it persist ENV variables on the production server? I've tried everything: .bashrc, dotenv, capistrano-secrets-yml. But it keeps failing on deploy because it can't find the necessary ENV keys
[09:52:44] vasilakisFiL: has joined #RubyOnRails
[09:52:59] GodFather: has joined #RubyOnRails
[09:53:05] vasilakisFiL: does anyone know how I can modify a view's `virtual_path` ?
[09:54:23] thomasfedb: vasilakisfil: idk with cap, isn't the ideal to set them on the server without them being on your dev box?
[09:54:54] thomasfedb: vasilakisfil: I highly recommend Flynn if you're looking for a solution that just works
[09:55:37] teddysmoker: thomasfedb: was that first answer for me? :D
[09:56:34] vasilakisFiL: thomasfedb are you talking about this? http://www.rubydoc.info/docs/rails/4.1.7/ActionView%2FTemplate%3Avirtual_path
[09:57:10] kassav_: has joined #RubyOnRails
[09:57:34] thomasfedb: TeddySmoker: both were
[09:58:05] thomasfedb: vasilakisfil: I'm actually trying to talk to TeddySmoker. Sorry!
[09:58:35] teddysmoker: thomasfedb: Ah, alright. Well, the keys are on the server (using dotenv, it's quite easy but I will try Flynn aswell) and if I try to launch rails it works perfectly but it fails with capistrano.
[09:59:58] TeddySmoker_: has joined #RubyOnRails
[10:00:33] srinidhi: has joined #RubyOnRails
[10:01:01] thomasfedb: How do you launch with dotenv without cap?
[10:01:20] thomasfedb: Sometimes you need to force 'bash -l'
[10:01:38] TeddySmoker_: Yeah, it launches perfectly without cap.
[10:04:28] mrbubbles: has joined #RubyOnRails
[10:06:51] thomasfedb: TeddySmoker_: login shell might help
[10:07:13] hive-mind: has joined #RubyOnRails
[10:08:30] TeddySmoker_: thomasfedb: I will try to deploy with login option and then come back with the results.
[10:18:13] ResidentBiscuit: has joined #RubyOnRails
[10:18:36] TeddySmoker_: thomasfedb: do you think that ansible would be a better option than cap?
[10:18:57] Papierkorb: has joined #RubyOnRails
[10:20:08] artto: has joined #RubyOnRails
[10:23:18] artto: has joined #RubyOnRails
[10:27:57] artto: has joined #RubyOnRails
[10:32:06] patarr: has joined #RubyOnRails
[10:41:16] arup_r: has joined #RubyOnRails
[10:45:39] arup_r: has joined #RubyOnRails
[10:46:57] mikeiniowa: has joined #RubyOnRails
[10:54:22] Guest96: has joined #RubyOnRails
[10:57:33] patarr: has joined #RubyOnRails
[10:57:49] tia: has joined #RubyOnRails
[10:59:09] artto: has joined #RubyOnRails
[10:59:16] Shoutsid: has joined #RubyOnRails
[11:01:55] Benshiro: has joined #RubyOnRails
[11:07:59] blackmesa: has joined #RubyOnRails
[11:10:46] Fernando-Basso: has joined #RubyOnRails
[11:12:14] artto: has joined #RubyOnRails
[11:12:55] xall: has joined #RubyOnRails
[11:21:32] TeddySmoker_: Update: running 'cap production config:show' returns all of the ENV variables that are required but cap deploy keeps failing
[11:25:13] blackmesa: has joined #RubyOnRails
[11:40:17] armyriad: has joined #RubyOnRails
[11:42:00] `: has joined #RubyOnRails
[11:45:02] GodFather: has joined #RubyOnRails
[11:45:30] ldnunes: has joined #RubyOnRails
[11:45:56] Takumo: Hi all, I'm having some trouble with unicode on mysql2, I've changed the database and table to the utf8 character set, and specified utf8 in the encoding in database.yml
[11:46:12] Takumo: But I'm still getting the following error:
[11:46:14] Takumo: Mysql2::Error: Incorrect string value: '\xE5t og ...' for column 'name' at row 1: INSERT INTO `dealers` (`name`, `account_number`, `created_at`, `updated_at`) VALUES ('Bergen B og Fritid AS avd Sreide', '12947', '2017-04-04 11:47:36', '2017-04-04 11:47:36'))
[11:47:24] jlebrech: has joined #RubyOnRails
[11:48:14] vasilakisFiL: has joined #RubyOnRails
[11:49:08] jlebrech: hi, my rails app makes api calls decodes the json response and merges some data and then renders the output as json. it's really slow, it there a way for my to make those api calls without processing the json and still rendering that data as json and doing merging code from the frontend?
[11:55:07] King_Rex: has joined #RubyOnRails
[11:57:01] xall: has joined #RubyOnRails
[11:57:49] Sidoniuns: has joined #RubyOnRails
[11:59:08] r3vDev: has joined #RubyOnRails
[12:01:52] Takumo: jlebrech: how big is this JSON response?
[12:02:34] jlebrech: Takumo: about 9kb
[12:02:45] Takumo: then it really shouldn't be slow unless the remote API is slow
[12:03:07] jlebrech: is my problem because i'm not calling the api async?
[12:04:18] marr: has joined #RubyOnRails
[12:06:58] xall: has joined #RubyOnRails
[12:07:04] handicraftsman: has joined #RubyOnRails
[12:09:18] Guest96: has joined #RubyOnRails
[12:14:56] donnib: if i need to schedule an action at some specific time what would i use ? cron or can i use something easier ?
[12:16:32] donnib: i am unsure if cron would be a good solution because i am in doubt how it will work in practice like how will cron know who to call in ruby to initiate an action ?
[12:17:47] ErhardtMundt: has joined #RubyOnRails
[12:19:33] Takumo: donnib: if you're using ActiveJob (which should should be!) and a proper backend like Sidekiq or Resque
[12:19:45] Takumo: there are gems which provide cron-like capabilities to Sidekiq/Resque
[12:20:52] jlebrech: If I make an apicall using excon, can I send the string as json to the client without decoding the json string at all?
[12:21:41] keerthana: has joined #RubyOnRails
[12:24:42] HoierM: has joined #RubyOnRails
[12:25:22] loechel: has joined #RubyOnRails
[12:27:07] Pumukel: has joined #RubyOnRails
[12:28:53] dminuoso: How do you folks handle seeding data for development purposes for larger apps with highly normalized tables? I originally started maintaining db/seeds.rb but it's just way too annoying.
[12:29:50] donnib: Takumo: there was many new words there, let me look that up :)
[12:29:58] NoGodDamnIdea: has joined #RubyOnRails
[12:31:16] Takumo: dminuoso: all I can really suggest is having a look the repo for Discourse
[12:31:24] Takumo: given that they have a ton of seed data and tons of tables etc
[12:34:32] dminuoso: Takumo: Interesting.
[12:34:52] dminuoso: Takumo: It gave me an idea.
[12:35:01] dminuoso: I think it gave me the crucial clue I was looking for.
[12:36:23] dminuoso: Im wondering about switching my rails app to a feature based style where I group by feature/post and end up with feature/post/model.rb feature/post/controller.rb feature/post/seed.rb, etc..
[12:36:57] dminuoso: Boy I really do too much react dev :|
[12:37:25] tbuehlmann: fight the system!
[12:38:06] dminuoso: tbuehlmann: I hear they have lots of places serving bear around the Maschsee. :-)
[12:39:14] mr_foto: has joined #RubyOnRails
[12:47:37] jusa: has joined #RubyOnRails
[12:48:27] xall: has joined #RubyOnRails
[12:48:29] donnib: Takumo: these ActiveJobs can the app create those on the fly ? What i need is that the user can create a schedule dynamically.
[12:48:55] Pumukel: has joined #RubyOnRails
[12:48:56] tbuehlmann: I'd love them to serve bears
[12:49:00] `: has joined #RubyOnRails
[12:49:18] aajjbb: has joined #RubyOnRails
[12:51:02] tbuehlmann: dminuoso: and yes, I also heard there have quite some places :)
[12:51:30] artto: has joined #RubyOnRails
[12:52:06] IRCFrEAK: has joined #RubyOnRails
[12:52:11] IRCFrEAK: has left #RubyOnRails: ()
[12:57:36] Takumo: donnib: Shouldn't be a reason with some of them that you can't call the code to set them up automatically
[12:57:48] Takumo: but you might want to do something in the DB to persist the schedules during restarts etc
[12:58:03] dminuoso: matthewd: Is there a reason I have to restart spring if I change the packages underneath?
[12:58:03] Technodrome: has joined #RubyOnRails
[12:58:24] dminuoso: I mean cant it just be smart and watch my Gemfile.lock with inotify?
[12:58:38] donnib: Takumo: so the user will thru an userinterface make a schedule, this will be saved in the db then also create a ActiveJob ?
[12:59:04] matthewd: If inotify weren't a tire fire, yeah, it probably could
[12:59:51] dminuoso: Is it that horrible?
[12:59:52] matthewd: But as its default/primary behaviour is filesystem scanning, that'd be a lot more to check for very unlikely changes
[13:00:08] keerthana: has joined #RubyOnRails
[13:00:13] matthewd: The mechanism isn't; the ruby libraries are.
[13:02:20] dminuoso: matthewd: That's a little surprising to hear.
[13:03:18] Takumo: dminuoso: well the ActiveJob class describes the process which will be run, so the code that will be run when the job is triggered
[13:03:40] Takumo: then you can use an extension like clockwork to tell the ActiveJob backend (e.g. Sidekiq) what the schedule to run it on is
[13:03:48] Takumo: but this stuff is all stored in-memory so is lost on app restart
[13:03:51] erlend: has joined #RubyOnRails
[13:04:06] Takumo: so you'd need to store info on this stuff in the DB so when the app restarts etc you can restore the schedules
[13:07:12] Jasaka: has joined #RubyOnRails
[13:07:25] donnib: dminuoso: it was for me
[13:09:56] tomas_w: has joined #RubyOnRails
[13:13:55] jlebrech: is there a viewer for a profiler? miniprofiler?
[13:14:42] dminuoso: jlebrech: flamegraph
[13:15:08] Takumo: (which you can use alongside rack_mini_profiler)
[13:15:11] Takumo: and is excellent
[13:16:08] KnownSyntax: has joined #RubyOnRails
[13:16:38] jlebrech: can I mount it as an engine?
[13:17:58] ResidentBiscuit: has joined #RubyOnRails
[13:17:59] Takumo: check rack_mini_profiler's docs but basically you want to initialize it in your development.rb env file
[13:18:14] Takumo: as its a middleware rather than an engine
[13:18:53] jlebrech: i'm not sure how to view those flamegraphs as my rails app is just and api
[13:20:34] Takumo: if you pass the parameter "pp" (preferably in the url) with the value of "flamegraph"
[13:20:40] Takumo: you'll get an SVG flamegraph back
[13:21:02] Takumo: e.g. localhost:3000/myresources/?pp=flamegraph
[13:21:23] dminuoso: jlebrech: Just write your own trivial middleware
[13:22:09] dminuoso: jlebrech: You would justhave a def call(env); RubyProf.start; r = @app.call(env); out = RubyProf.stop; handle(out); return r; end
[13:22:12] dminuoso: in that middleware
[13:22:24] dminuoso: Do it to get a feeling for how simple and yet powerful middlewares are.
[13:25:49] jlebrech: i've never written one
[13:27:20] blackmesa: has joined #RubyOnRails
[13:28:15] dminuoso: jlebrech: Do you know what a compose function does in functional programming?
[13:28:38] dblessing: has joined #RubyOnRails
[13:30:01] dminuoso: jlebrech: compose(fn1, fn2, fn3...)(arg) basically just yields the return of fn3(fn2(fn1(arg)) and rack middlewares are just such constructs like those functions. each middleware gets some input, and the output is passed to the next
[13:30:13] tedwing: has joined #RubyOnRails
[13:30:24] jlebrech: oh yeah i knew that
[13:30:30] jlebrech: but just haven't written one
[13:32:10] DLSteve: has joined #RubyOnRails
[13:32:51] ramortegui: has joined #RubyOnRails
[13:34:06] Pumukel: has joined #RubyOnRails
[13:35:02] byteflame: has joined #RubyOnRails
[13:35:02] byteflam1: has joined #RubyOnRails
[13:35:25] blackmesa: has joined #RubyOnRails
[13:39:55] buckrockwell: has joined #RubyOnRails
[13:44:09] libastral: has joined #RubyOnRails
[13:47:54] creature: has joined #RubyOnRails
[13:53:28] Pumukel: has joined #RubyOnRails
[13:53:33] chouhoulis: has joined #RubyOnRails
[13:55:16] xall: has joined #RubyOnRails
[13:55:28] r3vDev: has joined #RubyOnRails
[14:00:28] ahrs: has joined #RubyOnRails
[14:01:17] shinnya: has joined #RubyOnRails
[14:04:34] xall: has joined #RubyOnRails
[14:06:38] Qchmqs: has joined #RubyOnRails
[14:10:58] chouhoulis: has joined #RubyOnRails
[14:17:22] Rodya_: has joined #RubyOnRails
[14:23:59] cpruitt: has joined #RubyOnRails
[14:25:30] ResidentBiscuit: has joined #RubyOnRails
[14:25:33] chouhoulis: has joined #RubyOnRails
[14:25:41] coder2000: has joined #RubyOnRails
[14:25:53] chouhoul_: has joined #RubyOnRails
[14:36:18] cpruitt: Anyone happen to know how to sanitize user input into a call to activerecord order? e.g. I want Model.order(“owner = ?”, “AABBCC”) but that isnt’ possible AFAIK.
[14:36:40] Qchmqs: has joined #RubyOnRails
[14:39:15] romeoh: has joined #RubyOnRails
[14:41:37] phikes: has joined #RubyOnRails
[14:42:42] trisket: has joined #RubyOnRails
[14:46:41] artto: has joined #RubyOnRails
[14:48:06] armando1: has joined #RubyOnRails
[14:48:24] v|sh: has joined #RubyOnRails
[14:48:34] jusa: has joined #RubyOnRails
[14:57:02] georgie: has joined #RubyOnRails
[14:57:26] patarr: has joined #RubyOnRails
[15:00:00] gusrub: has joined #RubyOnRails
[15:00:38] Saukk: has joined #RubyOnRails
[15:02:01] fugee: has joined #RubyOnRails
[15:06:06] jarray52: has joined #RubyOnRails
[15:07:10] agent_white: has joined #RubyOnRails
[15:08:08] agent_white: Mornin' folks
[15:10:38] Pumukel: has joined #RubyOnRails
[15:18:07] mazeinmaze_: has joined #RubyOnRails
[15:23:59] kallisti5: has joined #RubyOnRails
[15:24:22] kallisti5: was there a change in 5.0.2 so active record queries with 0 results are no longer arrays?
[15:24:35] kallisti5: (well.. empty activerecord result sets)
[15:24:38] ResidentBiscuit: has joined #RubyOnRails
[15:25:09] kallisti5: code that used to return [] compatible results seems to be returning something different after upgrading
[15:25:25] tbuehlmann: naw, that's not that new
[15:25:34] tbuehlmann: what are you trying to call on the relation?
[15:25:51] kallisti5: I'm using the activerecord result sets in map's and other things
[15:26:00] matthewd: What are you upgrading from?
[15:26:10] kallisti5: lol.. oh yeah. my older version running has the same bug :-)
[15:26:21] kallisti5: must of been the 5.0 upgrade when it started and nobody noticed
[15:26:52] kallisti5: so i'm expecting [] as a result set if there are 0 matches in a lot of places.
[15:26:55] kallisti5: what did it change to?
[15:27:07] tbuehlmann: it's a relation, not an array
[15:27:15] helpa: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[15:27:24] tbuehlmann: but the relation behaves like an array in most situations, so what is it you're doing?
[15:27:26] gremly: has left #RubyOnRails: ("WeeChat 1.4")
[15:29:34] kallisti5: https://gist.github.com/avongluck-r1soft/4ee7cdf421fdfe8f395e20b9ec391c36
[15:30:23] kallisti5: so pretty much regions gets PG::InvalidTextRepresentation: ERROR: invalid input syntax for uuid: ""
[15:30:41] tbuehlmann: that's not related to the #map call I assume
[15:30:42] kallisti5: actually... the error is from my order by hack.
[15:30:50] kallisti5: ACTION just read it again :-|
[15:30:56] tbuehlmann: (well, it's related, but not map's fault)
[15:31:34] kallisti5: yeah, I think I know whats wrong
[15:31:55] kallisti5: i'm ordering with an empty order
[15:32:32] kallisti5: anyone see a better way to "make sure the query returns in the order of the json?
[15:32:50] blackmesa: has joined #RubyOnRails
[15:32:53] kallisti5: that was the best I could come up with and it felt a little messy
[15:33:09] matthewd: Sbm.find(sbmids) ?
[15:33:23] kallisti5: matthewd: the order isn't guarenteed when its called like that
[15:35:17] epochwolf: kallisti5: why not just sort in memory?
[15:35:27] epochwolf: It's not like sorting an array is all that expensive.
[15:35:54] kallisti5: epochwolf: the positioning is key, not the sorting of the uuids :-)
[15:35:58] gregf_: has joined #RubyOnRails
[15:35:58] kallisti5: matthewd: aaah.
[15:36:05] kallisti5: matthewd: I looked up the original code I was doing
[15:36:08] kallisti5: Sbm.where(:id => sbmids)
[15:36:17] kallisti5: so find will preserve ordering of the id's?
[15:36:23] epochwolf: kallisti5: sort_by{|record| json_ids.index(record.id) }
[15:36:45] matthewd: Yes; it does ^
[15:36:52] kallisti5: epochwolf: oh.. that's a neat solution
[15:36:58] matthewd: .. only not O(n**2)
[15:37:25] kitsuneyo: has joined #RubyOnRails
[15:37:49] matthewd: https://github.com/rails/rails/blob/4277047018af90d3f6ba5ec2f7ead7b9d6d11040/activerecord/lib/active_record/relation/finder_methods.rb#L516-L517
[15:38:26] kitsuneyo: validates_associated really slows my app down. I'm just wondering if it's worth using the `on` option or just removing it altogether
[15:38:42] kallisti5: matthewd: hey! that'll work :-)
[15:38:58] matthewd: Oh, apparently the documentation claims this isn't the case
[15:39:15] matthewd: We should fix that; it was consciously introduced
[15:39:47] kallisti5: undefined method `find_some_ordered' for #<Class:0x007fa86ad6d3b8>
[15:40:05] Mia: has joined #RubyOnRails
[15:40:05] Mia: has joined #RubyOnRails
[15:40:33] artek_: has joined #RubyOnRails
[15:40:37] matthewd: kallisti5: Are you trying to call that method directly? Don't do that.
[15:40:39] defsdoor: has joined #RubyOnRails
[15:40:46] kallisti5: matthewd: ack. internal to find
[15:40:47] artek_: Hello guys
[15:41:42] dblessing: has joined #RubyOnRails
[15:44:28] artek_: I have a question. I have a database with buses of different type: everyday buses, sunday buses, thuesday+thursday buses + ...and so on... . I made a column in database for these types. But I need a view for each type. I want to check in app if what wype is this bus and render it's view. Should I make one view with if clauses. And if the bus is "Type1", rails will render it's partial. Or is it a bad idea?
[15:44:44] dionysus69: has joined #RubyOnRails
[15:44:50] artek_: I dont know how to make it another way :(
[15:48:52] Takumo: artek_: I assume they're the same "action" (i.e. show the bus)
[15:49:07] Takumo: in which case you can have a different view per bus type
[15:49:12] Takumo: and then in the controller do something like
[15:49:30] Takumo: render "busses/bus/#{@bus.bus_type}"
[15:49:51] Takumo: so then it'd render app/views/busses/bus/sunday.html.erb etc
[15:50:18] artek_: Got it. I should use cases!
[15:50:20] Takumo: although you may want to be careful if users can add new bus types
[15:51:11] artek_: Use cases and render the following view
[15:51:21] artto: has joined #RubyOnRails
[15:52:02] artek_: Not cases. This "render "busses/bus/#{@bus.bus_type}"
[15:52:24] artek_: One line, thanks a lot. How havent I thought about it
[15:54:13] juggler: has joined #RubyOnRails
[15:57:48] Takumo: artek_: just be careful, if users can add new bus type's you'll need to check the view exists and default if there isn't one
[15:58:24] artek_: No, this site is just a clone of one site)) I parsed it
[16:01:59] Terens: has joined #RubyOnRails
[16:14:13] Terens: Lets say I have an archive with some ruby scripts. I have a rails app that executes this archive and updates itself. The problem is that I can't find a way to display whether it works or if failed
[16:14:31] Pumukel: has joined #RubyOnRails
[16:15:05] cagomez: has joined #RubyOnRails
[16:16:17] blackmesa: has joined #RubyOnRails
[16:16:44] cagomez: how do I create a where clause that also checks the object type within an array? Say I don't want objects of type 'Bar' . `Foo.where.not(some_array: some_array.include?(Bar))
[16:18:01] seanmc: has joined #RubyOnRails
[16:24:59] cagomez: has joined #RubyOnRails
[16:26:49] seanmcguigan: has joined #RubyOnRails
[16:27:58] King_Rex: has joined #RubyOnRails
[16:28:03] Technodrome: has joined #RubyOnRails
[16:30:40] dcluna: has joined #RubyOnRails
[16:35:09] hahuang65: has joined #RubyOnRails
[16:36:38] rakm: has joined #RubyOnRails
[16:36:48] seanmcguigan_: has joined #RubyOnRails
[16:45:34] tildes: has joined #RubyOnRails
[16:49:41] alexhartley: has joined #RubyOnRails
[16:49:49] artek_: How to integrate Angular 2 with rails?
[16:50:06] Spami: has joined #RubyOnRails
[16:50:13] alexhartley: has joined #RubyOnRails
[16:55:22] gusrub: has joined #RubyOnRails
[16:57:04] gusrub: has joined #RubyOnRails
[16:57:41] knight33: has joined #RubyOnRails
[17:00:34] pupsicle: https://github.com/nishio-dens/angular2-rails-example
[17:02:03] kies: has joined #RubyOnRails
[17:04:00] jsrn_: has joined #RubyOnRails
[17:04:44] [Butch]: has joined #RubyOnRails
[17:06:34] blackmesa: has joined #RubyOnRails
[17:08:54] `: has joined #RubyOnRails
[17:13:48] kiltzman: has joined #RubyOnRails
[17:14:22] romeoh: has joined #RubyOnRails
[17:14:25] buckrockwell: has joined #RubyOnRails
[17:16:05] kiltzman: has joined #RubyOnRails
[17:20:37] romeoh: has joined #RubyOnRails
[17:24:30] jusa: has joined #RubyOnRails
[17:29:55] fugee: has joined #RubyOnRails
[17:31:04] mello: has joined #RubyOnRails
[17:33:08] greengriminal: has joined #RubyOnRails
[17:41:57] duderonomy: has joined #RubyOnRails
[17:43:30] tedwing: has joined #RubyOnRails
[17:47:09] Robtop__: has joined #RubyOnRails
[17:48:25] DoctorMonocular: has joined #RubyOnRails
[17:48:33] drift: has joined #RubyOnRails
[18:04:02] chouhoulis: has joined #RubyOnRails
[18:05:58] pulkit4tech: has joined #RubyOnRails
[18:08:37] fernandomm: has joined #RubyOnRails
[18:11:43] defsdoor: has joined #RubyOnRails
[18:13:01] HoierM: has joined #RubyOnRails
[18:13:22] Dysp: has joined #RubyOnRails
[18:24:04] King_Rex: has joined #RubyOnRails
[18:26:23] Spami: has joined #RubyOnRails
[18:29:20] au5lander: has joined #RubyOnRails
[18:30:15] au5lander: has joined #RubyOnRails
[18:31:46] au5lander: hello there. got a question about resetting a callback if anyone has the knowledge. i have an after commit callback on create, i have a need to skip that callback in a certain situation, and want to turn it back on, but am not sure how to reset the on: :create part. I've tried a bunch of things, but that doesn't seem to set the :if of the callback
[18:32:40] blackmesa: has joined #RubyOnRails
[18:33:34] matthewd: au5lander: !gist your current code?
[18:33:34] helpa: au5lander: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[18:41:52] meoblast001: has joined #RubyOnRails
[18:44:44] au5lander: @matthewd @helpa https://gist.github.com/ckhall/8bb8d8f8af8a90c94394821d2a710f63
[18:45:47] pLaTo0n: has joined #RubyOnRails
[18:46:38] matthewd: au5lander: Okay, yeah.. don't do that. skip_callback is not for transient disabling.
[18:47:25] TheMoonMaster: I generally avoid AR callbacks and instead write service objects that handle it
[18:47:29] matthewd: au5lander: Instead, use an `if:` condition in the callback's definition to check some other "is this callback currently enabled/disabled" flag
[18:48:20] au5lander: legacy code, not so easy
[18:48:33] au5lander: ok, thanks for the info
[18:49:15] matthewd: Also consider thread safety when setting up such a flag -- which is one of the reasons you shouldn't directly manipulate the class definition
[18:49:58] au5lander: this would be running in a sidekiq process
[18:50:32] matthewd: Yeah, then you *really* don't want to do that :)
[18:51:05] au5lander: not a fan of callbacks myself, have always argued against them in most cases. was trying to see of i could get away with something like this without having to dig too deep into the existing code.
[18:51:20] au5lander: first time looking into skipping callbacks
[18:51:23] mlt-: has joined #RubyOnRails
[18:51:49] matthewd: As I say.. it's pretty easy to set up -- just not using this particular mechanism
[18:53:27] au5lander: thanks for the assist and info
[18:54:26] arBmind: has joined #RubyOnRails
[18:55:15] au5lander: i might do something nasty and set a virt attr that i can check in the after_commit method to just return true if it's set and not actually run the callback.
[18:55:29] au5lander: or if: condition on the callback def
[18:56:04] matthewd: Yeah, I think that's all you need
[18:59:10] zero1one0: has joined #RubyOnRails
[19:00:16] snickers: has joined #RubyOnRails
[19:01:49] zero1one0: has joined #RubyOnRails
[19:02:59] [Butch]: has joined #RubyOnRails
[19:03:45] DoctorMo_: has joined #RubyOnRails
[19:06:03] apotry: has joined #RubyOnRails
[19:06:07] tildes: has joined #RubyOnRails
[19:07:12] arBmind: has left #RubyOnRails: ()
[19:12:45] sandroqz: has joined #RubyOnRails
[19:17:00] cagomez: has joined #RubyOnRails
[19:17:49] pavelz: has joined #RubyOnRails
[19:17:53] pavelz: whats attr is it equiv to attr_reader?
[19:18:49] pavelz: i guess it is
[19:18:53] pavelz: has left #RubyOnRails: ()
[19:20:32] jaequery: has joined #RubyOnRails
[19:22:14] knight33: has joined #RubyOnRails
[19:26:50] Spami: has joined #RubyOnRails
[19:26:50] Spami: has joined #RubyOnRails
[19:33:38] mlt-: Every time I want to associate some object A with a field of my object B using select tag, I get an id of object A sent to my controller, and I have to find up an actual object A to save as a field of my object B being edited. It is somewhat annoying to mess with strong parameters by looking up an object instead of ID every time. Is it a normal thing to do?
[19:34:42] matthewd: mlt-: !gist
[19:34:42] helpa: mlt-: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:34:42] SteenJobs: has joined #RubyOnRails
[19:35:03] meoblast001: has joined #RubyOnRails
[19:36:30] mlt-: matthewd: https://gist.github.com/mlt/33bb02e30eaaf43e62bed910c474ee88#file-controller-rb-L138
[19:38:44] dionysus69: has joined #RubyOnRails
[19:39:23] matthewd: mlt-: Call the form field / parameter operation_id
[19:40:19] mlt-: matthewd: also the whole caboodle with batch creation & association looks odd to me near line 64
[19:40:23] matthewd: mlt-: That way #update will save it using operation_id= instead of operation=, which expects to get just the id
[19:40:30] mlt-: matthewd: ic
[19:40:45] mlt-: I'll give it a try... so with _id some extra magic is gonna happen
[19:41:41] matthewd: Technically less magic; when you set `o.foo = val` for an association it's internally doing `o.foo_id = val.id` (among other things)
[19:42:10] mlt-: are there many "other things" ? )
[19:42:42] matthewd: No.. just the object you passed in gets cached so you'll get the same instance back out again
[19:43:03] matthewd: That's not a concern here, because you won't have one to begin with
[19:46:10] matthewd: I don't follow what this create action is doing, sorry
[19:48:14] mlt-: matthewd: thank you! it all works nice with _id
[19:48:40] mlt-: I have one more related puzzle
[19:50:53] mlt-: So I want to load operation specific form details onto the same page via ajax. Right now I get by with fields_for to squeeze details into the same form. Otherwise I don't know how would I cache form builder object between ajax calls
[19:54:28] srinidhi: has joined #RubyOnRails
[19:56:07] [Butch]: has joined #RubyOnRails
[19:57:59] zpe: has joined #RubyOnRails
[19:59:17] oded: has joined #RubyOnRails
[20:00:52] Guest96_: has joined #RubyOnRails
[20:02:25] blackmesa: has joined #RubyOnRails
[20:04:59] srinidhi: has joined #RubyOnRails
[20:06:33] pwnd_nsfw: I hate when tests pass, but not in production lol
[20:08:58] pwnd_nsfw: https://gist.github.com/SirUncleCid/0d5d7fb9e0e8fbd30ccc61e88252c57d
[20:09:16] pwnd_nsfw: Almost all tests are in question. Mainly the one where it shows the pins of the user
[20:09:54] pwnd_nsfw: @pins should always be null, but it's saying that it sees the title of each pin.
[20:12:06] matthewd: pwnd_nsfw: Listed elsewhere in the layout / navigation?
[20:12:23] mlt-: matthewd: that create action creates a bunch of objects and associations (1:1)
[20:12:44] matthewd: pwnd_nsfw: When in doubt, I just puts the response HTML in the test that's failing to eyeball it
[20:14:10] jusa: has joined #RubyOnRails
[20:18:28] chouhoul_: has joined #RubyOnRails
[20:20:28] zpe: has joined #RubyOnRails
[20:20:35] cagomez: has joined #RubyOnRails
[20:21:46] pwnd_nsfw: matthewd, welp, confirmed that the pins don't exist when invokved from the user. So, they're not being created...
[20:22:13] pupsicle: has joined #RubyOnRails
[20:22:42] chouhoulis: has joined #RubyOnRails
[20:23:12] SteenJobs: has joined #RubyOnRails
[20:23:30] pwnd_nsfw: oh, I'm doing something wrong with after(:create) callback
[20:24:40] meoblast001: has joined #RubyOnRails
[20:24:49] pwnd_nsfw: there we go
[20:26:10] cagomez: has joined #RubyOnRails
[20:32:37] ResidentBiscuit: has joined #RubyOnRails
[20:35:34] fugee: has joined #RubyOnRails
[20:38:18] tildes: has joined #RubyOnRails
[20:38:29] Spami: has joined #RubyOnRails
[20:38:29] Spami: has joined #RubyOnRails
[20:43:00] mochiyoda: has joined #RubyOnRails
[20:58:57] snickers: has joined #RubyOnRails
[21:04:08] jenrzzz: has joined #RubyOnRails
[21:07:15] samdvr: has joined #RubyOnRails
[21:16:41] Jayson_Virissimo: has joined #RubyOnRails
[21:26:17] tedwing: has joined #RubyOnRails
[21:40:41] superlou: has joined #RubyOnRails
[21:40:46] zpe: has joined #RubyOnRails
[21:45:01] aperkins81: has joined #RubyOnRails
[21:53:53] cagomez: has joined #RubyOnRails
[21:57:56] gambl0re: has joined #RubyOnRails
[22:10:27] jdm: has joined #RubyOnRails
[22:15:13] jusa: has joined #RubyOnRails
[22:15:47] Rodya_: has joined #RubyOnRails
[22:16:17] andywww: has joined #RubyOnRails
[22:17:29] andywww: how do you call faker and return a value to a variable to use in a string?
[22:17:33] andywww: https://gist.github.com/anonymous/136d513ac090f0e5309e18cc2c680178
[22:18:33] andywww: its saying unexpected curly brace on the second closed bracket on line 5
[22:19:15] andywww: i’ve tried to assign the response to a variable outside the block but its not having it
[22:19:21] baweaver: andywww: Someone's been using Handlebars :)
[22:19:29] baweaver: "#{interpolate}"
[22:20:27] andywww: one set is for interpolating but the internal set is because you ge the same result back from the call unless you put the braces round it
[22:20:43] baweaver: Ruby doesn't work like that
[22:20:46] Radar: GOOD MORNING
[22:21:57] matthewd: andywww: Right idea, wrong position for the braces
[22:22:03] baweaver: you probably want.....
[22:22:06] baweaver: freaking ninja
[22:24:02] rakm: has joined #RubyOnRails
[22:25:17] Spami: has joined #RubyOnRails
[22:25:17] Spami: has joined #RubyOnRails
[22:25:49] Radar: andywww: name { "#{Faker::Address.city} to #{Faker::Address.city}" }
[22:25:51] Radar: first one's free.
[22:25:58] Radar: andywww: When in doubt, check out the documentation.
[22:26:16] Radar: https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#dynamic-attributes
[22:26:19] helpa: Next question, please!
[22:27:23] baweaver: Radar: Did you ever get the punch card system done? Every 5 questions answered gets one freebie?
[22:30:50] fugee: has joined #RubyOnRails
[22:31:34] fugee: <%= form_for[@user, @address], :url => users_addresses_set_current_path(current_user.id, a.id) do |f| %>
[22:32:10] fugee: that should work from what i read so i have to ask why => causes an error
[22:32:23] Radar: baweaver: ha :) I should.
[22:32:35] Radar: baweaver: imagine how many mices would have
[22:32:51] matthewd: fugee: Missing space before [
[22:33:33] fugee: First argument in form cannot contain nil or be empty
[22:33:40] jaegerca: has joined #RubyOnRails
[22:33:44] jaegerca: has left #RubyOnRails: ()
[22:33:45] jaegerca: has joined #RubyOnRails
[22:33:47] fugee: is what results from putting the space
[22:34:01] fugee: Radar: which nick should i use?
[22:34:10] Radar: fugee: huh?
[22:34:26] Radar: Why is the URL users_addresses_set_current_path(current_user.id, a.id) ?
[22:34:29] fugee: cause i'm mices
[22:34:30] jaegerca: Can anyone recommend a lightweight and current WYSIWYG editor capable of storing assets in S3
[22:34:33] Radar: fugee: oh lol
[22:34:47] Radar: fugee: It'd be good if you stuck with just one name.
[22:34:54] fugee: what happened to sherpas?
[22:34:58] Radar: Stay on topic.
[22:35:24] Radar: users_addresses_set_current_path(current_user.id, a.id) <- If this is always for the same user then why specify it here?
[22:35:35] Radar: Why not just set_current_addresses_path and then use current_user in that controller action?
[22:35:52] amperry: has joined #RubyOnRails
[22:36:22] mices: cause i'm using nested resources as this is the views convention for nested resources, no?
[22:36:36] mices: s/as/and;
[22:36:43] mices: s/as/and/;
[22:36:49] Radar: does it need to be a nested resource if you're always working with the current user?
[22:37:03] mices: guess not
[22:40:43] mices: nested resources seems to be my personal preference right now cause i feel like learning how to use them is progressive for me
[22:41:18] amperry: hi folks, got a design question: "thin controllers" (i.e., without much more than the default methods) and "fat models" are recommended, but most of the operations in my app deal with more than one model; I figured I could create a bunch of service objects, but where do you call them from, and how would a route for a service object loook?
[22:44:12] mices: Radar: if a phone table was added i could then make it a resource under addresses, i like nested resources
[22:45:06] mices: not that that's a good example
[22:45:41] dtzuzu: has joined #RubyOnRails
[22:48:34] amperry: I've been creating controller methods and routing appropriately, but I didn't know if there were a cleaner way or not.
[23:01:27] naprimer: has joined #RubyOnRails
[23:06:15] mices: <%= form_for[@user, @address], url: users_addresses_set_current_path(current_user.id, a.id) do |f| %>
[23:13:30] treefrob_: has joined #RubyOnRails
[23:14:38] gambl0re: has joined #RubyOnRails
[23:16:55] patarr: has joined #RubyOnRails
[23:25:17] romeoh: has joined #RubyOnRails
[23:26:08] patarr: has joined #RubyOnRails
[23:29:14] cagomez: has joined #RubyOnRails
[23:38:10] patarr: has joined #RubyOnRails
[23:46:04] amperry: I have several service objects (e.g., VoidApplication) which work with multiple models (residents, apts, applications). I've been calling them from controller methods and assigning routes such as "get '/void_application/:id' => 'residents#void_application'". Is this the recommended practice?
[23:47:24] patarr: has joined #RubyOnRails
[23:49:01] amperry: note that, since they deal with multiple models, I don't always have the best idea of which controller to place them in.
[23:57:22] Radar: amperry: Can you show us what this service object does?