« Back to channel list

#RubyOnRails - 28 February 2019

« Back 1 day Forward 1 day »
[00:00:21] kvda: has joined #RubyOnRails
[00:00:56] Net: I have a json column that I'd like to be editable via yaml in a textarea. What's a simple way to implement this?
[00:25:33] DoctorMonocular: Net: https://www.jvt.me/posts/2017/06/22/yaml-to-json/
[00:34:13] Forager: has joined #RubyOnRails
[00:34:28] orbyt_: has joined #RubyOnRails
[00:40:29] sevenseacat: has joined #RubyOnRails
[01:08:24] orbyt_: has joined #RubyOnRails
[01:15:51] ariedler: has joined #RubyOnRails
[01:17:39] mangold: has joined #RubyOnRails
[01:25:43] Technodrome: has joined #RubyOnRails
[01:27:00] tdy: has joined #RubyOnRails
[01:32:36] mangold: has joined #RubyOnRails
[01:36:33] andrewray: has joined #RubyOnRails
[01:37:14] andrewray: Has anyone set up an api user (with token based auth, not username/pass) in a rails app that's normally done with devise?
[01:43:15] SteenJobs: has joined #RubyOnRails
[01:50:25] faitswulff: has joined #RubyOnRails
[01:55:15] duderonomy: has joined #RubyOnRails
[02:02:52] crankharder: has joined #RubyOnRails
[02:12:08] quazimodo: has joined #RubyOnRails
[02:12:13] quazimod2: has joined #RubyOnRails
[02:13:50] quazimodo: has joined #RubyOnRails
[02:35:04] orbyt_: has joined #RubyOnRails
[02:46:16] faitswulff: has joined #RubyOnRails
[02:55:25] tdy: has joined #RubyOnRails
[03:02:03] ariedler: has joined #RubyOnRails
[03:17:48] MrCrackPotBuilde: has joined #RubyOnRails
[04:02:24] davidh38: has joined #RubyOnRails
[04:10:06] braincrash: has joined #RubyOnRails
[04:13:11] crankharder: has joined #RubyOnRails
[04:29:28] v01d4lph4: has joined #RubyOnRails
[05:03:53] Xiti`: has joined #RubyOnRails
[05:11:56] Xiti: has joined #RubyOnRails
[05:25:26] srinidhi: has joined #RubyOnRails
[05:30:58] tdy: has joined #RubyOnRails
[05:53:44] uks: has joined #RubyOnRails
[06:03:08] uplime: has joined #RubyOnRails
[06:37:02] v01d4lph4: has joined #RubyOnRails
[06:37:30] conta: has joined #RubyOnRails
[06:40:51] v01d4lph4: has joined #RubyOnRails
[06:47:54] benlieb: has joined #RubyOnRails
[06:49:43] DTZUZO: has joined #RubyOnRails
[06:57:29] srinidhi: has joined #RubyOnRails
[07:22:33] prestorium: has joined #RubyOnRails
[07:22:53] tdy1: has joined #RubyOnRails
[07:24:55] mangold: has joined #RubyOnRails
[07:30:10] fox_mulder_cp: andrewray i use devise + pundit in my rails app in api only mode :)
[07:30:23] fox_mulder_cp: but some devise controllers are owerritten
[07:31:02] fox_mulder_cp: and all users use token based auth in reactjs app)
[07:38:05] syndikate: If am running my specs using parallel_tests gems and in between in one of the specs if I call `DatabaseCleaner.clean` does it wipe out data from all the connections? How does this behave?
[07:38:58] sevenseacat: I think the answer to that would be 'undefinedly'
[07:43:02] akadmks: has joined #RubyOnRails
[07:51:46] syndikate: Can I interpret that word as "god knows" or "anomaly" or "can't say"
[07:52:15] sevenseacat: 'god knows' probably
[07:52:15] syndikate: I have not used that word before sevenseacat :P
[07:53:08] syndikate: database_cleaner gem shows the clean method calling clean on all connections
[07:53:30] syndikate: Now gotta see what happens when we have parallel_tests to the mix :( Why do people have to bring in complicated situations
[08:11:16] Ergo: has joined #RubyOnRails
[08:20:42] kapil____: has joined #RubyOnRails
[08:24:12] lxsameer: has joined #RubyOnRails
[08:24:27] blackmesa: has joined #RubyOnRails
[08:27:44] KevinSjoberg: has joined #RubyOnRails
[08:31:13] srinidhi: has joined #RubyOnRails
[08:59:25] wethu: has joined #RubyOnRails
[09:18:43] mikecmpbll: has joined #RubyOnRails
[09:38:09] reber: has joined #RubyOnRails
[10:02:47] Psy-Q: i'm really struggling implementing JSON-API "relationships", e.g. expose a relationship JSON on accounts/1/contacts but a full contact object unter /contacts/1
[10:03:16] Psy-Q: and also, how do i write a controller that handles only the relationship updates under accounts/1/contacts but actual object changes on /contacts? this is hell
[10:52:33] blackmesa1: has joined #RubyOnRails
[11:13:40] mangold: has joined #RubyOnRails
[11:21:10] lupine: can I ask a model to reload only a single column value?
[11:27:26] tbuehlmann: I don't think there's a method for that
[11:27:29] conta: has joined #RubyOnRails
[11:47:05] lankanmon: has joined #RubyOnRails
[11:49:22] lupine: yeah, I'm not finding it. so I'm just querying the database for the value directly :D
[11:49:46] lupine: (it's something of a self-made problem, since a bit earlier in the flow we update the database directly without going through the model)
[11:54:58] husam212: has joined #RubyOnRails
[11:55:21] husam212: Hello everyone!
[11:55:31] ariedler: has joined #RubyOnRails
[11:55:47] husam212: Can we have a template in rb format? Using helpers only to render anything
[11:56:29] husam212: Is ther a gem so I can have a view named foo.html.rb that contains calls to view helpers
[11:57:45] ariedler: has joined #RubyOnRails
[12:04:11] tbuehlmann: husam212: I don't think so. as helpers are modules, you could include these modules into your object and just call the methods
[12:27:49] Technodrome: has joined #RubyOnRails
[12:41:59] Psy-Q: i'm still too dumb to catch RoutingError in production and produce usable JSON output. it just produces a blank response and i can't catch ActionController::RoutingError in any controller
[12:43:09] Psy-Q: i've tried a catch-all route but what would i return from it so that things keep working? the code does reach the catch-all method, but something is always missing for Rails to continue processing the request (some env var for example)
[12:47:38] arooni_team_b: has joined #RubyOnRails
[12:48:31] Psy-Q: ah, fuck me. i guess there is no RoutingError to catch anymore if one has a catch-all route
[12:48:45] Psy-Q: since as far as the router is concerned, it found a matching route...
[12:59:59] tbuehlmann: Psy-Q: right, you'd route that to a custom controller action that would respond whatever you like
[13:01:57] Psy-Q: yeah, i guess i have to do that
[13:02:32] Psy-Q: since there doesn't seem to be a good way to let JSON-speaking clients know about routes that aren't found (also, i can't even remember what a full non-API-mode rails app does when a route is not found -- 404 HTML response?)
[13:08:57] tbuehlmann: right, it renders the public/404.html. for json requests, it'll render {"status":404,"error":"Not Found"}
[13:23:45] faitswulff: has joined #RubyOnRails
[13:25:46] Psy-Q: thanks. i have to render JSON-API-style error objects, i'll just point people at the docs to the API so they can find out which routes are valid
[13:25:59] Psy-Q: in the description element
[13:34:24] blackmesa1: has joined #RubyOnRails
[13:46:13] darkphnx: has joined #RubyOnRails
[13:58:15] ariedler: has joined #RubyOnRails
[14:04:23] blackmesa1: has joined #RubyOnRails
[14:52:53] orbyt_: has joined #RubyOnRails
[15:05:40] Dbugger: has joined #RubyOnRails
[15:15:43] pd09041999: has joined #RubyOnRails
[15:29:41] conta: has joined #RubyOnRails
[15:36:38] blackmesa1: has joined #RubyOnRails
[15:43:03] tdy1: has joined #RubyOnRails
[15:43:16] agent_white: has joined #RubyOnRails
[15:45:32] conta: has joined #RubyOnRails
[15:48:02] benlieb: has joined #RubyOnRails
[16:38:44] Net: What’s the proper way to transform a param for create/update actions?
[16:39:44] Net: In my case I have a param that comes in as a YAML string, and I need to parse it before it’s saved as a JSON attribute.
[16:43:12] ivanskie: has joined #RubyOnRails
[16:54:08] Inside: like in your controller?
[16:59:49] SteenJobs: has joined #RubyOnRails
[17:07:11] Technodrome: has joined #RubyOnRails
[17:14:47] gambl0re: has joined #RubyOnRails
[17:23:32] prestorium: has joined #RubyOnRails
[17:25:16] [Butch]: has joined #RubyOnRails
[17:35:06] orbyt_: has joined #RubyOnRails
[17:40:25] prestorium: has joined #RubyOnRails
[17:46:33] orbyt_: has joined #RubyOnRails
[17:46:39] Net: Inside: any particular convention?
[17:52:53] ams__: has joined #RubyOnRails
[17:53:42] ams__: has joined #RubyOnRails
[17:56:05] Inside: you can add non-db attributes to your models
[17:56:12] Inside: so you could be passing in the yaml as raw_yaml
[17:57:09] Inside: and then write a custom validator that either parses it to json and stores it in your model's attribute that's linked to acolumn or throws a validation error
[17:57:40] Net: is it idiomatic for validators to write attributes?
[18:02:23] Net: this is the way I did it, I don't know if it's better or worse – https://gist.github.com/net/244033bdc27c06bcb37e587ec06820b1
[18:03:10] Net: (this is rails 5.0 so no ActiveRecord::Type::Json)
[18:04:25] mikecmpbll: has joined #RubyOnRails
[18:16:24] KeyJoo: has joined #RubyOnRails
[18:17:05] mikecmpbll: has joined #RubyOnRails
[18:17:47] davidh38: has joined #RubyOnRails
[18:48:44] bambanx: has joined #RubyOnRails
[18:58:58] serverok: has joined #RubyOnRails
[19:11:28] orbyt_: has joined #RubyOnRails
[19:36:12] benlieb: has joined #RubyOnRails
[19:41:23] reber: has joined #RubyOnRails
[19:43:46] Inside: Net: Well, it could also be a before_validation type thing
[20:03:23] crankhar1er: has joined #RubyOnRails
[20:28:36] orbyt_: has joined #RubyOnRails
[20:57:04] cnsvc_: has joined #RubyOnRails
[20:59:34] Fernando-Basso: has joined #RubyOnRails
[21:04:14] hahuang65: what would be the best way to include a method from another module in ApplicationHelper
[21:06:48] Radar: hahuang65: where's the other module?
[21:08:01] hahuang65: Radar: in lib/
[21:08:22] Radar: hahuang65: Then you can probably do a require at the top of ApplicationHelper and then include that module directly into ApplicationHelper
[21:08:35] hahuang65: Radar: what if I don't want any other methods from that module?
[21:08:49] Radar: hahuang65: this isn't Elixir ;) You get either all or none.
[21:08:57] Radar: hahuang65: move the method into a 3rd module
[21:09:05] hahuang65: Radar: haha
[21:09:26] Radar: I long for Elixir's `import Module, only: [fun: 1]` in Ruby :D
[21:09:34] hahuang65: Radar: yeah so do I
[21:10:02] hahuang65: Radar: my use case is basically, I have a module for a 3rd party integration that has a lot of methods. One of which I want in ApplicationHelper so that I can derive a URL
[21:10:15] hahuang65: perhaps the best way is to just have a method call the other module's method.
[21:10:28] Radar: is the URL for the 3rd party system or for yours?
[21:10:40] Radar: Could you possibly have a controller action within your own project which then redirects to the 3rd party URL?
[21:10:52] Radar: then in app helper you could have a rails routing helper which goes to that controller
[21:11:08] Radar: But if it's making anything other than a GET request... a redirect won't work
[21:11:21] hahuang65: Radar: well this part I'm specifically using for a CSV export
[21:11:37] hahuang65: so it renders in CSV, rather than a page
[21:12:23] hahuang65: I suppose I could just call MyModule.my_method in the view...
[21:12:35] Radar: if you make a module method, yes.
[21:12:54] hahuang65: I think I'm over-engineering this in my head ha
[21:12:56] Radar: (i.e. it's defined with a self. prefix or you explicitly called module_function before that)
[21:13:27] hahuang65: thanks for bouncing around ideas with me
[21:13:31] hahuang65: appreciate it as always
[21:25:08] SteenJobs: has joined #RubyOnRails
[21:42:55] ams__: has joined #RubyOnRails
[22:04:08] quazimodo: has joined #RubyOnRails
[23:17:20] carlosd: has joined #RubyOnRails
[23:20:37] ericboehs: has joined #RubyOnRails
[23:22:31] carlosd: hey, I'm tinkering with ActiveStorage JS and would like to use async/await, but when I try to compile my code it gives me "17:9 error Parsing error: Unexpected token create"
[23:22:33] pd09041999: has joined #RubyOnRails
[23:23:05] carlosd: if I remove the async/await keywords it's compile fine
[23:25:49] carlosd: I think I have to tweak something in rollup.config.js, anyone have any hint?
[23:27:38] benlieb: How can I access the :layout option of the render call in a view?
[23:44:50] carlosd: discovered it was an eslint configuration, just have to configure my ecmaVersion to 2017
[23:45:42] gambl0re: has joined #RubyOnRails
[23:56:32] ariedler: has joined #RubyOnRails