sunya7a_

Activity Graph

Page 1 of 1

2019-06-28

[11:23:23] sunya7a_: Ping timeout: 245 seconds

2019-04-22

[22:15:26] sunya7a_: has joined #RubyOnRails

2018-08-21

[15:44:24] sunya7a_: has joined #RubyOnRails

2018-04-25

[12:26:00] sunya7a_: *.net *.split
[12:27:35] sunya7a_: has joined #RubyOnRails
[15:01:31] sunya7a_: *.net *.split
[15:03:03] sunya7a_: has joined #RubyOnRails

2018-04-24

[21:21:48] sunya7a_: hi, I have a many to many relationship (between model A and B with joining model AB) and would like to create a nested form for A that will accept values for B. When B already exists I would like to create the record in the join table without creating an additional B record. When B does not exist it should be created and the corresponding AB record as well. This is similar to this question on SO https://stackoverflow.com/questions/43106241/obj
[21:22:48] sunya7a_: it feels like this is a common use case but I don't know what to call it and that is the closest I've found. If there is a name for this could you tell me so I can research it on my own further

2018-02-28

[16:24:33] sunya7a_: *.net *.split
[16:27:15] sunya7a_: has joined #RubyOnRails

2017-11-30

[05:19:24] sunya7a_: hi, I have a call back (after_create) that is meant to create some additional resources but for reasons beyond me it is firing twice. anyone know why this might happen? https://gist.github.com/anonymous/06e67b1226850531f72b25df719c6ecf
[05:35:59] sunya7a_: dminuoso: I'm trying to step through the code...the first time my measure resource is added is during my loop...as I step through further rails is calling something inside active_support/callbacks.rb, during which measure i see active record insert the measures again. Is that what you are referring to, that autoloading being screwed up? Could you tell me why that happens or give me some resource to read up on this?
[05:36:57] sunya7a_: dminuoso: I'm not sure i understand what you mean with I "shouldn't already notice it". you mean this problem would have manifested itself somewhere else already?
[05:37:42] sunya7a_: dminuoso: i believe this is the first time I see it happen. I use after_create quite frequently in other models...only this time it's behaving this way
[06:45:37] sunya7a_: dminuoso: so I printed the backtrace and it is indeed being called twice...i don't understand why.
[06:45:59] sunya7a_: dminuoso: the fix is to go about creating the resource in the join resource...instead of the measure
[06:46:29] sunya7a_: dminuoso: https://gist.github.com/anonymous/9d0e3e640a370fb0afe3073bd5710978 the top version works...the bottom doesn't....could you help me understand this...is it a rails bug?
[06:59:50] sunya7a_: dminuoso: okay ... i did that...stopped rails server...stopped spring...placed bybug inside the class just below class ResultStatisticSection < ApplicationRecord line...then triggered the situation...i was dropped into debug mode once...pressed c to continue...didn't drop into debug mode again...rails created twice the record i expected. were you expecting it to drop into debug mode twice, thus explaining the double laoding?
[07:16:15] sunya7a_: dminuoso: here's a print out of inspecting ResultStatisticSection._save_callbacks, I grep'ed through the app and found the class defined only once (also in gist). Furthermore, it doesn't actually seem like the after_create is called twice, instead after_create is called once...then it goes through the loop of my method to add the measures and when it finishes it goes back into active_support/callbacks.rb:456 and runs whatever is inside @after
[07:16:22] sunya7a_: dminuoso: https://gist.github.com/anonymous/979ccd1a413950ca34d62edc3ec40821
[07:17:27] sunya7a_: dminuoso: please have a look at my comments in def create_default_descriptive_statistics . doing it one way creates double records...the otherway does it correctly. i'm just not sure why
[07:18:55] sunya7a_: dminuoso: i'm sorry...i should have inspected after I declared the callback...let me update the gist
[07:19:27] sunya7a_: dminuoso: https://gist.github.com/anonymous/a59f8e5dda2f4d58b368a526fd1aabdf
[07:20:00] sunya7a_: dminuoso: only the p ResultStatisticSection._save_callbacks is different in this gist...the rest is the same
[07:39:16] sunya7a_: dminuoso: https://gist.github.com/anonymous/a7799ed88223687dcc72c78110383ec7 this is with measure.rb
[07:39:45] sunya7a_: dminuoso: i see...let me get one more model then...one sec
[07:40:52] sunya7a_: dminuoso: https://gist.github.com/anonymous/74bf4404844783bb2cb029894e8407d2
[07:43:22] sunya7a_: dminuoso: does this make sense?
[07:45:57] sunya7a_: dminuoso: as ExtractionsExtractionFormsProjectsSectionsType1RowColumn is created I create 4 default ResultStatisticSection. This in turn checks its type and if it matches the first type it iterates through measures and adds the default ones as well. I alias that long class name to subgroup.
[07:49:18] sunya7a_: dminuoso: ok
[07:55:58] sunya7a_: dminuoso: https://gist.github.com/sunya7a/519cc67e0a56311e65e3611dc29a65b5
[07:56:17] sunya7a_: dminuoso: thanks for the tip
[08:02:33] sunya7a_: dminuoso: so what i'm trying to accomplish is add default measures to a specific type of ResultStatisticSection. ResultStatisticSection has many-to-many relationship with Measure via a join model. A ResultStatisticSection is created when ExtractionsExtractionFormsProjectsSectionsType1RowColumn (aka subgroup) is created via after_create callback
[08:03:20] sunya7a_: sevenseacat: =(
[08:03:29] sunya7a_: dminuoso: when i do self.measures << m in my code
[08:06:36] sunya7a_: dminuoso: i updated the gist with the controller action that I'm calling
[08:07:06] sunya7a_: I am making an update to another resource called ExtractionsExtractionFormsProjectsSections
[08:07:09] sunya7a_: sevenseacat: =(
[08:11:05] sunya7a_: dminuoso: idk exactly which line causes the bad behavior...in my opinion it should work...line 24 in result_statistic_section.rb does exactly what I want it to...but then once that method is called rails goes back into active_support/callback.rb and triggers the insert a second time and I don't know why it does that...but somehow when I create the join resource instead of doing measures << m on that same line it doesn't insert twice
[08:11:40] sunya7a_: 'once that method is called' meaning once it's done...it goes into callback.rb and does the insert again
[08:12:44] sunya7a_: dminuoso: that should be line 11: @extractions_extraction_forms_projects_section.update(extractions_extraction_forms_projects_section_params)
[08:13:16] sunya7a_: line 11 in the controller.rb
[08:14:47] sunya7a_: dminuoso: ok
[10:20:06] sunya7a_: dminuoso: ok...i created a test case...but the only thing i was able to do was reproduce the issue with the test...I decided to try something else...created a new app to show case the problem...i think this is rails behavior and it is either working as intended or a bug: https://github.com/sunya7a/rails-bug
[10:21:17] sunya7a_: dminuoso: please open rails console...then simply create an A
[10:21:18] sunya7a_: dminuoso: lol;
[11:58:45] sunya7a_: ][''''''''''''
[15:01:00] sunya7a_: Ping timeout: 268 seconds

2017-11-28

[14:57:38] sunya7a_: NL3limin4t0r: thanks...i believe what i was looking for doesn't exist...what i wanted was for the nested resource to do on: :collection but with the option to not include the parent...I'm already using shallow nesting...but that's not the issue....I simply created a level one resource (one without being nested under a parent) and used on: :collection

2017-11-27

[13:40:12] sunya7a_: I have a nested resource and wish to define a custom action on a child collection. Rails is automatically adding the parent and parent id in to the url...how do i prevent this besides redefininig the resource without the nesting...is there an option with on: :collection?
[16:56:07] sunya7a_: NL3limin4t0r: My understanding with shallow nesting is that it will not use the parent if it isn't necessary for the default actions. It doesn't seem to work for custom actions though...it still shows the parent resource in the url

2017-11-25

[12:01:40] sunya7a_: in a many-to-many relationship what is the cleanest way (built-in) to prevent duplicate entries when using nested forms? So for example...given model A and B, if i update A and have the option to add a new B via nested fields, I would like to connect to an existing B and only create if there is none
[12:11:25] sunya7a_: I believe there might not be a build-in way...what I would like to discuss is the cleanest way of accomplishing this...i.e. when it's best to check for an existing record

2017-11-23

[07:39:32] sunya7a_: hi all, I have a form with nested fields. while populating the elements in the nested fields I use label_method. problem is that i run into n+1 problem regardless of using .includes. Could someone point me to a resource that discusses this problem or is there no workaround?
[07:53:36] sunya7a_: sevenseacat: thanks. let me put togther a gist
[07:57:50] sunya7a_: sevenseacat: here is the view and controller: https://gist.github.com/anonymous/798f6c05820740684fa16ccabd8e914b
[07:58:36] sunya7a_: sevenseacat: I believe the relevant line is line 4 in the controller. The n+1 issue arises because it's fetching the profile username information one at a time even though I'm including it (or so i think)
[08:00:38] sunya7a_: sevenseacat: yup...this is a silly question, but i don't know how to edit a gist. should i just createa new one?
[08:01:58] sunya7a_: sevenseacat: https://gist.github.com/anonymous/764f763306a0517316217bfc56bce1b0
[08:02:21] sunya7a_: sevenseacat: ahh
[08:04:10] sunya7a_: sevenseacat: hm..there's no view associated with profile in this controller action. the information it's trying to fetch is populating the dropdown...line 10 in the form
[08:05:45] sunya7a_: i'm calling label_method: :titleize_username. which is a method in User model: https://gist.github.com/anonymous/8cba0c0a189d7a42799fd1e17b899f4d
[08:07:36] sunya7a_: sevenseacat: ahh...sorry about that.....i did attempt to call includes in the User model...but that diesn't seem to work
[08:10:17] sunya7a_: sevenseacat: yes..set_project is the one. Let me try combinging them
[08:13:13] sunya7a_: sevenseacat: problem persists: https://gist.github.com/anonymous/4cdca68efcfa7d7bc63b34fd6696c413
[08:14:23] sunya7a_: sevenseacat: i am....i will take out the set_project for edit action and place the code in set_project directly in edit
[08:15:56] sunya7a_: sevenseacat: yea same: https://gist.github.com/anonymous/aceb0ec0190b18c76519e302109e5be2
[08:16:04] sunya7a_: sevenseacat: okay
[08:17:58] sunya7a_: sevenseacat: https://gist.github.com/anonymous/4648d3fcd034b4537e4b6907d27049ba
[08:22:14] sunya7a_: sevenseacat: https://gist.github.com/anonymous/c73307b51a47d7c30db76a80f7c97e97
[08:22:43] sunya7a_: sevenseacat: yea...that is a bit odd...currently there's only one assignment
[08:23:18] sunya7a_: sevenseacat: nvm...there are three...still not as many as is being rendered
[08:26:00] sunya7a_: sevenseacat: but isn't it going through assignment...the
[08:28:43] sunya7a_: sevenseacat: hm....i see...i don't suppose i can pass an empty object with includes....that doesn't really makes sense
[08:29:50] sunya7a_: sevenseacat: but...hm...that doesn't make sense though...if I count the number of n+1's i see a total of four
[08:30:15] sunya7a_: sevenseacat: I assume for the three assignments that already exist and being rendered and one more for the empty partial
[08:31:27] sunya7a_: sevenseacat: i think i could do that
[08:33:26] sunya7a_: sevenseacat: thank you ...i'll go with that =)
[08:33:48] sunya7a_: yup...i'm just glad I see why it's behaving this way
[08:34:02] sunya7a_: i was afraid I misunderstood how includes works...and that was a bigger issue to me
[08:36:02] sunya7a_: what do you use these days?
[08:36:39] sunya7a_: sevenseacat: i wish i didn't either

2017-11-09

[06:13:41] sunya7a_: has joined #RubyOnRails
[08:43:19] sunya7a_: I have 3 models: A has many B and B has many C. I'm using delegate to get from C to A. Given a collection proxy of C's how can I get the corresponding A's? I've tried using delegate in the B model to help bridge from C to A, but it doesn't do what I expect it to

2017-10-31

[03:07:05] sunya7a_: has joined #RubyOnRails
[05:25:41] sunya7a_: could someone suggest a good way to deal with join table names that are too long? I've been staying very consistent with my naming convention up until now but I've come to a point where the name is over 64 characters long
[08:47:09] sunya7a_: Quit: Leaving
[08:47:58] sunya7a_: has joined #RubyOnRails
[09:16:47] sunya7a_: Ping timeout: 260 seconds

2017-09-28

[18:37:28] sunya7a_: Quit: leaving

2017-09-12

[23:48:41] sunya7a_: has joined #RubyOnRails

2017-08-08

[18:22:37] sunya7a_: Ping timeout: 240 seconds

2017-08-06

[04:04:20] sunya7a_: has joined #RubyOnRails
[04:04:20] sunya7a_: has joined #ruby

2017-07-21

[07:35:58] sunya7a_: Ping timeout: 240 seconds

2017-06-25

[01:06:54] sunya7a_: has joined #RubyOnRails
[01:06:54] sunya7a_: has joined #ruby

2017-06-20

[00:15:13] sunya7a_: Write error: Broken pipe

2016-07-10

[04:59:53] sunya7a_: *.net *.split
[08:54:10] sunya7a_: has joined #ruby
[08:54:11] sunya7a_: has joined #RubyOnRails

2016-07-04

[15:09:39] sunya7a_: Ping timeout: 260 seconds
[15:11:40] sunya7a_: has joined #RubyOnRails
[15:11:40] sunya7a_: has joined #ruby

2016-06-30

[09:04:00] sunya7a_: has joined #RubyOnRails
[09:04:00] sunya7a_: has joined #ruby

2016-06-25

[13:51:17] sunya7a_: Ping timeout: 258 seconds

2016-06-15

[23:08:02] sunya7a_: has joined #RubyOnRails
[23:08:02] sunya7a_: has joined #ruby

2016-05-18

[08:45:42] sunya7a_: Ping timeout: 250 seconds

2016-05-17

[14:58:46] sunya7a_: has joined #RubyOnRails
[14:58:46] sunya7a_: has joined #ruby

2016-04-11

[13:58:22] sunya7a_: composite keys in activerecord. I only find composite_primary_keys gem....is there a native solution in place...or any plans for one in the works?
[14:14:30] sunya7a_: workmad3: okay...so the gem is pretty much what people use? or just kind of manually manage is better? (in your opinion.)

2016-04-07

[16:24:27] sunya7a_: composite keys in activerecord. I only find composite_primary_keys gem....is there a native solution in place...or any plans for one in the works?

2016-03-21

[05:12:37] sunya7a_: Ping timeout: 250 seconds
[05:14:43] sunya7a_: has joined #RubyOnRails
[05:14:43] sunya7a_: has joined #ruby

2016-03-18

[21:25:40] sunya7a_: Ping timeout: 276 seconds
[21:26:23] sunya7a_: has joined #RubyOnRails
[21:26:23] sunya7a_: has joined #ruby

2016-03-09

[19:52:04] sunya7a_: using ruby 3.02 and I'm trying to add a custom data attribute to an image_tag helper...Could someone tell me why I'm not getting what I expected: https://gist.github.com/anonymous/57a13133ef81634b4694
[19:52:16] sunya7a_: rails* 3.02
[19:53:21] sunya7a_: according to this the data attribute should be formatted the way I wanted http://stackoverflow.com/questions/20152927/how-to-add-jquery-data-attributes-in-rails-image-tag

2016-02-28

[06:29:18] sunya7a_: Ping timeout: 268 seconds
[06:29:34] sunya7a_: has joined #RubyOnRails
[06:29:34] sunya7a_: has joined #ruby

2016-02-27

[23:06:09] sunya7a_: has joined #RubyOnRails
[23:06:09] sunya7a_: has joined #ruby

2016-02-26

[17:20:46] sunya7a_: *.net *.split

2016-02-15

[22:25:24] sunya7a_: Ping timeout: 252 seconds

2016-02-02

[19:07:26] sunya7a_: has joined #RubyOnRails
[19:07:26] sunya7a_: has joined #ruby

2016-01-20

[13:56:08] sunya7a_: *.net *.split

2015-12-13

[19:34:09] sunya7a_: *.net *.split
[19:35:57] sunya7a_: has joined #RubyOnRails
[19:36:01] sunya7a_: has joined #ruby

2015-11-26

[08:32:36] sunya7a_: has joined #ruby
[08:32:37] sunya7a_: has joined #RubyOnRails
[19:01:53] sunya7a_: *.net *.split
[19:08:05] sunya7a_: has joined #ruby
[19:08:08] sunya7a_: has joined #RubyOnRails

2015-11-21

[15:39:30] sunya7a_: Ping timeout: 240 seconds
[23:00:23] sunya7a_: has joined #RubyOnRails
[23:00:23] sunya7a_: has joined #ruby

2015-10-28

[23:53:43] sunya7a_: has joined #RubyOnRails
[23:53:43] sunya7a_: has joined #ruby

2015-10-19

[12:38:24] sunya7a_: Quit: Lost terminal

2015-10-18

[01:13:19] sunya7a_: has joined #RubyOnRails
[01:18:24] sunya7a_: Ping timeout: 255 seconds
[03:01:27] sunya7a_: has joined #RubyOnRails
[04:04:57] sunya7a_: has joined #RubyOnRails

2015-10-17

[00:56:36] sunya7a_: has joined #RubyOnRails
[02:44:46] sunya7a_: has joined #RubyOnRails
[14:43:26] sunya7a_: has joined #RubyOnRails
[20:17:32] sunya7a_: Ping timeout: 272 seconds

2015-10-16

[03:15:23] sunya7a_: has joined #RubyOnRails
[03:45:06] sunya7a_: Ping timeout: 240 seconds
[06:16:24] sunya7a_: has joined #RubyOnRails
[06:21:39] sunya7a_: Ping timeout: 240 seconds
[08:04:38] sunya7a_: has joined #RubyOnRails
[08:09:38] sunya7a_: Ping timeout: 272 seconds
[09:15:23] sunya7a_: has joined #RubyOnRails
[11:03:30] sunya7a_: has joined #RubyOnRails
[13:49:30] sunya7a_: has joined #RubyOnRails
[17:38:26] sunya7a_: has joined #RubyOnRails
[17:44:10] sunya7a_: Ping timeout: 260 seconds
[18:38:33] sunya7a_: has joined #RubyOnRails
[22:03:05] sunya7a_: has joined #RubyOnRails
[22:59:19] sunya7a_: Ping timeout: 244 seconds
[23:07:31] sunya7a_: has joined #RubyOnRails

2015-10-15

[19:04:58] sunya7a_: has joined #RubyOnRails
[20:19:04] sunya7a_: has joined #RubyOnRails
[21:33:21] sunya7a_: has joined #RubyOnRails

2015-10-13

[14:22:18] sunya7a_: has joined #RubyOnRails

2015-10-12

[14:42:43] sunya7a_: has joined #RubyOnRails

2015-10-11

[17:29:32] sunya7a_: has joined #RubyOnRails

2013-05-31

[20:43:49] sunya7a_: hello. I have a general/best practice question. If I was to share my rails application with another group or let's say put it up on github (public) what is the best practice in terms of handling configuration files, for example the database.yml file or any other file that may contain 'sensitive' or my installation specific information?
[20:44:53] sunya7a_: my first instinct is to replace the database.yml file with a symlink and point it to the file somewhere outside the repo
[20:45:48] sunya7a_: tubbo: so just leave config files untracked you say?
[20:47:39] sunya7a_: tubbo: okay i see
[20:47:51] sunya7a_: tubbo: thank you again

2013-04-02

[15:46:13] sunya7a_: hi...can I ask questions about rspec here or is there a more appropriate forum?