« Back to channel list

#RubyOnRails - 17 September 2017

« Back 1 day Forward 1 day »
[00:18:03] srinidhi: has joined #RubyOnRails
[00:25:14] jhfisc: has joined #RubyOnRails
[00:31:21] jhfisc: has joined #RubyOnRails
[00:38:53] kn-928: has joined #RubyOnRails
[01:13:17] jhfisc: has joined #RubyOnRails
[01:19:17] jhfisc: has joined #RubyOnRails
[01:25:17] jhfisc: has joined #RubyOnRails
[01:26:51] bronson: has joined #RubyOnRails
[01:39:06] jhfisc: has joined #RubyOnRails
[01:40:55] figuresofstick: has joined #RubyOnRails
[01:42:50] jhfisc: has joined #RubyOnRails
[02:06:46] rosalind: has joined #RubyOnRails
[02:09:48] orbyt_: has joined #RubyOnRails
[02:18:03] gusrub: has joined #RubyOnRails
[02:36:50] kn-928: has joined #RubyOnRails
[02:39:04] krz: has joined #RubyOnRails
[02:51:51] gusrub: has joined #RubyOnRails
[03:00:46] armyriad: has joined #RubyOnRails
[03:28:27] bronson: has joined #RubyOnRails
[03:39:41] kn-928: has joined #RubyOnRails
[03:45:48] banisterfiend: has joined #RubyOnRails
[04:12:15] kn-928: has joined #RubyOnRails
[04:31:50] tylluan: has joined #RubyOnRails
[04:34:23] tylluan: Hi, sorry for the basic question. What method do I use to configure/pass non-request params to a Controller? Use-case is I have a rate limiter, and I want to pass in an instance to the Controller (and then mock it out during tests). I did try old Google, but I think I'm using bad/overloaded terminology.
[04:38:36] irishfromua: has joined #RubyOnRails
[05:30:01] bronson: has joined #RubyOnRails
[06:14:18] srinidhi: has joined #RubyOnRails
[06:30:07] tamouse__: tylluan: how does the rate limiter work normally?
[06:31:55] tylluan: It's a simple class with a single Take() method that returns true or false (nonblocking). One instance keeps track of the rate of requests, so I'd like controllers to all use the same instance.
[06:33:38] tamouse__: i'm wondering if it's something that should be in middleware
[06:35:29] tylluan: Almost certainly - it seems like Controllers must be stateless between requests, but I don't know how to do that :D Do you have any good links to how to write my own middleware class?
[06:56:30] krz: has joined #RubyOnRails
[06:57:46] bruno-_: has joined #RubyOnRails
[07:15:36] dionysus69: has joined #RubyOnRails
[07:30:49] bronson: has joined #RubyOnRails
[07:30:49] Saukk: has joined #RubyOnRails
[07:37:26] kn-928: has joined #RubyOnRails
[07:38:25] krz: has joined #RubyOnRails
[07:43:40] maryo: has joined #RubyOnRails
[08:24:25] marr: has joined #RubyOnRails
[08:27:51] rgr: has joined #RubyOnRails
[08:56:25] jhfisc: has joined #RubyOnRails
[09:01:58] jhfisc: has joined #RubyOnRails
[09:05:10] jhfisc: has joined #RubyOnRails
[09:09:00] ahrs: has joined #RubyOnRails
[09:15:13] jhfisc: has joined #RubyOnRails
[09:19:13] jhfisc: has joined #RubyOnRails
[09:24:25] maryo: has joined #RubyOnRails
[09:25:11] jhfisc: has joined #RubyOnRails
[09:25:39] sandstrom: has joined #RubyOnRails
[09:31:15] jhfisc: has joined #RubyOnRails
[09:31:51] bronson: has joined #RubyOnRails
[09:40:59] kn-928: has joined #RubyOnRails
[09:46:51] segy: has joined #RubyOnRails
[09:48:56] dminuoso: tylluan, what web server are you on?
[09:49:05] dminuoso: And by that I mean puma/unicorn/whatever
[09:49:57] tylluan: @dminuoso No idea, I'm just using "rails server" :D I've figured out how to write middleware now, but I can't figure out how to test it
[09:50:17] dminuoso: tylluan, do you mean a rack middleware?
[09:50:52] tylluan: I think so, everyone online refers to it as rack, but I've not typed that word anywhere! I load it in application.rb using config.middleware.use
[09:51:13] dminuoso: tylluan, right. That's "just" a rack middleware then.
[09:52:24] tylluan: Awesome thanks, I was wondering about that - I was confused because it had it's own proper noun, but for a ruby outsider like me I didn't explicitly install rack at any point so I thought I was "just using rails".
[09:53:07] dminuoso: tylluan, rack is a stack of layers. Each request gets passed from layer to layer until the final layer (which rack calls "application")
[09:53:15] dminuoso: tylluan, and Rails is that final layer.
[09:53:59] tylluan: Layers of middleware makes sense, I just didn't think of it as a separate component from rails itself :)
[09:55:22] dminuoso: tylluan, you might be surprised to know that the documentation for rack is this much: http://rack.github.io/
[09:55:58] dminuoso: These 2 sentences are really all you need to know to start writing middlewares. :P
[09:56:22] tylluan: So I've already found a good tutorial and written a working middleware that does what I want
[09:56:29] tylluan: Now I'm just stuck on testing it properly!
[09:56:44] dminuoso: tylluan, dont plug the middleware in while using
[09:56:51] dminuoso: *while testing
[09:57:09] dminuoso: test it in a separate scenario, but leave it out for the other parts. that will avoid headaches.
[09:57:19] tylluan: I want to test the middleware itself
[09:57:46] dminuoso: rspec or minitest?
[09:59:02] tylluan: minitest I guess, since that's the default?
[09:59:51] dminuoso: tylluan, you can unit test the middleware without rack at all.
[10:00:44] tylluan: So just write unit tests as normal and then pass in my own app and env mocks?
[10:02:48] dminuoso: tylluan, either you just unit test the middleware by constructing it, and passing it some input
[10:02:54] lxsameer: has joined #RubyOnRails
[10:02:55] maryo: has joined #RubyOnRails
[10:02:58] dminuoso: tylluan, or you make an entire app. This is what rails uses internally to test middleware: https://github.com/rails/rails/blob/master/railties/test/isolation/abstract_unit.rb#L160-L183
[10:03:15] tylluan: My use-case is quite simple, so I will try the former first
[10:09:24] maryo: I am trying to use some barchart graph in my rails applications. Is there any recommended gem for achieving this?
[10:16:24] dminuoso: maryo, personally I'd say pick a JS library you like, and do it yourself.
[10:16:31] maryo_: has joined #RubyOnRails
[10:22:55] dminuoso: maryo_, for traditional apps chartkick has you covered though. Be careful that you look at the licensing for the charting library that drives chartkick
[10:23:28] maryo_: dminuoso, thank you so much.
[10:51:12] sevenseacat: has joined #RubyOnRails
[10:53:41] rgr_: has joined #RubyOnRails
[10:55:53] krz: has joined #RubyOnRails
[11:01:02] ShalokShalom: has joined #RubyOnRails
[11:22:27] dionysus69: has joined #RubyOnRails
[11:23:33] pLaTo0n: has joined #RubyOnRails
[11:33:12] bronson: has joined #RubyOnRails
[11:33:58] kn-928: has joined #RubyOnRails
[11:49:46] EminenceHC: has joined #RubyOnRails
[11:52:05] ShalokShalom_: has joined #RubyOnRails
[11:56:00] arBmind: has joined #RubyOnRails
[11:59:26] lxsameer: has joined #RubyOnRails
[12:07:03] tylluan: Hey dminuoso, I got it all working in the end. Thank you for your help!
[12:10:44] sonOfRa: has joined #RubyOnRails
[12:26:27] irishfromua: has joined #RubyOnRails
[12:53:19] sonOfRa: has joined #RubyOnRails
[13:03:38] GodFather: has joined #RubyOnRails
[13:10:27] Chernobuk: has joined #RubyOnRails
[13:10:51] EminenceHC: How would I go about editing linux server config files which need sudo access from rails? Is there a preferred way to do this, or do I just use FileUtils commands from any ruby method?
[13:18:50] sonOfRa: has joined #RubyOnRails
[13:24:00] arBmind: has joined #RubyOnRails
[13:29:16] wmoxam: eminencehc: Store the edited config in a DB, then write an async job (cron, resque) to update the file (and run it as root)
[13:32:58] wmoxam: alternatively use configuration management software (Chef, Ansible, etc) and use your rails app to feed it templates & trigger updates
[13:33:16] jhfisc: has joined #RubyOnRails
[13:34:06] bronson: has joined #RubyOnRails
[13:38:53] kn-928: has joined #RubyOnRails
[13:39:21] jhfisc: has joined #RubyOnRails
[13:40:43] dminuoso: Or you know, run the rails server with root, and then just do a plain system("#{params[:command]"}) - what could possibly go wrong
[13:41:15] EminenceHC: wmoxam: Thanks!
[13:42:05] ule: has left #RubyOnRails: ()
[13:44:46] coder2000: Always be careful allowing your system to be altered from a website
[13:45:06] pierrehedkvist: has joined #RubyOnRails
[13:58:50] wmoxam: There's always Webmin :D
[13:58:57] srinidhi: has joined #RubyOnRails
[14:00:30] krz: has joined #RubyOnRails
[14:27:17] xaviergmail: has joined #RubyOnRails
[14:58:57] irishfromua: has joined #RubyOnRails
[15:01:15] krz: has joined #RubyOnRails
[15:05:15] pierrehedkvist: has joined #RubyOnRails
[15:08:49] pierrehedkvist: Hey, I would like to begin contributing to rails. Is there any good beginner issues one can start with?
[15:28:20] EminenceHC: has joined #RubyOnRails
[15:29:30] dviola: has joined #RubyOnRails
[15:30:15] jhfisc: has joined #RubyOnRails
[15:31:06] Stabs: has joined #RubyOnRails
[15:34:53] bronson: has joined #RubyOnRails
[15:37:53] kn-928: has joined #RubyOnRails
[15:37:59] phedkvist: has joined #RubyOnRails
[15:46:33] jhfisc: has joined #RubyOnRails
[15:47:07] kn-928: has joined #RubyOnRails
[15:49:01] Stabs: has joined #RubyOnRails
[15:49:54] defsdoor: has joined #RubyOnRails
[15:56:48] Stabs: https://gist.github.com/Codefencing/c4c73d3a5b8608369006bb0d70c7ac81 problem enforcing uniqueness in email addresses while following Hartl's tutorial, chapter 6.
[15:59:48] orbyt_: has joined #RubyOnRails
[16:00:01] jhfisc: has joined #RubyOnRails
[16:00:58] mars777: has joined #RubyOnRails
[16:02:00] krz: has joined #RubyOnRails
[16:02:26] funkytwig: has joined #RubyOnRails
[16:14:34] tamouse__: Stabs: try `rails db:test:prepare` after running `rails db:migrate`
[16:15:12] jhfisc: has joined #RubyOnRails
[16:16:23] Stabs: Thanks, tamouse__
[16:16:27] Stabs: It has worked.
[16:25:29] tamouse__: Stabs: I'm not 100% sure what db:test:prepare is doing, but effectively it's wiping your test db, and replicating the structure, so you have a clean test db
[16:30:09] Treefingers: has joined #RubyOnRails
[16:30:31] Treefingers: has left #RubyOnRails: ()
[16:30:37] jhfisc: has joined #RubyOnRails
[16:37:08] coder2000: You can use database_cleaner as well to rebuild your test db each run
[16:43:51] conta: has joined #RubyOnRails
[16:46:17] tamouse__: you shouldn't really need to, though
[16:52:59] netzfisch: has joined #RubyOnRails
[17:02:45] krz: has joined #RubyOnRails
[17:12:17] bruno-: has joined #RubyOnRails
[17:13:40] MasterAsia: has joined #RubyOnRails
[17:14:03] MasterAsia: I have a method that generates an oauth link - what should it return if the env variable for the secret_id is nil?
[17:15:22] tamouse__: is this a method you're writing, masterasia ?
[17:34:55] mulander: has joined #RubyOnRails
[17:35:19] ascarter: has joined #RubyOnRails
[17:35:55] bronson: has joined #RubyOnRails
[17:36:41] mulander: hi all, what's the proper way to handle *data* migrations that can also be nicely automated? AR in db:migrate? raw SQL in db:migrate? custom rake tasks? They all seem to be prone to either getting borked by further changes or hard to automate (ie. changes needed to run between specific migrations when using rake)
[17:40:38] tamouse__: mulander: do they need to be reversible?
[17:42:56] mulander: tamouse__: no, but they should be atomic - either pass or revert data (so transaction wrapped)
[17:42:57] kies: has joined #RubyOnRails
[17:43:30] mulander: the use case being, adding ie. a field to an existing table that needs to have valeus set on business logic and after that is done applying a not null constraint on it
[17:44:02] mulander: so this means 3 steps: 1. add column; 2. run business logic to set a value based on potentially other data; 3. apply constraint
[17:47:06] drale2k: has joined #RubyOnRails
[17:48:30] bruno-: has joined #RubyOnRails
[17:57:15] arBmind: has joined #RubyOnRails
[18:03:29] krz: has joined #RubyOnRails
[18:13:46] maryo: has joined #RubyOnRails
[18:15:35] kn-928: has joined #RubyOnRails
[18:16:43] tamouse__: mulander: i can't say there's a one and true way to do this that forever going to be glitch free
[18:17:29] mulander: tamouse__: I'm trending towards either raw SQL in db:migrate or defining models needed for the migration inside db:migrate - everything else seems fiddly
[18:18:14] kn-928: has joined #RubyOnRails
[18:18:36] mulander: guess the question becomes, which is more idiomatic rails out of the two?
[18:19:08] netzfisch: has joined #RubyOnRails
[18:19:13] tamouse__: that i do not know. i think this is "everyone figures it out for their specific case"
[18:19:46] tamouse__: one time, we did it with the 3 steps in the `up` method, and made it irreversable
[18:20:26] tamouse__: but then someone tried to recreate a new database from the migrations and something borked at that point
[18:21:07] tamouse__: i think the proper solution in that case would have been to run that irreversible migration, and then consolidate all migrations to that point into a single one
[18:22:56] tamouse__: on another project, we had a case where a JSONB field had been added, but then later (like a few months), it needed to be given a default value of "{}" instead of null. so that involved a few steps like this, too. the person implementing went with a rake task, followed by a migration
[18:23:14] tamouse__: since then, there've been a few errors around that
[18:23:56] tamouse__: i guess maybe what i'm saying is figure out something that works in your case and make sure it can't get clobbered by something else
[18:24:09] tamouse__: but that's pretty much useless advice
[18:27:40] maryo: I am using a rubyXL to export data in xlsx format. But when doing it is not getting downloaded and it is appearing like this https://ibin.co/3aj84fGS97A4.png however if i right click on export option and open it in a new tab the file is getting downloaded successfully. Can someone shed some pointers on how to fix this behavior?
[18:28:57] tamouse__: maryo: i'm not sure, but do check the 'Content-disposition' response header
[18:29:36] maryo: tamouse__, sure thank you
[18:32:55] Aherin: has joined #RubyOnRails
[18:39:45] ascarter_: has joined #RubyOnRails
[18:48:09] mulander: tamouse__: thanks, you did help - confirmation that there is no sanctioned way helps.
[18:55:54] justrying: has joined #RubyOnRails
[19:04:47] krz: has joined #RubyOnRails
[19:07:50] ladipo: has joined #RubyOnRails
[19:09:43] ladipo: has left #RubyOnRails: ()
[19:10:26] maryo: Testing out device gem for authentication. Anyone knows which algorithm it uses for creating the hash?
[19:14:26] pwnd_nsfw: maryo, bcrypt
[19:14:30] mustmodify: has joined #RubyOnRails
[19:14:41] pwnd_nsfw: https://github.com/plataformatec/devise/blob/master/lib/devise/encryptor.rb
[19:17:56] mustmodify: has joined #RubyOnRails
[19:18:10] segy: has joined #RubyOnRails
[19:18:38] ResidentBiscuit: has joined #RubyOnRails
[19:19:46] mustmodify: has joined #RubyOnRails
[19:23:15] mustmodify: has joined #RubyOnRails
[19:23:42] mustmodify: has left #RubyOnRails: ()
[19:31:03] maryo: pwnd_nsfw, thank you. That helps o/
[19:35:39] MasterAsia: tamouse__, yep
[19:36:30] marr: has joined #RubyOnRails
[19:37:09] bronson: has joined #RubyOnRails
[19:40:45] mulander: has left #RubyOnRails: ()
[19:42:37] Stabs: has joined #RubyOnRails
[19:43:19] conta: has joined #RubyOnRails
[19:49:04] conta: has joined #RubyOnRails
[20:02:36] kn-928: has joined #RubyOnRails
[20:05:21] krz: has joined #RubyOnRails
[20:16:51] maryo: How do i see if any db migration is pending for my rails application?
[20:27:35] Stabs: maryo rails db:migrate:status works?
[20:36:26] Stabs: I can't seem to install bcrypt...
[20:37:18] Stabs: Command Prompt with Ruby and Rails: I use bundle install, and the system cannot find the path specified.
[20:38:11] Stabs: Even when I'm in the same folder as bundle.
[20:38:54] fryguy: Stabs: pastebin the output
[20:39:31] Stabs: fryguy: there is no output, just "The system cannot find the path specified."
[20:40:05] dminuoso: Stabs, paste the entire output regardless.
[20:40:48] dminuoso: The error message sounds suspiciously windows-esque.
[20:41:03] dminuoso: Stabs, also gist your Gemfile while you are at it
[20:41:13] mcr: has joined #RubyOnRails
[20:44:29] Stabs: https://gist.github.com/Codefencing/b4891e29c3bfca5787d58095c0062649 is my gist, fryguy, dminuoso.
[20:44:50] dminuoso: Stabs, you do not have bundler installed. Install it with "gem install bundler"
[20:45:41] dminuoso: The fact that msys has it is irrelevant. Perhaps its a different ruby installation or uses different gem paths, I dont know.
[20:47:05] dminuoso: Also dont msys things only work in the msys environment? No idea how that stuff works.
[20:49:00] Stabs: I seem to have gotten by on luck, then.
[20:54:55] armyriad: has joined #RubyOnRails
[20:58:30] krz: has joined #RubyOnRails
[21:37:49] bronson: has joined #RubyOnRails
[21:57:25] EminenceHC: has joined #RubyOnRails
[22:25:08] lord4163: has joined #RubyOnRails
[22:39:49] justrying: has joined #RubyOnRails
[22:49:13] jhfisc: has joined #RubyOnRails
[22:50:28] Radar: GOOD MORNING
[22:52:32] dminuoso: GOOD EVENING RADAR
[23:05:52] funkytwig: has joined #RubyOnRails
[23:06:57] gusrub: has joined #RubyOnRails
[23:27:17] jmay: has joined #RubyOnRails
[23:27:37] jmay: has joined #RubyOnRails
[23:38:52] okdas: has joined #RubyOnRails
[23:39:11] bronson: has joined #RubyOnRails
[23:59:38] irishfromua: has joined #RubyOnRails