« Back to channel list

#RubyOnRails - 12 April 2019

« Back 1 day Forward 1 day »
[00:30:40] fcser_: has joined #RubyOnRails
[00:40:33] FCser: has joined #RubyOnRails
[00:44:52] orbyt_: has joined #RubyOnRails
[00:49:42] mangold: has joined #RubyOnRails
[00:56:43] egray: has joined #RubyOnRails
[01:24:20] s00pcan: has joined #RubyOnRails
[01:26:04] sevenseacat: has joined #RubyOnRails
[01:29:42] bambanx: has joined #RubyOnRails
[01:44:05] cagomez: has joined #RubyOnRails
[01:55:42] srinidhi: has joined #RubyOnRails
[01:59:48] NeXTSUN: has joined #RubyOnRails
[02:05:28] MrCrackPotBuilde: has joined #RubyOnRails
[02:37:38] pd09041999: has joined #RubyOnRails
[03:10:27] braincrash: has joined #RubyOnRails
[03:10:34] mlt-: has joined #RubyOnRails
[03:51:35] timdotrb: has joined #RubyOnRails
[04:02:20] srinidhi: has joined #RubyOnRails
[04:27:36] kapil____: has joined #RubyOnRails
[04:35:06] s00pcan: has joined #RubyOnRails
[04:37:38] Tempesta: has joined #RubyOnRails
[04:38:44] Technodrome: has joined #RubyOnRails
[04:53:52] srinidhi: has joined #RubyOnRails
[05:03:36] srinidhi: has joined #RubyOnRails
[05:12:22] Fira: has joined #RubyOnRails
[05:16:08] Fira: I'm trying to find a boilerplate for running stateful background workers on Rails... Basically attempting to run Web Scrapping jobs with Sessions handling. No matter how I search, everything point me to independant stateless job systems, ActiveJob/resque/sidekiq. Not sure what to do... Should I just roll a separate Rails app for that ?
[05:18:01] mangold: has joined #RubyOnRails
[05:18:30] conta: has joined #RubyOnRails
[05:21:24] sidx64: has joined #RubyOnRails
[05:32:34] kvda: has joined #RubyOnRails
[05:43:59] duderonomy: has joined #RubyOnRails
[06:09:11] gambl0re: has joined #RubyOnRails
[06:20:46] Mia: has joined #RubyOnRails
[06:38:58] duderonomy: has joined #RubyOnRails
[06:39:20] sidx64_: has joined #RubyOnRails
[07:05:10] gambl0re: has joined #RubyOnRails
[07:06:15] ppl: has joined #RubyOnRails
[07:06:20] DukeDave: has joined #RubyOnRails
[07:06:32] mattwc: has joined #RubyOnRails
[07:06:37] Kamuela: has joined #RubyOnRails
[07:06:42] timwis: has joined #RubyOnRails
[07:06:54] Mutsuhito: has joined #RubyOnRails
[07:06:55] coffeejunk: has joined #RubyOnRails
[07:08:11] tjbp: has joined #RubyOnRails
[07:08:33] arielserafini: has joined #RubyOnRails
[07:20:00] sidx64: has joined #RubyOnRails
[07:24:22] prestorium: has joined #RubyOnRails
[07:24:24] duderonomy: has joined #RubyOnRails
[07:28:33] lxsameer: has joined #RubyOnRails
[07:43:16] defsdoor: has joined #RubyOnRails
[07:46:02] bokwoon: has joined #RubyOnRails
[07:56:38] srinidhi: has joined #RubyOnRails
[07:58:55] duderonomy: has joined #RubyOnRails
[08:02:17] lato: has joined #RubyOnRails
[08:04:30] duderonomy: has joined #RubyOnRails
[08:06:46] hightower2: has joined #RubyOnRails
[08:28:42] KeyJoo: has joined #RubyOnRails
[08:32:41] duderonomy: has joined #RubyOnRails
[08:58:59] sidx64: has joined #RubyOnRails
[09:01:13] lato: has joined #RubyOnRails
[09:16:21] sidx64: has joined #RubyOnRails
[09:35:17] pd09041999: has joined #RubyOnRails
[09:36:19] Ergo: has joined #RubyOnRails
[09:45:06] cek: has joined #RubyOnRails
[09:47:45] srinidhi: has joined #RubyOnRails
[09:48:38] conta: has joined #RubyOnRails
[09:57:05] sidx64: has joined #RubyOnRails
[10:10:24] sidx64: has joined #RubyOnRails
[10:18:50] Saukk: has joined #RubyOnRails
[10:21:39] Dbugger: has joined #RubyOnRails
[10:22:43] conta: has joined #RubyOnRails
[10:27:44] mangold: has joined #RubyOnRails
[10:49:14] lankanmon: has joined #RubyOnRails
[11:11:03] sidx64: has joined #RubyOnRails
[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:41:49] tbuehlmann: jarr0dsz: active record will deserialize it when you fetch it. when creating the csv, you could use the same serialization mechanism
[11:42:16] sidx64: has joined #RubyOnRails
[11:42:19] pd09041999: has joined #RubyOnRails
[11:42:29] jarr0dsz: tbuehlmann i tried column_serialized.to_csv when saving the row for the csv but that fails
[11:42:57] tbuehlmann: how is that column serialized? json? yaml? something else?
[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:46:11] tbuehlmann: `serialize` probably serializes to yaml, so you could manually serialize the object to yaml
[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:49:21] srinidhi: has joined #RubyOnRails
[11:50:06] tbuehlmann: try YAML.dump(request.serialized_column)
[11:51:08] tbuehlmann: is the receiving side also serializing that column? because it basically doesn't matter to what format you serialize in the csv as you have to deserialize on the receiving end either way
[11:56:12] jarr0dsz: let me try that tbuehlmann
[11:56:34] jarr0dsz: tbuehlmann yes the recieving side also has the column serialized
[11:57:19] tbuehlmann: it depends on how you plan to import the data
[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:00:16] tbuehlmann: YAML.load(that_attribute)
[12:00:36] tbuehlmann: so it basically doesn't matter how you serialize it, could be JSON as well
[12:00:53] sidx64: has joined #RubyOnRails
[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:06:12] tbuehlmann: you wouldn't work with the object's yaml representation directly, you would work with the object. what exactly is it? an array? of strings?
[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:10:30] tbuehlmann: no, yaml would correctly store them as integers. if they are strings, they were likely strings from the very beginning
[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:12:32] uks: has joined #RubyOnRails
[12:12:37] tbuehlmann: YAML.load(YAML.dump([42])) # => [42]
[12:13:04] tbuehlmann: yes, the quotes mean they are strings when deserialized
[12:13:45] sidx64: has joined #RubyOnRails
[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:16:12] tbuehlmann: if the question is how to convert an array of strings to an array of integers, one simple one would be ['42'].map(&:to_i)
[12:16:30] tbuehlmann: there are other options, though. Integer('42') for example
[12:20:32] Velkow: has joined #RubyOnRails
[12:24:58] Technodrome: has joined #RubyOnRails
[12:30:43] nnielsen: has joined #RubyOnRails
[12:39:42] FCser: has joined #RubyOnRails
[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:45:00] nnielsen: has joined #RubyOnRails
[12:45:53] tbuehlmann: jarr0dsz: for what? displaying purposes?
[12:46:06] booboy: has joined #RubyOnRails
[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
[12:47:05] Gizmokid2005: has joined #RubyOnRails
[12:51:31] Psy-Q: has joined #RubyOnRails
[13:05:58] s00pcan: has joined #RubyOnRails
[13:09:30] MrCrackPotBuilde: has joined #RubyOnRails
[13:09:51] regedit: has joined #RubyOnRails
[13:10:41] kidPalooma: has joined #RubyOnRails
[13:11:09] fragamus: has joined #RubyOnRails
[13:16:42] kidPalooma: Hello, I have these 3 namespaced classes: https://gist.github.com/salami-art/95f208eb602629cc3b2112f940ed3ebd . When I update a Rating::Type its nested options already have a rating_type_id and it saves correctly, however, when I try to create a new Rating::Type it gives an error because it fails to associate the new record
[13:17:35] kidPalooma: more clearly: the Rating::Options sent with the Rating::Type's nested attributes are created without a rating_type_id
[13:18:10] kidPalooma: I suspect that the problem is originated by the classes being namespaced but I thought that adding the foreign_key parameter would solve the issue
[13:18:33] kidPalooma: do you have a clue why this is failing?
[13:19:31] kidPalooma: the error is: {:"rating_options.rating_type"=>[{:error=>:blank}]}
[13:25:32] Terens: has joined #RubyOnRails
[13:25:49] Terens: would you do joins in code vs sql?
[13:29:17] mondz: has joined #RubyOnRails
[13:32:07] conta: has joined #RubyOnRails
[13:34:49] jtperreault: terens: lean on ActiveRecord as much as possible, would be my vote
[13:35:24] jtperreault: terens: https://guides.rubyonrails.org/active_record_querying.html#joining-tables
[13:49:13] quazimodo: has joined #RubyOnRails
[13:52:10] DTZUZO: has joined #RubyOnRails
[14:03:00] Technodrome: has joined #RubyOnRails
[14:08:57] krawchyk: has joined #RubyOnRails
[14:44:49] ss942: has joined #RubyOnRails
[14:46:23] ss942: What version of deface gem should I use after vulnerability was found in nokogiri?
[14:46:57] ss942: github told me that I shouldn't use nokogiri <1.8.5 and that deface links to it
[14:53:44] orbyt_: has joined #RubyOnRails
[15:09:32] tdy: has joined #RubyOnRails
[15:11:32] pd09041999: has joined #RubyOnRails
[15:13:37] Saukk: has joined #RubyOnRails
[15:25:44] ss942: has left #RubyOnRails: ()
[15:26:32] duderonomy: has joined #RubyOnRails
[15:31:12] pd09041999: has joined #RubyOnRails
[15:31:28] duderonomy: has joined #RubyOnRails
[15:34:09] pd09041999: has joined #RubyOnRails
[15:37:12] pd09041999: has joined #RubyOnRails
[15:42:04] pd09041999: has joined #RubyOnRails
[15:45:06] pd09041999: has joined #RubyOnRails
[15:49:01] crankharder: has joined #RubyOnRails
[15:54:02] crankharder: has joined #RubyOnRails
[16:01:26] mello: has joined #RubyOnRails
[16:45:38] cek: has joined #RubyOnRails
[16:54:09] dviola: has joined #RubyOnRails
[17:01:43] tdy: has joined #RubyOnRails
[17:28:40] fragamus: has joined #RubyOnRails
[17:34:04] cek: Something's up with turbolinks:load handler, it doesn't get triggered when navigating to a page that includes a JS that hooks on it
[17:37:09] dustinm`: has joined #RubyOnRails
[17:41:35] SteenJobs: has joined #RubyOnRails
[17:42:26] duderonomy: has joined #RubyOnRails
[17:50:09] uksio: has joined #RubyOnRails
[18:00:27] regedit: has joined #RubyOnRails
[18:01:57] lxsameer: has joined #RubyOnRails
[18:05:36] tjbp: has joined #RubyOnRails
[18:12:37] Dbugger: has joined #RubyOnRails
[18:29:13] conta: has joined #RubyOnRails
[18:29:37] tdy: has joined #RubyOnRails
[18:34:37] SteenJobs: has joined #RubyOnRails
[18:49:03] maryo: has joined #RubyOnRails
[18:58:29] srinidhi: has joined #RubyOnRails
[19:08:27] cek: anyone able to help with turbolinks? I don't get how it works.
[19:08:33] Dbugger: has joined #RubyOnRails
[19:09:04] cek: I'm hooking up on` turbolinks:load` in a JS script sourced in a layout loaded via turbolinks
[19:09:09] cek: the event doesn't trigger
[19:29:40] tdy: has joined #RubyOnRails
[19:32:47] sidx64: has joined #RubyOnRails
[19:51:20] orbyt_: has joined #RubyOnRails
[19:54:49] Dbugger: has joined #RubyOnRails
[20:07:49] hammer065: has joined #RubyOnRails
[20:12:43] c0san0stra: has joined #RubyOnRails
[20:30:13] hammer065: has joined #RubyOnRails
[20:31:38] xco: has joined #RubyOnRails
[20:31:59] xco: Hi iā€™m looking through rails source code and often see this ā€œ#:nodoc:ā€
[20:32:02] xco: what does #:nodoc: mean?
[20:32:16] xco: does it mean it has not documention or do not document or what?
[20:54:14] xco: has joined #RubyOnRails
[21:11:29] wallace_mu: has joined #RubyOnRails
[21:13:21] wallace_mu: Happy Friday all, may i ask a question about a error: nnectionNotEstablished: ActiveRecord::ConnectionNotEstablished, the reason i guess this because i put this in application.rb file ` ActiveRecord::Base.connection.table_exists?('table_name')`, i need to initialize some variable if the table exists, anyone know why it happens? is there the wrong i should check db connection.
[21:13:53] wallace_mu: wrong place*
[21:21:14] Fernando-Basso: has joined #RubyOnRails
[21:25:56] lomex: has joined #RubyOnRails
[21:27:45] xco: has left #RubyOnRails: ()
[21:55:41] DTZUZO: has joined #RubyOnRails
[22:06:11] SteenJobs: has joined #RubyOnRails
[22:13:15] FastJack: has joined #RubyOnRails
[23:07:55] jottr: has joined #RubyOnRails
[23:18:48] tdy: has joined #RubyOnRails
[23:24:48] violentE: has joined #RubyOnRails
[23:31:05] snk_: has joined #RubyOnRails
[23:51:56] orbyt_: has joined #RubyOnRails