#RubyOnRails - 19 December 2018
« Back 1 day Forward 1 day »
[07:46:54] TvL2386: hey guys, last days I've been searching for a solution to my problem. My rails app connects to an external mysql database to which I have read access. The datetime attributes are written in the local timezone. This messes up rails' assumption that they'd be in UTC.
[08:08:54] Eaven: Hello any regex ninjas on? im creepin up to that 17hr shift with no end in sight and this dumb expression is throwing me for a loop. tomorrow ill probably see the issue instantly but i want to solve tonight. the problem is its grabbing one big match instead of both individual matches http://rubular.com/r/olXapucmfb
[08:28:40] Eaven: [[field.list relationship (spouse|Parent)]]</p><p>[[field.list gender (male|female)]] into this <select id='relationship' name='relationship'><option value='spouse'>spouse</option><option value='Parent'>Parent</option></select></p><p><select id='gender' name='gender'><option value='male'>male</option><option value='female'>female</option></select>
[10:53:01] kidPalooma_: Hello, I came across the need for a class that I can include, as I would a module, but with before/after callbacks before every function. This class would be mainly (but not always) included in controllers. I started writing a module but I'm not happy with hw I would implement this, it doesn't seem clean.
[10:54:32] kidPalooma_: I have 2 questions: 1. is there anything in ruby/rails that matches this pattern that I can use? 2. where should such a class go and how it could be implemented?
[10:55:22] kidPalooma_: *with before/after callbacks before every function ( every function of the module, not of the class where the module is included )
[11:24:26] kidPalooma_: tbuehlmann: I have progressed a bit since I asked the last question. I am trying to make a class that I can include that exposes a number of methods that depend on functions on my app's models. The goal that I am after is to execute a check before every single one of these functions that I am exposing (without rewriting it...). What I am doing now is a class within a module that proxies methods to the module
[18:08:29] kidPalooma: Hello, how do I call a parent module's method from a nested class? example here: https://dpaste.de/svSi
[18:13:43] kidPalooma: I also need the method 'my_method' to stay as is (not like the solution proposed here: https://www.ruby-forum.com/t/calling-ruby-module-methods-from-a-nested-class-within/204596)
[18:38:30] kidPalooma: alternatively, can I access session variables in a simple ruby class? (not a module)
[23:42:25] logik-bomb: so I'm creating a new record with factory bot inside a controller spec. Somehow that record doesn't appear on my scope. If I run the test again the new one is also not there but the previous one now exists. Am I missing something? Do I need to "refresh" my model or something? Thanks