Activity Graph

Page 1 of 1


[01:11:59] martin1_1: has joined #RubyOnRails
[01:13:28] martin1_1: hello all! quite new to the rails world, quick question.. I have a set of models that are related to each other by associations.. A -> has_many B -> has_many C .. how can I access a property on the model C starting from A?
[01:14:00] martin1_1: A.first().bs.cs.some_attribute doesnt seem to work
[01:14:39] martin1_1: I tried using collect as well.. a.collect(&:bs).collect(&:cs).collect(&:some_property)
[01:15:19] martin1_1: but it raises a "has no method some_property" on something that seems to be a proxy of C
[01:19:14] martin1_1: what if it isn't a proof of concept?
[01:19:38] martin1_1: I saw some load_target method around, which as I understood it, it "unproxies" the collection, loading the target model
[01:19:44] martin1_1: but I can't seem to make it work
[01:24:39] martin1_1: \o/ flat_map did it! thanks Radar
[02:32:16] martin1_1: one more question.. this time about error handling: where do you usualy define your custom errors? do you create a PORO and define all of them there? what's the good practice in that subject?
[06:10:27] martin1_1: Ping timeout: 240 seconds