#RubyOnRails - 13 March 2019
« Back 1 day Forward 1 day »
[01:11:11] greengriminal: Hey all quick question is this the right syntax for only enabling uniqueness constraints on create: `validates :user_id, uniqueness: true, on: :create`
[01:12:02] greengriminal: My previous syntax was: `validates_uniqueness_of :user_id` and was finding that if I loaded an existing AR record and called `#save` it would fail this validation check.
[06:49:46] Cork: is there a way to tell activeRecrod to create a belongs_to record before trying to save the current one?
[07:05:48] Cork: this crashes with ActiveRecord::NotNullViolation (Mysql2::Error: Field 'network_id' doesn't have a default value: ...
[07:06:25] Cork: i suspect it means it tries to save the PrivateNetwork and then Network there by failing the PrivateNetworks constraint for network_id
[07:16:25] Cork: tbuehlmann: the function needs to clam a row in another table so if i run it before_validate i need to have a way to clean up if it fails validation
[07:28:35] tbuehlmann: another approach: can't you make sure the record exists before creating the private network?
[07:34:40] Cork: tbuehlmann: no, the network table is not exposed in the ui so the model needs to handle it
[07:35:32] Cork: interesting about the transaction, haven't actually checked that it doesn't revert that on it's own >_<
[07:37:01] za1b1tsu: I want to create a rails plugin (a rails app that can be used as a gem in another rails app), that handles database related tasks (including the database). From waht I am reading I should use rails plugin my_app --mountable. But when I try to create the db, it is created in the dummy app, not in /db. What should I do?
[08:29:14] za1b1tsu: hmmm, the idea is to have the database management separate so I can use in other projects
[08:42:01] tbuehlmann: web and api sounds like a rails app to me. a cli could be a gem (or script), but using the api, not interacting with the database on its own
[14:48:22] Vaevictus: I just realized that my unexpectedly-approved-by-departmentheads project requires it.
[15:34:05] Vaevictus: well, the browsers on windows (when configured to do so) will pass the login auth from your windows sessopm
[15:37:14] Vaevictus: we're a hospital, and to encourage people to do a better job of console security, we're going to have a security game where if you leave your workstation unattended, someone can lock it for you with a simple command... and i'm going to have it also ping a webserver with who got "hacked" and what alias is claiming responsibility
[15:46:27] Inside: sounds like what you want is an internal webpage someone can go to, then click a button?
[15:58:54] Vaevictus: right now, if i do batchfilename.bat <alias> it's *instantaneous* locking and still loads a webbrowser with a target url including the alias
[15:59:59] Vaevictus: screwing with them, silently getting kudos and money, publically remaining *anonymous*
[16:00:44] Vaevictus: the day i'm over in medsurg and i see someone stand up, start to leave, then glare at me and go back, that's when i win :D
[16:04:23] Vaevictus: i think... if they really want a gui, I'll just point them at the webserver directly
[16:08:24] Vaevictus: the problem with non-executable/batches is that we then have to trust the "hacker" to lock the terminal
[16:30:21] Vaevictus: i mean, if you're a nurse on the nursing unit screwing with a coworker, you want in-and-out as fast as possible
[18:07:17] Andr3as: hi all.. i've got an issue with running the command: rake webpacker:compile RAILS_ENV=staging which results in a
[18:08:01] Andr3as: i did quite an extensive google search but i havent been able to come up with a hint on how to track that down.. anyone an idea how to find out where it dies?
[18:09:17] havenwood: Time to update Rails (CVE with dev RCE)! https://weblog.rubyonrails.org/2019/3/13/Rails-4-2-5-1-5-1-6-2-have-been-released/
[18:12:24] Andr3as: havent touched the app in a while, it worked great before.. went from linux to windows, pulled it out of my gitlab, did some updates and now boom
[18:12:51] Andr3as: updates as in "bundle update" and some minor bug fixes in the code.. totally unrelated to that error
[18:27:02] ss942: Any tips on how to use deface gem to override view in place just after loop? I know that it would be :insert_after but I have problem with creating correct erb selector
[18:42:38] Inside: Ugh.. how do I get rails to eager_load all the classes in a directory in production. I have a folder app/roles and inside I've got a number of classes ie: (Role::Admin) which are derived from Role::Base. I'd like to be able to have a "RoleManager" class where I could call "RoleManager.all_roles" and get all the available roles
[18:44:33] Inside: Although, I suppose, I could mess around with the base initialize() function for it to auto register itself.. seems dirty thoug
[21:46:55] helpa: ss942: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us. Put the code on https://gist.github.com and then give us the HTTP link to the Gist.