« Back to channel list

#RubyOnRails - 14 December 2017

« Back 1 day Forward 1 day »
[00:13:24] _aeris_: has joined #RubyOnRails
[00:26:11] funburn: has joined #RubyOnRails
[00:27:22] cagomez: has joined #RubyOnRails
[00:28:10] funburn: something strange started happening on my new rails 5 project. Every time I run any binstub, it seems to run yarn and bundler first. this makes tests and restarting the rails s (on development) really slow. why is this? https://gist.github.com/mtuckerb/657ce69b277074b4d788325dee0bc0d8
[00:28:31] hahuang65: has joined #RubyOnRails
[00:34:05] SteenJobs: has joined #RubyOnRails
[00:42:38] xavrix: has joined #RubyOnRails
[00:51:13] Technodrome: has joined #RubyOnRails
[00:55:29] ResidentBiscuit: has joined #RubyOnRails
[01:03:20] _ritchie__: has joined #RubyOnRails
[01:04:54] alfiemax: has joined #RubyOnRails
[01:23:03] sandstrom: has joined #RubyOnRails
[01:24:46] amperry: has joined #RubyOnRails
[01:29:10] ResidentBiscuit: has joined #RubyOnRails
[01:36:01] amperry: hey folks, using FactoryBot, when you create factory that 'belongs_to' another model, what is the syntax to assign it to another factory? E.g., I have a model AptType that belongs_to Property, a 'factory :nowhereland, class: Property', and a 'factory :studio, class: AptType' that should belong to it. But I don't understand how to set up the association in the factory.
[01:36:24] amperry: I thought it was 'association :nowhereland, class: Property', but that didn't work.
[01:40:19] meesles: Same place you set the attributes!
[01:40:40] meesles: property: { create(:apttype, :etc, :etc }
[01:40:52] meesles: Well, create Property, but you get what I mean
[01:41:06] meesles: That's one way to have it create the associations automatically
[01:41:18] meesles: Or else you can instantiate one, and then just pass it in as an attribute to the create call
[01:41:23] amperry: maybe I'm trying to do the wrong thing. You can do this in the factories.rb file itself?
[01:41:44] meesles: There's multiple ways
[01:42:13] meesles: Read this: https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations
[01:42:29] amperry: that's what I'm working through, and not understanding.
[01:43:44] meesles: Second code chunk, factory :apt type, association :property, factory: :whatever, etc
[01:44:07] meesles: Dunno what you don't understand after that
[01:48:09] amperry: it's the fact that they start with user, alias it to author, and do some other chicanery that's tricking me. I would have expected the simplest example to be 'association :user'. And I still don't understand what that first block means, the one that just has 'author' in it. Is that supposed to mean if you put the name of the association on a blank line, it finds the factory (assuming the factory is the name of the belonged_to model)?
[01:48:52] amperry: I did change the line, however, and got the test working, so thanks for that.
[01:53:07] orbyt_: has joined #RubyOnRails
[01:56:47] twilling: has joined #RubyOnRails
[02:00:05] Technodrome: has joined #RubyOnRails
[02:22:58] orbyt_: has joined #RubyOnRails
[02:24:13] _aeris_: has joined #RubyOnRails
[02:26:29] ornerymoose: has joined #RubyOnRails
[02:36:17] orbyt_: has joined #RubyOnRails
[02:36:17] mtkd: has joined #RubyOnRails
[02:36:17] quazimodo: has joined #RubyOnRails
[02:36:17] boxmein: has joined #RubyOnRails
[02:36:17] AlHafoudh: has joined #RubyOnRails
[02:36:17] kies: has joined #RubyOnRails
[02:36:17] Gizmokid2005: has joined #RubyOnRails
[02:36:17] Barrt: has joined #RubyOnRails
[02:36:17] atrius: has joined #RubyOnRails
[02:36:17] duderonomy: has joined #RubyOnRails
[02:36:17] shtirlic: has joined #RubyOnRails
[02:36:17] yehowyada: has joined #RubyOnRails
[02:36:17] AntiSpamMeta: has joined #RubyOnRails
[02:36:17] meesles: has joined #RubyOnRails
[02:36:17] w0rd-driven: has joined #RubyOnRails
[02:36:25] TessaM: has joined #RubyOnRails
[02:48:36] Saukk: has joined #RubyOnRails
[02:49:48] Technodrome: has joined #RubyOnRails
[02:56:42] alfiemax: has joined #RubyOnRails
[03:09:00] funburn: has joined #RubyOnRails
[03:25:15] one_zero: has joined #RubyOnRails
[03:35:17] ebsen: has joined #RubyOnRails
[03:44:38] DTZUZO: has joined #RubyOnRails
[04:37:00] Technodrome: has joined #RubyOnRails
[04:44:46] kapil___: has joined #RubyOnRails
[05:02:40] epochwolf: has joined #RubyOnRails
[05:14:00] borodin: has joined #RubyOnRails
[05:18:49] srinidhi: has joined #RubyOnRails
[05:18:52] lupine: has joined #RubyOnRails
[05:33:12] hammer065: has joined #RubyOnRails
[05:44:01] drale2k_: has joined #RubyOnRails
[05:50:40] ur5us: has joined #RubyOnRails
[05:51:27] kies: has joined #RubyOnRails
[05:52:27] iamarun: has joined #RubyOnRails
[06:05:28] haydenbetts: has joined #RubyOnRails
[06:10:14] Dykam: has joined #RubyOnRails
[06:17:15] Exhiled: has joined #RubyOnRails
[06:23:17] mtkd: has joined #RubyOnRails
[06:28:23] wethu: has joined #RubyOnRails
[06:28:54] KeyJoo: has joined #RubyOnRails
[06:43:14] moei: has joined #RubyOnRails
[06:48:28] Exhiled: has joined #RubyOnRails
[06:49:00] alfiemax_: has joined #RubyOnRails
[06:55:46] AzaToth: has joined #RubyOnRails
[06:57:26] Tempesta: has joined #RubyOnRails
[06:59:29] Tempesta: has joined #RubyOnRails
[07:01:51] cjohnson: baweaver: Stupid .update not blowing up on errors
[07:02:09] cjohnson: .update! behaves sanely and showed me the problem
[07:02:10] baweaver: ACTION snickers
[07:02:27] baweaver: Also use bang on create
[07:02:43] baweaver: create!, find_by! are both handy
[07:05:59] baweaver: class StandardError; def holy_crap!; ::Rails.logger.danger(message) end; end; ... rescue => e; e.holy_crap!
[07:06:15] baweaver: pwnd_nsfw :D
[07:06:57] baweaver: class StandardError; def wat?; ::Rails.logger.warn(message) end; end; ... rescue => e; e.wat?
[07:08:02] baweaver: class Object; def yey!; ::Rails.logger.info(to_s) end; end; Model.save.yey!
[07:08:44] baweaver: Hrm, should proooobably return self from that
[07:08:45] baweaver: cjohnson: pro Rails
[07:09:49] baweaver: cjohnson: though if you want something useful.... `all`
[07:10:43] baweaver: Model.all vs Model.where(a: b).all vs Model.where(a: b).all.where(c: d)
[07:10:44] baweaver: all is a no-op
[07:10:58] sevenseacat: has joined #RubyOnRails
[07:11:53] baweaver: meaning you can do this in scope methods: def self.with_attr(opts={}) opts[:if] ? where(attr:opts[:if]) : all; end; Model.with_attr(if: params[:attr])
[07:21:11] cjohnson: oh interesting
[07:23:36] baweaver: Also modules are useful for mixing in common scopes for your models
[07:31:03] ksinkar: has joined #RubyOnRails
[07:31:48] ksinkar: Hello guys has anyone used stubbing extensively here with rspec? I am trying to create a stub a method onto my object that takes parameters and I do not know how to do that. I only how to stub methods onto objects.
[07:34:43] apeiros: has joined #RubyOnRails
[07:36:27] srinidhi: has joined #RubyOnRails
[07:39:56] dionysus69: has joined #RubyOnRails
[07:45:51] conta: has joined #RubyOnRails
[07:51:24] ur5us: has joined #RubyOnRails
[07:53:17] arBmind: has joined #RubyOnRails
[08:05:27] sandstrom: has joined #RubyOnRails
[08:21:03] DTZUZO: has joined #RubyOnRails
[08:28:46] Puffball: has joined #RubyOnRails
[08:30:37] loveablelobster: has joined #RubyOnRails
[08:30:51] loveablelobster: has left #RubyOnRails: ()
[08:42:28] Dimik: has joined #RubyOnRails
[08:45:12] AkyRhO: has joined #RubyOnRails
[08:46:30] defsdoor: has joined #RubyOnRails
[08:55:18] srinidhi: has joined #RubyOnRails
[08:56:29] xMopxShell: has joined #RubyOnRails
[08:57:33] srinidhi: has joined #RubyOnRails
[09:03:38] mikecmpbll: has joined #RubyOnRails
[09:08:15] ur5us: has joined #RubyOnRails
[09:17:53] defsdoor: has joined #RubyOnRails
[09:46:01] Torrone: has joined #RubyOnRails
[09:46:35] sandstrom: has joined #RubyOnRails
[09:50:30] Torrone: Hello, I'm working on a medium-size application that doesn't have any tests. My initial goal is to check that all my views work. Is there any tool that helps me generate tests for my app?
[09:51:45] marahin: has joined #RubyOnRails
[09:55:30] quazimodo: has joined #RubyOnRails
[10:00:11] marr: has joined #RubyOnRails
[10:03:37] loveablelobster: has joined #RubyOnRails
[10:04:48] Cavallari: has joined #RubyOnRails
[10:09:15] andrew9184: has joined #RubyOnRails
[10:09:58] kapil___: has joined #RubyOnRails
[10:13:04] simmerz: has joined #RubyOnRails
[10:15:51] _ritchie_: has joined #RubyOnRails
[10:24:56] p8m: has joined #RubyOnRails
[10:30:45] arBmind: has joined #RubyOnRails
[10:38:10] jnollette: has joined #RubyOnRails
[10:42:32] Ryzokuken: has joined #RubyOnRails
[10:42:37] Ryzokuken: hey everyone!
[10:43:21] Ryzokuken: I am using CI::Reporter to generate reports of my tests so that I can post those back in a PR if something goes off.
[10:44:10] Ryzokuken: I have been trying to uses ruby-prof for testing performance, but it is having issues with the Reporter
[10:45:16] Ryzokuken: The reporter is probably unable to parse it's results, and I'm kinda stuck.
[10:45:21] Ryzokuken: Could anyone please help??
[10:47:18] drale2k_: has joined #RubyOnRails
[10:52:17] loveablelobster: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[10:59:05] Sigyn: has joined #RubyOnRails
[11:02:54] Sigyn: has joined #RubyOnRails
[11:04:02] Ergo: has joined #RubyOnRails
[11:07:47] workmad3_: has joined #RubyOnRails
[11:07:58] peterhil`: has joined #RubyOnRails
[11:08:39] marr: has joined #RubyOnRails
[11:13:39] DTZUZO: has joined #RubyOnRails
[11:15:18] funburn: has joined #RubyOnRails
[11:24:39] KeyJoo: has joined #RubyOnRails
[11:25:23] mtkd: has joined #RubyOnRails
[11:33:11] workmad3: has joined #RubyOnRails
[11:37:28] apparition: has joined #RubyOnRails
[11:52:10] fschuindt: has joined #RubyOnRails
[12:01:50] simmerz: has joined #RubyOnRails
[12:02:50] one_zero: has joined #RubyOnRails
[12:05:51] the_collective_: has joined #RubyOnRails
[12:07:13] the_collective_: Are there any circumstances in which a .create should save a record where .new and .save wouldn't because of validations? I think I have a case where .create is skipping a validation but .new and .save aren't.
[12:10:55] funburn: has joined #RubyOnRails
[12:19:30] _aeris_: has joined #RubyOnRails
[12:19:47] the_collective_: https://pastebin.com/y1fW6567 - I make an object with a unique constraint using create. There are no objects already so it creates. I create a new one. It should not create according to the validation, but it does. Count of objects is now 2, however second one returns false for .valid? Both rows are in the database. I try again using .new and .save and it won't create. This happens consistently. What am I missing
[12:21:48] the_collective_: If I use .create! instead of .create it does create an exception
[12:32:15] truenito: has joined #RubyOnRails
[12:39:26] loveablelobster: has joined #RubyOnRails
[12:41:53] drowze: has joined #RubyOnRails
[12:42:31] jnollette: has joined #RubyOnRails
[12:43:00] DrYockel: has joined #RubyOnRails
[12:46:10] kapil___: I am using rails api for backend.
[12:46:20] kapil___: Where should I generate it? Backend or front end?
[13:02:34] loveablelobster: has joined #RubyOnRails
[13:23:03] the_collective_: I've also checked it with validating on IDs instead of objects. Same thing occurs. This is clearly a bug in Rails. Well I think so anyway.
[13:24:36] the_collective_: Can anyone thing of anything else to try to pin down where the bug is?
[13:24:41] simmerz: has joined #RubyOnRails
[13:24:45] ornerymoose: has joined #RubyOnRails
[13:30:06] mtkd: has joined #RubyOnRails
[13:31:24] pwnd_nsfw: ACTION shrugs.
[13:31:36] pwnd_nsfw: the_collective_, use http://gist.github.com It's for winners
[13:31:54] loveablelobster: has joined #RubyOnRails
[13:32:53] the_collective_: is pastebin deprecated these days?
[13:35:06] the_collective_: better now: https://gist.github.com/anonymous/1247e018264607bf95e0e03b68ca2e77 ?
[13:37:50] pwnd_nsfw: the_collective_, when you check valid?, remember that it is persisted and now has an id
[13:38:06] pwnd_nsfw: Or, I'm really tired
[13:38:17] pwnd_nsfw: but the fact that the record is persisted might mess with it's ability to be valid
[13:38:33] the_collective_: yeah, I'm just not sure why it's made it to being a record at all
[13:38:49] the_collective_: .new and .save leads to a ROLLBACK. .create doesn't
[13:39:03] the_collective_: from my reading of docs, this shouldn't be possible
[13:39:42] pwnd_nsfw: What happens if you use build instead of new?
[13:40:38] the_collective_: this also works the same as with new
[13:42:03] the_collective_: one other data point: @user.subscriptions.create(product: product, plan: plan) is different to Subscription.create(user: user, product: product, plan: plan).
[13:42:12] jokke: has joined #RubyOnRails
[13:42:27] the_collective_: the latter has the desired effect and causes the record to not save owing to failed validation
[13:42:27] jokke: is it possible to have multiple names for a single route?
[13:42:28] pwnd_nsfw: when does the uuid show up?
[13:42:38] pwnd_nsfw: probably after create
[13:42:38] jokke: (the root)
[13:42:59] pwnd_nsfw: jokke, multiple routes for a single action?
[13:43:01] jokke: something like as: [:root, :homepage]
[13:43:19] jokke: same route
[13:43:24] the_collective_: pwnd_nsfw, uuid is generated before_validation
[13:43:26] jokke: just multiple names
[13:43:45] jokke: in my case it would provide root_url and homepage_url methods for example
[13:43:51] pwnd_nsfw: oh duh, it's right there
[13:44:04] pwnd_nsfw: jokke, do it on multiple line
[13:44:18] pwnd_nsfw: so, same route, with different as
[13:44:29] pwnd_nsfw: OR, if you want to keep it single line
[13:44:36] pwnd_nsfw: [:root, :homepage].each { butts }
[13:45:36] pwnd_nsfw: the_collective_, I'm sure it's staring right at us
[13:46:38] the_collective_: pwnd_nsfw, I think you're onto something. If I stop it generating a uuid before validation then create and new are the same
[13:46:52] pwnd_nsfw: Interesting
[13:47:13] pwnd_nsfw: Yano, that was an accident mentioning that. I didn't see the before_save before I had asked you
[13:47:26] Saukk: has joined #RubyOnRails
[13:47:30] pwnd_nsfw: on: :create anyways
[13:47:57] pwnd_nsfw: Is that even a thing.. idk, I've had 2 hrs of sleep in like... 48 hrs
[13:48:12] pwnd_nsfw: the_collective_, do lemme know if adding save works
[13:49:45] the_collective_: pwnd_nsfw, if I remove the on => :create and don't generate a uuid at all, it still creates when it shouldn't
[13:50:08] _aeris_: has joined #RubyOnRails
[13:50:15] the_collective_: but if I remove the before_validation then it all works correctly
[13:50:42] the_collective_: so it's some kind of interaction between a before_validation and the validation.
[13:51:00] the_collective_: the object itself has errors immediately after creation, but they didn't stop it getting created
[13:52:17] loveablelobster: has joined #RubyOnRails
[13:53:03] the_collective_: pwnd_nsfw, ok, I think I've narrowed it down more. generate_uuid is using update_attribute, whereas if I just set uuid=random_string then it fails
[13:53:25] the_collective_: fails as in, it doesn't get created
[13:53:46] the_collective_: so the problem seems to be where a before_validation method writes to the record
[13:53:52] the_collective_: which makes total sense :)
[13:53:59] the_collective_: because rails must be creating a record
[13:54:57] the_collective_: bit of a gotcha there mind
[13:59:06] ornerymoose: has joined #RubyOnRails
[14:02:57] GodFather: has joined #RubyOnRails
[14:04:11] jokke: pwnd_nsfw: yup worked like a charm
[14:04:19] drowze: I love rals
[14:04:32] drowze: it just got me a job overseas. Hell yeah!
[14:06:00] drowze: will be working on a new rails 5 project, with lots of sidekiq, complex frontend and I am not sure exactly what else, but it will be fun I'm sure
[14:06:12] drowze: wahhh I did not even finish university yet
[14:06:17] drowze: welp, Uni can wait
[14:08:36] mikecmpbll: what country?
[14:09:05] ur5us: has joined #RubyOnRails
[14:10:02] drowze: I am from Brazil
[14:11:49] mostlybadfly: has joined #RubyOnRails
[14:11:51] mikecmpbll: ah :) fun times.
[14:12:07] drowze: It'll be awesome indeed!
[14:12:36] drowze: Will try my best to be at the ruby meetups in ireland
[14:12:47] drowze: confs in europe would be also great
[14:13:07] drowze: oh my... hell yeah Ruby
[14:13:18] solars: has joined #RubyOnRails
[14:17:29] solars: quick question: when using find_each, rails automatically orders on the primary key. If I have custom query that uses group however, I cannot use the primary key but need to use it in an aggregate function like max(table.id) in Postgres. The problem is that find_each does not let me specify a custom order column, does anyone know a workaround for this?
[14:20:48] funburn: has joined #RubyOnRails
[14:30:57] safetypin: has joined #RubyOnRails
[14:31:39] borodin: trying to understand an error in nested resources in rails5 API: https://gist.github.com/chewmanfoo/eb78b5e13b8250ac3b9478a11de2264b
[14:32:12] borodin: I'm not clear if the controller method cf_deployment_params is correct, and if so, why do I have the error?
[14:32:17] borodin: can anyone help?
[14:36:22] funburn: has joined #RubyOnRails
[14:44:10] pwnd_nsfw: solars, https://nambrot.com/posts/9-find_each-with-custom-ordering-in-rails/ dat google
[14:44:25] pwnd_nsfw: https://github.com/nambrot/ar-find-in-batches-with-order
[14:44:37] pwnd_nsfw: Hasn't been touched in 4 years, but may give you a direciton ofc
[14:45:17] pwnd_nsfw: borodin, what does the model look like?
[14:45:31] pwnd_nsfw: For CfDeployment
[14:46:59] pwnd_nsfw: solars, there's a reason why they use the primary though
[14:49:12] solars: pwnd_nsfw: yes, I'm still using the PK, however, if I aggregate I need to have it in a pseudo aggregation in PG as well
[14:49:53] funburn: has joined #RubyOnRails
[14:52:11] p8m: has joined #RubyOnRails
[14:54:16] okraits: has joined #RubyOnRails
[15:01:07] borodin: pwnd_nsfw: CfDeployment has belongs_to: cf_template
[15:01:53] borodin: CfTemplate has has_many :cf_deployments, dependent: :destroy
[15:03:57] pwnd_nsfw: I love how people just.. hold back on all of the code they can
[15:04:14] pwnd_nsfw: Since that'd be the most efficient way of receiving help *shrugs*
[15:04:33] borodin: no sorry I can give it all - trying to make it easier for *you*
[15:04:36] Dimik: has joined #RubyOnRails
[15:05:06] pwnd_nsfw: Nah nah, easier would be to just supply what is requested :P
[15:05:15] pwnd_nsfw: borodin, maybe even the database schema
[15:05:33] quazimodo: has joined #RubyOnRails
[15:07:19] borodin: https://gist.github.com/chewmanfoo/e0fd89674902ac24484b9dff7b35df4d
[15:07:25] borodin: including schema.rb
[15:09:21] pwnd_nsfw: Errr, correct me if I'm wrong, but {} isn't for multiline. That's what do end is for
[15:10:00] pwnd_nsfw: ActiveModel::UnknownAttributeError (unknown attribute 'cf_deployment' for CfDeployment.):
[15:10:03] pwnd_nsfw: Should point at you too
[15:10:55] borodin: are you suggesting the before_save blocks aren't working?
[15:11:09] pwnd_nsfw: Probably, since the syntax is totally wrong
[15:11:21] borodin: they are working
[15:11:49] pwnd_nsfw: Oh, it's just conventions
[15:12:14] borodin: but that unknown attribute error is puzzling
[15:13:44] pwnd_nsfw: Would you be able to put the whole project on github?
[15:13:51] pwnd_nsfw: if not, can I see cf_templates controller?
[15:15:42] borodin: https://gist.github.com/chewmanfoo/d4c90606c0659d647a0c94bf8f1877b9
[15:15:48] borodin: cf_templates_controller
[15:15:54] borodin: thanks for your help so far
[15:17:46] pwnd_nsfw: in your update
[15:17:53] pwnd_nsfw: you're updating a cf_deployment
[15:18:10] pwnd_nsfw: but your params are looking for a cf_deployment.cf_deployment
[15:18:53] borodin: do you get that from the method cf_deployment_params?
[15:19:06] borodin: 'your params are looking for...'
[15:19:37] pwnd_nsfw: look at what you're permitting
[15:19:59] borodin: look at the params that are comingin: https://gist.github.com/chewmanfoo/eb78b5e13b8250ac3b9478a11de2264b
[15:20:02] pwnd_nsfw: You're permitting the updating of cf_deployment on a cl_deployment record
[15:20:16] borodin: in the middle
[15:20:28] pwnd_nsfw: You're furthering my point
[15:20:47] pwnd_nsfw: Your CfDeployment model doesn't have a CfDeployment attribute
[15:20:47] borodin: Parameters: {"env"=>"cit_certification", "cf_template_id"=>"1", "cf_deployment"=>{"env"=>"cit_certification"}}
[15:21:07] borodin: yeah it doesn't mke sense
[15:21:09] pwnd_nsfw: Perhaps you meant to be updating a cf_template
[15:21:16] borodin: it's nested
[15:21:28] borodin: you're updating (creating) a cf_deployment via a cf_template
[15:21:31] pwnd_nsfw: You're not listening to me
[15:21:37] pwnd_nsfw: your update method
[15:22:06] pwnd_nsfw: Just... your params are wrong
[15:22:39] borodin: it makes sense to me that the cf_template is receiving parameters for a nested cf_deployment
[15:23:07] borodin: or that a cf_deployment is receiving parameters for a cf_deployment, but through cf_templates in a weird way
[15:23:16] borodin: the nested thing is breaking my brain
[15:23:25] pwnd_nsfw: yeah, the template
[15:23:31] pwnd_nsfw: but you're not updating the template
[15:23:36] pwnd_nsfw: You're updating a deployment
[15:24:29] uksio: has joined #RubyOnRails
[15:24:42] pwnd_nsfw: Understand what I'm getting at?
[15:25:16] borodin: look at the Parameters the server is getting
[15:25:27] borodin: see how it has a cf_deployment within them?
[15:25:28] pwnd_nsfw: Listen to me
[15:25:51] pwnd_nsfw: The params for deployment should not be nested in that
[15:26:00] borodin: you don't understand nesting?
[15:26:08] pwnd_nsfw: You don't understand da fuck I'm telling you
[15:26:08] borodin: have you never used nesting before?
[15:26:35] pwnd_nsfw: I'm literally laying the problem out in front of you, clear as day
[15:26:41] pwnd_nsfw: Ok, one sec
[15:26:42] borodin: you really havent said anything yet
[15:26:44] pwnd_nsfw: Let me write it ou
[15:26:52] pwnd_nsfw: With that comment, I might as well not waste my time...
[15:27:16] pwnd_nsfw: This is going to click when I spell it out for you
[15:27:21] pwnd_nsfw: and you're going to shit your pants. Give me one moment.
[15:27:46] borodin: good good Im happy to have your help
[15:28:28] apeiros: has joined #RubyOnRails
[15:32:07] pwnd_nsfw: borodin, before I link you to the most basic explanation I can give you... What do you think nested attributes are?
[15:32:28] borodin: they're just a routing method as far as I understand it
[15:32:39] pwnd_nsfw: A... a what?
[15:32:49] pwnd_nsfw: Like, what does it achieve
[15:33:00] borodin: the deployments and the templates are still just entities - they are still just related by their AR relationships
[15:33:34] borodin: it makes sure that you can not create a deployment unless you already have a template
[15:33:42] borodin: you create a deployment *through* a template
[15:33:48] pwnd_nsfw: It allows you to play with the attributes of an associated model, right?
[15:34:01] borodin: not sure about that
[15:34:27] borodin: @cf_template.cf_deployments.first.whatever
[15:34:42] borodin: allows you to "play with the attributes of an associated model"
[15:34:51] borodin: doesn't have anything to do with nesting
[15:34:54] borodin: nesting is for routing
[15:34:56] pwnd_nsfw: Why are you doing @cf_deployment.cf_deployment?
[15:35:06] borodin: it's wrong I know lol
[15:35:14] pwnd_nsfw: So, do you see the problem yet?
[15:35:20] pwnd_nsfw: Do you see why that code is wrong?
[15:36:01] borodin: the Parameters coming in seem to indicate that a cf_deployment contains a cf_deployment
[15:36:06] borodin: that is what is confusing me
[15:36:14] pwnd_nsfw: That's because......
[15:36:16] borodin: Parameters: {"env"=>"cit_certification", "cf_template_id"=>"1", "cf_deployment"=>{"env"=>"cit_certification"}}
[15:36:19] pwnd_nsfw: It's what you're doing...............
[15:36:34] borodin: are you saying the permit method is *creating* that parms hash?
[15:36:36] pwnd_nsfw: That's the code you've written
[15:36:53] borodin: why the hell...?
[15:37:00] pwnd_nsfw: Yeah, tell me about it
[15:37:18] borodin: I always thought that the Parameters in the log were the actual parameters recieved by the http POST
[15:37:25] pwnd_nsfw: Yeah no shit
[15:37:30] pwnd_nsfw: You still don't understand me
[15:37:57] pwnd_nsfw: I'm pretty sure you want that to be cf_template_params...
[15:38:10] pwnd_nsfw: But then you still have a little work to do
[15:38:13] pwnd_nsfw: You've mixed them up
[15:40:05] borodin: I think I undertsand now
[15:40:11] pwnd_nsfw: https://gist.github.com/SirUncleCid/abd6442a26a0915475c5e81fc633bae9
[15:40:15] borodin: within the controller there is no nesting at all
[15:40:46] borodin: within the controller you just deal with a cf_deployment
[15:40:50] borodin: ignore the cf_template
[15:40:54] borodin: thanks for your help!
[15:40:58] pwnd_nsfw: No, you've confused cf_template and cf_deployments somewhere along the way and just kept coding
[15:41:09] pwnd_nsfw: but whatever man, like.. do your thing
[15:41:17] borodin: what do you mean no?
[15:41:41] pwnd_nsfw: I mean I think you're trolling... like, that's how bad you misunderstanding me is
[15:42:30] pwnd_nsfw: Like, I'm not sure how you've made it this far
[15:42:40] pwnd_nsfw: Without being able to understand this particular concept.
[15:43:28] borodin: nested routing: http://guides.rubyonrails.org/routing.html
[15:43:31] borodin: look at 2.7
[15:43:38] borodin: that's what I'm trying to do
[15:43:52] pwnd_nsfw: It literally cannot be explained any further
[15:43:58] pwnd_nsfw: Without me writing the code for you entirely
[15:44:28] borodin: ok thanks for trying
[15:44:35] borodin: I guess I'll go clean toilets now
[15:45:19] ams__: has joined #RubyOnRails
[15:48:33] pwnd_nsfw: Something makes me think you'll be cleaning them with a shovel
[15:49:17] pwnd_nsfw: borodin, can you upload the whole project to github so I can get you started in the right direction
[15:49:35] pwnd_nsfw: maybe seeing the code and what I've changed will make it click
[15:49:46] borodin: I fixed it
[15:49:51] borodin: why did you frreak out so much?
[15:49:54] borodin: get some coffee
[15:50:09] pwnd_nsfw: What'd you change..
[15:50:10] borodin: cf_deployment doesn't need to permit parameters fro cf_template
[15:50:16] pwnd_nsfw: and I freaked out because you don't get it
[15:50:26] borodin: you have no idea what I 'get'
[15:50:34] pwnd_nsfw: I know what you don't get
[15:50:42] borodin: go away please
[16:07:55] brandononrails: has joined #RubyOnRails
[16:08:38] funburn_: has joined #RubyOnRails
[16:09:20] brandononrails: Can I render json responding to format.js? I have a modal remotely submitting a form. If it contains valid data, it renders the .js.erb. With invalid data I want to return a json string of the validation errors that I can show in the form via a rails ajax:error callback
[16:10:09] ur5us: has joined #RubyOnRails
[16:11:09] pwnd_nsfw: brandononrails, do you have any code currently? You can conditionally either render the template, else render json: validation_errors
[16:11:41] brandononrails: let me pop it in a gist
[16:12:42] brandononrails: https://gist.github.com/brandoncordell/ac4e7e59e2ad85cb25309cecb7b0b1f2
[16:13:04] brandononrails: The console error I'm getting seems to rails-ujs thinking it's a js response, even though it's sending back json (as it should)
[16:14:01] brandononrails: ignore the borked conditional, I just added it in there so I could spike the sad path. I don't have any real validation on it yet
[16:15:07] DTZUZO: has joined #RubyOnRails
[16:20:35] za1b1tsu: has joined #RubyOnRails
[16:22:16] za1b1tsu: Hello guys, I'm learning some rspec in ruby on rails, it seems that expect(json[:status]) is not the same with expect(json["status"]), and since this is ruby it should work, no?
[16:22:23] Technodrome: has joined #RubyOnRails
[16:24:55] cagomez: has joined #RubyOnRails
[16:28:05] dminuoso: has joined #RubyOnRails
[16:28:19] fryguy: za1b1tsu: why do you assume that?
[16:28:22] fryguy: symbols aren't strings
[16:30:37] za1b1tsu: fryguy: I understant that they are not string, but why in ruby if I declare employee {:name => "Johnny" }, I can call it with employee[:name] and employee["name"]
[16:31:03] SteenJobs: has joined #RubyOnRails
[16:31:46] dminuoso: za1b1tsu: You cant.
[16:32:05] dminuoso: za1b1tsu: There are some bizarre things like HashWithIndifferentAccess that pretend they are the same thing, and there's a mix of things that take either way.
[16:32:11] dminuoso: Generally you can't expect this though.
[16:33:03] dminuoso: za1b1tsu: Assuming that Employee is an ActiveRecord model, then their [] is overloaded to accept either a string or a symbol. But AR is specifically built to accept either.
[16:33:18] za1b1tsu: fryguy: I swear there was something like that, that worked like that
[16:33:30] za1b1tsu: dminuoso: I see, so it is specific to AR
[16:34:20] havenwood: za1b1tsu: Yeah, HashWithIndifferentAccess is probably what you're thinking of. It's specific to Rails but it doesn't change the behavior of regular Hashes.
[16:52:40] conta2: has joined #RubyOnRails
[17:01:30] fox_mulder_cp: has joined #RubyOnRails
[17:07:34] alfiemax: has joined #RubyOnRails
[17:09:39] amperry: has left #RubyOnRails: ("ERC (IRC client for Emacs 24.5.1)")
[17:16:55] dviola: has joined #RubyOnRails
[17:19:51] _ritchie_: has joined #RubyOnRails
[17:21:48] phedkvist: has joined #RubyOnRails
[17:23:10] phedkvist: Hi, I accidentally added a commit thats not my own in my PR. How can I remove this? https://github.com/rails/rails/pull/31449
[17:25:26] fox_mulder_cp: has joined #RubyOnRails
[17:27:38] Exhiled: has joined #RubyOnRails
[17:34:26] Cavallari: has joined #RubyOnRails
[17:34:47] mtkd: has joined #RubyOnRails
[17:35:17] amperry: has joined #RubyOnRails
[17:41:52] DanKnox: has joined #RubyOnRails
[17:42:08] srinidhi: has joined #RubyOnRails
[17:47:33] _ritchie_: has joined #RubyOnRails
[17:50:53] mikecmpbll: has joined #RubyOnRails
[17:53:25] _aeris_: has joined #RubyOnRails
[17:55:44] _aeris_: has joined #RubyOnRails
[18:05:01] funburn: has joined #RubyOnRails
[18:07:59] _aeris_: has joined #RubyOnRails
[18:10:52] ur5us: has joined #RubyOnRails
[18:22:55] creature: has joined #RubyOnRails
[18:23:26] orbyt_: has joined #RubyOnRails
[18:31:31] SteenJobs: has joined #RubyOnRails
[18:37:54] funburn: has joined #RubyOnRails
[18:38:05] mryukeen: has joined #RubyOnRails
[18:38:42] mryukeen: Hello. I've been googling and reading documentation for a while and cannot for the life of me understand how to do this properly.
[18:39:08] mryukeen: I have a partial with a yield block
[18:39:59] mryukeen: It renders fine with <%= render layout: "my_partial", ... do %> .... <% end %>
[18:41:03] mryukeen: However, if a wrap <a href="#"> <%= render layout: .... %> <% end %> </a>--- my <a> tag does not fully wrap the render
[18:41:28] mryukeen: it does a <a></a> on top then partial adds <a> ... </a> somewhere inside the render
[18:42:36] mryukeen: This doesn't happen if I don't have a yield block in the partial and render it using <%= render partial: "my_partial %>
[18:42:48] duderonomy: has joined #RubyOnRails
[18:43:47] mikecmpbll: "someone inside the render"?
[18:44:22] mryukeen: One sec, let me put it in a pastebin
[18:44:26] mryukeen: code and result
[18:46:43] dionysus69: has joined #RubyOnRails
[18:49:36] mryukeen: https://pastebin.com/Gy3RZUPU
[18:57:41] mryukeen: oh.. just read the rules, moving it to pastie
[19:00:13] desperek: has joined #RubyOnRails
[19:01:17] s2013: has joined #RubyOnRails
[19:02:23] amperry: confused on a '.joins()' clause on a query; I've got a 'Hold' model, which 'has_one :apt', but when I try to query 'Hold.joins(:apt).where(:apts {id: 32})', I get the error 'Error: Unknown column 'apts.hold_id' in 'on clause': SELECT COUNT(*) FROM `holds` INNER JOIN `apts` ON `apts`.`hold_id` = `holds`.`id` = 1 WHERE `apts`.`id` = 32'
[19:02:53] amperry: `holds` has an `apt_id`, which is what I'm trying to join on.
[19:03:07] amperry: should the association be belongs_to, instead?
[19:03:19] amperry: (he said, deciding to give that a try...)
[19:04:19] mryukeen: here is the gist ** https://gist.github.com/anonymous/76e9fc2ced8f71e0efe461dcaa75c7c1
[19:04:40] conta2: has joined #RubyOnRails
[19:05:16] SteenJobs: has joined #RubyOnRails
[19:05:17] amperry: okay, that works, on to next problem. Sometimes I just need to ask the question to someone before my brain decides to formulate the answer.
[19:09:44] kapil___: has joined #RubyOnRails
[19:10:19] kapil___: Hello I want to save scopes in seperate file. how can i do it?
[19:13:11] mostlybadfly: has joined #RubyOnRails
[19:14:21] kapil___: I mean i want to seperate scope from models.
[19:16:41] fryguy: put the scopes into a module, include that module in the AR class
[19:19:45] kapil___: fryguy: i am not expert. can you please write a line please
[19:23:06] baweaver: kapil___: You're going to have to write some of this yourself
[19:23:20] baweaver: That includes looking up how modules and module inclusion works in Ruby
[19:23:48] kapil___: baweaver: thanks i will do it
[19:40:42] brandononrails: has joined #RubyOnRails
[19:41:29] brandononrails: How do I stop a remote form from submitting? I've tried stopPropagation() preventDefault() and return false inside of ajax:beforeSend and ajax:send but it's still being submitted
[19:43:37] alfiemax: has joined #RubyOnRails
[19:43:53] funburn: has joined #RubyOnRails
[19:53:36] dionysus69: has joined #RubyOnRails
[19:54:50] kies: has joined #RubyOnRails
[19:55:11] Cache_Money: has joined #RubyOnRails
[19:58:35] mikecmpbll: has joined #RubyOnRails
[20:00:42] ahrs: has joined #RubyOnRails
[20:09:24] mikecmpb_: has joined #RubyOnRails
[20:09:50] sandstrom: has joined #RubyOnRails
[20:11:36] pwnd_nsfw: brandononrails, https://stackoverflow.com/questions/8664486/javascript-code-to-stop-form-submission
[20:11:40] pwnd_nsfw: maybe some of those solutions:?
[20:12:50] brandononrails: hooking into `submit` doesn't work unfortunately, because rails-ujs hijacks the form submission (to send it via ajax), so that never fires
[20:13:19] brandononrails: Interestingly enough, returning false from ajax:send or ajax:beforeSend DOES stop a lot of the rails-ujs code, for example where it injects the CSRF token
[20:13:43] pwnd_nsfw: That seems hacky
[20:14:20] pwnd_nsfw: look into putting the code into the form's onsubmit property
[20:14:40] pwnd_nsfw: form.onsubmit = (function() { STOP THE STUFF });
[20:14:46] pwnd_nsfw: idk it's been a minute
[20:16:43] orbyt_: has joined #RubyOnRails
[20:20:07] pwnd_nsfw: borodin, how's the app coming along?
[20:21:27] SteenJobs: has joined #RubyOnRails
[20:21:46] krawchyk: has joined #RubyOnRails
[20:22:14] alexertech: has joined #RubyOnRails
[20:22:28] cagomez: has joined #RubyOnRails
[20:24:11] amperry: in an after_update callback, using 'saved_change_to_attribute?', do we still have the value of the old attribute to work with? (I thougt it was 'attribute_was', but I'm not seeing it on http://guides.rubyonrails.org/active_record_callbacks.html .) I need to update the old and new associated models if I switch the model.associated_model_id. Where's the
[20:24:18] wopi: has joined #RubyOnRails
[20:24:25] alfiemax: has joined #RubyOnRails
[20:24:35] amperry: (skip those last two words)
[20:29:42] pwnd_nsfw: amperry, attribute_before_last_save iirc
[20:42:40] fox_mulder_cp: has joined #RubyOnRails
[20:50:14] ebsen: has joined #RubyOnRails
[20:52:28] jnollette: has joined #RubyOnRails
[20:57:58] conta2: has joined #RubyOnRails
[20:58:29] Iarfen: has joined #RubyOnRails
[20:59:00] Iarfen: is there a way to translate with gettext() directly? to use something like _('Welcome here message!') and change the text inside poedit files
[20:59:09] VeryBewitching: has joined #RubyOnRails
[20:59:09] Iarfen: I like poedit more than to write .yml files :D
[20:59:58] VeryBewitching: Hey folks, I'm seeing emails coming from ActionMailer with a from address of noreply@example.com all the time, configuration here https://gist.github.com/bewitchingme/7c513a3e815c63f7f51249c87b96b2ee, can anyone assist?
[21:00:05] amperry: I have two models, Placement, which 'has_many "residents', and Resident, which 'belongs_to :placement'. In a byebug console, I can't find resident.placement.residents (i.e., everyone on this placement). Should I not be able to?
[21:01:27] VeryBewitching: amperry: I'm assuming that residents.placement_id is a field?
[21:01:39] VeryBewitching: amperry: Can you Gist your models?
[21:01:54] amperry: VeryBewitching: yup, to both
[21:02:27] VeryBewitching: Also, do you get an error if you do Placement.find(some_id).residents ?
[21:03:42] amperry: nope, that works.
[21:04:30] sandstrom: has joined #RubyOnRails
[21:05:10] conta2: has joined #RubyOnRails
[21:05:14] VeryBewitching: So maybe placement_id is not set for the resident you had loaded?
[21:05:25] VeryBewitching: resident.placement <- is this nil?
[21:06:03] kies: has joined #RubyOnRails
[21:06:27] VeryBewitching: Gist your models please so we can see what's up.
[21:11:33] funburn_: has joined #RubyOnRails
[21:14:01] amperry: VeryBewitching: https://gist.github.com/amp108/8236766fd90fd98bfafa01dbb7e449cc
[21:23:32] sandstrom: has joined #RubyOnRails
[21:25:19] conta2: has joined #RubyOnRails
[21:28:53] amperry: VeryBewitching: it's something about where in the cycle I save resident, but I don't understand why resident would have an id if it weren't already saved.
[21:29:07] VeryBewitching: Tried this out in a test app, see: https://github.com/bewitchingme/assoc
[21:30:09] VeryBewitching: I can do in a rails console: Placement.create; Resident.create placement: Placement.find(1); Resident.create placement: Placement.find(1); r = Resident.find(1); r.placement.residents #=> Collection
[21:32:16] VeryBewitching: I would inspect resident.placement to see what the value of it is
[21:32:35] VeryBewitching: What happens when you call resident.placement.residents ?
[21:33:16] amperry: one sec, lemme switch back
[21:33:43] VeryBewitching: Does it raise an exception, or do you just get an empty collection?
[21:34:02] amperry: I get an empty collection.
[21:34:41] VeryBewitching: OK, so I would check if that placement actually has more than one resident (though you should get at least one given that you're resident belongs to it)
[21:35:25] amperry: what's the way, in a console, to check that an object has been saved? I *think* resident has at this point, but I'm not sure anymore.
[21:35:52] amperry: esp. since the call a few lines up is Resident.create!
[21:37:40] mtkd: has joined #RubyOnRails
[21:37:40] amperry: before I save "rez" (aka resident), the result of rez.placement.residents is: #<ActiveRecord::Associations::CollectionProxy []>
[21:38:20] helpa: has joined #RubyOnRails
[21:38:37] amperry: hmmm... I wonder if it hasn't been saved *since* creating the placement, at this point?
[21:40:02] VeryBewitching: kapil___: Can you elaborate on that question?
[21:40:11] VeryBewitching: amperry: You should write some tests.
[21:40:23] kapil___: i am using views on database
[21:40:41] amperry: VeryBewitching: interestingly enough, that's what I'm in the process of doing.
[21:41:12] kapil___: do i have to write same relationships in model views?
[21:41:20] amperry: but that's it: rez wasn't saving after creating the placement, and I needed it to do so before a couple other things happened.
[21:41:52] VeryBewitching: kapil___: https://dan.chak.org/enterprise-rails/chapter-11-view-backed-models/
[21:41:56] VeryBewitching: First result on Google
[21:42:21] VeryBewitching: amperry: Glad you found the bug :D
[21:42:50] VeryBewitching: amperry: I use TRB for business processes in Rails now, I highly recommend it.
[21:43:05] VeryBewitching: amperry: http://trailblazer.to/
[21:43:07] Iarfen: which is the equivalent way to use sprintf with %s inside ruby?
[21:43:12] Iarfen: I need it for translation
[21:43:15] Radar: GOOD MORNING
[21:43:39] Radar: hey VeryBewitching
[21:43:41] VeryBewitching: Iarfen: The I18n stuff allows for placeholders
[21:43:53] VeryBewitching: Iarfen: What are you trying to do?>
[21:45:03] VeryBewitching: Iarfen: http://edgeguides.rubyonrails.org/i18n.html#passing-variables-to-translations may be helpful
[21:45:50] Iarfen: VeryBewitching: well, it's a placeholder which receives a link tag generated inside the view, which isn't inside a variable
[21:46:28] VeryBewitching: t('some.path', my_var: link_to(params)) ?
[21:47:08] mikecmpbll: has joined #RubyOnRails
[21:48:19] Iarfen: VeryBewitching: ok, thanks!
[21:48:51] amperry: I have a handful of queries that might return nil, or might return []. I've been placing 'if result.present? and result.count > 0' before a lot of 'foreach' blocks, but is there a more concise way to do that?
[21:49:45] VeryBewitching: amperry: @result.blank?
[21:50:24] VeryBewitching: If you need to know if the count is higher than 0, you'll still have to check that.
[21:50:36] amperry: is an empty array blank?
[21:51:17] VeryBewitching: I think blank is irb(main):001:0> [].blank? #=> true
[21:51:17] Radar: Iarfen: !rule3
[21:51:17] helpa: Iarfen: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[21:51:34] amperry: ah... so what I'm doing is as concise as it gets, then, it seems.
[21:51:37] Radar: Iarfen: most of the time it's easier to show code and what you're trying to do with it rather than explain it
[21:51:50] Iarfen: Radar: well, I don't have any more problem thanks!
[21:52:41] VeryBewitching: amperry: :blank? will return false for nil, or '' or [] or {}
[21:52:48] cagomez: has joined #RubyOnRails
[21:52:53] truenito: has joined #RubyOnRails
[21:53:24] VeryBewitching: amperry: So if your result is nil or an empty array, :blank? will return true
[21:53:34] amperry: VeryBewitching: thanks, it sometimes doesn't occur to me to check that in a console. So Resident.find_by_id(10000000).blank? works.
[21:53:55] Radar: Iarfen: rightio. Think of it more for next time then.
[21:54:00] VeryBewitching: amperry: pry + rails console is your friend
[21:54:13] amperry: If you only knew the source data I was working with, you'd see where my frustrations come from.
[21:54:29] VeryBewitching: amperry: Your models look to be a little heavy-set
[21:55:03] VeryBewitching: My most complicated model in my current app has no methods, just associations and scopes.
[21:55:17] amperry: I've come to realize I've been poorly duplicating existing ActiveRecord methods.
[21:56:12] amperry: which is why I want to refactor the whole thing, which is why I'm (admittedly belatedly) creating a test suite. (Yes, TDD, write tests before... lesson learned.)
[21:57:20] VeryBewitching: amperry: If you're going to refactor it, I would certainly suggest Trailblazer. You can do it in pieces, one controller at a time. By the time you're done your models will be lean, your controllers will be lean and your tests will read better.
[21:57:49] VeryBewitching: Also, if you wanted to, you'd be in a position at that point to port the entire app to Sinatra or to Roda without too much effort (mostly routing)
[21:58:04] Iarfen: it's normal that link_to comes escaped when replaced inside a t() function?
[21:58:09] Iarfen: how I disable that
[21:59:53] VeryBewitching: Iarfen: link_to(params).html_safe
[22:00:42] quazimodo: has joined #RubyOnRails
[22:01:34] hahuang65: has joined #RubyOnRails
[22:02:04] ali_g: has joined #RubyOnRails
[22:02:23] VeryBewitching: Or maybe link_to(params).raw might be better?
[22:08:53] orbyt_: has joined #RubyOnRails
[22:09:05] greengriminal: has joined #RubyOnRails
[22:09:35] greengriminal: I want to disable rubicon for a method is this possible?
[22:09:59] pikislabis: has joined #RubyOnRails
[22:10:08] greengriminal: I know you can specify what rule to disable such as `rubocop:disable Style/ClassVars` but I want to disable all checks for a method
[22:10:15] Radar: what is a rubicon
[22:10:59] Radar: greengriminal: why _all_ checks for a particular method?
[22:11:06] greengriminal: i meant rubocp
[22:11:09] Radar: Why not just disable the particular checks that the method is erroring on?
[22:11:14] Radar: # rubocop:disable Style/ClassVars <- lots of these lines
[22:11:17] greengriminal: oh man today is not my day i can't type lol
[22:11:23] Radar: seems that way
[22:11:23] greengriminal: Its a migration
[22:11:34] greengriminal: lol I've done it.
[22:11:34] Radar: so what's stopping you from putting in lots of comments?
[22:13:46] pikislabis: has joined #RubyOnRails
[22:14:00] Technodrome: has joined #RubyOnRails
[22:16:02] nickjj: has joined #RubyOnRails
[22:25:58] ebsen: has joined #RubyOnRails
[22:26:35] pikislabis: has joined #RubyOnRails
[22:27:51] cagomez_: has joined #RubyOnRails
[22:35:20] jnollette: has joined #RubyOnRails
[22:37:10] Technodrome: has joined #RubyOnRails
[22:38:58] Iarfen: can I set the locale for a group of routes?
[22:39:20] Iarfen: something like get '/url-A' has always locale 'en', but get '/url-B' has locale 'es'
[22:50:53] amperry: I've been doing form_for wrong all this time (surprise, surprise). Don't know how to invoke collection_select properly. Gist here (note comments in each file): https://gist.github.com/amp108/8236766fd90fd98bfafa01dbb7e449cc
[22:52:57] amperry: I swear, as soon as I ask, I figure it out.
[22:53:12] amperry: But I can't figure it out unless I ask. Is there a word for that?
[22:54:26] duderonomy: has joined #RubyOnRails
[22:57:30] mikecmpb_: has joined #RubyOnRails
[23:07:13] VeryBewitching: Iarfen: https://github.com/enriclluelles/route_translator
[23:08:48] ornerymoose: has joined #RubyOnRails
[23:14:06] _ritchie_: has joined #RubyOnRails
[23:14:35] Iarfen: VeryBewitching: thanks!
[23:16:48] mikecmpbll: has joined #RubyOnRails
[23:19:12] VeryBewitching: Iarfen: Second result on Google for 'rails I18n routes'
[23:19:19] amperry: I want to add an entry to an ActiveRecord_Relation. Right now I have to call @results.to_a and add @new_entry by way of '<<'. Is there a more AR way to do this?
[23:19:54] Iarfen: VeryBewitching: well, ok
[23:21:08] VeryBewitching: amperry: user.posts << post
[23:22:45] amperry: VeryBewitching: that failed for me, giving me a "NoMethodError (undefined method `<<' for #<Apt::ActiveRecord_Relation:0xb2059ee0>)"
[23:23:30] amperry: @results and @new_entry, although returning objects of the same model, are very different queries.
[23:24:39] VeryBewitching: amperry: In a console in that app I spun up, I can do Placement.find(1).residents << Resident.new and it all works just fine
[23:28:27] VeryBewitching: OK work day is done for me, hitting the trail.
[23:29:39] mikecmpb_: has joined #RubyOnRails
[23:42:34] mtkd: has joined #RubyOnRails
[23:45:48] mheld: has joined #RubyOnRails
[23:48:40] mtkd: has joined #RubyOnRails
[23:52:24] _ritchie_: has joined #RubyOnRails
[23:57:01] mikecmpbll: has joined #RubyOnRails
[23:58:25] hervie: has joined #RubyOnRails