mlt-

Activity Graph

Page 1 of 3 | Next »

2018-11-14

[13:06:39] mlt-: Read error: Connection reset by peer
[13:06:52] mlt-: has joined #RubyOnRails

2018-11-13

[23:04:43] mlt-: Quit: rebooting
[23:19:57] mlt-: has joined #RubyOnRails

2018-11-12

[01:07:00] mlt-: has joined #RubyOnRails
[03:14:53] mlt-: Quit: bye
[04:53:14] mlt-: has joined #RubyOnRails
[08:15:33] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)
[23:33:02] mlt-: has joined #RubyOnRails

2018-11-11

[02:58:54] mlt-: has joined #RubyOnRails
[09:03:39] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-11-10

[21:49:34] mlt-: has joined #RubyOnRails
[23:06:22] mlt-: Quit: got to go

2018-11-09

[05:56:37] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-11-08

[18:34:00] mlt-: has joined #RubyOnRails
[18:35:08] mlt-: How do I prevent JSONB database type casting into Hash? I thought "attribute attr, ActiveRecord::Type::String.new" added to my Model will do, but it won't. Rails 5.2.1
[20:18:04] mlt-: dachi: he is gone:)

2018-11-05

[17:54:35] mlt-: has joined #RubyOnRails
[17:57:41] mlt-: Inside: I did give minitest-bisect a try... though for whatever reason that inconsistent test is not reproducible on Linux even with same seed :(
[18:02:17] mlt-: Inside: yeah... I used default ruby on Debian 2.3, whereas 2.4 on Windows... gotta try rvm
[18:03:15] mlt-: Also I recalled why I disable transactional fixtures in one test... I do set serializeable isolation level for transaction in my model... so no go for transactional fixture for this one
[18:20:44] mlt-: mices: was it tab separated?
[18:21:13] mlt-: mices: you would get by with awk
[18:21:19] mlt-: oneliner
[18:45:03] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-11-03

[22:06:10] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-11-02

[04:11:36] mlt-: Ping timeout: 268 seconds
[20:19:46] mlt-: has joined #RubyOnRails
[20:20:40] mlt-: Are there any pros/cons to NOT having 'fixtures :all' in class ActiveSupport::TestCase while using MiniTest? I mean to explicitly name fixtures for each test...

2018-11-01

[21:41:10] mlt-: has joined #RubyOnRails
[21:42:57] mlt-: How would I pin down a cause for (Mini)test failure? I mean if I re-run the failed test alone, it passes. It only fails if I run all tests with certain seeds. So I suspect that something is not getting cleaned up. But I'm totally lost as how to figure out what.
[21:43:25] mlt-: Most of the time if I run all tests, it passes. No JS stuff.
[21:43:59] mlt-: Inside: a single test in question does pass alright.
[21:44:38] mlt-: glasz: when it fails, it says "ActiveRecord::RecordNotFound: Couldn't find MyControllerName with 'my_id'=1234"
[21:44:49] mlt-: So something is funky about fixtures
[21:45:08] mlt-: Inside: that is the problem. If I re-run test alone, it passes.
[21:45:40] mlt-: I see what you are saying....it will tell me the actual order they are executed
[21:50:36] mlt-: glasz: it is failing at the line that gets the fixture... setup do @stuff = things(:mything) ...
[21:52:39] mlt-: No, not in this one. But I do some funky stuff with other tables... there might be some FK problems. I gonna give it a try.. will get back.
[21:52:53] mlt-: funky stuff in other tests
[21:57:05] mlt-: glasz, Inside: I tried ... where.. first! It fails with all tests and same seed, but passes for a single test.
[21:58:51] mlt-: Inside: not yet
[21:59:21] mlt-: glasz: I believe they are transactional by default... I turn it off only in one separate IntegrationTest
[21:59:38] mlt-: ACTION feels like onto something
[22:06:33] mlt-: I'm on PostgreSQL. I turn off transactional tests on one very specific set of integration tests. I want to split all those into smaller chunks, but setup takes quite some time, so I turn them off and i_suck_and_my_tests_are_order_dependent!
[22:09:07] mlt-: I might just rewrite that into one single test thus keeping everything transactional.... instead of trying to find the problem as is
[22:32:26] mlt-: ooops... minitest_bisect... UNIXServer is required
[22:32:39] mlt-: time to fire up WSL
[22:36:41] mlt-: glasz: most of the time it is alright...sort of. Still have no spring / zeus etc
[22:38:17] mlt-: nah... i got tired using VirtualBox before... seems nice to just run stuff locally. I just use WSL occasionally to test something out specific
[22:38:49] mlt-: https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux
[22:39:10] mlt-: in Windows 10... pretty slick. I run native Debian 64 bit
[22:40:48] mlt-: uname -a gives Linux UMN201657146 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 GNU/Linux
[22:48:46] mlt-: ehm...what is the point of using WSL if you use Mac? Don't you have docker and all other fun stuff OOB?
[22:50:22] mlt-: as a noob, I confirm rails runs alright on windows as is
[22:52:14] mlt-: 27 seconds for pretty big app with guard, foreman, puma
[22:52:30] mlt-: Nokogiri is alright now, though eventmachine is still a b*&ch
[22:52:46] mlt-: when using guard live realod
[22:54:02] mlt-: ooh... and there was that thing with ductape
[23:00:57] mlt-: I dunno if this is still a thing and/or windows specific https://stackoverflow.com/q/50552742/673826
[23:01:23] mlt-: Also while we are at it... I posted a SO question with a problem I came across while upgrading Rails... Can I re-use fixture_file_upload? Or do I have to call it explicitly every time? https://stackoverflow.com/q/53015697/673826
[23:02:26] mlt-: ACTION now has all tests failing... that is good start

2018-10-19

[00:39:11] mlt-: Now I can't figure out why RSpec/capybara/selenium won't find assets if I altered config.assets.prefix . If I start dummy app with either dev or test environment, I can access everything just fine with assets path I want, but running tests fails :(
[03:38:39] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-10-18

[23:20:09] mlt-: has joined #RubyOnRails
[23:22:12] mlt-: What is a good way to have an Rspec dummy app for a gem that can work with different Rails versions?
[23:22:42] mlt-: I mean there are certain changes ..like versioned migrations in 5.2.1 that are not there in 4.2.10
[23:22:57] mlt-: Do I have 2 dummy apps?
[23:23:38] mlt-: Or do I make my way through even with application.js.erb to deal with rails-ujs vs jquery-ujs ?
[23:27:24] mlt-: quazimodo: that is what I was thinking...but it is quite not DRY to have 2 almost identical dummy apps
[23:28:58] mlt-: sort of... there is some controller code and such
[23:29:28] mlt-: If I change something, I'd have to maintain the change across both apps
[23:29:57] mlt-: I feel like I can split only assets and migration folders and keep the rest shared
[23:30:10] mlt-: for assets I need only application.js
[23:31:15] mlt-: another pain that I recall is the change of boolean representaiton in sqlite3
[23:31:40] mlt-: I'd like to keep as much common/shared stuff as I can
[23:32:28] mlt-: I'd like to NOT use newer features... so as long as it is compatible with newer Rails, that is fine
[23:32:59] mlt-: ok... just wanted some feedback whether there is a standard way to deal with such things
[23:33:29] mlt-: I'll start with 1 but separate migrations and assets
[23:33:42] mlt-: 1 dummy app I mean
[23:34:01] mlt-: what do you mean?
[23:34:20] mlt-: You can test multiple versions
[23:35:57] mlt-: quazimodo: you said it would be nice to have Rails version switcher for testing. And I said nothing prevents from testing a gem against multiple versions. It was easier when there was no such drastic changes.
[23:38:21] mlt-: speaking of that...I came across appraisal gem .. I hope it is the way to go
[23:38:48] mlt-: and they say to add various gemfiles for Travis testing explicitly

2018-10-04

[00:45:08] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-10-03

[20:36:14] mlt-: has joined #RubyOnRails

2018-08-16

[18:36:34] mlt-: has joined #RubyOnRails
[18:51:48] mlt-: Ping timeout: 272 seconds
[18:52:59] mlt-: has joined #RubyOnRails
[21:51:48] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-08-01

[19:22:35] mlt-: theRoUS: why do you need do/end? Can't you just define whatever method for your model?
[19:40:09] mlt-: do you want unique per instance method?
[19:47:04] mlt-: theRoUS: I'm still confused. Can't you define a parent class for such models/relations that share something and define method directly in a model class that is unique?

2018-07-27

[22:01:04] mlt-: darkhanb: this might be helpful https://stackoverflow.com/q/28604626/673826
[22:01:59] mlt-: essentially .update_all(["bar = bar + ?", 123.45])

2018-07-26

[17:54:52] mlt-: Radar: Thanks for the feedback! The intent is to be generic tool for SQL export. There is no particular model, lots of dynamic SQL.
[17:57:02] mlt-: I just don't want to get low on memory on exporting let's say a few millions of rows
[19:05:23] mlt-: dopie: I'm not sure how "polymorphic" is relevant here. But what about rendering JS asking Turbolinks to visit and replace # thus re-rendering your page?
[19:06:10] mlt-: dopie: I mean like Turbolinks.visit('#', { action: 'replace' });
[19:58:17] mlt-: timdotrb: Have you tried?
[20:16:47] mlt-: somehow seesion[:timeout] isn't getting nilled. Multiple browser tabs open?
[20:21:28] mlt-: because you have no cookies in incognito
[20:24:13] mlt-: timdotrb: something is off in your code
[21:22:00] mlt-: tycoon177: are you looking for this https://github.com/composite-primary-keys/composite_primary_keys ?
[21:22:47] mlt-: I personally prefer raw sql
[21:26:27] mlt-: tycoon177: why not using it? I've been looking at it.
[21:26:33] mlt-: you may get by with AREL
[21:28:24] mlt-: tycoon177: if you use only a handful of scenarios where you do such join, just define a method for a final stuff you'd want. Apparently you can't use raw SQL if you expect to have AR relation to work with later
[21:28:32] mlt-: desnudopenguino: don't keep us hanging
[21:28:54] mlt-: you mean you are still using it
[21:29:57] mlt-: tycoon177: I don't think so... such scenarios are well possible
[21:31:26] mlt-: I mean you can always have a surrogate key, but it doesn't always mean table is not normalized
[21:32:11] mlt-: before_save?
[21:33:36] mlt-: mordof: check persisted?
[21:33:48] mlt-: in your validation
[21:34:10] mlt-: so you can say it is valid even if there is no string
[21:34:52] mlt-: str.present? || !persisted?
[21:39:43] mlt-: mordof: just use serial column in you db and get salted md5 of that as a path
[21:44:29] mlt-: sha1 from serial column + fixed salt is gonna be pretty unique

2018-07-25

[20:45:16] mlt-: has joined #RubyOnRails
[20:47:04] mlt-: Hello! I'm doing some nasty stuff in Rails, but being a noob I'm curious if it does what I expect it to do. I mean it does work alright. I'm not sure whether it is efficient approach. I'd appreciate a feedback https://gist.github.com/mlt/5988c3c3fd61858d13bd7c25891b9ecf#file-sql_to_csv_streamer-rb
[20:48:18] mlt-: I hope I'm not quite reinventing a wheel
[21:34:01] mlt-: Inside: Thank you for taking a look! I do use lots of PostgreSQL specifics and that is not an issue for me. I'm more concerned about memory overhead whether this approach is better than fetching everything, formatting into CSV and sending back in one shot.
[21:37:06] mlt-: also I was not sure whether it is okay to toss around a block like that. I just tried and it worked.

2018-05-19

[05:30:51] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-05-18

[20:21:48] mlt-: has joined #RubyOnRails
[20:22:21] mlt-: Can I eager load a chain of associations? I have like 5 tables I want to (left) join.
[20:24:15] mlt-: ropeney: ah... I suspected something alike...is it documented anywhere? All examples I see use just a simple symbol
[20:26:09] mlt-: ACTION feels dumb
[20:26:26] mlt-: ropeney: Thanks! I was looking at https://apidock.com/rails/ActiveRecord/QueryMethods/eager_load
[20:27:46] mlt-: ropeney: just to check... for left outer join, I use arel expressions and Mymodel.join(my_arel.join_sources)
[20:27:49] mlt-: Is it the way to go?
[20:28:20] mlt-: ropeney: nevermind...
[20:28:30] mlt-: I think with eager loading I would not need all that anymore
[20:38:44] mlt-: ropeney: Is there a handy function or alike to turn an array of chained table names into a hash suitable for eager loading? I feel like I'm about to re-invent a wheel on that.
[20:41:01] mlt-: ACTION found https://stackoverflow.com/q/5095077/673826
[21:52:09] mlt-: anoob: you might try to cheat... using databases setup for configuration
[21:53:01] mlt-: anoob: Rails.configuration.database_configuration
[21:53:08] mlt-: anoob: look for keys
[23:26:17] mlt-: Can I walk association reflections? I want to reflect on association of association. Is it doable?
[23:32:40] mlt-: ACTION is looking at #klass
[23:44:17] mlt-: foli: don't ask to ask, just ask

2018-05-11

[18:53:23] mlt-: has joined #RubyOnRails
[18:59:24] mlt-: back. Which is kind of "expected". What I do not get is how come JSON comes back from normal page operations. I do not see dot json in URL.
[18:59:24] mlt-: I am confused how a controller can return JSON type when it was not explicitly specified in the URL? I mean it has standard respond_to ...format.json ... format.html . What I am having a problem with is testing. In my Integration Test, I do xhr :get, my_controller_url, {stuff} in exactly the same way as I monitor normal behavior with Firefox's Developer Tools console on Network tab. For whatever reason, in my test, an HTML comes
[18:59:52] mlt-: Does X-Requested-With: XMLHttpRequest request header matter?
[19:01:01] mlt-: oh... I just noticed in logs: Processing by my_controller as JS
[19:01:40] mlt-: Why does it choose to use JS? I have no such clause in respond_to
[19:05:40] mlt-: I noticed that if I do in my test: xhr :get, my_controller_url(format: :json), ... . Then it works. But once again, I do not see .json in URL while using page normally...
[19:47:08] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-05-10

[20:56:40] mlt-: Read error: Connection reset by peer
[20:57:16] mlt-: has joined #RubyOnRails
[20:57:38] mlt-: Read error: Connection reset by peer

2018-05-08

[08:41:58] mlt-: Ping timeout: 240 seconds
[15:50:18] mlt-: has joined #RubyOnRails

2018-05-07

[17:43:40] mlt-: has joined #RubyOnRails

2018-05-04

[17:53:37] mlt-: has joined #RubyOnRails
[22:32:54] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-05-03

[01:09:35] mlt-: has joined #RubyOnRails
[01:17:44] mlt-: Remote host closed the connection
[01:18:42] mlt-: has joined #RubyOnRails
[02:51:31] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)
[21:43:59] mlt-: has joined #RubyOnRails
[22:50:27] mlt-: Quit: ERC (IRC client for Emacs 25.3.1)

2018-04-19

[19:25:30] mlt-: has joined #RubyOnRails
[19:27:58] mlt-: Is there a way to autoreload stuff if I modify ruby code in an underlying gem I use in my Rails app? I mean do I have to explicitly ask Guard to watch those files or is there an automagic way to restart server if any of the local gems changed?
[21:14:33] mlt-: FLeiXiuS: https://apidock.com/rails/ActionController/Streaming/send_file ?
[21:16:38] mlt-: why wouldn't you send pics the same way?
[21:17:41] mlt-: Set :disposition to inline?
[21:20:24] mlt-: are attachments way different than pictures? Can you handle them both the same way but keep a flag for disposition
[21:21:00] mlt-: Since you do it for both pictures and attachments, I don't see much difference and need in another controller
[21:21:15] mlt-: call avatar as a special attachment
[21:21:27] mlt-: I mean just "file"
[21:22:03] mlt-: I was about to suggest, but I don't think this will do it.
[21:22:11] mlt-: You said pictures can be attachments.
[21:22:17] mlt-: So you do need an extra flag
[21:22:37] mlt-: I mean just don't create 2 DB tables, 2 controllers, etc
[23:04:07] mlt-: Quit: ERC (IRC client for Emacs 25.2.1)

2018-01-25

[19:46:11] mlt-: Quit: ERC (IRC client for Emacs 25.2.1)

2018-01-24

[22:46:44] mlt-: has joined #RubyOnRails

2017-12-02

[18:37:17] mlt-: Ping timeout: 268 seconds

2017-12-01

[16:45:25] mlt-: has joined #RubyOnRails

2017-09-28

[04:05:28] mlt-: Quit: ERC (IRC client for Emacs 25.2.1)

2017-09-26

[02:32:17] mlt-: Where would I blank one parameter if another is also blank?
[02:32:34] mlt-: Somehow I feel like this belongs to a model
[02:35:20] mlt-: ACTION feels like #before_save is the way to go
[17:55:31] mlt-: Quit: ERC (IRC client for Emacs 25.2.1)
[21:00:19] mlt-: has joined #RubyOnRails

2017-09-25

[18:39:24] mlt-: Can I use AR query method #select to calculate fields with a parameter? I want something akin to the following SQL "count(*) filter (where completed_at < ?)"
[18:39:44] mlt-: Do I have to use exec_query?
[18:39:55] mlt-: I just though to use association, scopes and alike
[18:40:17] mlt-: I mean if bare SQL is the only option, fine by me
[19:00:22] mlt-: baweaver: no, I can't use global where... I need like 4 different values. I don't want to run 4 separate queries.
[19:00:48] mlt-: baweaver: I decided to go with raw sql
[20:26:19] mlt-: Does #sanitize_sql_array work with array parameters? I need to supply single element array of integers. I tried passing Array(blah) among other things, but sql looks as if array was turned into a single integer :(
[20:36:34] mlt-: tcopeland: yeah, though I had more like ["select blah from fancy_func(param => ?)", Array(1)]
[20:37:13] mlt-: it just expanded it as if param => 1 and I had DB error that no function with such signature
[20:38:29] mlt-: tcopeland: though since I had to pass a single value array, I got by with param=>'{?}'
[20:38:56] mlt-: But I'm curious in general purpose solution though
[20:39:16] mlt-: I wonder if it senses ? surrounded by parenthesis
[20:39:25] mlt-: to interpret arguments any different
[20:44:18] mlt-: patientplatypus: I think you do
[20:44:38] mlt-: your password and confirmation should be inside user=>{}}
[20:44:53] mlt-: Look at Parameters on line 9
[20:45:12] mlt-: and on line 47
[20:45:32] mlt-: something is not quite right with your html
[20:46:42] mlt-: name="user[password]" has to be somewhere, but it is name="password"
[20:47:42] mlt-: though... it depends on line 47 :) you can change it as well)
[20:47:53] mlt-: to accept the latter

2017-09-22

[16:10:43] mlt-: What is the best practice to solicit user for confirmation for the following? I have a batch action that changes attributes of a few AR objects. Some of them may fail to validate. I would like to check with user if they still wants to apply changes to some shown objects among all requested?
[16:11:17] mlt-: Shall I use extra parameter? Extra action? Form Object?
[16:27:47] mlt-: yehaizi: And what would be a good approach? Custom JSON response?
[16:28:12] mlt-: It would be nice to make it reusable
[16:42:51] mlt-: yehaizi: So you are saying error is just for a user to note and just returning html as usual without failing objects pre-filled would suffice? Shall I use a transaction and apply updates if there was no validation issues and roll back otherwise? And how would I know what failed to update? It seems #update returns resulting object no matter whether it was saved sucessfully
[16:44:21] mlt-: Call #all? and #valid?
[16:44:36] mlt-: on #update result
[16:44:49] mlt-: to decide whether to roll back
[16:49:39] mlt-: yehaizi: it seems that I have to fail it based on #all? and #valid? on #update result as I mentioned above. It doesn't look like #update will raise exception if validation fails
[16:52:18] mlt-: matthewd: Thanks! I don't know how I missed it)
[16:56:33] mlt-: yehaizi: Yes, I plan to enclose in transaction block ... it is just update_all as of now O;-)
[17:02:21] mlt-: matthewd: uhm... can I use update! on multiple objects? I'm confused... apparently there is Base::update and Persistence::update
[17:03:18] mlt-: Looks like I have to manually instantiate and update each object with #update!
[17:03:36] mlt-: for the whole idea with a transaction to work
[17:06:57] mlt-: Thank you!
[17:10:31] mlt-: Does #each return anything? like number of processed entries?
[17:14:55] mlt-: ravster: test suites and raise exceptions https://robots.thoughtbot.com/foolproof-i18n-setup-in-rails
[17:33:49] mlt-: matthewd: though yehaizi is gone... update! and rollback is not gonna help actually... as I do want to know a list of failed and valid objects :-) So I have to #map or something...
[17:34:36] mlt-: I mean I have to process all and then decide on rolling back manually
[18:41:44] mlt-: How would I count non-false values in array? I tried count(&:not) but I got NoMethodError: undefined method `not' for true:TrueClass
[18:46:05] mlt-: itself did the trick!
[18:47:03] mlt-: I wanted to count collected results on successfully updated AR objects as #update returns false if failed validation
[19:32:57] mlt-: uhm... when dealing with self-referencing associations, how do I refer to a columns in particular table in scopes?
[22:34:28] mlt-: Can I use _was in validators?
[22:34:40] mlt-: I want original value for an attribute

2017-09-19

[18:25:32] mlt-: Is there any neat way (gem) to autogenerate HTML table for array of hashes (same keys throughout)