Page 1 of 16 | Next »
[13:25:33] jarr0dsz: hello everyone im trying to deploy an previous working app and i get an exception ; NameError: uninitialized constant Rack::LiveReload
[13:27:53] jarr0dsz: ah nevermind it seems im missing environmental variable and the development.rb is loaded in production env with the livereload gem enabled there
[13:56:28] jarr0dsz: what would be the best way to debug a production app that does not keep session variables in https? i re-installed an app today but now it does not persist values stored in session so i have a form of 2 steps and only the session data from the 2nd step if submitted, the 1st step variables are lost :(
[11:01:15] jarr0dsz: hello everyone, is rails 6 rc1 stable enough to use in production or is this not advisable?
[11:01:56] jarr0dsz: i have upgraded basically to 6 and want to have a Product model use another database ( not using read/write copies of db) is it possible to connect to just a product_development database from a model Product?
[11:02:30] jarr0dsz: I red the documentation on multiverse and migrated from that to rails 6 but i find it a bit unclear on how to proceed, everywhere the read/write database replication is used in examples And i only want to connect a different db
[11:11:41] jarr0dsz: so is there a writeup / documentation on connecting to single different databsae instead of replica? i cannot find anything so far
[14:10:39] jarr0dsz: rails 6 i mean anyway? instead of replicating just connect to single other db from model?
[19:51:24] jarr0dsz: hello everyone im loading database seeds and end up non complete rows in my datavs=
[19:52:09] jarr0dsz: the issie is I have after_initialize :default_associations in my model that creates the associated models ,for example student and student_profile
[19:56:18] jarr0dsz: quick copy from my models to illustrate: https://gist.github.com/michaelsalexander83/fc905f6d74022bbc5960b215db80bda1
[19:56:41] jarr0dsz: how would one solve this problem? removing the method from my student model prevents the associated models created, and if i leave them in the seeds will create double entry in db :(
[20:41:49] jarr0dsz: quick copy from my models to illustrate: https://gist.github.com/michaelsalexander83/fc905f6d74022bbc5960b215db80bda1 has any ruby expert a suggestion how i could fix this?
[20:42:19] jarr0dsz: the problem is im not able to seed + have my model create association on initializing, i end up with incomplete rows in my db
[21:00:41] jarr0dsz: anyone an idea how i could resolve the empty rows in db with seeds and associations?
[22:06:52] jarr0dsz: i made a mistake and could not find how to roll it back, is it possible at all?
[22:10:27] jarr0dsz: ah, wouldent that be a nice feature for rails to have? then i have to manually correct :(
[21:19:14] jarr0dsz: hello everyone, i require my production database to have certain tables to be Not present.
[21:20:03] jarr0dsz: for example I have admin environment that only runs locally and i do not requre 'admins' table in production database, also other tables should not be in production database, is there a way to have schema.rb for production with these tables excluded? could not find anything so far
[21:21:31] jarr0dsz: it will not break but the admin controllers/views/routes are excluded for production.
[21:21:50] jarr0dsz: so its more to keep things 'dry' in the production environment and perhaps security wise it would be better
[21:22:19] jarr0dsz: another thing i stumbled on is that i found no way in rails to disable/ protect the console in production. I hope someone knows a solution for that too.
[21:22:48] jarr0dsz: Since i have encrypted data, personal data that cannot be leaked the whole db is encrypted ( certain columns ) now when console is available this is a security issue perhaps.
[10:50:36] jarr0dsz: hello everyone, is there a good way to have a specific schema.rb for production only?
[10:50:51] jarr0dsz: i solved my encryption issues it was a gem require false that caused all issues ;0
[14:54:27] jarr0dsz: hello everyone im investigating encryption options for ruby on rails ActiveRecord.
[14:56:29] jarr0dsz: I already asked before but im not sure on the best way to go, rbnacl seems a good gem for encryption but i understand from the docs that it cannot do ActiveRecord encryption 'automagic'
[14:56:50] jarr0dsz: then there is semmantic encryption gem which seems to be best option with aws integration for kms but the implementation is unclear to me after reading the docs
[14:57:22] jarr0dsz: has anyone implemented https://github.com/rocketjob/symmetric-encryption or knows an opensource application that implements it so i can look into/learn from it?
[15:31:35] jarr0dsz: attr_encrypted seems most used but it seems also outdated non maintained. and it requires an extra column column_encrypted in the db
[15:32:05] jarr0dsz: the symmetric-encryption does not require this but the implementation i dont understand, i followed the instructions but im receiving exception.
[15:32:22] jarr0dsz: so my thought was to look into a example implementation. to see what i have done wrong.
[15:59:41] jarr0dsz: ok i followed the exact steps for configuration but recieving a Unknown type :encrypted have , i assumed setting the column encryption in model would encrypt/decrypt values according to the documentation.
[16:01:40] jarr0dsz: encryption seems to work fine from the rails console, so im a bit confused what im missing.
[16:02:09] jarr0dsz: i know i can use own module but since im new to encryption i assumed using a gem would work best. since it also support aws kms ouf of the box.
[16:02:36] jarr0dsz: perhaps its this line require 'symmetric_encryption/core' i have included this in my application_controller would that not make it available in the models also?
[16:02:51] jarr0dsz: in that case i would need to require it at the model layer instead ( inside my models that use encryption )
[16:03:40] jarr0dsz: it seems that also fails require at model layer, have to digg the documentation a bit deeper its not very clear what i missed.
[16:05:09] jarr0dsz: https://rocketjob.github.io/symmetric-encryption/frameworks.html this is the section of the documention listing how to implement it in ralis 5 model which i followed exactly
[16:07:25] jarr0dsz: ok i understand but rather use the gem because it supports aws and prevents beginners mistakes in encryption.
[16:07:52] jarr0dsz: i can even encrypt a file in terminal it only seems to throw exception in rails model, Unknown type :encrypted what would be the best way to debug this?
[16:08:23] jarr0dsz: i assume the gem provides this attribute :email, :encrypted :encrypted function.
[16:08:46] jarr0dsz: however it seems the gem is loaded fine, in console it works corretly. so a bit confused why this exception is thrown
[16:14:37] jarr0dsz: according to this: https://metova.com/rails-5-attributes-api/ it seems attribute :price, :integer and integer is default type, so my :encrypted type is a non default type which should be provided by the gem (?)
[16:15:03] jarr0dsz: just reading the docs thats is my interpretation, is there i way i could best debug why my custom :encrypted type fails to be defined?
[16:15:20] jarr0dsz: i assume the gem is not correctly loaded somehow or does not provide the custom encrypted type to the application
[16:29:27] jarr0dsz: i have the gem installed and moved the require 'symmetric_encryption/core' back to the application_controller it seems to me the custom encrypted type is not made available. using postgres i read some documentation on custom types but i assume the gem would take care of this
[16:30:52] jarr0dsz: i do however in rails console after do a require for the gem , get an error SymmetricEncryption::ConfigError (Call SymmetricEncryption.load! or SymmetricEncryption.cipher= prior to encrypting or decrypting data)
[16:32:36] jarr0dsz: so tried this https://gist.github.com/michaelsalexander83/932dfaf6a90d61476f7a63a83699ab4a but also fails with same exception Unknown type :encrypted
[16:36:31] jarr0dsz: perhaps i should look at alternative solution. If i can't get it to work :( Basically I only need simple encryption with AWS kms keystore, there are more gems providing this
[16:49:33] jarr0dsz: seems to be unable to fix the problem with the gem, anyone has any thoughts on how i could resolve?
[16:50:09] jarr0dsz: after require core module from gem with require '' it seems i need to even load SymmetricEncryption.load! to be able to encrypt which is logic. but the error in models persist
[18:32:12] jarr0dsz: does anyone maybe have an idea how i could debug attribute :name, :encrypted, random_iv: false, Unknown type :encrypted im still trying to resolve this to no avail for the gem https://github.com/rocketjob/symmetric-encryption
[18:32:56] jarr0dsz: i have run the testcase and inspected code and see nothing i missed in my own codebase, the only difference im using postgres and the rest only are written for sqlite and mongodb
[18:33:31] jarr0dsz: is there anything i need to consider when using a custom cast type for postgres with rails 5 ? i really need this encryption solved before i can launch my application
[18:35:34] jarr0dsz: or could anyone point me to howto on how to implement encrypt/decrypt for AR and be able to use amazon KMS lateron?
[21:14:30] jarr0dsz: hello everyone, i still havent resolved my issue with ArgumentError: Unknown type :encrypted for attribute :name, :encrypted, random_iv: false, type: :string
[21:15:01] jarr0dsz: what would be the best way to debug this? this is related to semmetric encryption gem. followed the docs 2x times rechecked everything but it just fails with this exception everytime.
[21:49:33] jarr0dsz: hello everyone, could anyone advice on a gem for encryption in rails? i reviewed several gems most of them are outdated like strongbox.
[21:49:55] jarr0dsz: my goal is to provide data encryption in db, postgres and have strong encryption with as less headache as possible.
[21:51:03] jarr0dsz: https://github.com/attr-encrypted/attr_encrypted/ seems most popular but many open issues. then https://github.com/rocketjob/symmetric-encryption seems the most promising up2date gem, but. i have a hard time implementing it.
[21:51:19] jarr0dsz: and im not sure its compatible with the latest ruby and rails versions ( 5.x version )
[21:53:14] jarr0dsz: i will investigate that gem a bit further than, preferrable i have it hooked up with a KMS that is remote, so i basically end up with a solid solution that is hard to decrypt even when the server is compromised ( peace of mind )
[21:54:23] jarr0dsz: ive looked briefly at it, it looks like a more complete solution than the ones i mentioned havenwood thank you very much.
[21:55:08] jarr0dsz: i also found the 'vault hashicorp' "kms" opensource version but im not sure about it, i assume one would have to install this on another server and store the keys for encryption there.
[21:55:35] jarr0dsz: which means another vps, + the change it gets broken into anyway, aws kms seems most save / solid solution(?)
[21:56:22] jarr0dsz: ah great *bookmarks it will be my first encryption implementation it will be a bit steep the implementation i guess.
[21:57:12] jarr0dsz: yes im using lockbox currently on another project. to encrypt contents of mails, but i think it does not support AR encryption. Its more a file encryptor
[21:58:20] jarr0dsz: I think from rbnacl that the strategy https://github.com/crypto-rb/rbnacl/wiki/Secret-Key-Encryption fits my goal
[22:00:23] jarr0dsz: basically the activerecord colums should decrypt for the logged-in user and be encrypted otherwise ( in the db itself) preferrable thus with a remote KMS like on AWS to store the keys
[22:02:12] jarr0dsz: it seems from reading quickly the docs that rbnacl does not transparantly decrypt/encrypt AR columns ? one would have to do something like: box = RbNaCl::SimpleBox.from_keypair(public_key, private_key); box.encrypt("data")
[21:30:24] jarr0dsz: hello everyone i have a very frustrating issue with Rails 5 and devise which i seem unable to solve
[21:30:43] jarr0dsz: my method: https://gist.github.com/michaelsalexander83/24c4d752b2a07306e558a32800c552b1 i want to use the Rails.env.environment here to make the redirects conditional.
[21:31:20] jarr0dsz: however that does not work, i seem to be unable to use a Rails.env.development? block around the case, it just throws exception. The reason for this is that I do not have Admin entity in production mode. Since im not running admin in production but only development.
[21:32:16] jarr0dsz: So now my redirect url's break because Admin does not exists in production. I tried all kinds of things but it just won't work. Also I cannot even use a raise() inside the devise controller with console or pry. Anyone knows a solution to have a working solution?
[21:32:35] jarr0dsz: I need to 2 case resource_or_scope blocks, 1 for Rails.environment and 1 for Production
[21:53:13] jarr0dsz: its all default code, but it seems devise does not work with using Rails.env.production? around the resource case statement. its very strange this is not working its just basic rails code
[21:55:46] jarr0dsz: full controller is like: https://gist.github.com/michaelsalexander83/6f6ddeb5f8ce69213cae47d023f0629a
[21:56:07] jarr0dsz: it throws an exception that it cannot find the entity that is not defined in Production. which is Admin for example
[21:56:47] jarr0dsz: case resource_or_scope ; when :admin, Admin for example I have no Admin defined in production ( my admin only runs locally )
[21:57:27] jarr0dsz: so my logic thought was put Rails.env.production? around the blocks and have 1 for prod/dev but that doesent work either
[21:58:38] jarr0dsz: the pry.binding also does not work. it seems the devise controller is somehow differnetly executed. which is very frustrating
[22:02:45] jarr0dsz: NoMethodError (undefined method `organisation_url' for #<Deviser::SessionsController:0x00007fd01bb09df0> for example
[22:06:57] jarr0dsz: it does basically the same if its inside application or devise controller but i shall try moving it t oapplication perhaps i have Rails.env available there without error
[00:30:21] jarr0dsz: mlt- you mean defining def current_organisation inside the application controller?
[00:37:21] jarr0dsz: sounds indeed like logic, it then throws an processor_signed_in? so the current_processor is getting defined.
[00:37:33] jarr0dsz: now i also have the problem im using current_organisation in some of my controllers ;(
[00:38:03] jarr0dsz: basically i have for example an education_controller with current_organisation, current_admin etc.
[00:38:24] jarr0dsz: because based on the entity i need to set certain variables. I did it like that to keep things dry.
[00:38:57] jarr0dsz: So i guess i would need to define a current_anything in both the view and controller layers. bogus objects that hold no value just to prevent nil exceptions.
[00:40:29] jarr0dsz: would this actually be safe? or would such a workaround allow someone to elevate a current_organisation towards a current_admin for example?
[00:41:38] jarr0dsz: i have only 1 shared 'wizard' controller that has checking of current_organisation and current_admin . when the current_admin exists it sets some extra database columns
[00:45:53] jarr0dsz: its admin devise user and admin dashboard so to say, where i handle certain tasks.
[00:46:13] jarr0dsz: since the data is encrypted my idea is to connect to production database remotely within admin and handle all the tasks offline.
[00:47:04] jarr0dsz: dangerous in terms of there is lots of work in it. so with encryption and this code not in my vps online it seems to me im more secure
[23:57:29] jarr0dsz: hello everyone. Im having a problem that after long research i cannot figure out how to resolve
[23:57:48] jarr0dsz: its regarding using a current_organisation in my views for conditional logic, but i don't want to define a current_organisation in my production environment.
[23:58:19] jarr0dsz: its for devise, any ruby expert knows how i could resolve this? to prevent nil exepcetions within the views on production where i have not defined devise current_organisation ?
[23:58:42] jarr0dsz: the reason for this i want certain user roles in devise not deployed in production but i dont want to seperate all my views based on user, since it would not be dry
[23:59:34] jarr0dsz: my basic idea would to define current_organisation as something so its not nil but with no roles/access to anything because im not divining a 'real organisation' in devise
[12:53:00] jarr0dsz: hello everyone, i have specified resource as resources :requests, :as => :customers, :path => "/customers", param: :uuid do ...etc..
[12:53:17] jarr0dsz: but the problem is my named route for editing still uses the ID in the view no matter what I try.
[12:53:52] jarr0dsz: even when i do it like ``` = link_to edit_customer_path(@request.uuid) do``` it ends up with a link to /edit/1 for example
[12:54:10] jarr0dsz: how can i resolve this? i tried to fix this for 1 hour with no result reading all docs changing my routes etc.
[12:57:31] jarr0dsz: I do have to explicit use something like edit_customer_path(@request.uuid) ? I added uuid with postgres for rails 5 but it seems i cannot do edit_customer_path(@request) it always uses the id then
[17:38:40] jarr0dsz: hello everyone, im using devise and have a current_user and current_organisation in my views for conditional rendering
[17:39:40] jarr0dsz: hello everyone, im using devise and have a current_user and current_organisation in my views for conditional rendering
[17:39:58] jarr0dsz: but im not deploying my full code to the server, for example the organisation environment is only locally run.
[17:40:33] jarr0dsz: is there some way to rescue from the current_organisation nil error because it is not defined on my remote server and only in develepment mode
[22:09:47] jarr0dsz: hello everyone, im trying to manually create a record in rails ( no strong params ) i have organisation with users.
[22:10:32] jarr0dsz: I try to create user like user = User.new, user.organisation_id = 1, then a User.save(:validate => false ) this still throws an error that organisation must exists ( i have organisation with id = 1 in db ) is there a better way to do this?
[22:11:01] jarr0dsz: i ment user.save(:validate => false) because the var user contains the user object.
[14:18:58] jarr0dsz: hello everyone, im trying to solve a little bit complex routing issue once again and im stuck hope some experts can give me some pointers
[14:19:33] jarr0dsz: for example i have this routes: https://0bin.net/paste/5e7zoRwL+Q1ysHgu#OV7d8qLT4DyB64X-exPaCME5GgKCZ89P4mWg7GbLPuu i need 2 named routes for 2 routes that point to the same controller and method but have optional param
[14:20:21] jarr0dsz: so basically im trying to have multiple routes that all point to the same actions
[14:21:25] jarr0dsz: and if no 'stepx' is provided it should route also the controller requests/step1 is this possible somehow?
[14:24:41] jarr0dsz: how about im doing it like so: https://0bin.net/paste/AT3TieHtBFgTYuaQ#wj+DqiqsVHCWriotvQb9Bz1Xv6QSFUqaOupP0l+I9ng
[14:25:40] jarr0dsz: mistake this one: https://0bin.net/paste/kWdjEg4KT2tAFtiC#kBlHOQ7j+zeSyCF02tbN9hZo+P8ITsLplXR748DF2Z5 ( complete )
[14:26:10] jarr0dsz: this should work for /students/identifier/step1 /students/identifier and /students/step1 and /students
[14:27:11] jarr0dsz: the problem is my controller expects a "step" param and this is not included if i output the params
[14:30:21] jarr0dsz: randomuseragain this is my whole output: https://0bin.net/paste/SjzThlVtgj2sPNlp#wPpC4gOzgLtJtIWK6abusCUZxiS76kpXHNOCK5Dq7er
[14:31:10] jarr0dsz: line 22 in the paste gives me not a value for identifier param but for step instead. (:step) is overruling it
[14:31:43] jarr0dsz: so i think i should find a solution to have both /students/step1 and /students/newyork
[14:32:21] jarr0dsz: the steps are always a defined set of steps, step1,step2,step3, could is somehow find a way to differentiate between a 'step' and something else with the routes #totallyconfused on how to solve this
[14:32:42] jarr0dsz: since ofcourse /students/step is assigned to the :step param since the routes is setup like that
[14:33:46] jarr0dsz: + additional i have to find a way to route each step to the correct step instead of hardcoded #step1 i have now. Each step param would route to #step1 in the controller
[14:40:27] jarr0dsz: randomuseragain something like this ( cleanedup) https://0bin.net/paste/-BC6JbP4053Km0q6#0Kr16-bKNjlw5IfR40Ffym3MOMchkkfw3XQTndlZvi9
[14:40:52] jarr0dsz: so im not even very happy with the controller but found it somewhere online on doing multistep forms
[14:41:25] jarr0dsz: for now my main goal is to first get the routes work, with loading correct step from controller
[14:43:53] jarr0dsz: so default value of step = 'step1' so even if i have no step params applied but only a indentifier param /students/identifier. the step param would be 'step1' thus not overwriting the identifier param?
[14:51:22] jarr0dsz: i think im maybe should move the decision making to the controller instead of inside the routes
[14:59:20] jarr0dsz: so /students/newyork should give me params identifier = new york and step = step1
[14:59:59] jarr0dsz: perhaps this is not possible? no-one in the channel has come across this someday?
[15:13:10] jarr0dsz: ok so i just let the params step for now and in the controller i check the value of it
[09:59:22] jarr0dsz: hello everyone im struggling with a route that has 2 params, 1 conditional. a route that should work with the conditional param and without it.
[10:00:12] jarr0dsz: so i tried something like organisation_vogs GET /vogs(/:division_id(/:id))(.:format) but it does not work if i supply /organisation/division_id/id it works but not when i do /organisation/id it throws the id value in the division_id param
[10:00:42] jarr0dsz: how could i make it work so that if there is no division_id param the /organisation/id_here id_here part would become the param[:id]?
[10:03:16] jarr0dsz: organisation GET /(/:division_id)(/:id)(.:format) also gives same issue. /organisation/id throws the id value inside division_id param
[10:05:19] jarr0dsz: would it require 2 routes so that i first make a route that triggers /organisation/division_id and then a 2nd route to trigger the /organidation/division/id ? i cannot find any solution on how to remove the division_id else on /organisation/division_id/id
[10:11:24] jarr0dsz: so this seems to work for a bit: https://gist.github.com/voordev/2c31f6748c0315c9103a18b1343bfecb
[10:11:56] jarr0dsz: the problem is that when i do /organisations/id with no division_id like /organisations/division_id/id the ID param is not set but instead division_id is set.
[10:12:28] jarr0dsz: so is there a way i can have route /organisation/id that puts the id into the params[:id] ?
[10:13:09] jarr0dsz: NL3limin4t0r the condition is that i require 2 routes /org/division_id /org/id that both work at the same time
[11:15:56] jarr0dsz: would there also be a way to set a default action for a resource? for example i want /organisation/profile#edit to be accessible true /organisation/profile instead?
[11:16:36] jarr0dsz: that must be /organisation/profile/edit should work as /organisation/profile and it would render edit action by default.
[11:43:11] jarr0dsz: any thoughts on when rails 6 will be out? im most interested in multiple db support