jarr0dsz

Activity Graph

Page 1 of 15 | Next »

2019-04-18

[00:05:32] jarr0dsz: has joined #RubyOnRails
[00:06:13] jarr0dsz: hello fellow rubyionists
[00:06:30] jarr0dsz: i would like to ask some advice regarding hosting a rails application under a domain.ltd/customlocation
[00:07:12] jarr0dsz: is there some official documentation on how i would handle this? i need also to have forms and posts from external api all work true this so i hoped i could globally prepend a 'mylocation' to everything that is genrated in rails ( form routes, routes, etc )
[00:16:03] jarr0dsz: so i found this writeup: https://gist.github.com/shad1w/75e7ebbbdc5382719cd06f56bbe6acd0 but form posts do not prepend this custom url route
[00:25:43] jarr0dsz: so setting RAILS_RELATIVE_URL_ROOT does not fix the forms. it would be nasty to manually having to prepend al routings
[00:29:52] jarr0dsz: so its 2019 and i cannot find a documented way for this, guess nobody wants to run rails in a subfolder
[00:38:21] jarr0dsz: anyone knows something better than having to do this: :url => "/" + ENV['RAILS_RELATIVE_URL_ROOT'] + vs_wizard_path do |f| in my whole app?
[01:39:52] jarr0dsz: Quit: Textual IRC Client: www.textualapp.com
[11:06:14] jarr0dsz: has joined #RubyOnRails
[11:06:23] jarr0dsz: hello everyone, with rails 5.x can i have Non-digested asset names ?
[12:08:01] jarr0dsz: Remote host closed the connection

2019-04-17

[09:13:39] jarr0dsz: has joined #RubyOnRails
[14:02:14] jarr0dsz: Quit: My MacBook has gone to sleep. ZZZzzz…

2019-04-16

[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: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: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: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:59] jarr0dsz: so i need to have the headers + the proxy_pass combined working for the /location/ direction is that possible?
[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:50:36] jarr0dsz: Quit: My MacBook has gone to sleep. ZZZzzz…
[18:24:56] jarr0dsz: has joined #RubyOnRails
[18:25:07] jarr0dsz: hello everyone im keep getting a ActionController::InvalidAuthenticityToken on https on my server
[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:28] jarr0dsz: Vaevictus is that a file? i dont understand
[18:28:02] jarr0dsz: i look Vaevictus i dont believe no
[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: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: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:35:57] jarr0dsz: the proxy pass itself works(?) so that cannot be the error(?)
[18:36:36] jarr0dsz: i have exactly the same code as you pasted?
[18:36:57] jarr0dsz: ah like that sorry
[18:37:02] jarr0dsz: i can try and modify it
[18:37:51] jarr0dsz: Quit: My MacBook has gone to sleep. ZZZzzz…
[18:43:30] jarr0dsz: 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.
[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: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: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: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
[21:10:19] jarr0dsz: Quit: My MacBook has gone to sleep. ZZZzzz…

2019-04-15

[10:31:10] jarr0dsz: has joined #RubyOnRails
[10:31:42] jarr0dsz: hello everyone im trying to save and read from a binary file ( encrypted ) data. saving a string to file with mode rb but it fails to decrypt
[10:32:01] jarr0dsz: do i need to use any special syntax to read/write to binary files?
[10:32:47] jarr0dsz: file is saved in ASCII-8BIT im using the gem https://github.com/ankane/lockbox
[10:33:07] jarr0dsz: so just encrypting and decrypting strings work fine, but when i try to save them to file, it fails to decrypt :( tried everything i could imagine
[10:35:02] jarr0dsz: agh i should just use File.binwrite and File.binread, the other examples opening/reading binary do not work
[12:27:20] jarr0dsz: Quit: Textual IRC Client: www.textualapp.com

2019-04-14

[00:56:51] jarr0dsz: Quit: My MacBook has gone to sleep. ZZZzzz…

2019-04-13

[21:44:21] jarr0dsz: has joined #RubyOnRails
[21:44:44] jarr0dsz: hello everyone, i have a list of object attributes i need in several places, can i store them "generic" so i can use them in multiple placeS? ( dry )
[21:45:05] jarr0dsz: for example i have in my strong params this ```params.require(:request_wizard).permit(:request_target)```
[21:45:21] jarr0dsz: and i do at another place @request_wizard.request.attributes.slice('request_uuid')
[21:45:33] jarr0dsz: i look for a way to define the attributes generic so i can use them on several occasions, is that possible?
[21:47:15] jarr0dsz: doing like so: @request_wizard.request.attributes = request_wizard_params seems logic, i think that will also do it? it would only add the variables that have been filled-in though

2019-04-12

[11:32:48] jarr0dsz: has joined #RubyOnRails
[11:33:28] jarr0dsz: hello everyone! Im having a problem im breaking my head on hope some experts can point me in the right direction.
[11:34:10] jarr0dsz: i know its not fancy i have database serialized column. which needs to be exported to CSV so i can reimport it in another database.
[11:35:15] jarr0dsz: Basically my pain is: how can I save a serialized column to a csv ?
[11:36:11] jarr0dsz: User.column_serialized => csv => reimport in different db is my goal
[11:42:29] jarr0dsz: tbuehlmann i tried column_serialized.to_csv when saving the row for the csv but that fails
[11:43:39] jarr0dsz: in my User model i have defined: serialize :column_serialized
[11:44:01] jarr0dsz: so in database #1 its stored correctly, then i move it to csv and import in database #2
[11:44:20] jarr0dsz: if i compare the columns in both databases they are not the same, thus the export of the serialized column to csv is incorrect
[11:44:51] jarr0dsz: but im really struggling how to resolve it, tried serveral solutions from stackoverflow, the docs i just don't understand how i should approach this
[11:47:34] jarr0dsz: tbuehlmann this is my code as-is https://wtools.io/paste-code/bhL
[11:48:03] jarr0dsz: so you suggest i serialize the column to yaml? so the csv value contains the yaml object?
[11:48:21] jarr0dsz: my code example is a bit modified i see i make some mistake but you get the idea
[11:56:12] jarr0dsz: let me try that tbuehlmann
[11:56:34] jarr0dsz: tbuehlmann yes the recieving side also has the column serialized
[11:58:17] jarr0dsz: i dont like serialized column but its for a simple selection list. so what i basically do is re-build the object from the csv values
[11:58:32] jarr0dsz: it now indeed seems to have stored the value as yaml object "--- ..etc.."
[11:58:53] jarr0dsz: so it look like that does the trick, which i very much thank you sir. I tried for 1 hour to resolve this to no avail
[11:59:19] jarr0dsz: should have realized, its saved as some sort of object ( yaml) then export to that object format
[11:59:55] jarr0dsz: how would i then import the database on the other end? I cannot do User = User.new, User.column_serialized = csv_file.serialized_column like that
[12:02:05] jarr0dsz: yes thank you very much tbuehlmann that totally worked
[12:03:16] jarr0dsz: another thing im really struggling with and tried several attempts is to convert this serialized object to a comma seperated list
[12:04:20] jarr0dsz: i tried several .map and object methods but havent really got it worked out either do you know how i could make the yaml object into something like 1,2,3 when for example the object itselfs contains 1,2,3 values as yaml object?
[12:07:02] jarr0dsz: it is a list of integers
[12:07:14] jarr0dsz: but since the serialized column is a varchar they are stored as strings
[12:08:18] jarr0dsz: in my serialized column it is stored like https://wtools.io/paste-code/bhM integers stored as string because column is varchar
[12:11:24] jarr0dsz: hmm even if the column is varchar?
[12:11:52] jarr0dsz: ah that is a stupid question, the yaml object would determine what type it is stored right
[12:12:17] jarr0dsz: would that mean that quotes " around the object mean they are string and non quotes they are integers?
[12:12:23] jarr0dsz: object = the value
[12:14:38] jarr0dsz: its not fancy i can look lateron to refactor that, but for now what would be the best way i convert them to 1,2,3 format?
[12:15:09] jarr0dsz: i now have a very ugly do loop on the object to build this string but its not fancy ( because i could not find a solution to do it neatly 0
[12:40:01] jarr0dsz: tbuehlmann i try that thank you
[12:40:28] jarr0dsz: tbuehlmann i need it to not be an array but a comma seperated list btw so from "1","2","3', to 1,2,3
[12:46:12] jarr0dsz: tbuehlmann yes im using these values in my application
[12:46:27] jarr0dsz: so i just need it to be 1,2,3 then its ok
[13:16:39] jarr0dsz: Quit: My MacBook has gone to sleep. ZZZzzz…

2017-09-13

[11:45:13] jarr0dsz: has joined #RubyOnRails
[11:45:30] jarr0dsz: hello everyone, is there a way to get the index of an object that is part of an activerecord collection?
[11:45:42] jarr0dsz: i could not find this anywhere
[11:46:01] jarr0dsz: so for example 10 users inside @users, i would like to figure out for ech of them what the index would be
[11:57:10] jarr0dsz: i came across that for arrays not sure how that exactly do that with collection
[11:57:28] jarr0dsz: basically i do a @user = User.where(:id => '10')
[11:57:37] jarr0dsz: then want to know what index that user has inside @users
[12:27:29] jarr0dsz: working with rails is not a job its having fun and getting payed for it ;p
[12:29:23] jarr0dsz: Read error: Connection reset by peer

2017-08-09

[09:58:44] jarr0dsz: has joined #RubyOnRails
[09:59:10] jarr0dsz: hello everyone, what would be the best option to have a 'dynamic rails model' with something like mongodb/mongoid
[09:59:47] jarr0dsz: basically im looking for an example like activeadmin where you would be able to setup the model attributes in a simple admin ui
[10:00:26] jarr0dsz: tbuehlmann_ well basically just an 'admin panel' where you can build the attributes dynamically like say a animal with integer field, textfield etc.. i know activeadmin can do this i think but looking for a schemaless datastorage
[15:04:13] jarr0dsz: Quit: My MacBook Air has gone to sleep. ZZZzzz…
[22:29:54] jarr0dsz: has joined #RubyOnRails
[22:30:18] jarr0dsz: hi everyone, is it possible somehow to change the key from a rails form params hash?
[22:31:37] jarr0dsz: for example "organisation"=>{"email"=>"r", ... i want that "organisation" to be renamed to something else but havent found out how to do so
[22:34:35] jarr0dsz: i expected params.update(:email => 'bla') to work also for example
[22:35:07] jarr0dsz: but in this case i need a 'key' rename and cannot find , probably searching wrong anything on how to approach
[22:39:11] jarr0dsz: also this fails params["user"] = params.delete("organisation")
[22:45:14] jarr0dsz: i had some refersh/better errors gem issue it seems the parameter hash is renamed after all
[22:45:40] jarr0dsz: actually im trying to modify devise for an hour now, very simple question one would say. no solution so far. have devise accept multiple models with a single form
[22:46:33] jarr0dsz: now its a bit hackish what i have comeup with so far: https://gist.github.com/jordanlance/f24dc35b09995e66fc55c52bcc2aa0f0
[22:47:06] jarr0dsz: i have found 3 forum topics/google groups in devise 2 stackoverflow posts 3 old gists (2012 area ) and no solution anywhere
[22:47:40] jarr0dsz: so i thought i was smart just checking if the email is in any of the models then just rewriting the parma hashes and modifying the scope but it still does not work
[22:48:18] jarr0dsz: my test case, login as a regular user , the default devise scope = :organisation and all scopes are assigned to route / ( root ) which is my login form
[22:48:34] jarr0dsz: perhaps another lonely soul ad 0:48 my local time has an idea on how this could be resolved
[22:50:04] jarr0dsz: Radar correct typo , no find_by would be faster i assume
[22:52:05] jarr0dsz: Radar so find_by is just a 'wrapper' alias, i red somewhere that find was faster then a where(:id => params[:id]) recently
[22:52:21] jarr0dsz: the strange thing with my code it is still trying to authenticate as :organisation even while it detects my ifelse block
[22:53:01] jarr0dsz: i don't have that link anymore probably not true then overlooked, find is not faster than where?
[22:54:09] jarr0dsz: Radar point made sir just an alias / syntahx then
[22:54:16] jarr0dsz: yes it does return a true Radar
[22:54:55] jarr0dsz: my thought was I just lookup the different Devise models then I know what entity im working with then rewrite the authentication params for devise so it logs in as that entity but this fails
[22:55:44] jarr0dsz: https://gist.github.com/jordanlance/c30866080f3fc2eb9f15142a1e784ad8 <= even after changing the typo, it says invalid password so my first thought was i have to rewrite the params hash so it uses params[:user][:password]
[22:56:29] jarr0dsz: Radar not I assume there are some other params that devise uses
[22:57:51] jarr0dsz: its still messy i have to rewrite the param hash to begin with but for now no idea how to prevent that, devise seems to really not support multiple models 1 login form
[22:58:17] jarr0dsz: jose even posted on the google groups in regard to a post on this subject with no real solution just some pointers using custom warden
[22:58:39] jarr0dsz: my thought was if i can rewrite the request to authenticate in a way that it thinks its a User instead of Organisation it should work
[23:00:03] jarr0dsz: env['warden'].authenticate!(:password, :scope => :publisher) # throws if it cannot authenticate, <= this is from warden.authenticate! a bit lost where that password comes from
[23:00:23] jarr0dsz: i assumed that would be lifted from the params[:my_model][:password]
[23:09:51] jarr0dsz: running a debugger with breakpoint it seems https://gist.github.com/jordanlance/f28db287f323893df0f5583ae73543cb that user is nil
[23:10:05] jarr0dsz: anyone has an idea that could lead in right direction?
[23:56:38] jarr0dsz: Quit: My MacBook Air has gone to sleep. ZZZzzz…

2017-07-27

[15:17:01] jarr0dsz: has joined #RubyOnRails
[15:17:21] jarr0dsz: hi everyone, im still having a frustrating issue with multiple databases and problems with rails AR
[15:17:48] jarr0dsz: the problem is that you can do an establish_connection but it changes the connection for the whole application and all its users that logged in ( devise )
[15:18:14] jarr0dsz: does anyone know how i could fix this problem ? reloading the correct db on every request fails since devise also stores its users in the table so sessions gets lost and things get ugly fast
[15:18:23] jarr0dsz: and havent found any solution so far on how to work around this
[15:19:05] jarr0dsz: ala its related to multitennant, but nothing much comesup on a google search ( yes i know apartment) but i just want to use custom 'solution' it should just be able to keep a db per user session instead of making the db connectoin global
[15:25:46] jarr0dsz: i know there are some solutions out there, but i would like to fix this issue instead of implementing a whole new one
[15:26:07] jarr0dsz: it works great for everything from migrations to seeds i fixed everything up but cannot tackle this AR connection issue ;9
[15:30:28] jarr0dsz: i have this method inside my model to connect to database X and subclass it but it fails on multiple user type logins with devise
[15:30:48] jarr0dsz: i have like so for example establish_connection DB_PROCESSOR
[15:30:59] jarr0dsz: where DB_.. is the config to the db as a constant
[15:33:07] jarr0dsz: ah that is something new that seems interesting sylario
[15:33:53] jarr0dsz: so that only connects to the other db if i specific request it bu current def connection method wraps up the whole establish_connection method then just change the db
[15:34:03] jarr0dsz: but its 'global' for all users that are loggedin
[15:34:45] jarr0dsz: this would allow me to connect to any db, in code, but i think i need to request a 'switch'
[15:37:15] jarr0dsz: ok ill check that thank you sylario
[15:37:40] jarr0dsz: i have this processor.organisations and organisation.organisations (before . is the database after . is the table )
[15:38:03] jarr0dsz: then when using devise to login as organisation role it tries to connect to organisation.organisations db,table
[15:38:29] jarr0dsz: but if logged in at the same time as processor role and reloading the organisation role into a browser using the app it throws exception cannot find processor.organisations
[15:38:35] jarr0dsz: so somehow it just switches the db
[15:39:02] jarr0dsz: beside that im also lost my processor session then, it just disapears ( asssuming devise stores session data in the organisation db , it is switches so its lost ) which makes sense
[15:55:55] jarr0dsz: sevenseacat yes correct, but is there any solution to this?
[15:56:03] jarr0dsz: i can always switch but it has been a great learning
[15:56:36] jarr0dsz: it just seems strange that its not possible to have rails connect to 2 different db's on a per user session base , it seems also strange there is no real multitennant solution in rails by core team
[16:10:49] jarr0dsz: Quit: Textual IRC Client: www.textualapp.com

2017-07-20

[12:47:37] jarr0dsz: has joined #RubyOnRails
[12:47:52] jarr0dsz: hello everyone i have basically this issue: https://stackoverflow.com/questions/41628440/what-is-the-best-way-to-do-per-user-session-database-connections-in-rails and was wondering if there is a workaround
[12:48:35] jarr0dsz: im switching db, which is then systemwide, so on several different devise users it tries to connect to the same db
[12:48:51] jarr0dsz: i need a database connection from AR on a per-user /session based mechanism
[12:57:42] jarr0dsz: nobody knows? is ar establish_connection only locally global and not in production?
[12:58:02] jarr0dsz: since doing a establish_connection seems to be for the whole application so for all users loggedin- since i have multiple user model this throws exceptions
[12:58:27] jarr0dsz: since for example organisation is logged in the db, is switched to a user db, because its systemwide and should only be for that user
[13:00:05] jarr0dsz: nobody knows?
[13:00:51] jarr0dsz: i have looked at it before, we have implemented a custom solution the only problem the db connections are not session based but globally
[13:01:17] jarr0dsz: and really cannot find anything on this very frustrating . establish_connection changes db for the whole app, is this fixable by using threading or something?
[14:01:26] jarr0dsz: Quit: Textual IRC Client: www.textualapp.com

2017-07-04

[09:24:48] jarr0dsz: has joined #RubyOnRails
[09:25:22] jarr0dsz: hi everyone, is there an easy way to add an element to an AR object? say User.first_name, could I add a User.extra in code ?
[09:27:38] jarr0dsz: universa1 I need to add it a for each loop, i know i can add that to the model. but say I have a User object I just need to insert a custom element
[09:29:02] jarr0dsz: universa1 I want to add a custom value to User object. So If user had only a User.first_name I want , in code, add an extra element say User.mycustomelement = "123"
[09:29:20] jarr0dsz: So when I do as User.inspect it would like User.first_name, User.mycustomelement
[09:31:21] jarr0dsz: like so https://gist.github.com/anonymous/1d685350cb364c2d78d3dee6934186a4
[09:31:38] jarr0dsz: digged the manual really cannot figure it out frustrating as hell, it can't be that hard to just add a object element somehow in rails
[09:32:20] jarr0dsz: I need an extra value in the user object that is not there normally.
[09:34:19] jarr0dsz: ah that is so simple indeed *slams himself thank you very much for pointing me out
[09:36:52] jarr0dsz: hm only it still does not work I do like https://gist.github.com/anonymous/3c651442653706a31f7c5964fbf9152e
[09:37:07] jarr0dsz: I changed the model with atr uuid
[09:47:34] jarr0dsz: its just a very simple question with a very simple case.. i could have included the object definition
[09:48:17] jarr0dsz: it still does not work i can set request.uuid = 'xxx' but request would still be the existing object so i need to merge them somehow. seems to be not explained anywhere
[09:59:05] jarr0dsz: very helpfull yeah
[10:13:50] jarr0dsz: Quit: My MacBook Air has gone to sleep. ZZZzzz…

2017-06-30

[12:10:15] jarr0dsz: has joined #RubyOnRails
[12:10:26] jarr0dsz: hi everyone, is is possible to store a model + association into an array?
[12:10:37] jarr0dsz: for example im doing @organisations.push(organisation)
[12:11:06] jarr0dsz: but organisation has also an organisation.organisation_profile, i would like to push it in an array so im able to retrieve the organisation profile and the organisation itself in a convient way
[12:11:16] jarr0dsz: just like regular AR organisation.organisation_profile.name for example
[12:12:18] jarr0dsz: @organisations.push(organisation) only pushes the organisation model data to the array not the associated organisation_profile TheMoonMaster
[12:12:28] jarr0dsz: * tbuehlmann
[12:17:46] jarr0dsz: tbuehlmann im building the @organisations indeed what you say work right after the variable is set, but when rendering a collection it does not work
[12:18:11] jarr0dsz: so when inside the _organisation.haml partial i do not have an organisation.organisation_profile i only have an organisation
[14:30:22] jarr0dsz: hi everyone how could i use an index value inside an array? like. @user[index] instead of @user[0]
[14:30:46] jarr0dsz: cannot figure this out could not be really hard? the index is already an integer but not sure why i cannot just use it like that, does it need to be in another format?
[15:03:25] jarr0dsz: Quit: My MacBook Air has gone to sleep. ZZZzzz…

2017-06-29

[11:31:18] jarr0dsz: has joined #RubyOnRails
[11:41:55] jarr0dsz: hello everyone i have modified my database connectors ( multitennant) so there is no default database connection that is normally initiated from config.yml
[11:42:17] jarr0dsz: so i get Mysql2::Error: No database selected: SHOW FULL FIELDS FROM `organisations` when my session is timedout and the db connection is no longer active
[11:42:41] jarr0dsz: is here a nice way to implement a resque on no database connection? so i can redirect to the login page instead of that my application throws this exception?
[11:43:06] jarr0dsz: i tried to it in a before_filter in my application_controller but this fails since certain calls to the db seems to be made upfront
[11:43:47] jarr0dsz: so ideal would be a way to rescue AR with an exception instead, could not find anything on this
[11:44:19] jarr0dsz: it seems activerecord (5.1.2) lib/active_record/model_schema.rb:471:in `load_schema!' it goes wrong here
[11:45:41] jarr0dsz: Quit: My MacBook Air has gone to sleep. ZZZzzz…
[11:59:18] jarr0dsz: has joined #RubyOnRails
[11:59:35] jarr0dsz: would there be a way to rescue from AR if it fails to connect to db?
[11:59:47] jarr0dsz: i would need to monkey patch the layer where it starts looking for the db
[12:00:52] jarr0dsz: with this stracktrace https://gist.github.com/anonymous/efc9393dc2584abd72545320c41f1c7d
[12:28:16] jarr0dsz: I pointed it down to rescue_from ActiveRecord::StatementInvalid do |e| but is there a 'connection' method not in this class
[12:28:31] jarr0dsz: so i can rescue on the class method that tries to initiate the db anyone knows please?
[12:35:53] jarr0dsz: argh, the problem is my database not found is even called before he applicationcontroller
[14:42:31] jarr0dsz: Quit: My MacBook Air has gone to sleep. ZZZzzz…

2017-06-28

[11:57:56] jarr0dsz: tbuehlmann if i go the Array route,, i have changed it back now, then im stuck at @requests_data = @requests.where('request_type' => 'data')
[11:58:19] jarr0dsz: since @requests would be an array, is there a way to get the correct data from the array then? filter/select from the array instead of using a where?
[12:00:13] jarr0dsz: some find/query method for arrays... select from array where type='x'
[12:37:53] jarr0dsz: is it possible somehow to convert an array to an AR collection?
[12:37:55] jarr0dsz: anyone knows that?
[12:38:07] jarr0dsz: tbuehlmann thank you figured that out in the meantime
[13:10:42] jarr0dsz: Quit: My MacBook Air has gone to sleep. ZZZzzz…