morfin60

Activity Graph

Page 1 of 3 | Next »

2018-10-31

[12:31:59] morfin60: Remote host closed the connection

2018-10-22

[09:48:28] morfin60: has joined #RubyOnRails
[22:04:10] morfin60: Remote host closed the connection
[22:06:41] morfin60: has joined #RubyOnRails

2018-10-19

[15:02:39] morfin60: has joined #RubyOnRails
[15:04:41] morfin60: i am using gem which sets callback inside of concern but i need to change behavior of this gem a bit(basically i want to generate slug only when it's empty in request). Any idea how can i do this?
[15:52:45] morfin60: i realised i don't need autogeneration)
[16:55:00] morfin60: Remote host closed the connection

2018-09-10

[06:32:14] morfin60: has joined #RubyOnRails
[06:32:41] morfin60: Is there any way to get DIRECT link to thing uploaded via Active Storage?
[06:32:53] morfin60: instead of going trought application?
[12:41:31] morfin60: Read error: Connection reset by peer

2018-09-07

[15:51:52] morfin60: Remote host closed the connection

2018-09-06

[01:17:04] morfin60: Ping timeout: 240 seconds
[10:21:04] morfin60: has joined #RubyOnRails
[10:22:16] morfin60: seems like blob uploads would fixed only in Rails 6.0? I mean they're uploaded ONLY if model were valid not always(to avoid orphans)
[10:23:38] morfin60: i had to workaround in 5.2 to remove orphans
[10:55:55] morfin60: other stuff works fine for me

2018-09-05

[14:03:21] morfin60: has joined #RubyOnRails
[14:05:09] morfin60: can you help me with my dilemma: i am using ActiveStorage to save files locally, but when i attach file to model i just instantly save blob and attachment records. I also have my own validation on model owning this attachment so it can't be saved if file validation failed
[14:05:46] morfin60: but when i call save i do photo.purge but since there is an errors transaction gets rolled back and delete as well
[14:07:36] morfin60: how do i delete unnessesary record without having DELETE rolled back because validation failed?
[14:49:15] morfin60: nvm i made this in after_rollback callback
[17:38:47] morfin60: after_rollback and on does not combine?
[17:39:11] morfin60: i wanted to do after_rollback :purge_attachments, on: [:create]
[17:39:19] morfin60: but seems like i can't do that

2018-04-12

[09:04:10] morfin60: has joined #ruby
[15:01:34] morfin60: Remote host closed the connection

2018-04-11

[08:09:17] morfin60: has joined #RubyOnRails
[16:19:20] morfin60: Remote host closed the connection

2018-03-28

[18:51:55] morfin60: has joined #ruby

2018-03-22

[07:31:41] morfin60: has joined #RubyOnRails
[07:32:25] morfin60: can i somehow build WHERE locale=:locale AND (title != "" AND description != "" AND product_type != "") in Rails?
[07:33:31] morfin60: only using string?
[07:49:02] morfin60: joins(:translations).where.not(conditions).where("locale = :locale", locale: translation)
[07:49:13] morfin60: this is what i got in my scope
[07:49:45] morfin60: conditions is hash like {title: "", description: "", interior_type: ""}
[07:50:40] morfin60: SELECT "interiors".* FROM "interiors" INNER JOIN "interior_translations" ON "interior_translations"."interior_id" = "interiors"."id" WHERE ("interior_translations"."interior_type" != "") AND ("interior_translations"."title" != "") AND ("interior_translations"."description" != "") AND (locale = 'ru') LIMIT 11
[07:51:00] morfin60: this is what i've got
[13:53:02] morfin60: Remote host closed the connection

2018-03-19

[06:51:05] morfin60: has joined #RubyOnRails
[06:51:39] morfin60: is there good solutions to bulk upload file(just email per line) with validations etc?
[06:52:45] morfin60: 1. I need valid emails only. 2. I need unique emails list(so i have uniqueness validation). 3. Better if it would bulk upload instead of saving every contact separately
[06:54:21] morfin60: well, i have txt file where every line have one email and i need to upload this list into database with validations etc.
[07:00:12] morfin60: create records
[07:00:30] morfin60: as i said i have validation of email + validation of uniqueness
[15:20:37] morfin60: Remote host closed the connection

2018-03-16

[14:22:24] morfin60: has joined #ruby
[14:27:04] morfin60: i am not sure how implement that: i have class A and classes B,C,D inherited from this class, all of them have method to parse all pages called collect_blocks of resource(pool) and i parse them until there is no output, this method is protected and used in multiple public methods of classes, any clue how can i pass code to process single page?
[14:28:30] morfin60: i realized how dumb was idea trying collect all blocks in huge array and want to rewrite code to process page-by-page
[16:23:00] morfin60: Remote host closed the connection

2018-03-15

[13:32:43] morfin60: has joined #RubyOnRails
[13:33:02] morfin60: i am issuing memory bloat with Sidekiq And ActiveRecord 4
[13:33:08] morfin60: *ActiveRecord 5
[13:49:47] morfin60: Quit: Leaving

2018-03-14

[07:28:40] morfin60: has joined #RubyOnRails
[07:29:53] morfin60: i created browser.rb under lib subdirectory and added config.autoload_paths += %W(#{config.root}/lib) but Browser class declared in lib/browser.rb do not load
[07:30:04] morfin60: any clue why this can happen?
[07:31:53] morfin60: when i run "rails c" and then Browser.new(driver: :firefox) saying that this class not exists
[07:32:17] morfin60: but when i do require 'browser' and then do same thing everything is ok
[07:34:20] morfin60: hmm nothing changed
[07:36:17] morfin60: NameError: uninitialized constant Browser
[07:37:12] morfin60: and my application is working in development environment
[07:38:28] morfin60: i do not know what happens with this class
[07:42:42] morfin60: config.autoload_paths += Dir["#{config.root}/lib/**/", "#{config.root}/app/models/ckeditor"] in application.rb worked
[08:51:26] morfin60: has joined #ruby
[10:19:57] morfin60: Remote host closed the connection
[11:37:14] morfin60: has joined #ruby
[11:37:27] morfin60: can i somehow count objects allocated by Ruby by types?
[11:42:37] morfin60: dminuoso, well i just want to find out which objects count is constantly growing
[11:45:56] morfin60: i suspect something "leak"
[11:47:15] morfin60: i have Sidekiq performing some tasks and eventually it consumed all memory + all swap
[12:50:36] morfin60: not sure it's real leak
[12:51:41] morfin60: well, i know some native extension can allocate and do not free memory but there is pretty low chance of this because whole thing consumes bunch of memory
[15:36:00] morfin60: Remote host closed the connection

2018-03-13

[06:18:03] morfin60: has joined #ruby
[07:08:15] morfin60: i am not sure how implement next thing: i need to perform some job for different "accounts" with execution limit(let's say 35 time per day) for each account
[07:09:45] morfin60: what you'd use for this: Sidekiq? parallel? Let's assume most of time threads will be idling so i don't need N threads all the time
[09:42:47] morfin60: i am not sure how "persist" object connected to browser
[09:53:26] morfin60: dminuoso, what?
[09:53:49] morfin60: i meant persist N Selenium wrapper objects somewhere
[14:47:11] morfin60: Remote host closed the connection

2018-03-12

[10:08:35] morfin60: has joined #RubyOnRails
[10:09:07] morfin60: so i can test stuff using rails runner(i am developing my app using Selenium and Firefox + geckodriver)?
[10:09:19] morfin60: i need to run code in context of an application with autoloads etc
[15:27:37] morfin60: Remote host closed the connection

2018-03-07

[08:50:09] morfin60: has joined #RubyOnRails
[08:50:30] morfin60: how do i register stylesheets/javascripts in my own gem?
[16:09:47] morfin60: Remote host closed the connection

2018-03-01

[14:55:34] morfin60: dminuoso, not crashed for me
[14:56:16] morfin60: Arch Linux x86_64 =)
[14:56:24] morfin60: yes, 2.4.1 and irb
[14:59:14] morfin60: no stack level too deep for me
[23:38:41] morfin60: Ping timeout: 248 seconds

2018-02-28

[06:36:00] morfin60: Vashy, i'd suggest to choose special tool for this(like Ansible)
[06:38:13] morfin60: recently i had problem with older mysql2 gem and Mariadb
[06:38:44] morfin60: only way to build this was just fixing gem itself and install manually
[06:40:08] morfin60: why can't clone database and port(with migrations)?
[06:40:24] morfin60: and then deploy when it's ready(pass tests etc)
[06:43:27] morfin60: and they won't learn Ruby
[08:12:21] morfin60: Remote host closed the connection
[08:12:42] morfin60: has joined #RubyOnRails
[09:12:10] morfin60: if i have bunch of JSONAPI::Resources and each have relation and i need to count AVG on one field of related models is that better to precalculate?
[09:13:52] morfin60: seems like doing something like this: @model.blocks.where("pool_elapsed_time IS NOT NULL AND pool_elapsed_time <> 0").average(:pool_elapsed_time) is not pretty good idea since i perform extra query for each resource, also there is getter to count related to pool blocks, so it's +1 query
[10:23:08] morfin60: has joined #ruby
[10:24:01] morfin60: any clue why can connection reset by peer happen in Net::HTTP with this message: "Internal Server Error: Connection reset by peer <internal:prelude>:78:in `__read_nonblock'"?
[10:24:33] morfin60: i perform first request using Faraday and then performing second and get this error

2018-02-27

[13:24:23] morfin60: has joined #RubyOnRails
[13:26:31] morfin60: i use JSONResources and have resource for model Pool in list i need to get some parameters from non-relational database for each Pool instance how do i avoid querying database 2 times for each Pool instance?
[13:28:22] morfin60: queries could be placed in an array(as example: {start: 0, queries: [{metric: 'foo.bar', tags: {pool: 1, type: 'total'}, aggregate: 'sum'}, {metric: 'foo.bar', tags: {pool: 2, type: 'total'}, aggregate: 'sum'}]

2018-02-16

[08:23:39] morfin60: has joined #RubyOnRails
[08:24:30] morfin60: if i have class A with cattr_accessor :foo and class B doing self.foo = "bar" seems like this rewrites A.foo instead
[08:24:48] morfin60: should i use class << self attr_accessor :foo end then ?
[08:37:42] morfin60: ah wandbox )
[08:37:56] morfin60: i keep forgetting name of that site
[08:40:48] morfin60: dminuoso, i noticed that :)
[08:41:18] morfin60: i don't think any bot has ActiveSupport stuff
[09:01:01] morfin60: dminuoso, i guess this is similar: https://wandbox.org/permlink/dnBtptZRUlpfqkRy
[09:01:21] morfin60: well, not exact match but still: if i use @@ same result as i used cattr_accessor
[09:02:07] morfin60: i forgot they're shared across children
[09:18:45] morfin60: i remember how we optimized query from like 60s to milliseconds
[09:19:02] morfin60: it was not Ruby/Rails but still
[16:05:47] morfin60: Remote host closed the connection

2018-02-08

[15:40:43] morfin60: has joined #RubyOnRails
[15:40:51] morfin60: how do i autoload gem models?
[15:41:00] morfin60: only Engine?
[16:06:27] morfin60: Remote host closed the connection

2018-02-06

[11:02:29] morfin60: has joined #RubyOnRails
[11:02:44] morfin60: can i somehow know i access resources collection?
[11:05:24] morfin60: i have several resources: :products, :limited, :interiors etc, i need if i access index action of one of such controllers change canonical URL to add /All
[11:06:47] morfin60: *no, i need to output canonical URL including /all if user access /products instead of /products/All
[11:10:23] morfin60: ok it was bad idea
[11:11:00] morfin60: i just do not want to hardcode such behavior to add /All to canonical
[11:16:21] morfin60: because /products is same as /products/All
[11:16:58] morfin60: but /products/All is canonical when /products is not so i need to show canonical URL for this page because of SEO monkeys
[13:56:24] morfin60: Remote host closed the connection

2018-02-05

[08:42:22] morfin60: has joined #ruby
[08:42:34] morfin60: what's simpliest way to remove first element in path
[08:42:51] morfin60: as example i have /A/B/C/D/E i need to remove A whatevet it is
[09:00:16] morfin60: not sure it's valid
[11:09:44] morfin60: dminuoso, simple!?
[11:11:28] morfin60: and why the heck you call it simple?
[11:14:03] morfin60: as example we have something like Object->Module->Class->Foo->Instance of Foo, there can be ancestors for every level
[11:14:13] morfin60: *on every level
[11:14:34] morfin60: does Ruby avoid looking up same thing somehow?
[11:15:12] morfin60: as example Foo include Bar, Bar is basically Class
[11:15:30] morfin60: will Class and Object and Module looked up once
[14:39:44] morfin60: how do i parse timestamp as value with specific timezone?
[14:39:48] morfin60: as example i have
[14:41:05] morfin60: as example i have 1516208400 i want to parse it with Asia/Moskow timezone so reported date will be something like 2018-01-17 17:00:00 +03:00
[14:46:30] morfin60: strptime seems to be assuming that i have timezone UTC
[14:47:22] morfin60: it's stored in database as UTC but server(opentsdb) convert it for me
[14:47:36] morfin60: >> DateTime.strptime(1516208400, "%s")
[14:47:59] morfin60: >> require 'date'; DateTime.strptime(1516208400, "%s")
[14:48:12] morfin60: >> require 'date'; DateTime.strptime("1516208400", "%s")
[14:57:43] morfin60: Opentsdb seems to be weird
[15:20:54] morfin60: Remote host closed the connection

2018-02-02

[07:41:17] morfin60: has joined #RubyOnRails
[07:41:36] morfin60: how can i describe JSONAPI::Resource without AR model?
[16:20:22] morfin60: Remote host closed the connection

2018-01-23

[08:53:35] morfin60: has joined #RubyOnRails
[16:19:49] morfin60: Remote host closed the connection

2018-01-22

[07:57:26] morfin60: has joined #RubyOnRails
[07:58:08] morfin60: what's simpliest way to get current timezone in Rails in format of tzdata? like Europe/Moskow
[09:18:40] morfin60: how do i migrate data not just schema?
[14:20:15] morfin60: i have issue with enums in rails model
[14:20:43] morfin60: when i query model i get nil as enum value instead of string/int any idea why?
[14:25:30] morfin60: https://gist.github.com/morfin60/2d9ebfc2ae6b84ce9062d476948da083
[14:25:38] morfin60: i think i found weird rails bug?
[14:26:16] morfin60: i just rails c and then ProductInfo.first.info_type => nil
[15:14:49] morfin60: maybe you need joins?
[15:16:28] morfin60: za1b1tsu, includes seems to be loading AR models using minimal queries
[15:17:04] morfin60: eager loading, when joins is used when you need build condition on other related thing - like in your case
[15:18:26] morfin60: Remote host closed the connection

2018-01-19

[04:19:03] morfin60: Remote host closed the connection
[04:19:33] morfin60: has joined #RubyOnRails
[04:19:33] morfin60: has joined #ruby
[11:44:19] morfin60: how you'd do if have some model X which represent record in relation database but need print some additional fields which stored in different database(OpenTSDB/hbase)?
[11:45:18] morfin60: data in OpenTSDB stored with specific metrics and tag value equal to id of this record in relational database
[11:45:40] morfin60: {timestamp: 234436735, value: 2345, tags: [
[11:49:23] morfin60: {"metric": "pool.stats.hashrate","timestamp": 234436735, "value": 2345, "tags": {"pool": 2, "type": "total"}} this is how record in OpenTSDB can be represented as JSON
[12:27:45] morfin60: Ping timeout: 248 seconds
[12:37:22] morfin60: has joined #RubyOnRails
[14:29:52] morfin60: i think i need own adapter )
[15:31:16] morfin60: Remote host closed the connection

2018-01-18

[07:12:28] morfin60: i don't understand how BasicObject can have itself in ancestors list
[07:13:15] morfin60: ah of course)
[07:14:48] morfin60: at least we don't need proto/metatables/something else)
[07:17:15] morfin60: >> BasicObject.super
[07:17:22] morfin60: >> BasicObject.superclass
[07:21:25] morfin60: first method found in that chain is being executed right?
[07:33:59] morfin60: but what if i want explicitly call some instead of automatically looking up?
[07:36:03] morfin60: i mean instance method
[07:44:44] morfin60: dminuoso, can i somehow call method of parents parent explicitly?
[07:51:08] morfin60: nvm, this worked: https://eval.in/937122
[10:19:13] morfin60: ah i forgot
[10:19:21] morfin60: ruby[bot] can't handle PM
[10:19:58] morfin60: oops wrong chat =)