« Back to channel list

#RubyOnRails - 10 October 2017

« Back 1 day Forward 1 day »
[00:00:47] LambdaSource: has joined #RubyOnRails
[00:05:45] TinkerTyper: has joined #RubyOnRails
[00:14:14] TinkerTyper: has joined #RubyOnRails
[00:19:05] TinkerTyper: has joined #RubyOnRails
[00:23:06] rrichardsr3: has joined #RubyOnRails
[00:23:19] SteenJobs_: has joined #RubyOnRails
[00:26:00] cagomez: has joined #RubyOnRails
[00:30:51] orbyt_: has joined #RubyOnRails
[00:35:07] gusrub: has joined #RubyOnRails
[00:55:10] rrichardsr3: has joined #RubyOnRails
[00:59:13] bronson: has joined #RubyOnRails
[01:20:58] sevenseacat: has joined #RubyOnRails
[01:40:51] fragamus: has joined #RubyOnRails
[01:43:10] dopie: has joined #RubyOnRails
[01:54:57] LambdaSource: has joined #RubyOnRails
[02:00:11] brycesenz: has joined #RubyOnRails
[02:07:23] Axsuul: has joined #RubyOnRails
[02:15:06] Axsuul: has joined #RubyOnRails
[02:17:54] jscheel: has joined #RubyOnRails
[02:20:48] chrisgopher: has joined #RubyOnRails
[02:45:54] Derperperd: has joined #RubyOnRails
[02:50:02] Derperperd: has joined #RubyOnRails
[02:55:09] Derperperd: has joined #RubyOnRails
[03:00:02] bronson: has joined #RubyOnRails
[03:01:17] kies: has joined #RubyOnRails
[03:02:24] DTZUZO: has joined #RubyOnRails
[03:26:09] brycesenz: has joined #RubyOnRails
[03:37:20] orbyt_: has joined #RubyOnRails
[03:41:34] fragamus: has joined #RubyOnRails
[03:47:27] Derperperd: has joined #RubyOnRails
[03:49:16] irishfromua: has joined #RubyOnRails
[04:15:35] dblessing: has joined #RubyOnRails
[04:22:40] uksio: has joined #RubyOnRails
[04:31:12] bronson: has joined #RubyOnRails
[04:40:35] brycesenz: has joined #RubyOnRails
[04:48:53] tamouse__: has joined #RubyOnRails
[05:03:07] krz: has joined #RubyOnRails
[05:03:18] LambdaSource: has joined #RubyOnRails
[05:03:59] tcopeland: has joined #RubyOnRails
[05:11:39] rrichardsr3: has joined #RubyOnRails
[05:15:38] timdotrb: has joined #RubyOnRails
[05:15:43] timdotrb: Evening, all
[05:17:57] timdotrb: I’m having some odd issues with solr. It seems to be missing a lot of data from the index, and I get an error if I try to manually index objects (RSolr::Error::Http Request Data: "{\"commit\":{\"softCommit\":false}}”)
[05:18:42] timdotrb: I’m duplicating certain data from other tables into one single table to make it more easily searchable, but it doesn’t seem to be making it into the index. I can search those specific tables for the data, but that presents other issues
[05:20:57] tcopeland1: has joined #RubyOnRails
[05:27:08] paranoicsan: has joined #RubyOnRails
[05:47:09] brycesenz: has joined #RubyOnRails
[06:05:04] KevinSjoberg: has joined #RubyOnRails
[06:17:24] armyriad: has joined #RubyOnRails
[06:18:52] KevinSjoberg: has joined #RubyOnRails
[06:33:06] elcontrastador: has joined #RubyOnRails
[06:42:07] someuser: has joined #RubyOnRails
[06:45:08] srinidhi: has joined #RubyOnRails
[06:50:26] ur5us: has joined #RubyOnRails
[06:51:52] elcontrastador: https://gist.github.com/elcontrastador/0c5a8f4cc90e700afafd54f72b1da991
[06:52:48] elcontrastador: Can't destroy a record...fails silently...not even the js alert... Any suggestions where to start debugging? I'm sure it's right in front of me
[06:53:20] elcontrastador: Been forever since I used rails..spent too long on this
[06:54:13] sevenseacat: fails silently? as in, doesnt pop up the confirmation box?
[06:55:32] matthewd: elcontrastador: Use @client.destroy! if you're not checking the result
[06:55:49] ferr: has joined #RubyOnRails
[06:55:56] elcontrastador: i did that...i swear it's like it's not even being called...
[06:56:13] elcontrastador: i'll do destroy! again and test
[06:56:22] DrYockel: has joined #RubyOnRails
[06:56:36] elcontrastador: oh, well...i had it like that for last 30+ attempts
[06:57:09] elcontrastador: nothing showing in server log...just the redirect db dip
[06:57:22] elcontrastador: (related to errors or destroy)
[06:57:32] sevenseacat: i'm not folllowing
[06:58:16] elcontrastador: i had @client.destroy! already set...is what i meant. Rails server console log shows no errors...just the redirect
[06:58:36] sevenseacat: what redirect?
[06:59:11] elcontrastador: redirect_to clients_url within Client#destroy
[06:59:28] sevenseacat: ok so the js alert part is fine?
[06:59:43] elcontrastador: no...the js alert never fires either
[07:00:05] elcontrastador: it acts like a simple like to clients_url
[07:00:06] sevenseacat: can you gist the logs of what you're seeing?
[07:01:53] tamouse__: ACTION waves to sevenseacat 
[07:02:09] sevenseacat: heya tamouse__ , long time no see! how are you?
[07:02:24] elcontrastador: https://gist.github.com/elcontrastador/820d5cac9bd3fc86df5aaf8717c4037a
[07:02:26] tamouse__: i'm doing well, busy af :)
[07:02:44] tamouse__: i've been writing a bunch of React lately
[07:02:50] sevenseacat: know them feels
[07:03:22] tamouse__: i keep trying to get into Elixir and not getting far, and forgetting everything when i get back to it
[07:03:36] sevenseacat: know them feels also lol
[07:04:16] tamouse__: i was not even on irc for months, it seemed
[07:04:30] sevenseacat: elcontrastador: thats what I thought - you're not even calling the destroy action
[07:04:48] sevenseacat: do you have a JS error on your page somewhere?
[07:05:05] bronson: has joined #RubyOnRails
[07:06:50] elcontrastador: yeah...that makes sense.. safari js console shows Failed to load resource: the server responded with a status of 500 (Internal Server Error)
[07:07:27] elcontrastador: that would explain the alert maybe but not the delete action, right?
[07:07:28] sevenseacat: you need to look at fixing that - Rails performs delete requests via JS so if you have errors, they wont work
[07:07:49] elcontrastador: had no idea that was via js
[07:08:48] elcontrastador: i'll try to get the js fixed before i waste any more time... was prioritizing and alert was low down on the list
[07:09:59] tamouse__: if i may, elcontrastador: always have the JS console open to check for errors
[07:10:14] elcontrastador: ok, just realized those js load errors were many hours old and have been fixed. cleared log and it's running clean
[07:10:47] sevenseacat: okay. are you loading rails' ujs helper in your js?
[07:10:48] elcontrastador: doesnt work...mind u...
[07:11:33] elcontrastador: default asset pipeline config...looking now.
[07:12:18] elcontrastador: looks like default has rails-ujs commented out within application.js
[07:14:04] tamouse__: ah, careful, elcontrastador: sprockets directives are in comments
[07:14:26] elcontrastador: /= require rails-ujs
[07:14:26] elcontrastador: /= require turbolinks
[07:14:26] elcontrastador: /= require_tree .
[07:14:35] elcontrastador: double slash slash
[07:14:46] sevenseacat: are you including that application.js into your view?
[07:15:03] elcontrastador: oh shit...i am not...
[07:15:25] sevenseacat: it usually goes in your head somewhere
[07:16:43] Guest97372: has joined #RubyOnRails
[07:17:31] tamouse__: i'm off to sleep. good to see you, sevenseacat
[07:17:41] sevenseacat: have a good one :)
[07:18:02] alexday: has left #RubyOnRails: ("WeeChat 1.9.1")
[07:18:33] kitsuneyo: has joined #RubyOnRails
[07:19:05] elcontrastador: what's the relative path to the application.js from the view...do i reference assets/javascripts/application.js or just "application.js"
[07:19:49] sevenseacat: just "application.js", ie. `javascript_include_tag "application.js"`
[07:22:18] elcontrastador: ok...well huge progress...the #destroy is being called, alert works but...
[07:22:19] elcontrastador: ActionController::InvalidAuthenticityToken in ClientsController#destroy
[07:22:46] sevenseacat: now youre missing your csrf_meta_tags in your head also
[07:23:03] elcontrastador: i can google this i'm sure...i was way off trying javascript first and u put me on the right track...thx much
[07:23:28] elcontrastador: ok...i'll get that fixed up...
[07:27:10] elcontrastador: haha...that was funny. It's all better. I hit my byebug in the #destroy method finally and i was just sitting there watching the patch hang saying "WTF!?"...console log check and was like whew!
[07:28:08] elcontrastador: sevenseacat: thx man, appreciate it
[07:31:30] fragamus: has joined #RubyOnRails
[07:31:51] kitsuneyo: has joined #RubyOnRails
[07:32:32] ahrs: has joined #RubyOnRails
[07:49:57] Guest97372: has joined #RubyOnRails
[07:53:30] rrichardsr3: has joined #RubyOnRails
[07:55:23] elcontrastador: sevenseacat: https://gist.github.com/elcontrastador/a038accc92c95831aaf91682acd1eaec
[07:56:37] sevenseacat: you might have to elaborate, with maybe some logs showing the name not 'cruding'
[07:58:06] kitsuneyo: has joined #RubyOnRails
[08:01:24] elcontrastador: edit existing gist.. Line 208 (scroll right)... name: "" as expected
[08:03:38] elcontrastador: i found the prob... later in the file another textfield named :name. I suck... I need to get sleep i guess
[08:05:46] bronson: has joined #RubyOnRails
[08:08:34] LambdaSource: has joined #RubyOnRails
[08:08:39] nix1947: has joined #RubyOnRails
[08:18:12] rrichardsr3: has joined #RubyOnRails
[08:20:03] Sigyn: has joined #RubyOnRails
[08:33:08] gknathk: has joined #RubyOnRails
[08:34:20] gknathk: I have an array of hash, and while parsing i get an error "https://gist.github.com/anonymous/2bca9d75026c12cf7aa305adcc24cbec". Can someone help me here?
[08:40:32] sevenseacat: doesnt look like the problem is in the parsing, its in your calling parsed["TT (Theory Total)"]
[08:40:52] sevenseacat: given parsed is an array
[08:41:12] sevenseacat: do you mean parsed[0]["TT (Theory Total)"] ?
[08:43:37] marr: has joined #RubyOnRails
[08:44:38] gknathk: sevenseacat: yeah you are right. But in that case, i will get only one result. But I wanted to get the results of each Hash. How can i do that ?
[08:45:01] sevenseacat: then you want to iterate over the array? depends on what youre trying to do
[08:47:36] gknathk: sevenseacat: yes correct, i am trying to finding a way to iterate over the array. Currently doing like this https://gist.github.com/anonymous/22267c06745b49e25865ef541db264c3 but i need to iterate over the array.
[08:52:17] srinidhi: has joined #RubyOnRails
[08:54:49] paranoicsan: has joined #RubyOnRails
[08:55:20] lxsameer: has joined #RubyOnRails
[08:56:48] DrYockel: has joined #RubyOnRails
[08:59:30] DrYockel: has joined #RubyOnRails
[09:01:12] gknathk_: has joined #RubyOnRails
[09:09:28] Cork: is there a similar function to attribute for activemodel?
[09:12:18] srinidhi: has joined #RubyOnRails
[09:13:42] tbuehlmann: Cork, someone wrote a gem for that: https://github.com/Azdaroth/active_model_attributes
[09:13:57] tbuehlmann: never used it though, no idea whether it works or not
[09:14:05] dminuoso_: has joined #RubyOnRails
[09:14:28] dminuoso_: Pundit question: If you had a blanket policy that on any action just checks whether a user has a role, would you just use a simple headless policy instead?
[09:15:01] timdotrb: has joined #RubyOnRails
[09:16:23] tbuehlmann: what's a blanket policy?
[09:21:28] ams__: has joined #RubyOnRails
[09:22:25] dminuoso_: tbuehlmann: https://gist.github.com/anonymous/4bbafb56ad643a80a32e64864c4c18f7
[09:23:16] dminuoso_: I have certain resources where I just have a general "may interact with - or not" based on just a role.
[09:23:49] sevenseacat: oh in that case yeah I usually just have the type of policy that inherits from struct
[09:24:28] sevenseacat: aaaand thats called a headless policy. yep.
[09:25:27] dminuoso_: Alright, thanks. I suppose I'll go for that.
[09:26:03] tbuehlmann: if there's a model, I'd use a regular policy, but I guess that's really just personal preference
[09:30:00] dminuoso_: tbuehlmann: Can you explain your reasoning behind this?
[09:42:26] Ergo: has joined #RubyOnRails
[09:45:21] tbuehlmann: when I implement a "regular" policy for a controller/resource, I define every method needed (unless it's covered by the application policy). how is your policy different from a "regular" one? it's not, I'd say, it's just that the methods all follow the same rule. but it would behave differently when used, as in using #any? instead of #create?. so I'd have to know about this instead of just using the controller method's name
[09:46:43] bruno-: has joined #RubyOnRails
[09:48:13] dminuoso_: tbuehlmann: Right, and if all the methods follow the same rule (i.e. have the same implementation), it's my thought that they ought to be the same method in the first place.
[09:48:52] tbuehlmann: you could also just use a private method to dry this, if you want. by this you wouldn't change the default controller method names
[09:49:40] tbuehlmann: also, this could change, right? the rule could change for #create, you'd need to change it then
[09:50:23] tbuehlmann: I hear your yagni, but it's such a small thing I would implement it as mentioned right away
[09:50:35] mtkd: has joined #RubyOnRails
[09:57:39] dminuoso_: tbuehlmann: I had not considered the possibility of changing this in the future, I guess it's a fair point.
[09:58:10] rgr: has joined #RubyOnRails
[09:58:45] blackmesa: has joined #RubyOnRails
[09:59:56] dminuoso_: tbuehlmann: Right now Im trying to remove magical dependencies where things connect to each other purely by name and convention.
[10:00:43] dminuoso_: Each action for example must have some `render :foo, locals: { data: data }` - this actually has proven to be less error prone in some interesting ways.
[10:01:22] tbuehlmann: yeah, I read this the other day
[10:01:25] dminuoso_: So I'm trying to find any and all reasons to not have some plain `authorize @user`, but I guess I could be more explicit and use `authorize @user, :any?`
[10:02:48] tbuehlmann: can you even monkeypatch actiondispatch (or whatever framework lib is responsible) and disable copying instance variables to the view? or will it explode of some internal thingies?
[10:02:57] tbuehlmann: you could name it actionmonkeydispatch
[10:03:25] cheeti: has joined #RubyOnRails
[10:03:29] dminuoso_: tbuehlmann: Indeed I could. I remember it was quite easy to find even.
[10:03:34] lupine: dminuoso_: but that's the raison d'etre of rails, isn't it?
[10:04:08] cheeti: hi any tool for threat modelling using ruby on rails?
[10:05:18] dminuoso_: lupine: Not to me anymore. The two things Im mainly concerned about these days is ActiveRecord and how quickly it integrates with things like form helpers.
[10:05:51] rgr_: has joined #RubyOnRails
[10:06:12] dminuoso_: lupine: I've come to appreciate looking at code and reason about what it does by just.. well. looking at it.
[10:06:35] lupine: oddly, I find AR especially bad for that kind of transparency
[10:06:36] bronson: has joined #RubyOnRails
[10:07:38] blackmesa1: has joined #RubyOnRails
[10:07:52] dminuoso_: lupine: Im just biased because I spent the past 10 months or so writing React full time, so I guess I'm just aiming at the view portion and how it integrates into the controller.
[10:08:39] dminuoso_: I would have switched to Elixir already, but we have realized that the oracle support in Ecto is lacking (though there is an adapter that is quite advanced, but it needs work)
[10:10:53] dminuoso_: lupine: How is AR bad for that kind of transparency though?
[10:11:04] dminuoso_: I mean aside from the way that columns end up as attributes, it's highly explicit.
[10:11:26] lupine: no explicit column declarations, intermingling of concerns, convention in namings, etc
[10:11:42] dminuoso_: Ah, I fully agree with you.
[10:11:51] dminuoso_: Ecto has all of these adressed properly.
[10:13:01] dminuoso_: lupine: In all fairness, you can make column declarations kind of explicit by using the attribute API ;p
[10:13:37] dminuoso_: In fact if you work with Oracle databases that are not under your control, you are kind of forced to do it anyway
[10:16:32] blackmesa1: has joined #RubyOnRails
[10:17:23] dionysus69: has joined #RubyOnRails
[10:18:25] fragamus: has joined #RubyOnRails
[10:19:54] blackmesa1: has joined #RubyOnRails
[10:20:17] cheeti: hi, can you suggest any threat modelling tool using ruby on rails?
[10:32:06] Cork: tbuehlmann: sorry for the delay, got stuck on some problems; thx for the link!
[10:38:05] arBmind: has joined #RubyOnRails
[10:48:24] FernandoBasso: has joined #RubyOnRails
[10:51:41] srinidhi: has joined #RubyOnRails
[10:54:22] apparition: has joined #RubyOnRails
[11:06:27] apparition: has joined #RubyOnRails
[11:25:39] marr: has joined #RubyOnRails
[11:44:13] one_zero: has joined #RubyOnRails
[11:55:53] cheeti: has joined #RubyOnRails
[11:57:05] cheeti: hi can any saggest threat modeling tool using ror
[11:57:36] tbuehlmann: what's your understanding of a "threat modeling tool"?
[11:57:41] cheeti: hi can any one suggest threat modelling tool using ror
[11:58:21] cheeti: tbuehlmann i tried https://github.com/mozilla/seasponge
[11:59:08] cheeti: tbuehlmann but it's not working fine
[11:59:31] tbuehlmann: oh, okay, I can't suggest one
[12:01:38] cheeti: tbuehlmann i am not able to export PDF report using seasponge
[12:05:31] dminuoso_: Tried reading some articles about thread modelling.
[12:05:38] dminuoso_: Too many buzzwords without content.
[12:06:07] dminuoso_: Sounds to be like people want to get paid for drawing things. I say: do it right and become a graphical designer.
[12:07:41] bronson: has joined #RubyOnRails
[12:08:31] srinidhi: has joined #RubyOnRails
[12:08:40] cheeti: dminuoso_ what?
[12:09:43] mostlybadfly: has joined #RubyOnRails
[12:12:56] hammer065: has joined #RubyOnRails
[12:21:13] dionysus69: has joined #RubyOnRails
[12:34:47] kitsuneyo: has joined #RubyOnRails
[12:37:36] brycesenz: has joined #RubyOnRails
[12:40:49] Ergo: has joined #RubyOnRails
[13:05:06] mcr1: has joined #RubyOnRails
[13:11:39] conta: has joined #RubyOnRails
[13:12:11] chouhoulis: has joined #RubyOnRails
[13:21:11] rfoust: has joined #RubyOnRails
[13:21:20] bratsche: has joined #RubyOnRails
[13:27:06] bruno-: has joined #RubyOnRails
[13:30:06] xco: has joined #RubyOnRails
[13:34:47] fmcgeough: has joined #RubyOnRails
[13:58:48] Sigyn: has joined #RubyOnRails
[13:59:46] Sigyn: has joined #RubyOnRails
[14:01:21] Sigyn: has joined #RubyOnRails
[14:02:22] Sigyn: has joined #RubyOnRails
[14:03:54] ferr1: has joined #RubyOnRails
[14:08:42] jobewan: has joined #RubyOnRails
[14:08:52] bronson: has joined #RubyOnRails
[14:15:02] Sigyn: has joined #RubyOnRails
[14:21:20] xiljin: has joined #RubyOnRails
[14:22:42] tcopeland: has joined #RubyOnRails
[14:26:14] rfoust: has joined #RubyOnRails
[14:31:30] Xdega: has joined #RubyOnRails
[14:33:31] Xdega: Anyone here done much with the Webpacker gem?
[14:35:41] arBmind: has joined #RubyOnRails
[14:39:10] FrostCandy: has joined #RubyOnRails
[14:40:22] r00twrh: has joined #RubyOnRails
[14:40:41] Saukk: has joined #RubyOnRails
[14:40:46] r00twrh: Is it possible to have rails output the SQL it is going to use for a table creation without actually writing to the db?
[14:44:08] r00twrh: essentially I want to take a migration file and get the postgres sql it is going to use to gen the tables
[14:47:52] FrostCandy: I have controller Class BurgersController and model Class Burger, i then call Burger.throwout(param), will ruby/rails look to see if that method is in the controller and the model? or just the model?
[14:48:24] kuwze: Xdega: there's this tutorial I've been following: https://x-team.com/blog/get-in-full-stack-shape-with-rails-5-1-webpacker-and-reactjs/
[14:55:53] xhoy: has joined #RubyOnRails
[14:56:25] orbyt_: has joined #RubyOnRails
[14:56:50] gusrub: has joined #RubyOnRails
[14:58:29] Xdega: Thanks Kuwze. I have been following the official documentation. I have had a working project that was using this also. This tutorial is for creating a new project from scratch. I am implementing this into an existing project.
[14:59:46] Xdega: I guess I would explain my problem. When trying to install the Webpacker gem, it is skipping the binstubs, and leaving me without binstubs for webpack,webpack-dev-server... this means I cannot even run the webpacker:install:react script.
[15:02:23] gil_: has joined #RubyOnRails
[15:05:36] ych: has joined #RubyOnRails
[15:14:07] cschneid_: has joined #RubyOnRails
[15:17:40] blackmesa1: has joined #RubyOnRails
[15:18:54] blackmesa: has joined #RubyOnRails
[15:19:48] jjaii9: has joined #RubyOnRails
[15:20:45] jjaii9: hey, I'm trying to change a belongs_to to has_many through and need to swap out prod data, i plan to stick update calls in the migration (after adding the new table, and before dropping the foreign key column), is that the best way? How can I ensure i wont lose data if an update failed? thanks
[15:27:39] AzaToth: has joined #RubyOnRails
[15:34:27] cagomez: has joined #RubyOnRails
[15:39:23] LambdaSource: has joined #RubyOnRails
[15:40:51] jjaii9: has joined #RubyOnRails
[15:41:01] jjaii9: hey, I'm trying to change a belongs_to to has_many through and need to swap out prod data, i plan to stick update calls in the migration (after adding the new table, and before dropping the foreign key column), is that the best way? How can I ensure i wont lose data if an update failed? thanks
[15:42:25] Xdega: Is that a double post jjaii9?
[15:42:41] jjaii9: Xdega: sorry, I was disconnected. wasn't sure if anyone answered it already :/
[15:43:14] Xdega: Lol. Nope.
[15:51:36] tcopeland: r00twrh: I don’t see a nice way to do it… but in a pinch you could define your own version of execute and run the migration class in a console https://gist.github.com/tcopeland/b42dfcc436f2cdf21186a0c3bfec2e58
[16:02:32] dblessing: has joined #RubyOnRails
[16:04:22] troys: has joined #RubyOnRails
[16:07:08] kitsuneyo: has joined #RubyOnRails
[16:08:03] [Butch]: has joined #RubyOnRails
[16:09:06] orbyt_: has joined #RubyOnRails
[16:09:41] bronson: has joined #RubyOnRails
[16:11:14] rrichardsr3: has joined #RubyOnRails
[16:12:08] mtkd: has joined #RubyOnRails
[16:16:18] ShalokShalom_: has joined #RubyOnRails
[16:17:53] dminuoso: has joined #RubyOnRails
[16:18:56] dminuoso: Given some pundit policies, is there some succint way of accomplishing something along this JSX pseudocode? https://gist.github.com/norc/ffd768b9f079e68dfa9b0903210a16b9
[16:19:34] dminuoso: React has completely ruined me, I no longer seem to be capable of hacking ugly HAML templates.
[16:20:28] dminuoso: In rails terms: Say you are trying to draw a panel with multiple links (each of which might require some role), and you only want to draw the entire panel, if there's at least one link the user ought to see.
[16:21:47] dminuoso: Technically its not even linked to roles, it's linked to policies.
[16:28:38] elcontrastador: has joined #RubyOnRails
[16:32:25] marr: has joined #RubyOnRails
[16:34:01] Aherin: has joined #RubyOnRails
[16:36:17] dminuoso: My main issue is that I have no way of taking a chunk of slim code, and assign it to a variable (unless I push it into a separate partial and render it - but that's just downright crazy)
[16:38:20] blackmesa: has joined #RubyOnRails
[16:44:55] conta: has joined #RubyOnRails
[16:48:31] timdotrb: has joined #RubyOnRails
[16:52:46] dionysus69: has joined #RubyOnRails
[16:54:59] dminuoso_: has joined #RubyOnRails
[16:55:01] dminuoso_: https://gist.github.com/anonymous/61bbaa1207d8033f0798a744e034432e
[16:55:05] dminuoso_: This is just cancer.
[16:57:04] DTZUZO: has joined #RubyOnRails
[17:00:44] ahrs: has joined #RubyOnRails
[17:08:16] timdotrb: has joined #RubyOnRails
[17:21:24] [Butch]: has joined #RubyOnRails
[17:24:13] quirkycoders: has joined #RubyOnRails
[17:25:40] cagomez: has joined #RubyOnRails
[17:25:51] cagomez: has joined #RubyOnRails
[17:29:59] hahuang65: has joined #RubyOnRails
[17:30:51] Guest97372: has joined #RubyOnRails
[17:39:09] chouhoulis: has joined #RubyOnRails
[17:41:43] ahrs: has joined #RubyOnRails
[17:44:36] orbyt_: has joined #RubyOnRails
[17:52:31] AnotherOne: has joined #RubyOnRails
[17:56:54] DTZUZO: has joined #RubyOnRails
[17:57:06] milesmatthias: has joined #RubyOnRails
[17:58:44] weaksauce: has joined #RubyOnRails
[17:58:51] orbyt_: has joined #RubyOnRails
[18:02:36] Danny1: has joined #RubyOnRails
[18:03:01] mcr1: has joined #RubyOnRails
[18:05:13] Guest97372: has joined #RubyOnRails
[18:08:26] desnudopenguino: has joined #RubyOnRails
[18:10:05] milesmatthias: has joined #RubyOnRails
[18:10:50] bronson: has joined #RubyOnRails
[18:17:13] mtkd: has joined #RubyOnRails
[18:25:46] dionysus70: has joined #RubyOnRails
[18:48:06] milesmatthias: has joined #RubyOnRails
[18:50:25] blackmesa: has joined #RubyOnRails
[18:56:28] brycesenz: has joined #RubyOnRails
[18:57:24] sagax: has joined #RubyOnRails
[19:07:39] quirkycoders: has joined #RubyOnRails
[19:08:25] quirkycoders: So I have devise's warden working fine on one computer but on a different computer with the same code base it doesn't...I keep getting unauthorized and can't figure out why.
[19:09:25] quirkycoders: I'm using a docker setup which should ensure that the environments are pretty much the same but I'm getting different results. any ideas?
[19:16:28] jphase: has joined #RubyOnRails
[19:16:43] desnudopenguino: quirkycoders: do you have the correct permissions set for the users on the other host?
[19:17:11] quirkycoders: both boxes are local dev workstation. works on one but not the other
[19:17:22] quirkycoders: both workstations are using the same docker setup
[19:18:09] quirkycoders: on one system warden throws an 401 unauthorized. On the other workstation I get a 200.
[19:18:16] netzfisch: has joined #RubyOnRails
[19:19:07] bratsche: has joined #RubyOnRails
[19:31:28] brycesenz: has joined #RubyOnRails
[19:36:06] fryguy: need way more details than that
[19:37:17] mcr1: has joined #RubyOnRails
[19:38:28] gusrub: has joined #RubyOnRails
[19:39:17] SteenJobs: has joined #RubyOnRails
[19:42:49] orbyt_: has joined #RubyOnRails
[19:46:40] tanuki: has joined #RubyOnRails
[19:52:15] srinidhi: has joined #RubyOnRails
[19:52:45] hahuang65: has joined #RubyOnRails
[19:57:59] adgtl-: has joined #RubyOnRails
[20:01:01] ur5us: has joined #RubyOnRails
[20:08:36] kies: has joined #RubyOnRails
[20:11:45] bronson: has joined #RubyOnRails
[20:12:11] gheegh: has joined #RubyOnRails
[20:16:42] dopie: has joined #RubyOnRails
[20:16:57] dopie: hey guys can someone explain why this test is not passing?
[20:16:58] dopie: https://gist.github.com/staycreativedesign/0e2fad6e4f0413be517423f20d8f809b
[20:19:01] arBmind: has joined #RubyOnRails
[20:19:07] kitsuneyo: has joined #RubyOnRails
[20:19:19] cagomez: Foo has many Bars. is there a way to check if Foo has ever had a Bar before adding it to Foo?
[20:20:12] dminuoso: dopie, yes.
[20:22:22] dopie: dminuoso: you can?
[20:25:19] dminuoso: dopie, you first create 4 teams for the sponser in your before hook, then you add another..
[20:25:33] dminuoso: In my world of arithmetic that equals to 5 teams total, violating your expectation.
[20:25:35] dminuoso: But I could be wrong
[20:25:43] dminuoso: ¯\_(ツ)_/¯
[20:26:20] dminuoso: dopie, also please refrain from using before to set up your subject. Use let instead.
[20:26:49] dopie: create_list(:team, 4, sponsor: @admin)
[20:26:50] dminuoso: http://www.betterspecs.org/#let
[20:27:00] dopie: that creates 4 teams
[20:27:22] dminuoso: https://gist.github.com/staycreativedesign/0e2fad6e4f0413be517423f20d8f809b#file-team_spec-rb-L11
[20:27:26] dminuoso: and that adds another.
[20:28:07] dopie: correct but save! gives an AR error while save does not
[20:28:09] dopie: since I have
[20:28:10] dopie: validates_length_of :sponsored_teams, maximum: 4
[20:28:23] dopie: why is .save still creating it?
[20:28:28] dminuoso: dopie, it's not.
[20:28:29] sunrunner20: has joined #RubyOnRails
[20:28:37] dopie: i mean saving it
[20:28:45] dopie: what do you mean its not?
[20:28:56] dminuoso: dopie, what makes you say it saves it?
[20:29:21] dminuoso: that .save in there is effectively a no-op
[20:29:25] dminuoso: well it runs the validations I suppose.
[20:29:50] dopie: I pry it and there are 5 teams which the corresponding sponsor_id:
[20:29:59] mcr1: has joined #RubyOnRails
[20:30:12] dminuoso: In that AR object you hold in your hands, but that holds true whether you save or not.
[20:30:44] dminuoso: save is just like save!, except save returns true or false depending on whether it a) passes validations and b) succeeds in saving, and save! throws an exception on failure instead.
[20:31:00] dminuoso: so by using .save you silently ignore the "false" error
[20:31:18] dopie: ahhh......
[20:32:00] dopie: so it fails validation, and still saves?!@
[20:32:05] dminuoso: no it does not save.
[20:32:15] mtkd: has joined #RubyOnRails
[20:32:22] dminuoso: dopie, think of .save as "persist_to_database"
[20:32:30] dopie: yes and it is persisted
[20:32:35] dminuoso: what makes you say that?
[20:33:23] dminuoso: dopie, you can verify this by using @admin.persisted?
[20:33:49] dopie: ok hold on
[20:34:59] dopie: when I do that it returns true
[20:34:59] blorgo_: has joined #RubyOnRails
[20:35:01] dopie: [3] pry(#<RSpec::ExampleGroups::Team>)> @admin.persisted?
[20:35:15] dopie: https://gist.github.com/staycreativedesign/0e2fad6e4f0413be517423f20d8f809b#file-pry-rb
[20:36:23] dminuoso: dopie, try Team.reload first before you check Team.all
[20:36:31] dminuoso: I'm not quite sure how aggressive AR caches
[20:37:53] dminuoso: dopie, on that note also add expect(@admin.save).to be(false) and/or expect(@admin.valid?).to be(false)
[20:38:21] dminuoso: And really, please switch to let - those ivars hurt my eyes. :(
[20:38:41] dopie: dminuoso: ok :)
[20:48:42] gheegh: has joined #RubyOnRails
[20:48:55] dopie: dminuoso: updated :)
[20:49:07] dopie: still get the 5 team failure
[20:50:22] dminuoso: dopie, as it is to be expected.
[20:51:33] dminuoso: Im not sure whether we are on the same page. If obj.valid? is false, and obj.persisted? is false, then the record was never written to the database.
[20:51:33] jhass: has joined #RubyOnRails
[20:51:55] dopie: but object.persisted? is true
[20:52:45] dopie: admin.persisted is true
[20:53:01] mtkd: has joined #RubyOnRails
[20:53:50] dminuoso: dopie, can you make a new rails app `rails new testcase --api`, and reproduce it?
[20:54:42] dminuoso: (without rspec, just 2 minimal models and a simple runner script)
[20:57:08] dopie: dminuoso: I will get back to you wne I can as I have to head home now :) Thank you very much for your help and direction
[20:58:25] dopie: dminuoso: so just having
[20:58:26] dopie: expect(admin.save).to be(false)
[20:58:26] dopie: expect(admin.valid?).to be(false)
[20:58:31] dopie: and those passing
[20:58:57] dopie: obviously means that the test is passing and nothing is being saved
[20:59:51] dminuoso: dopie, well - if you also have admin.persisted? #=> true in that, then there's something screwed up.
[20:59:58] mr-spoon: has joined #RubyOnRails
[21:00:03] dminuoso: It should be true or false on all accounts.
[21:00:30] dminuoso: dopie, but the test as is is not telling much.
[21:00:43] dminuoso: dopie, the reason is that .save does not "update" your object you hold in hand.
[21:00:56] dminuoso: it either manages to synchronize the database with whats in there, or it doesn't.
[21:01:10] dopie: Failure/Error: expect(admin.persisted?).to be(false)
[21:01:17] dminuoso: matthewd, ^- is this a bug?
[21:01:38] dminuoso: !admin.save && admin.persisted? #=> true
[21:02:19] dopie: these two pass
[21:02:20] dopie: expect(admin.save).to be(false)
[21:02:20] dopie: expect(admin.valid?).to be(false)
[21:02:22] matthewd: dminuoso: persisted? means "has a row in the DB", not "has nothing to save"
[21:02:23] kuwze: has joined #RubyOnRails
[21:02:36] matthewd: You want dirty?
[21:04:01] dopie: admin.changed?
[21:04:46] dminuoso: dopie, https://gist.github.com/norc/91f579cd77a6c8328766ed13d0f0d6f2
[21:05:25] dopie: got it why is the object kept around?
[21:05:27] dopie: dminuoso:
[21:05:28] mr-spoon: has joined #RubyOnRails
[21:06:24] dminuoso: dopie, I can't say why it was done this way, but it's useful when you want to re-render a form. You can render an :edit template using that same object again, so the user gets to see his "incorrect" input
[21:07:48] dminuoso: dopie, you can directly inspect obj.errors to see the exact validation errors (which prevented the save)
[21:08:58] jhass: has joined #RubyOnRails
[21:09:21] dopie: yes I did that but I was just going crazy as to why the object was still there rofl
[21:09:29] blackmesa: has joined #RubyOnRails
[21:12:39] dminuoso: dopie, https://gist.github.com/norc/b247e4e901e36771a5f5a0c98a9d5c67
[21:13:10] dminuoso: this is a common theme in rails controllers, so its really useful that if @user.save is false (it couldn't save because there were validation errors), that these "incorrect" attribute remain for when we render :edit anew.
[21:14:11] dminuoso: I think .update might have been incorrect there, probably should be .assign
[21:15:58] dopie: dminuoso: thanks or the explanation
[21:21:36] Derperperd: has joined #RubyOnRails
[21:22:38] lxsameer: has joined #RubyOnRails
[21:28:55] roshanavand: has joined #RubyOnRails
[21:38:40] shilon: has joined #RubyOnRails
[21:45:10] fragamus: has joined #RubyOnRails
[21:54:40] weaksauce: has joined #RubyOnRails
[21:55:35] gheegh: has joined #RubyOnRails
[22:01:23] kitsuneyo: has joined #RubyOnRails
[22:12:50] bronson: has joined #RubyOnRails
[22:13:03] kitsuneyo: has joined #RubyOnRails
[22:16:07] AntiSpamMeta: has joined #RubyOnRails
[22:17:17] jphase: has joined #RubyOnRails
[22:20:55] fmcgeough: has joined #RubyOnRails
[22:26:09] Radar: GOOD MORNING
[22:36:34] mcr1: has joined #RubyOnRails
[22:38:01] Ropeney: has joined #RubyOnRails
[22:44:00] p8m: has joined #RubyOnRails
[22:49:51] mrgordon: has joined #RubyOnRails
[22:50:42] mrgordon: i’m trying to upgrade to ruby 2.4 with rails 3.2 until another part of my team can upgrade rails. it works for most of my applications but one is having problems like this
[22:50:43] mrgordon: irb(main):010:0> 1800 + 15.seconds
[22:50:44] mrgordon: TypeError: ActiveSupport::Duration can't be coerced into Integer
[22:51:19] mrgordon: I see 15.seconds.to_i is defined, so how can I allow Numeric + Duration to coerce Duration.to_i to make it a legal operation?
[22:52:08] mrgordon: Duration + Numeric already works due to https://stackoverflow.com/a/44286374
[22:54:21] matthewd: mrgordon: Are you using 3-2-stable?
[22:54:53] mrgordon: yes 3.2.22.5
[22:55:15] matthewd: I mean the git branch, as opposed to a released gem
[22:55:35] mrgordon: no using the gem. should we consider switching?
[22:55:56] matthewd: I believe there are some unreleased compatibility changes in git
[22:56:28] matthewd: No idea whether they're relevant to your question, though
[23:05:09] mrgordon: has joined #RubyOnRails
[23:05:10] workmad3: has joined #RubyOnRails
[23:06:12] wethu: has joined #RubyOnRails
[23:11:10] tcopeland: has joined #RubyOnRails
[23:17:49] dopie: has joined #RubyOnRails
[23:20:11] cagomez: has joined #RubyOnRails
[23:21:28] Shilon_: has joined #RubyOnRails
[23:24:08] fragamus: has joined #RubyOnRails
[23:25:44] agent_white: has joined #RubyOnRails
[23:28:29] irishfromua: has joined #RubyOnRails
[23:36:23] shilon: has joined #RubyOnRails
[23:43:53] gheegh: has joined #RubyOnRails
[23:51:50] timdotrb: has joined #RubyOnRails
[23:53:52] knight33: has joined #RubyOnRails