DEA7TH

Activity Graph

Page 1 of 10 | Next »

2016-04-24

[13:34:34] DEA7TH: has joined #ruby
[13:36:11] DEA7TH: Quit: DEA7TH

2016-03-12

[02:05:01] DEA7TH: Quit: DEA7TH
[14:11:49] DEA7TH: has joined #RubyOnRails
[14:16:49] DEA7TH: Quit: DEA7TH
[18:00:07] DEA7TH: has joined #RubyOnRails

2016-03-11

[00:09:45] DEA7TH: Quit: DEA7TH
[01:41:33] DEA7TH: has joined #RubyOnRails
[01:43:11] DEA7TH: Client Quit
[16:46:39] DEA7TH: has joined #RubyOnRails
[20:11:48] DEA7TH: Quit: DEA7TH
[21:08:58] DEA7TH: has joined #RubyOnRails

2016-03-10

[10:33:59] DEA7TH: has joined #RubyOnRails

2016-03-09

[02:16:30] DEA7TH: Quit: DEA7TH
[09:57:49] DEA7TH: has joined #RubyOnRails
[21:44:18] DEA7TH: Quit: DEA7TH

2016-03-08

[12:25:45] DEA7TH: has joined #RubyOnRails
[17:02:16] DEA7TH: Ping timeout: 264 seconds
[23:20:24] DEA7TH: has joined #RubyOnRails

2016-03-06

[10:22:32] DEA7TH: has joined #RubyOnRails
[23:30:29] DEA7TH: Quit: DEA7TH

2016-03-05

[15:57:21] DEA7TH: has joined #RubyOnRails
[20:49:16] DEA7TH: Quit: DEA7TH
[22:59:15] DEA7TH: has joined #RubyOnRails
[23:01:11] DEA7TH: Client Quit

2016-03-04

[09:49:17] DEA7TH: has joined #RubyOnRails
[17:10:41] DEA7TH: Quit: DEA7TH
[20:38:11] DEA7TH: has joined #RubyOnRails
[23:47:17] DEA7TH: Quit: DEA7TH

2016-03-03

[11:05:07] DEA7TH: has joined #RubyOnRails
[17:40:33] DEA7TH: Ping timeout: 240 seconds

2016-03-02

[11:45:17] DEA7TH: has joined #RubyOnRails
[16:51:26] DEA7TH: Quit: DEA7TH
[22:13:57] DEA7TH: has joined #RubyOnRails
[23:28:56] DEA7TH: Quit: DEA7TH

2016-03-01

[12:39:14] DEA7TH: has joined #RubyOnRails
[14:04:42] DEA7TH: Quit: DEA7TH

2016-02-29

[08:40:11] DEA7TH: has joined #RubyOnRails
[14:31:20] DEA7TH: Quit: DEA7TH
[14:31:55] DEA7TH: has joined #RubyOnRails
[17:20:26] DEA7TH: Quit: DEA7TH
[20:19:52] DEA7TH: has joined #RubyOnRails
[21:01:42] DEA7TH: Quit: DEA7TH

2016-02-27

[03:33:44] DEA7TH: has joined #RubyOnRails
[19:11:48] DEA7TH: Quit: DEA7TH

2016-02-26

[04:30:13] DEA7TH: has joined #RubyOnRails
[15:47:16] DEA7TH: If I need shared state for the current server only, is it better to write it to a file or to use dollar sign variables?
[15:47:51] DEA7TH: (across different requests)
[19:21:25] DEA7TH: Quit: DEA7TH

2016-02-25

[03:17:37] DEA7TH: has joined #RubyOnRails
[04:13:14] DEA7TH: I'm getting this: You tried to define an enum named "payment_scheme" on the model "Customer", but this will generate a instance method "payment_scheme=", which is already defined by another enum.
[04:13:27] DEA7TH: but the only two lines which mention this in my code are:
[04:13:49] DEA7TH: https://gist.github.com/VelizarHristov/e8c5898360502b467514
[04:13:56] DEA7TH: in the model at least
[04:14:20] DEA7TH: it was all working for many months, but yesterday I added this into a migration:
[04:14:30] DEA7TH: add_column :customers, :bookings_count, :integer
[04:14:44] DEA7TH: haven't touched the enum; but this broke my app
[04:14:48] DEA7TH: sounds like a Rails bug to me
[04:15:51] DEA7TH: it randomly disappears when I comment out either the validates or the enum declaration, but if I comment out the latter then some pages don't work because they reference the payment_scheme column
[04:16:42] DEA7TH: any ideas how to print the existing enums at least? or anything else I might to do try to debug it
[04:17:43] DEA7TH: matthewd: I have no clue how to reproduce it, I don't know what triggered it, it appeared since I made a migration.
[04:17:50] DEA7TH: the migration is for an unrelated column
[04:18:44] DEA7TH: sevenseacat: Not every problem is reproducible
[04:19:01] DEA7TH: I could post more code, like all code which makes use of that enum
[04:20:52] DEA7TH: https://gist.github.com/VelizarHristov/47125c5185378a601070
[04:21:05] DEA7TH: Now it stopped appearing. But I've restarted the server multiple times previously.
[04:21:46] DEA7TH: It's back after I restarted the server
[04:23:24] DEA7TH: oh, I haven't noticed that line of error trace.....
[04:23:39] DEA7TH: it's require 'customer'
[04:23:52] DEA7TH: because I'm monkeypatching Customer
[04:24:35] DEA7TH: because I hate doing method(object) instead of object.method
[04:24:54] DEA7TH: it's just this: addresses.map(&:display).join(' / ')
[04:25:08] DEA7TH: I'll just remove the require and the bug will probably go away, but I'll paste it anyway
[04:25:30] DEA7TH: Radar: that line works because I have Customer.create id: -1, .... ....
[04:25:48] DEA7TH: in the population
[04:25:52] DEA7TH: populate*
[04:26:11] DEA7TH: I think yes?
[04:26:34] DEA7TH: it never caused problems before (and there weren't problems with unknown causes, that's how I'm sure)
[04:26:52] DEA7TH: works in PG, didn't know it doesn't on other DBs
[04:27:21] DEA7TH: what is the best practice for having a system customer then?
[04:27:47] DEA7TH: they just reuse a subset of the logic for a normal customer
[04:28:22] DEA7TH: hold on I'll post it
[04:28:27] DEA7TH: it's just nothing new over what I posted
[04:28:44] DEA7TH: https://gist.github.com/VelizarHristov/88445faa464b9504cbd4
[04:29:22] DEA7TH: it's because I hate f(x) instead of x.f
[04:30:26] DEA7TH: I was pretty sure it was safe. oh well
[04:32:16] DEA7TH: I'll probably use a decorator instead, because the function call syntax is awful and a tiny bit less safe
[04:32:35] DEA7TH: I thought something said I can do it, not sure what lead me to it
[04:34:02] DEA7TH: don't even remember what made me do it
[04:34:22] DEA7TH: I mean assume that it's safe to do
[04:34:42] DEA7TH: it was probably 1-2 years ago
[07:15:15] DEA7TH: If my code is generating 250KB of HTML (4k loc), would this be the reason why it spends 500-600ms in Views?
[07:16:47] DEA7TH: no SQL executed in view
[07:18:00] DEA7TH: I haven't paginated it yet
[07:18:05] DEA7TH: but I'll fix that separately
[07:18:28] DEA7TH: it looks smaller when you view it
[07:19:28] DEA7TH: I thought the size of the generated HTML would be indicative
[07:19:33] DEA7TH: 4k loc is the generated HTML, not the irb
[07:19:38] DEA7TH: ok I'll gist
[07:20:21] DEA7TH: https://gist.github.com/VelizarHristov/8db6236ef0abe8142fc4
[07:20:52] DEA7TH: all querying is done before the view
[07:21:12] DEA7TH: no, they are already ran when the view is rendered
[07:21:45] DEA7TH: I'll include that too, although I suspect it won't help
[07:22:28] DEA7TH: edited: https://gist.github.com/VelizarHristov/8db6236ef0abe8142fc4
[07:22:32] DEA7TH: now includes controller method
[07:22:55] DEA7TH: search does nothing in my case
[07:23:05] DEA7TH: I am sure I am not running queries from the view
[07:23:14] DEA7TH: it is really easy to check for that, I cannot get it wrong
[07:23:30] DEA7TH: I tested it by including puts("end of controller") at the end of the controller and ran the page
[07:24:14] DEA7TH: (btw search is doing nothing in my case)
[07:24:22] DEA7TH: (or rather, returning Customer.all)
[07:26:46] DEA7TH: it's an attribute
[07:27:16] DEA7TH: .deletable? was bad, but now it's just reading a column
[07:51:46] DEA7TH: Quit: DEA7TH
[09:16:37] DEA7TH: has joined #RubyOnRails
[09:49:58] DEA7TH: Quit: DEA7TH
[09:53:41] DEA7TH: has joined #RubyOnRails
[09:53:49] DEA7TH: Client Quit
[09:55:58] DEA7TH: has joined #RubyOnRails
[18:06:25] DEA7TH: Quit: DEA7TH
[18:37:08] DEA7TH: has joined #RubyOnRails
[19:11:59] DEA7TH: Quit: DEA7TH

2016-02-24

[02:58:45] DEA7TH: has joined #RubyOnRails
[18:25:40] DEA7TH: Quit: DEA7TH

2016-02-23

[02:16:59] DEA7TH: Would this file be ignored? db/migrate/20140313192112_create_customers.rb~
[02:17:16] DEA7TH: I strongly suspect it's been ignored the whole time. also RubyMine didn't show it
[04:45:14] DEA7TH: This causes 2 queries, how can I make it 1 instead? a = Address.where(id: 1); a.size; a
[04:45:25] DEA7TH: First it queries for count since where is lazy
[04:48:19] DEA7TH: the problem was that I needed to first check the size/count, then use the record. load solved it
[06:45:26] DEA7TH: this doesn't work? TripItem.where(trip: Trip.where(completed: true).select(:id))
[06:45:35] DEA7TH: I get ERROR: subquery has too many columns
[06:45:46] DEA7TH: but Trip.where(completed: true).select(:id) works on its own
[06:46:06] DEA7TH: I have provided my full code snippet, what more do you want?
[06:46:19] DEA7TH: rhizome: I want to do it in a single query
[06:46:31] DEA7TH: sevenseacat: oh my bad
[06:46:53] DEA7TH: rhizome: select all TripItems whose Trip is completed
[06:48:16] DEA7TH: I know, but with pluck() it's 2 queries then
[06:52:13] DEA7TH: it's still 2 queries with Trip.joins(:trip_items). I'll try other variations with joins
[06:52:52] DEA7TH: arup_r: This takes 2 queries: Trip.joins(:trip_items).where(completed: true)[0].trip_items
[06:53:06] DEA7TH: I'll probably need map(&:trip_items) instead
[06:53:20] DEA7TH: but it should work with [0]
[06:54:54] DEA7TH: arup_r: that returns an array of Trips. Afterwards, using [0].trip_items does 2 queries
[06:55:25] DEA7TH: I think I have something working with includes now
[06:56:08] DEA7TH: Trip.joins(:trip_items).includes(:trip_items).where(completed: true).select('trip_items.*')[1].trip_items
[06:56:12] DEA7TH: this is 1 query
[06:56:54] DEA7TH: either one doesn't work
[06:57:37] DEA7TH: removing either the joins or includes results in 2 queries or not working
[06:57:58] DEA7TH: arup_r: returns Trip, not TripItem
[06:59:30] DEA7TH: arup_r: that's really odd! yes it works
[07:00:49] DEA7TH: so let's call that `ti`. ti = that_query_there
[07:00:55] DEA7TH: ti.trip doesn't work
[07:01:05] DEA7TH: NoMethodError: undefined method `trip' for #<Trip:0x007fa343a43510>
[07:01:21] DEA7TH: not sure if it would work for my use case
[07:01:30] DEA7TH: but I'll probably want to access its attributes
[07:01:42] DEA7TH: I want to replace code with lots of includes which also queries lots of columns
[07:01:55] DEA7TH: I'd rather go with includes().joins()
[07:02:31] DEA7TH: without joins it's double query
[07:11:36] DEA7TH: arup_r: Fair enough. But what is so bad about .joins.includes?
[07:12:59] DEA7TH: it does look a bit worrying:
[07:13:23] DEA7TH: SQL (2.5ms) SELECT trip_items.*, "trips"."id" AS t0_r0, "trips"."date" AS t0_r1, "trips"."start_time" AS t0_r2, "trips"."completed" AS t0_r3, "trips"."driver_account_id" AS t0_r4 etc......
[07:18:34] DEA7TH: I don't even need any of the trip attributes, but as long as it's readable and runs fast...
[07:19:53] DEA7TH: rvanlieshout: the query is retrieving trip.id, trip.date, trip.start_time etc. and I don't need any of those
[07:20:17] DEA7TH: it runs instantaneously, my DB will probably never have more than 20-50k records in any table
[07:20:25] DEA7TH: just the trip items
[07:20:33] DEA7TH: trip_items*
[07:21:49] DEA7TH: trip items whose trip_item.trip.completed == true
[07:22:51] DEA7TH: huh, I tried that but with _trip_ instead of _trips_ and it failed
[07:22:53] DEA7TH: yay it works
[07:23:20] DEA7TH: rvanlieshout: trips is the DB name?
[07:25:31] DEA7TH: I got the idea from here: http://guides.rubyonrails.org/active_record_querying.html
[07:26:26] DEA7TH: in the example, the table name is plural in the joins too so it was unclear
[07:28:11] DEA7TH: Quit: DEA7TH
[08:27:29] DEA7TH: has joined #RubyOnRails
[08:33:04] DEA7TH: Read error: Connection reset by peer
[08:33:22] DEA7TH: has joined #RubyOnRails
[16:15:14] DEA7TH: Quit: DEA7TH
[17:16:03] DEA7TH: has joined #RubyOnRails
[17:22:26] DEA7TH: Quit: DEA7TH
[17:28:44] DEA7TH: has joined #RubyOnRails
[17:45:24] DEA7TH: how can I get where.not to *not* exclude nil? this is stupid default behavior anyway
[17:45:47] DEA7TH: Booking.where.not(delivery_trip_item_id: 1).count - this exludes all bookings where delivery_trip_item_id = nil
[18:10:08] DEA7TH: arup_r: in practice I'm filtering by multiple ids. But I want to include the nils.
[18:10:38] DEA7TH: I can either do where(.._id: present_ids), or where.not(.._id: absent_ids)
[18:10:41] DEA7TH: but I solved it!
[18:10:55] DEA7TH: where(.._id: present_ids + [nil])
[18:11:08] DEA7TH: uhh that would exclude the nil
[18:11:52] DEA7TH: I tried it and it excludes
[18:12:04] DEA7TH: so I still don't have a solution if the ids need to be excluded
[18:13:41] DEA7TH: yeah that might be the only solution if I have to do that
[18:17:03] DEA7TH: Quit: DEA7TH

2016-02-22

[00:08:57] DEA7TH: I'm transforming my data for visualization - this code is only tied to the visualization pages. It's a fair amount of code. Should it go in a controller, since there is no logic building up on it?
[00:22:57] DEA7TH: Radar: It feels unintuitive because I'm used to putting large-ish amounts of code, and code for transforming my models, into models.
[00:31:26] DEA7TH: has left #ruby: ()
[09:57:43] DEA7TH: Quit: DEA7TH
[22:52:07] DEA7TH: has joined #RubyOnRails

2016-02-21

[00:34:56] DEA7TH: Quit: DEA7TH
[03:58:53] DEA7TH: has joined #RubyOnRails
[03:58:53] DEA7TH: has joined #ruby
[05:07:28] DEA7TH: How does ActiveRecord here know that I'm referring to the id of Ironing, rather than the included ironer_account's id? https://gist.github.com/VelizarHristov/ac9d9bd22330de5acf3a
[05:10:50] DEA7TH: I edited the gist to include the generated SQL
[08:52:18] DEA7TH: Ping timeout: 276 seconds
[10:57:10] DEA7TH: Quit: DEA7TH
[10:57:38] DEA7TH: has joined #RubyOnRails
[11:41:42] DEA7TH: has joined #ruby
[11:41:48] DEA7TH: Is there a shortcut for that: Proc.new{ |date| date.next_day }
[11:42:40] DEA7TH: I want to assign it to a variable and then call it with something
[11:42:44] DEA7TH: p.call(my_date)
[11:44:08] DEA7TH: awesome, I'll use :method_name.to_proc
[13:06:32] DEA7TH: Quit: DEA7TH
[20:07:31] DEA7TH: has joined #ruby
[20:07:31] DEA7TH: has joined #RubyOnRails

2016-02-20

[05:38:38] DEA7TH: Quit: DEA7TH
[07:35:22] DEA7TH: has joined #RubyOnRails
[07:35:22] DEA7TH: has joined #ruby
[07:38:24] DEA7TH: Client Quit
[17:48:39] DEA7TH: has joined #RubyOnRails
[17:48:39] DEA7TH: has joined #ruby

2016-02-19

[03:40:09] DEA7TH: has joined #RubyOnRails
[03:40:09] DEA7TH: has joined #ruby
[04:04:04] DEA7TH: How can I extract a reusable component from my application (ideally publish as a gem), if it uses a DB table and has views? I don't want people to be stuck with my exact tables / views.
[04:04:41] DEA7TH: But writing generators which simply place my code in your code doesn't sound right either.
[04:05:41] DEA7TH: yellow5: will look it up
[04:06:37] DEA7TH: sounds awesome! :)
[04:23:40] DEA7TH: strass|away: Whenever? https://github.com/javan/whenever
[04:23:47] DEA7TH: haven't used it myself yet though
[04:25:06] DEA7TH: strongcode: that was supposed to be for you ^
[04:25:39] DEA7TH: str - a very common nickname prefix for a prefix of that length :D
[05:03:39] DEA7TH: Does Spree or anything else offer support for keeping track of expenses (one-time and periodic e.g. weekly) - CRUD and then list expenses for a period of time? Just curious.
[05:04:37] DEA7TH: accounting*
[05:08:36] DEA7TH: arup_r: how do you mean, for expenses?
[05:11:01] DEA7TH: it's for a company - they need to keep track of their income. Expenses are things like gas prices (since they offer deliveries), employee wages and so on.
[05:11:08] DEA7TH: rent also
[05:12:23] DEA7TH: yeah I'm surprised it doesn't also include that as an option
[05:13:19] DEA7TH: I'm asking because I already did it for my app (should've looked for a gem for it, oh well) and am now wondering if I can make that as a gem
[08:51:29] DEA7TH: Ping timeout: 240 seconds
[12:26:45] DEA7TH: Quit: DEA7TH
[17:06:47] DEA7TH: has joined #RubyOnRails
[17:06:47] DEA7TH: has joined #ruby

2016-02-18

[06:39:32] DEA7TH: has joined #RubyOnRails
[06:46:39] DEA7TH: Quit: DEA7TH
[11:51:59] DEA7TH: has joined #RubyOnRails
[11:51:59] DEA7TH: has joined #ruby
[20:28:22] DEA7TH: Quit: DEA7TH