#RubyOnRails - 21 March 2018
« Back 1 day Forward 1 day »
[02:01:10] andrewray: I get webpacker less now. it has a special hacky config style you need to use, and if you want to run the dev server (standard for modern js development) you still have to run it as a standalone app? :(
[02:05:18] andrewray: Radar: well really I want rails to do less for me, i'm trying to understand the ins and outs of webpacker vs just running the dev sever instead
[02:05:47] andrewray: i was surprised since my assumption is that webpacker already runs webpack for you and you don't have to run a separate process, which it can do, but not for the dev server
[02:07:17] andrewray: that's what I don't get though, that was my initial mental model of webpacker. but now I realize the assets are still served directly through the rails app
[02:08:44] andrewray: chrome around the dev sever is odd to me too. I didn't realize the suggested way is rails webpack
[02:08:45] andrewray: "Webpacker will automatically start proxying all webpack asset requests to this server." huh
[02:10:55] andrewray: I don't have a good mental model of what I percieve as a significant amount of coupling back into rails from webpacker. I thought it was supposed to remove it from rails but it seems to have intimate knowledge of it
[07:54:12] bijan_: Hi one conceptual question: I need to write code that generates a license key with checksum and some obfuscation. Where should this key generation code live in? In the active record model for licenses? In the lib folder? As a concern? As a helper?
[12:55:16] dminuoso: nemesit|znc: No. Id just comment the gem out, run bundle update and then your test suite
[12:57:45] dminuoso: I mean I can think of a few tricks you could do, but in the end the only reliable way is pulling them out, and seeing if things crash (does this sound like a robust language by the way?)
[13:14:43] anikras: hello, i am following this guide, and a i am on Step 4 https://github.com/DMPRoadmap/roadmap/wiki/Upgrading-from-DMPonline_v4
[13:21:01] FrostCandy: we are using devise to handle login apparently, we have a logout link like main_app.destroy_user_session_path, I can't find a main_app controller or a user_session or session controller, what controller am i supposed to be looking for so I can see wheere main_app is? I added a bann user to the db and when someone logs in i want to check if they are banned then log them out
[13:25:10] dminuoso: FrostCandy: The controller and views for that engine are located in the devise gem itself.
[13:28:03] FrostCandy: Hmm ok so i'd have to modify the gem in order to check vs bann ? Actually I might be able to find a piece of code that is run when a user attempts login and handle it there.
[13:32:17] dminuoso: FrostCandy: You can simply create your own `class SessionsController < Devise::SessionsController` and then override the actions you want to.
[13:32:52] dminuoso: FrostCandy: Though for what you are describing the controller sounds like the wrong fit to do it in.
[13:33:40] FrostCandy: well everyone hts the index page after logging in, so i can do a IF user_logged_in? , then check thier bann, then log them back out.
[13:33:52] dminuoso: FrostCandy: You can trivially override `active_for_authentication?` as per https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb#L37-L41
[13:39:44] drale2k_: i need help with an issue i am having with connecting Rails and a Go app to AnyCable https://stackoverflow.com/questions/49407668/cant-connect-rails-and-go-via-websocket-using-anycable
[13:40:06] drale2k_: basically i want Rails and Go to be able to talk with each other over websocket
[15:01:27] spohnz: if I was to create a migration file to store a public_ssh_key, what database type should I use?
[15:18:25] spohnz: will varchar work? #bin/rails g migration AddPublicSSHKeyToUsersTable public_ssh_key:varchar
[15:21:20] logik-bomb: its been a while since I used rails. I have a list of Brands and a list of Dealers. If I want to associate a few brands per dealer (where multiple dealers can have the same brand) whats the best way to do it? has_many :through ?
[15:24:29] ruby_: anyone know what the do does? https://github.com/TwilioDevEd/api-snippets/blob/master/guides/voice/record-calls-guide/record-twiml/example.5.x.rb#L7
[15:26:04] ruby_: from what i've read this syntax can be used for iterate over loops but i dont see how it's being used here
[15:27:10] ruby_: the python version just gets the object and uses it which confuses me https://github.com/TwilioDevEd/api-snippets/blob/master/guides/voice/record-calls-guide/record-twiml/example.5.x.py#L11
[16:06:16] cagomez: I have "app/services/foo" with Foo::SomeClass, Foo::OtherClass. But now I need to add a bunch of classes with `Module Foo; Class SomethingElse; end; End`, and I'm getting an error: "Foo is not a module" when I try to Foo::SomethingElse.new
[16:06:36] FrostCandy: What does it mean if I make a method in a class that srtarts with _ ? Does that make it a private method or anything special?
[16:30:16] FrostCandy: Apparently the underscore in method name is just garnish. I am using a mailer controller class class EmailBlastMailer < AsyncApplicationMailer, and if I didn't put .deliver! at the end of my call to a def it wouldn't even run the method at all. I would have understood if it didn't mail, but didn't expect it no to run the method at all. I guess that's something written into the parent AsyncApplicationMailer
[21:58:10] GJdan: I have inherited an app that loads a page of JSON results from an API then fudges an array of emptiness to pass into Kaminari.paginate_array to create a pager. Is there a correct way to use Kaminari to page REST API results without doing that?
[21:59:22] GJdan: the paginate_array on the giant empty array no longer works seeing as we are dealing with over 1 Billion total results now