« Back to channel list

#RubyOnRails - 03 July 2017

« Back 1 day Forward 1 day »
[00:05:46] jhfisc: has joined #RubyOnRails
[00:43:57] exadeci: has joined #RubyOnRails
[00:47:56] cam27: has joined #RubyOnRails
[00:51:15] aperkins81: has joined #RubyOnRails
[00:54:25] quazimodo: has joined #RubyOnRails
[00:58:56] sevenseacat: has joined #RubyOnRails
[01:02:27] jhfisc: has joined #RubyOnRails
[01:08:50] jhfisc: has joined #RubyOnRails
[01:11:38] exadeci: Hello, does refile accept 2 attachments fields in one model?
[01:12:16] exadeci: It my second attachment gets uploaded and it's id is saved in the db but it won't load a I get a 301 when trying to access it
[01:13:19] jhfisc: has joined #RubyOnRails
[01:18:24] jhfisc: has joined #RubyOnRails
[01:38:28] Technodrome: has joined #RubyOnRails
[01:48:29] fschuindt: has joined #RubyOnRails
[01:51:45] jhfisc: has joined #RubyOnRails
[01:57:31] umaaji: has joined #RubyOnRails
[01:57:45] jhfisc: has joined #RubyOnRails
[02:02:49] gambl0re: has joined #RubyOnRails
[02:03:34] gambl0re: has joined #RubyOnRails
[02:03:50] jhfisc: has joined #RubyOnRails
[02:05:28] CustosLimen: has joined #RubyOnRails
[02:09:34] brent__: has joined #RubyOnRails
[02:09:42] jhfisc: has joined #RubyOnRails
[02:10:21] irishfromua: has joined #RubyOnRails
[02:15:44] jhfisc: has joined #RubyOnRails
[02:21:56] Jameser: has joined #RubyOnRails
[02:24:27] jhfisc: has joined #RubyOnRails
[02:42:57] Technodrome: has joined #RubyOnRails
[02:53:42] irishfromua: has joined #RubyOnRails
[03:09:47] delgiudices: has joined #RubyOnRails
[03:14:21] Technodrome: has joined #RubyOnRails
[03:16:18] knight33: has joined #RubyOnRails
[03:17:56] jhfisc: has joined #RubyOnRails
[03:23:02] jhfisc: has joined #RubyOnRails
[03:30:35] quazimodo: has joined #RubyOnRails
[03:37:04] jhfisc: has joined #RubyOnRails
[03:38:43] delgiudices: has joined #RubyOnRails
[03:42:33] jhfisc: has joined #RubyOnRails
[03:52:38] jhfisc: has joined #RubyOnRails
[03:54:56] kies: has joined #RubyOnRails
[04:10:43] kies: has joined #RubyOnRails
[04:22:18] delgiudices: has joined #RubyOnRails
[04:25:18] delgiudices: has joined #RubyOnRails
[04:46:49] mytrile: has joined #RubyOnRails
[04:50:06] mytrile: Hi, is it possible to validate boolean attribute based on associated object, say only one employee can be primary_contact (primary_contact is boolean) - https://gist.github.com/mytrile/c4b66b27ad1d66ae4b8b6c1350de22bf
[04:52:28] delgiudices: has joined #RubyOnRails
[04:53:57] bratsche: has joined #RubyOnRails
[04:55:42] ayonkhan: has joined #RubyOnRails
[05:29:30] KeyJoo: has joined #RubyOnRails
[05:36:55] conta: has joined #RubyOnRails
[05:50:22] jhfisc: has joined #RubyOnRails
[05:54:17] dminuoso: Good morning. Using the default cookie store, where does Rails hold the necessary information to validate client cookies?
[05:55:12] dminuoso: I just realized, it's just the secret key.
[05:56:30] jhfisc: has joined #RubyOnRails
[06:04:30] alfie: has joined #RubyOnRails
[06:06:57] umaaji: has joined #RubyOnRails
[06:10:01] brent__: has joined #RubyOnRails
[06:10:12] choke_: has joined #RubyOnRails
[06:29:59] jhfisc: has joined #RubyOnRails
[06:37:33] jhfisc: has joined #RubyOnRails
[06:48:27] jhfisc: has joined #RubyOnRails
[06:51:18] jhfisc: has joined #RubyOnRails
[06:57:42] jhfisc: has joined #RubyOnRails
[06:58:08] arBmind: has joined #RubyOnRails
[07:08:05] jhfisc: has joined #RubyOnRails
[07:20:52] jhfisc: has joined #RubyOnRails
[07:23:14] Nimzowitsch: has joined #RubyOnRails
[07:23:20] Nimzowitsch: good morning all
[07:23:43] lessless: has joined #RubyOnRails
[07:25:11] Nimzowitsch: I have been asked to implement a confirmation step for some of the workflows in our app. The workflows are currently kicked off by user, with sufficient permissions, clicking a button. Now I need to add a confirmation step whereby the user has to provide the name of whoever approved the action. So on a click I should show a pop-up (I think I'll use bootstrap's popover) and there's gonna be an input field and a button. When
[07:25:41] Nimzowitsch: ... with the workflow. If we were using a front-end framework that would be a trivial thing to do - just build a component and send through whatever contextual data you want along with the action
[07:26:05] Nimzowitsch: However, we're using vanilla rails with .haml. I have been reading up on how to do this and think partials kind of solve the problem
[07:26:36] Nimzowitsch: - content_for :confirm_step do
[07:27:01] Nimzowitsch: % the_button_that's_currently_in_use
[07:27:23] Nimzowitsch: is that a sane approach or is there a component of Rails that I should use instead but I'm unaware of
[07:29:01] DoubleMalt: has joined #RubyOnRails
[07:29:41] xall: has joined #RubyOnRails
[07:33:45] Ergo: has joined #RubyOnRails
[07:35:06] timdotrb: has joined #RubyOnRails
[07:35:51] lessless: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[07:36:16] DoubleMalt: has joined #RubyOnRails
[07:36:48] sathish: has joined #RubyOnRails
[07:38:24] sathish: Hi, I am working on a savings_scheme app, I want to only create the savings scheme after the initial payment. I have the Savings Scheme CRUD ready. How do I redirect to the Payment gateway and collect the payment before creating the savings scheme. What are some usual flows to acheive the same. Thanks.
[07:44:44] ElektroBug: has joined #RubyOnRails
[07:45:44] ElektroBug: how can I set cloudflare as cdn for static assets. webapp is hosted on heroku
[07:45:57] ElektroBug: Any help will be much appreciated
[07:47:11] dionysus69: has joined #RubyOnRails
[07:53:51] jhfisc: has joined #RubyOnRails
[07:55:50] xhoy: why wouldn't you?
[07:56:01] xhoy: ElektroBug: its just the url your are using for the assetpipeline
[07:59:14] ElektroBug: xhoy: More like how can i send the data to the cloudflare from rails app and set dynamic url for them in the views which is done using the stylesheet_link_tag etc
[07:59:42] xhoy: you dont?
[07:59:46] jhfisc: has joined #RubyOnRails
[07:59:57] xhoy: or you like to change your assets url?
[08:00:16] xhoy: ElektroBug: http://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html
[08:00:31] xhoy: ElektroBug: http://guides.rubyonrails.org/asset_pipeline.html
[08:00:42] xhoy: ElektroBug: and ofcz you need to setup cloudflare
[08:01:28] ElektroBug: xhoy: let me check out the likns and get back if still having trouble
[08:04:00] rofiquzzaki: has joined #RubyOnRails
[08:05:15] ElektroBug: xhoy: thanks these helped me with my problem, i was searching for problem in wrong way
[08:07:05] mikecmpbll: has joined #RubyOnRails
[08:10:51] ascarter: has joined #RubyOnRails
[08:13:20] Qchmqs__: has joined #RubyOnRails
[08:14:21] Pumukel: has joined #RubyOnRails
[08:27:08] jhfisc: has joined #RubyOnRails
[08:29:25] ferr: has joined #RubyOnRails
[08:30:33] lxsameer: has joined #RubyOnRails
[08:31:46] Tempesta: has joined #RubyOnRails
[08:32:59] jhfisc: has joined #RubyOnRails
[08:33:15] rietta: has joined #RubyOnRails
[08:36:37] jhfisc: has joined #RubyOnRails
[08:44:52] lxsameer: has joined #RubyOnRails
[08:49:51] marr: has joined #RubyOnRails
[09:03:41] srinidhi: has joined #RubyOnRails
[09:04:40] Pumukel: has joined #RubyOnRails
[09:07:22] wethu: has joined #RubyOnRails
[09:07:42] jhfisc: has joined #RubyOnRails
[09:08:01] bzf: has joined #RubyOnRails
[09:08:34] bzf: When running 'rails db:migrate' after upgrading our application to Rails 5 I got a diff in schema.rb, 'create_table "actions", id: :integer, default: %q{nextval('actions_id_seq1'::regclass)}
[09:08:56] bzf: Does anyone have a clue why this happened?
[09:10:01] brent__: has joined #RubyOnRails
[09:13:44] jhfisc: has joined #RubyOnRails
[09:18:35] arBmind: has joined #RubyOnRails
[09:19:07] cseder: has joined #RubyOnRails
[09:19:44] jhfisc: has joined #RubyOnRails
[09:27:13] wethu: has joined #RubyOnRails
[09:27:43] jhfisc: has joined #RubyOnRails
[09:28:44] ayonkhan: has joined #RubyOnRails
[09:31:04] tbuehlmann: matthewd: I like the require_relative idea to go up the directory and down again for readability. hadn't thought of that before
[09:31:53] TvL2386: has joined #RubyOnRails
[09:32:33] dminuoso: tbuehlmann: huh?
[09:33:02] TvL2386: hey guys, I'm trying to get devise_ldap_authenticatable to work with Active Directory. The logger outputs that it is able to find 1 match (LDAP: LDAP search yielded 1 matches). This is great
[09:33:09] jhfisc: has joined #RubyOnRails
[09:33:24] TvL2386: I also enabled config.ldap_create_user=true in devise.rb hoping devise will create a user
[09:33:49] TvL2386: however, when it does try to create a user, it does not fill in any User attributes causing validators to fail
[09:34:37] tbuehlmann: dminuoso: https://github.com/rails/rails/pull/29638#issuecomment-312426035
[09:35:04] TvL2386: If devise is able to find a user in AD, it should be able to populate a new User object. I probably need to do something, but I don't know what
[09:35:37] dminuoso: TvL2386: Ah.
[09:37:37] TvL2386: dminuoso: Ah.?
[09:38:01] dminuoso: TvL2386: Yes.
[09:38:36] TvL2386: dminuoso: what do you mean by that?
[09:41:39] dminuoso: TvL2386: This is supposed to confuse the hell out of you and tbuehlmann, while I kick back.
[09:42:05] lessless: has joined #RubyOnRails
[09:42:08] dminuoso: Or you can assume that my attempt to use "t<tab>" was foiled by you talking last (and thus making your name the first priority)
[09:42:39] NeutronStarr: has joined #RubyOnRails
[09:43:10] ayonkhan_: has joined #RubyOnRails
[09:44:17] TvL2386: not loving devise here...
[09:44:31] TvL2386: probably overkill as well for AD auth.
[09:44:41] TvL2386: I just thought it would be very easy to implement
[09:49:30] lupine: it's a bit of a hydra
[09:54:28] xiljin: has joined #RubyOnRails
[09:55:47] ur5us: has joined #RubyOnRails
[10:01:42] jhfisc: has joined #RubyOnRails
[10:03:59] sekmo: has joined #RubyOnRails
[10:04:58] DoubleMalt: has joined #RubyOnRails
[10:07:13] jhfisc: has joined #RubyOnRails
[10:12:05] arup_r: has joined #RubyOnRails
[10:13:54] Pumukel: has joined #RubyOnRails
[10:15:53] jhfisc: has joined #RubyOnRails
[10:20:07] dminuoso: So here is a question.. an action is not automatically wrapped in a database transaction.. is it? :D
[10:20:27] sevenseacat: dont think so.
[10:22:26] jhfisc: has joined #RubyOnRails
[10:22:38] dminuoso: sevenseacat: I have the case where I'm doing: `ids = @foo.relation.ids; if @foo.save; Foo.sync_ct!(ids); end` and I have every indication that there's some bizarre race condition, where the database interaction that Foo.sync_ct! triggers does not see the changes by @foo.save yet.
[10:22:47] dminuoso: Not always anyway.
[10:23:10] dminuoso: Beginning to slowly wonder whether I'm missing something.
[10:25:42] jhfisc: has joined #RubyOnRails
[10:27:17] quazimodo: has joined #RubyOnRails
[10:29:38] sekmo: hi all! :- ) Now that ruby-forum.com is no more active, which forum will replace it?
[10:31:42] jhfisc: has joined #RubyOnRails
[10:32:55] ariejan: has joined #RubyOnRails
[10:33:50] AzaToth: has joined #RubyOnRails
[10:34:21] ariejan: Hi. Running a rails 5.0.1 project where, in Jbuilder views, asset_url will not use config.action_controller.asset_host. Worse, the `config` Actionview's AssetUrlHelper uses is empty. Any ideas on how to troubleshoot this further?
[10:37:31] arup_r: sekmo: only mailing list :D
[10:37:39] jhfisc: has joined #RubyOnRails
[10:40:55] jhfisc: has joined #RubyOnRails
[10:43:24] timdotrb_: has joined #RubyOnRails
[10:46:21] jhfisc: has joined #RubyOnRails
[10:55:45] jhfisc: has joined #RubyOnRails
[11:00:02] drale2k_: has joined #RubyOnRails
[11:01:57] cseder: has joined #RubyOnRails
[11:02:47] loechel: has joined #RubyOnRails
[11:03:44] bratsche: has joined #RubyOnRails
[11:05:11] ur5us: has joined #RubyOnRails
[11:05:25] arBmind: has joined #RubyOnRails
[11:12:03] DoubleMalt: has joined #RubyOnRails
[11:13:03] quazimodo: has joined #RubyOnRails
[11:19:44] jhfisc: has joined #RubyOnRails
[11:23:32] delgiudices: has joined #RubyOnRails
[11:26:23] drale2k_: has joined #RubyOnRails
[11:40:01] shotbug: has joined #RubyOnRails
[11:44:40] shilon: has joined #RubyOnRails
[11:48:23] shilon: Hello railers. I’m trying to create a payment system, I have a range slider from 5 to 50 with 5 steps. I have a hidden_field that gets the current value of the rangeslider. I want multiply that param by the value of my stipe subscription. I can’t pass the dynamic slider params[:value] to my controller. Anyone knows how can I do this? Thank you.
[11:48:51] universa1: Shilon: why can't you pass the value to your controller?
[11:49:03] shilon: universa1: Its always nil
[11:49:10] shilon: I’m trying this
[11:49:13] universa1: Shilon: !code
[11:49:13] helpa: Shilon: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[11:49:29] shilon: universa1: ok
[11:51:05] shilon: universa1: https://gist.github.com/jamesalbuquerque/83489d5bef74b40d8032b4b87ea0ee07
[11:52:39] universa1: Shilon: https://gist.github.com/jamesalbuquerque/83489d5bef74b40d8032b4b87ea0ee07#file-pricing-coffee-L7
[11:52:51] universa1: Shilon: have you checked that data.from is actually the value you want?
[11:54:13] shilon: universa1: this is working <%= text_field_tag :amount, value: params[:slider] %>
[11:54:25] shilon: It updates the value of the field when I move the rangeslider
[11:54:26] universa1: Shilon: define: this is working.
[11:54:40] shilon: it changes the input value to the same as the slider
[11:55:07] universa1: Shilon: so, what does it submit then? check in the browser -> network tab and in the rails log
[11:55:42] universa1: Shilon: and iirc: $result.value = data.from
[11:56:47] shilon: universa1: I don’t want to submit. I want to multiply the param of the range slider with my @amount.
[11:56:55] shilon: and show it
[11:57:31] universa1: Shilon: so?
[11:57:47] ur5us: has joined #RubyOnRails
[11:58:00] universa1: Shilon: client side? server side?
[11:59:35] shilon: universa1: don’t know
[11:59:51] universa1: what? you don't know where you want to multiply the stuff? ---
[11:59:59] arBmind: has joined #RubyOnRails
[12:00:12] shilon: the range slider is the number of accounts. You can buy 5, 10, 15,etc. And all account have the same price...
[12:00:28] shilon: I want to pass the number of accounts to stripe
[12:00:36] shilon: so this server side
[12:01:08] shilon: but I don’t know if I need to know the value on the server side, I think thats something stripe might do right?
[12:01:22] universa1: Shilon: no clue how stripe actually works...
[12:01:48] universa1: Shilon: but i guess there is support for having orders with multiple of things...
[12:02:02] shilon: hum… They have quantity
[12:02:35] shilon: but still, to show the result “live”, I need to do it on the client side right?
[12:04:03] mikecmpbll: i'm just upgrading to 5.1 and I have a class method in a model called `sort`. this worked fine before but, presumably due to changes in how activerecord proxies methods to enumerable, it now hits the Enumerable#sort . is there any reason this shouldn't be seen as a bug? (before i file a issue)
[12:04:31] universa1: Shilon: yes. but you should only display it, not use the calculated amount in any form. use the submitted quantity/number of accounts.
[12:09:22] shilon: universa1: so I should display the values to the user with JS only
[12:09:44] shilon: no controller logic here, only after the submit I should send real data to the controller?
[12:09:59] universa1: Shilon: yes.
[12:10:07] shilon: thank you!
[12:10:24] shilon: I was on that path, just needed to make sure :P
[12:11:07] ayonkhan: has joined #RubyOnRails
[12:14:09] ascarter: has joined #RubyOnRails
[12:21:56] quazimodo: has joined #RubyOnRails
[12:35:06] DoubleMalt: has joined #RubyOnRails
[12:44:30] skroon: has joined #RubyOnRails
[12:48:02] jphase: has joined #RubyOnRails
[12:49:11] shotbug: has joined #RubyOnRails
[13:02:48] shilon: has joined #RubyOnRails
[13:09:02] shilon: universa1: still there?
[13:12:11] knight33: has joined #RubyOnRails
[13:16:21] jhfisc: has joined #RubyOnRails
[13:17:38] arup_r: has joined #RubyOnRails
[13:21:20] delgiudices: has joined #RubyOnRails
[13:22:24] jhfisc: has joined #RubyOnRails
[13:27:43] jhfisc: has joined #RubyOnRails
[13:36:54] jhfisc: has joined #RubyOnRails
[13:47:49] jhfisc: has joined #RubyOnRails
[13:48:35] bratsche: has joined #RubyOnRails
[13:50:00] Hess: has joined #RubyOnRails
[13:53:38] xMopxShell: has joined #RubyOnRails
[13:54:46] AckZ: has joined #RubyOnRails
[13:55:16] patarr: has joined #RubyOnRails
[13:57:03] marahin: has joined #RubyOnRails
[13:57:45] marahin: Hello! I just discovered sidekiq-status and I'm having an issue, where "Sidekiq::Status.delete(job_id)" throws an exception, that Sidekiq::Status module has no method 'delete'. Anyone encountered such issue? It's used in a before_destroy callback in another model that stores job_id.
[13:57:57] marahin: Both 'sidekiq' and 'sidekiq-status' are required (just to make sure) in the model file, at the top.
[13:59:53] marahin: (and I also just noticed that rubygesm version is from decemebr 2015, even though latest changes in the github repository happened in 2016; i assume it's kind of abandonware. Is there any alternative, that is still maintained/)
[14:02:31] mikecmpbll: marahin : what functionality are you after?
[14:02:32] Rodya_: has joined #RubyOnRails
[14:03:47] jphase: has joined #RubyOnRails
[14:06:44] truenito: has joined #RubyOnRails
[14:13:06] cam27: has joined #RubyOnRails
[14:14:27] Technodrome: has joined #RubyOnRails
[14:15:18] marahin: mikecmpbll I need to know when job has finished, when it's yet being calculated, and when it has failed. That's it.
[14:15:42] jhfisc: has joined #RubyOnRails
[14:16:58] mikecmpbll: marahin : oh okay. /shrug. you can use the project straight from github if you want unreleased functionality.
[14:17:16] mikecmpbll: gem 'sidekiq-status', github: 'whatever/sidekiq-status'
[14:17:18] marahin: mikecmpbll yes, that's what I'm thinking, but I don't find that a good practice :x
[14:17:52] zacts: has joined #RubyOnRails
[14:19:09] quirkycoders: has joined #RubyOnRails
[14:19:34] KeyJoo: has joined #RubyOnRails
[14:20:48] quirkycoders: has joined #RubyOnRails
[14:23:35] knight33: has joined #RubyOnRails
[14:25:49] thomasfedb: has joined #RubyOnRails
[14:26:00] cpruitt: has joined #RubyOnRails
[14:26:50] jhfisc: has joined #RubyOnRails
[14:27:56] quirkycoders: has joined #RubyOnRails
[14:30:52] xco: has joined #RubyOnRails
[14:31:16] quirkycoders: has joined #RubyOnRails
[14:31:42] xco: hi. i’m getting uninitialized constant Capybara::Poltergeist on https://gist.github.com/siaw23/622000a8cc331775201aa2cd8a6dd7d1#file-spec_helper-rb-L39 i don’t know why. maybe someone can help
[14:33:10] workerbeetwo: has joined #RubyOnRails
[14:33:43] Technodrome: has joined #RubyOnRails
[14:34:03] workerbeetwo: Hi. How to a define post params for a "post action"?' I'm testing a controller.
[14:34:22] skroon: has left #RubyOnRails: ()
[14:36:31] jhfisc: has joined #RubyOnRails
[14:37:35] xco: workerbeetwo: show what you have
[14:38:23] xco: the format should look something like this though params: { id: "something", another_id: "another something" }
[14:39:03] truenito: has joined #RubyOnRails
[14:41:04] lxsameer: has joined #RubyOnRails
[14:41:41] jhfisc: has joined #RubyOnRails
[14:46:19] jphase_: has joined #RubyOnRails
[14:52:00] workerbeetwo: xco: yes. I was looking for "post :action, :key1 => val1, :key2 => val2" inside of the controller spec.
[14:53:16] xco: workerbeetwo: that should work, with newer versions of rails you’re required to pass `params:` though
[14:55:38] irishfromua: has joined #RubyOnRails
[14:56:23] jhfisc: has joined #RubyOnRails
[14:56:36] workerbeetwo: xco: like so? : post :contact , :params => { :key1 => 'val1', ... }
[14:56:49] workerbeetwo: where :contact is an action
[14:57:24] xco: workerbeetwo: more like it. i’d prefer post :contact , params: { :key1 => 'val1', ... } for Ruby > 1.9
[14:57:47] xco: post :contact , params: { key1: 'val1', ... }
[15:01:13] patarr1: has joined #RubyOnRails
[15:07:32] xiljin: has joined #RubyOnRails
[15:10:43] knight33: has joined #RubyOnRails
[15:14:11] xhoy: ElektroBug: on problem :) that is where irc is for!
[15:16:32] ResidentBiscuit: has joined #RubyOnRails
[15:17:24] quirkycoders: has joined #RubyOnRails
[15:17:31] pLaTo0n: has joined #RubyOnRails
[15:17:37] patarr: has joined #RubyOnRails
[15:18:27] jhfisc: has joined #RubyOnRails
[15:21:43] quirkycoders: has joined #RubyOnRails
[15:23:13] pLaTo0n: has joined #RubyOnRails
[15:24:50] jhfisc: has joined #RubyOnRails
[15:25:35] quirkycoders: has joined #RubyOnRails
[15:29:45] doublemalt_: has joined #RubyOnRails
[15:30:01] quirkycoders: has joined #RubyOnRails
[15:30:43] jhfisc: has joined #RubyOnRails
[15:30:55] quirkycoders: has joined #RubyOnRails
[15:34:05] quirkycoders: has joined #RubyOnRails
[15:34:44] [Butch]: has joined #RubyOnRails
[15:38:22] brent__: has joined #RubyOnRails
[15:40:20] patarr: has joined #RubyOnRails
[15:44:27] sekmo: has joined #RubyOnRails
[15:45:56] jhfisc: has joined #RubyOnRails
[15:47:10] sekmo: hi all! Could you have a look at this snippet? https://gist.github.com/sekmo/c4bc4331df1fc22c933712fcd43d85e1
[15:48:45] mostlybadfly: has joined #RubyOnRails
[15:49:19] sekmo: I'm not sure about the set_note method... I cannot avoid repeating the call to "redirect_to_root_with_request_error"
[15:49:19] tbuehlmann: sekmo: done!
[15:50:06] sekmo: ...and about the exception, do I always need begin/rescue or can I use rescue in that way?
[15:50:06] tbuehlmann: sekmo: I personally would split the method in two
[15:50:28] tbuehlmann: it's doing two things: authorization and receiving the object
[15:51:42] jhfisc: has joined #RubyOnRails
[15:51:51] tbuehlmann: I would probably have a set_note method which sets the note. if there's no such note, redirect. the second method would be some kind of authorization, I'd use pundit to authorize the request, and if the user is not authorized, rescue the raised exception and redirect
[15:52:16] tbuehlmann: let me write a gist
[15:52:33] sekmo: thank you very much :-)
[15:53:11] sekmo: since it's a very small application, do you think that pundit is really needed?
[15:54:28] tbuehlmann: I'd use it, but you don't have to
[15:54:32] tbuehlmann: https://gist.github.com/tbuehlmann/f972d56ecfbf093de12a8fb3903e2d75
[15:57:39] jhfisc: has joined #RubyOnRails
[15:58:03] xco: hi. i’m getting uninitialized constant Capybara::Poltergeist on https://gist.github.com/siaw23/622000a8cc331775201aa2cd8a6dd7d1#file-spec_helper-rb-L39 i don’t know why. maybe someone can help
[15:59:46] dionysus69: has joined #RubyOnRails
[16:01:28] Rodya_: has joined #RubyOnRails
[16:02:32] quirkycoders: has joined #RubyOnRails
[16:06:42] sekmo: @ tbuehlmann have you used find_by because it returns nil instead of throwing an exception, right? (I read some times ago to stay away from find_by to avoid sql injection...)
[16:07:15] tbuehlmann: that's the reason, yeah. find_by(id: params[:id]) is perfectly safe, no reason to worry
[16:07:16] sekmo: has joined #RubyOnRails
[16:07:37] tbuehlmann: oh, you wasn't there right now. here again: that's the reason, yeah. find_by(id: params[:id]) is perfectly safe, no reason to worry
[16:07:46] troys: has joined #RubyOnRails
[16:08:19] jhfisc: has joined #RubyOnRails
[16:11:07] workerbeetwo: xco: thank you
[16:12:58] sekmo: Thanks a lot for the assistance tbluehlmann!
[16:14:30] jhfisc: has joined #RubyOnRails
[16:17:25] xco_: has joined #RubyOnRails
[16:17:30] ascarter: has joined #RubyOnRails
[16:17:40] Technodrome: has joined #RubyOnRails
[16:17:45] jhfisc: has joined #RubyOnRails
[16:24:45] timdotrb: has joined #RubyOnRails
[16:25:09] Axsuul: has joined #RubyOnRails
[16:37:10] choke: has joined #RubyOnRails
[16:39:42] jhfisc: has joined #RubyOnRails
[16:45:32] conta3: has joined #RubyOnRails
[16:45:42] jhfisc: has joined #RubyOnRails
[16:52:26] jhfisc: has joined #RubyOnRails
[16:57:23] jhfisc: has joined #RubyOnRails
[17:01:06] duderonomy: has joined #RubyOnRails
[17:03:42] jhfisc: has joined #RubyOnRails
[17:11:10] jhfisc: has joined #RubyOnRails
[17:14:27] jhfisc: has joined #RubyOnRails
[17:18:43] jhfisc: has joined #RubyOnRails
[17:24:42] jhfisc: has joined #RubyOnRails
[17:29:54] gusrub: has joined #RubyOnRails
[17:35:12] jhfisc: has joined #RubyOnRails
[17:38:07] Rodya_: has joined #RubyOnRails
[17:38:33] kies: has joined #RubyOnRails
[17:41:38] Rodya_: has joined #RubyOnRails
[17:41:42] jhfisc: has joined #RubyOnRails
[17:43:44] dionysus69: I am getting buggy behaviour. I get rollback on update_attributes method and just returns false without any errors. since it is just false I cant inspect AR errors too.
[17:43:50] jphase: has joined #RubyOnRails
[17:45:02] quirkycoders: has joined #RubyOnRails
[17:45:15] tbuehlmann: dionysus69: why can't you inspect the errors?
[17:45:37] dionysus69: because thing that it returns is boolean
[17:46:25] tbuehlmann: and on what object do you call #update_attributes?
[17:46:35] dionysus69: here's the gist from console
[17:46:35] dionysus69: https://gist.github.com/anonymous/5d428745299ec72d15d30acae2cbf6d1
[17:47:18] tbuehlmann: am I missing something obvious? `contract.errors`?
[17:47:20] dionysus69: to me it is just a regular AR object
[17:47:54] jhfisc: has joined #RubyOnRails
[17:48:37] dionysus69: tbuehlmann: ok found it :D :) I guess the references object wasn't found. I ll troubleshoot further :)
[17:55:19] dionysus69: I am dealing with weirdly setup API, they dont defend basic data modeling conventions and their modelnames don't match foreign keys... now I discoevered that I have to specify custom foreign key on both sides of the relationship in model files.
[17:56:13] Technodrome: has joined #RubyOnRails
[17:56:57] arup_r: has joined #RubyOnRails
[17:59:40] patarr: Will model.find_by_id still work if you generate the table migration with id: false and override the primary key?
[18:01:07] delgiudices: has joined #RubyOnRails
[18:01:30] dionysus70: has joined #RubyOnRails
[18:03:16] roshanavand: has joined #RubyOnRails
[18:05:14] gusrub: has joined #RubyOnRails
[18:11:18] dminuoso: tbuehlmann: I hate you.
[18:11:27] dminuoso: tbuehlmann: Because of you I can't use Chrome to watch netflix anymore. :(
[18:11:43] dminuoso: tbuehlmann: You live in the capital of Hochdeutsch right?
[18:12:05] dminuoso: tbuehlmann: So you and I need to have a talk now.
[18:13:33] conta2: has joined #RubyOnRails
[18:13:46] dminuoso: tbuehlmann: If only you had left me in ignorance..
[18:15:42] jhfisc: has joined #RubyOnRails
[18:19:11] jhfisc: has joined #RubyOnRails
[18:19:11] ascarter: has joined #RubyOnRails
[18:25:42] jhfisc: has joined #RubyOnRails
[18:26:17] srinidhi: has joined #RubyOnRails
[18:39:53] dblessing: has joined #RubyOnRails
[18:45:12] jhfisc: has joined #RubyOnRails
[18:53:14] Technodrome: has joined #RubyOnRails
[18:56:38] jhfisc: has joined #RubyOnRails
[19:01:10] jphase: has joined #RubyOnRails
[19:02:23] jhfisc: has joined #RubyOnRails
[19:13:12] quazimodo: has joined #RubyOnRails
[19:22:50] pasierbski1: has joined #RubyOnRails
[19:24:39] pasierbski1: has left #RubyOnRails: ()
[19:26:53] arBmind: has joined #RubyOnRails
[19:35:28] quazimodo: has joined #RubyOnRails
[19:38:19] jhfisc: has joined #RubyOnRails
[19:42:18] knight33: has joined #RubyOnRails
[19:42:55] tomaw: has joined #RubyOnRails
[19:44:37] shilon: has joined #RubyOnRails
[19:44:42] jhfisc: has joined #RubyOnRails
[19:51:40] sekmo: has joined #RubyOnRails
[19:53:08] quirkycoders: has joined #RubyOnRails
[19:53:12] brent__: has joined #RubyOnRails
[19:53:42] jhfisc: has joined #RubyOnRails
[19:58:11] jhfisc: has joined #RubyOnRails
[20:02:18] pasierbski: has joined #RubyOnRails
[20:03:57] tomaw: has joined #RubyOnRails
[20:06:27] tomaw: has joined #RubyOnRails
[20:14:06] pasierbski: has left #RubyOnRails: ("WeeChat 1.7")
[20:16:40] ur5us: has joined #RubyOnRails
[20:28:09] boreddanman: has joined #RubyOnRails
[20:29:42] jhfisc: has joined #RubyOnRails
[20:31:06] boreddanman: Hey fellas! Im doing a project and part of it involved a "lottery" which wont begin until there are at least 5 participants. After that the idea was to have a 3 minute countdown and at the end of the three minutes pick a winner. However, I'm not sure how I can activate this countdown asynchronously (and reliably show a timer to clients). I fear if i use ActiveJob the reliability of the countdown is compromised.
[20:31:26] shilon: has joined #RubyOnRails
[20:34:44] Rodya_: has joined #RubyOnRails
[20:38:44] dminuoso: boreddanman: ActionCable
[20:39:36] boreddanman: hmmm interesting idea
[20:39:45] dminuoso: boreddanman: As for how to active this countdown async kind of depends on when and how this should activate exactly
[20:40:36] boreddanman: so basically participant 5 "purchases" his lotto ticket, countdown should activate then and the lottery pool remains open for the next 3 minutes. After 3 minutes a winner is decided and a new pool is created.
[20:40:53] dminuoso: So exactly after the 5th purchase?
[20:41:15] dminuoso: boreddanman: Where do you store purchases in? A database?
[20:41:15] boreddanman: i guess i could just check the condition server end then just broadcast every second to the subscribers
[20:41:33] boreddanman: Lotto Pool is the model with many tickets. a ticket has a user_id
[20:41:42] jhfisc: has joined #RubyOnRails
[20:41:50] dminuoso: boreddanman: If its any modern RDMBS, you need to be extremely careful about concurrency.
[20:42:04] dminuoso: You could end up with a scenario where you end up with potentially 9 purchases before it could trigger.
[20:42:24] boreddanman: thats not a problem
[20:42:30] boreddanman: i should have rephrased
[20:42:40] boreddanman: it should trigger at the 5th purchase or after
[20:42:49] boreddanman: but still its kind of a problem
[20:42:52] dminuoso: boreddanman: Then you could end up with a scenario where you have 5 purchases, but no trigger.
[20:43:04] dminuoso: Unless you very carefully handle exclusive table locking
[20:43:44] dminuoso: boreddanman: Im not saying its an inherent issue, but it's a race condition you need to consider from the beginning for your design
[20:43:54] dminuoso: boreddanman: Do you at least understand why this could happen?
[20:44:13] boreddanman: i thought about it too, thats why i came here
[20:44:22] boreddanman: there are ways to do this, but none that seem reliable enough to me
[20:44:41] dminuoso: boreddanman: 3 solutions (more may exist) that immediately come to mind: redis, careful table locking strategies, database triggers
[20:44:50] dminuoso: the last one is probably more complicated, because you need some way to piggyback to rails.
[20:45:49] dminuoso: boreddanman: If you track the counter in some single row, you could get away with row-level locks -> that would actually be quite nice.
[20:46:00] dminuoso: (Assuming your RDMBS supports them)
[20:46:11] boreddanman: using postgresql so i think yes
[20:47:11] dminuoso: boreddanman: Then yeah, track the counter in your LottoPool model, and obtain a row level lock before you update and check the counter
[20:47:35] boreddanman: right so that solves the triggering issue
[20:47:37] jhfisc: has joined #RubyOnRails
[20:47:38] dminuoso: By then it could be a simple after_commit hook that broadcasts through ActionCable
[20:47:57] dminuoso: or rather run an ActiveJob (which handles the broadcasts)]
[20:49:39] sekmo: has joined #RubyOnRails
[20:53:41] jhfisc: has joined #RubyOnRails
[20:55:20] spheric: has joined #RubyOnRails
[20:56:23] lxsameer: has joined #RubyOnRails
[21:03:43] xMopxShell: has joined #RubyOnRails
[21:05:40] jhfisc: has joined #RubyOnRails
[21:05:47] Rodya_: has joined #RubyOnRails
[21:09:35] Doddlin: has joined #RubyOnRails
[21:13:05] jhfisc: has joined #RubyOnRails
[21:15:56] ur5us: has joined #RubyOnRails
[21:21:56] ascarter: has joined #RubyOnRails
[21:22:38] jhfisc: has joined #RubyOnRails
[21:25:03] boreddanman: dminuoso: do you think i need a pessimistic locking scheme?
[21:28:27] jhfisc: has joined #RubyOnRails
[21:30:10] Moeh: has joined #RubyOnRails
[21:33:07] jphase: has joined #RubyOnRails
[21:34:46] jhfisc: has joined #RubyOnRails
[21:34:53] delgiudices: has joined #RubyOnRails
[21:41:25] HoierM_: has joined #RubyOnRails
[21:44:23] jhfisc: has joined #RubyOnRails
[21:49:40] Technodrome: has joined #RubyOnRails
[21:50:18] jhfisc: has joined #RubyOnRails
[21:54:48] jphase: has joined #RubyOnRails
[21:57:44] mostlybadfly: has joined #RubyOnRails
[22:02:22] jhfisc: has joined #RubyOnRails
[22:07:44] boreddanman: is .lock! released on .save?
[22:07:48] boreddanman: for an activerecord object?
[22:08:07] cam27: has joined #RubyOnRails
[22:14:59] jhfisc: has joined #RubyOnRails
[22:21:53] jhfisc: has joined #RubyOnRails
[22:30:56] roshanavand: has joined #RubyOnRails
[22:34:15] Technodrome: has joined #RubyOnRails
[22:37:42] jhfisc: has joined #RubyOnRails
[22:45:37] jhfisc: has joined #RubyOnRails
[22:57:31] pitoucc: has joined #RubyOnRails
[23:18:02] patarr: has joined #RubyOnRails
[23:33:17] br0d1n: has joined #RubyOnRails