« Back to channel list

#RubyOnRails - 30 June 2016

« Back 1 day Forward 1 day »
[00:02:02] jenrzzz_: has joined #RubyOnRails
[00:06:00] mrkhlm: has joined #RubyOnRails
[00:06:28] pawnbox: has joined #RubyOnRails
[00:07:26] jhack: has joined #RubyOnRails
[00:12:12] hahuang61: has joined #RubyOnRails
[00:16:50] jhack: has joined #RubyOnRails
[00:20:29] voidDotClass: has joined #RubyOnRails
[00:24:59] speakingcode: has joined #RubyOnRails
[00:28:41] Rodya_: has joined #RubyOnRails
[00:29:43] skiz: has joined #RubyOnRails
[00:33:55] GodFather: has joined #RubyOnRails
[00:35:45] centrx: has joined #RubyOnRails
[00:36:04] djbkd: has joined #RubyOnRails
[00:36:40] jhack: has joined #RubyOnRails
[00:39:30] voidDotClass: I have an item called Product and ProductData. A product can have multiple ProductData (has_many :product_data). I'm doing a query like: Product.joins(:product_data).where(product_data: {marketplace_id: market_id}). This obviously does a join query and returns those products who have data for the marketplace xxx. Problem is, if I'm later looping over the results, and i try to access product.product_data, it does a second query like Select * from pro
[00:39:31] voidDotClass: duct_data where product_id = xxx. Why can't it cache the results from the prev query and return that?
[00:47:20] nertzy: has joined #RubyOnRails
[00:48:53] dminuoso: has joined #RubyOnRails
[01:03:58] jenrzzz: has joined #RubyOnRails
[01:06:30] chouhoul_: has joined #RubyOnRails
[01:07:34] quazimodo: has joined #RubyOnRails
[01:07:35] quazimod1: has joined #RubyOnRails
[01:09:42] centrx: has joined #RubyOnRails
[01:10:28] joowh85: has joined #RubyOnRails
[01:16:54] arthurl: has joined #RubyOnRails
[01:18:40] ekinmur: has joined #RubyOnRails
[01:19:58] danny__: has joined #RubyOnRails
[01:20:00] jhack: has joined #RubyOnRails
[01:20:49] chouhoulis: has joined #RubyOnRails
[01:22:41] danny__: if i have an active record object, which has an association, and that association depends on another one, and i want to create an object (the top-most), and it's children in one operation, how can i, if one of the children needs the ID of another
[01:22:46] danny__: im not explaining this very well
[01:23:55] danny__: Let's say I have a School object, and I want to create a duplicate of it
[01:24:08] AndrewIsHere: has joined #RubyOnRails
[01:24:12] quazimodo: has joined #RubyOnRails
[01:24:15] danny__: each School has associations for Classrooms, and Classrooms have Students
[01:24:16] quazimod1: has joined #RubyOnRails
[01:24:35] danny__: In one single operation, I want to create a new School with Classrooms and Students
[01:25:11] quazimodo: has joined #RubyOnRails
[01:25:34] danny__: so I do School.new, and I do School.classrooms << Classroom.new, and then I do School.students << Student.new
[01:25:52] danny__: the last line fails because I cant add the new student, because the classroom doesn't exist yet
[01:26:22] arthurl: has joined #RubyOnRails
[01:27:07] Radar: classroom = school.classrooms.build
[01:27:13] Radar: classroom.students.build(student_params)
[01:27:41] Radar: save the classroom to save the student (I think) and then school.students will return the student if you have your associations set up the way that I think you do.
[01:28:18] danny__: so the problem is that i don't want to do any save operations; only one, for school, so that if any of the downstream objects fail to save, NOTHING will get saved
[01:28:21] danny__: sort of like a transaction
[01:29:30] danny__: ...separately, and i know i can try it, but it will take me a lot of time to re-work my code: if you start a class with School.transaction do....and you do .save calls, and then you do a rollback, will it DELETE the data that it persisted to the database? if not, what does "transaction" do for you exactly?
[01:29:38] AndrewIsHere: has joined #RubyOnRails
[01:32:41] AndrewIs_: has joined #RubyOnRails
[01:38:20] quazimodo: has joined #RubyOnRails
[01:38:48] quazimodo: has joined #RubyOnRails
[01:39:13] macsteps: has joined #RubyOnRails
[01:39:17] pawnbox: has joined #RubyOnRails
[01:41:03] Radar: So wrap it in a transaction block?
[01:41:11] Radar: Danny__: It won't delete it... because it was never committed.
[01:41:12] asheinfeld: has joined #RubyOnRails
[01:42:08] danny__: but then im confused what transaction is good for. if i can't create Object B without having the ID from Object A, then how can I create Object B without first creating and saving Object A to the database?
[01:42:25] danny__: and then, if there's an issue saving Object B, i want to have not saved (or delete) Object A automatically
[01:42:29] sevenseacat: has joined #RubyOnRails
[01:43:27] nettoweb: has joined #RubyOnRails
[01:45:14] blackmes1: has joined #RubyOnRails
[01:49:41] dminuoso: has joined #RubyOnRails
[01:51:33] AndrewIsHere: has joined #RubyOnRails
[01:55:40] quazimodo: has joined #RubyOnRails
[01:55:47] quazimod1: has joined #RubyOnRails
[01:59:22] Sareuon: has joined #RubyOnRails
[02:00:26] Sareuon: Hi there, is there any gem that we can used to build thumbnail for Office files?
[02:01:40] one_zero: has joined #RubyOnRails
[02:09:12] voidDotClass: has joined #RubyOnRails
[02:11:25] quazimodo: has joined #RubyOnRails
[02:13:52] DZj091231kld: has joined #RubyOnRails
[02:14:07] hahuang61: has joined #RubyOnRails
[02:22:37] jenrzzz: has joined #RubyOnRails
[02:22:37] jenrzzz: has joined #RubyOnRails
[02:25:19] DoctorMonocular: has joined #RubyOnRails
[02:25:21] jtong: has joined #RubyOnRails
[02:25:55] Guest: has joined #RubyOnRails
[02:26:15] pawnbox: has joined #RubyOnRails
[02:31:03] DoctorMonocular: has joined #RubyOnRails
[02:36:48] chipotle: has joined #RubyOnRails
[02:37:07] jenrzzz: has joined #RubyOnRails
[02:37:07] jenrzzz: has joined #RubyOnRails
[02:40:55] AndrewIsHere: has joined #RubyOnRails
[02:42:45] nertzy: has joined #RubyOnRails
[02:43:20] zave: has joined #RubyOnRails
[02:45:19] phrozen77: has joined #RubyOnRails
[02:47:02] blackmes1: has joined #RubyOnRails
[02:48:36] jenrzzz: has joined #RubyOnRails
[02:48:36] jenrzzz: has joined #RubyOnRails
[02:51:40] dminuoso: has joined #RubyOnRails
[02:58:51] EasyCo: has joined #RubyOnRails
[03:02:10] pvertenten: has joined #RubyOnRails
[03:04:00] EasyCo: Hi team, quick question if you'll please. I have the following inflection: inflect.acronym 'ID'. The interesting thing is that it breaks previous migrations such as AddOwnerIdToVersions. Giving me a NameError: uninitialized constant. I'm not sure why this would matter for migrations.
[03:04:52] EasyCo: The obvious solution would be to just rename the migration class AddOwnerIDtoVersions but I fail to see why inflections would be important for the migration class name.
[03:06:22] dopamean_: has joined #RubyOnRails
[03:06:38] ftj: has joined #RubyOnRails
[03:07:01] rubyonrailed: has joined #RubyOnRails
[03:07:12] ElFerna: has joined #RubyOnRails
[03:08:55] justrohu: has joined #RubyOnRails
[03:09:17] arthurl: has joined #RubyOnRails
[03:11:22] Ropeney: has joined #RubyOnRails
[03:12:05] AndrewIsHere: has joined #RubyOnRails
[03:12:45] AndrewIsHere: has joined #RubyOnRails
[03:13:38] AndrewIsHere: has joined #RubyOnRails
[03:13:55] evansbee: has joined #RubyOnRails
[03:14:43] AndrewIsHere: has joined #RubyOnRails
[03:15:12] roamingdog: has joined #RubyOnRails
[03:17:53] pawnbox: has joined #RubyOnRails
[03:19:23] DoctorMonocular: has joined #RubyOnRails
[03:20:48] braincrash: has joined #RubyOnRails
[03:21:44] k3rn31: has joined #RubyOnRails
[03:24:21] macsteps: has joined #RubyOnRails
[03:32:20] Coldblackice: has joined #RubyOnRails
[03:32:45] workmad3: has joined #RubyOnRails
[03:44:05] Oliphaunte: has joined #RubyOnRails
[03:46:45] l4v2: in the def setup method, why do I need to declare the created variable as an instance variable?
[03:47:48] dc4: has joined #RubyOnRails
[03:48:24] jenrzzz: has joined #RubyOnRails
[03:48:24] jenrzzz: has joined #RubyOnRails
[03:51:32] jtong: has joined #RubyOnRails
[03:52:17] sevenseacat: what def setup method?
[03:52:24] dminuoso: has joined #RubyOnRails
[03:53:59] EasyCo: l4v2: You may want to be slightly more specific with your question.
[03:54:08] l4v2: class StaticPagesControllerTest < ActionController::TestCase
[03:55:04] l4v2: then say I’m going to have a lot of redundancy in the class, why do I make it an instance object? I’m not passing in an instance?
[03:55:10] sevenseacat: l4v2: wanna gist the code you're looking at?
[03:55:31] l4v2: ok hold on
[03:56:50] l4v2: https://gist.github.com/anonymous/1c5ccd40b57274110aa18ee5b14f72a0
[03:57:23] Hyuk: has joined #RubyOnRails
[03:57:39] sevenseacat: right, so you set the instance variable so it is accessible from other methods in the class - the tests
[03:58:59] sevenseacat: you're right that you're not defining an instance, but under the hood, one is getting created
[03:59:17] l4v2: is the setup method like a constructor?
[03:59:39] l4v2: Cause I tried looking that up, but it didn’t say
[04:00:24] sevenseacat: kind of. it gets run before each of your tests
[04:00:43] segy: has joined #RubyOnRails
[04:00:46] l4v2: ok, thank you
[04:02:35] l4v2: WHy do some classes like test unit require a gem, why isn’t it jsut put into the Gemfile?
[04:03:14] l4v2: require “test_helper” is generated with the test file
[04:03:57] sevenseacat: yes, that requires a file in your app, not a gem
[04:04:55] l4v2: so anything with require is a file or module?
[04:05:01] l4v2: but not a gem
[04:05:27] sevenseacat: require is for files, yes. those files may be either in your app or inside gems.
[04:05:36] sevenseacat: anywhere in your app's load path
[04:06:02] sevenseacat: this is all ruby stuff, nothing specific to rails
[04:08:20] l4v2: Yeah, I read all of that, but so much to take in the last few months.
[04:08:27] l4v2: thanks tho
[04:09:49] sevenseacat: I will say though, with ruby, if you're insistent on knowing how everything works under the hood, because there's so much metaprogramming involved thats a really deep rabbit hole
[04:14:52] hahuang61: has joined #RubyOnRails
[04:15:59] AndrewIsHere: has joined #RubyOnRails
[04:16:22] chipotle: has joined #RubyOnRails
[04:19:25] workmad3: has joined #RubyOnRails
[04:21:52] dc4: has joined #RubyOnRails
[04:28:38] pawnbox: has joined #RubyOnRails
[04:35:37] eserror: has joined #RubyOnRails
[04:41:11] Devalo: has joined #RubyOnRails
[04:42:34] dc4: has joined #RubyOnRails
[04:47:49] blackmes1: has joined #RubyOnRails
[04:50:03] jeromelanteri: has joined #RubyOnRails
[04:50:47] PotatoChipz: has joined #RubyOnRails
[04:51:30] alfiemax: has joined #RubyOnRails
[04:52:20] Devalo: has joined #RubyOnRails
[04:52:21] jeromelanteri: is it possible (and how ?) to have relation tables who may be link (or not) ? For example, imagine i have a relat_id in a model linked with the id of "relat" table id, but do that this field could be empty (null). And then, it may have a relation linked or not... (not sure i'm clear, tell me).
[04:53:10] dminuoso: has joined #RubyOnRails
[04:53:10] jeromelanteri: like relat_id can be null without any error generate.
[04:53:12] jtong: has joined #RubyOnRails
[04:57:56] naftilos76: has joined #RubyOnRails
[05:01:46] dminuoso: has joined #RubyOnRails
[05:04:44] quazimodo: has joined #RubyOnRails
[05:10:12] sebstrax: has joined #RubyOnRails
[05:12:57] rvanlieshout: has joined #RubyOnRails
[05:15:37] hahuang61: has joined #RubyOnRails
[05:16:34] quazimodo: has joined #RubyOnRails
[05:25:45] AndrewIsHere: has joined #RubyOnRails
[05:27:37] dminuoso: has joined #RubyOnRails
[05:30:15] swap_a_b: has joined #RubyOnRails
[05:41:57] pawnbox: has joined #RubyOnRails
[05:43:25] DoubleMalt: has joined #RubyOnRails
[05:45:25] segy: has joined #RubyOnRails
[05:46:23] hahuang61: has joined #RubyOnRails
[05:48:35] blackmes1: has joined #RubyOnRails
[05:54:00] Seich: has joined #RubyOnRails
[05:54:55] jtong: has joined #RubyOnRails
[05:55:18] d5sx43: has joined #RubyOnRails
[06:06:19] armyriad: has joined #RubyOnRails
[06:07:02] alfiemax: has joined #RubyOnRails
[06:09:06] agent_white: has joined #RubyOnRails
[06:16:12] bilal80: has joined #RubyOnRails
[06:18:27] zarubin: has joined #RubyOnRails
[06:20:14] srinidhi: has joined #RubyOnRails
[06:22:54] yfeldblum: has joined #RubyOnRails
[06:23:05] srinidhi: has joined #RubyOnRails
[06:23:14] dminca: has joined #RubyOnRails
[06:23:53] yfeldblum: has joined #RubyOnRails
[06:23:59] dminca: has joined #RubyOnRails
[06:31:21] arBmind: has joined #RubyOnRails
[06:31:38] emiltin: has joined #RubyOnRails
[06:32:06] pawnbox: has joined #RubyOnRails
[06:32:51] ur5us: has joined #RubyOnRails
[06:33:35] dopamean1: has joined #RubyOnRails
[06:34:42] conta: has joined #RubyOnRails
[06:35:05] emiltin: has joined #RubyOnRails
[06:41:10] Dimik: has joined #RubyOnRails
[06:41:25] Ergo: has joined #RubyOnRails
[06:43:38] GoranPavlovic: has joined #RubyOnRails
[06:43:43] pLaTo0n: has joined #RubyOnRails
[06:44:13] dionysus69: has joined #RubyOnRails
[06:45:55] sami: has joined #RubyOnRails
[06:51:14] Hyuk: has joined #RubyOnRails
[06:52:18] dannyguk: has joined #RubyOnRails
[06:53:18] bazzy: has joined #RubyOnRails
[06:54:17] AndrewIsHere: has joined #RubyOnRails
[06:54:26] emiltin: has joined #RubyOnRails
[06:55:05] GorillaApe: has joined #RubyOnRails
[06:56:16] GorillaApe: is there a way to
[06:56:25] jtong: has joined #RubyOnRails
[06:56:49] GorillaApe: autoreload a local gem at developmemt without restarting etc?
[06:56:52] AdamOnRails: has joined #RubyOnRails
[06:56:54] yardenbar: has joined #RubyOnRails
[06:57:10] comrad: has joined #RubyOnRails
[06:57:29] jtong: has joined #RubyOnRails
[06:58:03] jtong: has joined #RubyOnRails
[06:59:26] AdamOnRails: so my field_with_errors is now adding a wierd line break where its not supposed to, I think its because of the wohle natural "block" display type. I tried adding display:inline; to the .field_with_errors class, but it didn't work.
[06:59:42] sevenseacat: "it didnt work"?
[06:59:51] emilkarl: has joined #RubyOnRails
[06:59:51] AdamOnRails: ideally I don't even want to DIV to show up as I'm not styling them any differently to non-error fields.
[07:00:06] AdamOnRails: As in, it continued to add the line break
[07:01:18] darutoko: has joined #RubyOnRails
[07:01:19] AdamOnRails: I have a textbox, then a single whitespace, then a select menu. When validation fails on the textbox, it gets wrapped in a rails field_with_errors DIV - and its putting the select menu on the next line because of it.
[07:01:38] sevenseacat: removing the div would be the easiest way if you don't want it there
[07:01:52] AdamOnRails: Yeah, just not sure how to set rails to do that?
[07:02:06] sevenseacat: http://stackoverflow.com/a/16104009/560215
[07:02:26] AdamOnRails: yeah, thats whst im loooking at now
[07:02:40] dminuoso: has joined #RubyOnRails
[07:07:32] banisterfiend: has joined #RubyOnRails
[07:12:01] mark_66: has joined #RubyOnRails
[07:12:36] solars: has joined #RubyOnRails
[07:13:11] alfiemax: has joined #RubyOnRails
[07:13:45] edward__: has joined #RubyOnRails
[07:14:31] alevy: has joined #RubyOnRails
[07:16:14] pawnbox: has joined #RubyOnRails
[07:16:53] Hyuk: has joined #RubyOnRails
[07:19:43] pwnd_nsfw`: has joined #RubyOnRails
[07:22:02] conta1: has joined #RubyOnRails
[07:22:19] jgt: has joined #RubyOnRails
[07:23:04] AndrewIsHere: has joined #RubyOnRails
[07:24:26] xall: has joined #RubyOnRails
[07:24:36] Pazician: has joined #RubyOnRails
[07:24:36] Pazician: has joined #RubyOnRails
[07:26:30] antgel: has joined #RubyOnRails
[07:36:41] toomus: has joined #RubyOnRails
[07:38:19] ur5us: has joined #RubyOnRails
[07:38:47] toomus: How to find records from current week with AR?
[07:39:29] toomus: Current week I mean from Monady to Sunday
[07:40:15] rubyonrailed: has joined #RubyOnRails
[07:40:36] toomus: Eg.today is thursday, and I want to get all records with date from Monady to the nearest Sunday
[07:41:12] DoubleMalt: has joined #RubyOnRails
[07:43:40] tbuehlmann: toomus: this? http://api.rubyonrails.org/classes/Date.html#method-c-beginning_of_week and http://api.rubyonrails.org/classes/DateAndTime/Calculations.html#method-i-end_of_week
[07:44:10] toomus: tbuehlmann: Oh, nice! thx :)
[07:44:55] aganov: has joined #RubyOnRails
[07:45:18] tvw: has joined #RubyOnRails
[07:49:06] dionysus69: has joined #RubyOnRails
[07:50:30] blackmes1: has joined #RubyOnRails
[07:50:34] mikecmpbll: has joined #RubyOnRails
[07:55:03] Ergo^: has joined #RubyOnRails
[07:55:48] Radar: https://github.com/radar/by_star
[07:58:21] Kedare: has joined #RubyOnRails
[08:01:09] dannyguk: has joined #RubyOnRails
[08:01:48] mikecmpbll: has joined #RubyOnRails
[08:05:22] jsrn: has joined #RubyOnRails
[08:08:05] artto: has joined #RubyOnRails
[08:08:19] emilkarl: has joined #RubyOnRails
[08:09:01] adre: has joined #RubyOnRails
[08:09:17] Ergo: has joined #RubyOnRails
[08:12:46] nofxx: has joined #RubyOnRails
[08:14:31] marr: has joined #RubyOnRails
[08:14:47] fluxsource: has joined #RubyOnRails
[08:18:10] eyck: has joined #RubyOnRails
[08:29:23] artto: has joined #RubyOnRails
[08:33:34] jenrzzz: has joined #RubyOnRails
[08:39:13] agent_white: has left #RubyOnRails: ()
[08:39:15] Velizar: has joined #RubyOnRails
[08:40:40] Velizar: I'm adding icons to my links, which are with Bootstrap and look like buttons. What is a good icon for the _show_ link? Preferably from Bootstrap's glyphicons icon set.
[08:40:50] rafaelfranca: has joined #RubyOnRails
[08:41:33] fox_mulder_cp: Velizar: context based, as for me
[08:41:52] fox_mulder_cp: folder open icon, music/file icon, etc
[08:42:29] AndrewIsHere: has joined #RubyOnRails
[08:42:49] fox_mulder_cp: Radar: goog morning %^)
[08:44:58] pawnbox: has joined #RubyOnRails
[08:45:38] PotatoChipz: has joined #RubyOnRails
[08:48:05] jgameit: has joined #RubyOnRails
[08:52:12] oystersauce8: has joined #RubyOnRails
[08:52:29] arBmind: has joined #RubyOnRails
[08:56:20] artto_: has joined #RubyOnRails
[08:58:37] Tempesta_: has joined #RubyOnRails
[08:59:00] comrad: has joined #RubyOnRails
[08:59:17] daveomcd_: has joined #RubyOnRails
[08:59:29] jtong: has joined #RubyOnRails
[09:00:27] fcser_: has joined #RubyOnRails
[09:00:30] artto: has joined #RubyOnRails
[09:00:31] dannyguk_: has joined #RubyOnRails
[09:00:35] Depili_: has joined #RubyOnRails
[09:00:44] dever: has joined #RubyOnRails
[09:00:56] pawnbox: has joined #RubyOnRails
[09:00:56] srinidhi1: has joined #RubyOnRails
[09:00:59] staticfox`: has joined #RubyOnRails
[09:01:04] jtong: has joined #RubyOnRails
[09:01:39] jtong: has joined #RubyOnRails
[09:01:47] rogue_koder_: has joined #RubyOnRails
[09:01:49] rafaelfranca: has joined #RubyOnRails
[09:02:08] lxsameer: has joined #RubyOnRails
[09:02:48] pawnbox: has joined #RubyOnRails
[09:03:10] skyjumper: has joined #RubyOnRails
[09:03:14] ltd_: has joined #RubyOnRails
[09:03:44] lewix_: has joined #RubyOnRails
[09:04:00] sunya7a_: has joined #RubyOnRails
[09:04:09] devn_: has joined #RubyOnRails
[09:04:20] spastorino_: has joined #RubyOnRails
[09:04:22] Helheim_: has joined #RubyOnRails
[09:04:28] pragmati-: has joined #RubyOnRails
[09:04:38] csmb_: has joined #RubyOnRails
[09:04:49] AnoHito: has joined #RubyOnRails
[09:05:00] Aherin: has joined #RubyOnRails
[09:05:12] parus: has joined #RubyOnRails
[09:05:24] spectra-: has joined #RubyOnRails
[09:05:34] bedouin_: has joined #RubyOnRails
[09:05:36] pawnbox_: has joined #RubyOnRails
[09:05:43] croberts_: has joined #RubyOnRails
[09:05:55] proboszcz: has joined #RubyOnRails
[09:06:37] loglaunc-: has joined #RubyOnRails
[09:07:01] dminuoso_: has joined #RubyOnRails
[09:08:05] martinbjeldbak_: has joined #RubyOnRails
[09:08:12] M-shine1: has joined #RubyOnRails
[09:08:40] constantinexvi: has joined #RubyOnRails
[09:08:49] aganov: has joined #RubyOnRails
[09:09:01] mfilipe: has joined #RubyOnRails
[09:09:02] thejoecarroll: has joined #RubyOnRails
[09:09:42] TessaM: has joined #RubyOnRails
[09:10:25] comrad: has joined #RubyOnRails
[09:11:16] Ergo: has joined #RubyOnRails
[09:11:58] audibleblink: has joined #RubyOnRails
[09:13:15] tjvc: has joined #RubyOnRails
[09:13:15] tjvc: has joined #RubyOnRails
[09:14:36] Sero: has joined #RubyOnRails
[09:14:36] dc4: has joined #RubyOnRails
[09:21:43] hadronzoo: has joined #RubyOnRails
[09:21:56] blackhuey: has joined #RubyOnRails
[09:22:12] srinidhi: has joined #RubyOnRails
[09:22:23] dannyguk: has joined #RubyOnRails
[09:24:17] baash05: has joined #RubyOnRails
[09:26:26] jgameit: Hi all :-) I have some problem with serialize data if nested data hash rails add 'elements' and 'ivars'
[09:26:37] jgameit: https://gist.github.com/anonymous/282589872b15302a931ebe759de63e16
[09:27:44] jgameit: ## POST Parameters: {"record"=>{ "baz" => 0, "foo"=> {"a"=> 1, "b" => {"b1" => 2}, "c" => 3}}
[09:27:51] jgameit: Record.first #=> id: 1, baz: 0, foo: {a: 1 b: {elements: {b1: 2}, ivars: {@permitted: false}}}
[09:28:51] rubyonrailed: has joined #RubyOnRails
[09:33:50] pawnbox: has joined #RubyOnRails
[09:35:51] marahin: has joined #RubyOnRails
[09:38:40] srinidhi: has joined #RubyOnRails
[09:38:53] dminuoso_: jgameit: And what problem do you have?
[09:39:47] jgameit: wht I have elements and ivars?
[09:42:12] jgameit: I hope to have Record.first #=> id: 1, baz: 0, foo: {a: 1, b: {b1: 2}, c: 3}
[09:42:40] jgameit: not Record.first #=> id: 1, baz: 0, foo: {a: 1, b: {elements: {b1: 2}, ivars: {@permitted: false}}, c: 3}
[09:43:58] clandry94: has joined #RubyOnRails
[09:44:15] Macaveli: has joined #RubyOnRails
[09:47:10] ferr1: has joined #RubyOnRails
[09:47:49] edwinvdgraaf: has joined #RubyOnRails
[09:48:35] mdw: has joined #RubyOnRails
[09:49:05] jenrzzz: has joined #RubyOnRails
[09:58:03] defsdoor: has joined #RubyOnRails
[10:00:09] dminuoso_: jgameit: All I see is some random ruby code. I do not understand what is being called and how, the output and expected result instead.
[10:00:13] dminuoso_: It is completely incoherent.
[10:02:17] dminuoso_: jgameit: Also note that this #=> stuff is just what inspect returns, it should not matter to you. It is just debug information.
[10:02:23] snowy: has joined #RubyOnRails
[10:03:09] dannyguk: has joined #RubyOnRails
[10:03:17] jgameit: I get a POST to records controller
[10:03:46] jgameit: I elaborate with class CreateRecord
[10:04:42] blackmes1: has joined #RubyOnRails
[10:05:10] jgameit: the problem is access nested attributes of record
[10:05:25] jgt: has joined #RubyOnRails
[10:05:26] jgameit: I hope to access b1 property with
[10:05:46] jgameit: Record.find(1).foo[:b][:b1]
[10:06:19] jgameit: Record.find(1).foo[:b][:elements][:b1]
[10:06:24] dminuoso_: What happens if you do Record.find(1).foo[:b][:b1] ?
[10:07:10] jgameit: return nil
[10:07:21] dminuoso_: jgameit: Okay, I think Im getting the picture now.
[10:07:37] dminuoso_: jgameit: Well, the :elements/:@permitted come from psych
[10:08:11] dminuoso_: jgameit: This happens when you dump hashes with ivars
[10:08:49] Detch: has joined #RubyOnRails
[10:08:51] dminuoso_: jgameit: It is possible that the json serializer mimics this.
[10:08:54] Detch: has joined #RubyOnRails
[10:09:26] jgameit: I use default serialize from rails
[10:10:09] jgameit: I see now the gem psych
[10:10:26] siaw23: has joined #RubyOnRails
[10:12:40] jokke: does active support provide a method to humanize timespans? as in 21600 -> "6 hours"
[10:13:51] dminuoso_: jokke: distance_of_time_in_words
[10:13:59] jokke: haha really?
[10:14:19] jokke: active support really is the god gem
[10:14:28] dminuoso_: Well, such things I consider to be rather questionable..
[10:15:13] jgameit: dminuoso_: searching from psych http://stackoverflow.com/questions/36655635/railstutorial-where-is-debug-information-coming-from
[10:16:09] jokke: ah no that's not what i'm looking for
[10:16:13] jokke: has to be accurate
[10:17:28] dminuoso_: jgameit: I suppose you could simply use to_h to convert the parameters into a plain hash so you can then easily serialize it.
[10:17:37] dminuoso_: jokke: It is accurate when the time is accurate.
[10:18:08] Fernando-Basso: I guess in the setup method in the controller test I should somehow tell it to use the foo model, not admin/foo, but how? (assuming that is my problem)
[10:18:20] Fernando-Basso: I have models in the global namespace. Controllers and other things in the admin and public namespaces. When I try to run tests for admin/foo_controller, it fails because it is trying to find the admin_foos table. How should I proceed?
[10:18:23] artto: has joined #RubyOnRails
[10:19:06] jokke: dminuoso_: doesn't look like it: Adistance_of_time_in_words(from_time, from_time + 50.minutes) # => about 1 hour
[10:19:29] dminuoso_: jokke: An hour has 60 minutes, not 50.
[10:19:58] jokke: "about 1 hour" is _not_ accurate
[10:20:33] jokke: i'd expect something like "50 minutes"
[10:20:48] jokke: or if > 1h "1.x hours"
[10:21:21] dminuoso_: jokke: [60,60,24].reduce([s]) { |m,o| m.unshift(m.shift.divmod(o)).flatten } and then reject the first items containing a 0
[10:21:41] dminuoso_: Or just work with that someone.
[10:21:54] eGGshke: has joined #RubyOnRails
[10:23:40] dminuoso_: (s being your seconds)
[10:24:46] c355E3B: has joined #RubyOnRails
[10:26:00] yfeldblum: has joined #RubyOnRails
[10:29:25] Robtop__: has joined #RubyOnRails
[10:32:50] rafaelfranca: has joined #RubyOnRails
[10:33:07] emilkarl: has joined #RubyOnRails
[10:33:29] siaw23: has joined #RubyOnRails
[10:33:50] voidDotClass: has joined #RubyOnRails
[10:34:03] blackmes1: has joined #RubyOnRails
[10:34:29] AzaToth: has joined #RubyOnRails
[10:37:16] harfangk: has joined #RubyOnRails
[10:37:20] rafaelfranca: has joined #RubyOnRails
[10:40:19] dc4: has joined #RubyOnRails
[10:41:58] jokke: uhhhh i'm very confused by rails autoloading right now...
[10:42:10] jokke: i have a file timespan.rb in lib/
[10:42:36] jokke: i can't use 1.minute on class evaluation time
[10:42:59] jokke: says fixnum doesn't have that method
[10:43:35] jokke: so i required active_support and active_support/core_ext/numeric/conversions manually
[10:43:43] PaulePanter: has joined #RubyOnRails
[10:43:44] dminuoso_: jokke: Think about what autoloading does.
[10:43:55] jokke: after that it couldn't find the constant DatabaseCleaner... wtf...
[10:44:02] dminuoso_: jokke: Autoloading and reloading works on _constants_.
[10:44:20] jokke: appaerently it doesn't
[10:44:20] dminuoso_: If you do not use a constant, the rails autoloading is not invoked.
[10:44:23] dminuoso_: It quite does.
[10:44:25] fl4sh_: has joined #RubyOnRails
[10:44:30] dminuoso_: jokke: 1.minute is not using a constant.
[10:44:33] jokke: why can't it find DatabaseCleaner then?
[10:44:45] dminuoso_: jokke: Gist the code you have and how you use it.
[10:45:01] dminuoso_: jokke: Do you have a class DatabaseCleaner in the autoloading paths somewhere?
[10:45:17] jokke: it's a gem
[10:45:39] dminuoso_: jokke: Then its not autoloading that handles it.
[10:46:08] dminuoso_: jokke: Autoloading is basically for most parts inside your rails application - its how models for example are "known" to every other part without ever having to require the file defining it.
[10:46:13] dminuoso_: jokke: Gems are handled by Bundler usually.
[10:46:15] GodFather: has joined #RubyOnRails
[10:46:31] jokke: but i never had to explicitly require a gem for it to work
[10:46:44] dminuoso_: jokke: that depends on where you are.
[10:47:02] jokke: https://p.jreinert.com/cguwxr/ruby
[10:47:07] universa1: has joined #RubyOnRails
[10:47:21] _fortis: has joined #RubyOnRails
[10:47:29] jokke: now it gives me undefined method `minute' again
[10:47:36] jokke: seems pretty random..
[10:47:57] dminuoso_: jokke: Well how does that file get loaded? ;-)
[10:49:18] jokke: https://p.jreinert.com/EWog71/ruby
[10:49:44] jokke: in spec/lib/timespan_spec.rb
[10:50:05] edwinvdg_: has joined #RubyOnRails
[10:50:22] dminuoso_: jokke: Ah. require 'active_support/time'
[10:50:24] jokke: here's the full trace: https://p.jreinert.com/xG9L/
[10:51:09] jokke: now i get uninitialized constant DatabaseCleaner (which i _didn't_ get before all this)
[10:51:23] dminuoso_: Stacktrace on that?
[10:51:34] jokke: https://p.jreinert.com/FrgHH/
[10:52:40] dminuoso_: jokke: Are you requiring your library in an initializer?
[10:52:43] dminuoso_: Or in rspec?
[10:52:52] jokke: DatabaseCleaner?
[10:53:22] dminuoso_: No your custom library.
[10:53:39] jokke: you mean timespan
[10:53:46] jokke: only in the spec
[10:53:55] dminuoso_: Gist the code for the entire spec.
[10:54:54] jokke: 124702 jokke │ https://p.jreinert.com/cguwxr/ruby
[10:55:12] jokke: after that i added active_support/time, like you told me
[10:55:58] dminuoso_: jokke: That is not a spec.
[10:56:06] jokke: uhh my bad
[10:56:30] jokke: 124918 jokke │ https://p.jreinert.com/EWog71/ruby
[10:56:47] jokke: (it doesn't do anythin yet)
[10:57:10] jokke: copied from another classes spec where i extracted the coersion stuff from
[10:57:32] jokke: i gotta eat, brb
[11:01:30] eyck: has joined #RubyOnRails
[11:02:26] wethu: has joined #RubyOnRails
[11:03:06] harfangk: has joined #RubyOnRails
[11:03:40] jtong: has joined #RubyOnRails
[11:06:17] Pazician: has joined #RubyOnRails
[11:06:17] Pazician: has joined #RubyOnRails
[11:06:23] xpl0iter: has joined #RubyOnRails
[11:08:17] xpl0iter: Hi, I am trying to do transactions. The problem is I have a transaction which will be affecting 3 tables. And based on some reading I just did, I have to do in the model file. the question is in which model file should be doing the transactions? So can someone please help me with this?
[11:09:02] eyck: has joined #RubyOnRails
[11:10:34] rvanlieshout: xpl0iter: that doesn't really matter
[11:10:53] rvanlieshout: the transaction block will just start a database transaction. it doesn't obey the model's scope
[11:12:48] hardtail: has joined #RubyOnRails
[11:13:32] xpl0iter: rvanlieshout, oh ok. So I will just create a method inside any of the model file and then call it from the controller. IS that correct?
[11:14:27] xpl0iter: I mean a method with the transaction
[11:14:48] rvanlieshout: even that doesn't matter
[11:15:00] rvanlieshout: you execute 'stuff' within a Foobar.transacion do-block
[11:15:14] rvanlieshout: that's wrapped in a BEGIN TRANSACTION and COMMIT TRANSACTION (or ROLLBACK)
[11:15:59] eyck: has joined #RubyOnRails
[11:16:39] conta: has joined #RubyOnRails
[11:16:49] rubyonrailed: has joined #RubyOnRails
[11:18:07] xpl0iter: rvanlieshout, Ok thanks a lot. One more question(I think its stupid one, sorry). Whats that Foobar in Foobar.transaction?
[11:18:29] rvanlieshout: any of your models
[11:18:32] CornishPasty: Can anyone help me with a time zone issue? I have a rails-api app in production, and since it's BST in the UK, our times are 1 hour ahead of UTC. If I attempt to do "2016-06-30 12:00:00".to_time, it returns that time but with an offset of 0. If I do Time.current, I get the time with the current offset! If I do Time.now, I get the UTC time...
[11:18:33] CornishPasty: config.time_zone is set to London
[11:18:56] rvanlieshout: Time.zone.now
[11:18:59] jmignault: has joined #RubyOnRails
[11:19:05] CornishPasty: rvanlieshout: I'm on about converting a string to time
[11:19:11] xpl0iter: rvanlieshout, Is that mandatory to give? I was going to give it like transaction do.
[11:19:18] rvanlieshout: Time.zone.parse?
[11:19:27] CornishPasty: Ah, I didn't think of that!
[11:19:28] rvanlieshout: xpl0iter: it depends on in what context you operate
[11:19:36] bonswouar: has joined #RubyOnRails
[11:19:44] rvanlieshout: if a transaction-method is available, use that for sure
[11:19:49] CornishPasty: Thanks rvanlieshout :)
[11:20:30] rvanlieshout: you're welcome
[11:20:34] rvanlieshout: how's life in london atm?
[11:21:14] xpl0iter: Ok thanks rvanlieshout
[11:21:27] rvanlieshout: oh. it was just the timezone
[11:21:30] rvanlieshout: in the UK then :)
[11:21:48] CornishPasty: London is our go-to timezone
[11:22:10] CornishPasty: I'm about a hundred miles north of London
[11:23:01] rvanlieshout: cool. noticed any big changes yet? since the referendum
[11:27:31] nettoweb: has joined #RubyOnRails
[11:28:09] mello: has joined #RubyOnRails
[11:28:17] edwinvdgraaf: has joined #RubyOnRails
[11:28:44] eyck: has joined #RubyOnRails
[11:29:50] nettoweb: has joined #RubyOnRails
[11:31:30] jokke: dminuoso_: any other thoughts?
[11:32:08] ldnunes: has joined #RubyOnRails
[11:32:27] dminuoso_: jokke: please use gist.github and contain the stack trace along with your spec
[11:32:35] dminuoso_: It's difficult to browse through multiple tabs.
[11:32:48] jokke: i can make a multipaste :)
[11:32:59] dminuoso_: If that site supports it fine.
[11:33:09] Pazician_: has joined #RubyOnRails
[11:34:14] jokke: https://p.jreinert.com/m-jowD/
[11:35:06] jokke: should i include the spec and rails helpers?
[11:35:35] dminuoso_: jokke: Every bit of information can help
[11:35:51] jokke: https://p.jreinert.com/m-8gk4c/
[11:36:32] chouhoulis: has joined #RubyOnRails
[11:37:13] dminuoso_: jokke: Your spec is not requiring your rails_helper
[11:37:59] jokke: that was it!
[11:38:32] rubyonrailed: has joined #RubyOnRails
[11:38:49] jokke: dminuoso_: and now i also don't need to require activesupport
[11:39:35] rodfersou: has joined #RubyOnRails
[11:39:41] dminuoso_: jokke: Indeed, because now your rails_helper will include the entire rails environment.
[11:51:55] blackmes1: has joined #RubyOnRails
[11:52:06] workmad3: has joined #RubyOnRails
[11:53:01] hardtail: has joined #RubyOnRails
[11:56:57] antgel: has joined #RubyOnRails
[11:58:02] dc4: has joined #RubyOnRails
[12:02:48] artto: has joined #RubyOnRails
[12:04:21] sergio_101: has joined #RubyOnRails
[12:04:42] edwinvdg_: has joined #RubyOnRails
[12:05:08] jtong: has joined #RubyOnRails
[12:07:28] Guest683: has joined #RubyOnRails
[12:07:47] AnoHito: has joined #RubyOnRails
[12:08:19] pawnbox: has joined #RubyOnRails
[12:09:56] Tempesta: has joined #RubyOnRails
[12:10:35] oystersauce8: has joined #RubyOnRails
[12:12:16] Axilla: has joined #RubyOnRails
[12:13:55] basldex: has joined #RubyOnRails
[12:15:04] basldex: hi all. I want to share session cookies between all my localhost subdomains. any idea how I can do that? tried with different values for :domain and :tld_length in config.session_store.
[12:15:24] basldex: so app.localhost:3000 and app2.localhost:3000 for example shall share the same session cookie
[12:15:41] basldex: got it working for staging and production but apparently it's a bit different on localhost
[12:16:30] harfangk: has joined #RubyOnRails
[12:21:54] l4v2: has joined #RubyOnRails
[12:22:43] Scient: basldex: your easiest bet is to use lhv.me as your local domain
[12:22:48] Scient: and set the cookie to that
[12:23:05] Scient: or if you are adventurous and use pow, you can make up a longer domain instead of .dev :)
[12:23:19] Scient: like foo.dev, so all your apps are <appname>.foo.dev
[12:23:25] Scient: either way you cant do it for localhost
[12:23:54] epochwolf: pow is slightly buggy, if you have issues with it just uninstall and reinstall.
[12:25:45] Scient: i installed pow via brew
[12:25:53] Scient: and it breaks every time i update node via brew
[12:25:56] Scient: every single fucking time :
[12:26:37] basldex: ok I'll give the lhv.me trick a try, thx Scient
[12:26:54] epochwolf: Scient: pow is wierd. It'll stop working for seemly no reason and reboots won't fix it.
[12:27:11] epochwolf: But you uninstall it and reinstall it, it works.
[12:27:38] epochwolf: I'm guessing it has something to do with network routing going wierd.
[12:29:39] artto_: has joined #RubyOnRails
[12:32:09] artto: has joined #RubyOnRails
[12:32:57] pLaTo0n: has joined #RubyOnRails
[12:36:50] basldex: works perfectly fine, thx Scient
[12:39:45] fmcgeough: has joined #RubyOnRails
[12:47:38] d0nn1e: has joined #RubyOnRails
[12:47:53] Oliphaunte: has joined #RubyOnRails
[12:49:19] dannyguk: has joined #RubyOnRails
[12:49:52] Oliphaunte: has joined #RubyOnRails
[12:50:22] conta: has joined #RubyOnRails
[12:50:41] diegoviola: has joined #RubyOnRails
[12:51:23] JamieD: has joined #RubyOnRails
[12:52:07] pawnbox: has joined #RubyOnRails
[12:53:30] dmz: has joined #RubyOnRails
[12:53:30] dmz: has joined #RubyOnRails
[12:53:57] artto: has joined #RubyOnRails
[12:54:32] diofeher: has joined #RubyOnRails
[12:54:35] xpl0iter: has joined #RubyOnRails
[12:57:04] conta: has joined #RubyOnRails
[12:57:17] basldex: does anybody know if carrierwave somewhere stores the cropping attributes it used at creation? I'd like to duplicate an upload in respect of cropping too
[12:57:32] pawnbox: has joined #RubyOnRails
[12:58:22] universa1: basldex: don't you save the original, unmodified image?
[12:59:33] diofeher: guys I'm having a problem with has_and_belongs_to_many. I created a gist here, it's not populating through the relationship https://gist.github.com/diofeher/e58c87f1262682fd6ad6627e56e7fcd0
[12:59:53] universa1: differentreality: !gist-usage
[12:59:53] helpa: differentreality: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[13:00:43] universa1: differentreality: oopsss, sorry, wrong tab completion :(
[13:00:55] universa1: diofeher: ^^ this was for you
[13:01:32] aegis3121: has joined #RubyOnRails
[13:01:54] diofeher: universa1, oh thanks didn't know about that
[13:01:59] universa1: diofeher: cl.nil?; cl.reload.patients.count
[13:02:26] srinidhi: has joined #RubyOnRails
[13:02:46] diofeher: universa1, first one gives false and second one gives 0
[13:02:52] ramortegui: has joined #RubyOnRails
[13:02:55] dannyguk: has joined #RubyOnRails
[13:03:17] pLaTo0n: has joined #RubyOnRails
[13:03:22] universa1: diofeher: you gisted the full files for both models?
[13:06:23] basldex: universa1: I think so, yes. why?
[13:06:37] jtong: has joined #RubyOnRails
[13:07:00] universa1: basldex: well then you can figure out the crop attributes ;)
[13:07:24] basldex: universa1: I can figure out width and height, but how could I find out x and y?
[13:07:31] basldex: without image recognition or similar ;)
[13:07:54] universa1: i didn't say it was easy ;)
[13:07:57] jtong: has joined #RubyOnRails
[13:08:44] universa1: basldex: quick google turns up the following ;) http://stackoverflow.com/questions/14345256/determine-position-of-one-image-in-another-with-php -- most likely easily adoptable to ruby ;)
[13:08:51] diofeher: universa1, just updated
[13:08:56] diofeher: https://gist.github.com/diofeher/e58c87f1262682fd6ad6627e56e7fcd0
[13:09:11] ybart: has joined #RubyOnRails
[13:09:44] ybart: If I have a model with an integer[] column, and I want to add a number from within an ActiveJob, how do I do this without a race condition?
[13:10:04] universa1: diofeher: might fail because of your join table having a primary id key column ;)
[13:10:15] universa1: diofeher: but that is just a wild guess.
[13:10:22] basldex: universa1: nice one! but I think my co-workers won't be happy if I want to deploy that to production :D
[13:10:56] universa1: _bart: locking?
[13:10:58] diofeher: universa1, => Relationship(id: integer, patient_id: integer, clinician_id: integer) like that?
[13:11:14] universa1: diofeher: has and belongs to many has NO(!!!!) join model!
[13:11:24] universa1: diofeher: it is just a table with two foreign keys.
[13:11:56] diofeher: I was testing this way because I was trying with through before
[13:12:07] universa1: well, decide what you want ;)
[13:12:21] Oliphaunte: has joined #RubyOnRails
[13:12:21] diofeher: but in the migration you see that I've added only the two fields
[13:12:24] khelair: hello y'all again; got another question due to trying to learn rails (w/ruby 2.x) from a text that's based on ruby 1.x again, sorry for the foolish trouble. I just added my map.connect line in config/routes.rb, and it doesn't appear that such exists any more
[13:12:33] universa1: diofeher: has_many :relationships; has_many :patients, through: :relationships
[13:12:46] khelair: can anybody tell me what I might need instead of that map line in my routes.rb?
[13:12:56] khelair: any pointers, etc, greatly appreciated
[13:13:05] universa1: diofeher: create_table automatically adds a pk, if you don't tell it otherwise
[13:13:09] universa1: khelair: !routing
[13:13:09] helpa: khelair: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[13:13:21] universa1: khelair: what is the url you want to "connect" ?
[13:13:24] diofeher: I see. universa1 : but the way I was using in the console should be right, right?
[13:13:36] diofeher: the problem must be in my models
[13:13:57] universa1: diofeher: well, create the correct table for habtm, then it probably works.
[13:14:10] khelair: I'm trying to connect the welcome page to a url with no file specification, ie map.connect '', :controller => "main", :action => "welcome"
[13:14:18] ybart: universa1: OK I noticed that with_lock routine, but what happens when when another Job tries to update the instance?
[13:14:42] universa1: khelair: there should be a comment in the routes.rb file, with root to: "main#welcome" or alike
[13:15:33] khelair: oh ffs, yeah I see it now. Thank you
[13:15:47] universa1: khelair: yw :-) easy to miss
[13:16:17] universa1: _bart: http://guides.rubyonrails.org/active_record_querying.html#locking-records-for-update
[13:19:38] brendan-: has joined #RubyOnRails
[13:20:53] basldex: is there something like a find_or_initialize for has_one associations? to get a freshly instantiated object if nil would be returned
[13:21:10] ybart: universa1: looks good, so the lock is on db level, and I suppose the with_lock will hang to wait without an exception? (the doc is not so clear on that)
[13:21:31] ybart: universa1: with pessimistic locking
[13:21:44] universa1: _bart: no clue. never tried, but should be easy to check: open two consoles and try ;)
[13:22:47] ybart: universa1: OK will do, I also wonder how to allow reading in postgres (with the "lock in share mode" that works in mysql)
[13:24:12] efy: has joined #RubyOnRails
[13:26:06] ekinmur: has joined #RubyOnRails
[13:30:11] asheinfeld: has joined #RubyOnRails
[13:32:07] workmad3: has joined #RubyOnRails
[13:33:41] GodFather: has joined #RubyOnRails
[13:35:27] agit0: has joined #RubyOnRails
[13:35:36] jgt: has joined #RubyOnRails
[13:35:41] pawnbox: has joined #RubyOnRails
[13:36:02] conta1: has joined #RubyOnRails
[13:36:07] diofeher: universa1, so what made it work was to put :association_foreign_key in both models thanks =]
[13:36:09] jokke: hmm i don't know if this is a simple form or plain form builder issue but i'm using decorators for my models in my controller and thus in my views. One model has an association which i've wrapped in the decorator so that it returns the associated model wrapped with a decorator. This works fine e.g. MyDecorator.new(model).association.class => 'OtherDecorator'. If i try to use simple_fields_for it uses the
[13:36:10] jokke: plain model as object for the nested form builder.
[13:37:03] jokke: does the form builder use something else than a getter with the attribute name to get the object?
[13:38:21] finnnnnnnnnnn: has joined #RubyOnRails
[13:38:49] artto: has joined #RubyOnRails
[13:38:53] universa1: jokke: so you are passing a decorator instance to the form_for ?
[13:39:08] jokke: and f.object.class => 'MyDecorator'
[13:39:35] finnnnnnnnnnn: hello, using number_to_currency is there a way to convert 3250000 to £3.25m
[13:40:10] jokke: universa1: https://p.jreinert.com/m-FQ3/
[13:41:14] jokke: don't be fooled by line 51 in the controller. The getter always wraps the model with a decorator
[13:42:11] universa1: jokke: so add a = f.object.estimate.inspect before the render 'tasks...'
[13:42:17] universa1: to make 100% sure.
[13:42:18] finnnnnnnnnnn: got it, number_to_human(3200000)
[13:42:20] herbst: has joined #RubyOnRails
[13:42:20] herbst: has joined #RubyOnRails
[13:42:34] mikecmpb_: has joined #RubyOnRails
[13:43:11] herbst: i need to check the referrer for font files in the vendor/assets directory. Is there any straight forward way to do this?
[13:43:23] jokke: i debugged it with pry in line 4 of the last partial and f.object.estimate.class == EstimateDecorator
[13:43:31] artto: has joined #RubyOnRails
[13:44:02] universa1: jokke: ok, and if you do the same in the partial, what is f.object's class?
[13:44:03] herbst: In other words, i need to implement this .htaccess rule somehow: https://gist.github.com/b1nary/96369396ac127023e76889cd06b25466
[13:44:23] jokke: universa1: TaskDecorator
[13:44:39] universa1: jokke: inside the second form
[13:44:49] universa1: herbst: use apache and use that .htaccess file?
[13:45:11] herbst: the webserver is not my choice. I just need to "protect" those damn font files because of the license agreement
[13:45:20] jokke: universa1: you mean estimate_fields.object.class?
[13:45:24] universa1: herbst: but it depends on the webserver.
[13:45:28] jokke: universa1: that's Estimat
[13:45:39] jokke: weird innit?
[13:45:51] herbst: it was just a example for what i want to do. I am obviously looking for a rails solution
[13:46:02] universa1: jokke: the same happens with f.fields_for ?
[13:46:23] universa1: herbst: well, in the usual production configuration the rails app NEVER sees requests to the assets directory.
[13:46:49] diofeher: is it possible to change current_user class used in Devise views?
[13:46:52] universa1: herbst: the proxy server (nginx or apache in most cases) handles the public directory
[13:46:55] jokke: universa1: yup
[13:46:57] universa1: diofeher: what?!
[13:47:13] herbst: fuck, havent thought about that. I would prefer something within rails
[13:47:36] jokke: herbst: why?
[13:47:42] universa1: herbst: well you can have your rails app serve the public files, but any http server is better at serving static files.
[13:47:46] jokke: herbst: nginx is a million times faster
[13:48:10] diofeher: universa1, I have the Patient and Clinician and they provide custom methods. When accessing @current_user at my views, the class used is the default User (the class that both inherit) so I wanted to inherit these methods depending on the type of the user
[13:48:18] jokke: herbst: only when you're concerned about access rights it makes sense to use send_file or so
[13:48:25] universa1: diofeher: ?!
[13:48:35] herbst: well yeah sounds reasonable. i just dont want to ask the devops team to change the config on multiple servers if there would be a alternative
[13:48:51] jokke: that's what devops are for!
[13:49:09] herbst: true dat. but they dont really care ;)
[13:49:22] universa1: herbst: the sensible solution is to take care of that in the proxy server (imho)
[13:49:22] AmiMoench: has joined #RubyOnRails
[13:49:23] diofeher: e.g.: I wanted to access patient.clinicians in my view, so I would do @current_user.clinicians in my view, but current_user is from User model, not from Patient model (Patient < User), so it gives me nil
[13:49:36] herbst: thinking about it its the only reasonable way tho, send_file would just mess with the ram usage i assume
[13:49:43] universa1: diofeher: you have single table inheritance?!
[13:49:48] diofeher: universa1, yes :/
[13:49:55] jokke: if they're any good it doesn't matter if it's one ore 1000 servers they have to update the config on
[13:50:04] jtd: has joined #RubyOnRails
[13:50:07] jokke: or 9001 :>
[13:50:13] diofeher: the project was already rolling when I entered :P I was thinking about changing to MTI
[13:50:53] universa1: diofeher: well you can most likely hack devise to have it return the inherited class, shouldn't be too hard to figure out
[13:51:07] herbst: thanks again guys. time to annoy the devops :)
[13:51:16] macsteps: has joined #RubyOnRails
[13:51:17] jokke: universa1: any other thoughts on my problem? :/
[13:51:40] universa1: jokke: hmm, aside from reproducing it? no ;) and for that i would need to implement well models, with your kind of decorators, etc... ;)
[13:51:49] jhack: has joined #RubyOnRails
[13:53:22] jokke: it's super weird really, i've got good test coverage and everything works like it should outside of views...
[13:53:39] yardenbar: has joined #RubyOnRails
[13:53:40] jokke: or outside of form builders i should say
[13:53:58] universa1: jokke: :-) but i got about an hour left, and not really in the mood to dig into the other problem... so: what kind of decorators do you use?
[13:54:14] blackmes1: has joined #RubyOnRails
[13:54:53] jokke: https://p.jreinert.com/m-hNGDL/
[13:55:39] jahbrewski: has joined #RubyOnRails
[13:55:53] universa1: jokke: whoa, mongoid ;)
[13:56:16] jokke: i reeeeally doubt it has anything to do with _this_ problem ;)
[13:56:30] universa1: jokke: yeah, what is simpledelegator? some gem?
[13:56:38] jokke: no that's ruby core
[13:56:42] ramortegui: has joined #RubyOnRails
[13:56:47] universa1: jokke: ok, abstractize too?
[13:56:55] jokke: no abstractize is a gem of mine
[13:57:08] universa1: jokke: publicly available?
[13:57:19] universa1: good :-) brb ;)
[13:57:54] jokke: https://github.com/jreinert/abstractize
[13:59:49] jhack: has joined #RubyOnRails
[13:59:54] terrabl: has joined #RubyOnRails
[14:00:17] terrabl: pretty simple question, if I wanted to add contenteditable = "true" to an erb file would I just do <%= @test["title"], :contenteditable => "true"%>
[14:00:48] dc4: has joined #RubyOnRails
[14:01:26] rvanlieshout: terrabl: you want to add it to what?
[14:01:33] rvanlieshout: @test["title"] is just a string
[14:01:42] rvanlieshout: that's just <%= 'foobar' %>
[14:01:46] terrabl: Yeah but I want to make it editable?
[14:01:52] terrabl: Is that possible?
[14:01:53] rvanlieshout: shouldn't it be a div then?
[14:02:10] rvanlieshout: <%= content_tag :div, @test['title'], contenteditable: true %>
[14:02:11] terrabl: yeah but when I put a div around it it puts a weird line break
[14:02:41] rvanlieshout: even with that content_tag ?
[14:03:45] terrabl: Without the content tag i get an : syntax error, unexpected tLABEL, expecting '=' ...test['title'], contenteditable: true );@output_buffer.safe_a... ... ^
[14:04:55] terrabl: Well it isnt really that important. It's justa line break ahah thanks for helping
[14:05:20] rvanlieshout: that's a syntax error
[14:05:24] rvanlieshout: what exact code did you use?
[14:08:13] universa1: jokke: ok, reproduced! ;)
[14:09:52] Talltree: do you guys happen to know of a method to reduce the size of a huge json post request? compression? gzipping?
[14:10:12] jokke: Talltree: yeah
[14:10:24] jokke: but the client has to support it
[14:10:28] jokke: (most client's do)
[14:10:36] Talltree: what do you mean then?
[14:10:48] Talltree: rails supports it?
[14:10:49] universa1: jokke: https://github.com/universal/form-decorator :-) couldn't think of less to do, now to some debugging ;)
[14:10:58] jokke: Talltree: no but your proxy should?
[14:11:05] Talltree: i dont have a proxy :D
[14:11:13] Talltree: or do you mean nginx?
[14:12:17] Talltree: jokke: it just unzips automaticly or does it need some configuration?
[14:12:34] jokke: it unzips automagically
[14:12:53] Talltree: nice, i'm going to test that
[14:13:07] jokke: wait a sec
[14:15:05] mdw: has joined #RubyOnRails
[14:15:41] jtong: has joined #RubyOnRails
[14:16:03] mdw: has joined #RubyOnRails
[14:16:07] Oliphaunte: has joined #RubyOnRails
[14:17:00] jokke: i'm actually not sure if requests can be gzipped
[14:17:36] diegoviola: has joined #RubyOnRails
[14:18:18] jokke: http://stackoverflow.com/questions/29766154/nginx-gunzip-post-requests-to-backend
[14:19:41] jokke: Talltree: doesn't look too good
[14:19:45] jenrzzz: has joined #RubyOnRails
[14:19:45] jenrzzz: has joined #RubyOnRails
[14:21:16] Talltree: does someone have another idea how to reduce the size of an json post?
[14:22:21] spion: has joined #RubyOnRails
[14:25:46] universa1: jokke: ok found it ;)
[14:25:46] emilkarl: has joined #RubyOnRails
[14:25:49] universa1: jokke: https://github.com/rails/rails/blob/9f44aa08636dfbba9261f4350ec14684425c4b7b/actionview/lib/action_view/helpers/form_helper.rb#L1582
[14:26:05] universa1: jokke: https://github.com/rails/rails/blob/9f44aa08636dfbba9261f4350ec14684425c4b7b/actionview/lib/action_view/helpers/form_helper.rb#L1895 --> association_to_model
[14:26:14] universa1: jokke: it calls to_model on the object
[14:27:04] universa1: Talltree: do not post so much?
[14:27:20] Talltree: universa1: duh
[14:27:31] jokke: universa1: why in hell?
[14:27:39] prithaj: has joined #RubyOnRails
[14:28:03] universa1: jokke: no clue, that is just the flow of fields_for ...
[14:28:04] jokke: do i really have to override to_model in my decorator to get past this shit?
[14:28:47] universa1: jokke: def to_model; self; end ;)
[14:30:33] rubyonrailed: has joined #RubyOnRails
[14:30:45] universa1: jokke: yup, that works ;)
[14:31:41] edwinvdgraaf: has joined #RubyOnRails
[14:32:05] dopamean_: has joined #RubyOnRails
[14:32:16] jokke: that feels like such a hack though
[14:34:08] amcoder: has joined #RubyOnRails
[14:35:37] diego2: has joined #RubyOnRails
[14:35:39] quazimodo: has joined #RubyOnRails
[14:35:43] diego2: has joined #RubyOnRails
[14:38:05] macsteps: has joined #RubyOnRails
[14:39:01] chouhoulis: has joined #RubyOnRails
[14:39:17] chouhoulis: has joined #RubyOnRails
[14:40:06] chouhoulis: has joined #RubyOnRails
[14:40:12] rubyonrails860: has joined #RubyOnRails
[14:44:49] Guest_: has joined #RubyOnRails
[14:46:57] joshuaflores: has joined #RubyOnRails
[14:50:07] adavia: has joined #RubyOnRails
[14:55:35] quazimod1: has joined #RubyOnRails
[14:57:36] yottanami: has joined #RubyOnRails
[14:59:01] yottanami: I tried to override registration like this http://dpaste.com/2Z3QTHP but it does not show me errors so I override the helper like this http://dpaste.com/3CA0VZ1 and here is my create view http://dpaste.com/3YKZH6T but it does not show any error message
[14:59:24] yottanami: I am using devise and I checked it seems it does not run my helper methods
[15:00:48] triptec: has joined #RubyOnRails
[15:01:39] ekinmur: has joined #RubyOnRails
[15:01:39] solars: has joined #RubyOnRails
[15:02:20] adre: has joined #RubyOnRails
[15:02:27] agent_white: has joined #RubyOnRails
[15:03:04] allcentury: has joined #RubyOnRails
[15:03:42] allcentury: I'm trying to use awsome print inside an ERB template with <%= ap my_hash %> but when I go to render, awesome print is going to STDOUT and not into the template file. How can I redirect awesome print to not use STDOUT? Can't find it in the docs anywhere
[15:10:35] Peteykun: has joined #RubyOnRails
[15:13:12] ale-batt: has joined #RubyOnRails
[15:17:42] disgrntld: has joined #RubyOnRails
[15:21:39] pixelhandler: has joined #RubyOnRails
[15:25:19] jokke: universa1: still here?
[15:25:33] jokke: you said half an hour so i guess not :)
[15:27:18] amcoder: has joined #RubyOnRails
[15:27:47] dannyh: has joined #RubyOnRails
[15:28:08] quazimodo: has joined #RubyOnRails
[15:28:11] allcentury: alright another question for the time being. Any idea why this doesn't work? {"a": "b"}.to_s.tr("{", "{\n")
[15:28:25] allcentury: but this does: {"a": "b"}.to_s.sub("{", "{\n")
[15:28:35] AndrewIsHere: has joined #RubyOnRails
[15:29:10] helpa: has joined #RubyOnRails
[15:33:22] jokke: where exactly does the value for form fields come from with form helpers such as text_field?
[15:33:44] camilasan: has joined #RubyOnRails
[15:34:12] artto: has joined #RubyOnRails
[15:36:02] mustmodify: has joined #RubyOnRails
[15:36:26] solars: has joined #RubyOnRails
[15:36:51] quazimodo: has joined #RubyOnRails
[15:37:02] quazimod1: has joined #RubyOnRails
[15:38:57] mustmodify: I have a collection of strategies (classes) to do some work. I want to ask each strategy whether it handles an object. First one that says yes will be asked to do it. Should the interface be StrategyOne.handles?( obj ) and then StrategyOne.new(obj).fire? or s = StrategyOne.new(obj).handled? then s.fire
[15:39:12] tbuehlmann: jokke: https://github.com/rails/rails/blob/9f44aa08636dfbba9261f4350ec14684425c4b7b/actionview/lib/action_view/helpers/tags/text_field.rb#L13
[15:39:43] mustmodify: My thinking is the first, even though that would mean some of the strategies would have to do duplicate work. But it would mean I wouldn't have to keep instances of strategies I'm not using, which seems sloppy...
[15:40:06] mustmodify: and it's not like there is a big efficiency issue. I mean, we have some efficiency issues, but this won't be one of them.
[15:41:00] quazimod2: has joined #RubyOnRails
[15:41:12] macsteps: has joined #RubyOnRails
[15:41:13] quazimod3: has joined #RubyOnRails
[15:42:17] quazimod4: has joined #RubyOnRails
[15:42:19] quazimod5: has joined #RubyOnRails
[15:42:20] quazimod6: has joined #RubyOnRails
[15:42:50] polishdub: has joined #RubyOnRails
[15:44:55] adre: has joined #RubyOnRails
[15:52:39] Ergo: has joined #RubyOnRails
[15:54:02] amorbix: has joined #RubyOnRails
[15:54:09] quazimodo: has joined #RubyOnRails
[15:54:57] workmad3: has joined #RubyOnRails
[15:55:00] blackmes1: has joined #RubyOnRails
[15:56:32] carlosd_: has joined #RubyOnRails
[15:56:49] zave: has joined #RubyOnRails
[15:57:22] jokke: uhhhhh whyyyyy! why does it use "#{attribute}_before_type_cast"
[15:57:39] jokke: using decorators in rails seems to be quite the PITA
[15:59:22] AnoHito_: has joined #RubyOnRails
[16:02:23] nettoweb: has joined #RubyOnRails
[16:02:57] dc4: has joined #RubyOnRails
[16:04:52] shinnya: has joined #RubyOnRails
[16:07:54] finnnnnnnnnnn_: has joined #RubyOnRails
[16:08:08] dici: has joined #RubyOnRails
[16:10:25] Talltree: can i log into a running puma instance to see the "debug" stuff?
[16:13:06] epochwolf: Talltree: only if you installed a remote debugger.
[16:14:27] janiz: has joined #RubyOnRails
[16:15:17] Talltree: sadly, i dont :-(
[16:15:20] janiz: Hi, is there way to count affected rows in the series of update? Ideal will be to count affected rows in transaction block. I am doing series of updates and want to know exactly how many rows were updated
[16:17:55] whathappens: has joined #RubyOnRails
[16:20:01] Ergo: has joined #RubyOnRails
[16:21:30] jenrzzz: has joined #RubyOnRails
[16:24:01] xall: has joined #RubyOnRails
[16:24:36] AndrewIsHere: has joined #RubyOnRails
[16:26:09] nogic: has joined #RubyOnRails
[16:27:44] workmad3: has joined #RubyOnRails
[16:27:52] dannyh: has joined #RubyOnRails
[16:28:05] blackmes1: has joined #RubyOnRails
[16:28:21] Hobogrammer: has joined #RubyOnRails
[16:28:31] finnnnnnnnnnn: has joined #RubyOnRails
[16:30:09] rafaelfr_: has joined #RubyOnRails
[16:30:13] AndrewIsHere: has joined #RubyOnRails
[16:32:51] whathappens: has joined #RubyOnRails
[16:40:27] pixelhandler: has joined #RubyOnRails
[16:40:40] rafaelfranca: has joined #RubyOnRails
[16:40:40] rafaelfranca: has joined #RubyOnRails
[16:41:26] arrowcircle: has joined #RubyOnRails
[16:43:56] oystersauce8: has joined #RubyOnRails
[16:44:45] manfrin_: has joined #RubyOnRails
[16:44:55] pixelhandler: has joined #RubyOnRails
[16:46:18] arrowcircle: Hi! I have a strang problem with namespacing in rails. https://gist.github.com/arrowcircle/d1ac3bdf78d67703c8e3a3aeca3d22dc If I access my namespaced activemodel, it shows me activerecord model instead. What I doing wrong?
[16:46:50] AndrewIsHere: has joined #RubyOnRails
[16:48:48] Macaveli: has joined #RubyOnRails
[16:50:41] matthewd: arrowcircle: http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#nesting-and-qualified-constants
[16:52:23] mustmodify: has left #RubyOnRails: ()
[16:53:01] workmad3: has joined #RubyOnRails
[16:53:06] pilne: has joined #RubyOnRails
[16:53:25] Devalo: has joined #RubyOnRails
[16:57:21] s1|verfox: has joined #RubyOnRails
[17:00:47] aegis3121: has joined #RubyOnRails
[17:01:34] d00n: has joined #RubyOnRails
[17:03:23] d00n: has left #RubyOnRails: ()
[17:06:14] Hyuk: has joined #RubyOnRails
[17:07:33] Macaveli: has joined #RubyOnRails
[17:10:31] arrowcircle: matthewd, thanks! I changed all my Pochta models, but ring no bells. Rails s works, but Pochta::Box::News still returns News. I updated the gist https://gist.github.com/arrowcircle/d1ac3bdf78d67703c8e3a3aeca3d22dc
[17:11:25] arrowcircle: and if I put reload! in console, it fails with error (colsole.log)
[17:11:43] matthewd: arrowcircle: Oh sorry, wrong section: http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#when-constants-aren-t-missed
[17:12:57] aegis3121: has joined #RubyOnRails
[17:13:38] mikecmpbll: has joined #RubyOnRails
[17:17:48] snowy: has joined #RubyOnRails
[17:19:19] snowy: has joined #RubyOnRails
[17:20:06] cnk: has joined #RubyOnRails
[17:20:25] Snowy_: has joined #RubyOnRails
[17:20:28] harfangk: has joined #RubyOnRails
[17:24:27] [Butch]: has joined #RubyOnRails
[17:24:44] arrowcircle: hmm. I dont get it, should I use it in Pochta or in top level News?
[17:30:07] djbkd: has joined #RubyOnRails
[17:31:10] emilkarl: has joined #RubyOnRails
[17:31:17] dannyh: has joined #RubyOnRails
[17:31:33] zave: has joined #RubyOnRails
[17:31:39] mostlybadfly: has joined #RubyOnRails
[17:32:27] arrowcircle: matthewd, still cant figure out what is wrong
[17:33:11] Oliphaunte: has joined #RubyOnRails
[17:34:27] emilkarl: has joined #RubyOnRails
[17:35:11] matthewd: arrowcircle: "use it"?
[17:35:34] arrowcircle: guide suggests to user require_dependency
[17:35:42] matthewd: arrowcircle: You have the Image / Hotel::Image situation
[17:37:31] matthewd: You'd need `require_dependency 'pochta/box/news'`, before you reference Pochta::Box::News, whereever that happens
[17:38:17] arrowcircle: it happens in console
[17:38:29] arrowcircle: should i put it in top level news.rb?
[17:38:43] yardenbar: has joined #RubyOnRails
[17:39:15] mdw7: has joined #RubyOnRails
[17:40:18] diegoviola: has joined #RubyOnRails
[17:40:34] matthewd: If you're referencing the constant from the console, then that's where you need to do the require_dependency
[17:41:37] dannyh: has joined #RubyOnRails
[17:41:52] arrowcircle: and how not to catch it in production?
[17:42:55] alfiemax: has joined #RubyOnRails
[17:44:52] matthewd: > You'd need `require_dependency 'pochta/box/news'`, before you reference Pochta::Box::News, whereever that happens
[17:47:59] mello: has joined #RubyOnRails
[17:49:12] arrowcircle: now I have another problem, it tells me TypeError: Box is not a module
[17:49:48] emilkarl: has joined #RubyOnRails
[17:52:09] Devalo: has joined #RubyOnRails
[17:54:00] arrowcircle: @matthewd how to deal with it?
[17:55:07] macsteps: has joined #RubyOnRails
[18:00:24] pramsky: has joined #RubyOnRails
[18:00:53] pramsky: has left #RubyOnRails: ()
[18:04:22] Dimik: has joined #RubyOnRails
[18:04:40] dc4: has joined #RubyOnRails
[18:05:25] matthewd: arrowcircle: Umm... don't define Box as both a class and a module?
[18:06:42] liquid-silence: has joined #RubyOnRails
[18:07:05] arrowcircle: but how to nest it properly? I need these classes to have parent class
[18:07:38] arrowcircle: dont put it under box namespace?
[18:07:46] arrowcircle: put to pochta?
[18:08:08] liquid-silence: has joined #RubyOnRails
[18:08:21] matthewd: You'd be better off defining it as Pochta::Box::News instead of using the separate module definitions, IMO
[18:08:38] alfiemax: i've got a question that might sound dumb
[18:08:48] alfiemax: if i have a User model
[18:09:20] alfiemax: and there is user object present, then if i do u = User.last; u.destroy
[18:09:32] alfiemax: it would remove/delete the user from the user table
[18:09:53] alfiemax: but, what would happen when i do, u = User.new; u.destroy
[18:10:22] alfiemax: i expected it to throw an error since the record did not exist in the DB
[18:10:58] alfiemax: in the console is shows, BEGIN COMMIT and then returns the new object
[18:12:11] chipotle: has joined #RubyOnRails
[18:13:07] willardg: has joined #RubyOnRails
[18:14:12] netzfisch: has joined #RubyOnRails
[18:15:45] nertzy: has joined #RubyOnRails
[18:15:48] willardg: has left #RubyOnRails: ()
[18:15:49] willardg: has joined #RubyOnRails
[18:17:16] workmad3: has joined #RubyOnRails
[18:21:11] Robtop__: has joined #RubyOnRails
[18:22:20] nettoweb: has joined #RubyOnRails
[18:25:18] easyecho: has joined #RubyOnRails
[18:25:47] augustao: has joined #RubyOnRails
[18:29:33] agit0: has joined #RubyOnRails
[18:29:39] siaw23: has joined #RubyOnRails
[18:29:46] mcr-credil: has joined #RubyOnRails
[18:31:02] augustao_: has joined #RubyOnRails
[18:32:31] meoblast001: has joined #RubyOnRails
[18:32:45] ^Denis: has joined #RubyOnRails
[18:33:02] futilegames: has joined #RubyOnRails
[18:33:33] pLaTo0n: has joined #RubyOnRails
[18:35:22] creyes: has joined #RubyOnRails
[18:35:33] macsteps: has joined #RubyOnRails
[18:36:46] creyes: Hi I have a Task which has_many subTasks. All are viewed in tree-form on one page like a todo list. The Task has a progress bar, I'd like to update the progress bar when a subTask gets created/completed.
[18:36:49] matthewd: alfiemax: #destroy doesn't raise on failure; it returns false
[18:36:56] matthewd: alfiemax: You may want #destroy!
[18:37:07] creyes: My question is, should I store a completed_percentage in the Task table that updates when a subTask is completed?
[18:37:23] Limix: has joined #RubyOnRails
[18:38:07] Limix: Hi, is there a way to serve files located in the : tmp dir with rails?
[18:38:32] Limix: I’m creating pdfs and they are being stored in tmp
[18:39:01] Limix: I get a: No route matches [GET] "/tmp/pdfs/e371393cdbd0d4982e2d40b55d7e950b.pdf"
[18:39:40] helpa: Limix: It seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[18:40:32] matthewd: Limix: Do the PDFs have to be written as files at all?
[18:40:56] matthewd: Limix: Have you considered writing them somewhere other than tmp? (Not necessarily claiming that's a good idea)
[18:41:07] User458764: has joined #RubyOnRails
[18:41:13] matthewd: Limix: How large are the files in question?
[18:41:21] Limix: I guess I could go in public, but these files will be wiped every day
[18:41:29] Limix: so I thought tmp made more sense
[18:41:33] matthewd: (ballpark... are we talking a PDF representation of a form, or a book?)
[18:41:45] Limix: so single page
[18:41:48] Limix: they are small
[18:42:31] matthewd: In that case, I'd consider reading the file back in, inside the method that's creating it
[18:42:32] Limix: about 100k each
[18:42:35] ur5us: has joined #RubyOnRails
[18:42:43] matthewd: That way you can immediately delete the file from disk, so no need for a sweeper
[18:42:50] matthewd: .. then just send_data the binary string
[18:43:28] Limix: Main reason for writing is because I am pushing to s3
[18:43:45] Limix: and I can only get it to work when reading from disk
[18:43:46] matthewd: Alternatively, you can send_file any arbitrary filesystem path -- but then the file has to remain available until the request is finished, which means you need a sweeper
[18:44:26] matthewd: That.. sounds like a misbehaviour to be diagnosed and fixed
[18:44:31] Limix: so file is already there, this is just for testing btw, I just want to be able to serve the pdf so I can see it when adjusting the pdf
[18:45:21] Limix: really just wish I could find a way to serve files from tmp
[18:45:35] matthewd: Then you want send_file
[18:45:56] Limix: thank you
[18:46:38] srinidhi: has joined #RubyOnRails
[18:47:37] blackmes1: has joined #RubyOnRails
[18:49:51] Technodrome: has joined #RubyOnRails
[18:50:19] AnoHito: has joined #RubyOnRails
[18:50:28] rogue_koder: has joined #RubyOnRails
[18:51:57] futilegames: has joined #RubyOnRails
[18:52:22] siaw23: has joined #RubyOnRails
[18:53:04] pawnbox_: has joined #RubyOnRails
[18:53:17] xall: has joined #RubyOnRails
[18:53:18] kies: has joined #RubyOnRails
[18:54:05] netzfisch: has joined #RubyOnRails
[18:56:14] Talltree: if i have a radio button thats true false and i also want a button that clears the param completly, how would i do that?
[18:56:30] ur5us: has joined #RubyOnRails
[18:58:06] djbkd: has joined #RubyOnRails
[18:58:47] l4v2: has joined #RubyOnRails
[19:00:30] workmad3: has joined #RubyOnRails
[19:01:45] Hyuk: has joined #RubyOnRails
[19:05:40] GodFather: has joined #RubyOnRails
[19:06:16] jenrzzz: has joined #RubyOnRails
[19:06:16] jenrzzz: has joined #RubyOnRails
[19:08:17] hahuang61: has joined #RubyOnRails
[19:08:55] pLaToOn: has joined #RubyOnRails
[19:11:40] cutlet___: has joined #RubyOnRails
[19:13:15] yfeldblum: has joined #RubyOnRails
[19:16:21] banisterfiend: has joined #RubyOnRails
[19:18:43] pixelhandler: has joined #RubyOnRails
[19:22:10] prgmmr: has joined #RubyOnRails
[19:23:23] chouhoul_: has joined #RubyOnRails
[19:27:37] tomdp: has joined #RubyOnRails
[19:29:39] jenrzzz: has joined #RubyOnRails
[19:29:39] jenrzzz: has joined #RubyOnRails
[19:29:54] tomdp: Quick question: I have a class with class-level instance variables or class variables for storing state, and an initializer to set the state. How can I prevent Rails' development-mode autoloading from clobbering those variables after I make any change to the codebase in development?
[19:31:29] chouhoulis: has joined #RubyOnRails
[19:31:42] blackmes1: has joined #RubyOnRails
[19:33:49] chouhoul_: has joined #RubyOnRails
[19:34:29] Oliphaunte: has joined #RubyOnRails
[19:34:49] chouhoul_: has joined #RubyOnRails
[19:40:43] emiltin: has joined #RubyOnRails
[19:41:16] rafaelfranca: has joined #RubyOnRails
[19:41:36] mikecmpbll: has joined #RubyOnRails
[19:42:19] phrozen77: has joined #RubyOnRails
[19:43:11] Devalo: has joined #RubyOnRails
[19:48:51] epochwolf: tomdp: you should not be using variables to store state between requests.
[19:48:51] neo_: has joined #RubyOnRails
[19:50:20] epochwolf: class variables and class instance variables shouldn't be used at all due to multiple threads and multiple workers in production. Use constants for things that don't change.
[19:51:40] Fernando-Basso: I have models in the global namespace. Controllers and other things in the admin and public namespaces. When I try to run tests for admin/foo_controller, it fails because it is trying to find the admin_foos table. How should I proceed?
[19:52:11] Fernando-Basso: And I only have the foos table (the models are not namespaced).
[19:52:29] nettoweb: has joined #RubyOnRails
[19:53:11] wldcordeiro: has joined #RubyOnRails
[19:53:51] whathappens: has joined #RubyOnRails
[19:55:23] jm3: has joined #RubyOnRails
[19:55:51] Fernando-Basso: http://sprunge.us/ichN?ruby
[19:57:14] nogic: has joined #RubyOnRails
[19:57:43] nofxx: Fernando-Basso, set_table_name or use_relative_naming_model
[19:58:04] nofxx: Fernando-Basso, might need to cehck the latter
[19:58:16] Fernando-Basso: nofxx: I'll try that. Still, is what I am doing OK?
[19:58:32] dangerousdave: has joined #RubyOnRails
[19:58:55] nofxx: Fernando-Basso, nothing wrong, but, no problem with 'admin_foos" table too
[19:59:30] nofxx: Fernando-Basso, self.use_relative_model_naming?; true
[20:00:15] nofxx: but for you case guess only set_table_name.... relative will also change your paths
[20:00:31] GodFather: has joined #RubyOnRails
[20:00:40] Fernando-Basso: What do you mean with "no problem with admin_foos table"?
[20:01:07] Fernando-Basso: I mean, I don't want and don't need 'admin_foos'. I want to use the same models for both public and admin area.
[20:01:16] hightower2: has joined #RubyOnRails
[20:01:35] nofxx: Fernando-Basso, hmm, yeah go with set_table_name
[20:02:26] Fernando-Basso: nofxx: Also, why does the tests assume admin_foos whereas just running the application through the browser just works?
[20:02:43] Fernando-Basso: It does get the "global" models.
[20:03:00] upsell5: has joined #RubyOnRails
[20:03:13] Fernando-Basso: (by the way, I am reading the testing guide on the rails site and did not install anything extra to do testing, just rails default stuff).
[20:03:48] rubyonrailed: has joined #RubyOnRails
[20:04:47] nofxx: dunno what's yr problem...sure you're running in development mode?
[20:05:14] nofxx: development == test, but in production it isn't reloading your code
[20:05:34] jhack: has joined #RubyOnRails
[20:05:36] chouhoulis: has joined #RubyOnRails
[20:06:22] Fernando-Basso: Yep. I'll push some changes to bitbucket later and can show you the code if you want to take a look.
[20:06:50] Fernando-Basso: But later and only if you have time and are willing to, no pressure really. You helped a lot already.
[20:15:36] jgt: has joined #RubyOnRails
[20:15:50] chouhoulis: has joined #RubyOnRails
[20:15:58] Fernando-Basso: Gee! use_relative_model_naming? look like secret!
[20:18:00] roamingdog: has joined #RubyOnRails
[20:21:23] KensoDev: has joined #RubyOnRails
[20:21:51] cmmagid: has joined #RubyOnRails
[20:25:53] deur-: has joined #RubyOnRails
[20:26:54] JohanTux: has joined #RubyOnRails
[20:27:09] weaksauce: has joined #RubyOnRails
[20:27:54] tfitts: has joined #RubyOnRails
[20:33:00] tfitts: Anyone here ever customize a devise login? I want to make it so if a user is connecting from a local ip address and using an android chrome client they can login with a pin only instead of email/password.
[20:33:55] nofxx: Fernando-Basso, no problm
[20:34:12] nofxx: tfitts, views are easy, just copy sessioncontroller over to your app and change to your needs
[20:34:35] nofxx: but, might check, guess it's only one method on user for that (check user/pass), so overwrite the model or the controller
[20:34:51] pLaTo0n: has joined #RubyOnRails
[20:34:56] tfitts: ok, i'll give it a try
[20:35:26] nofxx: tfitts, SessionsController is on devise somewhere, just cp to your app/controllers
[20:36:09] mdw: has joined #RubyOnRails
[20:39:25] diegoviola: has joined #RubyOnRails
[20:40:21] jenrzzz: has joined #RubyOnRails
[20:40:21] jenrzzz: has joined #RubyOnRails
[20:41:10] chouhoulis: has joined #RubyOnRails
[20:41:16] nofxx: tfitts, browser detection is easy, but it's fakeable have in mind. Local IP is ok
[20:47:55] Darmani: has joined #RubyOnRails
[20:51:00] aegis3121: has joined #RubyOnRails
[20:54:05] qejk: has joined #RubyOnRails
[20:59:14] epitron: has joined #RubyOnRails
[21:02:24] Limix: has joined #RubyOnRails
[21:06:21] chouhoulis: has joined #RubyOnRails
[21:06:27] blackmes1: has joined #RubyOnRails
[21:08:58] AntiSpamMeta: has joined #RubyOnRails
[21:09:10] hahuang61: has joined #RubyOnRails
[21:09:39] deur-_: has joined #RubyOnRails
[21:13:42] codezomb: has joined #RubyOnRails
[21:14:57] Darmani: Hey guys when using the Paperclip gem for storing photos, am I supposed to upload them to my app and put them in the public folder?
[21:15:02] Darmani: I'm a bit confused about that.
[21:18:53] nogic: has joined #RubyOnRails
[21:18:54] macsteps: has joined #RubyOnRails
[21:20:56] wldcordeiro: has joined #RubyOnRails
[21:25:14] helpa-bot: has joined #RubyOnRails
[21:25:56] mozzarel1: has joined #RubyOnRails
[21:26:50] havenwood: https://github.com/rails/rails/releases/tag/v5.0.0
[21:27:14] helpa: has joined #RubyOnRails
[21:27:17] cnk: Darmani: you can configure paperclip to store images in a local file system or in S3
[21:27:39] cnk: then you use a form on your admin page to upload the images - and they get stored wherever you configure them to be
[21:27:42] pixelhandler: ^ yeah the path the file storage on disk is configurable
[21:28:01] mfilipe_: has joined #RubyOnRails
[21:28:48] Darmani: cnk: Got it!
[21:30:09] amitchellbullard: has joined #RubyOnRails
[21:31:41] Darmani: cnk: Any idea why I might be getting this error? https://gist.github.com/mfifth/c94ec6d6d7f60a6cff5916e4c17889da
[21:31:48] Darmani: The gem is installed o.o
[21:32:11] banisterfiend`: has joined #RubyOnRails
[21:32:44] cnk: gem installed by adding to your Gemfile and running bundle install /
[21:35:10] Darmani: cnk: Perhaps my migration is off? But I didn't think that was the case...
[21:35:11] Darmani: https://gist.github.com/mfifth/c94ec6d6d7f60a6cff5916e4c17889da#file-add_pics_migration-rb
[21:35:59] cnk: and db:migrate ran just fine? no warning about not finding add_attachment?
[21:36:27] cnk: do you have image magick installed?
[21:37:08] cnk: And add the section of your Gemfile.lock around 'paperclip' to that gist
[21:37:49] cnk: What version of Rails is your project? and what version of Paperclip
[21:37:53] Darmani: cnk: https://gist.github.com/mfifth/c94ec6d6d7f60a6cff5916e4c17889da
[21:38:02] staticfox`: has joined #RubyOnRails
[21:38:05] cnk: you probably don't want paperclip 5.00beta for a rails 4 project
[21:38:19] hardtail: has joined #RubyOnRails
[21:38:36] aegis3121: has joined #RubyOnRails
[21:38:48] Darmani: cnk: My rails version is 4.2
[21:39:11] cnk: remove paperclip from your Gemfile, run bundle uninstall paperclip, then added just gem paperclip w no version # back to yoru Gemfile
[21:39:18] cnk: then run bundle install again
[21:39:36] Darmani: cnk: Kk hang on.
[21:39:59] jarib_: has joined #RubyOnRails
[21:41:03] Darmani: cnk: bundle uninstall isn't a command o.o
[21:41:16] cnk: OK gem uninstall paperclip
[21:41:36] Darmani: oh there it is.
[21:42:15] Darmani: cnk: Done... Still get the same error tho
[21:42:20] Darmani: I'm doomed D:
[21:42:34] cnk: check your gemflie.lock
[21:42:41] cnk: what version does it say you have of paperclip
[21:43:08] Darmani: cnk: 4.3.6
[21:44:00] yfeldblum: has joined #RubyOnRails
[21:44:05] adam12_: has joined #RubyOnRails
[21:44:09] Darmani: cnk: Did you know you could render a bunch of items from a collection without using a specific block like shirts.each do |shirt|?
[21:44:11] thejoecarroll_: has joined #RubyOnRails
[21:44:13] Darmani: I had no idea.
[21:44:13] FaresKAl-: has joined #RubyOnRails
[21:44:48] cnk: yes if you pass a collection to a partial it does the loop for you
[21:45:27] Darmani: cnk: only took me four days to figure that out xP
[21:46:12] Darmani: cnk: Maybe I should just use a different gem? There has to be another one that might work...
[21:46:18] cnk: Darmani: do me a favor, migrate down to get rid of your image field in the db
[21:46:36] cnk: then change the name of your attachment. Call it picture instead of image
[21:46:51] Darmani: cnk: Aye aye captain. Gimme a sec.
[21:47:31] cnk: Because of all the magic name inferances rails makes, I have learned to be cautious (perhaps overly cautious) of names that might be in use elsewhere
[21:48:06] Darmani: cnk: That's a good point... Never thought of that...
[21:48:08] Darmani: Okay now what?
[21:48:26] cnk: OK see if stuff works now that your fields are pictures
[21:49:13] Darmani: cnk: no :[
[21:50:01] cnk: Did you restart your server after playing with the gems?
[21:50:25] Darmani: cnk: no :O I should've done that...
[21:50:46] Darmani: cnk: goddamnit that's what it was
[21:50:53] Darmani: ACTION is dumb
[21:51:16] cnk: Everyone in this channel has done that - more times than we will admit
[21:51:36] Darmani: cnk: thank you for having the patience of an angel.
[21:52:36] mikeiniowa: has joined #RubyOnRails
[21:57:41] edwinvdgraaf: has joined #RubyOnRails
[22:02:20] pawnbox: has joined #RubyOnRails
[22:02:21] siaw23: has joined #RubyOnRails
[22:03:32] wethu: has joined #RubyOnRails
[22:05:07] blackmes1: has joined #RubyOnRails
[22:07:02] Limix: has joined #RubyOnRails
[22:09:12] mikecmpbll: has joined #RubyOnRails
[22:12:15] shinnya: has joined #RubyOnRails
[22:12:57] Limix: has joined #RubyOnRails
[22:13:24] jhack: rails 5 out
[22:13:29] jhack: thoughts?
[22:22:15] pilne: has joined #RubyOnRails
[22:23:06] dc4: has joined #RubyOnRails
[22:26:58] oystersauce8: has joined #RubyOnRails
[22:29:32] havenwood: jhack: wheee
[22:29:35] ndrst: has joined #RubyOnRails
[22:30:58] djbkd: has joined #RubyOnRails
[22:31:29] beingjohnm: jhack: my thought is that I have now learned enough not to jump on the bandwagon when I have something working
[22:31:54] beingjohnm: still on Ubuntu 14.04 on my second desktop and still running 12.04 on my servers
[22:32:11] Fernando-Basso: nofxx: Should I do `set_table_name('post_categories')` inside the setup method of the admin/controller test?
[22:32:21] beingjohnm: I used to jump on every new release of everything and lose at least a day of productivity in the process
[22:32:24] jhack: They have ActionCable now, which i find to be pretty col
[22:32:39] jhack: beingjohnm: so when do you read up on the new releases etc?
[22:33:02] Honeycomb: has joined #RubyOnRails
[22:33:31] beingjohnm: jhack: I usually read the release notes when it hits HN. And then contemplate switching when a library/gem requires it.
[22:35:03] djbkd: has joined #RubyOnRails
[22:35:38] beingjohnm: quick question, do you have to escape a "!" in a string? I am having a hell of a time seeding a database and seem to be struggling with some foreign characters.
[22:36:59] siaw23: has joined #RubyOnRails
[22:37:05] jhack: dont think so
[22:37:18] jhack: could be ‘ or “
[22:37:40] iooner: has joined #RubyOnRails
[22:37:58] jhack: Gonna take me a while to go through all these changelogs, probably will re-read em a couple times :|
[22:38:23] jhack: if ya post some of the seed, i can scan through it and see if i see anything
[22:39:59] beingjohnm: jhack: thanks. going through it line by line now but this has been seriously stumping me. Looping through an array of hashes and getting some strange behaviour. Kids will be home soon so got to start dinner but might hit you up later. Enjoy your reading.
[22:46:31] AndrewIsHere: has joined #RubyOnRails
[22:49:13] jgt: has joined #RubyOnRails
[22:49:30] moei: has joined #RubyOnRails
[22:52:19] rubyonrailed: has joined #RubyOnRails
[22:57:15] crdpink: has joined #RubyOnRails
[22:58:35] jenrzzz: has joined #RubyOnRails
[23:03:20] startupwrench: has joined #RubyOnRails
[23:04:26] Dimik: has joined #RubyOnRails
[23:07:04] Fernando-Basso: nofxx: I found the error. I had the fixtures in the test/fixtures/admin/ directory. Moved those back to just test/fixtures/ and now tests work.
[23:07:19] Fernando-Basso: So, fixtures seem to be used to infer table names.
[23:07:32] Fernando-Basso: And their path influence that.
[23:08:40] roamingdog: has joined #RubyOnRails
[23:11:01] hahuang61: has joined #RubyOnRails
[23:11:53] banisterfiend: has joined #RubyOnRails
[23:13:08] augustao: has joined #RubyOnRails
[23:16:12] dalbuschat: has joined #RubyOnRails
[23:17:37] Darmani: Why is it so hard to go back to coding after you've taken a break?
[23:17:50] Darmani: I was focused like 20 minutes ago and now I can't even remember what I was doing -__-
[23:18:20] Radar: Darmani: The Flow.
[23:18:40] Darmani: Radar: The Chi.
[23:19:21] Radar: Darmani: Some days I have a _compulsion_ to code and other days it's slow to get going but if I force myself I can usually lock into The Flow.
[23:20:11] Darmani: Radar: yeah. I'm the same way.
[23:20:50] chouhoul_: has joined #RubyOnRails
[23:22:13] iamvery: has joined #RubyOnRails
[23:26:20] banisterfiend: has joined #RubyOnRails
[23:27:43] startupwrench: I'm making a movie listings site.. -- and wondering performance wise would it be better to store for instance a list of posters or videos in a JSONB column that's gin indexed or use joins/sep. table?
[23:28:53] Synthead: can I have an app/models/concerns/foo.rb and app/controllers/concners/foo.rb, or would one override another?
[23:31:32] kanzure: has joined #RubyOnRails
[23:34:00] lacuna: has joined #RubyOnRails
[23:38:05] quazimodo: has joined #RubyOnRails
[23:38:41] queequeg2: has joined #RubyOnRails
[23:39:36] arnonhongklay: has joined #RubyOnRails
[23:42:21] dc4: has joined #RubyOnRails
[23:42:24] kanzure: has joined #RubyOnRails
[23:43:43] chipotle: has joined #RubyOnRails
[23:47:09] Devalo: has joined #RubyOnRails
[23:47:44] Radar: Synthead: Yes, if the two modules are called the same they will conflict.
[23:51:26] kanzure: has joined #RubyOnRails
[23:51:40] AmiMoench: has joined #RubyOnRails
[23:54:08] queequeg1: has joined #RubyOnRails
[23:54:10] Darmani: Radar: Ever used Paperclip?
[23:54:40] Radar: Darmani: Yes.
[23:54:45] skiz: has joined #RubyOnRails
[23:54:48] Senjai: has joined #RubyOnRails
[23:55:04] Darmani: When I display an image with imag_tag @shirts.image blah blah blah...
[23:55:14] Radar: @shirt.image or @shirt.image.url
[23:55:31] Darmani: Do I have to define the image with a preset? like (:medium, :large), etc?
[23:55:47] Radar: I'm about to go into a meeting so I can't help you.