« Back to channel list

#RubyOnRails - 06 December 2018

« Back 1 day Forward 1 day »
[00:01:10] gavit: has joined #RubyOnRails
[00:07:05] NivenHuH: has joined #RubyOnRails
[00:19:56] ur5us: has joined #RubyOnRails
[00:34:09] beowuff: has joined #RubyOnRails
[00:38:10] cnsvc: has joined #RubyOnRails
[00:53:12] crankharder: has joined #RubyOnRails
[01:00:45] sevenseacat: has joined #RubyOnRails
[01:22:05] mangold: has joined #RubyOnRails
[01:22:17] jetchisel: has joined #RubyOnRails
[01:25:13] alan_w: has joined #RubyOnRails
[01:26:42] openstruct: has joined #RubyOnRails
[02:03:41] andrewray: has joined #RubyOnRails
[02:03:58] andrewray: Is this redundant? File.open(Tempfile.new())
[02:18:42] andrewray: I'm calling file.close then File.delete(file) and I'm getting this answer
[02:38:38] DTZUZO: has joined #RubyOnRails
[02:49:40] hays: has joined #RubyOnRails
[02:49:57] jgpawletko: has joined #RubyOnRails
[02:55:26] ivanskie: has joined #RubyOnRails
[03:12:44] DTZUZO: has joined #RubyOnRails
[03:14:14] jetchisel: has joined #RubyOnRails
[03:17:05] jetchisel: has joined #RubyOnRails
[03:19:18] jetchisel: has joined #RubyOnRails
[03:22:08] jetchisel: has joined #RubyOnRails
[03:24:51] knight33: has joined #RubyOnRails
[03:24:53] jetchisel: has joined #RubyOnRails
[03:27:24] jetchisel: has joined #RubyOnRails
[03:29:43] jetchisel: has joined #RubyOnRails
[03:32:44] jetchisel: has joined #RubyOnRails
[03:32:49] scrptktty: has joined #RubyOnRails
[03:35:09] jetchisel: has joined #RubyOnRails
[03:37:22] jetchisel: has joined #RubyOnRails
[03:39:41] jetchisel: has joined #RubyOnRails
[03:42:06] jetchisel: has joined #RubyOnRails
[03:44:24] jetchisel: has joined #RubyOnRails
[03:45:42] gambl0r3: has joined #RubyOnRails
[03:46:40] jetchisel: has joined #RubyOnRails
[03:48:59] jetchisel: has joined #RubyOnRails
[03:54:01] NivenHuH: has joined #RubyOnRails
[03:55:16] alan_w: has joined #RubyOnRails
[04:10:27] braincrash: has joined #RubyOnRails
[04:27:15] ivanskie: has joined #RubyOnRails
[04:28:49] jetchisel: has joined #RubyOnRails
[04:28:58] KeyJoo: has joined #RubyOnRails
[04:38:01] jenrzzz: has joined #RubyOnRails
[04:38:45] jenrzzz: has joined #RubyOnRails
[04:40:22] bambanx: has joined #RubyOnRails
[04:42:48] alan_w: has joined #RubyOnRails
[05:23:07] uks: has joined #RubyOnRails
[05:38:48] mangold: has joined #RubyOnRails
[05:41:20] Saukk: has joined #RubyOnRails
[05:49:47] paranoicsan: has joined #RubyOnRails
[05:59:51] cgfbee: has joined #RubyOnRails
[06:11:00] jenrzzz: has joined #RubyOnRails
[06:16:43] conta: has joined #RubyOnRails
[06:23:42] jenrzzz: has joined #RubyOnRails
[06:32:25] akosednar: has joined #RubyOnRails
[06:54:42] gambl0r3: has joined #RubyOnRails
[07:20:51] srinidhi: has joined #RubyOnRails
[07:31:19] bijan_: has joined #RubyOnRails
[07:53:49] ur5us: has joined #RubyOnRails
[07:58:15] akosednar: has joined #RubyOnRails
[08:02:59] bijan_: has joined #RubyOnRails
[08:08:07] jenrzzz: has joined #RubyOnRails
[08:11:01] roshanavand: has joined #RubyOnRails
[08:13:51] roshanavand1: has joined #RubyOnRails
[08:15:40] bijan_: has joined #RubyOnRails
[08:20:19] bijan_: has joined #RubyOnRails
[08:33:08] paranoicsan: has joined #RubyOnRails
[08:40:18] bijan_: has joined #RubyOnRails
[08:44:38] bijan__: has joined #RubyOnRails
[08:50:24] ur5us: has joined #RubyOnRails
[08:51:37] mikecmpbll: has joined #RubyOnRails
[08:53:28] bijan_: has joined #RubyOnRails
[08:55:42] booboy: has joined #RubyOnRails
[09:02:01] bijan___: has joined #RubyOnRails
[09:04:06] xMopx: has joined #RubyOnRails
[09:04:29] gavit: has joined #RubyOnRails
[09:05:58] Ergo: has joined #RubyOnRails
[09:06:17] bijan_: has joined #RubyOnRails
[09:08:33] dtzuzu: has joined #RubyOnRails
[09:10:40] bijan__: has joined #RubyOnRails
[09:19:32] bijan_: has joined #RubyOnRails
[09:32:08] kapil____: has joined #RubyOnRails
[09:36:16] akosednar: has joined #RubyOnRails
[09:36:44] ur5us: has joined #RubyOnRails
[09:56:34] roshanavand: has joined #RubyOnRails
[10:06:02] paranoicsan: has joined #RubyOnRails
[10:16:30] cnsvc: has joined #RubyOnRails
[10:28:50] bijan_: has joined #RubyOnRails
[10:53:21] srinidhi: has joined #RubyOnRails
[10:55:57] bijan_: has joined #RubyOnRails
[10:56:15] gavit_: has joined #RubyOnRails
[11:00:55] bijan_: has joined #RubyOnRails
[11:05:57] conta: has joined #RubyOnRails
[11:22:25] bijan_: has joined #RubyOnRails
[11:23:56] lxsameer: has joined #RubyOnRails
[11:33:38] lexileo: has joined #RubyOnRails
[11:36:10] paranoicsan: has joined #RubyOnRails
[11:39:11] gavit: has joined #RubyOnRails
[11:43:00] cnsvc: has joined #RubyOnRails
[11:44:38] Ropeney_: has joined #RubyOnRails
[11:56:11] beholders_eye: has joined #RubyOnRails
[12:09:16] kapil____: has joined #RubyOnRails
[12:19:13] bijan_: has joined #RubyOnRails
[12:22:16] bijan_: has joined #RubyOnRails
[12:23:45] paranoicsan: has joined #RubyOnRails
[12:31:10] bijan_: has joined #RubyOnRails
[12:44:19] bijan_: has joined #RubyOnRails
[12:48:55] Saukk: has joined #RubyOnRails
[12:54:14] dslegends: has joined #RubyOnRails
[12:56:41] defsdoor: has joined #RubyOnRails
[13:08:20] bijan_: has joined #RubyOnRails
[13:09:43] _aeris_: has joined #RubyOnRails
[13:15:05] Magir01: has joined #RubyOnRails
[13:15:17] Magir01: Всем Привет
[13:17:16] bijan_: has joined #RubyOnRails
[13:18:58] roshanavand1: has joined #RubyOnRails
[13:24:35] tuor: has joined #RubyOnRails
[13:24:57] bijan_: has joined #RubyOnRails
[13:33:25] bijan__: has joined #RubyOnRails
[13:33:49] jsc: has joined #RubyOnRails
[13:40:02] mostlybadfly: has joined #RubyOnRails
[13:45:56] bijan_: has joined #RubyOnRails
[13:50:00] bijan_: has joined #RubyOnRails
[13:50:38] conta2: has joined #RubyOnRails
[13:50:45] Ropeney: has joined #RubyOnRails
[13:53:04] cnsvc: has joined #RubyOnRails
[14:02:27] bijan_: has joined #RubyOnRails
[14:06:32] bijan__: has joined #RubyOnRails
[14:11:32] conta2: has joined #RubyOnRails
[14:15:54] sheepman: has joined #RubyOnRails
[14:59:38] mangold: has joined #RubyOnRails
[15:11:21] paranoicsan: has joined #RubyOnRails
[16:23:08] cnsvc: has joined #RubyOnRails
[16:27:42] KeyJoo: has joined #RubyOnRails
[16:44:45] Dbugger: has joined #RubyOnRails
[16:54:33] bijan_: has joined #RubyOnRails
[16:55:31] jaddison: has joined #RubyOnRails
[17:07:07] bijan_: has joined #RubyOnRails
[17:11:04] noob_on_rails: has joined #RubyOnRails
[17:11:48] weaksauce: has joined #RubyOnRails
[17:11:48] bijan__: has joined #RubyOnRails
[17:12:04] noob_on_rails: hey all, can i declare a string like str = 'hello my name is :name' and then declare name = john and then puts str #=> 'hello my name is john' ?
[17:12:55] noob_on_rails: without eval maybe
[17:21:10] bijan_: has joined #RubyOnRails
[17:26:33] Andr3as: hi all.. i have a string like 'ESZ8-CME' and i have a model where i want to store a string "pattern" like 'ES??-CME' .. what i want to achieve is to find the corresponding element when i query for 'ESZ8-CME'
[17:27:02] Andr3as: anyone a tip how to approach that? i did some google research but am stuck, somewhat..
[17:34:22] bijan_: has joined #RubyOnRails
[17:45:12] hammer065: has joined #RubyOnRails
[17:46:50] bijan_: has joined #RubyOnRails
[17:47:26] bijan__: has joined #RubyOnRails
[17:51:16] bijan_: has joined #RubyOnRails
[17:53:09] Andr3as: i found the match method..
[17:53:27] Andr3as: when i change the pattern to like ES..-CME it should do the trick
[17:53:37] Andr3as: with something like BrokerInstrument.where(broker: broker).each {|bi| puts bi.id if te[1][2].match(bi.symbol) }
[18:04:05] bijan_: has joined #RubyOnRails
[18:19:21] Inside: has joined #RubyOnRails
[18:19:30] Inside: all my unit tests passed after a big code change
[18:19:35] Inside: what did I break...
[18:20:50] bijan_: has joined #RubyOnRails
[18:29:33] bijan_: has joined #RubyOnRails
[18:37:04] eckhardt_: has joined #RubyOnRails
[18:38:08] bijan_: has joined #RubyOnRails
[18:42:19] bijan__: has joined #RubyOnRails
[18:44:44] lexileo: has joined #RubyOnRails
[18:53:17] cnsvc: has joined #RubyOnRails
[19:06:26] reber: has joined #RubyOnRails
[19:11:15] gambl0r3: has joined #RubyOnRails
[19:15:35] bijan_: has joined #RubyOnRails
[19:17:17] orbyt_: has joined #RubyOnRails
[19:17:19] elcontrastador: has joined #RubyOnRails
[19:20:10] elcontrastador: When using a javascript library, like chart.js, is it typical practice to use erb to load the data in the script? Is it common practice to write a rest api and pull with native js?
[19:20:15] bijan_: has joined #RubyOnRails
[19:20:49] mostlybadfly: has joined #RubyOnRails
[19:22:09] Inside: elcontrastador: I uses google_visualr and it blerps the data via erb into the page
[19:23:04] elcontrastador: inside: checking it out now. Thanks for response!
[19:25:29] elcontrastador: inside: The charts require flash?
[19:25:34] Inside: You're looking for a function called render_chart
[19:26:17] Inside: I don't think so at least - It's a wrapper around the google charting library
[19:26:47] elcontrastador: http://googlevisualr.herokuapp.com/examples/interactive/annotated_time_line
[19:28:32] Inside: might be old docs
[19:28:35] Inside: but maybe not
[19:28:41] Inside: https://developers.google.com/chart/interactive/docs/gallery/annotatedtimeline?csw=1 seems to be js
[19:28:53] elcontrastador: looks like it may be ONLY the sample chart i first picked
[19:29:05] elcontrastador: others are working
[19:29:18] Inside: it hasn't been updated in 3 years though D:
[19:29:43] elcontrastador: http://googlevisualr.herokuapp.com/examples/interactive/calendar
[19:29:48] elcontrastador: this one is bomb
[19:30:08] mikecmpbll: has joined #RubyOnRails
[19:30:14] Inside: how have I not seen this before
[19:31:02] elcontrastador: that is exactly what i need for one chart...was trying to figure out best way to show it...this is so clear
[19:32:37] RedNifre: has joined #RubyOnRails
[19:33:24] RedNifre: What's a good way to learn Rails if you have medium knowledge of web frameworks and ruby?
[19:34:29] Inside: skim through Michael Hartl's Rails Tutorial
[19:34:32] Inside: seems to be the go-to thing
[19:34:39] Inside: how did you learn ruby if not through rails?
[19:35:01] elcontrastador: I'd say poke around Udemy and feel out where your skills are...rails guides (https://guides.rubyonrails.org/) and Rails API (https://api.rubyonrails.org/) and Ruby Docs (https://ruby-doc.org/core-2.5.3/)
[19:36:13] bijan_: has joined #RubyOnRails
[19:40:56] bijan_: has joined #RubyOnRails
[19:41:05] elcontrastador: inside: Check out chart_kick
[19:41:28] Inside: I've used it before
[19:41:32] Inside: I'm trying to remember why I went away
[19:55:30] RedNifre: I learned ruby because I needed to do some simple things.
[19:55:40] RedNifre: So far I only used it for small to medium sized things.
[19:56:06] RedNifre: E.g. a Jira automation, some raspberry Pi LED blinking stuff, some media ingest etc.
[19:56:16] Wixy: has joined #RubyOnRails
[19:56:22] elcontrastador: ruby rocks....i use it constantly...ex-Perl fanatic...been using Ruby for years...dabble in rails
[19:57:07] Wixy: Does Rails support upserts? I want to create or update a record in an atomic way, or else just replace it, I'll provide all attributes again. The thing is I want to do it in one statement only
[19:58:31] RedNifre: Yeah, I noticed that even though I never learned Ruby properly it's still my go to language for getting something simple done quickly. So I wondered if I should give it a closer look regarding doing large things with it, hence Rails.
[19:59:10] RedNifre: (Usually I use heavy weight statically typed languages for larger things)
[20:04:58] aghalarp: has joined #RubyOnRails
[20:06:18] Inside: I love ruby too
[20:06:25] Inside: I'm just curious what people use it for outside of rails
[20:06:35] Inside: I've written apps with QTRuby
[20:07:49] Inside: Wixy: I mean, you can write your own code to do that?
[20:08:26] Wixy: Inside, yeah, but not if there's one builtin
[20:08:31] Inside: afail, no
[20:08:35] Inside: afaik, no
[20:08:57] Wixy: weird, it's really useful in so many use cases
[20:09:24] Wixy: not sure about MySQL but PosgreSQL has upserts
[20:09:31] RedNifre: it basically replaced bash for me completely, especially since you can write `inline bash like that`
[20:09:42] ur5us: has joined #RubyOnRails
[20:11:26] Wixy: https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Fjesjos%2Factive_record_upsert
[20:11:56] Inside: not builtin though :P
[20:12:22] Inside: That's why I <3 Ruby. Gems for days
[20:12:35] Inside: And not stupid crap like leftpad
[20:14:02] Wixy: https://github.com/stevemao/left-pad
[20:14:05] Wixy: that leftpad?
[20:14:29] Inside: yes, that leftpad
[20:14:51] Inside: https://arstechnica.com/information-technology/2016/03/rage-quit-coder-unpublished-17-lines-of-javascript-and-broke-the-internet/
[20:23:07] Wixy: I didn't know that story
[20:31:08] bijan_: has joined #RubyOnRails
[20:32:55] eckhardt_: has joined #RubyOnRails
[20:37:39] NivenHuH: has joined #RubyOnRails
[20:50:43] krawchyk: has joined #RubyOnRails
[20:57:25] fragamus: has joined #RubyOnRails
[21:04:40] jenrzzz: has joined #RubyOnRails
[21:04:42] bijan__: has joined #RubyOnRails
[21:10:14] agent_white: has joined #RubyOnRails
[21:10:29] bambanx: has joined #RubyOnRails
[21:16:31] _aeris_: has joined #RubyOnRails
[21:22:25] Radar: GOOD MORNING
[21:29:37] bijan_: has joined #RubyOnRails
[21:38:12] bijan_: has joined #RubyOnRails
[21:39:28] jenrzzz: has joined #RubyOnRails
[21:41:09] krawchyk: has joined #RubyOnRails
[21:47:08] bijan_: has joined #RubyOnRails
[21:48:15] jottr: has joined #RubyOnRails
[21:52:13] bijan_: has joined #RubyOnRails
[21:52:15] jenrzzz: has joined #RubyOnRails
[22:01:29] NivenHuH: has joined #RubyOnRails
[22:01:58] eckhardt_: has joined #RubyOnRails
[22:06:54] NivenHuH: has joined #RubyOnRails
[22:08:47] and0: has joined #RubyOnRails
[22:13:07] NivenHuH: has joined #RubyOnRails
[22:13:53] roshanavand: has joined #RubyOnRails
[22:14:50] and0: Hi all, struggling to find the most eloquent way to implement something. Our project unfortunately was bootstrapped from an old db, for an app that is still using the same DB. It's pretty unfortunate. We're replicating functionality in a "v2" of that site.
[22:16:19] and0: The old db had a column for "modified_by" which stored the user ID of the last person to touch it. This is for almost all models. I want to write a concern for the controllers which will do a quick after_action and update that field with the user id Devise passes in current_user.
[22:17:43] and0: However, each controller does its own "@model = Model.find(params[:id])", but the concern can't know which model its updating the modified_by column on so it can't guess the variable to use. The column "modified_by" is consistent, but not the variable name of the model being effected.
[22:18:29] and0: AppleController and OrangeController will make @apple and @orange, but I'd like for the concern to update @apple.modified_by or @orange.modified_by respectively
[22:18:48] and0: Is there an easy way to do this?
[22:24:56] fragamus: has joined #RubyOnRails
[22:27:25] Radar: and0: define a method in those controllers that does something like:
[22:27:28] Radar: def model; @apple; end
[22:27:50] and0: ohh... good idea
[22:29:37] daemonwrangler: has joined #RubyOnRails
[22:29:43] eckhardt_: has joined #RubyOnRails
[22:33:10] jenrzzz: has joined #RubyOnRails
[22:33:33] Radar: that's why they pay me the bigg bucks
[22:35:16] tubbo: i see what u did there
[22:37:54] gambl0r3: has joined #RubyOnRails
[22:39:19] jenrzzz: has joined #RubyOnRails
[22:50:37] krawchyk: has joined #RubyOnRails
[22:52:25] Esteth: has joined #RubyOnRails
[22:52:30] Esteth: Hi folks. I have a model with a has_one relationship to itself, and I want to make a .where filter on this model's "foo" column use a lowercase comparison of a string. I've added a migration to create an index on lower(foo), and changed my .where(:foo, 'bar') to .where('lower(foo) = lower(?)') but I get a SQL error because I have an ambigous "foo" in the generated query
[22:53:08] Esteth: quite right, because the generated query LEFT JOIN's the table to itself, so there's two instances of a "foo" column, and my .where uses a string query which doesn't specify which foo I mean
[22:53:32] Esteth: That said, I don't know how to substitute the "left" name into my query
[22:58:53] Inside: are you sure your db doesn't already do case-insensitive lookups? :D
[22:59:11] Inside: (I only ask since whatever we use it work is configured that way..)
[22:59:51] cnsvc: has joined #RubyOnRails
[23:01:52] Inside: I guess what does your query look like
[23:02:17] Esteth: Yeah, my DB is definitely doing case-sensitive lookups
[23:02:26] Esteth: getting an example query
[23:04:23] Esteth: https://pastebin.com/NkwduJej
[23:04:34] Esteth: This is the query generated (minus a whole bunch of redundant columns)
[23:05:23] Inside: dumb question
[23:05:35] Inside: why not have foo, and foo_lower columns
[23:05:36] Esteth: actually the error message from ActiveRecord says the ""local_counterparts_custom_emojis"."domain" IS NULL" is wrong
[23:05:50] Esteth: I really just wanna rewrite the table to use CITEXT because we're on postgres
[23:06:00] Esteth: but that requires locking the whole damn table :(
[23:06:37] Esteth: I could have a foo_lower column, but I only ever want the lowercase version. I could start enforcing lowercase input, but that wouldn't modify what's already there
[23:06:48] Esteth: I guess I could migrate all the contents to lowercase
[23:06:52] Radar: lowercase everything that's already there with a migration
[23:07:21] Inside: Emoji.each { |e| e.update!(domain: domain.downcase) }
[23:07:25] Inside: then get a cup of coffee :3
[23:07:28] Esteth: OK, then I lowercase my user input before i hit the database too?
[23:07:32] Radar: Esteth: sure.
[23:07:41] Inside: You can do a before_validation filter
[23:07:56] Esteth: Oh yeah, I forgot about that :) Thanks Radar and Inside :)
[23:08:08] Esteth: It's a shame postgres can't do a lock-free TEXT->CITEXT migration :'(
[23:08:09] Inside: and then stick a validates :domain, etcetc filter if you're super paranoid
[23:14:14] aidanh010: has joined #RubyOnRails
[23:22:06] Inside: 50% of my problems lately have been as to what to name stuff
[23:26:27] jenrzzz: has joined #RubyOnRails
[23:28:03] Dimik: has joined #RubyOnRails
[23:34:07] Inside: what would you call a master file which is kind of like the thing where configurations are stored
[23:34:37] Inside: I'm building a configurator, this is something which stores available options and then a bunch of instructions as to what happens when certain options are selected
[23:34:41] Inside: almost a makefile for physical things
[23:35:02] Jervis_: has joined #RubyOnRails
[23:42:12] Inside: I'll call it a Makefile in the code
[23:42:32] Radar: MASTER RECIPE
[23:42:58] Inside: Fiojasdflaknsdfasdf
[23:43:59] Inside: I have spent literally 20 minutes trying to think of a good word
[23:44:17] Radar: Inside: that's why they pay me the bigg bucks
[23:44:28] Inside: I don't get the joke
[23:44:36] Radar: My last name is Bigg
[23:45:17] Radar: ha ha i am so funny
[23:45:25] Radar: ACTION slaps thigh
[23:45:55] Inside: I fear for your sanity
[23:51:55] Inside: what is your opinion on 'Product' which has many revisions
[23:52:03] Inside: Should it be ProductRevision or Revision?
[23:52:29] Inside: I like ProductRevision since it's clearer as to what it is a revision of
[23:52:41] Inside: but then you get stuck writing product.product_revisions, etc..
[23:53:10] Inside: what do you prefer?
[23:54:57] Inside: what if you have a namespace full of things that could be revisioned
[23:55:08] Radar: Then yeah I would namespace it appropriately.
[23:55:17] Radar: product_revisions, but you can name the association "revisions" still
[23:55:23] Radar: has_many :revisions, class_name: "ProductRevisions"
[23:55:57] Inside: true true
[23:56:47] beowuff: has joined #RubyOnRails
[23:57:55] beowuff: has left #RubyOnRails: ()
[23:58:32] beowuff: has joined #RubyOnRails
[23:59:27] beowuff: has left #RubyOnRails: ()
[23:59:45] beowuff: has joined #RubyOnRails