#RubyOnRails - 06 October 2018
« Back 1 day Forward 1 day »
[03:47:17] rodd: anyone using traefik + docker + puma care to share your container labels in docker-compose?
[08:35:02] ariejan: Hi. I'm trying to understand how a rendered view fetches instance variables (in the code). I've found `view_assigns` and I see how those assigns get loaded up in `@_assigns` in ActionView::Base, but I can't seem to locate the place where you get that data out - and what happens when a variable is not there. Note: I'm trying to find the code where this happens in Rails - I know how it all works :-)
[13:39:52] mjacob: context: i want to test a helper class which can be used to define an attribute with certain properties. my first idea was to create an ad-hoc record subclass for testing. however this turned out to be too complicated because this subclass isn't contained in the database schema. i thought that testing an activemodel instead of an activerecord may be a better idea
[13:56:49] tbuehlmann: mjacob: activemodel and activerecord are different things, so you probably shouldn't mock an activerecord class with an activemodel class, right?
[13:57:34] mjacob: tbuehlmann: the helper is in a module, so in theory it could be included by both models and records
[13:58:26] mjacob: tbuehlmann: i'm basically doing what was proposed in the top answer of https://stackoverflow.com/questions/35373590/how-can-i-test-methods-in-the-applicationrecord-abstract-base-class
[14:27:47] mjacob: tbuehlmann: this would work because the 'attribute' class method is missing: http://dpaste.com/0M6V5E5
[14:37:53] tbuehlmann: I mean, you could also just test whether the `attribute` method called as expected, not doing it really
[21:57:44] skangas: How do I specify a belongs_to relation with ":optional => true" but also that *if it is specified* it has to be unique. As it is, I have both constraints enabled (optional and unique) but that means only one entry can be empty...