« Back to channel list

#RubyOnRails - 18 July 2017

« Back 1 day Forward 1 day »
[00:01:36] brent__: has joined #RubyOnRails
[00:05:35] xco: has joined #RubyOnRails
[00:05:50] xco: hi, how do i reload page content in tests on line 10? https://gist.github.com/siaw23/b9696b6204c3662a47e8f53bcc8e43ed
[00:07:20] jhfisc: has joined #RubyOnRails
[00:11:55] Radar: xco: You can't. Make another request.
[00:12:01] Radar: get user_message_deliveries_path
[00:13:22] hotpancakes: has joined #RubyOnRails
[00:14:24] xco: Radar: i’m testing a remember login path. if i make my test look like this https://gist.github.com/siaw23/b9696b6204c3662a47e8f53bcc8e43ed i feel there’s something wrong cause then im’ explicitely requesting the same page as before and not the app sending me to that page
[00:19:17] jhfisc: has joined #RubyOnRails
[00:22:01] jhfisc: has joined #RubyOnRails
[00:22:18] Radar: xco: I believe login_as just sets up the session. It doesn't make the requests to actually login as the user.
[00:22:44] Radar: Perhaps that's what you want to do? When you're redirected to new_session_path and then actually complete a proper login by filling in the fields then assert that the user is redirected to that path?
[00:23:43] cagomez: has joined #RubyOnRails
[00:25:15] rkellermeyer: has joined #RubyOnRails
[00:27:55] quazimodo: has joined #RubyOnRails
[00:29:34] hotpancakes: has joined #RubyOnRails
[00:37:41] jhfisc: has joined #RubyOnRails
[00:41:36] hotpancakes: has joined #RubyOnRails
[00:46:00] hotpancakes: has joined #RubyOnRails
[00:47:05] sevenseacat: has joined #RubyOnRails
[00:52:04] brent__: has joined #RubyOnRails
[00:57:09] emers2n: has joined #RubyOnRails
[00:58:41] emers2n: If I want to show a link to a random post sitewide in the footer, where do I put the controller code so it's available site wide?
[00:58:49] emers2n: Controller code I'm using for a random post: Post.offset(rand(Post.count)).first
[01:02:36] umaaji: has joined #RubyOnRails
[01:05:24] jhfisc: has joined #RubyOnRails
[01:09:50] centrx: has joined #RubyOnRails
[01:10:29] hotpancakes: has joined #RubyOnRails
[01:10:54] bruno-: has joined #RubyOnRails
[01:12:17] patarr: has joined #RubyOnRails
[01:13:45] rakm: has joined #RubyOnRails
[01:13:54] lessless: has joined #RubyOnRails
[01:29:24] jhfisc: has joined #RubyOnRails
[01:31:45] hotpancakes: has joined #RubyOnRails
[01:34:45] jhfisc: has joined #RubyOnRails
[01:43:27] bronson: has joined #RubyOnRails
[01:46:01] lacuna: has joined #RubyOnRails
[01:47:32] hotpancakes: has joined #RubyOnRails
[01:49:17] jhfisc: has joined #RubyOnRails
[01:50:58] xco: has joined #RubyOnRails
[01:51:05] irishfromua: has joined #RubyOnRails
[01:51:53] xco: has joined #RubyOnRails
[01:59:41] apparition: has joined #RubyOnRails
[02:03:01] patarr: has joined #RubyOnRails
[02:05:48] Chernobuk1: has joined #RubyOnRails
[02:06:40] gwilkes_: has joined #RubyOnRails
[02:06:47] sonOfRa_: has joined #RubyOnRails
[02:07:04] mmun_: has joined #RubyOnRails
[02:07:13] nickenchuggets_: has joined #RubyOnRails
[02:08:30] jottr: has joined #RubyOnRails
[02:08:46] LyndsySimon_: has joined #RubyOnRails
[02:09:00] omer: has joined #RubyOnRails
[02:09:49] patarr: has joined #RubyOnRails
[02:12:20] matthewd_: has joined #RubyOnRails
[02:12:20] xco: has joined #RubyOnRails
[02:12:42] apeiros_: has joined #RubyOnRails
[02:13:18] bphogan_: has joined #RubyOnRails
[02:14:12] armyriad: has joined #RubyOnRails
[02:14:15] Scient: has joined #RubyOnRails
[02:17:06] irishfromua: has joined #RubyOnRails
[02:18:03] Jameser: has joined #RubyOnRails
[02:19:11] gremax: has joined #RubyOnRails
[02:19:11] Majadon: has joined #RubyOnRails
[02:19:12] Majadon: has joined #RubyOnRails
[02:20:23] apeiros: has joined #RubyOnRails
[02:21:23] rubio: has joined #RubyOnRails
[02:22:34] mtkd: has joined #RubyOnRails
[02:23:08] rubio: Hi here! i need some help... i like to use the asset:precompile but without creating a single bundle file (specially JS), the idea is that the engine return all the files as in develop mode, but they should be one by one, uglified and minified/gzipped
[02:23:14] rubio: It's possible?
[02:24:30] willardg: has joined #RubyOnRails
[02:32:06] ElFerna: has joined #RubyOnRails
[02:44:58] ascarter: has joined #RubyOnRails
[02:50:18] ascarter_: has joined #RubyOnRails
[02:59:43] TessaM: has joined #RubyOnRails
[03:06:54] biox: has joined #RubyOnRails
[03:08:00] jpleau: has joined #RubyOnRails
[03:09:31] jottr: has joined #RubyOnRails
[03:27:08] ariedler: has joined #RubyOnRails
[03:31:35] hotpancakes: has joined #RubyOnRails
[03:41:11] duderonomy: has joined #RubyOnRails
[03:42:41] high_fiver: has joined #RubyOnRails
[03:44:18] bronson: has joined #RubyOnRails
[03:51:16] kies: has joined #RubyOnRails
[03:56:07] DoctorMonocular: has joined #RubyOnRails
[03:57:58] bios: has joined #RubyOnRails
[03:59:27] bios: hey *.. I'm having a hard time with something simple.. I want to have a link the user can click to duplicate a record.. I've got a controller action that duplicates the record and redirects to the new record.. I'm having issues with the route and also with the link_to .. any tips on best way to do that
[04:02:50] elcontrastador: has joined #RubyOnRails
[04:06:56] fschuindt: has joined #RubyOnRails
[04:10:33] jottr: has joined #RubyOnRails
[04:30:29] bios: nm.. I got it going.. thanks anyways * :]
[04:37:24] hahuang65: has joined #RubyOnRails
[04:37:41] rakm: has joined #RubyOnRails
[04:51:14] cjk101010: has joined #RubyOnRails
[05:01:37] brent__: has joined #RubyOnRails
[05:07:36] patarr: has joined #RubyOnRails
[05:07:47] Rodya_: has joined #RubyOnRails
[05:08:24] mjolnird: has joined #RubyOnRails
[05:11:16] jottr: has joined #RubyOnRails
[05:22:18] tercenya: has joined #RubyOnRails
[05:33:45] uks: has joined #RubyOnRails
[05:45:13] ahrs: has joined #RubyOnRails
[05:45:36] bronson: has joined #RubyOnRails
[05:54:32] benlieb: has joined #RubyOnRails
[05:59:46] hotpancakes: has joined #RubyOnRails
[06:11:28] krmela: has joined #RubyOnRails
[06:12:18] jottr: has joined #RubyOnRails
[06:22:50] clouder`grr: has joined #RubyOnRails
[06:30:25] ariedler: has joined #RubyOnRails
[06:39:47] hahuang65: has joined #RubyOnRails
[07:00:45] duderonomy: has joined #RubyOnRails
[07:08:21] patarr: has joined #RubyOnRails
[07:09:24] fschuindt: has joined #RubyOnRails
[07:12:29] hotpancakes: has joined #RubyOnRails
[07:13:02] jottr: has joined #RubyOnRails
[07:13:49] tbuehlmann_: has joined #RubyOnRails
[07:15:24] quazimod1: has joined #RubyOnRails
[07:17:36] RahulT: has joined #RubyOnRails
[07:42:31] xall: has joined #RubyOnRails
[07:46:29] bronson: has joined #RubyOnRails
[07:50:44] mikecmpbll: has joined #RubyOnRails
[07:59:31] jhfisc: has joined #RubyOnRails
[08:06:02] jhfisc: has joined #RubyOnRails
[08:13:47] jottr: has joined #RubyOnRails
[08:18:57] hotpancakes: has joined #RubyOnRails
[08:19:17] jhfisc: has joined #RubyOnRails
[08:24:14] dionysus69: has joined #RubyOnRails
[08:27:13] cagomez: has joined #RubyOnRails
[08:28:10] ferr: has joined #RubyOnRails
[08:32:18] ariedler: has joined #RubyOnRails
[08:34:14] jhfisc: has joined #RubyOnRails
[08:37:17] jhfisc: has joined #RubyOnRails
[08:39:39] lxsameer: has joined #RubyOnRails
[08:40:40] hahuang65: has joined #RubyOnRails
[08:42:23] Defenestrate: has joined #RubyOnRails
[08:42:28] one_zero: has joined #RubyOnRails
[08:43:17] jhfisc: has joined #RubyOnRails
[08:49:11] jhfisc: has joined #RubyOnRails
[08:55:31] workmad3: has joined #RubyOnRails
[08:58:09] marahin: has joined #RubyOnRails
[09:04:07] jhfisc: has joined #RubyOnRails
[09:06:47] jhfisc: has joined #RubyOnRails
[09:09:17] patarr: has joined #RubyOnRails
[09:14:34] jottr: has joined #RubyOnRails
[09:16:05] jhfisc: has joined #RubyOnRails
[09:21:40] srinidhi: has joined #RubyOnRails
[09:25:23] hotpancakes: has joined #RubyOnRails
[09:27:00] marr: has joined #RubyOnRails
[09:27:26] jhfisc: has joined #RubyOnRails
[09:30:21] Terens: has joined #RubyOnRails
[09:31:03] Terens: Behind a reserse proxy nginx or when using passenger-nginx when serving sidekiq assets I get
[09:31:23] lessless: has joined #RubyOnRails
[09:31:29] Terens: Completed 406 Not Acceptable in 347ms (ActiveRecord: 0.6ms)
[09:31:29] Terens: ActionController::UnknownFormat (DashboardController#index is missing a template for this request format and variant.
[09:31:29] Terens: request.formats: ["text/css"]
[09:31:31] Terens: request.variant: []):
[09:33:24] jhfisc: has joined #RubyOnRails
[09:42:11] hahuang65: has joined #RubyOnRails
[09:43:05] jhfisc: has joined #RubyOnRails
[09:46:02] cseder: has joined #RubyOnRails
[09:47:25] bronson: has joined #RubyOnRails
[09:48:25] jhfisc: has joined #RubyOnRails
[09:53:08] mytrile: has joined #RubyOnRails
[10:06:46] patarr: has joined #RubyOnRails
[10:07:46] fschuindt1: has joined #RubyOnRails
[10:12:57] vedu: has joined #RubyOnRails
[10:13:21] krmela: has joined #RubyOnRails
[10:14:07] gregf_: has joined #RubyOnRails
[10:15:20] jottr: has joined #RubyOnRails
[10:16:28] krmela: hello there i have model WeekDay which has many dayoffer and Food which has many day offer i dont know how to make for given WeekDay in one array put related foods and in second array unrelated foods
[10:19:10] Doldge: has joined #RubyOnRails
[10:28:05] tbuehlmann_: krmela: so you want all associated dayoffers for one specific weekday and then all not associated dayoffers for that same weekday?
[10:29:36] hotpancakes: has joined #RubyOnRails
[10:30:12] krmela: tbuehlmann_: i need associated and unassociated foods
[10:30:50] krmela: tbuehlmann_: dayoffer is limited set of food for given work day
[10:30:51] tbuehlmann_: I don't understand the connection to Food yet. can you gist your models and their associations?
[10:33:28] krmela: tbuehlmann_: https://gist.github.com/netmoleCBA/59019465cc9b53cc3d956bccba60b376
[10:34:01] ariedler: has joined #RubyOnRails
[10:34:07] dminuoso: tbuehlmann_: The connection to food should be quite obvious
[10:34:09] dminuoso: It's lunch time.
[10:34:59] krmela: dminuoso: i thinked it WeekDay.dayoffer.food but console it wont accept
[10:35:33] dminuoso: "it wont accept"
[10:36:29] tbuehlmann_: still not sure I understand. for a given week_day you want to get what exactly?
[10:37:27] krmela: tbuehlmann_: well it is web for big canteen so we have various foods choices stored in foods
[10:37:59] krmela: tbuehlmann_: days are stored in weekday and day offer is restricted set of choices for given day
[10:38:28] krmela: tbuehlmann_: so i need get for given weekday associated and unassociated foods
[10:38:52] dminuoso: Now Im really hungry.
[10:38:59] tbuehlmann_: ah, I see. will prepare a gist
[10:40:02] krmela: dminuoso: i am sorry that i am made you hungry
[10:40:30] tbuehlmann_: https://gist.github.com/tbuehlmann/db14f7aab4d0cdc01a37f14686156612#file-week_day-rb-L3
[10:40:40] tbuehlmann_: that way you can call week_day.foods
[10:42:31] krmela: tbuehlmann_: and second part of question is how to get for give workday unassociated foods i am plan to display two groups of check boxes and and on save process two arrays
[10:43:44] tbuehlmann_: you could write a clever join condition, but I'm too lazy for that right now. this could work: Food.where.not(id: week_day.foods.select(:id))
[10:43:55] jhfisc: has joined #RubyOnRails
[10:47:24] krmela: well guys dminuoso and tbuehlmann thanks for help btw if you coming nearby Olomouc in Czech Republic poke me i am glad invite you for some beer
[10:50:08] lugray: has joined #RubyOnRails
[10:51:38] dminuoso: tbuehlmann_: See? I was completely unhelpful but still got free beer.
[10:52:18] krmela: dminuoso: you helped me a lot other days
[10:52:38] tbuehlmann_: glad to be of help
[11:00:00] jhfisc: has joined #RubyOnRails
[11:05:58] jhfisc: has joined #RubyOnRails
[11:16:05] jottr: has joined #RubyOnRails
[11:19:41] lugray: has joined #RubyOnRails
[11:33:59] hotpancakes: has joined #RubyOnRails
[11:37:18] jhfisc: has joined #RubyOnRails
[11:41:13] shilon: has joined #RubyOnRails
[11:43:00] hahuang65: has joined #RubyOnRails
[11:43:17] jhfisc: has joined #RubyOnRails
[11:49:19] bronson: has joined #RubyOnRails
[11:56:09] jhfisc: has joined #RubyOnRails
[11:59:17] jhfisc: has joined #RubyOnRails
[11:59:38] Jameser: has joined #RubyOnRails
[12:02:02] brent__: has joined #RubyOnRails
[12:02:18] jhfisc: has joined #RubyOnRails
[12:02:19] lugray: has joined #RubyOnRails
[12:05:33] lugray: has joined #RubyOnRails
[12:06:07] cagomez: has joined #RubyOnRails
[12:06:10] Jameser: has joined #RubyOnRails
[12:08:21] Voxxit: has joined #RubyOnRails
[12:12:44] jhfisc: has joined #RubyOnRails
[12:16:27] aajjbb: has joined #RubyOnRails
[12:17:04] jottr: has joined #RubyOnRails
[12:25:29] jhfisc: has joined #RubyOnRails
[12:27:43] Sylario: has joined #RubyOnRails
[12:30:27] mytrile: has left #RubyOnRails: ()
[12:30:40] jhfisc: has joined #RubyOnRails
[12:35:46] ariedler: has joined #RubyOnRails
[12:36:10] jhfisc: has joined #RubyOnRails
[12:37:07] jottr: has joined #RubyOnRails
[12:38:21] high_fiver: has joined #RubyOnRails
[12:39:15] hotpancakes: has joined #RubyOnRails
[12:44:06] jhfisc: has joined #RubyOnRails
[12:45:42] lacuna: has joined #RubyOnRails
[12:47:02] Terens: is there a way to copy assets from a gem
[12:47:15] Terens: to public/assets/ somehow
[12:49:33] dminuoso: Terens: Why...?
[12:49:47] dminuoso: Seriously. Why do you think Rails blessed you with sprockets?
[12:49:58] jphase: has joined #RubyOnRails
[12:50:31] Terens: The issue is this https://github.com/mperham/sidekiq/issues/900
[12:51:13] rfoust: has joined #RubyOnRails
[12:51:32] Terens: It works if I disable X-Accel
[12:52:42] Jameser: has joined #RubyOnRails
[13:02:05] shilon: has joined #RubyOnRails
[13:04:09] truenito: has joined #RubyOnRails
[13:07:51] doublemalt_: has joined #RubyOnRails
[13:13:28] bruno-: has joined #RubyOnRails
[13:14:37] Tempesta: has joined #RubyOnRails
[13:15:54] jhfisc: has joined #RubyOnRails
[13:18:00] ule: Hey guys.. what do you think about forwarding to a model a hash instead of passing via parameters? For example: inside my "def create" I call MyModel.new(permitted_params) instead of MyModel.new(name = nil, email = nil, address = nil, phone = nil) and so on?
[13:18:25] ule: I was told that its a bad practice forwarding a hash to a model and this should be passed as parameters
[13:18:41] ule: but I got to a point where I have too much parameters and it's bacoming a mess
[13:18:58] dionysus69: has joined #RubyOnRails
[13:19:18] ule: Please share your thoughts
[13:20:07] vedu: ule: Could you gist your code
[13:20:08] tbuehlmann_: ule: who says passing a hash is bad practice?
[13:20:23] ule: tbuehlmann_: a senior dude here at work
[13:20:37] ule: vedu: it's not a big differece of what I mention in my example
[13:20:52] tbuehlmann_: that's basically how activemodel and activerecord objects work. are you sure the senior doesn't mean something else?
[13:21:20] ule: tbuehlmann_: no.. that's exactly his idea
[13:21:41] ule: tbuehlmann_: I shouldn't forward to my model something that "Rails" deals on controllers
[13:21:47] vedu: ule: its hard to understand. You are saying that you want to do something like MyModel.new(name = nil, email = nil, address = nil, phone = nil) ?
[13:22:01] ule: no I want to pass a Hash
[13:22:13] ule: MyModem.new(permitted_params)
[13:22:22] ule: for me is way cleaner reading like that
[13:22:22] tbuehlmann_: are you really really sure? maybe the senior means to not throw the raw params into the method call rather than using strong params?
[13:22:33] vedu: ule: this is the correct way. how is permitted_params defined?
[13:22:58] vedu: yeah I think I would agree with tbuehlmann_
[13:23:02] ule: tbuehlmann_: I'm actually passing the hash affter calling a private method with .permit and all that idea
[13:23:14] ule: so it's not raw "params"
[13:23:18] tbuehlmann_: right, that's sounds correct to me
[13:23:38] tbuehlmann_: I prefer this way over having an explicit order of the single attributes
[13:24:03] ule: I found this video to support my argument.. https://www.youtube.com/watch?v=4e-_bbFjPRg
[13:24:03] tbuehlmann_: what if you _don't_ want to update a single one of the attributes? providing nil obviously doesn't work
[13:24:14] ule: but I would love to see a Official Rails Best Practice
[13:24:55] ule: yeah.. providing nil or not nil it's not the point.. the point mention was not passing params as hash to a model
[13:24:57] tbuehlmann_: that is a common rails practice, you can quote me on this
[13:25:16] matthewd: ule: It's literally the Active Record API, used in every example controller/action everywhere.. I'm not sure what else we can offer
[13:26:12] ule: yeah thank you guys.. I'm gonna refactory my code here.. I got to a point where I'm passing 4 parameters which is becoming ridiculous
[13:26:29] ule: thank you everyone
[13:29:33] apparition47: has joined #RubyOnRails
[13:29:33] doublemalt_: has joined #RubyOnRails
[13:29:45] tbuehlmann_: I'm glad you asked
[13:30:01] jhfisc: has joined #RubyOnRails
[13:31:26] ule: Does this apply even for custom methods?
[13:32:15] ule: for example.. if inside my "def index" I have something like MyModel.new.users_custom_method(permitted_params) ?
[13:34:01] matthewd: Well it's ultimately a design decision, which is theoretically what a senior developer is there for
[13:36:49] ule: I feel chatting here sometimes I get better insights
[13:38:20] shilon: hello there, I’m starting to use money and currencies. To switch between currencies do I need to make add the rate myself or can I use a gem for that? How can I have a select_field with only currencies I want? Can I define the currencies available?
[13:41:31] mikecmpb_: has joined #RubyOnRails
[13:43:53] hahuang65: has joined #RubyOnRails
[13:45:01] jhfisc: has joined #RubyOnRails
[13:50:29] jhfisc: has joined #RubyOnRails
[13:50:31] bronson: has joined #RubyOnRails
[13:56:12] truenito: has joined #RubyOnRails
[13:59:30] chouhoulis: has joined #RubyOnRails
[14:00:31] hotpancakes: has joined #RubyOnRails
[14:01:20] jhfisc: has joined #RubyOnRails
[14:05:20] Jameser: has joined #RubyOnRails
[14:07:10] hotpancakes: has joined #RubyOnRails
[14:08:21] shilon: has joined #RubyOnRails
[14:08:48] Jameser: has joined #RubyOnRails
[14:11:13] jhfisc: has joined #RubyOnRails
[14:11:55] arup_r: has joined #RubyOnRails
[14:13:34] lugray: has joined #RubyOnRails
[14:15:36] Jameser: has joined #RubyOnRails
[14:22:27] Ergo: has joined #RubyOnRails
[14:23:17] rubio: has joined #RubyOnRails
[14:23:29] rubio: Hi here! i need some help... i like to use the asset:precompile but without creating a single bundle file (specially JS), the idea is that the engine return all the files as in develop mode, but they should be one by one, uglified and minified/gzipped
[14:23:29] rubio: It's possible?
[14:25:20] fryguy: rubio: yep. you can do this. you really don't want to, but you can
[14:26:06] fryguy: in config/application.rb, config.assets.precompile can take a Proc for what to precompile instead of a static list
[14:26:09] fryguy: then you can do somethign like this:
[14:26:57] theunraveler: has joined #RubyOnRails
[14:27:05] fryguy: https://gist.github.com/bryanalves/6b862f18f817045759f002ab869c1aa5
[14:27:27] rubio: fryguy: the reason behind is to take advantage of http/2 protocol for parallel downloads... :D
[14:27:36] jhfisc: has joined #RubyOnRails
[14:27:47] fryguy: rubio: it's not going to work how you think it's going to work
[14:28:55] fryguy: because http will parallel download, sure, but that won't be any faster than downloading a single file.
[14:29:11] fryguy: give it a try though, i wouldn't mind being proven wrong
[14:29:21] fryguy: i have not conducted this experiment myself
[14:30:53] high_fiver: has joined #RubyOnRails
[14:31:38] rubio: the theory say that parallels should be faster... but i will let you know the results, maybe this can we added later as a "inline comment" on the default code... :D
[14:32:24] FooBarWidget: has joined #RubyOnRails
[14:33:55] jhfisc: has joined #RubyOnRails
[14:33:57] mikecmpbll: has joined #RubyOnRails
[14:34:13] rfoust: has joined #RubyOnRails
[14:36:45] fryguy: rubio: you'll lose compression efficiency from compressing multiple smaller files instead of 1 larger file
[14:38:03] ariedler: has joined #RubyOnRails
[14:38:56] jphase: has joined #RubyOnRails
[14:38:57] rubio: let me test and i will let you know.... normally the bottleneck is the internet latency and slowness on a single thread... but lets make some tests :D
[14:39:25] shilon: has joined #RubyOnRails
[14:39:42] jhfisc: has joined #RubyOnRails
[14:39:59] chouhoulis: has joined #RubyOnRails
[14:41:44] brent__: has joined #RubyOnRails
[14:44:05] jhfisc: has joined #RubyOnRails
[14:48:14] NoGodDamnIdea: has joined #RubyOnRails
[14:52:28] Jameser: has joined #RubyOnRails
[14:58:31] danguita: has joined #RubyOnRails
[14:59:39] hotpancakes: has joined #RubyOnRails
[14:59:54] lacuna: has joined #RubyOnRails
[15:10:01] patarr: has joined #RubyOnRails
[15:11:25] Orxata_: has joined #RubyOnRails
[15:13:00] mtkd: has joined #RubyOnRails
[15:19:46] ar1a: has joined #RubyOnRails
[15:24:13] mikecmpbll: has joined #RubyOnRails
[15:26:32] chouhoulis: has joined #RubyOnRails
[15:27:09] cagomez: has joined #RubyOnRails
[15:32:50] rfoust: has joined #RubyOnRails
[15:34:50] cagomez: has joined #RubyOnRails
[15:35:05] hotpancakes: has joined #RubyOnRails
[15:38:55] ariedler: has joined #RubyOnRails
[15:40:59] rubio: has joined #RubyOnRails
[15:44:58] hahuang65: has joined #RubyOnRails
[15:46:21] high_fiver: has joined #RubyOnRails
[15:51:09] bronson: has joined #RubyOnRails
[15:52:53] Rodya_: has joined #RubyOnRails
[15:53:43] FooBarWidget: has joined #RubyOnRails
[15:56:39] hotpancakes: has joined #RubyOnRails
[15:57:46] bruno-: has joined #RubyOnRails
[15:58:38] hoangtg: has joined #RubyOnRails
[15:59:26] dviola: has joined #RubyOnRails
[16:03:33] ahrs: has joined #RubyOnRails
[16:04:55] wolfravenous: has joined #RubyOnRails
[16:10:12] rakm: has joined #RubyOnRails
[16:12:07] chouhoulis: has joined #RubyOnRails
[16:18:43] gusrub: has joined #RubyOnRails
[16:22:33] ascarter: has joined #RubyOnRails
[16:23:35] duderonomy: has joined #RubyOnRails
[16:25:24] mwlang: has joined #RubyOnRails
[16:25:30] br0d1n: has joined #RubyOnRails
[16:25:55] mwlang: I’m just curious (seeking ideas): How would you refactor this? https://gist.github.com/mwlang/09958e44a202654783e4b24348e9d754
[16:27:18] mwlang: basically, the code’s stopping a delete of a party record if it’s referenced in a number of different scenarios (read: tables)
[16:35:59] Exuma: has joined #RubyOnRails
[16:36:58] dionysus69: has joined #RubyOnRails
[16:42:51] shilon: has joined #RubyOnRails
[16:45:44] greengriminal: has joined #RubyOnRails
[16:53:04] greengriminal: Can someone shed a bit of light on an issue I'm facing. My problem is rails is failing to load an asset in the test env.
[16:53:20] greengriminal: I can confirm that in development the asset will load. This is the gist I have prepared: https://gist.github.com/davidpatters0n/9c5f5d00917a88f01916afbfc0a7c6c7
[16:54:15] mwlang: greengriminal: try: spring stop
[16:54:24] mwlang: then try tests again.
[16:55:12] mwlang: not sure if that’s your issue or not, but frequently when test or development start behaving differently from each other, spring is the culprit for me.
[16:55:46] lacuna: has joined #RubyOnRails
[16:56:04] leggomygreggo: has joined #RubyOnRails
[16:57:29] greengriminal: has joined #RubyOnRails
[16:57:37] greengriminal: mwlang, - I got disconnected
[16:57:59] greengriminal: mwlang, - Should i be running `spring stop` from within the rails test console ?
[16:58:34] greengriminal: okay so ran that from outside the rails console.
[16:59:06] gusrub: has joined #RubyOnRails
[16:59:54] greengriminal: Appears to not make a difference. If i re-run `Rails.application.assets.find_asset('foundation_emails').to_s` in a rails test console.
[17:00:15] one_zero: has joined #RubyOnRails
[17:00:52] leggomygreggo: Hi. So im getting a kinda weird error. I display a group of categories. They are in a certain order but when I update the a field for a certain category, the category moves to the bottom of the page. This happens with all the categories and cycles like that each time i update one. I am assuming there is some kind of ordering default that puts the most recently updated one on the bottom
[17:01:09] leggomygreggo: How do i override that so they are always in alphabetical order
[17:01:10] leggomygreggo: https://gist.github.com/greghoggard/15e534ea4720ecd85431a5bb650ac3ad
[17:01:26] fryguy: leggomygreggo: there is explicitly no default ordering
[17:02:19] leggomygreggo: So how would i put an explict ordering on there?
[17:02:37] leggomygreggo: I have tried to put .order(name: :desc) but to no avail
[17:03:14] cpruitt: has joined #RubyOnRails
[17:03:15] fryguy: putting it where
[17:03:32] rattatmatt: has joined #RubyOnRails
[17:03:51] leggomygreggo: <% Category.where(report_id: @report.id).order(name: :desc).each do |category| %>
[17:04:55] fryguy: what SQL does that generate
[17:06:25] sha-7: has joined #RubyOnRails
[17:06:55] sha-7: Is there a way I can automatically log all the errors that get raised?
[17:08:37] Rodya_: has joined #RubyOnRails
[17:10:47] hahuang65: has joined #RubyOnRails
[17:14:52] ahrs: has joined #RubyOnRails
[17:16:14] fryguy: sha-7: they should already end up in log/{environment}.log
[17:17:08] leggomygreggo: Wow apparenly i said i ordered my list like that but i didnt actually lol
[17:17:12] leggomygreggo: Fixed thanks fryguy
[17:17:22] ascarter: has joined #RubyOnRails
[17:26:42] Chernobuk: has joined #RubyOnRails
[17:30:23] kies: has joined #RubyOnRails
[17:31:21] cagomez: has joined #RubyOnRails
[17:35:56] mtkd: has joined #RubyOnRails
[17:45:28] high_fiver: has joined #RubyOnRails
[17:50:39] jhfisc: has joined #RubyOnRails
[17:52:47] bronson: has joined #RubyOnRails
[17:53:49] one_zero: has joined #RubyOnRails
[18:00:11] sha-7: fryguy: thanks!
[18:00:16] defsdoor: has joined #RubyOnRails
[18:01:37] rubio: has joined #RubyOnRails
[18:02:20] jhfisc: has joined #RubyOnRails
[18:05:50] nebiros: has joined #RubyOnRails
[18:11:11] rakm: has joined #RubyOnRails
[18:11:56] rakm: has joined #RubyOnRails
[18:12:41] rakm: has joined #RubyOnRails
[18:14:22] jhfisc: has joined #RubyOnRails
[18:19:06] boreddanman: has joined #RubyOnRails
[18:19:27] boreddanman: any ActiveRecord / SQL Wizards out there?
[18:19:43] boreddanman: having some trouble querying in an efficient way
[18:19:49] boreddanman: internet has been of no use
[18:20:24] jhfisc: has joined #RubyOnRails
[18:21:13] srinidhi: has joined #RubyOnRails
[18:22:30] cagomez: has joined #RubyOnRails
[18:22:37] boreddanman: Basically I have a model which represents a single access of a file. Most relevant attributes are: ID, filename, date_accessed, and ip_address. I want to group on filename and pluck the top 10 records ordered by the count of distinct ip_addresses, but also retrieve the total count. How can i get both aggregations in one query?
[18:23:03] cagomez: has joined #RubyOnRails
[18:27:23] yebyen: has joined #RubyOnRails
[18:27:58] yebyen: Greetings, I am wondering if anyone knows how to manipulate sessions in ActionController::Integration::Session
[18:28:01] yebyen: eg in the rails console
[18:28:47] yebyen: I found out that I can do "rails console" and run "app.get '/'" and get back a request response and use this way to do debugging
[18:29:21] yebyen: but my login process goes out to CAS for auth and I'm not sure how the authorization is handled, because it's done by rack-cas
[18:29:39] yebyen: I just need to make sure that session["cas"]["user_id"] is set before the request is handled
[18:30:03] yebyen: but app.session is "not yet loaded"
[18:30:09] yebyen: and when I do set variables in there, they don't seem to stick
[18:30:16] havenwood: yebyen: Are you familiar with #open_session with a block?
[18:30:25] yebyen: new one for me
[18:30:34] havenwood: yebyen: https://apidock.com/rails/ActionController/IntegrationTest/open_session
[18:30:39] havenwood: yebyen: It's a bit hard to find!
[18:30:44] havenwood: Session isn't easy to google.
[18:30:49] havenwood: Oops, bad docs link >.>
[18:30:55] havenwood: Go away API dock!!
[18:31:11] havenwood: http://api.rubyonrails.org/v5.1.2/classes/ActionDispatch/IntegrationTest.html
[18:31:42] havenwood: yebyen: Third time's the charm: http://api.rubyonrails.org/v5.1.0/classes/ActionDispatch/Integration/Runner.html#method-i-open_session
[18:31:53] shilon: has joined #RubyOnRails
[18:32:15] yebyen: how do I get an ActionDispatch::Integration::Runner?
[18:32:28] yebyen: in rails console, I just use "app" and find the Integration::Session
[18:33:10] yebyen: i was hoping for a way to get the session so I could manipulate it directly...
[18:33:27] yebyen: this looks like I could set up a session and manipulate it through posts, if I have a post endpoint for what I'm trying to do
[18:33:47] havenwood: it's mixed in afaik, you can just: open_session do; assert_equal session['yebyen'], 'yebyen'
[18:34:33] yebyen: its a part of Test::Unit?
[18:34:42] yebyen: i don't seem to have open_session in rails console
[18:35:05] havenwood: yebyen: are you in the console inside an integration tet?
[18:35:19] yebyen: no i'm in the console just outside of shell
[18:35:20] havenwood: We're talking tests, right?
[18:35:24] havenwood: Did I get confused?
[18:35:41] havenwood: Integration tests? Maybe I just made that up. >.>
[18:35:42] yebyen: if you start an interactive rails console eg. 'rails c'
[18:36:02] yebyen: the ActionDispatch::Integration::Session object is available to you as 'app'
[18:36:11] havenwood: Oh dear, my pre-coffee brain thought you were asking about integration tests.
[18:36:16] havenwood: You weren't.
[18:36:17] yebyen: i am almost
[18:36:36] yebyen: app.get '/' is roughly equivalent to "get '/'" in an integration test
[18:36:43] yebyen: i think they are actually the same thing
[18:37:11] yebyen: i could disable the actual CAS part of rack-cas for my debugging/testing session
[18:37:36] yebyen: and send a simple post with a username and password to whatever FakeCAS endpoint is listening, like rack-cas does in ENV=test
[18:38:07] yebyen: that might be the best thing to do, because honestly I don't think I need to manipulate the session directly for anything other than to get past my authenticate before
[18:38:18] deur-_: has joined #RubyOnRails
[18:38:58] rubio: fryguy: with your code precompile do precompile all files.... but the require on application.js still load all inside the bundle, not like in development (where javascript_include_tag "application" incude all separates files...)
[18:39:01] yebyen: it looks a little bit like this is not exposed as a public API on purpose
[18:39:19] shilon: has joined #RubyOnRails
[18:39:23] sha-7: has left #RubyOnRails: ()
[18:39:50] FredStockton: has joined #RubyOnRails
[18:45:10] cagomez: has joined #RubyOnRails
[18:47:43] watersoul: has joined #RubyOnRails
[18:50:37] DoctorMonocular: has joined #RubyOnRails
[18:54:54] jhfisc: has joined #RubyOnRails
[18:57:45] mtkd: has joined #RubyOnRails
[18:59:49] jhfisc: has joined #RubyOnRails
[19:00:13] Jon30: has joined #RubyOnRails
[19:00:20] Jon30: is find_by_sql safe from SQL injections?
[19:03:51] cagomez: has joined #RubyOnRails
[19:16:31] theunrav_: has joined #RubyOnRails
[19:20:02] rakm: has joined #RubyOnRails
[19:21:09] cagomez: has joined #RubyOnRails
[19:23:02] yebyen: havenwood: i wound up just dropping a pry statement in before the point that checks if session['cas']['user'] is set
[19:23:10] yebyen: and setting it when that pry comes along the first time
[19:23:34] yebyen: now I can app.get '/' and follow redirects to my heart's content, session persists without any open_session tricks
[19:23:49] yebyen: i have no idea why just sending a post to /login doesn't work with rack-cas fakecas
[19:24:04] yebyen: i get back a redirect with a blank Location: header
[19:24:30] yebyen: not sure what's supposed to happen after that, but in my browser I wind up logged in
[19:25:11] yebyen: normally the 302 comes with a location target
[19:25:27] yebyen: maybe there's something that isn't set in the rack-cas fakecas middleware when you do it this way
[19:25:36] jhfisc: has joined #RubyOnRails
[19:29:55] Aherin: has joined #RubyOnRails
[19:31:32] gusrub: has joined #RubyOnRails
[19:32:00] jhfisc: has joined #RubyOnRails
[19:33:39] cagomez: has joined #RubyOnRails
[19:38:03] jhfisc: has joined #RubyOnRails
[19:38:09] cam27: has joined #RubyOnRails
[19:39:57] hahuang65: has joined #RubyOnRails
[19:42:59] jhfisc: has joined #RubyOnRails
[19:45:19] FredStockton: has left #RubyOnRails: ()
[19:46:27] ascarter: has joined #RubyOnRails
[19:49:13] cagomez: has joined #RubyOnRails
[19:53:23] bronson: has joined #RubyOnRails
[19:55:08] gambl0re: has joined #RubyOnRails
[19:56:29] cagomez: has joined #RubyOnRails
[19:59:23] jhfisc: has joined #RubyOnRails
[20:01:58] emilkarl: has joined #RubyOnRails
[20:02:08] lxsameer: has joined #RubyOnRails
[20:03:26] cagomez: has joined #RubyOnRails
[20:09:24] Jayson_Virissimo: has joined #RubyOnRails
[20:09:43] workmad3: has joined #RubyOnRails
[20:10:22] jhfisc: has joined #RubyOnRails
[20:10:36] yebyen: does anyone know what kind of redirect comes with a blank Location: header?
[20:10:54] yebyen: other than, one that goes nowhere
[20:11:19] yebyen: rack-cas seems to be sending me a redirect with no destination, but in my browser it definitely goes
[20:14:56] yebyen: could it be some kind of csrf protection issue?
[20:15:05] yebyen: because I'm not sending any cookies with the first request
[20:18:35] doublemalt_: has joined #RubyOnRails
[20:19:07] patarr: Does SideKiq license only per worker, or deos it also license per app?
[20:23:03] benlieb: has joined #RubyOnRails
[20:23:49] benlieb: I'm having a problem using my_relation.any? when my_relation uses a select() clause with an "AS" in it. https://gist.github.com/benlieb/20fb447140cf303b72d1d7bce724cfd8
[20:23:56] cagomez: has joined #RubyOnRails
[20:24:16] benlieb: a col that I'm using in the group no longer exists: ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "num" does not exist LINE 1: ...", "sale_commissions"."commission_rate" ORDER BY num desc, ...
[20:24:21] benlieb: is there a right way to do this?
[20:26:11] HoierM: has joined #RubyOnRails
[20:27:04] bennyzr: has joined #RubyOnRails
[20:27:51] bennyzr: Hi, anybody have any suggestions on implementing a user id stamp with active record?
[20:29:55] Rodya_: has joined #RubyOnRails
[20:38:00] Jayson_Virissimo: benlieb: you try .exists? already?
[20:40:04] ur5us: has joined #RubyOnRails
[20:43:58] jhfisc: has joined #RubyOnRails
[20:50:22] mtkd: has joined #RubyOnRails
[20:53:11] netzfisch: has joined #RubyOnRails
[20:53:25] ElFerna: has joined #RubyOnRails
[20:53:55] rakm: has joined #RubyOnRails
[20:54:41] ascarter_: has joined #RubyOnRails
[20:55:33] gusrub: has joined #RubyOnRails
[20:56:11] jhfisc: has joined #RubyOnRails
[21:05:37] ascarter_: has joined #RubyOnRails
[21:20:06] hotpancakes: has joined #RubyOnRails
[21:22:53] jhfisc: has joined #RubyOnRails
[21:23:28] gusrub: has joined #RubyOnRails
[21:28:43] tvon: has joined #RubyOnRails
[21:29:21] jhfisc: has joined #RubyOnRails
[21:32:28] Rodya_: has joined #RubyOnRails
[21:34:04] jhfisc: has joined #RubyOnRails
[21:39:21] jhfisc: has joined #RubyOnRails
[21:41:46] Jason: let's pretend i have `resource :favorite, only: %w(update destroy)`
[21:41:49] Jason: why am I using %w?
[21:42:08] Jason: why not ['update', 'destroy']
[21:44:17] baweaver: they're the same thing
[21:44:18] baweaver: so preference really
[21:44:20] Jayson_Virissimo: It's shorter and quicker to add to/ remove from.
[21:44:47] Jayson_Virissimo: Otherwise they are identical.
[21:44:48] jhfisc: has joined #RubyOnRails
[21:45:41] rubycoder37: has joined #RubyOnRails
[21:49:18] rubycoder37: I'm trying to write tests with the default stack (minitest, fixtures, etc), but I have devise installed, do I need to create a user fixture first and then use one of the devise helpers to authenticate?
[21:53:27] jhfisc: has joined #RubyOnRails
[21:54:18] bronson: has joined #RubyOnRails
[21:56:14] s2013: has joined #RubyOnRails
[21:57:46] Jason: bennyzr, Jayson_Virissimo: thanks :)
[21:58:00] fryguy: rubycoder37: you might find this helpful: https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-(and-RSpec)
[21:59:14] jhfisc: has joined #RubyOnRails
[22:01:47] rubycoder37: fryguy: thanks, but I'm not using factorygirl, can I use fixtures instead?
[22:02:51] cagomez: has joined #RubyOnRails
[22:04:17] jhfisc: has joined #RubyOnRails
[22:04:47] gusrub: has joined #RubyOnRails
[22:08:15] cagomez: has joined #RubyOnRails
[22:08:41] cagomez: has joined #RubyOnRails
[22:09:24] cagomez: has joined #RubyOnRails
[22:10:07] cagomez: has joined #RubyOnRails
[22:11:24] Rodya_: has joined #RubyOnRails
[22:17:01] hahuang65: has joined #RubyOnRails
[22:27:54] Rodya_: has joined #RubyOnRails
[22:28:37] cagomez: has joined #RubyOnRails
[22:29:39] cagomez: has joined #RubyOnRails
[22:33:33] hahuang65: has joined #RubyOnRails
[22:43:26] hotpancakes: has joined #RubyOnRails
[22:44:58] ascarter: has joined #RubyOnRails
[22:45:11] ascarter_: has joined #RubyOnRails
[22:46:59] cagomez: has joined #RubyOnRails
[22:51:30] akshat: has joined #RubyOnRails
[22:54:54] jhfisc: has joined #RubyOnRails
[22:58:17] patarr: How the hell does Airbrake not let you disable integrations....
[22:58:23] patarr: This gem drives me insane...
[23:00:03] jhfisc: has joined #RubyOnRails
[23:06:56] pwnd_nsfw: has joined #RubyOnRails
[23:06:59] jhfisc: has joined #RubyOnRails
[23:08:17] rfoust: has joined #RubyOnRails
[23:23:20] cseder: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[23:24:51] jhfisc: has joined #RubyOnRails
[23:30:07] RahulT: has joined #RubyOnRails
[23:31:17] jhfisc: has joined #RubyOnRails
[23:34:45] jhfisc: has joined #RubyOnRails
[23:37:37] ascarter: has joined #RubyOnRails
[23:37:54] patarr1: has joined #RubyOnRails
[23:44:22] |PiP|: has joined #RubyOnRails
[23:46:45] |PiP|: How can I get the internal values of an ActiveRecord object, right before save? I don't want to call the public/external methods, but rather, I'd like to retrieve the true internal representation of the data that will be persisted to the database.
[23:47:03] cagomez: has joined #RubyOnRails
[23:47:13] |PiP|: Basically, I want the values that will be sent to the database when a .save() is called
[23:47:56] |PiP|: Is there an internal hash or something, where that data lives, inside each AR object?
[23:52:41] jhfisc: has joined #RubyOnRails
[23:52:52] |PiP|: Ahh, found it. Is it the "attributes" method that returns the internal representation?
[23:54:40] cagomez: has joined #RubyOnRails
[23:55:34] bronson: has joined #RubyOnRails
[23:57:35] rakm: has joined #RubyOnRails
[23:58:25] rakm: has joined #RubyOnRails