« Back to channel list

#RubyOnRails - 25 September 2017

« Back 1 day Forward 1 day »
[00:01:26] dionysus69: has joined #RubyOnRails
[00:06:59] h7br1x: Yeah, I get the point you're making with format but shouldn't there be a way for rails to recognize m/d/y as well? Especially when handling a route?
[00:10:32] orbyt_: has joined #RubyOnRails
[00:21:21] Radar: h7br1x: It's your view that's causing this issue.
[00:21:27] Radar: h7br1x: Date.strptime is the way, not .to_date.
[00:26:55] Rodya_: has joined #RubyOnRails
[00:29:46] timdotrb: has joined #RubyOnRails
[00:36:50] h7br1x: .strptime was the way- Thank you, @Radar.
[00:39:39] Radar: All good :D
[00:50:29] quazimodo: has joined #RubyOnRails
[01:01:40] desnudopenguino: anyone have any experience with https://github.com/mikel/mail?
[01:02:17] Radar: desnudopenguino: !used
[01:02:17] helpa: desnudopenguino: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[01:03:39] desnudopenguino: so my issue with https://github.com/mikel/mail is I'm getting an error "Net::POPError (-ERR unable to open that message)" so I'm trying to step through the emails and figure out what it is in byebug, but i don't think I'm getting it right
[01:05:21] Radar: desnudopenguino: !rule3
[01:05:21] helpa: desnudopenguino: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[01:05:49] bronson: has joined #RubyOnRails
[01:13:17] moei: has joined #RubyOnRails
[01:15:58] desnudopenguino: https://gist.github.com/desnudopenguino/b50970c95f98226ffc121fd2e7a79412
[01:16:02] desnudopenguino: with the error in the comment
[01:19:05] desnudopenguino: I'm trying to parse through the emails with Mail.find(:what => :last, :count => 23) and Mail.find(:what => :first, :count => 23) and I'm not getting matching emails between those two queries though I'm getting overlapping dates, and I'm finding the error "*** Net::POPError Exception: -ERR unable to open that message" when I hit an email that can't be opened I guess
[01:24:52] DTZUZO: has joined #RubyOnRails
[02:06:46] Jameser: has joined #RubyOnRails
[02:07:08] beilabs: has joined #RubyOnRails
[02:17:43] gusrub: has joined #RubyOnRails
[02:36:29] ahrs: has joined #RubyOnRails
[02:47:55] irishfromua: has joined #RubyOnRails
[02:53:17] s2013: has joined #RubyOnRails
[02:54:45] fragamus: has joined #RubyOnRails
[03:06:35] bronson: has joined #RubyOnRails
[03:06:51] fragamus: has joined #RubyOnRails
[03:27:33] srinidhi: has joined #RubyOnRails
[03:42:42] bronson: has joined #RubyOnRails
[03:48:35] bios: Radar: I want to let the users set up their own subdomains, but I need to have a subdomain such as 'dashboard' and 'api' as reserved
[04:03:45] Rodya_: has joined #RubyOnRails
[04:08:07] opekktar: has joined #RubyOnRails
[04:14:05] knight33: has joined #RubyOnRails
[04:20:56] desnudopenguino: bios: that sounds cool but like a pain
[04:24:17] s2013: has joined #RubyOnRails
[04:30:20] cgfbee: has joined #RubyOnRails
[04:41:55] Radar: bios: sounds like an exclusion validation would suffice.
[04:56:54] beilabs: has joined #RubyOnRails
[05:04:22] beilabs_: has joined #RubyOnRails
[05:14:07] foreman-n00b: has joined #RubyOnRails
[05:14:17] timdotrb: has joined #RubyOnRails
[05:31:51] kapil___: has joined #RubyOnRails
[05:40:32] bios: I'll look into exclusion validation, but I did get it working using routing constraints
[05:41:06] bios: thanks you guys!
[06:03:33] desnudopenguino: i think i figured out the issue, there is some sort of phantom email or something in my mailbox that is not readable, and not letting any email clients connect happily, and it is messing with stuff
[06:11:23] wethu: has joined #RubyOnRails
[06:35:43] srinidhi: has joined #RubyOnRails
[06:36:00] psychoslave: has joined #RubyOnRails
[06:41:52] paranoicsan: has joined #RubyOnRails
[06:45:50] leclerc: has joined #RubyOnRails
[06:46:08] leclerc: Hey folks scaffolding is awesome right!?
[07:00:14] conta: has joined #RubyOnRails
[07:02:11] xcesariox: has joined #RubyOnRails
[07:05:54] beilabs: has joined #RubyOnRails
[07:14:43] coder2000: I don't even use scaffolding any more
[07:15:37] psychoslave: has joined #RubyOnRails
[07:19:44] dkam_: has joined #RubyOnRails
[07:33:48] dionysus69: has joined #RubyOnRails
[07:36:32] DrYockel: has joined #RubyOnRails
[07:49:42] defsdoor: has joined #RubyOnRails
[08:00:03] mikecmpbll: has joined #RubyOnRails
[08:01:40] defsdoor: has joined #RubyOnRails
[08:02:21] ProofTechnique: has joined #RubyOnRails
[08:13:33] xcesariox: has joined #RubyOnRails
[08:14:02] marr: has joined #RubyOnRails
[08:14:49] ams__: has joined #RubyOnRails
[08:19:52] defsdoor: has joined #RubyOnRails
[08:23:05] leclerc: coder2000: I was kind of testing the waters. Cause I never liked it, but some guy is arguing with me that the *thing that made RoR* is scaffolding. Like this is the top #1 feature.
[08:24:00] dminuoso_: has joined #RubyOnRails
[08:24:26] dminuoso_: tbuehlmann: turns out I dont need that much magic for a "traditional web app"
[08:25:27] tbuehlmann: not sure you're making fun of me now
[08:27:55] dminuoso_: tbuehlmann: https://gist.github.com/anonymous/e315b52163e34a9d5798c570b5b5080e
[08:28:01] dminuoso_: Look! I can be minimalistic!
[08:28:52] dminuoso_: Dont ask me why axios is a devDependency, *somebody* ought to fix that.
[08:30:04] Arkentias: has joined #RubyOnRails
[08:40:56] dminuoso_: Over time I think something like RxJS/bacon/kefir is going to be added too, to make this asynchronous programming Im doing on the frontend a bit easier.
[08:49:04] arBmind: has joined #RubyOnRails
[08:52:53] dionysus69: I need an advice
[08:53:23] dionysus69: I just joined a project which uses coffescript, so I have a choice, reset it to vanilla js or learn coffescript
[08:53:43] dionysus69: is coffescript worth the time ?
[08:55:29] dminuoso_: dionysus69: Depends on what you mean by vanilla js.
[08:56:08] dionysus69: by vanilla I mean pre es6 syntax but even if it's ES6 it is still very much different from coffescript
[08:56:54] dminuoso_: dionysus69: It's up to you really. Given that choice I'd go for CoffeeScript, because without ES6 JavaScript is a piss poor language.
[08:57:27] dionysus69: ok I ll consider that :)
[08:57:30] dminuoso_: dionysus69: But in the end you should conform to what the rest of the team uses.
[08:57:39] dminuoso_: If there's a mix of both that's usually even more horrible.
[08:57:57] dionysus69: but if it were es6, you wouldnt consider coffee?
[08:58:24] dionysus69: indeed you wouldn't or you would :D ?
[08:58:35] lxsameer: has joined #RubyOnRails
[08:58:50] dminuoso_: Indeed I wouldn't even think about considering CoffeeScript
[08:59:07] dminuoso_: But it's a matter of preference really.
[08:59:32] dionysus69: ye but I want to practical, for example going from erb to haml, didnt require lots of time
[09:00:27] catphish: has joined #RubyOnRails
[09:00:42] dminuoso_: dionysus69: If I had the choice, I'd pick PureScript over both. :p
[09:01:02] dionysus69: never heard of it :P
[09:01:13] catphish: does rails provide any mechanism to decrement a column and raise an exception if the column has reached zero? or am i going to need to do some row locking manually?
[09:01:38] drptbl: has joined #RubyOnRails
[09:01:49] dminuoso_: catphish: No need for row locking if you have a transactional database.
[09:02:22] catphish: thanks, in that case i think i'm just not seeing how you'd code this
[09:02:43] catphish: essentially i have a number in a column, and i want to ensure a controller action can only be run that number of times
[09:02:54] catphish: decrementing the value each time
[09:03:13] dminuoso_: catphish: Provide a wrapper method that just invokes #decrement, inspects the value and then behaves accordingly
[09:03:24] dminuoso_: catphish: Are you on postgres?
[09:03:36] catphish: mysql, so decrement, then roll back if it's reached -1?
[09:04:04] catphish: this will invoke an implicit row lock i believe, that sounds good
[09:04:12] dminuoso_: catphish: Nope, why should it?
[09:05:00] catphish: because otherwise what would stop 2 instances both decrementing it before reading the value
[09:05:12] dminuoso_: The database if in doubt.
[09:05:52] catphish: i'm pretty sure decrement calls UPDATE ... SET n = n - 1. which will create a row lock, at least in innodb
[09:06:08] catphish: anyway, that's what i want here, so it's all good
[09:10:58] defsdoor: has joined #RubyOnRails
[09:11:28] catphish: related question: how does one rescue an exception in order to display a friendly error to the user, but then roll back the transaction?
[09:11:38] dminuoso_: catphish: Mmm think I need to get more coffee. Of course that would do a row level lock. :|
[09:12:22] catphish: thanks :) glad i'm not entirely insane
[09:12:51] dminuoso_: catphish: If you wrap it inside a transaction block, you can simply raise a ActiveRecord::Rollback
[09:13:40] tbuehlmann: catphish: you could lock the record (reloading it) and then do your thing with a regular soft rails validation
[09:14:18] defsdoor: has joined #RubyOnRails
[09:17:47] timdotrb: has joined #RubyOnRails
[09:20:32] defsdoor: has joined #RubyOnRails
[09:32:44] catphish: dminuoso_: thanks, using a manual transaction block decrement, and ActiveRecord::Rollback works perfectly
[09:35:26] paranoicsan: has joined #RubyOnRails
[09:41:41] Sigyn: has joined #RubyOnRails
[09:51:16] uksio: has joined #RubyOnRails
[09:51:20] defsdoor: has joined #RubyOnRails
[10:05:12] paranoicsan: has joined #RubyOnRails
[10:20:21] wethu: has joined #RubyOnRails
[10:42:13] drale2k: has joined #RubyOnRails
[10:48:58] kapil___: has joined #RubyOnRails
[10:50:40] bronson: has joined #RubyOnRails
[10:58:13] paranoicsan: has joined #RubyOnRails
[10:59:59] alibby: has joined #RubyOnRails
[11:37:29] wopi: has joined #RubyOnRails
[11:45:32] ladipo: has joined #RubyOnRails
[11:50:48] bronson: has joined #RubyOnRails
[12:11:15] mostlybadfly: has joined #RubyOnRails
[12:21:53] bruno-: has joined #RubyOnRails
[12:33:13] keegnotrub: has joined #RubyOnRails
[12:40:24] marr: has joined #RubyOnRails
[12:49:52] tcopeland: has joined #RubyOnRails
[12:59:02] dkam_: has joined #RubyOnRails
[12:59:48] jphase: has joined #RubyOnRails
[13:00:22] dkam_: Can I use the ActiveStorage Gem with rails 5.1.14? I'm giving it a go, but I can't generate a URL for the attachments.
[13:11:48] orbyt_: has joined #RubyOnRails
[13:17:14] matthewd: dkam_: That was a one-off gem release when it was pretty early in development. I imagine it will work in some way, but anything anyone's written about how to use it probably doesn't apply.
[13:20:00] dkam_: Thanks matthewd
[13:26:23] catphish: has left #RubyOnRails: ("Leaving")
[13:33:01] fidalgo: has joined #RubyOnRails
[13:36:06] hammer065: has joined #RubyOnRails
[13:38:49] shime: has joined #RubyOnRails
[13:39:07] shime: has joined #RubyOnRails
[13:40:03] apparition: has joined #RubyOnRails
[13:43:13] knight33: has joined #RubyOnRails
[13:43:16] rfoust: has joined #RubyOnRails
[13:44:46] fidalgo: Hello! good afternoon for all near GMT :)
[13:51:48] bronson: has joined #RubyOnRails
[13:52:08] kitsuneyo: has joined #RubyOnRails
[13:52:52] ravster: has joined #RubyOnRails
[14:02:18] fidalgo: anyone here has suffered the pain to deal with PDF creation? namely using Prawn, because it allows to control what goes in each page...
[14:05:12] matthewd: fidalgo: I've previously used Apache FOP as a more middle ground between position-everything and render-HTML-then-"print"
[14:07:21] fidalgo: matthewd: I would like to avoid Java dependencies. Maybe I need to try something with Javascript and let the client-side do the dirty job.
[14:09:14] matthewd: I had the Rails app build the XML, then post that to a separate server to do the rendering and give back the binary -- so there's Java involved, but it's nowhere near the actual app
[14:10:24] ShalokShalom_: has joined #RubyOnRails
[14:10:53] paranoicsan: has joined #RubyOnRails
[14:12:49] ravster: fidalgo: I've used prawn in the past.
[14:13:18] ravster: I didn't find it to be worse than CSS, tbh
[14:15:31] fidalgo: ravster: I'm facing an blocker issue, I want to have a section, that if it don't fit in the remaining space, create a new page and draw it.
[14:15:36] theunraveler: has joined #RubyOnRails
[14:16:04] knight33: has joined #RubyOnRails
[14:16:52] ravster: For something like that I'd just see how far away the cursor is from the bottom of the page (+/- any margins) , and compare that to the height of the section that I want to build.
[14:21:16] ResidentBiscuit: has joined #RubyOnRails
[14:21:22] skapshikar: has joined #RubyOnRails
[14:22:36] skapshikar: I am trying to create a dashboard for our Rails Application for which i need to create a dashboard layout. Is there any tool which you guys use for making layou or recommend any?
[14:23:50] fryguy: skapshikar: bootstrap is a pretty common css toolkit with layout options
[14:23:55] chouhoulis: has joined #RubyOnRails
[14:23:59] fidalgo: ravster: but how do you calculate the height of an element without draw it? I'm using a bouding_box by the way
[14:25:52] ravster: fidalgo: I used to extract the creation of the contents into a function that returns the bounding-box, and then compare heights. Then I'd make the decision whether to start a new page or not, and then call that function again.
[14:27:10] skapshikar: fryguy, thank you. I will have a look on that.
[14:27:54] skapshikar: Also currently our application is running on Rails4. If I upgrade it to Rails5, will it affect any functionality?
[14:28:37] fryguy: of course
[14:32:33] skapshikar: fryguy, what are the major changes between Rails4 and Rail5? If you could redirect me to any documentation it would be great
[14:33:05] drale2k: has joined #RubyOnRails
[14:33:25] fryguy: changelogs are here: http://weblog.rubyonrails.org/releases/
[14:33:48] fidalgo: ravster: but if I call the bounding_box method it will create and draw a bounding_box. So calling it two times won't create two bounding boxes?
[14:34:23] ravster: fidalgo: Let me see if I can find how I did it before.
[14:39:51] skapshikar: fryguy, thank you
[14:40:36] chouhoulis: has joined #RubyOnRails
[14:53:30] bronson: has joined #RubyOnRails
[14:54:47] Chernobuk: has joined #RubyOnRails
[15:02:20] s2013: has joined #RubyOnRails
[15:06:05] DTZUZO: has joined #RubyOnRails
[15:11:46] gusrub: has joined #RubyOnRails
[15:14:43] DTZUZO: has joined #RubyOnRails
[15:17:14] cabotto: has joined #RubyOnRails
[15:18:01] bruno-: has joined #RubyOnRails
[15:25:21] cpruitt: has joined #RubyOnRails
[15:26:05] Saukk: has joined #RubyOnRails
[15:27:04] aphel: people here that use amazon elastic beanstalk: is it good for rails apps at scale?
[15:27:20] cpruitt: Hey all. First, I understnad all the reasons that this is usually a very bad idea, but still… I’m looking for a way to individually set/overide #id for an ActiveRecord model (w/ postgres).
[15:28:50] matthewd: cpruitt: In what way is it not just doing what you want?
[15:28:56] cpruitt: I have a legacy app that’s being overwritten. One model (Account) uses the primary key as account numbers. I need the user to be able to key in the old account number from the old software when entering information into the new system. So the new system will start auto-incrementing from a point higher than the old system. All those “unused” ids are reserved for records being moved over so we can ensure that account numbers do not cha
[15:31:17] cpruitt: I know I could just add an “account number” field and look up by that instead of by #id, but the account # is used internally in all kinds of URLs and such, so I’d have to *always* look up resources by the account # anyway, which basically makes it used in the same way as the ID column.
[15:31:19] am55: has joined #RubyOnRails
[15:35:36] cpruitt: @matthewd Ummm… nevermind.
[15:35:57] cpruitt: I guess rails doesn’t prevent this by default, which I was certian it did.
[15:36:13] cpruitt: Now I’m confused about why it works… lol
[15:36:57] timdotrb: has joined #RubyOnRails
[15:37:00] matthewd: It started working somewhere in 4.x, I believe, if that helps
[15:42:18] chouhoulis: has joined #RubyOnRails
[15:45:31] dionysus69: has joined #RubyOnRails
[15:46:02] cpruitt: matthewd: Yeah, it does. I’ll put it on my “go back & look into” list. For the moment it’s doing what I need it to so here’s to a day with easy solutions. Thanks for the reply. Your comment made me actually test it. I guess it’s a good reminder not to just assume.
[15:47:56] fidalgo: ravster: if you have public example (ex: github) you can just point me
[15:52:09] gusrub: has joined #RubyOnRails
[15:56:57] troys: has joined #RubyOnRails
[15:58:08] shime: has joined #RubyOnRails
[15:58:44] cagomez: has joined #RubyOnRails
[16:00:12] pLaTo0n: has joined #RubyOnRails
[16:01:42] DTZUZO: has joined #RubyOnRails
[16:09:59] Sylario: has joined #RubyOnRails
[16:12:15] paranoicsan: has joined #RubyOnRails
[16:13:30] timdotrb: has joined #RubyOnRails
[16:20:48] uks: has joined #RubyOnRails
[16:27:29] raunicolae: has joined #RubyOnRails
[16:27:45] raunicolae: has left #RubyOnRails: ()
[16:29:24] uksio: has joined #RubyOnRails
[16:29:51] srinidhi: has joined #RubyOnRails
[16:30:56] irishfromua: has joined #RubyOnRails
[16:34:02] maryo: has joined #RubyOnRails
[16:39:46] irishfromua: has joined #RubyOnRails
[16:42:23] DTZUZO: has joined #RubyOnRails
[16:45:13] bruno-_: has joined #RubyOnRails
[16:47:46] gusrub: has joined #RubyOnRails
[16:48:57] NoGodDamnIdea: has joined #RubyOnRails
[16:51:50] orbyt_: has joined #RubyOnRails
[16:54:21] chouhoulis: has joined #RubyOnRails
[16:55:15] uks: has joined #RubyOnRails
[16:58:03] kies: has joined #RubyOnRails
[17:01:42] daveomcd: has joined #RubyOnRails
[17:04:19] one_zero: has joined #RubyOnRails
[17:05:20] bronson: has joined #RubyOnRails
[17:17:25] dionysus69: has joined #RubyOnRails
[17:25:03] one_zero: has joined #RubyOnRails
[17:29:40] brycesenz: has joined #RubyOnRails
[17:31:28] brycesenz: Hi all. I'm trying to get the fully rendered HTML from a Mail::Message object (including the rendered layout and any partials). I can't really find documentation on how to do this though. Has anyone done something similar before?
[17:35:35] kies: has joined #RubyOnRails
[17:36:38] knight33: has joined #RubyOnRails
[17:38:22] fidalgo: brycesenz: in the past I've used https://github.com/ryanb/letter_opener
[17:38:39] kapil___: has joined #RubyOnRails
[17:39:06] brycesenz: @fidalgo - doesn't that prevent the mail from being sent though?
[17:41:09] chouhoulis: has joined #RubyOnRails
[17:45:10] tcopeland: https://mailcatcher.me/ is pretty good too
[17:47:22] fidalgo: brycesenz: yes, it's not what you want?
[17:47:24] brycesenz: tcopeland - again, isn't that more about preventing mail from going out than working with the message class itself?
[17:47:57] tcopeland: I guess I tend to use it more for iterating on mailer template design and contents
[17:47:59] brycesenz: fidalgo - no. I have a mail interceptor class. I just want to do some message analysis on the raw outgoing HTML before it is sent
[17:48:17] brycesenz: that's why I am keen to understand how one would get the full HTML from that class
[17:52:08] theunraveler: has joined #RubyOnRails
[17:52:31] lxsameer: has joined #RubyOnRails
[17:52:58] mtkd: has joined #RubyOnRails
[17:54:54] orbyt_: has joined #RubyOnRails
[18:01:51] srinidhi: has joined #RubyOnRails
[18:04:56] gambl0re: has joined #RubyOnRails
[18:05:44] bronson: has joined #RubyOnRails
[18:06:09] knight33: has joined #RubyOnRails
[18:09:39] conta: has joined #RubyOnRails
[18:15:12] Saukk: has joined #RubyOnRails
[18:17:50] ivanskie: has joined #RubyOnRails
[18:22:38] tubbo: has joined #RubyOnRails
[18:38:14] wethu: has joined #RubyOnRails
[18:39:24] mlt-: Can I use AR query method #select to calculate fields with a parameter? I want something akin to the following SQL "count(*) filter (where completed_at < ?)"
[18:39:44] mlt-: Do I have to use exec_query?
[18:39:55] mlt-: I just though to use association, scopes and alike
[18:40:17] mlt-: I mean if bare SQL is the only option, fine by me
[18:42:02] paranoicsan: has joined #RubyOnRails
[18:46:36] bronson: has joined #RubyOnRails
[18:47:18] baweaver: mlt-: Something like this?: Model.where('completed_at < ?', completed_at).count
[18:47:51] dviola: has joined #RubyOnRails
[18:50:20] justrying: has joined #RubyOnRails
[18:53:43] FrostCandy: has joined #RubyOnRails
[18:55:17] jphase_: has joined #RubyOnRails
[18:57:28] psychoslave: has joined #RubyOnRails
[19:00:22] mlt-: baweaver: no, I can't use global where... I need like 4 different values. I don't want to run 4 separate queries.
[19:00:48] mlt-: baweaver: I decided to go with raw sql
[19:00:50] baweaver: There's probably a way with select and strings to make it behave
[19:01:02] baweaver: but raw sql is probably cleaner by that point, yeah
[19:06:08] knight33: has joined #RubyOnRails
[19:07:15] fryguy: has joined #RubyOnRails
[19:22:31] s2013: has joined #RubyOnRails
[19:46:42] uksio: has joined #RubyOnRails
[19:53:00] dionysus70: has joined #RubyOnRails
[19:58:21] bronson: has joined #RubyOnRails
[19:58:25] ivanskie: has joined #RubyOnRails
[20:00:01] orbyt_: has joined #RubyOnRails
[20:06:27] mtkd: has joined #RubyOnRails
[20:11:43] brent__: has joined #RubyOnRails
[20:14:12] hahuang65: has joined #RubyOnRails
[20:18:23] patientplatypus: has joined #RubyOnRails
[20:18:30] patientplatypus: https://hastebin.com/etoyihevef.rails
[20:18:45] patientplatypus: im having trouble with a uniqueness check on a model, can anyone take a look?
[20:19:24] lacuna: has joined #RubyOnRails
[20:21:26] patientplatypus: updated with error from terminal https://hastebin.com/oporikisul.rb
[20:23:07] tubbo: patientplatypus: code looks ok, what makes you think it's the uniqueness validation that's causing the problem?
[20:24:14] patientplatypus: look at the line in the error "USER EXISTS" followed by the rollback - it seems to save the user, THEN find itself (doy!) and say since it exists it can't write itself
[20:24:29] patientplatypus: its either a race condition or an ordering problem or something i think
[20:24:43] patientplatypus: also - the inputs are unique after a database wipe
[20:26:15] patientplatypus: im trying to test with a different way to write the controller now
[20:26:19] mlt-: Does #sanitize_sql_array work with array parameters? I need to supply single element array of integers. I tried passing Array(blah) among other things, but sql looks as if array was turned into a single integer :(
[20:30:31] theunraveler: has joined #RubyOnRails
[20:34:47] keegnotrub: has joined #RubyOnRails
[20:34:51] tcopeland: mlt-: like ActiveRecord::Base.send(:sanitize_sql_array, ["foo in (?)", [1,2,3]]). ? # that produces "foo in (1,2,3)"
[20:36:34] mlt-: tcopeland: yeah, though I had more like ["select blah from fancy_func(param => ?)", Array(1)]
[20:37:13] mlt-: it just expanded it as if param => 1 and I had DB error that no function with such signature
[20:38:29] mlt-: tcopeland: though since I had to pass a single value array, I got by with param=>'{?}'
[20:38:56] mlt-: But I'm curious in general purpose solution though
[20:39:16] mlt-: I wonder if it senses ? surrounded by parenthesis
[20:39:23] ur5us: has joined #RubyOnRails
[20:39:25] mlt-: to interpret arguments any different
[20:39:45] patientplatypus: does anyone have any ideas im very confused
[20:42:00] tubbo: patientplatypus: i mean, that's definitely what it looks like but it's hard to tell because you're never outputting user.errors. try doing a `puts user.errors.full_messages.to_sentence`
[20:42:17] tubbo: maybe after the "inside user.errors" line in your controller?
[20:43:50] patientplatypus: im getting 'password can't be blank' but im not sending a blank password 😕
[20:44:18] mlt-: patientplatypus: I think you do
[20:44:38] mlt-: your password and confirmation should be inside user=>{}}
[20:44:53] mlt-: Look at Parameters on line 9
[20:45:12] mlt-: and on line 47
[20:45:32] mlt-: something is not quite right with your html
[20:46:33] tubbo: patientplatypus: yeah password == password_confirmation needs to be bypassed if password.nil?
[20:46:42] mlt-: name="user[password]" has to be somewhere, but it is name="password"
[20:46:49] patientplatypus: i needed to pass user:{name....password....etc} rather than {name....password....etc}
[20:47:42] mlt-: though... it depends on line 47 :) you can change it as well)
[20:47:53] mlt-: to accept the latter
[20:48:43] brent__: has joined #RubyOnRails
[20:49:14] FrostCandy: I want to write function in rails to translate state name to state abbriviation like New York turns into NY. My question is, where should a function like that go so I can access it in different models / controllers? Is that something I shoudl put in a helper?
[20:49:28] brent__: I have some haml link_to's w/ data: {disable_with: 'blah'}.... the text changes, yet it does't seem to disable and prevent 2nd clicks
[20:56:20] shime: has joined #RubyOnRails
[20:56:44] ravster: FrostCandy: If I needed something like that in different models, I'd just place that in lib/ and require it wherever I needed it.
[21:00:45] cagomez: has joined #RubyOnRails
[21:05:53] ivanskie: has joined #RubyOnRails
[21:13:55] shime: has joined #RubyOnRails
[21:14:56] cagomez: has joined #RubyOnRails
[21:15:36] cagomez: has joined #RubyOnRails
[21:25:58] FrostCandy: ravster: yup i had the same thought. Then decided to put it in a helper, but now i keep getting uninitliazed constant page::myhelper :( My helper looks like this module StatesHelper ... ::States = { AK: "Alaska" } - currently im using include StatesHelper before calling ::States but no luck yet
[21:27:06] FrostCandy: Would I need to do some sort of rake ?
[21:32:18] keegnotrub: has joined #RubyOnRails
[21:47:43] FrostCandy: Oh --- you have to name the file the same name as the module
[22:10:42] workmad3: has joined #RubyOnRails
[22:14:25] muzik: has joined #RubyOnRails
[22:25:06] mwlang: has joined #RubyOnRails
[22:25:48] mwlang: is it possible for a rails session that’s a database/activerecord store to be explicitly set by passing the session_id in on URL?
[22:26:20] mwlang: For example, we want to implement Google Docs preview functionality whereby a logged in user can view a document.
[22:27:12] mwlang: since the request for the document’s data payload is coming from docs.google.com, we need docs.google.com to “auto-login” to the user’s current session.
[22:32:17] jphase: has joined #RubyOnRails
[22:34:44] blindMoe: has joined #RubyOnRails
[22:36:50] blindMoe: When saving a date to the db ( postgres timestamp ) using AR is is possible to have it not convert it to UTC? I am trying to make it so certain rake tasks run at midnight for locations we have stored in the db but midnight is different for many of the locations due to the timezones
[22:38:02] blindMoe: so I can do something like run_task_at DateTime.tomorrow.beginning_of_day.in_time_zone(location.time_zone) and it returns the correct time (Mon, 25 Sep 2017 20:00:00 EDT -04:00) for what I want but when I save it to the db it saves it at 9/26/2017 00:00:00
[22:39:56] mwlang: blindMoe: in config/application.rb, set config.active_record.default_timezone = :local
[22:40:13] mwlang: and you’ll also want to set the timezone you want while you’re at it: config.time_zone = "CET"
[22:40:17] blindMoe: mwlang: it is set
[22:40:18] mwlang: (for example)
[22:42:01] mwlang: I’m reasonably sure the second setting is crucial to getting the behavior you want.
[22:42:18] mwlang: albeit it’s been a while since I’ve fiddled with these settings.
[22:42:53] brycesenz: has joined #RubyOnRails
[22:42:58] blindMoe: mwlang: The problem is that this app can run in a cluster and the timezone could be dynamic
[22:45:02] mwlang: ok, monkeying with UTC in the DB probably isn’t the solution you want anyway…if you have multiple timezones serviced by the app, it’s best to keep it UTC in the DBMS.
[22:46:33] mwlang: If you’re running in a cluster and the expectation is each server serves a specific timezone, then my thought would be to try setting the server’s timezone so that it’s cronjob scheduler is firing the midnight tasks at midnight local time for that server.
[22:48:39] Radar: GOOD MORNING
[22:49:05] PTalmighty: has joined #RubyOnRails
[22:49:26] mwlang: Greetings
[23:12:17] knight33: has joined #RubyOnRails
[23:13:02] tcopeland: has joined #RubyOnRails
[23:16:14] ivanskie: has joined #RubyOnRails
[23:16:26] orbyt_: has joined #RubyOnRails
[23:17:58] blitz: why does rails by default inject an extra parameter that contains all parameters with the controller name as a key into the params? I feel like I must be missing something - for example: http://paste.ubuntu.com/25617578/ "registration" gets injected
[23:19:09] blitz: I'm running in rails-api mode, json req/responses only
[23:23:25] orbyt_: has joined #RubyOnRails
[23:37:53] mikecmpbll: has joined #RubyOnRails
[23:50:25] Radar: blitz: it's because you're making a JSON request. Rails does this so it makes it easier to pass the parameters through to a model, i.e. Post.create(post_params)
[23:50:47] Radar: I believe the google terms you'd be after are "ParamsWrapper Rails"
[23:53:00] blitz: thanks a bunch, I could just not figure out the right keywords to google this
[23:53:10] leclerc: has joined #RubyOnRails
[23:55:53] bronson: has joined #RubyOnRails
[23:56:15] mtkd: has joined #RubyOnRails