« Back to channel list

#RubyOnRails - 07 February 2019

« Back 1 day Forward 1 day »
[00:04:18] Fridtjof: has joined #RubyOnRails
[00:12:32] ariedler: has joined #RubyOnRails
[00:29:42] guyzmo: istrasci - yes, you can use or, but beware that using `or` can be tricky
[00:48:38] bruul: has joined #RubyOnRails
[01:04:39] gambl0r3: has joined #RubyOnRails
[01:05:14] kvda: has joined #RubyOnRails
[01:26:55] orbyt_: has joined #RubyOnRails
[01:58:17] akosednar: has joined #RubyOnRails
[02:27:01] Saukk: has joined #RubyOnRails
[02:46:32] blackmesa: is there a difference between Product.all.includes(:variants) and Product.includes(:variants)
[02:52:42] SteenJobs: has joined #RubyOnRails
[03:09:15] gambl0r3: has joined #RubyOnRails
[03:09:42] kvda: has joined #RubyOnRails
[03:15:38] jobewan: has joined #RubyOnRails
[03:16:25] DTZUZO: has joined #RubyOnRails
[03:24:17] wethu: has joined #RubyOnRails
[03:48:02] Technodrome: has joined #RubyOnRails
[04:10:43] braincrash: has joined #RubyOnRails
[04:39:58] SteenJobs: has joined #RubyOnRails
[04:44:05] srinidhi: has joined #RubyOnRails
[04:59:38] apparition: has joined #RubyOnRails
[04:59:49] NotSatoshi: has joined #RubyOnRails
[04:59:52] NotSatoshi: I am having some trouble getting my rails project stated. 'rake db:create' gives me some errors. I never gave the app mysql passwords.... am I supposed to?
[05:02:36] havenwood: NotSatoshi: See your: config/database.yml
[05:13:55] dionysus69: has joined #RubyOnRails
[05:17:47] NotSatoshi: So this is a fresh install, I am just trying to generate a controller and I am getting errors about active record not connecting with primary.... I am not certain I need a database yet
[05:18:25] NotSatoshi: specifically ' raise ConnectionNotEstablished, "No connection pool with '#{spec_name}' found." unless pool'....I get this when I try to view the website
[05:29:57] havenwood: NotSatoshi: Generate your app with a -O flag for a no DB setup.
[05:30:12] havenwood: -0, --skip-active-record
[05:30:26] NotSatoshi: I will eventually need db support though....
[05:31:08] havenwood: There's little difference. You can configure your db now or disable the db and re-add it later.
[05:37:03] srinidhi: has joined #RubyOnRails
[05:37:47] NotSatoshi: havenwood: thanks... figured it out... I guess my setup doesnt like the latest version of sqlite i
[05:40:34] v01d4lph4: has joined #RubyOnRails
[05:47:35] Milos: has joined #RubyOnRails
[06:05:05] srinidhi: has joined #RubyOnRails
[06:09:58] srinidhi: has joined #RubyOnRails
[06:17:50] v01d4lph4: has joined #RubyOnRails
[06:20:10] NotSatoshi: is there a way to have a segment of code run every x minutes in rails?
[06:20:27] valadares: has joined #RubyOnRails
[06:34:00] lexileo: has joined #RubyOnRails
[07:06:47] srinidhi: has joined #RubyOnRails
[07:14:19] beholders_eye: has joined #RubyOnRails
[07:24:34] reber: has joined #RubyOnRails
[07:43:40] Puffball: has joined #RubyOnRails
[08:23:34] Jervis_: has joined #RubyOnRails
[08:43:06] paranoicsan: has joined #RubyOnRails
[09:18:00] Technodrome: has joined #RubyOnRails
[09:29:54] Ergo: has joined #RubyOnRails
[10:12:10] conta: has joined #RubyOnRails
[10:14:52] sandstrom: has joined #RubyOnRails
[10:15:24] blackmesa: has joined #RubyOnRails
[10:19:32] blackmesa1: has joined #RubyOnRails
[10:23:07] za1b1tsu: has joined #RubyOnRails
[10:49:44] conta: has joined #RubyOnRails
[11:28:06] silent_freak: has joined #RubyOnRails
[11:32:49] paranoicsan: has joined #RubyOnRails
[11:36:15] v01d4lph4: has joined #RubyOnRails
[11:36:41] v01d4lph4: has joined #RubyOnRails
[11:37:36] v01d4lph4: has joined #RubyOnRails
[11:46:11] valadares: has joined #RubyOnRails
[11:50:15] lankanmon: has joined #RubyOnRails
[11:55:08] ariedler: has joined #RubyOnRails
[11:56:51] silent_freak: has joined #RubyOnRails
[11:58:51] Guest16678: has joined #RubyOnRails
[12:04:27] blackmesa1: has joined #RubyOnRails
[12:26:46] blackmesa: has joined #RubyOnRails
[12:28:51] catbusters: has joined #RubyOnRails
[12:30:02] Technodrome: has joined #RubyOnRails
[12:31:07] catbusters: I've a form with the GET method, and it overwrites all the other query parameters on submit. How can I stop that from happening?
[13:21:15] dionysus69: catbusters: submit a gist online ^.^
[13:26:23] catbusters: https://dpaste.de/XTFw
[13:26:52] catbusters: I've tried the two snippets and it still removes all existing query params
[13:36:41] blackmesa: hi all. When I want to validate uniquness within a scope, do I have to do this vice versa like this?
[13:36:41] lwwwr: has joined #RubyOnRails
[13:36:45] blackmesa: validates :column1 , uniqueness: { scope: :column2_id }
[13:36:47] blackmesa: validates :column2 , uniqueness: { scope: :column1_id }
[13:37:07] lwwwr: Hi. Can anyone help me with "apartment"-gem?
[13:38:08] lwwwr: has joined #RubyOnRails
[13:40:11] roshanavand: has joined #RubyOnRails
[13:41:14] catbusters: lwwwr: What problem are you facing?
[13:45:18] beholders_eye: has joined #RubyOnRails
[13:47:16] beholders_eye: has joined #RubyOnRails
[13:47:54] v01d4lph4: has joined #RubyOnRails
[13:49:08] lwwwr: Have an issue with "apartmen"-gem, problem When i perform create in "Document"-table, "Document" sequence from a different tenant schema is sometimes used. This in turn may cause duplicate key errors. But if half of issue. When i switch schema name(in console) by "Apartment::Tenant.switch!(some_schema)", "sequence_name" doesnt reset for some model.Link to example. https://hastebin.com/ekegimohen.php How can i fix it?
[13:50:50] srinidhi: has joined #RubyOnRails
[14:06:36] blackmesa: has joined #RubyOnRails
[14:09:55] alan_w: has joined #RubyOnRails
[14:23:27] srinidhi: has joined #RubyOnRails
[14:24:35] Souvent22: has joined #RubyOnRails
[14:25:25] bruul: has joined #RubyOnRails
[14:32:18] Technodrome: has joined #RubyOnRails
[14:33:10] FastJack: has joined #RubyOnRails
[14:36:03] beholders_eye: has joined #RubyOnRails
[14:37:45] jlebrech: has joined #RubyOnRails
[14:39:02] jlebrech: i find my routes.rb to be over complex, is there a nicer way to do it? sick of POST, GET, only: everywhere. 247 lines of code
[14:55:25] status402: has joined #RubyOnRails
[15:01:21] planigan: has joined #RubyOnRails
[15:01:24] MrCrackPotBuilde: has joined #RubyOnRails
[15:01:38] ams__: has joined #RubyOnRails
[15:10:55] Tempesta: has joined #RubyOnRails
[15:14:11] b6b: has joined #RubyOnRails
[15:14:37] Axsuul: has joined #RubyOnRails
[15:14:53] trif: has joined #RubyOnRails
[15:20:15] blackmesa: Hi all. I have alot of .size and .count method usages in my code. Is the counter_cache option a useful alternative that works well?
[15:28:15] valadares: has joined #RubyOnRails
[15:30:37] conta: has joined #RubyOnRails
[15:31:41] regedit: has joined #RubyOnRails
[15:35:29] conta: has joined #RubyOnRails
[15:42:30] Souvent22: has joined #RubyOnRails
[15:44:00] conta: has joined #RubyOnRails
[15:48:10] srinidhi: has joined #RubyOnRails
[15:51:03] conta: has joined #RubyOnRails
[15:57:45] krawchyk: has joined #RubyOnRails
[16:00:27] SteenJobs: has joined #RubyOnRails
[16:03:34] valadares: has joined #RubyOnRails
[16:17:23] roshanavand1: has joined #RubyOnRails
[16:17:27] bruul: has joined #RubyOnRails
[16:19:26] roshanavand1: has joined #RubyOnRails
[16:29:18] korgul: has joined #RubyOnRails
[16:31:12] barhum2013: has joined #RubyOnRails
[16:45:33] korgul: Hi there, I am new to this channel and brand new to Ruby on Rails. I am working on a gist right now for a problem I am having. I will share the gist link and maybe someone here has had this problem before and can help me out.
[16:47:45] blackmesa: has joined #RubyOnRails
[16:53:37] korgul: Here is my gist. Summary = cannot initiate a new project without errors. <script src="https://gist.github.com/korgul/0ae7f19bd27cdbaea86acf27851d958c.js"></script>
[16:55:01] srinidhi: has joined #RubyOnRails
[17:00:06] za1b1tsu: has joined #RubyOnRails
[17:02:54] _N_I_X_O_N_: has joined #RubyOnRails
[17:03:15] blackmesa: has joined #RubyOnRails
[17:05:58] blackmesa1: has joined #RubyOnRails
[17:07:58] agent_white: has joined #RubyOnRails
[17:12:33] havenwood: blackmesa1: Yeah, counter_cache works well for avoid DB counts. IIR, the only issue I noticed was it can be odd with tests.
[17:14:14] _N_I_X_O_N_: has joined #RubyOnRails
[17:16:53] _N_I_X_O_N_: has joined #RubyOnRails
[17:17:00] v01d4lph4: has joined #RubyOnRails
[17:18:39] orbyt_: has joined #RubyOnRails
[17:19:17] Dbugger: has joined #RubyOnRails
[17:23:12] maryo: has joined #RubyOnRails
[17:24:55] valadares: has joined #RubyOnRails
[17:36:41] [Butch]: has joined #RubyOnRails
[17:38:29] Saukk: has joined #RubyOnRails
[17:50:30] jane_booty_doe: has joined #RubyOnRails
[17:59:16] old_relik: has joined #RubyOnRails
[17:59:41] maryo: has joined #RubyOnRails
[17:59:59] old_relik: I'm trying to write a rails (ar) query for this https://dpaste.de/mBjc
[18:00:14] old_relik: finding it very hard to do it idiomatically, could someone help?
[18:11:30] old_relik: I currently have this: https://dpaste.de/UMJF
[18:11:47] old_relik: but the join query is not building correctly
[18:13:26] sandstrom: has joined #RubyOnRails
[18:14:41] elcontrastador: has joined #RubyOnRails
[18:22:25] MrCrackPot: has joined #RubyOnRails
[18:23:41] v01d4lph4: has joined #RubyOnRails
[18:24:04] MrCrackPotBuilde: has joined #RubyOnRails
[18:25:51] NotSatoshi: has joined #RubyOnRails
[18:26:22] NotSatoshi: I want to execute code immediatly after the website is running, where should I put the code?
[18:26:43] ariedler: has joined #RubyOnRails
[18:27:43] MrCrackPotBuilde: NotSatoshi: do you mean when you upload the site to something like heroku and once built then run some code ??
[18:28:35] NotSatoshi: MrCrackPotBuilde: no, I have some code that takes a while to complete, and I want to be able to access the website before it executes
[18:28:57] NotSatoshi: I want the code to run after the 'listening' message
[18:29:09] conta: has joined #RubyOnRails
[18:29:47] Souvent22: has joined #RubyOnRails
[18:30:14] MrCrackPotBuilde: You need to check with the hosting service your using
[18:31:12] NotSatoshi: I am running the code locally on my machine...no host
[18:33:03] MrCrackPotBuilde: Try putting it inside your config.ru
[18:35:04] havenwood: NotSatoshi: Say more about what you're doing? What triggers the code running? What happens when it completes running?
[18:36:05] NotSatoshi: I am running a local news reader program.... my view displays content that the program has found.... when the program starts it should immediatly look for new news articles
[18:36:29] NotSatoshi: looking for news takes a while and I would like to see old news while I wait for that to complete
[18:36:32] MrCrackPotBuilde: probably a good idea to mention which web server your using puma passenger etc
[18:36:57] defsdoor: has joined #RubyOnRails
[18:37:07] MrCrackPotBuilde: for that couldnt you use caching ??
[18:38:14] NotSatoshi: Currently I am putting the code inside a config, but the webserver does not start until it completes
[18:38:22] MrCrackPotBuilde: cache the old searches from im guessing the api your using when you load the page either have a button or auto search and update function little like the bbc news app
[18:38:36] NotSatoshi: It is caching...that isn't the problem
[18:38:45] NotSatoshi: the problem is the server wont start until it completes
[18:38:53] havenwood: NotSatoshi: Are you using a worker queue?
[18:40:15] NotSatoshi: I don't know what that means
[18:40:24] NotSatoshi: I have code inside initialize/scheduler
[18:40:33] NotSatoshi: config/initialize/scheduler.rb
[18:40:51] havenwood: NotSatoshi: https://guides.rubyonrails.org/active_job_basics.html
[18:41:40] havenwood: NotSatoshi: A common pattern is to create a rake task that runs a job when your app starts. I'd suggest reading the Active Job basics Rails docs above first.
[18:41:48] NotSatoshi: cool, thanks
[18:42:33] havenwood: I suppose you could use an initializer to run the task. Hmm.
[18:44:09] havenwood: NotSatoshi: If you're not using Redis, consider the Sucker Punch gem, which is one of many that are supported by Active Job.
[18:44:13] havenwood: NotSatoshi: https://github.com/brandonhilkert/sucker_punch#sucker-punch
[18:45:57] guyzmo: hi, I got a complex schema, basically I got : Node from which inherits Leaf and CompositeLeaf, where composite contains a list of leaves. I have defined a bunch of scopes (which are similar, but are mostly different, basically used for filtering) on both Leaf and CompositeLeaf so I can list them in a UI. Now I want to use Node to list all Leaf and CompositeLeaf stuff. I have managed to use union (using
[18:45:59] guyzmo: active_record_union), where I can call a scope on Node, it calls the scope on both Leaf and LeafComposite. But now I'm struggling with chaining the scopes efficiently.
[18:48:07] krawchyk: has joined #RubyOnRails
[18:48:45] guyzmo: (or at all)
[18:49:37] guyzmo: the way I'm handling the union for now is a mess of merge+union, and the merge is aliased as `nodes`, which when chained conflicts with further scopes
[18:50:52] Souvent22: has joined #RubyOnRails
[18:53:50] guyzmo: so one way to handle this would be to make all the successive scope calls piled and applied respectively to each side of the union. i.e.: Node.scope1.scope2 would call Leaf.scope1.scope2 union LeafComposite.scope1.scope2
[18:55:41] guyzmo: another way would be for me to write all scopes on node as pure SQL, which will be highly unmaintainable and another way would be to avoid all joins by making all values needed for filtering local to the Node class, which would be prone to errors/issues and make migrations harder
[19:00:09] guyzmo: so my question would what directions would you people take in this situation?
[19:01:26] guyzmo: I'm getting to a point where I believe my options are to make complex hacks or complex hacks, but not getting the code simpler, so I feel something's wrong
[19:01:38] blackmesa1: has joined #RubyOnRails
[19:11:41] valadares: has joined #RubyOnRails
[19:17:56] gambl0re: has joined #RubyOnRails
[19:25:06] Aherin: has joined #RubyOnRails
[19:30:24] orbyt_: has joined #RubyOnRails
[19:34:22] conta: has joined #RubyOnRails
[19:35:12] lxsameer: has joined #RubyOnRails
[20:04:51] Technodrome: has joined #RubyOnRails
[20:05:23] segy: has joined #RubyOnRails
[20:06:52] guyzmo: ok, I rode back home, and had a 'simpler' idea: within the method I have that builds a query by associating the scopes depending on parameters given through the API, I instead make a list of those, and then I inject them on the class. There I can either do a normal chain of scopes, or build the two chains, and make the union after
[20:17:27] bruul: has joined #RubyOnRails
[20:20:32] reber: has joined #RubyOnRails
[20:22:24] SteenJobs: has joined #RubyOnRails
[20:23:36] lexileo: has joined #RubyOnRails
[20:27:33] ariedler: has joined #RubyOnRails
[20:27:34] krawchyk: has joined #RubyOnRails
[20:29:10] cnsvc: has joined #RubyOnRails
[20:34:58] Fernando-Basso: has joined #RubyOnRails
[20:35:13] Souvent22: has joined #RubyOnRails
[20:44:39] orbyt_: has joined #RubyOnRails
[20:48:34] Dbugger: has joined #RubyOnRails
[21:00:20] Souvent22: has joined #RubyOnRails
[21:15:31] conta: has joined #RubyOnRails
[21:20:23] uks: has joined #RubyOnRails
[21:22:05] krawchyk: has joined #RubyOnRails
[21:35:50] blackmesa1: has joined #RubyOnRails
[21:47:14] planigan: has joined #RubyOnRails
[22:03:15] Souvent22_: has joined #RubyOnRails
[22:18:13] orbyt_: has joined #RubyOnRails
[22:28:20] ariedler: has joined #RubyOnRails
[22:28:59] crankharder: has joined #RubyOnRails
[22:29:34] crankharder: has joined #RubyOnRails
[22:30:53] crankharder: has joined #RubyOnRails
[22:32:12] crankharder: has joined #RubyOnRails
[22:32:17] kvda: has joined #RubyOnRails
[22:40:51] octos: has joined #RubyOnRails
[23:01:12] newplasticideas: has joined #RubyOnRails
[23:06:20] newplasticideas: Hi folks. I'm looking into using AMS to render JSON, and we have one instance where a response body needs to include the path to a particular record, which I understand to be an inaccessible attribute from the model layer. I was wondering if anyone has any experience using AMS to serialize JSON, but then dynamically populating one json field with, say, a jbuilder template that can render data exposed in the controller. As
[23:06:52] newplasticideas: ...good practise - how might this be done?
[23:12:32] orbyt_: has joined #RubyOnRails
[23:15:03] ariedler: has joined #RubyOnRails
[23:27:17] Xiti: has joined #RubyOnRails
[23:44:50] orbyt_: has joined #RubyOnRails