« Back to channel list

#RubyOnRails - 02 May 2017

« Back 1 day Forward 1 day »
[00:00:22] quirkycoders: has joined #RubyOnRails
[00:07:21] thebaffoon: has joined #RubyOnRails
[00:11:04] hndk: has joined #RubyOnRails
[00:18:07] Technodrome: has joined #RubyOnRails
[00:28:20] thomasfedb: has joined #RubyOnRails
[00:31:03] amperry: hey folks, I've got an AR query that runs over a model (Placement), a 1:1 association with that model (Ledger), and a many:1 association with Ledger (LedgerLines). I want to filter the LedgerLines by date, but I don't know of an AR query that will allow me. How would I filter, for each Placement |p|, p.ledger.ledger_lines to remove unwanted dates?
[00:41:15] roamingdog: has joined #RubyOnRails
[00:47:11] Jameser: has joined #RubyOnRails
[01:00:49] quirkycoders: has joined #RubyOnRails
[01:07:51] quazimodo: has joined #RubyOnRails
[01:13:11] thebaffoon: has joined #RubyOnRails
[01:14:31] quazimodo: has joined #RubyOnRails
[01:18:56] thomasfedb: amperry, p.ledger.ledger_lines.where(**whatever**)
[01:29:42] jon31: has joined #RubyOnRails
[01:41:33] brent__: has joined #RubyOnRails
[01:47:15] duderonomy: has joined #RubyOnRails
[01:57:11] irishfromua: has joined #RubyOnRails
[01:58:12] amperry: thomasfedb: thanks, but that doesn't seem to work. I think this is because it includes the ledger of a ledger_line within a certain date, then takes all of the ledger_lines belonging to it, so even if I try to restrict the date, it grabs them all.
[01:59:32] fourcolors: has joined #RubyOnRails
[02:01:35] iliketurtles: has joined #RubyOnRails
[02:05:39] ule: has joined #RubyOnRails
[02:05:44] ule: hi there.
[02:06:05] ule: I have this relation: Company -> BusinessUnit -> Employee
[02:06:24] ule: How can I define the relation if Employee can be in multiple busines units?
[02:07:02] libastral: has joined #RubyOnRails
[02:08:07] ule: BusinessUnit (has_many) employees.. and Employees (has_many) Business_Units?
[02:08:14] kies: has joined #RubyOnRails
[02:08:32] ule: but in this case Employee also something like: (belongs_to_many)
[02:09:22] ule: Anyone please?
[02:14:39] mjora7: has joined #RubyOnRails
[02:18:48] romeoh_: has joined #RubyOnRails
[02:21:59] romeoh__: has joined #RubyOnRails
[02:25:47] ule: found this: "has_and_belongs_to_many"
[02:25:53] ule: I'm trying here
[02:26:28] cpruitt: has joined #RubyOnRails
[02:30:15] xco: has left #RubyOnRails: ()
[02:33:59] quirkycoders: has joined #RubyOnRails
[02:37:51] aajjbb: has joined #RubyOnRails
[02:39:23] iliketurtles: has joined #RubyOnRails
[02:43:11] sevenseacat: has joined #RubyOnRails
[02:49:09] Technodrome: has joined #RubyOnRails
[02:54:36] quirkycoders: has joined #RubyOnRails
[03:13:24] roamingdog: has joined #RubyOnRails
[03:14:09] roamingdog: has joined #RubyOnRails
[03:14:59] roamingdog: has joined #RubyOnRails
[03:15:49] roamingdog: has joined #RubyOnRails
[03:19:26] quirkycoders: has joined #RubyOnRails
[03:19:50] srinidhi: has joined #RubyOnRails
[03:29:19] brent__: has joined #RubyOnRails
[03:48:20] fourcolors: has joined #RubyOnRails
[03:49:31] morfin: has joined #RubyOnRails
[03:56:45] MrPunkin: has joined #RubyOnRails
[03:57:16] MrPunkin: Is there any way I can render HTML AND evaluate the javascript on the page server-side within RoR?
[03:57:17] quirkycoders: has joined #RubyOnRails
[03:57:54] quirkycoders: has joined #RubyOnRails
[03:58:55] fourcolors: has joined #RubyOnRails
[04:02:23] fourcolors: has joined #RubyOnRails
[04:13:43] patarr: has joined #RubyOnRails
[04:17:15] roamingdog: has joined #RubyOnRails
[04:26:42] iliketurtles: has joined #RubyOnRails
[04:30:17] jeyraof^mbpr: has joined #RubyOnRails
[04:38:13] mjora7: has joined #RubyOnRails
[04:40:21] jeyraof^mbpr: has joined #RubyOnRails
[04:41:30] iliketurtles: has joined #RubyOnRails
[04:55:24] quazimodo: has joined #RubyOnRails
[05:02:57] fourcolors: has joined #RubyOnRails
[05:03:23] xhoy: MrPunkin: i do not fully understand your question?
[05:03:31] xhoy: you can add ruby files to assets/javascripts
[05:03:38] xhoy: eeuh js files to ruby
[05:03:57] xhoy: and your html in views/
[05:03:58] MrPunkin: I’m trying to get some JSON from an API that is only available via a client-side JS library
[05:04:18] MrPunkin: so I’d like to evalute the JS on an HTML page to get the JSON, then use that JSON in my app.
[05:04:30] xhoy: so there is htttp://random/api.json
[05:04:43] xhoy: but json doesn't need html???
[05:05:03] xhoy: cant you just get the json url???
[05:05:06] xhoy: or is that dynamic or something?
[05:05:26] xhoy: (how big can the js lib be? and how hard can it be to implment?)
[05:05:42] MrPunkin: there is no JSON url. The API is consumed entirely via JS and returns JSON via the JS requests.
[05:05:54] xhoy: you can set js requests?
[05:06:08] MrPunkin: the endpoint their own JS library uses requires the JS authentication system they developed.
[05:06:15] MrPunkin: Trying to query the JSON directly without the authentication fails
[05:06:25] xhoy: can you cant fake the JS auth?
[05:06:50] MrPunkin: Not that I’ve been able to figure out. They generate a token and I’m not sure exactly how.
[05:07:00] xhoy: you can submit posts or gets with
[05:07:05] xhoy: MrPunkin: stick around
[05:07:09] xhoy: ask again in two hours
[05:07:25] xhoy: i think reverse engineering there thing is easyer BUT i am not sure
[05:07:41] xhoy: we fetch a lot of data from other websites
[05:07:52] xhoy: we go to there site
[05:08:09] xhoy: submit a form (hard coded that in ruby) then get the cookies, and do some requests
[05:08:14] xhoy: i think you can do something similary
[05:08:32] xhoy: look at open-uri
[05:08:48] xhoy: uri = URI.parse('https://random')
[05:08:49] xhoy: @client = Net::HTTP.new(uri.host, uri.port)
[05:08:49] xhoy: @client.use_ssl = true
[05:08:50] xhoy: @cookies = ""
[05:08:53] xhoy: and then
[05:09:41] xhoy: @client.post('/loginage?action=login', 'login_field=login&password_field=password')
[05:10:08] xhoy: let me give you some code we use
[05:16:16] mokiwis: has joined #RubyOnRails
[05:17:58] roamingdog: has joined #RubyOnRails
[05:22:00] fourcolors: has joined #RubyOnRails
[05:22:23] morfin: what about using headless browser?
[05:22:52] morfin: which could be controlled using Ruby
[05:25:33] mokiwis: has joined #RubyOnRails
[05:45:06] fourcolors: has joined #RubyOnRails
[05:45:16] mjora7: has joined #RubyOnRails
[05:45:51] brent__: has joined #RubyOnRails
[05:51:18] romeoh: has joined #RubyOnRails
[05:53:40] Lauer: has joined #RubyOnRails
[06:04:22] DaniG2k: has joined #RubyOnRails
[06:05:08] DaniG2k: I have a nested namespace in lib/foo/v2/my_class.rb which I'm trying to access via Foo::V2::MyClass.new
[06:05:21] DaniG2k: however, I am getting an NameError: uninitialized constant error
[06:05:36] DaniG2k: does Rails not load the files in lib/foo/v2/ automatically?
[06:05:43] sevenseacat: so whats in that file?
[06:06:08] DaniG2k: I noticed that if I add it to the autoload_path in application.rb, the file gets loaded but it cases issues with Sidekiq
[06:12:31] srinidhi: has joined #RubyOnRails
[06:14:40] patarr: has joined #RubyOnRails
[06:18:37] roamingdog: has joined #RubyOnRails
[06:29:16] srinidhi: has joined #RubyOnRails
[06:32:25] mjora7: has joined #RubyOnRails
[06:35:04] dionysus69: has joined #RubyOnRails
[06:37:01] conta: has joined #RubyOnRails
[06:52:45] romeoh: has joined #RubyOnRails
[06:53:26] conta: has joined #RubyOnRails
[06:58:37] fourcolors: has joined #RubyOnRails
[07:21:38] fourcolors: has joined #RubyOnRails
[07:27:53] conta: has joined #RubyOnRails
[07:41:15] Qchmqs: has joined #RubyOnRails
[07:42:05] User458764: has joined #RubyOnRails
[07:44:34] sandstrom: has joined #RubyOnRails
[07:50:03] roamingdog: has joined #RubyOnRails
[07:56:41] mikecmpbll: has joined #RubyOnRails
[07:57:01] Qchmqs__: has joined #RubyOnRails
[07:57:54] fourcolors: has joined #RubyOnRails
[08:07:29] cheeti: has joined #RubyOnRails
[08:08:44] cheeti: hi, how to validate array filed validate presence in rails 4?
[08:10:06] arBmind: has joined #RubyOnRails
[08:15:29] patarr: has joined #RubyOnRails
[08:16:39] cheeti: hi, how to validate array filed validate presence in rails 4?
[08:20:24] cheeti: universa1 i have multi select dropdown validates_presence_of not working in that
[08:20:37] Ergo: has joined #RubyOnRails
[08:20:46] universa1: define not owrking... code? error? expected behavior? actual behavior?
[08:21:56] cheeti: universa1 form saving if user not select any value also
[08:23:21] universa1: so, what have you done to prevent it from saving?
[08:29:49] rakm: has joined #RubyOnRails
[08:41:23] romeoh: has joined #RubyOnRails
[08:44:59] irishfromua: has joined #RubyOnRails
[08:49:34] cheeti: universa1 https://gist.github.com/anonymous/37c79817701b19056885b8cfeac82274
[08:51:06] roamingdog: has joined #RubyOnRails
[08:54:37] lxsameer: has joined #RubyOnRails
[09:13:27] universa1: cheeti: so why do you think validates_presence_of :service is a viable validation in your case? what does it actually do? what values are allowed for a presence validation, and which are not? (hint: try the .present? method on different values)
[09:33:11] apparition: has joined #RubyOnRails
[09:36:05] srinidhi: has joined #RubyOnRails
[09:41:11] MrCrackPotBuilde: has joined #RubyOnRails
[09:41:52] MrCrackPotBuilde: hi i know how to do an image tag but little confused how i would turn this to ruby
[09:41:55] MrCrackPotBuilde: <figure class="elementwrapper"><a class="imgoverlay" href="#"><img src="images/demo/480x285.png" alt="">
[09:42:30] MrCrackPotBuilde: i thought id just have to remove the img src part as it looks like a separate part
[09:43:20] MrCrackPotBuilde: or would i have to create a link_to with image overlay and a img src
[09:44:53] CornishPasty: has joined #RubyOnRails
[09:45:18] digitalfiz: has joined #RubyOnRails
[09:45:46] DukeDave: has joined #RubyOnRails
[09:47:38] Hosh: has joined #RubyOnRails
[09:49:21] dmcc: has joined #RubyOnRails
[09:49:21] wbnns: has joined #RubyOnRails
[09:49:25] arBmind: has joined #RubyOnRails
[09:54:35] donnib: has left #RubyOnRails: ()
[10:13:55] ferr: has joined #RubyOnRails
[10:15:42] Hates_: has joined #RubyOnRails
[10:16:22] patarr: has joined #RubyOnRails
[10:17:14] brent__: has joined #RubyOnRails
[10:36:49] srinidhi: has joined #RubyOnRails
[10:47:31] marr: has joined #RubyOnRails
[10:48:53] User458764: has joined #RubyOnRails
[10:49:04] bauruine: has joined #RubyOnRails
[10:49:20] norfumpit: has joined #RubyOnRails
[10:51:48] norfumpit: so ive got an rails 5 api endpoint which includes some bookmark, like its a resource endpoint and it includes in the response all the bookmarks on that resource. this is serialized by AMS. and ive got pundit for authorization. so i've got the resource finder wrapped in a policy_scope, but then i use includes(:bookmarks) ... how to authorize that?
[10:54:43] norfumpit: i would need to apply a scope to those included models
[10:56:08] norfumpit: right now ive overriden the bookmarks method on the serializer and wrapped it in a scope, but this runs the query again, it doesnt use the preloaded data
[11:04:38] arBmind: has joined #RubyOnRails
[11:14:14] 07EAAS2NJ: has joined #RubyOnRails
[11:14:14] patarr: has joined #RubyOnRails
[11:14:28] hive-mind: has joined #RubyOnRails
[11:14:57] quazimodo: has joined #RubyOnRails
[11:16:39] MasterAsia: Anyone else get issues with capybara where
[11:16:44] MasterAsia: database is not being wiped
[11:17:48] snowy: has joined #RubyOnRails
[11:18:02] justAllgood: has joined #RubyOnRails
[11:25:20] bbrowning: has joined #RubyOnRails
[11:30:30] Or1on: has joined #RubyOnRails
[11:31:02] romeoh: has joined #RubyOnRails
[11:31:20] hndk: has joined #RubyOnRails
[11:32:09] sandstrom: has joined #RubyOnRails
[11:46:23] User458764: has joined #RubyOnRails
[11:51:57] DrYockel: has joined #RubyOnRails
[11:54:30] fourcolors: has joined #RubyOnRails
[11:55:04] nacho_: has joined #RubyOnRails
[11:55:19] DrYockel1: has joined #RubyOnRails
[11:55:44] nacho_: Hi all, I'm currently migrating from rails 4.1 to 4.2 and came across some issues with the serializer
[11:55:58] nacho_: any piece of advice or someone willing to share some experiences on it?
[11:58:26] nacho_: Currently, the upgrade is from 4.1.8 to 4.2.8
[12:02:27] ferr: has joined #RubyOnRails
[12:02:39] DrYockel1: has joined #RubyOnRails
[12:08:17] universa1: nacho_: the serializer is rather unspecific...
[12:08:35] nacho_: Well, it was a catch up
[12:08:48] nacho_: The point is, I'm using a serializer to store a hash in a column
[12:08:55] nacho_: Everything was fine in 4.1.8
[12:09:01] nacho_: Am now testing 4.2.8
[12:09:09] nacho_: and it breaks apart with the following message
[12:09:11] 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.
[12:13:15] romeoh: has joined #RubyOnRails
[12:13:48] nacho_: Here's the code https://gist.github.com/anonymous/d42436f966b18bb3c7f3048eca24069e
[12:14:14] nacho_: What rails is actually complaining about is that ActiveRecord::SerializationTypeMismatch (Attribute was supposed to be a Hash, but was a String.
[12:14:35] nacho_: This was actually working fine with rails 4.1.8
[12:15:13] nacho_: I'm eager to provide details if needed
[12:16:02] universa1: nacho_: new records? existing records?
[12:16:10] nacho_: It's a new record
[12:16:32] nacho_: Though I assume there would be the same with records to be updated since the code is kind of the same
[12:16:55] universa1: can you add the full error trace to the gist please?
[12:17:14] universa1: and also the line triggering the error.
[12:17:46] brent__: has joined #RubyOnRails
[12:17:47] universa1: does it work in console?
[12:20:02] nacho_: It doesn't work in console either
[12:20:47] User458764: has joined #RubyOnRails
[12:23:25] nacho_: I added the error log into the gist here: https://gist.github.com/anonymous/e4c3cea2be9fc527b69ecb5b53e5091b
[12:23:41] Or1on: has joined #RubyOnRails
[12:30:25] nacho_: With the post log added at the beginning so that it makes more sense understanding what kind of parameters arrive in there
[12:30:26] nacho_: https://gist.github.com/anonymous/7b31792b47edec8f81d5edfda2ef5f56
[12:31:42] pupsicle: has joined #RubyOnRails
[12:44:25] pupsicle: has joined #RubyOnRails
[12:45:40] brent__: has joined #RubyOnRails
[12:58:26] roamingdog: has joined #RubyOnRails
[12:59:18] snowy: has joined #RubyOnRails
[13:01:05] xco: has joined #RubyOnRails
[13:03:04] Knockys: has joined #RubyOnRails
[13:10:08] aajjbb: has joined #RubyOnRails
[13:10:43] Jameser: has joined #RubyOnRails
[13:12:23] workmad3: has joined #RubyOnRails
[13:17:09] gaucheph: has joined #RubyOnRails
[13:18:23] sonOfRa: has joined #RubyOnRails
[13:20:29] workmad3_: has joined #RubyOnRails
[13:24:47] Jameser: has joined #RubyOnRails
[13:25:35] workmad3: has joined #RubyOnRails
[13:29:25] Knockys: has joined #RubyOnRails
[13:31:06] fourcolors: has joined #RubyOnRails
[13:31:33] snowy: has joined #RubyOnRails
[13:31:43] Knockys: Hello there ! I'm building a form and I need to find a way for the user to select images and I thought of how Google do it : http://bit.ly/2pBrnmq, does someone know a lib that can achieve that ? I'm using Materialize but there's nothing like that :/
[13:33:20] scrooloose: has joined #RubyOnRails
[13:33:36] DLSteve: has joined #RubyOnRails
[13:34:15] beauby: has joined #RubyOnRails
[13:38:21] LyndsySimon: Is it a stupid idea to have a concern that is included in both models and controllers?
[13:38:45] LyndsySimon: It's for configuration handling, which on the app I'm working on is quite unique.
[13:38:58] nacho_: Can you develop a bit more @LyndsySimon?
[13:39:52] LyndsySimon: As in provide more detail, or just ask fewer questions in this channel? :)
[13:40:53] nacho_: As in provide more detail
[13:41:18] nacho_: I don't really understand what you do mean
[13:41:25] nacho_: Is this like you're duplicating code?
[13:41:29] LyndsySimon: Our config is a cascade, with "tenant" and "department" being the levels. The concern resolves the correct config object based upon the tenant and department in context for a model or controller instance.
[13:42:38] LyndsySimon: The config object is my own creation, and is where the vast majority of the business logic lives. The concern is just the way the correct config object is resolved. It provides hooks to specify the department to which an instance of a model belongs (or to which a controller belongs)
[13:43:23] Jameser: has joined #RubyOnRails
[13:43:39] nacho_: Doesn't sound that bad to me
[13:44:09] nacho_: What I wonder is what exactly you do really need to configure in the model and the controller
[13:44:12] LyndsySimon: Where should I put it in the filesystem.
[13:44:31] nacho_: I'd rather attach it as a module in lib/
[13:44:39] LyndsySimon: OOoh good idea.
[13:45:39] nacho_: What kind of configurations do you need to perform to modules and controllers?, just as curiosity
[13:46:26] LyndsySimon: Can you remind me in a couple of days? I'll refactor it into a gem.
[13:46:43] LyndsySimon: I'm under time pressure at the moment, and there's too much business logic in there to share it at the moment.
[13:47:10] nacho_: Ok, enjoy!
[13:49:54] mtkd: has joined #RubyOnRails
[13:54:49] akshat: has joined #RubyOnRails
[14:05:27] patarr: has joined #RubyOnRails
[14:05:34] patarr1: has joined #RubyOnRails
[14:11:42] ResidentBiscuit: has joined #RubyOnRails
[14:20:04] ravster: has joined #RubyOnRails
[14:29:48] User458764: has joined #RubyOnRails
[14:30:22] theunraveler: has joined #RubyOnRails
[14:30:43] fourcolors: has joined #RubyOnRails
[14:33:14] mikecmpb_: has joined #RubyOnRails
[14:33:51] theunraveler: has joined #RubyOnRails
[14:42:06] justAllgood1: has joined #RubyOnRails
[14:43:16] dionysus69: has joined #RubyOnRails
[14:44:29] aajjbb: has joined #RubyOnRails
[14:44:49] noodle: has joined #RubyOnRails
[14:45:24] boshhead: has joined #RubyOnRails
[14:45:58] pupsicle1: has joined #RubyOnRails
[14:46:06] atrius: has joined #RubyOnRails
[14:46:15] CornishPasty: has joined #RubyOnRails
[14:46:15] blitz_: has joined #RubyOnRails
[14:46:55] ome: has joined #RubyOnRails
[14:47:14] hotpancakes: has joined #RubyOnRails
[14:47:19] hive-mind: has joined #RubyOnRails
[14:47:20] jkwood: has joined #RubyOnRails
[14:47:40] kies: has joined #RubyOnRails
[14:48:59] hotpancakes: Hi everyone. I'm trying out 5.1 now. After I install bootstrap via yarn, must I do anything else in application.css and/or application.js?
[14:49:11] hotpancakes: Docs are lacking...
[14:49:11] TheMoonMaster: has joined #RubyOnRails
[14:49:22] greenhat: has joined #RubyOnRails
[14:49:25] DukeDave: has joined #RubyOnRails
[14:49:45] Liothen: has joined #RubyOnRails
[14:49:49] targaf: has joined #RubyOnRails
[14:51:03] bphogan: has joined #RubyOnRails
[14:51:18] dnyy: has joined #RubyOnRails
[14:51:27] Hates_: has joined #RubyOnRails
[14:52:40] ankhers: has joined #RubyOnRails
[14:52:57] rjungemann: has joined #RubyOnRails
[14:54:23] loglaunch: has joined #RubyOnRails
[14:54:42] beingjohnm: has joined #RubyOnRails
[14:55:30] planigan: has joined #RubyOnRails
[14:56:05] patarr: has joined #RubyOnRails
[14:57:15] szulak: has joined #RubyOnRails
[14:59:20] workmad3: has joined #RubyOnRails
[15:00:56] guacamole: has joined #RubyOnRails
[15:02:34] johnkpaul: has joined #RubyOnRails
[15:02:35] gthank: has joined #RubyOnRails
[15:02:37] gheegh: has joined #RubyOnRails
[15:04:28] rockymeza: has joined #RubyOnRails
[15:04:47] conta1: has joined #RubyOnRails
[15:05:11] ecook: has joined #RubyOnRails
[15:05:30] pfg: has joined #RubyOnRails
[15:07:46] manveru: has joined #RubyOnRails
[15:07:57] BBHoss: has joined #RubyOnRails
[15:08:59] centrx: has joined #RubyOnRails
[15:14:33] duderonomy: has joined #RubyOnRails
[15:14:33] patarr: has joined #RubyOnRails
[15:15:48] sunya7a: I'm using foundation abide and have trouble with invalid fields that are marked for destruction. how do i tell abide to ignore these fields so that I can submit the form?
[15:16:34] mikecmpbll: has joined #RubyOnRails
[15:19:37] patarr1: has joined #RubyOnRails
[15:22:36] MissionCritical: has joined #RubyOnRails
[15:23:35] theunraveler: has joined #RubyOnRails
[15:24:47] theunraveler: has joined #RubyOnRails
[15:27:47] cpruitt: has joined #RubyOnRails
[15:28:22] soule: has joined #RubyOnRails
[15:28:25] soule: Hi, if i updated a linked_file in Capistrano, how can i get it to upload to my server?
[15:36:07] workmad3_: has joined #RubyOnRails
[15:36:56] adambecker: has left #RubyOnRails: ()
[15:37:15] brent__: has joined #RubyOnRails
[15:41:06] workmad3: has joined #RubyOnRails
[15:42:16] centrx: UNKNOWN ANSWER!
[15:46:58] sonOfRa: has joined #RubyOnRails
[15:53:55] fryguy: soule: linked files/dirs are explicitly separate from the deployment, and are to be provided separately ahead of the deployment. you are responsible for maintaining the content of them yourself (we use our configuration management tool for this)
[15:54:45] soule: @fryguy Ahhh thanks
[15:54:57] soule: so should i update it manually in the shared/config folder on my server?
[15:57:29] cagomez: has joined #RubyOnRails
[15:58:16] cagomez: has joined #RubyOnRails
[15:58:44] cagomez: has joined #RubyOnRails
[16:00:27] hobodave: has joined #RubyOnRails
[16:00:41] blackmesa: has joined #RubyOnRails
[16:05:48] hotpancakes: has joined #RubyOnRails
[16:05:59] beauby: has joined #RubyOnRails
[16:08:23] dminuoso: soule: Ideally no, but sure that could work.
[16:11:06] kristofferR: has joined #RubyOnRails
[16:15:10] GragHarker: has joined #RubyOnRails
[16:22:23] gusrub: has joined #RubyOnRails
[16:30:31] morfin: has joined #RubyOnRails
[16:30:50] morfin: how do you share translations between backend(Ruby) and frontend?
[16:31:08] morfin: store all stuff into global JS variable?
[16:32:57] mtkd: has joined #RubyOnRails
[16:35:36] LastWhisper____: has joined #RubyOnRails
[16:39:07] workmad3_: has joined #RubyOnRails
[16:40:29] aajjbb: has joined #RubyOnRails
[16:41:11] roamingdog: has joined #RubyOnRails
[16:45:42] sent-hil: has joined #RubyOnRails
[16:46:19] beauby: has joined #RubyOnRails
[16:47:31] kumavis: has joined #RubyOnRails
[16:47:35] pupsicle: has joined #RubyOnRails
[16:48:00] hotpancakes: has joined #RubyOnRails
[16:59:12] ja: morfin: that's what i would do. dunno if there's a better approach.
[17:02:45] xibalba: has joined #RubyOnRails
[17:04:26] dminuoso: morfin: yaml...
[17:04:47] dminuoso: morfin: Or just store it in a JSON (which is a subset of YAML)
[17:05:07] dminuoso: You can then serve the same YAML file to your i18n and your JS i18n solution
[17:07:08] gheegh: has joined #RubyOnRails
[17:07:16] brent__: has joined #RubyOnRails
[17:07:31] brent__: I want to send an email if a user spent x seconds on a page, what is the best way to handle that and track how long the user spent on a page
[17:09:42] rakm: has joined #RubyOnRails
[17:09:56] hotpancakes: has joined #RubyOnRails
[17:11:25] gheegh: Hey all.. anyone upgrading to Rails 5.1 yet? I'm having a WEIRD problem with the Twitter Gem. I have a User model, but the Twitter gem keeps trying to use it for the Twitter::User model.
[17:14:33] LastWhisper____: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[17:14:35] LastWhisper____: has joined #RubyOnRails
[17:16:54] ldnunes: has joined #RubyOnRails
[17:20:00] jsrn_: has joined #RubyOnRails
[17:20:39] dminuoso: brent__: You have to do this in JavaScript somewhow. Can't tell more without knowing how your application works.
[17:21:29] defsdoor: has joined #RubyOnRails
[17:22:21] brent__: dminuoso: thanks, yeah looks like i can just do some sort of window.onLoad() that will initialize a start time and look for window.onLeave()? type fuction to see if the time has hit the x seconds and then ajax to a rails controller that will create the mailer
[17:22:36] brent__: just wondering if there was some sort of rails specific way to accomplish it better
[17:22:40] dminuoso: brent__: focus/blur are the events you are looking for.
[17:23:23] brent__: well those have to be more w/ the page/tab being active
[17:23:46] brent__: would #blur account for leaving a specific page?
[17:23:47] dminuoso: brent__: As I said. focus/blur on window.
[17:24:13] dminuoso: brent__: "leaving a page" -> what does that even mean?
[17:24:38] brent__: going to anothe rpage
[17:24:53] brent__: going from a show page to a index page
[17:25:01] brent__: or just closing the browser
[17:25:41] dminuoso: brent__: Do you have turbolinks enabled?
[17:26:16] kies: has joined #RubyOnRails
[17:27:28] brent__: doesn't look like it
[17:28:08] dminuoso: brent__: Then you will need blur/focus/unload/DOMContentLoaded
[17:28:13] dminuoso: All on window.
[17:28:32] brent__: whats your thoughts on turbolinks?
[17:28:47] dminuoso: But then again my frontend is written in ReactJS.. so..
[17:28:55] brent__: my personal projects are react
[17:29:11] brent__: and usually add the skip flag for it
[17:29:21] brent__: but this is an older rails app
[17:29:36] blackmesa: has joined #RubyOnRails
[17:33:31] User458764: has joined #RubyOnRails
[17:36:28] mikecmpbll: has joined #RubyOnRails
[17:39:30] morfin: i uduslly disable turbolinks
[17:42:51] hotpancakes: has joined #RubyOnRails
[17:44:48] irishfromua: has joined #RubyOnRails
[17:47:28] hotpancakes: has joined #RubyOnRails
[17:50:49] xco: has left #RubyOnRails: ()
[17:51:28] xibalba: has joined #RubyOnRails
[17:52:44] hotpancakes: has joined #RubyOnRails
[17:53:02] patarr: has joined #RubyOnRails
[18:00:11] aFineDay: has joined #RubyOnRails
[18:01:27] sandstrom: has joined #RubyOnRails
[18:02:18] duderonomy: has joined #RubyOnRails
[18:02:37] mostlybadfly: has joined #RubyOnRails
[18:03:06] workmad3: has joined #RubyOnRails
[18:04:17] sonOfRa: has joined #RubyOnRails
[18:06:27] pLaTo0n: has joined #RubyOnRails
[18:17:55] patarr: has joined #RubyOnRails
[18:22:10] ornerymoose: has joined #RubyOnRails
[18:23:08] rakm: has joined #RubyOnRails
[18:23:58] rakm: has joined #RubyOnRails
[18:24:07] srinidhi: has joined #RubyOnRails
[18:24:43] rakm: has joined #RubyOnRails
[18:25:42] rakm: has joined #RubyOnRails
[18:26:17] rakm: has joined #RubyOnRails
[18:26:51] ornerymoose: Hello. I’m having a hard time wrap my head around how to correctly update a subscriber’s current categories. Can someone offer some insight? https://gist.github.com/ornerymoose/4952c5fa42a7b3c5779576af3aeabcb5 I have quite a few users to update, so would rather not do it manually one by one. (rails_console.rb) is the file in question in the Gist
[18:36:53] hotpancakes: has joined #RubyOnRails
[18:37:22] patarr: has joined #RubyOnRails
[18:42:12] workmad3: has joined #RubyOnRails
[18:42:46] roamingdog: has joined #RubyOnRails
[18:43:45] chouhoulis: has joined #RubyOnRails
[18:44:44] tercenya: has joined #RubyOnRails
[18:46:21] fourcolors: has joined #RubyOnRails
[18:49:23] Technodrome: has joined #RubyOnRails
[18:55:03] aFineDay: has joined #RubyOnRails
[19:00:10] aFineDay: Hey, I'm having trouble When I push a form from User A to User B's page using ActionCable the form wont verify. I wrote a SO question with a different architecture because I thought there might have been a problem pushing from another user's session, but the issue is still there. Here's the question https://stackoverflow.com/questions/43549899/a-form-inserted-through-actioncable-wont-verify
[19:13:09] choke: has joined #RubyOnRails
[19:14:56] gusrub: has joined #RubyOnRails
[19:18:00] patarr: has joined #RubyOnRails
[19:19:30] fourcolors: has joined #RubyOnRails
[19:23:54] cagomez: has joined #RubyOnRails
[19:24:33] mtkd: has joined #RubyOnRails
[19:32:01] fourcolors: has joined #RubyOnRails
[19:32:37] hnanon: has joined #RubyOnRails
[19:33:03] hnanon: I've been struggling with this for a while.
[19:33:17] hnanon: I don't understand why the upgrade is getting created:
[19:33:19] hnanon: https://gist.github.com/anonymous/15dcd520b4d2cd7811c530aed5611870
[19:33:58] hnanon: I'm creating the customer first, then if successful, charging them (upgrading), then if successful, saving the user.
[19:34:14] hnanon: However, I'm purposefully tripping an exception when upgrading.
[19:34:21] hnanon: But the upgrade is still created.
[19:34:32] hnanon: Any ideas?
[19:35:42] dminuoso: hnanon: Yes, you have not bothered with a testcase.
[19:35:53] dminuoso: Which is why a) you have some abstract high level description of your problem that I cant relate to your code.
[19:36:11] dminuoso: And b) you have been wasting so much time thinking about it.
[19:36:57] dminuoso: hnanon: But while we're at it, DRY up that error handler.
[19:37:52] hnanon: dminuoso: Can you suggest how I would DRY it up?
[19:38:24] cagomez: has joined #RubyOnRails
[19:38:25] dminuoso: hnanon: As it stands right now all stripe errors end up doing the same thing. So catch them in a single rescue.
[19:39:19] hnanon: I planned on changing some of the messages. But I understand what you mean.
[19:39:45] dminuoso: hnanon: So just catch Stripe::StripeError and move on.
[19:40:02] dminuoso: hnanon: That's fine, but even then move that into a separate method or something.
[19:40:25] dminuoso: hnanon: Anyway. The important thing is not to dry up right now, but make a test case.
[19:40:35] dminuoso: So "git checkout -b fix_shit" and start deleting code.
[19:40:37] hnanon: The weird thing is that when I trigger an error, and resubmit, it PATCHES instead of POSTS.
[19:40:48] dminuoso: Who knows. Make a testcase.
[19:41:41] hnanon: dminuoso: I've actually never written a test, unfortunately.
[19:41:47] dminuoso: hnanon: A testcase.
[19:45:14] Derperperd: has joined #RubyOnRails
[19:45:36] dminuoso: hnanon: The problem is you have a really large code example and a very abstract description. Try to reduce your code as much as possible so that you can point at a single line of code and ask me "why does this do X and not Y" ?
[19:45:59] dminuoso: hnanon: Note this is not for me, this is a debugging technique and will help you debug things on your own.
[19:46:12] dminuoso: It just happens to make problems small enough to look at and understand.
[19:50:24] arBmind: has joined #RubyOnRails
[19:53:13] hnanon: dminuoso: I understand. Thank you.
[19:54:41] patarr: has joined #RubyOnRails
[19:57:08] mlt-: So params is not available when declaring before_action ? I want it only if a certain parameter was set
[19:57:29] mlt-: nevermind
[19:59:04] mlt-: ACTION had to use ', if: "blah"' instead of 'if blah'
[20:03:27] rails4444: has joined #RubyOnRails
[20:03:38] rails4444: some one knows if it is possible to use a rails validation method on a delegated attribute?
[20:04:14] rails4444: https://apidock.com/rails/Module/delegate :hello, to: :greeter
[20:04:32] quirkycoders: has joined #RubyOnRails
[20:05:17] rails4444: something like
[20:05:18] rails4444: belongs_to :greeter
[20:05:18] rails4444: delegate :hello, to: :greeter
[20:05:18] rails4444: validate :hello, uniqueness: true
[20:05:39] fourcolors: has joined #RubyOnRails
[20:06:58] Ellimist: has joined #RubyOnRails
[20:15:37] quirkycoders: has joined #RubyOnRails
[20:20:35] lxsameer: has joined #RubyOnRails
[20:23:38] fourcolors: has joined #RubyOnRails
[20:24:05] cagomez: has joined #RubyOnRails
[20:27:04] gusrub: has joined #RubyOnRails
[20:31:01] amperry: Hey folks, I'm trying to get an AR query right, but I'm trying to filter a has_many association by date and still getting all the results. I think I know *why*, but I don't know how to rewrite it. Gist is here: https://gist.github.com/amp108/f9006426ac06d713716649ec38f32d7f
[20:36:34] fourcolors: has joined #RubyOnRails
[20:44:59] cagomez: has joined #RubyOnRails
[20:58:05] workmad3: has joined #RubyOnRails
[21:12:34] amperry: my problem boils down to: how to place conditions on a (twice) nested query?
[21:12:54] fourcolors: has joined #RubyOnRails
[21:15:26] Technodrome: has joined #RubyOnRails
[21:15:41] MrPunkin: has joined #RubyOnRails
[21:15:43] MrPunkin: has left #RubyOnRails: ()
[21:20:25] patarr: has joined #RubyOnRails
[21:26:02] Alayde: has joined #RubyOnRails
[21:31:34] fourcolors: has joined #RubyOnRails
[21:32:41] workmad3: has joined #RubyOnRails
[21:38:07] workmad3: has joined #RubyOnRails
[21:41:07] patarr: has joined #RubyOnRails
[21:41:46] Aytan72: has joined #RubyOnRails
[21:43:45] pupsicle: has joined #RubyOnRails
[21:47:04] patarr: has joined #RubyOnRails
[21:51:08] quirkycoders: has joined #RubyOnRails
[21:52:39] hotpancakes: has joined #RubyOnRails
[21:56:03] Leonardo_0112: has joined #RubyOnRails
[21:56:07] amperry: If anyone's joined since last I mentioned it, I've got a nested tables query problem at: https://gist.github.com/amp108/f9006426ac06d713716649ec38f32d7f. Boils down to how to place conditions on a doubly nested query.
[21:57:42] Leonardo_0112: I'm reading this ebook online https://www.railstutorial.org/book/_single-page. Is there a way to download it in PDF? So I can read it in my tablet offline.
[21:57:56] hotpancakes: has joined #RubyOnRails
[21:59:59] Alayde: Leonardo_0112: Afaik, no. If you want to read it offline, you have to purchase a copy.
[22:00:01] fourcolors: has joined #RubyOnRails
[22:05:28] amperry: has joined #RubyOnRails
[22:08:05] cseder: has joined #RubyOnRails
[22:11:35] Technodrome: has joined #RubyOnRails
[22:18:59] fourcolors: has joined #RubyOnRails
[22:19:37] cagomez: has joined #RubyOnRails
[22:19:44] FCser: has joined #RubyOnRails
[22:20:12] workmad3_: has joined #RubyOnRails
[22:21:40] fourcolors: has joined #RubyOnRails
[22:25:24] gusrub: has joined #RubyOnRails
[22:26:43] Radar: amperry: why both an includes and a joins for the same associations?
[22:27:09] Radar: amperry: and what is the query that Rails generates for that AR code you have?
[22:28:01] amperry: Radar: probably because I've been trying it both ways and left both in when I hould have taken it out :S
[22:28:17] amperry: I'm going to update the gist with what I have right now, one moment
[22:29:06] hotpancakes: has joined #RubyOnRails
[22:32:17] cagomez: has joined #RubyOnRails
[22:32:29] cagomez: has joined #RubyOnRails
[22:33:37] cagomez: has joined #RubyOnRails
[22:34:03] amperry: Radar: the gist has been updated.
[22:36:14] Radar: amperry: so why both an includes + joins?
[22:36:36] Radar: Oh I missed that when I closed my laptop earlier.
[22:36:38] Radar: Saw it in the logs.
[22:37:11] amperry: Radar: what I suspect is happening is that the query filters out the unwanted ledger_lines, but then grabs the containing ledgers and all of their ledger_lines again.
[22:37:22] Radar: amperry: what DBMS is this?
[22:37:47] Radar: Give me a few minutes.
[22:38:04] amperry: Radar: you are a gentleman and a scholar
[22:38:49] Radar: "and apts.id > 0" seems unnecessary.
[22:40:03] amperry: yeah, that's from a scope that I need to fix.
[22:43:28] Radar: I think the joins to apt is unnecessary.
[22:45:13] amperry: Radar: why unnecessary? I'm trying eventually to get a list, broken down by apt, of all the transactions (ledger_lines) that happened for it within a date range.
[22:45:30] Radar: You're not using it anywhere in the query.
[22:46:25] amperry: okay. I am using it in the view, however, but I'll remove it if you think that's the better thing to do.
[22:46:59] amperry: Oh, also, see the commented-out '.order'?
[22:47:01] Radar: Ok, if you're using it in the view then it probably makes sense for that to be an includes association
[22:47:12] Radar: Regarding querying on ledger lines, that should be a joins
[22:47:14] Radar: I'm trying to replicate your app's schema
[22:48:24] Radar: yes I see the commented out order.
[22:49:15] patarr: has joined #RubyOnRails
[22:49:17] cagomez: has joined #RubyOnRails
[22:50:12] cagomez: has joined #RubyOnRails
[22:50:38] amperry: ? That's what I don't get about how this works (or, one of the things I don't get). The Ledger joins LedgerLines, but not the Placement. Can I .joins(:ledger_lines) directly like that?
[22:50:53] amperry: I mean, from the Placement
[22:51:23] Radar: If it's a has_many :through, yes
[22:51:29] Radar: What is the desired output of this query?
[22:51:40] Radar: I'm arriving at my train station so I won't have much more time to work on this.
[22:52:11] baweaver: Yeah, radar is getting Ruby off Rails
[22:52:22] amperry: List broken out first by apt, then by ledger_line date, of all lines within a given date range.
[22:57:10] cagomez: has joined #RubyOnRails
[23:13:33] hotpancakes: has joined #RubyOnRails
[23:14:09] cagomez: has joined #RubyOnRails
[23:23:09] mtkd: has joined #RubyOnRails
[23:29:01] quirkycoders: has joined #RubyOnRails
[23:42:03] DLSteve: has joined #RubyOnRails
[23:42:37] amperry: Radar: fixed it by going backwards from lines -> ledger -> placement -> apt; Placement was supposed to be a container object, but this worked as needed. Thanks for your help.
[23:45:50] DLSteve: has joined #RubyOnRails
[23:57:33] jarray52: has joined #RubyOnRails
[23:57:47] uksio: has joined #RubyOnRails
[23:57:49] duderono_: has joined #RubyOnRails