ericboehs

Activity Graph

Page 1 of 1

2019-03-26

[14:56:21] ericboehs: Read error: Connection reset by peer

2019-03-21

[22:59:20] ericboehs: Read error: Connection reset by peer
[22:59:32] ericboehs: has joined #RubyOnRails
[22:59:38] ericboehs: has joined #ruby

2019-03-12

[09:23:51] ericboehs: Read error: Connection reset by peer
[09:24:19] ericboehs: has joined #RubyOnRails
[09:24:25] ericboehs: has joined #ruby

2019-02-28

[23:20:37] ericboehs: has joined #ruby
[23:20:37] ericboehs: has joined #RubyOnRails

2019-02-26

[09:30:05] ericboehs: Ping timeout: 245 seconds

2019-02-21

[16:01:34] ericboehs: Read error: Connection reset by peer
[16:26:10] ericboehs: has joined #ruby
[16:26:10] ericboehs: has joined #RubyOnRails
[19:11:55] ericboehs: Quit: WeeChat 2.3
[19:12:16] ericboehs: has joined #ruby
[19:12:16] ericboehs: has joined #RubyOnRails

2019-02-08

[20:55:18] ericboehs: Quit: WeeChat 2.3
[20:57:42] ericboehs: has joined #RubyOnRails
[20:57:43] ericboehs: has joined #ruby

2019-02-05

[00:59:38] ericboehs: Ping timeout: 244 seconds
[01:04:08] ericboehs: has joined #RubyOnRails
[01:04:14] ericboehs: has joined #ruby
[01:45:26] ericboehs: Ping timeout: 240 seconds
[03:10:04] ericboehs: has joined #RubyOnRails
[03:10:10] ericboehs: has joined #ruby
[03:27:16] ericboehs: Read error: Connection reset by peer
[03:27:42] ericboehs: has joined #RubyOnRails
[03:27:48] ericboehs: has joined #ruby
[04:18:00] ericboehs: Ping timeout: 246 seconds
[04:19:21] ericboehs: has joined #RubyOnRails
[04:19:27] ericboehs: has joined #ruby
[07:24:14] ericboehs: Read error: Connection reset by peer
[07:25:01] ericboehs: has joined #RubyOnRails
[07:25:07] ericboehs: has joined #ruby

2019-01-31

[07:51:47] ericboehs: Ping timeout: 240 seconds
[08:23:27] ericboehs: has joined #RubyOnRails
[08:23:33] ericboehs: has joined #ruby

2019-01-30

[23:55:09] ericboehs: Quit: Textual IRC Client: www.textualapp.com
[23:55:30] ericboehs: has joined #ruby
[23:55:30] ericboehs: has joined #RubyOnRails

2019-01-18

[16:27:47] ericboehs: Quit: Textual IRC Client: www.textualapp.com
[16:30:19] ericboehs: has joined #ruby
[16:30:43] ericboehs: has joined #RubyOnRails

2019-01-13

[00:27:00] ericboehs: has joined #ruby
[00:27:30] ericboehs: has joined #RubyOnRails

2018-07-05

[18:08:14] ericboehs: Quit: Textual IRC Client: www.textualapp.com

2018-06-30

[00:23:20] ericboehs: Read error: Connection reset by peer
[00:23:26] ericboehs: has joined #RubyOnRails

2018-06-27

[16:45:32] ericboehs: has joined #RubyOnRails

2014-06-11

[20:48:57] ericboehs: I'm getting a "no implicit conversion of Hash into String" when doing setting `my_model.my_key = 'asdf'` and I have `store :settings, :my_key, coder: JSON` in MyModel. (I have a settings json attribute in pg). Google is coming up blank. Anyone familiar with using JSON data types in Rails 4.1?
[20:50:56] ericboehs: I tracked down the code in Rails and it believe it's doing a JSON.load({my_key: 'asdf'}) (which woudl yield that error)
[21:35:59] ericboehs: Is there a clever way to make an object that responds to any method with the output of the first argument? Here's a crappy example using Struct: `Struct.new(:noop){ def load s; s end; def dump s; s end }.new.load {foo: 'bar'}`
[21:37:18] ericboehs: Yeah but I also want to define the class on the fly
[21:40:09] ericboehs: DouweM: Doh. Of course! That's perfect
[21:40:21] ericboehs: Why do I need it? Rails...
[21:41:19] ericboehs: DouweM: Using a JSON data store in postgres
[21:41:41] ericboehs: Either Rails' json coder support is broke or I'm not using it right
[21:43:34] ericboehs: I have a pg column type of json on a "service_keys". In my model I'm doing `store :service_keys, accessors: [:rdio_key], coder: JSON` and rails tries to JSON.load on a hash
[21:43:52] ericboehs: Sigma00: nty :P

2013-08-22

[02:27:38] ericboehs: I have two relations I want to join but still do associated relation calls on them. Example: I want user.messages to be user.sent_messages + user.received_messages but I want to be able to call user.messages.tags to see an aggregate set of tags on both sent and received messages).
[02:30:11] ericboehs: How do you add scopes together?
[02:31:11] ericboehs: I'm familiar with user.sent_messages + user.received_messages but that gets the resulting arrays and adds them together. The result is a ruby array not an AR scope.
[02:32:10] ericboehs: I'm wanting to override the conditions that rails uses for setting up the has_many association. I know you can do has_many :messages, ->(u) { ... } but when I do that it still runs it's normal has many conditions of messages.user_id = $1
[02:40:06] ericboehs: optobear: Actually received_messages come through a message_recipients class (has_many through) while sent messages are just the creator of the message (message.user)
[02:40:47] ericboehs: (In my case a message could have multiple recipients)
[02:40:59] ericboehs: You should see what I've came up with.. it's pretty.. nasty
[02:45:15] ericboehs: https://gist.github.com/ericboehs/d94b79a17380e929adb8 Still doesn't quite do what I want.
[02:45:35] ericboehs: If I could just remove the "messages"."user_id" = $1 AND part
[02:47:08] ericboehs: My code's a little gnarley
[02:54:20] ericboehs: Yeah.. it's hard to judge w/ seeing the actual models :D
[03:12:23] ericboehs: Well I got it but it was ugly, and was essentially deinging a method instead of a has_many (see: https://gist.github.com/ericboehs/d94b79a17380e929adb8) (Batons are my messages)
[03:13:35] ericboehs: Haha thanks :)

2013-07-29

[01:02:59] ericboehs: I'm looking to have Guest users persisted to db using STI. I have a type column of 'Guest' or 'User'. When a user registers I just want to update the existing record and change the type from Guest to User.
[01:05:05] ericboehs: I'm using devise. Which calls User.new. I was wanting to override initialize or add an after_initialize hook to do a Guest.find_by(email: attributes['email']) but I run into problems with AR thinking the record is a new record and throwing validation errors (uniqueness on email) rather than thinking it's an existing record and not conflicting on save. It'd be nice if I could do self = guest_record.
[01:05:59] ericboehs: Radar: Haha. Okay I did after_initialize. But this scenario is a bit unique so I'm trying not to limit my options.
[01:10:20] ericboehs: I was doing this but it's not working (it still thinks it's a new object and validates against the db for uniqueness): https://gist.github.com/ericboehs/6101566
[01:17:03] ericboehs: Radar: Not sure...
[01:18:30] ericboehs: Haha.. I guess it's because I don't want there to be a user to conflict with with devise tries to create it.. but I'm jumping through enough hoops to make this work right for devise.. It may be easier as a boolean field.
[02:18:46] ericboehs: Well Radar.. I overrode the AR initialzier and got it working: https://gist.github.com/ericboehs/6101566 .. but I'm not happy w/ it. Like I say in the gist, I think it should be a before_validate callback.
[02:20:31] ericboehs: I'm trying to move it to a before_validation callback.
[02:21:04] ericboehs: I don't want to have a bunch of conditionals for my validations: unless: :guest?
[02:22:44] ericboehs: In Railscast 393 he shows how to do it with a boolean. Then in 394 he shows how to do it with STI.
[02:30:17] ericboehs: Radar: I've updated it further to be a before_validation call: https://gist.github.com/ericboehs/6101566 It's still STI, but I like its application here.
[02:32:07] ericboehs: Radar: Oh nice! I googled it and SO just said to set type to the class I wanted. I like becomes much better. THanks
[02:38:02] ericboehs: Looks like I can just set the instance variable directly with @new_record = false. Don't have to make it complicated :D
[02:38:15] ericboehs: jamuraa: Do you define account_update yourself?
[02:38:26] ericboehs: jamuraa: :+1:
[02:49:59] ericboehs: Hmm looks like becomes(User) didn't set the object's type to 'User'. Once saved the type is still 'Guest'. ¯\_(ツ)_/¯
[02:54:50] ericboehs: Radar: I did. I also tried self.becomes User and self.becomes! User.
[02:56:00] ericboehs: Thanks for the help.
[03:00:53] ericboehs: Bah. Now I'm having has_many through problems.
[03:01:32] ericboehs: I have a user that has many books through book memberships. But when I do @user.books.build it returns a book object with a nil user_id.
[03:02:43] ericboehs: "status".pluralize # => "statuses"
[03:04:52] ericboehs: I think I figured out my problem too..
[03:06:12] ericboehs: Mine was.. a book can have a sender. And in this scenario the user was sending the book. So I just needed to user.sent_books.build

2012-10-08

[04:33:13] ericboehs: Anyway to do joins('projects.unscoped') or something like it. Trying to refrain from making a projects_unscoped relation.
[04:33:38] ericboehs: Just don't like the extra scopes.
[04:33:41] ericboehs: err relations
[04:34:19] ericboehs: I have a condition on my has_many :projects association. But I'd like to do a join w/o the condition.
[04:34:59] ericboehs: :/ Guess that's what I'll do. haha
[04:38:25] ericboehs: :/ I guess it's fine. Just didn't want to create an association just for one query
[04:39:18] ericboehs: Alright I got one for you. How can I assign a date to Inifinity? :P
[04:39:42] ericboehs: err Inifinity to a date column
[04:39:59] ericboehs: I mispelled Infinity twice. Amazing.
[04:40:21] ericboehs: With AR the only way I can figure out is to use a datetime column and assign it to 1.0/0.0
[04:40:31] ericboehs: but I really don't need a datetime here.
[04:41:59] ericboehs: I mean Infinity :P
[04:42:12] ericboehs: In postgresql you can set date columns to Inifinity
[04:43:04] ericboehs: I'm sure under the covers they are picking some ridicioulously large date.. But I found out it goes to at least the year 20120 when I accediently ran a query between 2012-10-08 and 20120-10-09
[04:43:07] ericboehs: It only took 5 seconds :D
[04:49:19] ericboehs: So I completely rewrote a huge part of our app this weekend. Now I'm going to run the tests.
[04:53:39] ericboehs: We're working on building better test suites. This project had a tighter budget then originally thought it would have.
[04:53:55] ericboehs: Our next project has about 4x the budget it needs but "they need to spend the money" ... lol
[04:54:22] ericboehs: It's a reservation system. The way were doing listing availability was an atrocity.
[04:54:35] ericboehs: https://gist.github.com/3850427
[04:55:10] ericboehs: I work in SQL and then try to AREL/AR/Squeelify it. But I haven't got that far yet.
[04:56:20] ericboehs: 24 files changed, 283 insertions(+), 550 deletions(-) -- I really thought it'd be more than that.
[05:01:33] ericboehs: Well only 23 failing tests out of 150+
[05:01:44] ericboehs: And all of them are expected.. I still have more refactoring to do.
[05:05:56] ericboehs: Love weechat + tmux
[05:07:07] ericboehs: Yeah I hopped out of the other.. :/
[06:02:50] ericboehs: Hmm.. How can I add a calculated column to my SQL results. I'm trying select('listings.*, avg(listings_rate.rates) as listings.day_rate but it's giving invalid syntax. If I drop the "listings." part it doesn't error but I don't see they day_rate in the results.
[06:03:57] ericboehs: It's point at the . before day_rate
[06:04:31] ericboehs: Hmm when I call .map(:&day_rate) on the result I get my values. I guess it just doesn't appear...
[06:04:35] ericboehs: haha I know right/
[06:40:17] ericboehs: RubyPanther: Yeah. DateTime works though. They just need to fix it for Dates. There's a ticket open for it.
[06:53:18] ericboehs: I hate when I fix something that feels substantial and it only fixes one test. .. BLARG