« Back to channel list

#RubyOnRails - 27 May 2019

« Back 1 day Forward 1 day »
[00:11:22] skryking: has joined #RubyOnRails
[00:28:46] phaul: has joined #RubyOnRails
[00:55:16] bambanx: has joined #RubyOnRails
[01:01:15] orbyt_: has joined #RubyOnRails
[01:17:13] sevenseacat: has joined #RubyOnRails
[02:00:49] orbyt_: has joined #RubyOnRails
[02:08:38] Technodrome: has joined #RubyOnRails
[02:23:12] tdy: has joined #RubyOnRails
[02:48:04] octos: has joined #RubyOnRails
[03:09:11] braincrash: has joined #RubyOnRails
[03:17:45] zmo: has joined #RubyOnRails
[03:18:37] Saukk: has joined #RubyOnRails
[03:23:37] MrCrackPotBuilde: has joined #RubyOnRails
[03:29:59] zmo: has joined #RubyOnRails
[03:40:33] zmo: has joined #RubyOnRails
[03:50:19] Technodrome: has joined #RubyOnRails
[04:08:04] Exuma: has joined #RubyOnRails
[04:36:45] zmo: has joined #RubyOnRails
[04:37:54] tdy: has joined #RubyOnRails
[04:53:07] w0rd-driven: has joined #RubyOnRails
[05:05:06] Technodrome: rails just no longer makes me happy , sad time
[05:16:25] conta: has joined #RubyOnRails
[05:16:59] MrCrackPotBuilde: Q1) When you use User.where creates an array of objects yes ? Q2) User.find / User.find_by returns a single object ? if Q1 is true how do you simplafy a User.where object so it can be serialized ?
[05:18:09] MrCrackPotBuilde: im using a dirty hack at the minute which calls the db twice. user = User.where('username LIKE :userInput OR email LIKE :userInput OR mobile LIKE :userInput', userInput: "%#{auth_params[:userInput]}%") || userSerial = User.find_by(id: user.ids)
[05:19:16] MrCrackPotBuilde: then instead of passing the user object to the serializer UserSerializer.new(user) i use the single object UserSerializer.new(userSerial)
[05:21:10] MrCrackPotBuilde: otherwise i think i have to break down the login function to check for regexp then use find_by depending on which regexp is true
[05:34:48] haxx0r: first question i dont even understand
[05:34:56] haxx0r: User.where doesn't create an array of objects
[05:35:03] haxx0r: It's creating ActiveRelation
[05:35:20] haxx0r: User.where().class
[05:35:49] haxx0r: User.where.not(affiliate_tag: 1234).class
[05:36:31] haxx0r: User.find or User.find_by returns the User object or nil
[05:37:08] haxx0r: `. user = User.where('username LIKE :userInput OR email LIKE :userInput OR mobile LIKE :userInput', userInput: "%#{auth_params[:userInput]}%")` wtf? you should look how devise is doing that
[05:37:35] haxx0r: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address
[05:38:15] haxx0r: i'm pretty excited to see what happens when my username is google and anothers name is goog ....
[05:38:26] haxx0r: the second one then will match to my one
[05:39:00] haxx0r: `userSerial = User.find_by(id: user.ids)`
[05:39:25] haxx0r: user.ids? ids? or you mean user.id?
[05:39:50] ur5us: has joined #RubyOnRails
[05:40:11] xco: has joined #RubyOnRails
[05:41:08] haxx0r: `if user = User.find_by(email: user_input) || User.find_by(username: user_input) || User.find_by(mobile: user_input)`
[05:41:31] haxx0r: ` return true if user.authenticate?(authentication_params)`
[05:41:41] haxx0r: something like that
[05:42:40] haxx0r: and for your question *? if Q1 is true how do you simplafy a User.where object so it can be serialized ?* i might ahve the answer
[05:43:43] haxx0r: render json: @collection, each_serializer: User::SingleSpecialSerializer
[05:49:07] MrCrackPotBuilde: haxx0r when i use user.id it days no such thing did you mean ids
[05:49:14] MrCrackPotBuilde: use that and it work
[05:49:43] MrCrackPotBuilde: but to use the serializer i either have to use user[0] or the dirty hack of calling the db twice
[05:49:59] haxx0r: maybe you mean user_ids, but `user.ids` should not exist
[05:49:59] MrCrackPotBuilde: thats when user.where is used
[05:50:10] MrCrackPotBuilde: thats what i thought but it does
[05:50:21] haxx0r: why don't you show your whole code? i bet you do some fancy stuff without using rails magic
[05:50:41] haxx0r: u use camelcase and no experienced rails dev will do that.... that's the indicator
[05:50:42] MrCrackPotBuilde: more than likely im still a major noob
[05:51:22] haxx0r: i can see that...
[05:52:43] MrCrackPotBuilde: https://pastebin.com/raw/wQJwZm4P
[05:53:18] MrCrackPotBuilde: https://pastebin.com/raw/miLMYTfr
[05:53:39] MrCrackPotBuilde: the top link is what im talking about with the where and find
[05:53:55] MrCrackPotBuilde: the bottom link is the code that the authenticate is using to get the token
[05:54:37] haxx0r: did you write that code?
[05:54:45] haxx0r: or it's just a plugin you use?
[05:56:04] MrCrackPotBuilde: im trying not to use gems like devise for now
[05:56:16] MrCrackPotBuilde: some of course is copy pasta
[05:56:29] MrCrackPotBuilde: but currently as is
[05:56:35] MrCrackPotBuilde: everything works and tests run
[05:56:47] MrCrackPotBuilde: i can log in a user create and update along with password resets
[05:57:04] MrCrackPotBuilde: i was going through and cleaning up the responses for the mobile application.
[05:57:33] haxx0r: so all you want is a guarding beeing able to login with 3 different things?
[05:57:47] MrCrackPotBuilde: this already works
[05:57:59] MrCrackPotBuilde: id like to get rid of the one of the two db calls
[05:58:28] MrCrackPotBuilde: sorry im really bad at explaining it but the way i see it is. the Guardian.where is returning a plurual
[05:58:44] MrCrackPotBuilde: i have no ids in the projects ive searched the whole thing
[05:59:11] MrCrackPotBuilde: when i use the .id rails also tells me i got it wrong and use ids
[05:59:29] MrCrackPotBuilde: thats why i assumed its an array of objects even though its one
[06:00:04] haxx0r: i really can't read your code
[06:00:16] haxx0r: if you want to get rid of 2 DB Calls, then you do something wrong
[06:00:20] haxx0r: nothing wrong with doing it
[06:00:42] haxx0r: Uploaded file: https://uploads.kiwiirc.com/files/b152c569930d60088fc7d9232d339b35/pasted.txt
[06:00:49] haxx0r: same code. more readable
[06:01:27] MrCrackPotBuilde: my bad im sorry i left all my trail of thought inside
[06:01:44] MrCrackPotBuilde: let me clean up the main one
[06:01:48] haxx0r: i can't help you
[06:02:02] haxx0r: making 2 queries is fine
[06:02:51] MrCrackPotBuilde: https://pastebin.com/raw/fUSRE0hN
[06:03:19] MrCrackPotBuilde: 2 queries in a small app is not too bad i was thinking more long term.
[06:03:47] haxx0r: i dont get your code at all
[06:04:02] MrCrackPotBuilde: or because im a bit of a noob looking for a rails way if there was one to reduce from two to one or even to just use the where query to serialize instead
[06:04:29] haxx0r: Api::V1::Auth::Guardsec::AuthenticateGuardian.new().call <- isn't that supposed to return a single guardian?
[06:04:45] MrCrackPotBuilde: it returns a auth token
[06:04:45] haxx0r: what it's supposed to do?
[06:05:13] MrCrackPotBuilde: that function is the second file i showed you
[06:05:29] haxx0r: guardian = Guardian.find_by(email: email)
[06:05:33] haxx0r: it returns a guardian
[06:05:35] haxx0r: not a token
[06:05:35] MrCrackPotBuilde: it just checks email or user or mobile uses the id and password and makes an auth token
[06:06:26] haxx0r: i don't get it. sorry
[06:06:43] haxx0r: a api should not authenticate something, just check authorization
[06:06:50] haxx0r: good luck with that. i can't follow
[06:07:39] srinidhi: has joined #RubyOnRails
[06:07:48] MrCrackPotBuilde: user sends in userInput which is either a username email or mobile. authenticateGuardian checks the reg and finds the user uses its id and passsword to encode a jwt token.
[06:08:36] MrCrackPotBuilde: an api should authenticate something i mean how else are you supposed to log in
[06:08:36] schne1der: has joined #RubyOnRails
[06:08:48] MrCrackPotBuilde: games like pubg all use api auth logins
[06:08:53] haxx0r: it's called API TOKEN
[06:09:08] haxx0r: huh what?
[06:09:17] haxx0r: PUBG api just uses api token
[06:09:26] MrCrackPotBuilde: thanks for your help
[06:09:35] haxx0r: https://documentation.pubg.com/en/getting-started.html#authorization
[06:09:45] haxx0r: i even used that API...
[06:09:54] haxx0r: no API that i know does authentication, they all just do authorization
[06:10:04] haxx0r: so throw your current API away
[06:10:47] sevenseacat: so how do you get an api token without authentication?
[06:10:48] haxx0r: https://www.pluralsight.com/guides/token-based-authentication-with-ruby-on-rails-5-api
[06:10:59] haxx0r: you get the API token on your website when you are logged in
[06:11:15] dtzuzu: has joined #RubyOnRails
[06:11:21] sevenseacat: so if you're making a mobile app
[06:11:41] sevenseacat: and want to use your own API
[06:11:51] sevenseacat: you want mobile users to copy and paste api tokens?
[06:12:01] haxx0r: that's different then
[06:12:01] MrCrackPotBuilde: sorry but the link haxor just sent is what i used to create the API token
[06:12:16] MrCrackPotBuilde: so im at a loss how my application is even remotely wrong
[06:12:17] sevenseacat: no its not. its an API
[06:12:42] haxx0r: i didn't know whe wanna do authenticate users out of a mobile app
[06:12:44] sevenseacat: (that was to haxx0r saying 'but its different')
[06:13:07] MrCrackPotBuilde: how are you going to log users in without an email and password
[06:13:12] MrCrackPotBuilde: you need some end point
[06:13:16] MrCrackPotBuilde: regardless of what it is
[06:13:21] sevenseacat: APIs are APIs, no matter how they're utilized
[06:13:35] haxx0r: fair enough
[06:13:40] MrCrackPotBuilde: right but you still need to authenticate
[06:13:53] MrCrackPotBuilde: sorry if my english is bad
[06:13:57] MrCrackPotBuilde: chinese no problem
[06:14:16] haxx0r: dann reden wir deutsch. kein thema...
[06:14:55] MrCrackPotBuilde: its slow but sure
[06:15:32] MrCrackPotBuilde: anyway back to the point API must have an authentication system
[06:15:44] MrCrackPotBuilde: Signup Login Update and Logout
[06:16:03] MrCrackPotBuilde: API's differ from web apps becuase of sessions. Hence the token auth
[06:16:34] MrCrackPotBuilde: token auths do need to be deleted properly when loggin out that bit though still confuses me so ill keep quiet
[06:17:28] MrCrackPotBuilde: there is no web facing side to the rails application and its a full API only app
[06:18:24] MrCrackPotBuilde: 2 calls to the database you said was ok but to me thats excessive. Especially if User.where and User.find both return an object
[06:19:32] MrCrackPotBuilde: im just to stupid to be able to use the User.where and pass that to the serializer instead i keep getitng read_attribtes error. which to me is saying its created an array of objects incase more than one object would have been returned
[06:19:52] sevenseacat: where will always return a relation, yes
[06:20:12] sevenseacat: an enumerable object
[06:20:14] MrCrackPotBuilde: do you mean the relation as in User and its address
[06:20:22] sevenseacat: no, as in a list of users
[06:20:28] MrCrackPotBuilde: as user[0] is correct
[06:20:41] MrCrackPotBuilde: UserSerail.new(user[0])
[06:21:12] MrCrackPotBuilde: because of my lack of understanding i made the hack of doing where then using the id to get a single object
[06:21:27] MrCrackPotBuilde: hence the 2 database calls is down to my own stupidity and not that of rails framewor
[06:23:10] MrCrackPotBuilde: actually talking throuh it smokig a j and looking at it i see ive already solved my stupid 2 calls
[06:23:31] sevenseacat: wouldn't be anything wrong with doing where(your conditions).first
[06:23:42] sevenseacat: instead of doing a second query
[06:24:09] MrCrackPotBuilde: becuase UserSerail.new(user[0]) works couldnt i just use that instead of being picky
[06:24:57] MrCrackPotBuilde: the .first also works
[06:25:12] MrCrackPotBuilde: now i need to measure the resource usage for each see if there is a difference
[06:25:49] MrCrackPotBuilde: i know 2 calls seems small but the appliction its replacing contains 300,000 plus calls a day
[06:25:59] MrCrackPotBuilde: that would double the load
[06:26:08] MrCrackPotBuilde: just for a simple log in every day
[06:30:34] MrCrackPotBuilde: sevenseacat the .first actually solved everything thanks. it seems you were correct where is always returning a 'relation' (or array of objects as i explained it my bad) the .first simply chose the first entity.
[06:31:00] MrCrackPotBuilde: i think its because im searching using 3 key values
[06:31:21] MrCrackPotBuilde: 2 will always return nil but its in the relation
[06:31:28] kapilp: has joined #RubyOnRails
[06:31:31] MrCrackPotBuilde: 1 is my valid user
[06:31:51] MrCrackPotBuilde: the .first is removing those two failed searches
[06:32:13] MrCrackPotBuilde: thank you very much. always better to understand exactly why than just do lol
[06:39:17] haxx0r: has joined #RubyOnRails
[06:46:20] Ergo: has joined #RubyOnRails
[06:49:24] lxsameer: has joined #RubyOnRails
[06:54:16] quazimodo: has joined #RubyOnRails
[06:54:39] Cork: has joined #RubyOnRails
[07:06:11] dionysus69: has joined #RubyOnRails
[07:07:41] zmo: has joined #RubyOnRails
[07:08:56] deepredsky: has joined #RubyOnRails
[07:12:37] schne1der: has joined #RubyOnRails
[07:38:10] deepredsky: has joined #RubyOnRails
[07:39:22] pd09041999: has joined #RubyOnRails
[07:42:59] tdy: has joined #RubyOnRails
[07:49:31] quazimodo: has joined #RubyOnRails
[07:50:21] srinidhi: has joined #RubyOnRails
[07:55:49] shtirlic: has joined #RubyOnRails
[07:59:28] zmo: has joined #RubyOnRails
[08:19:21] xuyuheng: has joined #RubyOnRails
[08:30:06] hightower2: has joined #RubyOnRails
[08:32:56] deepredsky: has joined #RubyOnRails
[08:35:08] conta: has joined #RubyOnRails
[08:43:39] dionysus69: need help with this not so pretty query situation everything is in gist https://gist.github.com/webzorg/fb77cb141e9ee01a017886681ed2d3dd
[08:44:22] dionysus69: that last query.count should return one user with missing wallet
[08:49:51] quazimodo: has joined #RubyOnRails
[08:58:08] MrCrackPotBuilde: have you thought about using polymorphic models insteaddionysus69 this case looks like it would benifit from it. you could then run validation on the model and then validations on the association
[08:59:05] dionysus69: Hmm, not really getting which model would be polymorphic
[08:59:59] dionysus69: and what kind of validations do you mean?
[09:00:01] MrCrackPotBuilde: it belongs to user and currency
[09:00:32] deepredsky: has joined #RubyOnRails
[09:01:13] dionysus69: in my real app I have after_create hook on user so it wallets for all currencies
[09:01:21] MrCrackPotBuilde: ok lets say i have a user and a seconduser each have addresses. address must have street and zip and user and seconduser must have addresses
[09:01:37] dionysus69: but I am building an integrity check functionality for admin panel
[09:01:58] MrCrackPotBuilde: i can validate that address must have these properties then validate that user and seconduser has the association and validates its presence
[09:02:09] conta: has joined #RubyOnRails
[09:02:37] MrCrackPotBuilde: think of a polymorphic model as it is on its own. you validate all the values you need and want. then validate that association
[09:03:32] MrCrackPotBuilde: user and seconduser can have addresses which will validate based upon the address validations
[09:04:04] dionysus69: making that big of a refactor for my app is unrealistic :) it is like this for year or two already :s
[09:04:40] MrCrackPotBuilde: its not that big and will dry up your code quite a bit
[09:05:00] MrCrackPotBuilde: all though if its an old app with a large db yer that would be a bit tricky
[09:05:20] dionysus69: yea db is pretty big, over 100k wallets
[09:05:41] dionysus69: don't wanna deal with that, can't wrap my head around it
[09:06:18] MrCrackPotBuilde: yer something like that you would need to back up the database extract the nessary info and put it all in the new db not sure if migrations alone could handle that
[09:06:52] MrCrackPotBuilde: although if its an api just create a new version have all new apps use that then when the old one is seldom used delete
[09:07:32] dionysus69: ok thanks :)
[09:08:21] MrCrackPotBuilde: note the above is not good for security patches hahah
[09:09:24] MrCrackPotBuilde: if there is an error in a gem that leaves a security vulnerabity it isnt a problem. if the error stems from your code and you do not patch old versions in the api i can exploit that weakness
[09:10:58] MrCrackPotBuilde: lets say you made a method that wasnt authenticated properly and instead of trying to go through and fix you decide to go with a new version. if i download an app that has access to this api i can exploit that weakness
[09:11:46] dionysus69: oh well yea, you mentioned "wasn't authenticated properly" I don't have such controller actions :P
[09:12:01] MrCrackPotBuilde: tinder was a good example of this. when they added extra pay features removing the old ones like who likes etc they didnt close the api they just created a new version and had new apps use that. if you download an old version of tinder you can see who liked you for free
[09:12:13] MrCrackPotBuilde: just as an example
[09:12:34] MrCrackPotBuilde: many methods could contain an exploit coded in the wrong way
[09:15:37] ZAJDAN: has joined #RubyOnRails
[09:17:30] ZAJDAN: hi....in Model I check if same record already exist via :uniqueness => true ...if I try create same record it returns notice '...has already been taken' ..is any way how to get the value of passed variable into this notice?
[09:19:30] MrCrackPotBuilde: ZAJDAN uniqueness true just means no other entry in the column can contain this value. Do you mean you want to display the attribute within the error message displayed to the user
[09:21:08] ZAJDAN: value of the attribut
[09:23:19] MrCrackPotBuilde: are you using api or web
[09:29:49] ZAJDAN: web ...but is not problem use both
[09:32:34] MrCrackPotBuilde: the way i do it for api is if activerecord raises set something like attr_string = your_params[:paramkey] then when an error prints your message add the attr_string
[09:34:18] MrCrackPotBuilde: that should be good for both
[09:45:02] Sylario: has joined #RubyOnRails
[10:04:27] haxx0r: dionysus69
[10:04:48] haxx0r: isn't it useful if every user always have 2 wallets?
[10:05:16] haxx0r: first of all, have a look at the `money` gem
[10:05:23] haxx0r: `belongs_to :currency
[10:07:45] haxx0r: why `has_many :wallets`? should be more likely `has_one :usd_wallet, class_name: "Wallet", ->{where currency: :usd}`
[10:08:23] haxx0r: and the `User` before_create { build_usd_wallet; build_eur_wallet; }
[10:10:42] dtzuzu: has joined #RubyOnRails
[10:17:02] Dbugger: has joined #RubyOnRails
[10:18:05] conta: has joined #RubyOnRails
[10:18:42] Dbugger: has joined #RubyOnRails
[10:23:18] deepredsky: has joined #RubyOnRails
[10:35:57] dslegends: has joined #RubyOnRails
[10:47:51] _aeris: has joined #RubyOnRails
[10:48:28] _axx: has joined #RubyOnRails
[11:05:40] deepredsky: has joined #RubyOnRails
[11:07:16] octos: has joined #RubyOnRails
[11:14:29] lankanmon: has joined #RubyOnRails
[11:23:33] deepredsky: has joined #RubyOnRails
[11:24:15] quazimodo: has joined #RubyOnRails
[11:27:23] ZAJDAN: McCrack...Iam greenhorn in RoR, so I do not understand so well where I should set such attribut
[11:30:09] ZAJDAN: In controller I have method new and inside this method I call another method (commission_params)
[11:31:01] ZAJDAN: commission_params I should set it?
[12:02:05] Sylario: @ZAJDAN commission_params is a private method inside your controller
[12:02:45] Sylario: It is another method as it will be used for create and update.
[12:04:51] xuyuheng: has joined #RubyOnRails
[12:09:08] ZAJDAN: sylario:yes it is private method
[12:13:12] ZAJDAN: in my case if I understand corectly..the message (record already exist) returns Model
[12:13:47] ZAJDAN: cause tehre is the "function" :uniqueness => true
[12:55:37] MrCrackPotBuilde: ZAJDAN so it would be something like name_of_string = commission_params['key-name']. Place this inside the method that captures the error. where the error is located raise an exception or throw an error passing name_of_string to the error
[12:55:56] zmo: has joined #RubyOnRails
[13:00:57] zmo: has joined #RubyOnRails
[13:01:36] NL3limin4t0r: ZAJDAN: It shouldn't return "record already exist" a error message, the default value is "has already been taken". You can read the current value simply out of the attribute that has this error.
[13:03:15] ZAJDAN: NL3Limin...yes yes...I just explained about what is going on
[13:05:34] NL3limin4t0r: Take for example a model `User` that has an `email` attribute, which has the validation `validates :email, uniqueness: true`. Let's say I try to create a new user, but the email has already been taken: `user = User.new(email: 'foo@bar.com'); user.save #=> false` I can simply get the value from the instance, `user.email #=> "foo@bar.com"` which is the value already in use.
[13:09:48] deepredsky: has joined #RubyOnRails
[13:10:41] schne1der: has joined #RubyOnRails
[13:27:58] ZAJDAN: this is what I actually needed: https://guides.rubyonrails.org/active_record_validations.html#message
[13:28:24] ZAJDAN: so in my case in Model: :uniqueness => { message: "%{value} already exist"}
[13:38:15] lankanmon: has joined #RubyOnRails
[13:39:13] NL3limin4t0r: You could also edit the default message by updating locale/en.yml and setting {en: {errors: {messages: {taken: "your custom error message with %{value}"}}}}
[13:43:30] ZAJDAN: ok thank for the info
[13:48:29] zmo: has joined #RubyOnRails
[14:07:14] NL3limin4t0r: the above should be config/locales/en.yml
[14:28:57] deepredsky: has joined #RubyOnRails
[14:29:15] beholders_eye: has joined #RubyOnRails
[14:38:36] deepredsky: has joined #RubyOnRails
[14:50:06] kapilp: has joined #RubyOnRails
[15:05:00] FastJack: has joined #RubyOnRails
[15:24:47] quazimodo: has joined #RubyOnRails
[15:38:56] weteamsteve: has joined #RubyOnRails
[15:39:32] deepredsky: has joined #RubyOnRails
[15:55:34] tdy: has joined #RubyOnRails
[16:01:59] conta1: has joined #RubyOnRails
[16:09:59] m_antis: has joined #RubyOnRails
[16:22:25] sameerynho: has joined #RubyOnRails
[16:47:26] deepreds1: has joined #RubyOnRails
[16:54:50] regedit: has joined #RubyOnRails
[17:19:28] Tempesta: has joined #RubyOnRails
[17:29:51] deepreds1: has joined #RubyOnRails
[17:52:07] conta: has joined #RubyOnRails
[18:02:35] octos: has joined #RubyOnRails
[18:14:37] orbyt_: has joined #RubyOnRails
[18:29:25] ravenousmoose: has joined #RubyOnRails
[18:39:22] Frag_: has joined #RubyOnRails
[18:42:58] Frag_: Hi guys! I am new to RoR, having some experience with plain php and Laravel (which means I have an understanding of MVC). Which book would you recommend to learn Rails (apart from Michael Hartl's)?
[18:47:16] gambl0re: has joined #RubyOnRails
[18:49:22] gambl0re: has joined #RubyOnRails
[18:49:34] brool: has joined #RubyOnRails
[18:51:20] octos: has joined #RubyOnRails
[19:11:30] octos: has joined #RubyOnRails
[19:17:01] Kamuela: has joined #RubyOnRails
[19:40:31] JJonah: has joined #RubyOnRails
[19:41:31] Kamuela: has joined #RubyOnRails
[19:44:41] jhill: has joined #RubyOnRails
[19:45:17] Frag_: Hi guys! I am new to RoR, having some experience with plain php and Laravel (which means I have an understanding of MVC). Which book would you recommend to learn Rails (apart from Michael Hartl's)?
[19:46:13] KevinSjoberg: has joined #RubyOnRails
[19:47:21] brool: has joined #RubyOnRails
[19:52:59] tdy: has joined #RubyOnRails
[20:02:58] ravenousmoose: has joined #RubyOnRails
[20:19:52] orbyt_: has joined #RubyOnRails
[20:31:32] octos: has joined #RubyOnRails
[20:36:48] jstrong: has joined #RubyOnRails
[20:37:03] jstrong: Hi, when using webpacker. should the @rails/webpacker package.json dependency go under “dependencies” or “devDependencies” ?
[20:55:56] beholders_eye: has joined #RubyOnRails
[21:07:47] tdy: has joined #RubyOnRails
[21:16:29] beholders_eye: has joined #RubyOnRails
[21:38:56] tdy: has joined #RubyOnRails
[22:31:12] orbyt_: has joined #RubyOnRails
[23:06:39] bambanx: has joined #RubyOnRails
[23:12:22] haxx0r: has joined #RubyOnRails
[23:41:33] tdy: has joined #RubyOnRails
[23:44:45] haxx0r: Should i use AnyCable rather than ActionCable?
[23:44:55] haxx0r: i don't expect 1,000 visitors tho. maybe 50 max
[23:46:36] weaksauce: haxx0r premature optimization is not a good thing in general
[23:47:18] haxx0r: but need do a roulette table where people simultanously can play
[23:47:35] haxx0r: i guess actioncable is fast enough for that, broadcasting live bets to all clients
[23:47:48] haxx0r: i don't expect 1000 people simultanously playing
[23:48:01] haxx0r: https://evilmartians.com/chronicles/anycable-actioncable-on-steroids
[23:48:08] haxx0r: the RAM consumption looks bad for AC
[23:48:31] weaksauce: that's 20k connections though
[23:49:18] haxx0r: with 1k conn its already 1.x seconds delayed
[23:49:30] haxx0r: which would be really bad for the game. 5 4 3 2 1 no more bets!
[23:49:35] haxx0r: imagine you get those with 1 sec delay. lol
[23:50:10] weaksauce: i mean if you think you will get to 1k connections at one table then sure
[23:50:19] weaksauce: you can always break up the tables
[23:50:33] haxx0r: i think 50/100 max
[23:50:40] haxx0r: it's a casino game to lose money
[23:51:37] weaksauce: if you feel the incremental complexity is worth it go for it
[23:52:04] haxx0r: Anycable doesn't look more complex
[23:52:14] haxx0r: i think it's easy to scale up later and refactor anyways
[23:52:21] haxx0r: so maybe best, i go with action cable straight
[23:52:24] weaksauce: https://medium.com/@leshchuk/from-action-to-any-1e8d863dd4cf
[23:52:39] weaksauce: that shows some of the moving from actioncable to anycable
[23:53:18] weaksauce: i'm talking about having to setup another process to handle the anycable stuff. logging/monitoring/etc
[23:56:19] haxx0r: let's try out
[23:56:35] haxx0r: app is pretty easy i think. just broadcast data to the clients.
[23:56:46] haxx0r: if they place a bet, they push data back.
[23:56:48] haxx0r: that's all