« Back to channel list

#RubyOnRails - 05 September 2018

« Back 1 day Forward 1 day »
[00:13:01] quazimodo: has joined #RubyOnRails
[00:17:59] Guest58115: has joined #RubyOnRails
[00:29:18] duderonomy: has joined #RubyOnRails
[00:42:22] DTZUZO: has joined #RubyOnRails
[00:52:44] sevenseacat: has joined #RubyOnRails
[00:55:00] moei: has joined #RubyOnRails
[01:05:48] craysiii: has joined #RubyOnRails
[01:07:01] craysiii: Hey all, wondering if there is a gem out there that allows users to define filters through a UI and save them to the database in order to generate custom reports without having to write additional code. Don't know if I asked this already since irccloud was acting weird, apologies if I did.
[01:37:53] mices: has joined #RubyOnRails
[01:48:55] Technodrome: has joined #RubyOnRails
[02:08:27] orbyt_: has joined #RubyOnRails
[02:14:53] s2013: has joined #RubyOnRails
[02:15:12] s2013: im running into a peculiar issue.. its asking me to sign in even tho the controller does not require a signed in user..
[02:18:37] Guest58115: has joined #RubyOnRails
[02:34:04] Saukk: has joined #RubyOnRails
[02:45:41] craysiii: has joined #RubyOnRails
[02:46:21] jhass: has joined #RubyOnRails
[02:46:31] Dimik: has joined #RubyOnRails
[02:48:01] Sylario: has joined #RubyOnRails
[02:55:41] quazimodo: has joined #RubyOnRails
[03:11:54] braincrash: has joined #RubyOnRails
[03:13:34] Kilo`byte: has joined #RubyOnRails
[03:13:44] quazimodo: has joined #RubyOnRails
[03:17:25] samort7: has joined #RubyOnRails
[03:19:24] jhill: has joined #RubyOnRails
[03:33:24] jhass: has joined #RubyOnRails
[03:34:49] wethu: has joined #RubyOnRails
[03:38:45] egray: has joined #RubyOnRails
[03:48:49] Technodrome: has joined #RubyOnRails
[04:14:26] quazimodo: has joined #RubyOnRails
[04:14:31] phon: has joined #RubyOnRails
[04:19:17] Guest58115: has joined #RubyOnRails
[04:21:43] brandoncc: has joined #RubyOnRails
[04:24:38] brandoncc: I have a Rails 5 app which I am hitting in some requests using axios. During this request, I set some session values. On the next request, the values are gone and I cannot figure out why. I know that axios is sending my cookie because checking if I am logged in returns true during the ajax request. Does anybody have any idea what might be going on?
[04:28:31] sevenseacat: how have you debugged this so far
[04:29:23] exchgr`: has joined #RubyOnRails
[04:29:28] quazimodo: has joined #RubyOnRails
[04:30:49] havenwood: has joined #RubyOnRails
[04:31:35] crankharder: has joined #RubyOnRails
[04:32:03] salasrod: has joined #RubyOnRails
[04:34:19] brandoncc: sorry @sevenseacat I just saw your response
[04:35:10] brandoncc: I forgot that isn't how you mention on irc :-)
[04:36:38] brandoncc: Anyway sevenseacat, placed a binding.pry before and after my session change in the server controller action. Everything changes as expected. I have also verified the session is being looked up properly by making sure logged_in? returns true. The network tab in Chrome shows the proper cookies in the request and response for my ajax call.
[04:37:39] brandoncc: the next ajax call, the session value is the old value, before the prior update...it only changes if I run the same code with a full request rather than an ajax one
[04:38:47] sevenseacat: ok, so two ajax requests, one updates a session var, the next one doesn't see the update
[04:39:05] sevenseacat: are they using the same session?
[04:39:17] brandoncc: every ajax request has the ability to update the session, depending on its payload
[04:39:38] brandoncc: the full page loads do as well, I am just caching certain query params
[04:40:07] brandoncc: I will go as far as saying that I am not doing anything to make them *not* use the same session
[04:40:29] zmo: has joined #RubyOnRails
[04:40:29] brandoncc: since it says I am logged in and I logged in using a standard request, not ajax...then I believe they are yes
[04:41:43] brandoncc: the ajax request carries the X-CSRF-TOKEN as it should and the cookie
[04:44:12] brandoncc: hmmm I just figured out that some values seem to persist and others don't...the plot thickens!
[04:44:42] sevenseacat: do the keys for the ones that don't have some kind of dodgy property? or weird non-serializable value?
[04:45:43] brandoncc: they are all arrays of strings
[04:46:35] brandoncc: actually, scratch that, none are persisting
[04:46:46] brandoncc: one was coming from a local rehydrate so it tricked me
[04:47:09] sevenseacat: ok so what are you using as a session store?
[04:47:22] brandoncc: rails 5 default, so I believe it would be cookie store
[04:47:39] brandoncc: ACTION guesses you are about to say use redis
[04:47:48] sevenseacat: are you trying to store too much data for the cookie? cookies are limited to 4kb
[04:48:06] brandoncc: {"shape"=>["B"], "price"=>["2293", "44000"], "symmetry"=>["VG", "G", "F"], "polish"=>["EX", "VG"]}
[04:48:10] brandoncc: this is the before data
[04:48:15] brandoncc: {"shape"=>["PR", "M", "P", "R", "E", "C", "H", "B"], "price"=>["2893", "44000"], "carat"=>["0.34", "12.65"], "symmetry"=>["VG", "G", "F"], "polish"=>["EX", "VG"]}
[04:48:17] brandoncc: this is after
[04:48:21] brandoncc: not much data
[04:48:53] brandoncc: the before data is the same on every request though of course
[04:48:56] reber: has joined #RubyOnRails
[04:49:05] brandoncc: (not supposed to be)
[04:49:08] sevenseacat: do you see the cookie change after the request?
[04:49:13] sevenseacat: cookie data that is
[04:49:24] brandoncc: the base64 value you mean, right?
[04:49:24] sevenseacat: and the next request uses the new cookie?
[04:49:54] brandoncc: I didn't think about looking at that
[04:50:01] brandoncc: I forgot I can look at the cookie
[04:51:41] brandoncc: you know...chrome says the cookie expires 1969...I wonder if that could have anything to do with it
[04:52:11] reber: has joined #RubyOnRails
[04:52:27] baweaver: The mighty epoch!
[04:52:51] brandoncc: I'm guessing there must be a setting I have never needed to change that is causing this
[04:53:32] sevenseacat: that sounds mighty suspicious
[04:53:50] brandoncc: I think I am going to delete the cookie and see if it recreates with no issue
[04:54:11] brandoncc: recreates with epoch
[04:54:30] brandoncc: weird, I have other localhost cookies from rails apps with cookie expirations in the future in the same list
[04:55:29] brandoncc: this is the only app that uses react_on_rails though....I wonder if there is something weird in that config
[04:56:44] quazimodo: has joined #RubyOnRails
[04:57:06] brandoncc: firefox lists the expiration of the same cookie as "Session"
[04:58:06] brandoncc: I guess that is why the weird date
[04:59:07] brandoncc: I take that back another rails app lists it as epoch too
[04:59:12] brandoncc: so that isn't the problem
[04:59:36] sevenseacat: are you quite sure?
[05:00:04] brandoncc: well, the ajax request definitely includes the cookie as I am still logged in...so it seems like it
[05:00:39] brandoncc: at this point I can't be 100% of anything though
[05:00:43] sevenseacat: expired cookies definitely sound like a problem to me
[05:01:00] brandoncc: it isn't listed as expired in firefox though, only as "Session"
[05:01:15] brandoncc: I think maybe it lacks an expiration date and chrome has a default of epoch
[05:01:23] brandoncc: rather than a blank ui value
[05:01:38] sevenseacat: so those will expire on browser close
[05:02:21] brandoncc: interesting....the size of the cookie changes properly
[05:02:43] brandoncc: so that means axios must be caching the cookie and sending the same one over and over
[05:03:17] brandoncc: I bet that is because I am using axios instances
[05:04:21] sevenseacat: I don't know what axios is, so
[05:04:54] brandoncc: testing that theory now
[05:05:08] brandoncc: axios is a library much like fetch
[05:05:16] brandoncc: just ajax requests
[05:05:29] sevenseacat: ok. i was about to say 'that comparison doesnt help' lol
[05:06:17] brandoncc: it is probably going to be replaced by the Request browser API eventually if that helps any more lol
[05:06:25] brandoncc: https://developer.mozilla.org/en-US/docs/Web/API/Request
[05:07:37] brandoncc: ohhhh the size is the base64 character length, duh lol
[05:07:41] brandoncc: my guess was wrong :-(
[05:09:11] brandoncc: ohhhhhh I know what the problem is
[05:09:17] brandoncc: I think anyway
[05:09:29] brandoncc: I fire off 2 requests simultaneously
[05:09:50] brandoncc: I think the cookie in the response from one (with no session change) is clobbering the other one
[05:11:36] brandoncc: I guess the easiest way to check that is to stop sending one of the requests
[05:13:18] brandoncc: indeed, I had a race condition!
[05:13:30] brandoncc: thanks a ton, you helped a lot!
[05:14:00] sevenseacat: glad I could help!
[05:14:49] duderonomy: has joined #RubyOnRails
[05:18:18] lexileo: has joined #RubyOnRails
[05:18:20] ur5us: has joined #RubyOnRails
[05:19:16] brandoncc: For the record, the solution was to add `jar: false` to my axios request options. Thanks again!@
[05:21:41] brandoncc: bah, maybe not lol
[05:45:54] nemesit: has joined #RubyOnRails
[06:38:02] duderonomy: has joined #RubyOnRails
[06:43:14] dionysus69: has joined #RubyOnRails
[06:53:36] silent_freak: has joined #RubyOnRails
[06:55:01] duderonomy: has joined #RubyOnRails
[06:57:25] duderonomy: has joined #RubyOnRails
[07:00:54] duderonomy: has joined #RubyOnRails
[07:07:38] roshanavand: has joined #RubyOnRails
[07:11:35] sandstrom: has joined #RubyOnRails
[07:13:33] srinidhi: has joined #RubyOnRails
[07:16:23] dionysus69: I've been criticized for using javascript globals, I only use couple really not that many, so what's the other proper way to pass data to a javascript var?
[07:16:32] Dbugger: has joined #RubyOnRails
[07:23:39] dionysus69: baweaver: but that means an extra call, sounds inefficient doesn't it?
[07:24:21] baweaver: You pre-load the data from Rails directly in the template
[07:24:27] baweaver: That's called server-side rendering
[07:24:37] baweaver: When you need to _replace_ it is when you call AJAX
[07:25:32] dionysus69: baweaver: interesting, lemme try
[07:25:51] baweaver: That's why you tag areas on your page for jQuery to sub out
[07:26:01] baweaver: Though really it depends a lot on what precisely you're doing
[07:26:09] dionysus69: just setting a settings var
[07:26:15] dionysus69: like 0.2 in var
[07:26:34] baweaver: You could just make it a JSON config.
[07:27:18] baweaver: What are the settings for?
[07:27:42] dionysus69: for some function in javascript function which resides in action cable channel.js
[07:28:24] dionysus69: so I dont know how I would assign a var on certain page load but use it in a function which is in asset pipeline
[07:28:35] dionysus69: I get scoping problem without global :S
[07:28:59] quazimodo: has joined #RubyOnRails
[07:29:12] dionysus69: so far from you said I understood I'd call ajax and save the results in a var :D which is the same problem I started with :)
[07:29:53] sevenseacat: if we know what problem you were trying to solve, we might be able to offer more nuanced advice.
[07:30:19] dionysus69: yea sorry, I assumed you knew more than you did :D
[07:30:45] dionysus69: I mean, about my case
[07:32:49] dionysus69: or perhaps I could make a js.erb file and render setting var in asset pipeline directly?
[07:33:00] dionysus69: is that legit? :D
[07:33:37] sevenseacat: again, what problem are you trying to solve?
[07:34:47] dionysus69: well there's a transaction fee for a transaction, so I need to take that into account in some function which is in asset pipeline, but I dont get how do I pass that fee amount to the js, that's all
[07:35:25] dionysus69: I'd use global before now but trying to upgrade this particular flow
[07:35:29] sevenseacat: data attributes might be a way. write it into the HTML, then read it out with JS
[07:35:43] sevenseacat: where does this transaction fee come from?
[07:35:56] dionysus69: hell yea, simple but genius, how didn't I think of that :D
[07:36:11] dionysus69: it comes from Setting.some_fee rails settings cached gem
[07:36:34] dionysus69: ok that makes perfect sense sevenseacat, thanks I'll go that way
[07:36:49] dionysus69: hidden field I guess
[07:37:22] dionysus69: I'd render value in hidden field and then read it with js
[07:37:27] sevenseacat: how do you take what I say and interpret something totally different
[07:37:41] dionysus69: you said write it into HTML :D
[07:37:47] dionysus69: what else could you possibly mean :D
[07:37:53] sevenseacat: with a data attribute. where did you get form fields from?
[07:38:11] dionysus69: right, data attribute :D
[07:39:29] dionysus69: not really using them often so, my bad, anyway thanks again
[07:44:34] egray: has joined #RubyOnRails
[07:44:59] quazimodo: has joined #RubyOnRails
[08:10:09] mikecmpbll: has joined #RubyOnRails
[08:14:16] quazimodo: has joined #RubyOnRails
[08:16:35] apeiros: has joined #RubyOnRails
[08:29:42] Guest58115: has joined #RubyOnRails
[08:32:34] beholders_eye: has joined #RubyOnRails
[08:33:49] beholders_eye: has joined #RubyOnRails
[08:34:18] syndikate: Is there any naming convention for boolean field?
[08:35:23] quazimodo: has joined #RubyOnRails
[08:43:45] beholders_eye: has joined #RubyOnRails
[08:47:35] uks: has joined #RubyOnRails
[09:38:55] Turnikov: has joined #RubyOnRails
[09:44:59] Ergo: has joined #RubyOnRails
[10:30:20] quazimodo: has joined #RubyOnRails
[10:43:45] lankanmon: has joined #RubyOnRails
[11:06:51] apeiros: has joined #RubyOnRails
[11:22:34] roshanavand: has joined #RubyOnRails
[11:39:13] roshanavand: has joined #RubyOnRails
[11:40:23] roshanavand: has joined #RubyOnRails
[11:44:24] roshanavand: has joined #RubyOnRails
[11:51:23] Sylario: has joined #RubyOnRails
[12:00:43] pulgolino: has joined #RubyOnRails
[12:12:20] noob_on_rails: has joined #RubyOnRails
[12:15:36] dblessing: has joined #RubyOnRails
[12:40:59] Xiti: has joined #RubyOnRails
[12:47:01] srinidhi: has joined #RubyOnRails
[12:48:50] DTZUZO: has joined #RubyOnRails
[12:58:41] jottr: has joined #RubyOnRails
[13:05:01] kapil___: has joined #RubyOnRails
[13:24:54] Technodrome: has joined #RubyOnRails
[13:53:40] cschneid_: has joined #RubyOnRails
[13:54:17] beholders_eye: has joined #RubyOnRails
[13:54:30] drale2k_: has joined #RubyOnRails
[13:54:58] kentt: has joined #RubyOnRails
[13:57:03] Saukk: has joined #RubyOnRails
[14:03:21] morfin60: has joined #RubyOnRails
[14:04:39] quazimodo: has joined #RubyOnRails
[14:05:09] morfin60: can you help me with my dilemma: i am using ActiveStorage to save files locally, but when i attach file to model i just instantly save blob and attachment records. I also have my own validation on model owning this attachment so it can't be saved if file validation failed
[14:05:46] morfin60: but when i call save i do photo.purge but since there is an errors transaction gets rolled back and delete as well
[14:06:53] kentt: Hi. Looking for some advice as to whether the following is the expected behaviour and if so, why https://gist.github.com/hirowatari/5598d3d8af2d4c21d98ca01abec103be. Thanks for looking.
[14:07:36] morfin60: how do i delete unnessesary record without having DELETE rolled back because validation failed?
[14:27:27] bijan_: has joined #RubyOnRails
[14:32:20] bijan_: Hi I have a controller class Manager::ShopsController < ManagerController. What is the default layout path if I want to override it's layout? The Manager controller layout is views/layouts/manager.html.erb and I tried views/layouts/manager/shops.html.erb but this one is not picked up..
[14:34:37] bijan_: Or anyone knows where the code for layout lookup is implemented in rails?
[14:38:31] regedit: has joined #RubyOnRails
[14:39:26] apeiros_: has joined #RubyOnRails
[14:43:34] bijan_: Wait my approach works... Just needed to restart the webserver lol
[14:48:36] cayuse: has joined #RubyOnRails
[14:49:15] morfin60: nvm i made this in after_rollback callback
[14:51:26] blackmesa: has joined #RubyOnRails
[14:53:44] cayuse: hi y'all, i'm trying to figure out the correct way to have two models that are joined in two different ways (i'm not even sure what it's called) but I have a User and Competition model. i want competitions to have an owner (a user with foreign key) but also have "users" who are competiting in the competition, so has_many :through user_competitions.. but I want all 4 of the implied types of memberships user has_many competitions
[14:54:28] v01d4lph4: has joined #RubyOnRails
[14:55:21] Dbugger: has joined #RubyOnRails
[15:01:08] bijan_: has joined #RubyOnRails
[15:05:19] Technodrome: has joined #RubyOnRails
[15:29:26] Puffball: has joined #RubyOnRails
[15:45:16] duderonomy: has joined #RubyOnRails
[15:51:07] desperek: has joined #RubyOnRails
[16:06:40] s2013: has joined #RubyOnRails
[16:08:28] Guest58115: has joined #RubyOnRails
[16:10:03] duderonomy: has joined #RubyOnRails
[16:10:21] orbyt_: has joined #RubyOnRails
[16:21:35] conta2: has joined #RubyOnRails
[16:23:12] orbyt_: has joined #RubyOnRails
[16:23:24] Guest58115: has joined #RubyOnRails
[16:25:15] brandoncc: has joined #RubyOnRails
[16:33:19] Guest58115: has joined #RubyOnRails
[16:36:23] quazimodo: has joined #RubyOnRails
[16:39:55] havenwood: has joined #RubyOnRails
[16:40:58] duderonomy: has joined #RubyOnRails
[16:43:17] Guest58115: has joined #RubyOnRails
[16:53:23] Guest58115: has joined #RubyOnRails
[16:56:31] jkprg: has joined #RubyOnRails
[16:59:13] jkprg: hi! any actioncable genius around? I have problem with message processing in AC. It seems to me messages are not processed in the same order as they arrived ftrom client.
[17:00:42] jkprg: moreover messages are not started to be processed in the same order. Is there any way how to serialize message processing for particular channel?
[17:02:35] quazimodo: has joined #RubyOnRails
[17:03:22] Guest58115: has joined #RubyOnRails
[17:11:07] ams__: has joined #RubyOnRails
[17:13:33] Guest58115: has joined #RubyOnRails
[17:21:20] eckhardt: has joined #RubyOnRails
[17:23:33] Guest58115: has joined #RubyOnRails
[17:23:39] spohnz: has left #RubyOnRails: ("Leaving channel")
[17:26:42] cagomez: has joined #RubyOnRails
[17:29:20] defsdoor: has joined #RubyOnRails
[17:31:53] duderonomy: has joined #RubyOnRails
[17:33:32] Guest58115: has joined #RubyOnRails
[17:34:40] orbyt_: has joined #RubyOnRails
[17:37:29] duderonomy: has joined #RubyOnRails
[17:38:47] morfin60: after_rollback and on does not combine?
[17:39:11] morfin60: i wanted to do after_rollback :purge_attachments, on: [:create]
[17:39:19] morfin60: but seems like i can't do that
[17:39:39] duderonomy: has joined #RubyOnRails
[17:39:40] lomex: has joined #RubyOnRails
[17:42:55] havenwood: has joined #RubyOnRails
[17:43:12] Guest58115: has joined #RubyOnRails
[17:45:29] dviola: has joined #RubyOnRails
[17:53:24] Guest58115: has joined #RubyOnRails
[18:03:08] duderonomy: has joined #RubyOnRails
[18:03:24] Guest58115: has joined #RubyOnRails
[18:05:33] dblessing: has joined #RubyOnRails
[18:07:30] jkprg: has joined #RubyOnRails
[18:13:27] Guest58115: has joined #RubyOnRails
[18:15:08] s2013: has joined #RubyOnRails
[18:15:31] v01d4lph4: has joined #RubyOnRails
[18:16:06] Linuus: has joined #RubyOnRails
[18:23:18] Guest58115: has joined #RubyOnRails
[18:33:17] Guest58115: has joined #RubyOnRails
[18:40:29] mikecmpbll: has joined #RubyOnRails
[18:43:28] Guest58115: has joined #RubyOnRails
[18:48:10] ariedler: has joined #RubyOnRails
[19:05:55] sandstrom: has joined #RubyOnRails
[19:10:44] LiftLeft2: has joined #RubyOnRails
[19:24:17] sameerynho: has joined #RubyOnRails
[19:25:34] jkprg: has joined #RubyOnRails
[19:37:57] duderonomy: has joined #RubyOnRails
[19:43:46] brent__: has joined #RubyOnRails
[19:44:36] s2013: has joined #RubyOnRails
[19:49:46] ellcs: has joined #RubyOnRails
[19:55:51] cayuse: so a lot earlier, i asked this question:
[19:55:53] cayuse: hi y'all, i'm trying to figure out the correct way to have two models that are joined in two different ways (i'm not even sure what it's called) but I have a User and Competition model. i want competitions to have an owner (a user with foreign key) but also have "users" who are competiting in the competition, so has_many :through user_competitions.. but I want all 4 of the implied types of memberships user has_many competitions
[19:56:49] cayuse: i have gotten most of the way to doing what i want, here is a gist for the user.rb and competition.rb https://gist.github.com/cayuse/f94e277f635c425b1d69394636fbf559 i'm down to the has_many :comps line in the user.rb not working, can anyone tell me what i'm doing wrong here (the other associations seem to be behaving as expected)
[19:57:19] magellanicloud: has joined #RubyOnRails
[19:59:20] ShekharReddy: has joined #RubyOnRails
[20:06:55] jkprg: has joined #RubyOnRails
[20:17:20] wojnar: has joined #RubyOnRails
[20:24:40] jkprg: has joined #RubyOnRails
[20:34:28] cayuse: OMG i finally figured it out.. you have to reload! in console now? When did that start?
[20:39:01] jrich523: has joined #RubyOnRails
[20:51:23] dionysus69: has joined #RubyOnRails
[20:58:23] ur5us: has joined #RubyOnRails
[20:59:07] Guest58115: has joined #RubyOnRails
[20:59:40] eckhardt: has joined #RubyOnRails
[21:01:06] jottr: has joined #RubyOnRails
[21:11:53] duderonomy: has joined #RubyOnRails
[21:12:44] duderonomy: has joined #RubyOnRails
[21:13:32] duderonomy: has joined #RubyOnRails
[21:14:01] dblessing: has joined #RubyOnRails
[21:14:47] duderonomy: has joined #RubyOnRails
[21:20:34] duderonomy: has joined #RubyOnRails
[21:22:54] salasrod: has joined #RubyOnRails
[21:37:20] dblessing: has joined #RubyOnRails
[21:40:24] eckhardt: has joined #RubyOnRails
[21:48:04] Technodrome: has joined #RubyOnRails
[22:01:05] v01d4lph4: has joined #RubyOnRails
[22:03:12] lomex: has joined #RubyOnRails
[22:14:56] timdotrb: has joined #RubyOnRails
[22:15:10] timdotrb: Evening, all
[22:15:35] timdotrb: Does anyone know if it’s possible to get the min and max values for a column in a single query?
[22:15:52] timdotrb: Would I have to write the SQL myself?
[22:24:35] aesthetikx: there is min and max in activerecord i believe
[22:24:51] aesthetikx: not at the same time though
[22:25:11] aesthetikx: Result.max(:score) should give you a max score, for example
[22:25:53] aesthetikx: but you might be able to try x = Result.select('min(score) as min_score, max(score) as max_score'); x.min_score; x.max_score for example timdotrb
[22:26:26] aesthetikx: haven't tried it though
[22:28:12] timdotrb: aesthetikx: yea, I’m currently using min and max in two separate database calls, but I want to make this more efficient. I also want to add more conditions, but figured I’d start with the simplest form of my problem
[22:29:25] aesthetikx: iirc if you do select('whatever as thing') in AR it will define #thing on each element in the result, so you can do a lot that way
[22:29:45] aesthetikx: but you do have to type sql strings which i know is icky
[22:33:47] timdotrb: I’m trying that, as well as writing the full SQL query, but they are both returning a nil object
[22:34:02] timdotrb: Even though when I execute the query on the actual database, it returns the data I want
[22:34:02] aesthetikx: let me spool up a console and take a gander
[22:34:06] timdotrb: So I know the query is good
[22:34:37] timdotrb: It’s like AR is panicking because it doesn’t get an ID back
[22:37:06] aesthetikx: hmm yeah im noticing something similar
[22:38:03] timdotrb: I don’t want or need an ID, I just need the values lol
[22:38:22] aesthetikx: right yeah I forgot min and max are aggregate funcitons
[22:38:30] aesthetikx: so its looking for a group clause
[22:40:04] aesthetikx: maybe just make 2 queries :)
[22:40:28] timdotrb: Well, the problem is I want 6 values
[22:40:36] aesthetikx: alternatively you could define a view in the database and use the scenic gem
[22:40:39] timdotrb: So I am trying to get out of executing 6 queries
[22:42:08] aesthetikx: ActiveRecord::Base.connection.execute('select min(users.id) as min_id, max(users.id) as max_id from users;').first
[22:42:14] aesthetikx: gives a hash
[22:44:15] timdotrb: That could work
[22:46:21] timdotrb: That cuts it down to 3 queries that I have to execute. Now to figure out the SQL to make it 1..
[22:46:27] timdotrb: Or be satisfied with 3 queries
[22:46:36] aesthetikx: sql is tough for sure
[22:46:44] aesthetikx: you doing like statistics, quartiles avgs etc?
[22:49:31] timdotrb: Nah, it’s much more simple :) I want the min and max values for a column for: last 24 hours, last 7 days, last 1 month
[22:51:08] aesthetikx: my first thought would be like sql window functions but yeah this would be google territory for me
[22:52:52] aesthetikx: or you could write somethign along the lines of 'with (select val from table where created_at > 24) as day, (select val from table where created at > 7 days) as week, (... > 1 month) as month, select min(day.val) as min_day, min(week.val) as min_val, min(month.val) as min_month;
[22:52:55] aesthetikx: etc you get the idea
[22:55:19] srruby: has joined #RubyOnRails
[22:58:26] s2013: has joined #RubyOnRails
[22:59:54] Guest58115: has joined #RubyOnRails
[23:01:41] jkprg: has joined #RubyOnRails
[23:07:42] ivanskie: has joined #RubyOnRails
[23:10:02] egray: has joined #RubyOnRails
[23:16:49] timdotrb: has joined #RubyOnRails
[23:17:35] timdotrb: has joined #RubyOnRails
[23:18:19] timdotrb: has joined #RubyOnRails
[23:19:19] timdotrb: has joined #RubyOnRails
[23:19:54] timdotrb: has joined #RubyOnRails
[23:20:41] timdotrb: has joined #RubyOnRails
[23:21:02] DTZUZO: has joined #RubyOnRails
[23:21:29] timdotrb: has joined #RubyOnRails
[23:22:14] timdotrb: has joined #RubyOnRails
[23:22:36] eckhardt: has joined #RubyOnRails
[23:22:59] timdotrb: has joined #RubyOnRails
[23:23:44] timdotrb: has joined #RubyOnRails
[23:24:34] timdotrb: has joined #RubyOnRails
[23:25:20] DTZUZO: has joined #RubyOnRails
[23:25:29] timdotrb: has joined #RubyOnRails
[23:26:09] timdotrb: has joined #RubyOnRails
[23:27:02] baweaver: !connection timdotrb
[23:27:05] timdotrb: has joined #RubyOnRails
[23:27:14] baweaver: Riiiiiight, no nice bots
[23:27:39] timdotrb: has joined #RubyOnRails
[23:28:25] timdotrb: has joined #RubyOnRails
[23:29:14] timdotrb: has joined #RubyOnRails
[23:30:08] timdotrb: has joined #RubyOnRails
[23:30:49] timdotrb: has joined #RubyOnRails
[23:31:27] ellcs: has joined #RubyOnRails
[23:39:54] jottr: has joined #RubyOnRails
[23:44:19] s2013: {"error":"You need to sign in or sign up before continuing."} i keep getting that.. i have no idea why.. i shouldnt need to sign in
[23:44:24] s2013: to access that particular controller
[23:58:17] Caerus: s2013, hard to say without looking at the code but by the looks of it you need to check the controller for a before_action call to something like :authenticate_user
[23:58:51] Caerus: oh, he´s gone