#RubyOnRails - 13 September 2017
« Back 1 day Forward 1 day »
[02:09:04] ali_g: For some reason my loop isn't looping how I need. I'm retrieving instances that have 2 active record relations in it. I need to loop through the years column to get all relations from the first year, then all relation from the second year... (code as follows)
[06:26:06] Cork: anyone know of a supported way to lock the current active record database (self.lock!) in before_validation until after_commit?
[06:26:39] Cork: i tried locking just simply having a function and calling it, but then the modification for the record didn't save :)
[06:52:28] Radar: Cork: why in before_validation? Couldn't you lock the record for read during a transaction?
[06:53:14] Cork: Radar: there is checks in the validation that is vital is in sync with what the before_save sets in the database
[06:53:33] Cork: and i would prefer if it wasn't a must to remember it in every place where it might be called
[06:54:24] Cork: basically it is just a column with boolean :pending and it validates it is false in validation and sets it to true in before_save
[06:54:40] helpa: 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.
[06:57:44] Cork: i'm on the trail of solution so just ignore the question if you get annoyed with it
[06:59:48] Radar: You could probably create a service object that ensured this object was locked. It would be cleaner than putting the logic in the model, as you may have some places where you might _not_ want this locking to take place.
[07:00:06] Radar: But then I see your point earlier about avoiding missing a place where you need the locking.
[09:28:46] GeorgesLeYeti: I have articles and each article get a language_id. I want to return an array of distinct language_id but order by the number of occurency
[09:43:52] helpa: Please do not crosspost without at least telling so. Experience shows that people don't bother to inform the other channels of provided solutions, therefore it is considered rude.
[11:45:30] jarr0dsz: hello everyone, is there a way to get the index of an object that is part of an activerecord collection?
[11:46:01] jarr0dsz: so for example 10 users inside @users, i would like to figure out for ech of them what the index would be
[11:57:10] jarr0dsz: i came across that for arrays not sure how that exactly do that with collection
[13:04:45] DarkSaint: the pages refference css and js files through http:// intead of https:// and I don't know where I can fix that
[13:06:00] DarkSaint: I need tips on where to tweak so that the refferences to css and js are generated as https://
[13:18:54] solars: quick question: if I have a PG db, with a specific schema I know I can specify it with schema_search_path - but how does this work if I want to create the db with rake, does it create the schema?
[13:34:06] mcr: I have rake tasks that run from cron. When all is well, I don't need to see any output. When things go wrong, I want to see the debug output. Has anyone seen any Logger replacements that collects the debug logging, and then emits it *only* if a logger.error or some other signal is created? I can create such a thing myself of course.
[13:56:18] freedrull: forgery_protection_origin_check is default now, even if you create your app with --api ?
[14:23:15] kapil___: Could not read 'columns_hash' for Design::CollectionHierarchy: PG::UndefinedTable: ERROR: relation "collection_hierarchies" does not exist
[14:23:33] kapil___: i installed closer_tree gem , error comes after that, error comes when i use model that use close_tree function.
[14:49:40] DarkSaint: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
[16:37:38] Dbugger: Does anybody here has experience with building APIs in Rails with authentication? I am a lil bit lost on this one...
[16:41:53] Sylario: Dbugger: I am in the process of creating an non-OAUTH API, and I am going to use JWT. I think it's the most used solution.
[16:51:08] tomoyuki28jp: Is anyone using rails_best_practices with guard? This gem is outdated and not longer works: https://github.com/logankoester/guard-rails_best_practices
[18:53:40] kshah: Having trouble catching an error from an ExecJS.call command, the result of calling that is nil when an error is thrown, not some error object. I only get the error printed to the console/STDOUT for example
[19:06:24] kshah: nvm, I think the console was just swallowing it up, I can catch the ExecJS::RuntimeError just fine