#RubyOnRails - 23 March 2017
« Back 1 day Forward 1 day »
[05:05:43] helpa: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[05:14:33] wkoszek: Which open-source Rails projects have a nicely figured out deploy model, so that I could look at it?
[05:15:19] wkoszek: I'm interested in stealing a flow for running a migration on a remote machine and having staging/prod on a separate VPSes.
[05:18:14] pankaj_: baweaver: I installed mysql package by command 'sudo apt-get install libmysqlclient-dev' but then I did 'gem install mysql2' I got errror:
[05:21:36] pankaj_: The thing is that I had already installed Ruby and rails previously successfully. But then I did 'bundle install' I go error in some certain gems like sqlite, debug inspector etc.
[05:24:55] pankaj_: I think so. But how can I remove those old settings. It must be very tedious task.
[05:27:35] wkoszek: Before you do so, you may source ~/.profile && which gem <- whatever you get, should show you ~/.rvm/... bleh path.
[06:00:13] dminuoso: Radar: In my app it's just when a show action for a particular resource is requested. It's unlikely that you have the data cached locally anyway.
[06:05:01] Radar: dminuoso: For that sort of thing I would use the json.cache blocks that jbuilder provides
[06:08:48] mwlang: if you’re just doing the most typical thing, the capistrano getting started guide is pretty clear cut and well organized.
[07:56:52] Andr3as: if the app i am building will serve 2500 users and lets say they all visit the site the same time.. i know it all depends on the coding but as a rule of thumb, how big a server would i need to serve 'em?
[08:45:30] naftilos76: Hi, is it a really good idea to have a captcha on my user login sreen? I am using rails 4.2 and bcrypt which is on purpose slow (as you probably already know) so that bots are discouraged to continue hitting my login page. What do you think?
[09:17:02] Andr3as: i've also saw a drupal addon the other day, where they put a field on the page which is hidden by css.. if the robot fills it, they ignore the form
[09:17:54] Andr3as: doesnt sound too complicated to implement that in rails if there isnt a gem for that anyway
[09:20:11] Andr3as: ah.. k.. i'm asking due to my "sizing question" above.. am really not having any experience with it
[09:26:06] mikecmpbll: does anyone use sidekiq via activejob? is it worth it? seems like the disadvantages are quite extensive
[09:26:23] mikecmpbll: https://github.com/mperham/sidekiq/wiki/Active-Job#customizing-error-handling
[09:39:59] dminuoso: naftilos76: Googles new recaptcha is actually pretty good because it will only trigger if the user is likely to be a machine.
[09:47:27] naftilos76: dminuoso, i think i will not use it for now. I will rely on fail2ban or a future ruby version of fail2ban and iptables that drops down the number of requests/sec
[09:57:45] nacho_: But still, apple's calendar app won't take the event because the end of line is not standard
[09:58:45] dminuoso: Papierkorb: If you always have to click pictures it's a strong smell that there's something wrong with your computer or your network.
[10:00:58] dminuoso: Papierkorb: (This could happen if you implicitly configure your browser to block third-party cookies)
[10:08:33] Papierkorb: dminuoso: Nothing's wrong with my computer or network, I just don't like being spied upon. Third-party cookies are of course blocked.
[10:10:38] Papierkorb: dminuoso: I'm not even hardcore, I don't block JS per se, just a adblocker with sane configuration
[15:07:07] donnib: i am trying to do rake db:create and i get error "Couldn't create database for..." where do i get more information what fails ?
[15:39:53] froyo1: So I have two models -- Post and Comment. I'm using fragment caching to cache each post, and on the Comment model I've specified -> 'belongs_to :post, touch: true'
[15:40:13] froyo1: This works as expected. Whenever I add a new comment to a post, the cache key of that particular post expires
[15:40:37] froyo1: HOWEVER, when I delete a comment from a post, the cache key of that post doesn't expire. What gives?
[15:45:41] cek: What's the modenr way of getting test data into DB via rspec and not via factories (too much data). I have an sql snapshot of data here.
[16:12:44] helpa: pankaj_: Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
[16:17:12] pankaj_: No the problem was that I had already installed rails but via get-apt. It didnot worked out for me. Gems like sqlite,debugger etc. are causing error.
[16:18:13] pankaj_: After that somebody suggested me a link and told not use 'get-apt' to install rails. But due to some problem in my OS I was unable to retrieve the link.
[16:19:25] brent__: so a select dropdown inside the form, if a certain option is chosen, i want to show a couple other fields, i know this can be done with jquery, but wondering if there is any rails way to accomplish it
[16:26:18] tbuehlmann: pankaj_, ryan wrote a guide for you: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
[16:29:19] pankaj_: tbuehlmann: Will it work successfully. Because after many attempts I am frustated with myself. Yesterday My OS cracked because of some problems.
[16:43:37] pankaj_: tbuehlmann: Following error occured while updating : The following packages have unmet dependencies:
[18:00:46] beingjohnm: I was looking at delayed_job but Heroku doesn't recommend it as it can cause strain on the databaes. They instead recommend a Redis-based queuing system. Curious if anybody had any thoughts on that?
[18:05:28] beingjohnm: I eventually want to move to Elastic Beanstalk as I have a bunch of AWS credits but can't focus on that now
[18:05:43] beingjohnm: whichever option would be easiest to switch is probably what I should go with
[18:07:30] kreantos: beingjohnm, the easiest imho is delayed_job. As this is no option, i would go for rescue
[18:11:22] cpruitt: kreantos: Good to hear you got it sorted. As far as active job max attempts, I’m not sure. What’s the default behavior? Aborts after first failure?
[18:12:44] kreantos: delayed_job stops after 25 attempts, and with delayed job it is pretty straight forward to set on job level the max_attempts
[18:13:40] kreantos: but i can't find a setting for ActiveJob, its a pity as I thought its pretty neat to keep it abstract :-/
[18:13:50] cpruitt: kreantos: Yeah I know DJ uses max attempts but I thought I remembered activejob just trying once. Not sure. I don't use it.
[18:14:55] cpruitt: & as for sidekiq I think (don’t use it either) that most of the non-core functionality available with the paid license is also available through additional gems. Least that’s what I recall from listening to the author on a podcast once.
[18:15:35] cpruitt: kreantos: Then I’d suspect that your delayed job config would be the place to set max attempts.
[18:18:21] matthewd: AJ gains some retry handling in 5.1. Individual adapters are always going to have more options, though.
[18:18:22] kreantos: I loved the idea that i just can xchange the backend behind ActiveJob (e.g. switch from delayed_job to resque)
[18:19:14] cpruitt: It’s a nice thought cause you can (in theory) just swap out your back end any time you want. But if the worst case is that you have to set up a new config for the back end, that doesn’t sound like that big a deal.
[18:20:56] cpruitt: kreantos: does ActJob still rquire you to start your worker processes directly or does it abstract that our too? Like, are you you still using bin/delayed_job or whatever?
[18:22:14] kreantos: Im using rake jobs:work locally and require 'capistrano/delayed_job' for capistrano
[18:23:57] cpruitt: kreantos: OK, so the thing is, you’re interacting with JelayedJob directly anyway. max_attempts is a config option for DJ. So trying to go through AJ to set it doesn’t make much sense. AJ isn’t really involved at that point. It’s DJ all the way through the process.
[18:24:22] workmad3: tbh, I find ActiveJob useful because it has a relatively simple interface and integrates with ActionMailer well for background sending... also the transparency for passing ActiveRecord objects around with GlobalID is pretty nice
[18:25:16] workmad3: changing backends isn't something I think of it for... similar to the fact that changing backends with ActiveRecord is 'possible' but almost never done, so all the practical advantages it provides are really what you use it for rather than that one rather esoteric use-case
[18:27:43] kreantos: I see, so option1 forget about ActiveJob and use DelayedJob only. option2 wait for 5.1
[18:27:47] cpruitt: workmad3: I see an advantage to having one consistent api across projects that might use various backends.
[18:28:35] cpruitt: kreantos: Or option 3, just set up your DJ config file if activejob defers to it anyway
[18:29:58] kreantos: i have jobs which need to be retried like forever, i have others, when they fail once they should never be retried
[18:31:32] cpruitt: kreantos: Hmmm…. I mean… you could manually query the jobs table & delete stuff. Or you could rescue errors and manually set failed_at for the job. I think.
[18:32:37] kreantos: cpruit, this sounds very hacky just for the sake of being able to use ActiveJob
[18:32:39] cpruitt: kreantos: Yeah, might need to wait for a rails update for that one unless you want to patch AJ somewhere
[18:34:06] cpruitt: ActiveJob is like anything else in rails. It’s fantastic as long as you’re using the tool for the use case it was meant to match. Sometimes you have problems you need to solve that the tool doesn’t (intend to) solve well. So you need to switch your tool.
[18:36:01] kreantos: at least i have a ton of options, thinking of doing the same in java gives me the shivers
[19:36:14] cek: need to build a predictible fixture with factorygirl . Want to supply an arg to create("factory)
[19:40:41] xangria: I'm working on a project for a restaurant and they want a booking system and CMS, can you recommend some gems or API please
[20:02:46] tbuehlmann: depending on what you want, have a look at traits (https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#traits) or setting attributes directly: create(:model, foo: 'bar')
[21:09:32] rubyonrails758: Hi All. I am having an issue where the same exact query takes >100ms when I run it as part of a larger method, but only 15 ms, when I run it by itself.
[21:09:36] rubyonrails758: PurchasePattern Load (106.9ms) SELECT "purchase_patterns".* FROM "purchase_patterns" WHERE "purchase_patterns"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
[21:09:56] rubyonrails758: PurchasePattern Load (15.8ms) SELECT "purchase_patterns".* FROM "purchase_patterns" WHERE "purchase_patterns"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
[21:43:00] fryguy: rubyonrails758: do you see similar performance characterstics when running each query directly using your RDBMS client? does exploring your query plan show anything interestingly different between the 2 queries? Is there disk caching in place?
[21:51:03] DoctorMonocular: rubyonrails758: also wondering about what fryguy asked, and am curious about the contents of the slow method
[22:02:43] Radar: dminuoso: https://github.com/pat/json_template_benchmarking/blob/master/OUTPUT.markdown
[22:15:23] dminuoso: Radar: This is interesting, seems to indicate that jbuilder is still the fastest solution.
[22:16:13] dminuoso: Radar: Though it's mildly amusing that even in case of my frontend components are usually functions or objects.
[23:41:02] wkoszek_: Do you guys know any Rails apps that are both open-source and have an active team that runs them as SaaS? (example: Discourse is an example)
[23:41:27] wkoszek_: I'm looking for good patterns for running migrations in production, once you have some clients' data inside of your app.