« Back to channel list

#RubyOnRails - 16 April 2019

« Back 1 day Forward 1 day »
[00:17:25] paul0: has joined #RubyOnRails
[00:25:41] orbyt_: has joined #RubyOnRails
[00:34:40] nnielsen: has joined #RubyOnRails
[00:35:32] SteenJobs: has joined #RubyOnRails
[00:48:40] bob14: has joined #RubyOnRails
[00:51:18] SteenJobs: has joined #RubyOnRails
[00:57:50] duderonomy: has joined #RubyOnRails
[01:07:40] mangold: has joined #RubyOnRails
[01:09:01] rascencio: has joined #RubyOnRails
[01:25:36] levifig: has joined #RubyOnRails
[01:34:14] Saukk: has joined #RubyOnRails
[01:39:34] kevinburke: has joined #RubyOnRails
[01:53:23] ule: ActionController::RoutingError (No route matches [GET] "/fonts/gijgo-material.ttf")
[01:53:42] ule: Does anybody knows how do I solve this? I already added this ttf inside app/assets/fonts
[01:53:56] ule: Already added assets.precompile to read *.ttf
[01:54:06] ule: Also already added assets.paths to read fonts/
[01:54:15] ule: I have no more clue
[02:18:12] duderonomy: has joined #RubyOnRails
[02:23:49] ule: nvm, managed to put it working overriding it with asset_url()
[02:39:14] maryo: has joined #RubyOnRails
[03:10:44] braincrash: has joined #RubyOnRails
[03:17:30] sevenseacat: has joined #RubyOnRails
[03:22:53] havenwood: has joined #RubyOnRails
[04:06:53] levifig: has joined #RubyOnRails
[04:15:05] nnielsen: has joined #RubyOnRails
[04:17:52] eckhardt: has joined #RubyOnRails
[04:50:11] pd09041999: has joined #RubyOnRails
[05:33:57] eckhardt: has joined #RubyOnRails
[05:41:28] DTZUZO: has joined #RubyOnRails
[05:57:23] kapil____: has joined #RubyOnRails
[06:15:24] srinidhi: has joined #RubyOnRails
[06:25:34] Dbugger: has joined #RubyOnRails
[06:48:51] pd09041999: has joined #RubyOnRails
[06:52:16] KevinSjoberg: has joined #RubyOnRails
[06:53:13] lipoqil: has joined #RubyOnRails
[06:55:32] Kamuela: has joined #RubyOnRails
[07:00:00] JJonah: has joined #RubyOnRails
[07:02:46] coffeejunk: has joined #RubyOnRails
[07:03:39] lankanmon: has joined #RubyOnRails
[07:14:43] prestorium: has joined #RubyOnRails
[07:16:38] lxsameer: has joined #RubyOnRails
[07:59:49] tdy: has joined #RubyOnRails
[08:34:16] jottr: has joined #RubyOnRails
[08:36:28] xco: has joined #RubyOnRails
[08:40:21] bbbobbb: has joined #RubyOnRails
[08:41:08] deians: has joined #RubyOnRails
[08:41:45] deians: is there any one here able to help me setup rails sessions with redis? i'm hit a wall
[08:57:45] lomex: has joined #RubyOnRails
[09:21:14] phaul: has joined #RubyOnRails
[09:29:52] deians: anyone awake?
[09:33:27] tbuehlmann: deians: what's the problem?
[09:37:48] deians: hi, thanks, i'm trying to get redis do deal with my sessions
[09:38:08] havenwood: deians: what seems to be the issue you're running into, specifically?
[09:38:15] havenwood: deians: how is it not working?
[09:38:40] deians: as i understand it, each instance sets a cookie in the browser, is it possible to grab an anonymous user's ip and write it to redis?
[09:39:24] havenwood: deians: sure, you can write ips to redis or postgres or whatever else 👍🏽
[09:39:43] deians: i have the gem redis, redis-rails and redis-store, it's blowing my mind to work out what to use where and i've trawled for tutorials
[09:39:52] deians: so i'll make my own one when i get this working
[09:40:21] deians: can i paste bin my production.rb?
[09:40:25] havenwood: deians: whatcha using the ips for? is redis the best place to keep them?
[09:41:22] havenwood: deians: sure, code always helps
[09:42:00] deians: it's only until they expire after 15 mins of non activity, then i'll write it to the database
[09:42:05] havenwood: deians: have you considered just using a Model?
[09:42:20] deians: just so i can track individual users and see which ones then sign up and tie them to a location
[09:42:23] havenwood: deians: then i'd use redis-store and store them via cache
[09:42:41] deians: u think i should just write directly to the database?
[09:43:14] havenwood: deians: sure, users have ips - makes sense
[09:43:31] havenwood: deians: if you want to be fancy, you could even namespace under user
[09:43:45] havenwood: deians: class User::IP < ApplicationRecord; self.table_name = :ips; belongs_to :user; end
[09:43:58] deians: i know that reeeeally it's a bit of a no-no to use IP's because they can be spoofed and some may be dynamic
[09:44:40] deians: ....but, i want to be able to grap IP's of non logged in or anonymous users too
[09:45:02] deians: all i know is that each instance has a cookie set in the browser
[09:45:35] havenwood: deians: have you used Rails.cache.fetch before?
[09:46:05] havenwood: deians: that's a nice way to do low level caching in Rails
[09:46:06] havenwood: deians: https://guides.rubyonrails.org/v5.2/caching_with_rails.html#low-level-caching
[09:46:19] havenwood: deians: it works well backed by redis-store
[09:47:10] deians: i'll take a look
[09:48:03] deians: here's my pastebin: https://dpaste.de/CvS7
[09:48:10] havenwood: deians: something like: Rails.cache.fetch("#{session_id/ip_address", expires_in: 15.minutes) do; request.remote_ip; end
[09:48:39] deians: line 60 onwards, does it look right?
[09:50:11] havenwood: deians: looks fine to me
[09:50:50] deians: ok, thanks
[09:51:06] deians: so, will it still set a cookie regardless?
[09:51:43] havenwood: deians: https://www.justinweiss.com/articles/how-rails-sessions-work/
[09:52:47] deians: so that @user.id mentioned in that article is the one set by the cookie?
[09:52:49] havenwood: deians: I'd suggest just reading this one ^ nicely-written article on Rails sessions to get up to speed.
[09:53:24] havenwood: deians: No, @user there is an instance of the User model, and #id is the database ID.
[09:54:02] deians: so does it imply that it's already talking with Devise?
[09:54:05] havenwood: deians: (That first example shows how to put that user id on the session.)
[09:54:30] havenwood: deians: it's just an example of a thing often stored on a session - your user's id
[09:54:34] deians: so that user_id can be anything?
[09:54:39] havenwood: deians: yes
[09:54:57] havenwood: session[:key_goes_here] = 'value here'
[09:55:07] deians: so i can even create a GUID and grab an IP and write it to the database?
[09:55:33] havenwood: deians: users can have many ips, in the db - you can just have an association, and store every ip you ever see for a user
[09:56:07] havenwood: deians: you can do it so many ways. as far as the session goes, i'd recommend slogging through that article
[09:56:15] deians: ok thats great
[09:56:24] deians: i think i may have been overthinking this
[09:56:46] deians: as per usual with me
[09:58:08] deians: is it easy to grab more data through rails so i can properly fingerprint users?
[10:05:38] jottr_: has joined #RubyOnRails
[10:20:35] jottr: has joined #RubyOnRails
[10:25:57] lomex: has joined #RubyOnRails
[10:52:08] lankanmon: has joined #RubyOnRails
[10:55:58] xco: has joined #RubyOnRails
[11:25:36] jottr: has joined #RubyOnRails
[11:37:52] mangold: has joined #RubyOnRails
[11:41:43] tdy: has joined #RubyOnRails
[11:58:55] jottr: has joined #RubyOnRails
[12:13:26] hive-mind: has joined #RubyOnRails
[12:15:32] MrCrackPotBuilde: has joined #RubyOnRails
[12:20:11] MrCrackPotBuilde: has joined #RubyOnRails
[12:22:08] cxl: has joined #RubyOnRails
[12:50:29] fmcgeough: has joined #RubyOnRails
[12:53:01] Technodrome: has joined #RubyOnRails
[12:55:08] pd09041999: has joined #RubyOnRails
[13:45:38] duderonomy: has joined #RubyOnRails
[13:50:38] ghormoon: has joined #RubyOnRails
[13:52:53] MrCrackPotBuilde: has joined #RubyOnRails
[14:11:07] Vircung: has joined #RubyOnRails
[14:21:24] mangold: has joined #RubyOnRails
[14:23:51] Ergo: has joined #RubyOnRails
[14:27:29] skryking: has joined #RubyOnRails
[14:30:24] skryking: has joined #RubyOnRails
[14:31:13] lomex: has joined #RubyOnRails
[14:36:33] srinidhi: has joined #RubyOnRails
[14:37:28] brool: has joined #RubyOnRails
[14:55:06] coffeejunk: has joined #RubyOnRails
[15:02:04] lipoqil: has joined #RubyOnRails
[15:07:49] rascencio: has joined #RubyOnRails
[15:10:27] ht85: has joined #RubyOnRails
[15:13:15] ht85: I'm trying to understang the rails database connection / session model. My goal would be for each request to use a single database session, and not release it until the request terminated.
[15:13:27] ht85: is there a way to accomplish that easily?
[15:14:50] _aeris_: has joined #RubyOnRails
[15:40:43] ht85: Gonna try to make my question more specific. I'm running `SET somevariable = ...` in application_controller, it runs correctly, but subsequent active record database queries do not see that variable.
[15:41:32] ht85: It means active record is using a different database session, than the one I'm getting when calling `ActiveRecord::Base.connection.execute`
[15:54:25] xco: has joined #RubyOnRails
[15:54:42] dtzuzu: has joined #RubyOnRails
[16:00:06] Vaevictus: has joined #RubyOnRails
[16:01:36] Vaevictus: I've got a destination setting that'll be authenticating my users in the webserver... anyone have a good way to prototype/develop an app such that my tests (in the rails server piece) supply (faked) users?
[16:02:01] Vaevictus: (specifics: mod_auth_kerb on apache, provides username as REMOTE_USER)
[16:03:46] Vaevictus: i suppose what i'm asking is for information on how to write tests and configure environments to fake the environment
[16:06:49] Saukk: has joined #RubyOnRails
[16:11:43] duderonomy: has joined #RubyOnRails
[16:11:52] defsdoor: has joined #RubyOnRails
[16:11:55] pd09041999: has joined #RubyOnRails
[16:18:06] jarr0dsz: has joined #RubyOnRails
[16:18:36] jarr0dsz: hello everyone, im deploying rails application on https and it throws invalid ActionController::InvalidAuthenticityToken
[16:18:37] pd09041999: has joined #RubyOnRails
[16:18:46] jarr0dsz: so i found some information online https://ziyan.jdeen.com/code/2018/03/18/rails-5-invalid-authenticity-ssl.html
[16:19:26] jarr0dsz: but it does not work since i need a proxy_pass http://form_vog-5000/;
[16:19:27] jarr0dsz: directive also and these cannot be combined?
[16:19:44] jarr0dsz: anyone an idea how i can resolve this? its driving me insane, im tried al lcombinations it just won't work.
[16:32:16] ht85: jarr0dsz what do you mean combined? the article is about adding proxy_set_header directives, not proxy_pass
[16:32:40] jarr0dsz: yes i know, and i need ot have the proxy headers set but also have the proxy pass working ht85
[16:33:05] jarr0dsz: and i cannot get it work, i just combined them as-is in the example but now my /mylocation/ just throws back http://app_appname:5000 in my browser
[16:33:23] jarr0dsz: mydomain.ltd/mylocation that is
[16:34:57] ht85: sorry I'm having a hard time following what you're trying to accomplish and what is happening... does the proxy target receive the headers correctly?
[16:35:08] ht85: is there some unwanted redirection happening?
[16:35:28] jarr0dsz: yes it redirects to the link i posted above.
[16:35:40] jarr0dsz: i need those proxy headers because of how my rails application works
[16:35:55] nnielsen: has joined #RubyOnRails
[16:35:59] jarr0dsz: so i need to have the headers + the proxy_pass combined working for the /location/ direction is that possible?
[16:36:48] ht85: yes, whatever proxy_set_header you add in a block with proxy_pass with send that particular header to the target of proxy_pass
[16:36:55] ht85: will send*
[16:37:42] jarr0dsz: so how can it be that i see the internal proxy in my browser then?
[16:37:59] jarr0dsz: i mean the internal proxy name http://app.appname:5000 is loaded in the browser with this config
[16:41:03] ht85: could you the nginx config for that domain somewhere?
[17:04:28] agent_white: has joined #RubyOnRails
[17:19:27] mondz: has joined #RubyOnRails
[17:23:09] xco: has joined #RubyOnRails
[17:27:20] rascencio: has joined #RubyOnRails
[17:30:02] ziyadb: has joined #RubyOnRails
[17:30:45] ziyadb: I'm having trouble with devise, it's been frustrating me for a day. I've uninstalled the gem and reinstalled it, nothing seems to make any difference
[17:32:00] hammer065: has joined #RubyOnRails
[17:33:35] ziyadb: the worst part is it passes everything in the URL like:
[17:33:41] ziyadb: http://localhost:3000/users/sign_up?utf8=%E2%9C%93&authenticity_token=rGqn0XsnFvp4XUiUe44IJ7jnPicgira3n9ugSZeSSVGu4z3AgLKri5B8UzZjw9ueUxfISNaYEPs7dwvOeglIQQ%3D%3D&user%5Bemail%5D=test%40example.com&user%5Bpassword%5D=MyPassword&user%5Bpassword_confirmation%5D=MyPassword&commit=Sign+up
[17:33:49] ziyadb: and then it just rerenders registrations#new
[17:33:57] ziyadb: so the create method is not even called
[17:37:48] ziyadb: the forms are practically dead
[17:50:42] uksio: has joined #RubyOnRails
[17:59:09] ziyadb: I would appreciate any help...
[18:02:34] agent_white: has joined #RubyOnRails
[18:05:18] LtHummus: has joined #RubyOnRails
[18:07:10] Vaevictus: ziyadb: i'm not sure why your app is GETing rather than POSTing, but i haven't ever used devise
[18:10:15] ziyadb: Vaevictus: that makes two of us. but the get/post issue is a critical one, indicates that there's something terribly broken.
[18:10:53] Vaevictus: i'd have to agree there
[18:10:57] Vaevictus: what's the code look like?
[18:11:46] ziyadb: I don't think there's much I can do beyond share the entire codebase, since what caused the problem wasn't resolved by a reinstall of devise
[18:12:02] ziyadb: here's an online version for you to inspect https://beta.mattersource.com/users/sign_up
[18:12:34] Vaevictus: that for looks like it wants to post
[18:12:57] ziyadb: does it though? Rails Panel just makes it GET GET GET #new
[18:13:14] ziyadb: on the logs no #create request comes in
[18:13:40] ziyadb: other than that the devise install is 100% vanilla..let me make a gist of the routes and all
[18:13:46] Vaevictus: interesting
[18:13:53] Vaevictus: the form actually has method=post
[18:13:56] Vaevictus: but it doesn't
[18:14:05] Vaevictus: which makes me think you've got something going on other than posting
[18:14:09] Vaevictus: validation issue or something
[18:14:45] Vaevictus: possibly relevant: it's going back to the signup page
[18:14:49] Vaevictus: perhaps it's failing submission?
[18:14:57] Vaevictus: and GET would be trying to repopulate the fields?
[18:15:04] Vaevictus: are you displaying errors on that page anywhere?
[18:15:18] Vaevictus: be aware, my rails knowledge is 4 or 5 versions behind
[18:16:57] Vaevictus: also, where are you storing new users? are they getting stored?
[18:19:37] ziyadb: https://gist.github.com/ziyadbasheer/08d7dd0c75379e8651276fb098133959
[18:20:03] prestorium: has joined #RubyOnRails
[18:20:42] lxsameer: has joined #RubyOnRails
[18:20:42] ziyadb: I don't think errors are getting displayed, since they aren't showing up even if I deliberately poison the fields
[18:21:12] Vaevictus: well, historically it seems like a GET for a sign_up makes sense on an error
[18:21:53] Vaevictus: you're using postgre?
[18:22:10] ziyadb: users go in postgres, I added the schema and the model.rb to the gist (refresh)
[18:22:40] Vaevictus: okie, but is there user data in postgre right now?
[18:23:13] ziyadb: https://www.irccloud.com/pastebin/5HHkSvT3/
[18:23:15] Vaevictus: okay, so signups are failing
[18:23:34] ziyadb: clearly, since it's not posting, or if it is, the #create action is never triggered
[18:23:52] Vaevictus: so ... we need to start displaying errors
[18:24:45] ziyadb: I don't suppose <%= notice %> in my layout/application.html.erb would cut it?
[18:24:56] jarr0dsz: has joined #RubyOnRails
[18:25:03] Vaevictus: that's beyond the scope of my current knowledge
[18:25:05] Vaevictus: i'd start there
[18:25:07] jarr0dsz: hello everyone im keep getting a ActionController::InvalidAuthenticityToken on https on my server
[18:25:15] Vaevictus: notice contains all the errors and other remarks, right?
[18:25:32] ziyadb: Vaevictus: I don't believe so, since devise has its own _error_messages partial
[18:25:37] jarr0dsz: i have been unable to fix it, higly frustrating anyone expierienced this? i found on stackoverflow a message saying its rails 5 related
[18:26:08] jarr0dsz: its only on POSTS on https only then im getting ActionController::InvalidAuthenticityToken and a 422 error view is rendered
[18:26:15] Vaevictus: jarr0dsz: under request_forgery_protection.rb ?
[18:26:28] jarr0dsz: Vaevictus is that a file? i dont understand
[18:26:40] Vaevictus: part of your error trace
[18:27:04] ziyadb: it's called in the new.html.erb, so it should show if there are errors, that is to say, whenever I used to input invalid information for example, it would return an error, but it's not even getting there to render and error, whats happening here is completely invisible to me since no errors are raised
[18:27:21] ziyadb: s/and error/an error/
[18:27:26] Vaevictus: ziyadb: sign_up though?
[18:28:02] jarr0dsz: i look Vaevictus i dont believe no
[18:28:14] ziyadb: users/sign_up -> users/registrations#new hence new.html.erb
[18:28:14] jarr0dsz: https://0bin.net/paste/eAxq-xNLzERT180F#YTTPd6nYh8mKePGHCi8X4z2mSZoGnhvpBr-12Xs4XbZ <= i added this header to my proxy directive for the location. but it still fails
[18:28:25] jarr0dsz: someone mentioned that on stackoverflow as a solution
[18:28:40] jarr0dsz: so i now have. production app that is unreachable and im unable to find a solution /documentation on why this happens :S
[18:29:04] jarr0dsz: i tried the past hour to fix all kind of solutions tried, really a bit desperate at this point
[18:29:42] Vaevictus: shoud form-5000 be form:5000 ?
[18:29:54] Vaevictus: also, you're doing proxying with CSRF ?
[18:30:19] jarr0dsz: in application controller i have ``` protect_from_forgery with: :exception ``` is that correct even?
[18:30:39] jarr0dsz: Vaevictus yes im using proxy to 'attach' my rails application onto a subfolder of domain.ltd
[18:30:55] jarr0dsz: so domain.ltd/myform is proxying to the rails app on port 5000 ( docker setup )
[18:31:29] jarr0dsz: the form directives are all correct i just keep getting the error generated by the running rails app and it runs fine untill i do a POST
[18:31:47] Vaevictus: right, but proxy_pass has a hyphen where a colon should go?
[18:32:14] Vaevictus: i don't know anything about rails CSRF mitigations
[18:32:30] Vaevictus: if it's down in production somehow, you could temporarily suspend forgery checking, but that's dangerous
[18:32:46] jarr0dsz: yes im going to suspend it now yes i need this to run :S
[18:34:19] jarr0dsz: Vaevictus im not sure about the hypen comment my language is not native english
[18:34:40] Vaevictus: https://0bin.net/paste/iTlhnq5CfInXsvf8#icrBxx7UR5C2pbLPG6ij+GXUBfHjDMkXElgML1eJwAY <-- maybe?
[18:35:03] Vaevictus: do you have a - in the proxy_pass line where you need a : ?
[18:35:35] Vaevictus: i'm pretty sure you do need my version
[18:35:57] jarr0dsz: the proxy pass itself works(?) so that cannot be the error(?)
[18:36:13] Vaevictus: well, -5000 is invalid
[18:36:17] Vaevictus: so i don't know how it works
[18:36:29] Vaevictus: perhaps it's invalidating the whole line
[18:36:36] jarr0dsz: i have exactly the same code as you pasted?
[18:36:46] Vaevictus: you pasted one with -5000 instead of :5000
[18:36:57] jarr0dsz: ah like that sorry
[18:37:02] jarr0dsz: i can try and modify it
[18:37:52] gambl0re: has joined #RubyOnRails
[18:40:03] dviola: has joined #RubyOnRails
[18:42:59] ascarter: has joined #RubyOnRails
[18:43:30] jarr0dsz: has joined #RubyOnRails
[18:58:19] lomex: has joined #RubyOnRails
[18:58:53] jarr0dsz: if i have just a protect_from_forgery not with an exception error, will my app still run? or will it fail anyway
[18:59:16] jarr0dsz: i try to understand how this relates to the https and this error but i don't understand and cannot debug/any pointers to debug this.
[18:59:38] jarr0dsz: i checked the - vs : Vaevictus it is correct, dokku has the containers referred like that.
[18:59:59] Vaevictus: no idea then. I believe your issue is related to CSRF
[19:00:11] jarr0dsz: basically those parts are all correct in place. I just keep getting that ActionController::InvalidAuthenticityToken .
[19:00:32] jarr0dsz: So that means the AuthenticityToken is not passed? even though its in my application layout ( the html tag )
[19:03:16] jarr0dsz: so if i remove the exception than its just stuck in my application :|
[19:03:27] jarr0dsz: nobody has encountered this and could point me in right direction please?
[19:06:01] jarr0dsz: so now in my application_controller i try skip_before_action :verify_authenticity_token
[19:14:25] dviola: has joined #RubyOnRails
[19:26:31] jarr0dsz: i think i might have the problem because of rails 5.2 new secrets
[19:26:41] jarr0dsz: and i have not defiend a secret key for production on my production environment
[19:27:04] jarr0dsz: so 'Your secret key is used for verifying the integrity of signed cookies.’ that could explain why i get the invalid csrf error right
[19:28:00] ascarter_: has joined #RubyOnRails
[19:32:13] jarr0dsz: does SECRET_BASE_KEY still work for rails 5.2? or should i use the new system totally... or can i thus set this environment variable to resolve my issue?
[19:36:12] jarr0dsz: so i basically added the credential files from a new rails 5.2 project created and try a new deploy now , assuming this was causing the issue
[19:41:40] jarr0dsz: and its STILL not resolved
[20:06:24] maryo: has joined #RubyOnRails
[20:09:37] ascarter: has joined #RubyOnRails
[20:18:43] ascarter: has joined #RubyOnRails
[20:21:17] jarr0dsz: modified nginx headers still not working nobody an idea?
[20:21:43] jarr0dsz: i even disabled the checks in config, it still complains not valid authenticity
[20:30:30] orbyt_: has joined #RubyOnRails
[20:30:33] bensonny: has joined #RubyOnRails
[20:30:43] bensonny: Hi there. Any reason to keep using ERB when things like slim and haml exist?
[20:49:00] s2013: has joined #RubyOnRails
[21:08:38] s2013: has joined #RubyOnRails
[21:14:14] Fernando-Basso: has joined #RubyOnRails
[21:15:43] fmcgeough: has joined #RubyOnRails
[21:16:13] fmcgeough: has joined #RubyOnRails
[21:17:22] fmcgeough_: has joined #RubyOnRails
[21:40:10] ascarter: has joined #RubyOnRails
[21:45:55] ascarter_: has joined #RubyOnRails
[22:13:06] ascarter: has joined #RubyOnRails
[22:31:22] orbyt_: has joined #RubyOnRails
[22:48:55] xco: has joined #RubyOnRails
[22:50:22] atrius: has joined #RubyOnRails
[23:09:13] lunarkitty7: has joined #RubyOnRails
[23:35:13] Haydos: has joined #RubyOnRails
[23:41:20] orbyt_: has joined #RubyOnRails
[23:50:51] ascarter: has joined #RubyOnRails
[23:53:07] gb_away: has joined #RubyOnRails
[23:59:41] tdy: has joined #RubyOnRails