#RubyOnRails - 05 July 2017
« Back 1 day Forward 1 day »
[07:07:45] dionysus69: the second method requires more work, that's why I wonder if it's theoretically justifiable to send html with json and then just append that json key to some dom element instead of getting data and then using lots of jquery to format it and render it at needed places.
[07:08:59] dminuoso: dionysus69: Ultimately there is no right and wrong. If you remember, matthewd himself considers the js.erb pattern quite valid.
[07:12:20] dminuoso: dionysus69: The advantage of providing raw JSON is that allows other users to interact with the API directly more easily.
[07:12:58] dionysus69: not dealing with that kind of scenario but ye I agree, would be useful in that case of course
[07:12:59] dminuoso: dionysus69: If you don't want or need that for some or all endpoints, then it's fine to produce html partials. This could enable you to still make use of things like form helpers (e.g. simple_form)
[07:14:36] dminuoso: dionysus69: Yeah, same story still. If you use html partials rather than pure json you can use those still. :)
[07:17:20] dionysus69: looks ugly but couldn't think of another way :D if there is let me know please :D :)
[07:17:38] dminuoso: dionysus69: Im also a bit biased, since I have a pure react frontend, so Im forced to use JSON. ;-)
[07:20:37] dionysus69: I am for using pure json apis, it's cool for api to be client agnostic, but I guess that would be useful in case there is a use for it in a project :) right now I am working on project that company will use only on localhost :D but still good to know a proper structure, in case one builds a scalable project
[11:03:55] marahin: Hello! I am looking for the best way to copy a paperclip attachment (image, hosted on S3) to another record. Both records should then have the same attachment, but either one can be later on edited / changed (so it _shouldnt_ point to the same file, instead it should duplicate it). https://makandracards.com/makandra/6-copy-a-paperclip-attachment-to-another-record is this a good way?
[11:50:57] dminuoso: Abhijit: If you separate them completely, it also makes sense to keep the api project completely separate too.
[11:54:04] dminuoso: arup_r: I mean I don't think there's any right or wrong answer. I keep them completely separate because I want my frontend to be completely agnostic of the API.
[11:54:52] arup_r: yeah API only app will not be getting the new webpack thing.. webpacker is for mvc with FE frameworks support
[11:55:23] arup_r: But it will be very much based on the project future scope :D I get your point dminuoso
[12:26:52] dminuoso: Abhijit: Nah. They decided that the release of angular 2 demanded an immediate upgrade to a new major.
[13:34:35] Papierkorb: jokke: Do that in your front-end proxy, will be much more efficient for production
[14:39:28] arup_r: My program doing something wrong evenif I gave it correct value. It never fill the sign in form with my inputs correctly. Any one faced this error in selenium? https://gist.github.com/aruprakshit/9951358338c78fabc767ebf43fda331e
[16:10:36] pwnd_nsfw: Reasons why "current_user" wouldn't be automatically available in a pundit policy? (One moment, will provide some actual code)
[16:23:13] tbuehlmann: https://github.com/elabs/pundit/blob/ac2a25d93ccd044ac3ea777a70ffd5e31db10d3a/lib/generators/pundit/install/templates/application_policy.rb#L2
[16:24:33] tbuehlmann: https://github.com/elabs/pundit/blob/ac2a25d93ccd044ac3ea777a70ffd5e31db10d3a/lib/pundit.rb#L269-L271
[16:24:54] pwnd_nsfw: I did see that, but wasn't sure if that was what was passed to the policy itself
[16:25:14] pwnd_nsfw: Which brings me to that other policy that I am able to use current_user in. I'll have to check that out
[17:22:38] dminuoso: Assume a lead ticket (something along the lines of a "bug" or "issue" in a bug tracker), which can either be opened or closed.
[17:22:40] dminuoso: Should the respective column be called "open" or "closed" (having a boolean value of true or false)
[17:27:19] dminuoso: The third option of having some generic "status" is a bit more annoying because Rails hates people trying to use string values as enums, and Im trying to get away from using too many integer enums.
[17:45:25] matthewd: http://www.dictionary.com/browse/open lists 42 definitions for the adjectival form; http://www.dictionary.com/browse/closed has 9
[17:56:31] dminuoso: open also has the added advantage of saving a single character (thus reducing source size and saving some development time) whenever you have to type it
[17:56:58] dminuoso: It also improves the start up time of the rails app because it has to parse less.
[18:09:05] matthewd: dminuoso: I think I'd use closed, because it feels narrower / more specific. (I already thought that; the dictionary check just supported it.)
[18:09:45] matthewd: dminuoso: Also avoids Kernel#open, I guess, though I'd be worried if you wanted to call that from your model anyway
[18:10:16] dminuoso: matthewd: Interesting, I came to the same conclusion. For me the underlying meaning is "is it resolved?". And "open" is a negation of that "is it unresolved?"
[18:11:27] matthewd: And that may tie into my other thought, which is that I'd first try to find a more specific-sounding word/synonym. (Like "resolved".)
[20:03:41] fryguy: anyone have any good examples for a devise auth strategy that takes some configuration? i'm looking at devise-jwt but I don't see how jwt_revocation_strategy works so i'm looking for some other examples
[21:37:11] rory096: any idea why mysql2 would keep trying to connect on /tmp/mysql.sock no matter what socket: i specify in my database.yml?
[22:50:05] freeatnet: Hey everyone, need a little bit of help figuring out how to report a deadlock in Rails. Here's the gist of it: https://gist.github.com/freeatnet/d0501319936f567d7d855e200201bf2b