Activity Graph

Page 1 of 13 | Next »


[01:06:07] walidvb: has joined #RubyOnRails
[01:18:23] walidvb: Ping timeout: 245 seconds


[03:33:59] walidvb: Remote host closed the connection
[20:22:21] walidvb: has joined #RubyOnRails
[21:39:37] walidvb: Remote host closed the connection


[00:26:09] walidvb: Remote host closed the connection
[11:10:21] walidvb: has joined #RubyOnRails
[11:19:32] walidvb: Read error: Connection reset by peer


[22:14:06] walidvb: has joined #RubyOnRails
[22:14:26] walidvb: i have an issue with counter_culture, can't find anything online
[22:14:52] walidvb: i'd like to have an example file file that runs the test at once, all in one file
[22:15:07] walidvb: i've seen these before, but can't find any. any pointers?
[22:15:45] walidvb: the issue i am having is that it seems that have a model with counter_culture on an STA model calls the UPDATE COUNTER twice
[22:16:09] walidvb: i'd like if possible to avoid having a full repo just for that test case, but rather have one file that can rune
[22:18:43] walidvb: am i connected here?
[22:20:35] walidvb: i realize, however, that my usecase might require a db..
[23:32:34] walidvb: nvm, found it: https://christoph.luppri.ch/articles/rails/single-file-rails-applications-for-fun-and-bug-reporting/


[20:21:23] walidvb: has joined #RubyOnRails
[20:22:39] walidvb: i'm trying to understand how i can have a model validate its associations, or smth about them
[20:23:31] walidvb: concrete example: i have works, that have participations(which have attr percentage). I want to validate the fact that the total of their participations.percentage == 100
[20:24:49] walidvb: i have accepts_nested_association on Work, and a validation on check_sum_of_participations. Problem is, i think, that when i create the work and do the check, the participations don't exist yet, so it doesn't compute the shares yet
[20:42:53] walidvb: Remote host closed the connection


[08:33:09] walidvb: has joined #RubyOnRails
[08:33:12] walidvb: hello all!
[08:33:29] walidvb: i have declared a module in app/lib/my_module.rb
[08:47:52] walidvb: that module contains a sub module (so that module A; module B; end; end;)
[08:48:10] walidvb: I can call it fine when putting the file at the app/lib directory
[08:49:02] walidvb: but when i put it in a directory app/lib/my_module/my_module.rb, the submodule doesn't exist anymore
[08:49:57] walidvb: actually, it's as if the module isn't read (the module constant exists, but doesn't have any methods)
[08:50:24] walidvb: module is UnEpp, contains UnEpp::Domain (currently declared in the same file, trying to change that)
[08:54:39] walidvb: in app/lib/un_epp.rb
[08:54:58] walidvb: trying to move it to app/lib/un_epp/un_epp.rb and app/lib/un_epp/domain.rb
[08:55:06] walidvb: sry for the delay
[08:55:49] walidvb: this particular one i haven't tried, considering the app/lib/un_epp/un_epp.rb didn't work
[08:56:13] walidvb: should domain.rb's code be wrapped in module UnEpp, or is that magically added by the folder structure?
[08:57:27] walidvb: and what about the un_epp.rb file? how come the module exists, but has none of the methods i defined?
[08:59:06] walidvb: reason being?
[08:59:28] walidvb: UnEpp also has methods, where do i declare them?
[08:59:36] walidvb: in app/lib/un_epp.rb , then?
[08:59:57] walidvb: so a module should have its own file, and its submodule their own folder
[09:00:08] walidvb: thanks sevenseacat, always here to save the day :)
[15:33:47] walidvb: has joined #RubyOnRails
[15:33:51] walidvb: hello again
[15:34:37] walidvb: i have a UnEpp module that makes calls to an external API. I'd like to stub/mock it in my rspec, so that whenever any call is made to it in my code, i control what the method returns
[15:35:11] walidvb: (in this case, i will want UnEpp.info to return a hard-coded copy of what the API actually returns)
[15:36:57] walidvb: i can't find the right way to do this. most example let me check that my service got called with the right params
[15:37:09] walidvb: but i'd like that my service returns a certain answer, rather
[15:38:43] walidvb: i'm almost thinking of conditionally declaring my module (module UnEpp; if Rails.env.test?; fake_code; else; real_code; end;)
[15:38:52] walidvb: but there must be a better way to do that, no?
[15:40:03] walidvb: just that? :)
[15:40:41] walidvb: and i can put this in another file, and require it in my rspec?
[15:40:52] walidvb: or include it, rather
[15:41:36] walidvb: yes. so, have a UnEppMock module with a stub_all function, and include the module and run that function in a before block
[15:43:04] walidvb: that's where i'm confused
[15:43:38] walidvb: all these show a call on an object that is declared there
[15:43:56] walidvb: in my case, it's a module that is called by my model, and i'm testing my model
[15:44:54] walidvb: except if i'd run UnEpp = double("UnEpp"), allow_and_stub, test my model
[15:45:00] walidvb: maybe that'll work, will try
[15:45:02] walidvb: thx yoones
[15:46:05] walidvb: you're awesome
[15:48:53] walidvb: i guess where i'm stuck with my little ruby knowledge, is how do i declare these stubs outside of the spec file
[15:52:12] walidvb: yoones: trying to do the opposite, to call `allow` in my helper
[15:52:44] walidvb: but for now i've passed `self` as an arg to UnEppMock.stub_all, that worked ;)
[15:52:52] walidvb: will find a better solution later
[16:21:04] walidvb: Ping timeout: 260 seconds


[16:09:46] walidvb: has joined #RubyOnRails
[16:10:07] walidvb: i'm having issues with ruby
[16:12:24] walidvb: i have the following file: app/lib/epp/un_epp.rb . this contains a module UnEpp, with a submodule Domain. it seems that the UnEpp module is loaded, but not its submodules
[16:12:36] walidvb: as in UnEpp exists, but not UnEpp::Domain
[16:13:27] walidvb: this would be my code: https://gist.github.com/walidvb/002bdbaca9076131d18b81b93d0b7303
[16:13:50] walidvb: as a matter of fact, the whole module is empty
[16:14:06] walidvb: fryguy: i can't call any of the functions in that file
[16:14:46] walidvb: right this second, by running a rails console, and running UnEpp.server
[16:14:56] walidvb: (which is a method on the UnEpp module)
[16:15:25] walidvb: that, i am not sure
[16:17:11] walidvb: that's one thing i'm confused by. there is another file in the lib folder which does get loaded. but i can't find any explicit loading of it in app.rb (or anywhere else)
[16:17:25] walidvb: fryguy: better to put in config/initializers ?
[16:17:48] walidvb: (btw, rails 5)
[16:20:34] walidvb: pankaj: you _can_ have different dbs in prod and dev, just fyi
[16:20:53] walidvb: fryguy: any advice on where to put this / how to solve ?
[16:21:32] walidvb: i get `=> UnEpp`
[16:22:01] walidvb: NameError: uninitialized constant UnEpp::Domain
[16:22:08] walidvb: and UnEpp.constants gives []
[16:22:42] walidvb: checked that, no
[16:24:50] walidvb: and then restarting the console?
[16:26:55] walidvb: gettin `Domain (call 'Domain.connection' to establish a connection)`
[16:27:16] walidvb: fryguy: (i have an ActiveRecord class called Domain)
[16:27:43] walidvb: i've added a Test submodule to have this work
[16:32:15] walidvb: fryguy: ok, defo a problem smwh. I emptied the file, stopped spring, relaunched rails console and it still finds a UnEpp
[16:36:24] walidvb: it seems that simply having a file named un_epp automatically declares a UnEpp constant
[17:08:17] walidvb: pankaj: if i were you i would install psql locally
[17:36:12] walidvb: any reason why your previous won't run on psql?
[17:54:05] walidvb: Read error: Connection reset by peer


[15:59:27] walidvb: has joined #RubyOnRails
[16:13:15] walidvb: Ping timeout: 260 seconds


[13:15:34] walidvb: has joined #ruby
[13:19:07] walidvb: hey all, i'm having trouble with v8, libv8 and mini_racer using bundler
[13:19:27] walidvb: running on Mac OS X 10.13
[13:20:56] walidvb: somehow it seems i cannot get the versions to match. i have installed v8 via brew(which installed 5.1), then libv8(using gem i libv8 -v 5.3.332.38.5 -- --with-system-v8), and tried installing mini_racer the same way, which seemed to do the trick
[13:24:08] walidvb: i have successfully run my rails app. I then added a gem, ran bundle again, and starting the app now gives me a Symbol not found error
[13:24:39] walidvb: if that rings a bell to anyone, would greatly appreciate some help configuring this
[13:53:57] walidvb: havenwood: was this: mini_racer Symbol not found: __ZTIN2v811ArrayBuffer9AllocatorE
[13:54:14] walidvb: i'm currently re installing, etc, so can't tell more right this second
[13:54:19] walidvb: libv8 is currently compiling
[13:58:45] walidvb: yeah i've been through that.. worked on it 3-4 hours, for it to finally work. sprung my server, was working fine, added a gem, added an empty class, restarted my server to get access to these, it had stopped working
[13:59:02] walidvb: although i don't think running bundle would touch anything on installed gems, no?
[14:06:17] walidvb: very frustrating indeed ^^
[14:06:31] walidvb: argh in the meantime i remove libv8, is recompiling now
[14:06:46] walidvb: but i did revert and tried to run, had the same issue
[14:07:03] walidvb: seems like smth to do with the wrong versions/paths being used, i would say
[14:07:39] walidvb: (which is running since 10 minutes, i think.. -.-)
[14:08:20] walidvb: (and bundler hasn't told me this would take time, which it usually does)
[14:25:46] walidvb: havenwood: it could be that i had some bundle configs when it was working, i just can't figure out exactly which
[14:34:40] walidvb: havenwood: still here?
[14:36:21] walidvb: i'm now reinstalling everything. libv8 installs fine(--with-system-v8), but mini_racer gives me a Libv8 location not found(whether i run it with or without --with-system-v8)
[14:36:43] walidvb: btw i uninstalled and reinstalled v8 (with brew uninstall v8 && brew install v8)
[15:09:48] walidvb: yeah is quite tricky indeed
[15:10:06] walidvb: i ended up updating both libv8 and mini_racer, seems to have done the trick
[15:10:29] walidvb: tests running fine :)
[15:10:51] walidvb: thanks all for your help, appreciated!
[15:10:51] walidvb: don't think i require to understand more right now ;)
[15:20:52] walidvb: Ping timeout: 256 seconds


[12:30:39] walidvb: has joined #RubyOnRails
[12:31:18] walidvb: Remote host closed the connection


[14:43:33] walidvb: has joined #RubyOnRails
[14:43:50] walidvb: I'm trying to test some caching with rspec and jbuilder
[14:45:11] walidvb: i set a cache key to a static string for testing, and expect the response from the server to be the exact same. Still, it seems like on the 2nd request the view is still rendered.
[16:15:07] walidvb: Remote host closed the connection


[09:31:54] walidvb: has joined #RubyOnRails
[09:32:51] walidvb: i have a path in my routes that redirects to application#fallback_index_html. It works fine, except it looks from the logs that like it never even hits application_controller
[09:33:12] walidvb: i'd like to redirect if user isn't logged in, but can't seem to find how :/
[09:33:15] walidvb: !request.xhr? && request.format.html?
[09:33:15] walidvb: get '*path', to: "application#fallback_index_html", as: :app, constraints: ->(request) do
[09:33:23] walidvb: oops sry about that
[15:06:42] walidvb: Ping timeout: 268 seconds


[00:44:24] walidvb: has joined #RubyOnRails
[00:44:29] walidvb: happy new year everyone
[02:40:20] walidvb: Remote host closed the connection
[15:31:10] walidvb: has joined #RubyOnRails
[15:32:56] walidvb: I have Links, Users, and LinkUserAssignment. I'm trying to get a list of my links such as each link would contain a key "users" which would contain each user(or some of their fields)
[18:47:42] walidvb: Remote host closed the connection


[15:57:07] walidvb: has joined #RubyOnRails
[15:57:43] walidvb: i'm trying to rescue an error in an initializer, but when i make a request the error is thrown anyways in development
[15:58:06] walidvb: the rescue block is called, and does not call any raise(caught_error)
[15:58:14] walidvb: this is my code:
[15:58:45] walidvb: https://gist.github.com/walidvb/ee1973338c8025765aba2cc39a23761b
[15:58:57] walidvb: not sure if this is linked to my dev environment
[16:37:26] walidvb: Ping timeout: 272 seconds


[09:13:50] walidvb: has joined #RubyOnRails
[09:14:51] walidvb: hey, i'm trying to switch to using X-SMTPAPI generally, but i'm having issues testing it. Mainly, all my old tests consider each mail is sent once for each user.
[09:17:10] walidvb: rspec's expect(mail).to have_header('X-SMTPAPI', 'somevalue'), but the header returned seems to have a broken key (smth like /[!-9;-~]+/=>MY_X_SMTPAPI_VALUE)
[10:12:12] walidvb: Read error: Connection reset by peer


[15:56:25] walidvb: has joined #RubyOnRails
[16:00:00] walidvb: i have an issue with ruby, actually. I have a parent ApplicationMailer class from which my mailers inherit. That class has a method that adds headers automatically. Sometimes i want to override these headers from a Mailer.
[16:00:56] walidvb: i add some instance variables on initialize, which are called in that method. It seems that calling the method from a child skips the initialize part of the parent, which i can't explain to myself
[16:01:01] walidvb: code is here: https://gist.github.com/walidvb/f5a37d08d023d5bb2e6682600de1415a
[16:01:45] walidvb: if i remove the call to add_sendgrid_headers from GenericMailer, then 1) it works 2) i see the output of ApplicationMailer#initialize
[17:58:34] walidvb: Remote host closed the connection


[04:03:39] walidvb: Remote host closed the connection


[19:12:12] walidvb: has joined #RubyOnRails
[19:12:36] walidvb: I'm having some issues using the serialize method of ActiveRecords
[19:12:56] walidvb: I basically want to store json and retreive json (or a Hash), but can't seem to get it right
[19:13:54] walidvb: rails 4.2.6
[19:14:18] walidvb: i'm not sure i understand the diff between serialize :column, as: JSON and as: Hash
[19:15:12] walidvb: i get a parsed hash from the console, but when I render it in a template i get a "no implicit conversion of Hash into String" error
[19:15:37] walidvb: well, they're really tiny JSON objects, actually
[19:15:42] walidvb: cheers nzst
[19:20:35] walidvb: matthewd: i'm not sure, even just assigning the the value to an object gives a bug
[19:20:40] walidvb: no printing of it at all
[19:21:55] walidvb: (just doing `- oembed = link.oembed` in a partial)
[19:23:49] walidvb: ok. so, when I load it from the console, i get a Hash, although I have serialize as:JSON. Is this the expected behaviour?
[19:24:34] walidvb: well, it's an object
[19:25:05] walidvb: but of course I could parse it when I retreive it and .to_json it when i store it, i just thought rails had smth for that?
[19:25:57] walidvb: fair enough
[19:26:55] walidvb: i get an oembed object from a server, that i want to store in my LinkModel in a single column. Also, I need to retrieve it to read keys of that object
[19:27:04] walidvb: matthewd: agreed
[19:27:23] walidvb: the embed is returned as a Hash, and is fairly tiny
[19:28:07] walidvb: is serialize the right tool for htis, though?
[19:28:24] walidvb: matthewd: well, i did try serialize as: Hash
[19:30:18] walidvb: matthewd: https://gist.github.com/walidvb/6b34bb7d947f7649ccb2a0930a70ac3b
[19:30:44] walidvb: this is what I tried. My PostgreSQL column is currently :json (although i did try various variations)
[19:32:48] walidvb: .. ok. i'm not sure what i did, but it seems i had the wrong column type
[19:32:57] walidvb: matthewd: seems to be working now! thanks!
[22:09:33] walidvb: has joined #RubyOnRails
[22:09:37] walidvb: hey again :)
[22:10:41] walidvb: I need to load some assets in my template files to embed, as well as get its path
[22:10:56] walidvb: i'm deploying on heroku, and the css and js are not loading
[22:11:47] walidvb: (I also have multiple js/css, that have been added to my precompiles list)
[22:11:53] walidvb: http://tsilp.herokuapp.com/
[22:12:44] walidvb: i'm using `Rails.application.assets.find_asset` to read the asset and inline it
[22:13:57] walidvb: config.digest: false yields a find_assets called on nil error
[22:14:32] walidvb: config.digest: true doesn't return the files
[22:16:36] walidvb: my end goal is to be able to load a script from a bookmarklet, and have it fetch a remote script to run on that page
[22:55:32] walidvb: hey all, i'm going crazy with assets compilation on heroku again...
[22:55:46] walidvb: site is not serving the assets, i don't know why
[22:55:54] walidvb: my config is the following: https://gist.github.com/walidvb/fe9838407be232eba5eb86f3f4873a12
[22:56:36] walidvb: been playing around with this for a while because i was doing some weird loading of js in the controllers, but i got rid of that. i just want it back to normal :P
[22:57:40] walidvb: any help greatly appreciated :)
[23:26:42] walidvb: the digest yielded by heroku run assets:precompile don't match those of the page, given by javascript_include_path


[12:26:38] walidvb: has joined #RubyOnRails
[12:29:04] walidvb: hey all, trying to write a Sanitizer transformer that would remove all html tags, but add the href of anchors in brackets after the text
[12:30:19] walidvb: i don't exactly get how the transformers work, actually, my attemps so far:
[12:31:01] walidvb: t1 = lambda {|env| if env[:node_name] == 'a'; return "#{env[:node].text}(#{env[:node][:href]})"; end;}
[12:40:35] walidvb: Read error: Connection reset by peer
[13:56:14] walidvb: has joined #RubyOnRails
[13:56:57] walidvb: hey all, i'm trying to fix this error: https://pastebin.com/pjpdBXRH
[13:57:17] walidvb: i bundled using git, and heroku is trying to use https (or smth like that).
[13:57:49] walidvb: i tried erasing the gemfile.lock, making bundle use https instead of git, run bundle install, and push, without luck
[13:57:56] walidvb: (and variations of this...)
[13:59:38] walidvb: jeromelanteri: sry, have myself an adblocker, and there is no files to show here, but noted
[14:04:46] walidvb: jeromelanteri: i do use gist, try to avoid for throwaway files, so as not to clutter my gists list
[16:04:21] walidvb: Remote host closed the connection


[08:30:08] walidvb: has joined #RubyOnRails
[08:30:59] walidvb: i'm trying to upgrade my rails from 4.1 to 4.2, and it broke a lot of tests. I'm managing to fix most, but some i don't see what is wrong
[08:35:44] walidvb: universa1: very difficult to isolate, unfortunately, i'm hoping someone ran into that before:
[08:36:40] walidvb: i have a signup flow: click on signup, request some html from server, fill in form, POST request to server, then either display error if present in response, or dismiss modal
[08:37:51] walidvb: it always worked fine, but now i do get an error displayed, saying: Turbolinks.clearCache() Turbolinks.visit("", {"action":"replace"})
[08:38:52] walidvb: yes i understand, i wouldn't know where to even start, would need to copy loads of things, tests, specs, gemfile, js files, layout files, etc
[08:39:30] walidvb: ok wait i'll past a gist and go incrementally
[09:29:48] walidvb: this would be it: https://gist.github.com/walidvb/8979640422a134faaf9729cb66d8bb65
[10:04:05] walidvb: ah. downgraded Turbolinks, fixed _that_ problem
[16:10:23] walidvb: Remote host closed the connection


[12:09:39] walidvb: Read error: Connection reset by peer