#RubyOnRails - 05 April 2018
« Back 1 day Forward 1 day »
[05:49:54] cam27: Experience, keep me developing, maybe a job. (I got a job in a Casino working on slot machines) So I don’t want to get reusty from coding
[05:51:18] Radar: OK, well I can provide the project and some advice on what you can do to improve if you can provide the code :)
[05:52:15] cam27: I’ll try, I read about Rspec and all of that, but never been asked to do it, but I’m sure I can
[05:53:02] cam27: Actually I have some Lynda videos on it (using let and things) RSpec, Cucumber, etc
[06:57:31] dionysus69: tbuehlmann: that's what I wanted to ask about, the gems, which ones should I give shot to, thing is I am starting a new project and i am making a bit of a research before I get started.
[06:58:46] dminuoso: tbuehlmann: Look you can make cool websites by just adding a bunch of random stuff to your Gemfile.
[06:59:05] dionysus69: and as for webpack, it is still vague on what it does exactly and what rails parts would become obsolete if I decide to use it. for example, uglifier would not work with webpack, other parts maybe?
[06:59:07] tbuehlmann: I don't use any administration gem, I always recommend implementing that yourself
[06:59:40] dminuoso: Some people are under the mistaken impression that you dont need to have coding skills to write websites.
[06:59:47] dionysus69: ok done, I have done that actually for my past app, I am just working on app that some studio made while ago, and it uses activeadmin
[07:02:26] tbuehlmann: I have some must-have gems that I always use, depending on what's needed though. like, I always add pry-rails, or slim (when in need of a template engine), or rspec-rails
[08:58:26] arthurwozniak: Hi guys, I have a problem with attaching after_create_commit callback to my model. Code snippet is here https://pastebin.com/w64DhhSv . Problem is, that in controller I'm updating Customer class and its related orders (connecctable only by customer hash due to GDPR, so I have to update all of them). IMHO this should be done in transaction, as written in the code.
[08:59:34] arthurwozniak: Another thing is, that I want to run specific action after creating Customer record. Again, I assume that creating user can fail, so I think it should be called in after_create_commit callback.
[09:00:48] arthurwozniak: Registering action to mentioned callback raises rollback when calling update_all on Customer instance. When I change callback to after_create (which I don't want to) or remove it completely, no rollback or error is raised
[09:01:47] arthurwozniak: Unfortunatelly I'm stucked with debugging and don't know how to move on with this. Yes, it can be "workarounded", but I think that approach with using after_create_commit callback is correct
[15:34:31] beingjohnm: Been pulling my hair out with something for the past couple of hours: https://gist.github.com/global001/13c241f57a74be0b46f669b76dca409b
[16:10:02] beingjohnm: anybody want to help a brother keep his hair and let me know while this view loop prints out what is inside an if statement regardless? https://gist.github.com/global001/13c241f57a74be0b46f669b76dca409b
[16:32:15] kevinburke: So, I'm working on a Rails app for the first time (yay), and I notice it's taking about 20-25 seconds for Rails to start up (boo). Say I wanted to figure out which components were taking the most time in startup, and/or print out e.g. "loading models - 5 seconds", "loading controllers - 5 seconds" etc.
[16:34:00] thomasfedb: kevinburke, if it's a vanilla app it's probably not something you're going to be able to reduce
[16:34:31] kevinburke: I guess 20 seconds is a long time to wait to get feedback when e.g. you change a test file. in a Go app I wrote recently the entire suite of database tests compiled and completed in about 1 second.
[16:37:14] thomasfedb: kevinburke, you can use spring to keep the framework loaded and just reload code for each test run
[16:38:25] MasterAsia: Is there a difference between module X class Ycontroller end end vs class x::ycontroller end
[16:39:41] thomasfedb: masterasia, though I think `class A::B; end` will fail if A doesn't already exist
[16:40:17] thomasfedb: masterasia, though Rails will handle that for you when loading nested files methinks
[16:51:06] markoa: hi everyone, I just co-published my first (free) ebook and it's about outside-in testing, check it out on https://semaphoreci.com/ebooks/rails-testing-handbook
[16:52:42] beingjohnm: I did. And it seems to be testing the even/odd correctly based on the debugs. The issue seems to be a quirk of views or something.
[16:53:02] beingjohnm: I feel like I came across this a couple of years ago but can't remember exactly what the issue was.
[16:57:33] beingjohnm: that resulted in some strange behaviour. It put all of them on one row (inside of <tr></tr>) with the other four rows appearing empty and outside of the table
[16:59:53] thomasfedb: beingjohnm, maybe try compiling your template to ruby code to see what's going on: https://ruby-doc.org/stdlib-2.5.0/libdoc/erb/rdoc/ERB.html
[18:49:04] CGibsonmm: goodday I Have a user 1:1 user_profile User is handled by devise I am trying to create the User_profile, with default params along with the create of the USER, I tried a before_create in the user model setting @profile = create_user_profile!(default_parmas) I am getting a stack lvl too deep error when I run RSPEC
[18:51:47] CGibsonmm: When I run through rails s and try to create my user It attempts to beginnig the transaction and calls CACHE User Exists (0.0ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "email@example.com"], ["LIMIT", 1]] about 100 times and then fails, Any help with why this is happining would be awesome
[19:41:27] kevinburke: can I ask a dumb question? i've been running dtrace on my executing ruby process
[19:41:34] kevinburke: a file in globalid-0.3.7/lib/global_id/global_id.rb calls "require 'global_id/uri/gid'". the file we are looking for is adjacent, in globalid-0.3.7/lib/global_id/uri/gid.rb. but instead of looking there, we stat all ~300 rubygems for <gemname>/lib/global_id/uri/gid.rb
[19:41:57] kevinburke: that seems... slow? surely there is a flag or something that says "look in the currently required gem first"
[19:52:52] istrasci: For a has_one/has_many with conditions, what are the pros/cons of putting the conditions directly on the association vs. making a scope on the associated class and using that?
[20:13:42] arooni: for connecting to a remote mysql database; must i specify the socket and the port number or does providing the socket enough
[21:27:41] nemesit|znc: e.g. from a new york to a form with a city field that then gets "new york" passed to it?