#RubyOnRails - 08 November 2018
« Back 1 day Forward 1 day »
[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: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:18:22] hightower2: martin1_1, if you just want to get anything working as a proof of concept, then A.first.bs.first.cs.first.some_attribute
[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:21:25] hightower2: Do you want to find particular Bs and Cs, or you want to start from A and get all Bs and all Cs and some_attribute() on them?
[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?
[18:35:08] mlt-: How do I prevent JSONB database type casting into Hash? I thought "attribute attr, ActiveRecord::Type::String.new" added to my Model will do, but it won't. Rails 5.2.1
[19:14:23] greengriminal: Hey all quick question I'm trying to run: Rake::Task['db:schema:load'] and I'm getting: `untimeError: Don't know how to build task 'db:schema:load'`
[19:14:51] greengriminal: Better yet even when I try: `Rake::Task['db:migrate']` I get the same error.
[19:16:22] cnk: what is the context for `Rake::Task['db:migrate']`? Rake is a command so more normal would be, from the command line: `rake db:migrate`
[19:17:45] greengriminal: For those who want to run a rake task from the rails console you need to run: `Rails.application.load_tasks` and then `Rake::Task['db:schema:load']` will load
[19:24:47] cjohnson: When request.path = '/foo/bar/baz', is there a better way to get "foo" than request.path.split('/') ?
[19:35:32] Karunamon: Heya folks. Having a really hard time googling this: When doing before/after callbacks on a model using 'has_and_belongs_to_many', which model gets passed into the function you define? The one you're defining the function in, or the one on the other side of that relation?
[19:42:11] andywww: ive been watching a few youtube vids recently that have been extremely critical of apple hardware and whilst ive always been fairly hardware agnostic, i do like apples laptops for the form factor, retina screens and the simplicity of os x/brew for setting up the ruby environment
[19:42:41] andywww: i’d be curious to hear what you guys run and if not you think a non apple device with linux is a viable alternative for dev work?
[19:56:06] dachi: I have 'More space' set in retina display configuration, and I got used to 13-inch, it's not that bad after few months