« Back to channel list

#RubyOnRails - 22 November 2017

« Back 1 day Forward 1 day »
[00:01:11] Radar: hnanon: How did you define @categories and @markets?
[00:01:54] Radar: hnanon: Next clue: work out how to calculate the revenue for a given category / market combination.
[00:02:06] Radar: So Market A and Category 1. What is their revenue?
[00:03:12] hnanon: Radar: @categories = Category.all
[00:03:26] hnanon: Similarly for @markets
[00:04:08] Radar: Good. You might want to order them by name for readability.
[00:04:59] hnanon: <%= category.revenues.sum(:amount) %> gives me the total revenue across all markets...
[00:05:43] hnanon: To get the revenue for each market...
[00:05:58] Radar: Just for _one_ market.
[00:06:12] Radar: All the revenue records for _one_ category and _one_ market.
[00:07:33] rfoust: has joined #RubyOnRails
[00:14:06] hnanon: Radar: Almost there...
[00:14:09] hnanon: Radar: <%= category.revenues.joins(:location).where(locations: { market_id: 2 }).sum(:amount) %>
[00:14:21] hnanon: I'm hardcoding the market_id for now...
[00:14:32] hnanon: It's correctly showing the sum for each id.
[00:21:16] Radar: hnanon: Ok, so can you get it to display all those totals for at least one category, across all markets?
[00:21:18] hnanon: Radar: https://gist.github.com/anonymous/138c877b5db49cfec679997b35e79e83 !
[00:22:37] mtkd: has joined #RubyOnRails
[00:25:09] orbyt_: has joined #RubyOnRails
[00:38:06] Kutakizukari: has joined #RubyOnRails
[00:39:26] Technodrome: has joined #RubyOnRails
[00:43:30] sevenseacat: has joined #RubyOnRails
[00:47:05] hnanon: Radar: Thank you for your help.
[00:47:34] hnanon: Radar: You always come through and I really appreciate it.
[00:47:47] hnanon: creature: Thank you too.
[00:53:38] workmad3: has joined #RubyOnRails
[01:04:06] Radar: hnanon: You might want to look at how you could move those queries into one query so you can easily grab all that data in one... but I think that's pro-level type stuff.
[01:12:08] srinidhi: has joined #RubyOnRails
[01:17:33] orbyt_: has joined #RubyOnRails
[01:19:11] xaviergmail: has joined #RubyOnRails
[01:26:20] Kutakizukari: has joined #RubyOnRails
[01:54:44] Barrt: has joined #RubyOnRails
[02:03:08] Jameser: has joined #RubyOnRails
[02:09:01] Jameser: has joined #RubyOnRails
[02:10:49] Barrt: has joined #RubyOnRails
[02:13:25] Jameser: has joined #RubyOnRails
[02:21:42] Barrt: has joined #RubyOnRails
[02:21:43] one_zero: has joined #RubyOnRails
[02:23:01] LambdaSource: has joined #RubyOnRails
[02:37:55] tenderlove: has joined #RubyOnRails
[02:46:08] Jameser: has joined #RubyOnRails
[02:53:56] workmad3: has joined #RubyOnRails
[02:59:49] elcontrastador: has joined #RubyOnRails
[03:20:10] Barrt: has joined #RubyOnRails
[03:20:33] tcopeland: has joined #RubyOnRails
[03:31:25] epochwolf: has joined #RubyOnRails
[03:51:12] Barrt: has joined #RubyOnRails
[03:57:17] Jameser: has joined #RubyOnRails
[04:20:42] Barrt: has joined #RubyOnRails
[04:26:32] kies: has joined #RubyOnRails
[04:45:21] Karpah: has joined #RubyOnRails
[04:46:08] MrCrackPotBuilde: can you display an error message without the name of the object
[04:46:21] MrCrackPotBuilde: <%= @message.errors.full_messages.join(', ') %>
[04:46:38] MrCrackPotBuilde: being used with validates on a contact page
[04:46:47] MrCrackPotBuilde: i managed to display custom messages
[04:46:57] MrCrackPotBuilde: but i cant get rid of the name infront
[04:47:10] MrCrackPotBuilde: contactName Name should not be blank
[04:47:24] MrCrackPotBuilde: but i want to remove the contactName
[04:50:09] orbyt_: has joined #RubyOnRails
[04:54:13] workmad3: has joined #RubyOnRails
[05:03:16] Barrt: has joined #RubyOnRails
[05:21:05] starseed00: has joined #RubyOnRails
[05:22:50] starseed00: So I just moved my site from a place where I had the domain name setup to amazon where it's currently at something like: https://my-application.gzfivafdic.us-east-1.elasticbeanstalk.com. Now all of the sudden my POST requests are all returning InvalidAuthenticityToken - I have domain: all set in my session_store.rb - what gives?
[05:23:22] Barrt: has joined #RubyOnRails
[05:28:21] iamarun: has joined #RubyOnRails
[05:32:02] helpa-bot: has joined #RubyOnRails
[05:34:02] helpa: has joined #RubyOnRails
[05:36:42] starseed00: I also have all of the protect_from_forgery with: :exception - and this all works when I am at mydomain.com.
[05:39:52] Exhiled: has joined #RubyOnRails
[05:41:53] Radar: !botsnack
[05:41:53] helpa: Nom nom. Thanks, Radar!
[05:49:52] sevenseacat: has joined #RubyOnRails
[05:56:49] Barrt: has joined #RubyOnRails
[06:35:54] dionysus69: has joined #RubyOnRails
[06:38:47] Technodrome: has joined #RubyOnRails
[06:50:24] Barrt: has joined #RubyOnRails
[06:54:30] workmad3: has joined #RubyOnRails
[07:17:32] snickers: has joined #RubyOnRails
[07:22:34] conta: has joined #RubyOnRails
[07:27:23] kickr_: has joined #RubyOnRails
[07:28:13] kickr_: has joined #RubyOnRails
[07:29:22] kickr: has joined #RubyOnRails
[07:32:22] Radanisk: has joined #RubyOnRails
[07:39:16] Barrt: has joined #RubyOnRails
[07:44:57] DrYockel: has joined #RubyOnRails
[07:58:19] Technodrome: what i the most common used bootstrap gem?
[07:59:00] LambdaSource: has joined #RubyOnRails
[08:13:10] kapil___: has joined #RubyOnRails
[08:14:12] DoubleMalt: has joined #RubyOnRails
[08:14:50] cschneid_: has joined #RubyOnRails
[08:18:12] Barrt: has joined #RubyOnRails
[08:33:42] Technodrome: has joined #RubyOnRails
[08:35:21] srinidhi: has joined #RubyOnRails
[08:45:49] Technodrome: has joined #RubyOnRails
[08:47:57] Ergo: has joined #RubyOnRails
[08:52:29] ur5us: has joined #RubyOnRails
[08:54:47] andrew9184: has joined #RubyOnRails
[08:55:46] workmad3: has joined #RubyOnRails
[08:56:48] xall: has joined #RubyOnRails
[08:58:38] hervie: has joined #RubyOnRails
[09:08:56] ur5us: has joined #RubyOnRails
[09:11:28] shilon: has joined #RubyOnRails
[09:18:34] FastJack: has joined #RubyOnRails
[09:20:08] bronson: has joined #RubyOnRails
[09:32:21] shilon: has joined #RubyOnRails
[09:35:48] shilon: has joined #RubyOnRails
[09:38:06] dminuoso: !radarsnack
[09:38:13] dminuoso: Radar: Where is this command?
[09:38:28] dminuoso: How do we feed you with snacks if you've done a good job?
[09:38:29] helpa: Nom nom. Thanks, sevenseacat!
[09:38:53] dminuoso: sevenseacat: Yeah, why do we get to feed the bot but not radar?
[09:39:44] sevenseacat: should add a fact for that that has his paypal address in it. that will feed him.
[09:40:39] Sylario: has joined #RubyOnRails
[09:52:08] xall: has joined #RubyOnRails
[09:57:18] DoubleMalt: has joined #RubyOnRails
[10:06:48] fearoffish: has joined #RubyOnRails
[10:07:21] MrCrackPotBuilde: has joined #RubyOnRails
[10:17:35] arBmind: has joined #RubyOnRails
[10:30:28] marahin: Any way to explicitly prepare fixtures outside of the test? Like, in a helper file?
[10:38:26] workmad3: has joined #RubyOnRails
[10:44:27] Terens: has joined #RubyOnRails
[10:44:48] Terens: hello. How can I listen for mqtt events from a rails app?
[10:50:34] xall: has joined #RubyOnRails
[10:53:56] alipiorp: has joined #RubyOnRails
[10:56:54] s2013: has joined #RubyOnRails
[10:59:12] ferr: has joined #RubyOnRails
[11:01:46] ferr: has left #RubyOnRails: ()
[11:04:55] SirOliver: has joined #RubyOnRails
[11:11:38] defsdoor: has joined #RubyOnRails
[11:15:40] stamina: has joined #RubyOnRails
[11:20:53] rikkipitt: has joined #RubyOnRails
[11:23:38] dminuoso: terens: You just do.
[11:23:49] dminuoso: terens: set up an extra program that listens to those events.
[11:24:22] SirOliver: has left #RubyOnRails: ("Ave")
[11:24:50] dminuoso: terens: If you want that "listener" to be able to interact with rails, you just also require your config/environment.rb
[11:25:31] hfp_work: has joined #RubyOnRails
[11:25:46] dminuoso: Rails consists of two things basically: A rack application (which connects rack to the routing/controller thing), and everything else. That "everything else" you can get into any program by just requiring that file.
[11:28:18] Terens: dminuoso: This is what I am planning to do. However I dont know how to convice the other developer that this is good
[11:29:20] morfin: has joined #RubyOnRails
[11:30:14] morfin: would you recommend using task instead of migration to enumerate models after adding acts_as_list to this model?
[11:30:27] dminuoso: terens: Have you consider an opinion amplnifier? https://i.imgur.com/1ieRZja.jpg
[11:31:05] dminuoso: Jokes aside, you have to demistify rails to make it obvious how this is the right move.
[11:31:25] dminuoso: terens: But if you want good proof
[11:31:31] dminuoso: terens: Check out your config.ru
[11:31:41] dminuoso: terens: This is basically how rails is started. ;-)
[11:32:10] Terens: I think I should. When I told him that he replies:" I dont understand". Trying to explain get responses like: 'You are overcomplicating things, I dont understand the reason'
[11:32:32] dminuoso: It's literally requiring that file (which initializes and boots rails into your ruby program), and then just uses `run Rails.application` which is a rack thing.
[11:33:48] morfin: there is specific interface for Rack application right?
[11:34:55] matthewd: terens: Is there a competing suggestion/approach for you to compare & contrast? Or just general doubt?
[11:35:11] Terens: I use passenger. Any idea what to use to keep this process up ?
[11:35:31] Terens: matthewd: no.
[11:35:42] matthewd: morfin: Yes: http://rack.github.io/
[11:36:08] Technodrome: has joined #RubyOnRails
[11:37:10] dminuoso: terens: The same way you keep your rails server up.
[11:37:30] dminuoso: terens: And before you say "passenger", what keeps passenger running on your system?
[11:37:50] matthewd: morfin: I'd do it in the same migration that adds the column (or a nearby one)
[11:37:56] Terens: So I could use monit for example?
[11:39:41] matthewd: morfin: Slightly more detailed reasoning: https://github.com/rails/rails/pull/31082#issuecomment-342656259
[11:40:47] marr: has joined #RubyOnRails
[11:41:21] dminuoso: terens: Not familiar with monit, but if thats what you like then sure. Anything that has the capability to "run a program" will suffice. Whether its systemd or monit.
[11:51:58] cheeti: has joined #RubyOnRails
[11:52:50] cheeti: hi i am using pdfkit gem to generate pdf, i am able to cretae pdf but how to add index page?
[12:01:02] dionysus69: simple token authentication gem when using with devise, still falls back to using cookie with postman for example but I have this set in all API controllers acts_as_token_authentication_handler_for User, fallback_to_devise: :false
[12:16:36] lupine: has joined #RubyOnRails
[12:22:09] LambdaSource: has joined #RubyOnRails
[12:28:37] AntiSpamMeta: has joined #RubyOnRails
[12:31:07] lupine: has joined #RubyOnRails
[12:32:41] dviola: has joined #RubyOnRails
[12:40:30] kickr: has joined #RubyOnRails
[12:42:04] kickr_: has joined #RubyOnRails
[12:49:51] DoubleMalt: has joined #RubyOnRails
[12:50:14] lupine: has joined #RubyOnRails
[12:57:58] Sylario: Thank you Ruby for taking a huge JSON and having a matching syntax that allow me to end up with a bunch of arrays and hashes
[13:02:33] keegnotrub: has joined #RubyOnRails
[13:02:41] Technodrome: has joined #RubyOnRails
[13:05:04] morfin: can i somehow make simple_form use scope?
[13:07:43] morfin: simple_fields_for require method name, so i can only rely on specific method in my model?
[13:08:52] Jameser: has joined #RubyOnRails
[13:16:31] airdisa: has joined #RubyOnRails
[13:20:30] dminuoso: What does it mean for simple_form to use scope?
[13:22:40] morfin: simple_fields_for :markers do |marker_form| ... end just get all markers and make forms
[13:23:13] morfin: i had to do simple_fields_for :markers, f.object.markers.ordered_by_sequence do |marker_form| ... end to use my scope
[13:24:08] wethu: has joined #RubyOnRails
[13:25:49] dionysus69: how do disable session store config.session_store :disabled for certain controllers only?
[13:25:57] dionysus69: API controllers*
[13:35:32] drowze: has joined #RubyOnRails
[13:40:40] truenito: has joined #RubyOnRails
[13:43:21] MrCrackPotBuilde: is there something special your supposed to do to make validation errors display the message inside en.yml
[13:45:06] MrCrackPotBuilde: on the validation side its called :contactName so in the en.yml i used errors: format: "%{message}" errors: models: messages: atributes: contactName: Please enter a valid name
[13:45:15] ^mtkd: has joined #RubyOnRails
[13:45:32] MrCrackPotBuilde: i tried adding activeRecord too but that didnt work and active model
[13:52:15] apparition: has joined #RubyOnRails
[13:53:21] rfoust: has joined #RubyOnRails
[14:06:44] keegnotrub: has joined #RubyOnRails
[14:08:35] keegnotrub_: has joined #RubyOnRails
[14:11:45] iamarun: has joined #RubyOnRails
[14:16:05] mtkd: has joined #RubyOnRails
[14:24:10] drowze: has joined #RubyOnRails
[14:25:49] dminuoso: Why would `rails console` not environment variables from the shell it was started in?
[14:25:51] safetypin: has joined #RubyOnRails
[14:26:04] dminuoso: not have. :|
[14:31:11] dminuoso: Oh. SPRING.
[14:31:13] dminuoso: It's you again.
[14:35:50] TinkerTyper: has joined #RubyOnRails
[14:39:24] Technodrome: has joined #RubyOnRails
[14:47:09] uks: has joined #RubyOnRails
[14:52:42] solars: has joined #RubyOnRails
[14:53:17] solars: can anyone recommend a plugin for authentication against a CAS server?
[14:55:51] keegnotrub: has joined #RubyOnRails
[14:59:01] keegnotrub_: has joined #RubyOnRails
[15:01:07] fryguy: solars: devise_cas
[15:12:27] solars: fryguy: the build is failing and it seems outdated..
[15:13:40] fryguy: the last commit was like 1.5 months ago, you should contact the author and/or help him fix the build.
[15:13:50] fryguy: i know him personally, he'll probably be very helpful.
[15:20:54] safetypin: has joined #RubyOnRails
[15:26:40] daveomcd: has joined #RubyOnRails
[15:27:01] daveomcd: how can I add a params value to my ApplicationController.render() call? https://gist.github.com/daveomcd/2fbc50ecc93a289e5a1dbf173cc23cf8
[15:37:26] deur-: daveomcd: replied with something to try in the gist
[15:40:07] daveomcd: deur-, thanks! going to attempt with it
[15:43:17] krawchyk: has joined #RubyOnRails
[15:54:16] uks: has joined #RubyOnRails
[15:56:09] airdisa_: has joined #RubyOnRails
[15:59:35] Or1on: has joined #RubyOnRails
[16:01:28] Technodrome: has joined #RubyOnRails
[16:03:16] Puffball: has joined #RubyOnRails
[16:06:13] DaveM: has joined #RubyOnRails
[16:09:04] mcr1: has joined #RubyOnRails
[16:09:54] kapil___: has joined #RubyOnRails
[16:17:41] conta: has joined #RubyOnRails
[16:21:46] starseed00: has joined #RubyOnRails
[16:21:51] starseed00: So I just moved my site from a place where I had the domain name setup to amazon where it's currently at something like: https://my-application.gzfivafdic.us-east-1.elasticbeanstalk.com. Now all of the sudden my POST requests are all returning InvalidAuthenticityToken - I have domain: all set in my session_store.rb - what gives?
[16:21:52] starseed00: I also have all of the protect_from_forgery with: :exception - and this all works when I am at mydomain.com.
[16:26:11] DaveM: Hello all, Q on front end JS frameworks: I need something that can live within the Rails asset pipeline and doesn't take over the view layer. I use Angular 1 at work and like how it integrates with Rails but would prefer a lib that's not on a slow ramp of death. I'd like to give React a spin but it seems a full React front end and Rails API is the preferred approach. I'm aware of React-Rails and React On Rails but see as many compl
[16:37:12] krawchyk: DaveM rails version?
[16:40:09] dionysus69: has joined #RubyOnRails
[16:43:57] drowze: has joined #RubyOnRails
[16:46:46] one_zero: has joined #RubyOnRails
[16:48:41] mtkd: has joined #RubyOnRails
[16:50:51] bronson_: has joined #RubyOnRails
[16:53:49] airdisa: has joined #RubyOnRails
[16:54:06] Dimik: has joined #RubyOnRails
[16:57:20] DaveM: krawchyk: 5.1.3
[16:57:34] krawchyk: have you looked into trying webpacker?
[16:57:58] krawchyk: that would really help your decision be agnostic to rails while still having a tight integration
[16:58:05] LateralOctober: has joined #RubyOnRails
[16:58:16] krawchyk: https://github.com/rails/webpacker
[17:01:37] one_zero: has joined #RubyOnRails
[17:05:05] starseed00: Do any of you see anything wrong with creating a thread in middleware to time how long each request is taking? Basically surrounding app.call(env) in a thread?
[17:07:02] DaveM: krawchyk: Thanks, looking into webpacker. I'm skimming a couple tutorials, is it common to pass props/data into React via data attributes using this approach?
[17:11:27] keegnotrub: has joined #RubyOnRails
[17:12:12] krawchyk: DaveM i've seen rails render a JSON object of "initial state" for react to consume and pass as props during initialization, data attributes could work but can grow out of control
[17:14:03] krawchyk: DaveM this isn't a rails example but similar to what im thinking https://redux.js.org/docs/recipes/ServerRendering.html#inject-initial-component-html-and-state
[17:18:11] rikkipitt: has joined #RubyOnRails
[17:19:17] uksio: has joined #RubyOnRails
[17:19:33] rikkipitt: i've got a lengthy select query that i'd like to wrap into a query object, how can I best do that? Something like RecordQuery.new (returns the distinct rows) then chain with a where...
[17:20:48] uks: has joined #RubyOnRails
[17:21:17] mtkd: has joined #RubyOnRails
[17:28:38] kickr: has joined #RubyOnRails
[17:29:00] one_zero: has joined #RubyOnRails
[17:41:14] Exhiled: has joined #RubyOnRails
[17:45:26] rikkipitt: has joined #RubyOnRails
[17:48:42] Exhiled: has joined #RubyOnRails
[17:50:14] Cache_Money: has joined #RubyOnRails
[17:51:28] mtkd: has joined #RubyOnRails
[17:59:17] mtkd: has joined #RubyOnRails
[18:00:47] ur5us: has joined #RubyOnRails
[18:01:42] blindMoe: has joined #RubyOnRails
[18:11:17] mcr1: has joined #RubyOnRails
[18:15:30] Andr3as: hello everyone.. i have the need for some special time formating and am using a rb file to do so... see https://gist.github.com/awunder/0092bdc3d0702b238954a02a8e9ab66b
[18:16:09] Andr3as: econtime should be different from tradeplan.. i want it to be dependent on a value of an attribute
[18:16:35] Andr3as: anyone an idea how to pass that value into the call?
[18:27:09] kies: has joined #RubyOnRails
[18:27:55] keegnotrub: has joined #RubyOnRails
[18:27:55] orbyt_: has joined #RubyOnRails
[18:30:04] Andr3as: got it to work.. should not be done in the localization.. for now its in the view, i might refactor it into a helper... <%= l ee.date, format: (ee.all_day? ? :econallday : :econtime) %>
[18:33:32] [Butch]: has joined #RubyOnRails
[18:37:09] Exhiled: has joined #RubyOnRails
[18:48:58] Puffball: has joined #RubyOnRails
[18:57:54] urk187: has joined #RubyOnRails
[19:19:05] DrYockel: has joined #RubyOnRails
[19:20:01] rfoust: has joined #RubyOnRails
[19:34:29] Exhiled: has joined #RubyOnRails
[19:51:15] mtkd: has joined #RubyOnRails
[19:58:53] ur5us: has joined #RubyOnRails
[20:03:13] FrostCandy: has joined #RubyOnRails
[20:05:19] FrostCandy: if i do a <% render "_pagename" %> but it's in a diffenrt folder than where i'm calling it from, how to i tell render where to look? Right now i'm getting missing current_page/_pagename because it obvously can't find it.
[20:06:32] FrostCandy: oh looks like i just add the folder prefix myfolder/mypage
[20:24:21] joshsmith: has joined #RubyOnRails
[20:27:50] kus_ubuntui686: has joined #RubyOnRails
[20:28:25] marr: has joined #RubyOnRails
[20:32:10] yalcin: has joined #RubyOnRails
[20:43:29] truenito: has joined #RubyOnRails
[20:56:19] TinkerTyper: has joined #RubyOnRails
[21:01:11] Or1on: has joined #RubyOnRails
[21:25:11] Jayson_Virissimo: has joined #RubyOnRails
[21:31:38] kitsuneyo: has joined #RubyOnRails
[21:53:09] one_zero: has joined #RubyOnRails
[22:04:19] starseed00: So I just moved my site from a place where I had the domain name setup to amazon where it's currently at something like: https://my-application.gzfivafdic.us-east-1.elasticbeanstalk.com. Now all of the sudden my POST requests are all returning InvalidAuthenticityToken - I have domain: all set in my session_store.rb - what gives?
[22:05:30] helpa: has joined #RubyOnRails
[22:22:27] Megamos: has joined #RubyOnRails
[22:26:06] rikkipitt: has joined #RubyOnRails
[22:27:13] dminuoso: FrostCandy: Yes. It was done this way to ensure maximum confusion.
[22:27:15] Megamos: Anyone have a rails 5 app on debian 9 in production? Have taken on a project and trying to establish what to use before setting up dev-env on a new comp.
[22:27:51] dminuoso: Megamos: It does not matter, as long as it can modern ruby.
[22:28:16] dminuoso: Megamos: Generally any linux or unix flavor will do just fine.
[22:29:32] Megamos: dminuoso: Ok, thanks mate. Now lets hope emacs and the other parts gets up n running smoothly to :)
[22:30:44] dminuoso: Megamos: You probably will need to use ruby-install to get a modern Ruby (or rely on third party vendors). But that's really fine. :)
[22:31:00] dminuoso: Not sure what Debian 9 has available.
[22:31:39] Or1on: has joined #RubyOnRails
[22:33:49] Megamos: As I'm learning Java in school, I'm thinking about JRuby. Any idea if this will add a lot more complexity? Never used JRuby and I'm new to Java :) Maybe I should wait? Should be easy to migrate to JRuby later on yes?
[22:40:59] NoGodDamnIdea: has joined #RubyOnRails
[22:43:04] dminuoso: Megamos: It makes no difference really. JRuby has a higher performance ceiling and offers more robust parallel threads, but it comes with high warmup times.
[22:43:53] dminuoso: You can switch later to JRuby if you develop the need.
[22:45:11] Megamos: dminuoso: Thanks, yes feels like the way to go. Use things I know then improve later on when/if needed.
[22:45:51] rikkipitt: has joined #RubyOnRails
[22:48:47] rikkipitt: has joined #RubyOnRails
[23:05:57] alexertech: has joined #RubyOnRails
[23:16:10] lupine: has joined #RubyOnRails
[23:23:48] wethu: has joined #RubyOnRails
[23:24:47] orbyt_: has joined #RubyOnRails
[23:40:02] mtkd: has joined #RubyOnRails