#RubyOnRails - 29 May 2018
« Back 1 day Forward 1 day »
[05:36:46] worknick: sending email with deliver_now works but when deliver_later sends it to delayed_job queue, it executes the job but actual email is not sent.
[06:17:43] syndikate: Check the job code. Check if the mail delivery service is working fine. Check if the Env variables for the same are set properly
[06:33:41] worknick: syndikate, all those are fine, because if i do deliver_now or just deliver then it works
[08:43:18] andywww: was wondering if i could get a bit of steer, i’ve got a feeling i might be reinventing a wheel here somehow
[08:43:34] andywww: i was to use a bastardisation of a strategy pattern to apply rules to the params hash
[08:44:36] sevenseacat: what kind of rules, out of curiosity? params are generally very specific per action
[08:45:14] andywww: this class will be used on multiple apps, each will have different rules to apply so I want to loop through any derivatives of Strategy (incorrectly named i know, but this is for illustration purposes) and apply them
[08:45:56] andywww: the class packages up params and sends them to a stats app so i can track application usage across the suite
[08:46:28] andywww: but i want to apply rules like removing uploads and swapping out sensitive data before sending the packet
[08:47:24] andywww: i’ve had a sniff through some of the GOF patterns and this is the closest i’ve found so far
[08:50:59] tbuehlmann: you want a pipeline with filters, I think. each filter taking input and returning output, which will be the next filter's input
[09:22:54] RougeR: sevenseacat: well. comparing a search for django/node/php/rails. rails has the least by a massive margin on all jobs
[09:23:02] sevenseacat: depending on where you are of course, there were never many entry-level jobs around
[09:24:42] RougeR: yeah, thats a little tricky when i only know rails. im happy to learn and apply for jobs using other frameworks
[09:25:27] sevenseacat: everything youve learned is specific to rails? there's nothing general in there, about ruby or web dev as a whole?
[09:27:11] dionysus69: rails is not really used in my region, massively dominated by php and .net frameworks
[09:29:56] sevenseacat: i'm interviewing for elixir roles atm. who would have thought they would be easier to find out about
[09:30:10] Charliebr73: It took my current employer three rounds of interviews to find a Rails developer, in that case, me.
[09:33:01] Charliebr73: I don't mind. I like learning new things. And now I have the chance to learn AngularJS
[09:34:02] dionysus69: it could, humanity could exhaust this topic soon and think of it as a standardized software
[09:37:28] RougeR: although i was goin to ask in here. does anyone know a way of generating meaningful seed data to perform statistical analysis on
[09:44:14] RougeR: i suspect ill be using nested each loops, random samples and case statements to try add some correlation
[10:23:29] yottanami: for example how can I access current_user from this controller http://dpaste.com/15H7VMW
[10:24:00] yottanami: I also can move these actions to another controller and it is not important for me to be in ApplicationController
[16:41:58] cagomez: in Rspec, how can I test that a class is receiving `@some_var = value` ? I can do this: `expect(obj).to receive(:some_var=).with(value)` but `receive(:@some_var=)` doesn't work
[17:02:35] apeiros: what you can test is whether @some_var has value at some point, or whether an actual setter method has been called.
[17:03:11] apeiros: but assignment itself is not a method call and hence your object is not "receiving" anything.
[17:05:01] eelster: some_var= is a method, @sum_var= is not, so receive(:some_var=) works because that's a method name.
[17:10:43] cagomez: eelster: that makes sense. but doesn't the latter go through https://ruby-doc.org/core-2.5.1/Object.html#method-i-instance_variable_set ?
[17:11:25] cagomez: (ie :@sum_var= is not a method per se, but it can be tested through `instance_variable_set`)
[17:12:07] apeiros: an explicit receiver is required for setter methods. otherwise it's always variable assignment.
[17:12:46] eelster: Wait so when you use something like attr_writer :test it doesn't write the method
[17:12:47] apeiros: i.e. self.somevar= is, or any_expression.somevar= (and honestly, "somevar" is a misnomer there because it's really somemethod=)
[17:13:44] apeiros: there are levels of knowledge where that's in no way an "of course", and I think cagomez is there atm.
[17:14:09] eelster: I wasn't saying use it without a receiver. I was just leaving off the `expect(obj).to` for brevity as the receive method was the only part I was really talking about.
[17:14:59] apeiros: no worries. it's usually fine, but I think sometimes extra pedantry is warranted :D
[20:22:08] GreekFreak: I am having trouble installing ruby 2.0.0-p195 so I wanted to know what is the latest version of ruby that Rails 3.2.18 supports (and yes, I know 3.2 is no longer supported. I'm doing a re-write)
[20:52:50] lupine: (and most crazy kids deploying to cloudy things have that as their principal cost)
[20:57:26] havenwood: lupine: I haven't noticed a large MB per MiB/sec discrepancy between Puma and Unicorn.
[20:58:30] havenwood: lupine: On Techempower, as a random example, Rails Puma and Unicorn seem right on top of each other, given the same resources: https://www.techempower.com/benchmarks/previews/round16/#section=data-r16&hw=ph&test=json
[21:01:24] havenwood: Speaking of Unicorn, I saw Jeremy Evan's repo unicorn-lockdown - which looks like a really neat way to run Unicorn on OpenBSD: https://github.com/jeremyevans/unicorn-lockdown
[21:07:43] cagomez: if `passport` belongs to `student`, and I do `Passport.create(student: my_student)`, is it expected that `my_student` will have it's `passport` association loaded?
[21:16:52] lupine: in unicorn-alikes, each request occupies a process (~300-600MiB) for the time it takes to run. in puma-alikes, it does not
[21:22:42] acovrig: lupine: I’ve used actioncable and like it, but an app dev can’t use actioncable (as far as i know), do you know of any way to use socket.io or websockets in rails (or, mostly of of scope of this channel - a js client that works with actioncable)
[21:23:55] acovrig: true, but does actioncable produce raw websickets? He is able to see the pings and a welcome message, but nothing in any cables
[21:24:23] acovrig: and I’d rather not boradcast private data to any websocket-connected deivce for snooping
[21:41:25] dionysus69: are there no plans to implement a shorter version of this? Rails.application.credentials
[22:15:10] havenwood: lupine: The TechEmpower benchmarks I linked are showing RPS for each with a fixed amount of RAM. What I'm saying is that the throughput per megabyte is roughly equivalent.
[22:17:57] lupine: I can't view the benchmarks, so can't comment directly on the methodology. if they've found a way to make unicorn be more ram-efficient than it generally is, that's all good though
[22:29:54] jstrong: I’m having an issue whereby my loaded Rails engine models are not available when I run rspec.
[22:35:53] havenwood: lupine: In the benchmark Unicorn and Puma both autotune to match RAM: https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Ruby/rails/config/unicorn.rb
[22:36:36] lupine: what I'm saying is that handling 2 concurrent requests will take twice as much ram with unicorn vs. puma
[22:37:33] havenwood: lupine: What I'm saying, is that with multiprocess machines, both tuned, they get about the same number of requests per second with the same amount of RAM.
[22:38:10] lupine: which rather matters since peak concurrency determines how much it's going to cost to run the thing
[22:42:47] havenwood: I keep hearing buzz about Iodine lately (maybe mostly from the author, but still): https://github.com/boazsegev/iodine
[22:43:33] lupine: I mostly deal with giant ruby processes that actually can't cope without being restarted every minute or so