#RubyOnRails - 21 October 2018
« Back 1 day Forward 1 day »
[01:53:57] cxl: I haven't done Ruby in a while, and I can't understand why Foo.new_token works but not self.new_token in this snippet: https://dpaste.de/33c9
[04:16:36] zorp: I'm currently doing redirect_to(subdomain: @user.name, controller: 'users', action: 'show') and it works but I think it should be simpler
[04:16:43] zorp: hi, I want "redirect to @user" after sign up to redirect to a subdomain that's the username, how can I set up my route so this works?
[14:22:56] i8igmac: is there a controller generate for a form post request. that will configure routes and create example view.erb.html
[14:25:14] i8igmac: i guess its not to difficult to create a basic form post request. but for the sake of speed.
[15:53:42] dcope: anyone in here developing in docker? i can't figure out if the slow rails server is isolated to my setup or if that's just how it is.
[18:18:39] nickjj: dcope, i am with docker for windows and it's nearly as fast as native linux for typical rails app dev
[18:19:39] nickjj: rails picks up file changes in about 100ms and webpack compiles 100kb+ of CSS in about 3 seconds -- on a 5 year old workstation
[20:22:39] walidvb: i'm trying to understand how i can have a model validate its associations, or smth about them
[20:23:31] walidvb: concrete example: i have works, that have participations(which have attr percentage). I want to validate the fact that the total of their participations.percentage == 100
[20:24:49] walidvb: i have accepts_nested_association on Work, and a validation on check_sum_of_participations. Problem is, i think, that when i create the work and do the check, the participations don't exist yet, so it doesn't compute the shares yet
[21:28:57] Radar: hd1: your erb template isn't being loaded because you have a before_action that is blocking it, or your controller is directed to render a different template, or a third possibility: the controller redirects.
[21:29:36] Radar: Oh I have another idea actually: your expected template is a part of a Rails engine but your application overrides the template at the same path.
[22:26:34] Vashy: hd1, I guess I'm not entirely sure myself, so here's the situation: I created a rails app, created some models/views/controllers, then decided to try building a react front end but idk how to interact with the app?
[22:26:55] Vashy: some tutorials I looked up created a brand new rails api app for the tutorial using: 'rails new --api ...'
[22:30:08] Vashy: hd1, do you have some material you can point to that I can read to better understand how to use an existing rails app as an api?
[22:58:12] i8igmac: havenwood: is there a method for running system commands from rails that you might suggest
[22:59:48] i8igmac: i was thinking about creating a daemon.rb that would listen for a list of commands for a multi threaded or multiprocess design
[23:00:56] havenwood: i8igmac: Say more about the commands you're running. Do you need them to just do something in the background? Does anything need to happen when they finish?
[23:02:42] i8igmac: the server becomes unresponsive when a time consuming command is running in a rails thread.