Activity Graph

Page 1 of 7 | Next »


[15:46:38] Andr3as: has joined #RubyOnRails
[15:47:44] Andr3as: hi all... is someone aware of an "opposite" of time in words? if i enter like "5 years" or "3 months" it should come up with the number of days


[18:15:29] Andr3as: Quit: whats this plug for?


[07:55:49] Andr3as: Remote host closed the connection


[17:55:25] Andr3as: has joined #RubyOnRails
[18:07:17] Andr3as: hi all.. i've got an issue with running the command: rake webpacker:compile RAILS_ENV=staging which results in a
[18:07:25] Andr3as: TypeError: no implicit conversion of nil into String
[18:08:01] Andr3as: i did quite an extensive google search but i havent been able to come up with a hint on how to track that down.. anyone an idea how to find out where it dies?
[18:08:22] Andr3as: dev env compiles just fine
[18:11:43] Andr3as: i am on
[18:12:24] Andr3as: havent touched the app in a while, it worked great before.. went from linux to windows, pulled it out of my gitlab, did some updates and now boom
[18:12:51] Andr3as: updates as in "bundle update" and some minor bug fixes in the code.. totally unrelated to that error
[18:13:28] Andr3as: will give that a try, havenwood.. thank you
[18:14:26] Andr3as: ha, that "fixes" it
[18:14:39] Andr3as: thanks a lot!! i googled for like hours


[23:46:47] Andr3as: *.net *.split


[18:27:27] Andr3as: hi all.. i am having an API and it works as expected.. however, a third party wants to request a json reply of my "identity".. that req in the browser works fine, though wen the 3rd party app asks for it, i get an ActionController::UnknownFormat error
[18:27:52] Andr3as: as the req format seems to be html (request.formats: ["text/html"])
[18:28:14] Andr3as: is there a way to tell rails to serve json no matter what? kinda like ignore that the req asks for html?
[18:29:43] Andr3as: fwiw, that's my controlelr which serves the json
[18:30:33] Andr3as: its a bit of a test right now, so dont focus on the missing auth and what not..
[18:31:17] Andr3as: thing is, it already defaults on json
[18:31:25] Andr3as: lemme post the error
[18:31:45] Andr3as: trade added
[18:33:06] Andr3as: so, that 3rd party seems to specifically requests html (for whatever reason)
[18:34:17] Andr3as: so you still think that "format: :json" might fix that?
[18:35:48] Andr3as: will try.. its a bit of an open heart surgery on the staging env.. have that 3rd party app nowhere else..
[18:35:53] Andr3as: thank god for capistrano
[18:40:30] Andr3as: i dont get that far.. throws the error right away.. probably even before it executes the method
[18:47:30] Andr3as: yes, as this is an api.. i just try to disguise html as json now.. lets see what happens
[19:07:02] Andr3as: i put the default format into the routes.. the error is gone but it doesnt serve what its supposed to do
[19:07:06] Andr3as:
[19:07:26] Andr3as: first req is made be the 3rd party app.. it serves :no_content
[19:07:49] Andr3as: 2nd req is made by me in the browser, it serves what i expect it to
[19:11:09] Andr3as: sh*t .. i gotta go..


[15:35:59] Andr3as: hi all.. i have a text field where users should set a timecode in the format of MM:SS.. that timecode should be converted into seconds before i save it to the database as there is an integer field to hold it..
[15:36:30] Andr3as: in order to set that field correct i had to write a setter message timecode= with write_attribute :timecode, time.split(':').inject(0){|m, s| m = m * 60 + s.to_i}
[15:37:02] Andr3as: so far so good, i am now stuck with a validation coz i wnat that the user input will be validated if the format is correct..
[15:37:29] Andr3as: but as it gets converted when set, i cant validate, can i?
[15:38:06] Andr3as: if i dont do that setter method, user inputs of like "01:08" will be set to 1 when i do the thing..
[15:38:13] Andr3as: any hint is highly welcome


[11:35:35] Andr3as: morning all.. pretty noob question but i have this youtube api playlist item.. all i want is to put that content of @data into another hash.. but i dont seem to get @data out of the item.. anyone a hint how to get it?
[11:36:54] Andr3as: argh.. sometimes it needs a question somewhere.. i totally missed @snippet
[11:37:04] Andr3as: so does the trick


[11:34:12] Andr3as: has joined #RubyOnRails


[07:52:30] Andr3as: Remote host closed the connection


[17:04:32] Andr3as: hello all.. i wonder what i do wrong here.. i cannot seem to have a fontwaesome icon in a button_to call..? it ends up rendering as text
[17:04:37] Andr3as: anyone an idea whats going on?
[17:07:18] Andr3as: the left one is using link_to, the right one uses the button_to
[17:10:00] Andr3as: tbuehlmann: <%= button_to icon('far', 'eye'), new_signal_read_path, remote: true, class: 'read-link' %>
[17:10:43] Andr3as: no, passt..
[17:14:27] Andr3as: tbuehlmann: just to clearify.. i meant i am using the button_to method as above.. and it aint working.. i cant find my mistake..
[17:15:33] Andr3as: same thing.. doesnt work.. i even tried raw(icon('foo', 'bar'))
[17:15:46] Andr3as: i give this one a shot
[17:16:37] Andr3as: the block systax does the trick
[17:17:35] Andr3as: that method is part of the fontawesome gem
[17:18:37] Andr3as:
[17:29:49] Andr3as: ah, and thanks, as walways, tbuehlmann
[17:42:25] Andr3as: yeah, but they stopped at 4.7'ish or something.. i thought, i new project deserves the newest icons ;)
[17:42:35] Andr3as: *a new project


[09:18:41] Andr3as: is it really called "file.rb"?
[09:19:28] Andr3as: and.. define "not working"..
[09:25:41] Andr3as: => "cat's are really nice sometimes, we give them good cat ."
[09:25:41] Andr3as: 2.5.3 :004 > line.gsub!(/food/, '') if line.start_with?('cat', 'dog')
[09:25:53] Andr3as: line = "cat's are really nice sometimes, we give them good cat food."
[09:26:11] Andr3as: so, your code works to me..?
[09:26:54] Andr3as: that loop though..
[09:30:17] Andr3as: you might wanna try map
[09:30:20] Andr3as: {|l| l.gsub(/food/, '') if line.start_with?('cat', 'dog')}
[09:30:43] Andr3as: or if you wanna replace the text inside the array try map! {...
[09:31:55] Andr3as: if l-start_with, obviously
[09:32:02] Andr3as: *l.start_with?


[12:07:47] Andr3as: has joined #RubyOnRails


[03:47:42] Andr3as: Ping timeout: 252 seconds


[09:36:41] Andr3as: i do that quite often
[09:37:31] Andr3as: though, for lots of data (big table rows or something) it proves to be slow using partials
[09:37:45] Andr3as: *big tables and a row partial
[09:39:58] Andr3as: ah, good tip, nevre thought abt using helpers for that


[09:26:34] Andr3as: i have a string like 'ESZ8-CME' and i have a model where i want to store a string "pattern" like 'ES??-CME' .. what i want to achieve is to find the corresponding element when i query for 'ESZ8-CME'
[09:28:48] Andr3as: there are other strings as well like "NQZ8-CME" or "@ESZ18"
[09:30:32] Andr3as: anyone with a hint on how to achieve that?
[12:35:31] Andr3as: could someone pls take a look at that gist?
[12:35:53] Andr3as: i'm going crazy and wonder why i cant iterate through the elements..(?)
[12:37:07] Andr3as: sevenseacat: am still at that issue above..
[12:37:32] Andr3as: even a puts doesnt "work"
[12:38:24] Andr3as: see updated gist
[12:38:29] Andr3as: same output as without
[12:40:54] Andr3as: sevenseacat: at the end of the day i want to get the BrokerInstrument whose symbol "match" (e.g.) "CLZ8-CME"
[12:41:59] Andr3as: well.. i thought i simplify the gist
[12:47:09] Andr3as: sevenseacat: i did another update.. this time with my poor attempt to get the id
[12:48:56] Andr3as: ok.. so map... i will read a bit
[12:52:29] Andr3as: sevenseacat: you think {|bi| if trade_executions[r][2].match bi.symbol }.first sounds good?
[12:54:34] Andr3as: hmm, it gives me 1 which is the id of the BrokerInstrument i'd expect it to return
[12:57:11] Andr3as: the thing is, i have a "pattern" stored in the DB.. like "ES..-CME" and when i import a file, i have a string "ESZ8-CME"
[12:59:04] Andr3as: hmm, i though find needs an id but i do not have an id?
[13:00:14] Andr3as: but thanks for the heads up, if i change the string its more like [nil, 5] - so my above code def wont work
[13:02:45] Andr3as: sevenseacat: select might do what i need...
[13:02:50] Andr3as:
[13:03:35] Andr3as: {|bi| if trade_executions[r][2].match bi.symbol }.first.instrument


[17:26:33] Andr3as: hi all.. i have a string like 'ESZ8-CME' and i have a model where i want to store a string "pattern" like 'ES??-CME' .. what i want to achieve is to find the corresponding element when i query for 'ESZ8-CME'
[17:27:02] Andr3as: anyone a tip how to approach that? i did some google research but am stuck, somewhat..
[17:53:09] Andr3as: i found the match method..
[17:53:27] Andr3as: when i change the pattern to like ES..-CME it should do the trick
[17:53:37] Andr3as: with something like BrokerInstrument.where(broker: broker).each {|bi| puts if te[1][2].match(bi.symbol) }


[08:30:11] Andr3as: i import them in my scss file and thats it
[08:30:15] Andr3as: @elcontrastador
[08:43:35] Andr3as: @import "bootstrap";
[08:43:35] Andr3as: cat alphatrade_reloaded/app/assets/stylesheets/application.scss
[08:44:17] Andr3as: i import 'em directly in application.scss (renamed it to scss from css)
[08:45:48] Andr3as: elcontrastador:
[08:46:46] Andr3as: idk.. never did it like that.. i always used the bootstrap gem
[08:47:31] Andr3as: so, you're using weback then? elcontrastador
[08:48:54] Andr3as: found this via google.. they even use bootstrap as example:
[08:49:56] Andr3as: what rails version do you use?
[08:52:20] Andr3as: maybe you can figure it out with a starter app?
[08:53:18] Andr3as: here's another.. well... guide
[12:26:51] Andr3as: gemfile.lock might get an update
[12:27:03] Andr3as: *Gemfile.lock


[08:30:16] Andr3as: i'd go with pundit
[08:30:23] Andr3as: and rolify @elcontrastador
[08:33:09] Andr3as: nothing specific, i just started with it and found it very clean and organized
[08:33:33] Andr3as: i guess i wouldnt switch in the middle of the "project" though


[08:13:50] Andr3as: good morning.. i have a simple_form inside a modal / reveal and when i submit invalid data it does not show validation errors inside the form.. the controller correctly responds with a 422 and json data with the error message.. i was under the impression that simple_form does show the errors automagically...(?) - it does do so in a non remote form but not in this case.. here's the stackoverflow q i posted a while back but no soltion in sight..
[08:13:51] Andr3as:
[08:13:59] Andr3as: any help is appreciated


[15:29:49] Andr3as: has joined #RubyOnRails
[15:31:13] Andr3as: hello all.. i have a little issue with an "after_create".. i need to create associations (has_many through) when i create a certain element.. thats working great.. now i started to implement paper_trail to have an undo function
[15:31:51] Andr3as: i was able to get it working with associations too.. though that after_create is a bit wrong in that case as the associations will be recreated by paper_trail
[15:32:23] Andr3as: how would you guys prevent the firing of that after_create in that case?
[15:33:09] Andr3as: determining the "caller"? (e.g. which controller called for the (re)creation of that element?)


[12:28:04] Andr3as: has joined #RubyOnRails


[08:01:29] Andr3as: Remote host closed the connection


[07:17:24] Andr3as: maybe dump it, change the table names in the sql file and reload it?
[07:17:37] Andr3as: if the other table is empty, obviously
[07:24:48] Andr3as: so, you basically have to skip those id's which are presnet in both tables
[07:27:13] Andr3as: what about some sql magic? like a full outer join?
[07:27:46] Andr3as: or iner join (i think)
[07:30:13] Andr3as: This variant of the full outer join (sometimes abbreviated to full join) returns all rows from both tables named in the ON condition where the join condition is not met (excluding NULL values).
[07:30:13] Andr3as: Full [Outer] Join without Intersection
[07:30:37] Andr3as: if i understood it correctly, thats the sql join you could use
[07:31:10] Andr3as: and create the records if they arent already existing
[07:31:25] Andr3as: This join is a variant on the basic right outer join, but instead, it returns all rows from the right-hand table specified in the ON condition that also meets the join condition and none of the rows from the left-hand table that match the join condition.
[07:31:25] Andr3as: or even better the Right [Outer] Join without Intersection
[07:31:48] Andr3as: that gives you only the missing records.. take those and create them
[07:33:20] Andr3as: here's a pic and stuff
[07:35:26] Andr3as: well, you get the records which are missing
[07:36:58] Andr3as: yes, and the outer join excludes those from the production table
[13:49:35] Andr3as: mices:


[06:36:26] Andr3as: anyone ever had this issue with rails and js?
[06:38:30] Andr3as: i've tried to boil it down to the minimum without losing infos..
[06:39:51] Andr3as: well, at the end of the day it sends this $('#mainModal').modal('toggle'); in the update.js.erb and chrome argues Uncaught Error: Syntax error, unrecognized expression:
[06:40:18] Andr3as: and i dont know why.. i can execute the same thing from the console and it does work just fine
[06:44:51] Andr3as: no, i say the exact same code which does not work from within update.js.erb work when i post it into the console
[06:45:37] Andr3as: i wanted to make it easier to read.. and omited the rest of the code which also works
[06:45:57] Andr3as: "from the console
[06:46:40] Andr3as: and it also works from within the update.js.erb but it still throws that error and after the error, chrome wont deal with js anymore (as expected, unfortunately)..
[06:48:51] Andr3as: i've updated the post with the complete update.js.erb
[06:49:05] Andr3as: though its not that it adds any more value, actually..(?)
[06:49:50] Andr3as: coz it does not work with that modal toggle alone as well
[06:50:35] Andr3as: well, when it doesnt work with the toggle alone..(?) how could it matter how my final js.erb looks like?
[06:53:21] Andr3as: what shall i say to this... i just want to clearify that the whole thing does not work with the toggle alone.. to keep things simple.. you guys argue its too much code but ask for more.. anyway.. its ok.. i look somewhere else
[06:53:30] Andr3as: thanks for taking a look
[06:58:25] Andr3as: $("#mainModal").modal("toggle");
[07:00:50] Andr3as: dev tools network tab looking like this
[07:02:23] Andr3as: no, i removed it
[07:02:30] Andr3as: to only have the toggle in it
[07:03:05] Andr3as: why overvcomplicate things when the easy stuff isnt working either
[07:05:47] Andr3as: i did that a thousand times... after that i took it out of the js.erb file, pasted it into the chrome console and it closes the modal without an issue
[07:06:00] Andr3as: no error message whatsoever
[07:09:49] Andr3as: see
[07:09:55] Andr3as: i made a little video
[07:12:22] Andr3as: fwiw, the error in the rubymine server console is an old one.. i scrolled up earlier and it doesnt scroll down automatically
[08:42:16] Andr3as: i tried a console.log("Hello");


[09:22:43] Andr3as: does a counter_cache always "just counts"? or could i use it for do some calculations as well? like when a trade has many executions and each execution has a size field which could be positive or negative and i wanna calculate the position size with adding up all the sizes of each execution
[09:23:42] Andr3as: i see, thx sevenseacat
[09:25:05] Andr3as: every gem installed?
[09:25:19] Andr3as: *for staging
[10:30:25] Andr3as: Quit: No Ping reply in 180 seconds.


[05:43:11] Andr3as: fwiw, i found a solution for the "location with number sign paths"
[05:43:15] Andr3as: location: admin_index_path(anchor: 'instrument_templates')
[05:43:50] Andr3as: ah, and: morning
[11:01:39] Andr3as: is it possible to call a helper method to alter the pluck output? if not, anyone with a hint how to achieve it otherwise? here's a gist of what the situation is and what i need
[11:08:00] Andr3as: i tried it but it maps the $ to USD.. havent found a way to have them both in it
[11:08:02] Andr3as: sevenseacat
[11:08:32] Andr3as: and its prretty tough to google, actually
[11:08:49] Andr3as: so an array.. that makes sense
[11:08:54] Andr3as: thanks a lot! (again)
[11:09:05] Andr3as: yes, it is
[11:09:35] Andr3as: i thought coz map already gave back an array..
[11:09:47] Andr3as: well, i dont know what i thought coz i always would need a 2d array


[08:42:46] Andr3as: morning.. i never created an admin section like this before.. so i made a namespace :admin and put my stuff in a "do / end".. routes are working fin, index actions too though i have a bit of a struggle with a "new" action...
[08:42:55] Andr3as: this is a gist of it
[08:43:16] Andr3as: as a teaser, i am getting "NameError - uninitialized constant Admin::InstrumentTemplatesController::InstrumentTemplate:"
[08:43:23] Andr3as: anyone with a hint?
[08:49:41] Andr3as: sevenseacat: yes
[08:50:33] Andr3as: forget it.. typo.. argh
[08:50:51] Andr3as: thx a ton.. saved my day
[09:22:29] Andr3as: dont ask to ask, just ask
[09:23:43] Andr3as: i have another one as well.. am using the responders gem with a "location" redirect.. i do it like this respond_modal_with @instrument_template, location: "/admin#instrument_templates"
[09:24:33] Andr3as: if i use a location "/admin" it does just fine "/admin#instrument_templates" isnt working though.. no errors either.. anyone an idea how to redirect to urls / paths like this?
[09:30:54] Andr3as: sevenseacat: real quick, you have maybe a hint re my redirect problem?
[09:31:34] Andr3as: Code_[24]: i'd go for the thing sevenseacat has mentioned.. let there be an entry for each occurence a book has been borrowed.. kinda l ike a "registration for borrowings"
[09:32:15] Andr3as: that even stores a history which you can do some stats on, later
[09:32:27] Andr3as: sevenseacat: sh.t


[09:52:16] Andr3as: sunya7a: what does the server log say when you create a child?
[09:54:42] Andr3as: so you create the child and at your byebug the values are empty, if you move on the values are there?


[16:58:31] Andr3as: hi all.. i gave devise a shot and am already regretting it... in my production / staging env when trying to register i get a "ActionController::InvalidAuthenticityToken in Devise::RegistrationsController#create" with google chrome.. i can register with ms edge though.. googling brought up nothing substantial.. anyone an idea where to look at? am trying to fix it for hours with no luck...
[16:58:53] Andr3as: am not sure what you guys need in a gist..
[16:59:18] Andr3as: pls let me know.. i am more than happy to provide anything needed
[17:15:02] Andr3as: Caerus: it totally works in dev and i am exclusively use chrome.. edge was just a test...
[17:15:23] Andr3as: i gave chrome incognito mode a shot, doesnt work either.. cleared all the cookies and chache, doesnt fix it
[17:18:15] Andr3as: just tested to sign in, same issue just different contorller (SessionsController) - can login with Edge
[17:19:55] Andr3as: fwiw, i am not using turbolinks
[17:30:54] Andr3as: Caerus: 5.2.0
[17:39:41] Andr3as: sure - thanks for looking into this
[17:40:00] Andr3as: its pretty empty right now.. have just started with a new app
[18:25:48] Andr3as: Caerus: i tried that already.. the error is gone but it doesnt process the registration.. it renders the form again after submitting but empty
[18:26:21] Andr3as: also tried protect_from_forgery with: :null_session / protect_from_forgery / protect_from_forgery with: :exception
[18:30:47] Andr3as: for testing purposes - skip_before_action :verify_authenticity_token does "work"
[18:30:55] Andr3as: though thats nothing i would really consider
[18:31:25] Andr3as: i give this gist a shot, hang on
[18:32:33] Andr3as: nope, doesnt work
[18:40:43] Andr3as: Caerus: i have not.. am on apache... will digg a bit to come up with an apache setting
[18:40:52] Andr3as: in the meantime i have set it to "skip_before_action :verify_authenticity_token, if: :devise_controller?"
[18:41:12] Andr3as: to at least not have it wide open
[18:44:11] Andr3as: well, right now i do not have an authenticate before filter
[18:44:40] Andr3as: not that its particulary difficult to add ;) - but i just havent added it yet
[18:53:16] Andr3as: anyway, i'm calling it... thanks a lot, Caerus - good night


[08:44:06] Andr3as: morning all.. i am aware of the possibility to "override" ActionView::Base.field_error_proc to get a more bootstrap like class settings...
[08:44:30] Andr3as: is there something to set the class for fields without error?
[08:45:13] Andr3as: after a validation brought up some other fields with an error, obviously
[09:48:59] Andr3as: syndikate: if you have a validation and it fails it wraps the field with the error in a div with a class "field_with_error" when it renders the view again
[09:49:22] Andr3as: you can change that behavier when you change ActionView::Base.field_error_proc
[09:50:37] Andr3as: i did it and it works as expected
[09:51:03] Andr3as: what i would like to have though is that it wraps fields without an error as well.. with a different class though
[09:51:21] Andr3as: to kinda show correct fields in green and fields with error in red
[10:45:37] Andr3as: syndikate: yeah, maybe thats what i have to do.. i just thought if there's a "field_with_error" there may be a way for a field without error too
[10:45:42] Andr3as: from within rails


[16:34:16] Andr3as: has joined #RubyOnRails


[15:21:02] Andr3as: Ping timeout: 256 seconds


[00:15:28] Andr3as: has joined #RubyOnRails