Page 1 of 10 | Next »
[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?
[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: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:21:05] DEA7TH: Now it stopped appearing. But I've restarted the server multiple times previously.
[04:25:08] DEA7TH: I'll just remove the require and the bug will probably go away, but I'll paste it anyway
[04:26:34] DEA7TH: it never caused problems before (and there weren't problems with unknown causes, that's how I'm sure)
[04:32:16] DEA7TH: I'll probably use a decorator instead, because the function call syntax is awful and a tiny bit less safe
[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:23:30] DEA7TH: I tested it by including puts("end of controller") at the end of the controller and ran the page
[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:48:19] DEA7TH: the problem was that I needed to first check the size/count, then use the record. load solved it
[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).trip_items
[06:54:54] DEA7TH: arup_r: that returns an array of Trips. Afterwards, using .trip_items does 2 queries
[06:56:08] DEA7TH: Trip.joins(:trip_items).includes(:trip_items).where(completed: true).select('trip_items.*').trip_items
[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:25:31] DEA7TH: I got the idea from here: http://guides.rubyonrails.org/active_record_querying.html
[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.
[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.
[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
[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.
[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: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: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