« Back to channel list

#RubyOnRails - 30 January 2019

« Back 1 day Forward 1 day »
[00:13:28] planigan_: has joined #RubyOnRails
[00:27:15] Ergo: has joined #RubyOnRails
[00:38:18] mat_bug: has joined #RubyOnRails
[00:39:52] duderonomy: has joined #RubyOnRails
[00:59:24] lankanmon: has joined #RubyOnRails
[01:34:40] tris: has joined #RubyOnRails
[01:46:14] tdy: has joined #RubyOnRails
[02:14:18] haxx0r: has joined #RubyOnRails
[02:14:38] haxx0r: i think i found a bug in the devise gem, but i can't evaluate if i'm wrong or devise.
[02:16:11] haxx0r: i try to implement a way, that if you give *current_password* into the model, it needs to be validated since some attributes can only be changed if the user is given his password
[02:16:58] haxx0r: https://pastebin.com/raw/Y9Pw6jJe here is the validation functon and the tests are working. pretty standard and easy
[02:18:02] haxx0r: def change_password(current, new_password, confirmation, otp=nil)
[02:18:02] haxx0r: self.update(current_password: current, password: new_password, password_confirmation: confirmation, otp_attempt: otp)
[02:19:11] sevenseacat: has joined #RubyOnRails
[02:19:24] haxx0r: now i need to use it to change the password. the funny part here is, that this is failing. if i debug the validation for the current_password with binding.pry, i expect the validations are called before anything else is done, right? however
[02:19:27] haxx0r: [10] pry(#<User>)> self.valid_password?("12345678")
[02:20:15] haxx0r: so i then tried
[02:20:46] haxx0r: [2] pry(main)> u.valid_password? "12345678" => true
[02:20:46] haxx0r: [3] pry(main)> u.password = "bla" => "bla"
[02:20:46] haxx0r: [4] pry(main)> u.valid_password? "12345678" => false
[02:21:02] haxx0r: this is clearly broken in my opinon.
[02:21:50] haxx0r: the docs say
[02:21:51] haxx0r: Verifies whether a password (ie from sign in) is the user password.
[02:22:29] haxx0r: https://github.com/plataformatec/devise/blob/master/lib/devise/models/database_authenticatable.rb#L67
[02:26:06] haxx0r: pry(main)> b = u.dup
[02:26:06] haxx0r: pry(main)> u.password = "aaaaaaaa"
[02:26:06] haxx0r: pry(main)> Devise::Encryptor.compare(User, u.encrypted_password, "12345678") => false
[02:26:06] haxx0r: pry(main)> Devise::Encryptor.compare(User, b.encrypted_password, "12345678") => true
[02:26:24] mat_bug: has joined #RubyOnRails
[02:26:35] haxx0r: now i'm asking if i'm blind and this is correct behavior or if it doesn't make any sense at all that devise is behaving like this
[02:28:10] haxx0r: so basically encrypted_pasword is always changed if password=() is called
[02:29:00] haxx0r: which is https://github.com/plataformatec/devise/blob/e72839f4bc18e038e1cb9a0cd24c9aed47cb2183/lib/devise/models/database_authenticatable.rb#L61
[02:40:25] tdy: has joined #RubyOnRails
[02:54:35] brandoncc: has joined #RubyOnRails
[02:56:32] haxx0r: i've created an issue https://github.com/plataformatec/devise/issues/5016
[02:58:13] sevenseacat: I'm not sure I see the problem
[02:58:37] sevenseacat: why is it causing an issue for you?
[03:00:37] mat_bug: has joined #RubyOnRails
[03:05:24] maryo_: has joined #RubyOnRails
[03:06:05] tdy: has joined #RubyOnRails
[03:07:50] Technodrome: has joined #RubyOnRails
[03:10:41] orbyt_: has joined #RubyOnRails
[03:11:07] cnsvc: has joined #RubyOnRails
[03:16:15] gambl0r3: has joined #RubyOnRails
[03:16:23] haxx0r: because it's not working the way it should
[03:16:37] sevenseacat: you haven't defined why you expect it to work that way
[03:17:15] haxx0r: i want to be able to check current_password on model level
[03:17:26] haxx0r: so in controller i can call
[03:17:26] sevenseacat: like, if I set a new password, I expect that the old one should no longer be valid. that's how it should work to me
[03:17:45] haxx0r: yes. but as long you didn't save the new password, the old one is still valid
[03:17:52] haxx0r: and this is whats broken right now
[03:18:29] haxx0r: if i set a new password, the old one is still current. the new one could be invalid. so the new one isn't the one that is to be checked
[03:18:48] haxx0r: f change_password(current, new_password, confirmation, otp=nil)
[03:18:48] haxx0r: self.update(current_password: current, password: new_password, password_confirmation: confirmation, otp_attempt: otp)
[03:19:00] haxx0r: that won't work with current devise behavior
[03:19:20] sevenseacat: yes, I read that in the issues you created
[03:19:28] haxx0r: i check current_password in a validation, but it won't match the current password anymore if you attempt to set a new password
[03:19:35] sevenseacat: that doesn't mean the current behaviour is wrong, but I'll let plataformatec weigh in
[03:19:49] haxx0r: ya, maybe my perspective is wrong
[03:20:20] haxx0r: but valid_password? should always use the password. and untill we updated successfully, the password wasn't changed, imho
[03:21:23] sevenseacat: changed and persisted are two different thnigs
[03:21:51] sevenseacat: there are built in tools in devise to do what you're trying to do, such as resource.update_with_password
[03:22:11] haxx0r: update_with_password looks good, lol
[03:22:46] haxx0r: but i assume it will also fail, just from reading the code. lemme try that out quick
[03:23:10] haxx0r: result = if valid_password?(current_password)
[03:23:10] haxx0r: it does pretty much the same
[03:23:26] quazimodo: has joined #RubyOnRails
[03:24:32] sevenseacat: its not the same thing at all, because it uses current_password not password
[03:25:40] haxx0r: and valid_password checks against encrypted_password
[03:25:48] haxx0r: which will be already set if you try to update password
[03:25:50] haxx0r: let's see
[03:27:28] haxx0r: there you go
[03:27:29] haxx0r: it's broken
[03:27:30] haxx0r: [9] pry(main)> u.update_with_password(current_password: 12345678, password: "aaaaaa")
[03:27:31] haxx0r: [10] pry(main)> u.errors
[03:27:31] haxx0r: => #<ActiveModel::Errors:0x00007fe0609d5ad8
[03:27:31] haxx0r: #<User id: 1, email: "test@test.de", created_at: "2019-01-30 03:13:27", updated_at: "2019-01-30 03:27:00", eur_balance: 1200.0, btc_balance: 0.0, xmr_balance: 0.0, google_2fa: nil, encrypted_otp_secret: "tAt12NuLxACkLKmh+uFVdh9d3FIoDaKS26b2NPp6INXcXKWy3Q...", encrypted_otp_secret_iv: "FzK8bAhiqytfcMlA\n", encrypted_otp_secret_salt: "_AkTQidcKMtyc
[03:27:31] haxx0r: amAqWsUSLQ==\n", consumed_timestep: nil, otp_required_for_login: false, otp_secret: nil>,
[03:27:32] haxx0r: @details={:current_password=>[{:error=>:invalid}]},
[03:27:32] haxx0r: @messages={:current_password=>["is invalid"]}>
[03:27:32] ChanServ: +q *!*@gateway/web/cgi-irc/kiwiirc.com/ip.119.76.1.67
[03:29:34] sevenseacat: well I guess they didn't want to discuss it anymore
[03:30:03] DTZUZO: has joined #RubyOnRails
[03:30:06] sevenseacat: given passwords are strings, not numbers
[03:41:40] duderonomy: has joined #RubyOnRails
[04:09:32] braincrash: has joined #RubyOnRails
[04:36:42] tdy: has joined #RubyOnRails
[04:50:17] mat_bug: has joined #RubyOnRails
[04:58:56] NeXTSUN: has joined #RubyOnRails
[05:00:57] gambl0r3: has joined #RubyOnRails
[05:02:30] lexileo: has joined #RubyOnRails
[05:16:48] cnsvc: has joined #RubyOnRails
[05:21:18] orbyt_: has joined #RubyOnRails
[05:24:00] _aeris_: has joined #RubyOnRails
[05:41:13] dviola: has joined #RubyOnRails
[05:47:23] mat_bug: has joined #RubyOnRails
[05:50:08] tdy: has joined #RubyOnRails
[05:53:05] tdy: has joined #RubyOnRails
[06:02:00] Leifr: has joined #RubyOnRails
[06:07:28] Milos: has joined #RubyOnRails
[06:08:51] ravenousmoose[aw: has joined #RubyOnRails
[06:10:01] mat_bug: has joined #RubyOnRails
[06:19:52] orbyt_: has joined #RubyOnRails
[06:21:07] srinidhi: has joined #RubyOnRails
[06:21:44] conta: has joined #RubyOnRails
[06:33:12] kapil____: has joined #RubyOnRails
[07:00:08] mat_bug: has joined #RubyOnRails
[07:05:12] ramfjord: has joined #RubyOnRails
[07:11:34] blackmesa1: has joined #RubyOnRails
[07:29:22] quazimodo: has joined #RubyOnRails
[07:40:10] snuz: has joined #RubyOnRails
[07:45:38] mat_bug: has joined #RubyOnRails
[08:09:11] Jervis_: has joined #RubyOnRails
[08:25:33] bruce_lee: has joined #RubyOnRails
[08:37:49] mikecmpbll: has joined #RubyOnRails
[08:41:10] srinidhi: has joined #RubyOnRails
[08:47:03] srinidhi: has joined #RubyOnRails
[09:05:09] mauro1254: has joined #RubyOnRails
[09:16:06] mikecmpbll: has joined #RubyOnRails
[09:19:59] Jervis_: has joined #RubyOnRails
[09:26:21] ravenousmoose: has joined #RubyOnRails
[09:34:15] ramfjord: has joined #RubyOnRails
[09:39:13] ramfjord: has joined #RubyOnRails
[09:41:16] apparition: has joined #RubyOnRails
[09:44:58] srinidhi: has joined #RubyOnRails
[10:02:02] Ergo: has joined #RubyOnRails
[10:16:45] kidPalooma: has joined #RubyOnRails
[10:17:05] kidPalooma: Hello, how do I delete this association? https://gist.github.com/salami-art/c69d48a78406dff6159ac5566540badf
[10:17:18] kidPalooma: raises ActiveRecord::ActiveRecordError (delete_all doesn't support distinct):
[10:22:56] tuor: has joined #RubyOnRails
[10:24:02] dionysus69: kidPalooma: I would make a separate scope for distinct Fonts and it also would solve your error
[10:26:28] dionysus69: scope :distinct_fonts, -> { self.fonts.where(distrinct: true)where(published: true) }
[10:30:28] kidPalooma: dionysus69: that seems reasonable
[10:31:09] kidPalooma: I would also need to declare another scope for styles_fonts
[10:31:24] kidPalooma: because that's the type of record that raises
[10:31:41] bonhoeffer: has joined #RubyOnRails
[10:33:20] ramfjord: has joined #RubyOnRails
[10:33:35] dionysus69: kidPalooma: sounds good ^.^
[10:40:17] Guest16678: has joined #RubyOnRails
[10:55:40] GeorgesLeYeti: has joined #RubyOnRails
[10:59:39] GeorgesLeYeti: Hi, I'm just starting to undestand the concept of multi-tenant but not sure it could fit my need. I want to create white label of my web application. Each client has it own server, own database and own design but there is a part commun to every application. When I'm making an update on this commun part, I want to deploy it on all my applications.
[11:00:25] GeorgesLeYeti: Is the multi-tenant good for that ?
[11:01:36] blackmesa1: has joined #RubyOnRails
[11:14:45] ramfjord: has joined #RubyOnRails
[11:16:11] KeyJoo: has joined #RubyOnRails
[11:21:15] ravenousmoose: has joined #RubyOnRails
[11:27:40] jjeffers: has joined #RubyOnRails
[11:36:21] fox_mulder_cp: GeorgesLeYeti: depends of requests. i have a TenantID column in database tables
[11:37:02] _aeris_: has joined #RubyOnRails
[11:38:16] GeorgesLeYeti: fox_mulder_cp, Sorry I don't undestand what you mean
[11:38:49] GeorgesLeYeti: After reading seems the multi-tenant not my solution. Because I have 1 server for each applicaiton
[11:40:25] ramfjord: has joined #RubyOnRails
[11:42:56] fox_mulder_cp: GeorgesLeYeti: multitenant concept https://en.wikipedia.org/wiki/Multitenancy
[11:43:38] GeorgesLeYeti: fox_mulder_cp, ty. I read too : https://rubygarage.org/blog/three-database-architectures-for-a-multi-tenant-rails-based-saas-app
[11:44:01] fox_mulder_cp: one app - many databases, one database with schemas per tenant, or tenant id in tables per record
[11:48:59] lankanmon: has joined #RubyOnRails
[11:51:04] fox_mulder_cp: if you have multiple apps and multiple servers you must support all instances defferently, via control systems like salt, ansible, chef for deply code and run database migrations
[11:52:32] ravenousmoose: has joined #RubyOnRails
[11:54:42] fox_mulder_cp: or upgrade code for use multitenancy and merge all databases into one..
[11:55:23] ariedler: has joined #RubyOnRails
[11:57:31] ariedler: has joined #RubyOnRails
[12:25:34] GeorgesLeYeti: fox_mulder_cp, Ok ty. I actualy have multiple servers multiple apps
[12:29:20] fox_mulder_cp: GeorgesLeYeti: so if this servers under your control you can use salt for propagate code and database migration deployment to end-user servers
[12:31:10] blackmesa1: has joined #RubyOnRails
[12:31:44] GeorgesLeYeti: fox_mulder_cp, Ty a lot. I will look at that.
[12:33:10] GeorgesLeYeti: And do you have any reference explaining how to architecting my application (core part and specific application part)
[12:37:40] blackmesa1: has joined #RubyOnRails
[12:40:14] fox_mulder_cp: GeorgesLeYeti: seems that you need a devops for help you dev and qa teams to deploy code
[12:41:02] fox_mulder_cp: GeorgesLeYeti: it's a dependent for your business andd applications. multi tenancy hints i post via links earlier
[12:55:33] EXCHGR: has joined #RubyOnRails
[13:05:53] kapil____: has joined #RubyOnRails
[13:26:09] ravenousmoose: has joined #RubyOnRails
[13:27:21] leni1: has joined #RubyOnRails
[13:54:56] Kamuela: when I'm using the web console, what are some typical things I'm able to do? how can I see all of the variables currently in use for example
[14:21:55] alan_w: has joined #RubyOnRails
[14:24:23] ramfjord: has joined #RubyOnRails
[14:27:52] blackmesa1: has joined #RubyOnRails
[14:28:47] jjeffers: has joined #RubyOnRails
[14:36:41] segy: has joined #RubyOnRails
[14:48:56] conta: has joined #RubyOnRails
[14:58:23] bruce_lee: has joined #RubyOnRails
[15:05:40] ravenousmoose: has joined #RubyOnRails
[15:18:09] ramfjord: has joined #RubyOnRails
[15:19:26] skryking: has joined #RubyOnRails
[15:23:48] DTZUZO: has joined #RubyOnRails
[15:33:41] tuor: has left #RubyOnRails: ("bye")
[15:35:45] Dbugger: has joined #RubyOnRails
[15:39:29] tdy: has joined #RubyOnRails
[15:45:08] skryking: has joined #RubyOnRails
[15:53:34] fox_mulder_cp: oh. seems that is dns resolving. i cahe a minion withou domain part in fqdn and salt-master try connect to localhost again
[15:59:37] blackmesa1: has joined #RubyOnRails
[16:22:38] Technodrome: has joined #RubyOnRails
[16:22:46] GodFather: has joined #RubyOnRails
[16:23:49] NeXTSUN: has joined #RubyOnRails
[16:37:34] duderonomy: has joined #RubyOnRails
[16:42:09] ravenousmoose: has joined #RubyOnRails
[16:43:33] snuz: has joined #RubyOnRails
[16:44:57] conta1: has joined #RubyOnRails
[17:20:13] gambl0r3: has joined #RubyOnRails
[17:28:24] ravenousmoose: has joined #RubyOnRails
[17:34:20] Tempesta: has joined #RubyOnRails
[17:34:56] yoshie902a: has joined #RubyOnRails
[17:35:17] yoshie902a: Got a question on database design, shown here: https://stackoverflow.com/questions/54442282/ruby-on-rails-good-database-design-question-1-to-1-relationship-polymorphic-v
[17:35:58] yoshie902a: Would love feedback.
[17:37:14] krawchyk: has joined #RubyOnRails
[17:40:28] NoGodDamnIdea: has joined #RubyOnRails
[17:41:59] murkx: has joined #RubyOnRails
[17:43:00] Technodrome: has joined #RubyOnRails
[17:44:39] Linuus`: has joined #RubyOnRails
[17:49:02] orbyt_: has joined #RubyOnRails
[17:55:43] Saukk: has joined #RubyOnRails
[17:58:10] lxsameer: has joined #RubyOnRails
[18:01:20] gambl0r3: has joined #RubyOnRails
[18:01:40] NeXTSUN: has joined #RubyOnRails
[18:05:33] skryking: has joined #RubyOnRails
[18:07:28] mikecmpbll: has joined #RubyOnRails
[18:09:39] ryovaa: has joined #RubyOnRails
[18:10:36] agent_white: has joined #RubyOnRails
[18:16:58] bruce_lee: has joined #RubyOnRails
[18:23:07] blackmesa1: has joined #RubyOnRails
[18:23:45] conta1: has joined #RubyOnRails
[18:32:54] defsdoor: has joined #RubyOnRails
[18:43:07] bruce_lee: has joined #RubyOnRails
[18:48:56] tdy: has joined #RubyOnRails
[18:49:11] yoshie902a: has left #RubyOnRails: ()
[18:56:57] jjeffers: has joined #RubyOnRails
[19:01:14] Dreamer3: has joined #RubyOnRails
[19:16:33] orbyt_: has joined #RubyOnRails
[19:21:54] ravenousmoose: has joined #RubyOnRails
[19:49:45] GodFather: has joined #RubyOnRails
[19:57:57] skryking: has joined #RubyOnRails
[20:06:29] lexileo: has joined #RubyOnRails
[20:12:51] reber: has joined #RubyOnRails
[20:16:33] dviola: has joined #RubyOnRails
[20:20:45] Net: What do I have to do so I can just call `describe` without `Rspec.` in my specs?
[20:25:06] cnsvc: has joined #RubyOnRails
[20:33:24] havenwood: Net: Does it not just work?
[20:33:32] Net: havenwood: not for me
[20:33:35] havenwood: Net: include RSpec
[20:33:44] Net: this is an old rails app that's been upgraded over the years
[20:34:03] havenwood: Net: What version of RSpec?
[20:34:05] Net: in my rails_Helper?
[20:34:16] Net: 3.8 now
[20:34:28] Net: but the generated files may be old
[20:34:31] havenwood: πŸ‘πŸ½
[20:35:04] havenwood: Net: Did you run transpec?
[20:35:16] havenwood: http://yujinakayama.me/transpec/
[20:35:25] Net: damn that's nice
[20:35:31] Net: no we haven't
[20:35:54] havenwood: It's quite an impressive tool!
[20:35:55] havenwood: https://github.com/yujinakayama/transpec
[20:36:36] Net: what happened to the rails community?
[20:36:45] Net: I seem to remember these channels being much more active a few years ago
[20:37:15] havenwood: People learned Rails and started talking on internal Slack channels in their companies instead of IRC.
[20:42:12] Net: I guess I missed the train
[20:42:23] Net: took a few years off from rails to write elixir
[20:42:57] Net: now I'm back and it's a ghost town
[20:50:32] skryking: has joined #RubyOnRails
[21:05:11] zephiro: has joined #RubyOnRails
[21:09:59] ramfjord: has joined #RubyOnRails
[21:27:59] dustinm`: has joined #RubyOnRails
[21:36:20] Radar: All the questions have been answered.
[21:36:32] Radar: But yeah, what havenwood said.
[21:37:01] Radar: Net: welcome back.
[21:37:43] Net: Radar: thanks. I remember you helped me a lot :)
[21:50:57] yoshie902a: has joined #RubyOnRails
[21:51:49] yoshie902a: I am trying to figure out if I should do a 1 to 1 polymorphic relationship or just have the data on the same table. see this.. https://stackoverflow.com/questions/54442282/1-to-1-polymorphic-relationship-vs-none-ruby-on-rails.
[21:52:24] yoshie902a: Anyone here? It’s been quite and have not sen much discussion.
[21:59:33] Jervis_: has joined #RubyOnRails
[22:03:39] wethu: has joined #RubyOnRails
[22:15:01] ravenousmoose[aw: has joined #RubyOnRails
[22:16:18] quazimodo: has joined #RubyOnRails
[22:19:26] Net: yoshie902a: I would go with 2 or 3 or one table for both the address and overview
[22:20:07] yoshie902a: Net: added a new option Disign 4
[22:21:59] Net: yoshie902a: not bad either. although it won't be specific to AR, you'll probably find more advice in #postgresql
[22:23:54] yoshie902a: Since its Rails, would the Design 4 make programing the rails app much harder?
[22:39:47] ellcs: has joined #RubyOnRails
[22:58:41] davidw: has joined #RubyOnRails
[22:59:23] davidw: res = Foo.where(token: 'A') ; res.any? ? true : false -- ignoring any other problems with this, is there a way to ensure it executes and puts a result in 'res' ?
[23:04:34] davidw: .load is what I needed I guess
[23:04:40] davidw: has left #RubyOnRails: ("Leaving")
[23:24:02] zephiro: has joined #RubyOnRails
[23:37:24] fragamus: has joined #RubyOnRails
[23:53:15] istrasci: has joined #RubyOnRails
[23:55:30] ericboehs: has joined #RubyOnRails
[23:58:43] istrasci: Why is it that Rails stresses separation of stages for the database (typically, development, test, and production), but they all share one schema.rb file? This can cause you to get into these situations where different DBMSs for different stages step on each other's toes in the one schema.rb file.