peteyg

Activity Graph

Page 1 of 2 | Next »

2016-03-08

[07:32:54] peteyg: Ping timeout: 276 seconds
[07:40:24] peteyg: has joined #ruby
[19:36:39] peteyg: Ping timeout: 244 seconds

2016-03-07

[00:09:46] peteyg: Ping timeout: 252 seconds
[03:24:06] peteyg: has joined #ruby

2016-03-06

[20:49:34] peteyg: Ping timeout: 252 seconds
[21:12:54] peteyg: has joined #ruby

2016-03-01

[04:02:50] peteyg: has joined #ruby

2016-02-29

[01:00:47] peteyg: has joined #ruby
[01:14:12] peteyg: Ping timeout: 260 seconds
[01:30:34] peteyg: has joined #ruby
[01:41:23] peteyg: Ping timeout: 248 seconds
[03:42:30] peteyg: has joined #ruby
[04:19:06] peteyg: Ping timeout: 268 seconds
[04:21:21] peteyg: has joined #ruby
[04:28:19] peteyg: Ping timeout: 248 seconds
[05:00:22] peteyg: has joined #ruby
[10:54:27] peteyg: Ping timeout: 276 seconds

2016-02-28

[00:52:22] peteyg: Ping timeout: 260 seconds
[00:58:41] peteyg: has joined #ruby
[07:53:21] peteyg: Ping timeout: 276 seconds
[08:23:12] peteyg: has joined #ruby
[11:20:04] peteyg: Ping timeout: 248 seconds
[17:40:54] peteyg: has joined #ruby
[19:21:59] peteyg: Ping timeout: 268 seconds
[19:52:01] peteyg: has joined #ruby
[23:07:02] peteyg: Ping timeout: 260 seconds

2016-02-27

[08:11:16] peteyg: Ping timeout: 264 seconds
[20:18:34] peteyg: has joined #ruby
[22:19:18] peteyg: has joined #ruby

2016-02-26

[17:20:48] peteyg: *.net *.split
[23:34:59] peteyg: has joined #ruby

2016-02-16

[23:38:40] peteyg: *.net *.split

2016-02-15

[07:03:43] peteyg: *.net *.split
[07:03:58] peteyg: has joined #ruby
[22:28:50] peteyg: Read error: Connection reset by peer
[22:28:58] peteyg: has joined #ruby

2016-01-31

[12:25:01] peteyg: *.net *.split
[12:28:14] peteyg: has joined #ruby

2016-01-29

[18:44:28] peteyg: Read error: Connection reset by peer
[18:47:37] peteyg: has joined #ruby

2016-01-26

[12:02:59] peteyg: Read error: Connection reset by peer
[12:03:14] peteyg: has joined #ruby

2016-01-25

[11:13:48] peteyg: has joined #ruby

2016-01-20

[12:56:46] peteyg: Read error: Connection reset by peer
[12:56:55] peteyg: has joined #ruby
[13:56:05] peteyg: *.net *.split

2016-01-18

[01:12:15] peteyg: Read error: Connection reset by peer
[01:12:51] peteyg: has joined #ruby
[01:14:20] peteyg: Read error: Connection reset by peer
[01:19:22] peteyg: has joined #ruby
[01:21:20] peteyg: Read error: Connection reset by peer
[01:24:24] peteyg: has joined #ruby

2016-01-17

[13:34:15] peteyg: Read error: Connection reset by peer
[13:34:56] peteyg: has joined #ruby
[13:36:47] peteyg: Read error: Connection reset by peer
[13:39:52] peteyg: has joined #ruby
[13:40:45] peteyg: Read error: Connection reset by peer
[13:44:52] peteyg: has joined #ruby
[13:47:16] peteyg: Read error: Connection reset by peer
[13:49:53] peteyg: has joined #ruby
[14:06:54] peteyg: Read error: Connection reset by peer
[14:07:06] peteyg: has joined #ruby
[14:09:08] peteyg: Read error: Connection reset by peer
[14:12:05] peteyg: has joined #ruby
[14:15:23] peteyg: Read error: Connection reset by peer
[14:17:05] peteyg: has joined #ruby
[23:08:28] peteyg: Read error: Connection reset by peer
[23:09:19] peteyg: has joined #ruby

2016-01-07

[09:35:21] peteyg: has joined #ruby
[15:35:05] peteyg: Read error: Connection reset by peer
[19:28:47] peteyg: has joined #ruby

2016-01-02

[00:01:18] peteyg: Ping timeout: 240 seconds

2015-12-24

[16:58:11] peteyg: Ping timeout: 276 seconds
[17:00:01] peteyg: has joined #ruby

2015-12-21

[10:03:19] peteyg: has joined #ruby

2015-12-19

[17:33:30] peteyg: Ping timeout: 272 seconds

2015-12-12

[10:11:01] peteyg: Ping timeout: 240 seconds
[10:11:45] peteyg: has joined #ruby
[10:18:39] peteyg: Ping timeout: 240 seconds
[10:21:00] peteyg: has joined #ruby

2015-12-10

[12:56:12] peteyg: Ping timeout: 250 seconds
[22:14:22] peteyg: has joined #ruby

2015-12-02

[15:35:24] peteyg: *.net *.split
[15:41:31] peteyg: has joined #ruby
[15:52:36] peteyg: *.net *.split
[16:47:46] peteyg: has joined #ruby

2015-12-01

[00:16:10] peteyg: has joined #ruby
[05:26:32] peteyg: Quit: leaving
[05:28:23] peteyg: has joined #ruby

2015-11-29

[14:57:50] peteyg: Ping timeout: 240 seconds

2015-11-26

[07:24:31] peteyg: has joined #ruby
[09:33:53] peteyg: Ping timeout: 264 seconds
[18:56:31] peteyg: has joined #ruby

2015-11-19

[02:23:43] peteyg: Ping timeout: 250 seconds

2015-11-16

[22:57:32] peteyg: has joined #ruby

2015-11-14

[10:20:35] peteyg: Ping timeout: 252 seconds

2015-11-07

[19:13:04] peteyg: has joined #ruby
[19:24:07] peteyg: Quit: leaving
[22:52:27] peteyg: has joined #ruby

2015-10-07

[19:47:10] peteyg: Ping timeout: 240 seconds

2015-09-23

[21:09:47] peteyg: has joined #RubyOnRails
[21:12:58] peteyg: Is there a way to get the underlying field value if there's a method shadowing it? e.g. http://pastie.org/10440421
[21:14:57] peteyg: smathy: Don't do the shadowing in the first place, or don't attempt to get the underlying value?
[21:17:47] peteyg: smathy: Sure, that was just an example--but why even _have_ that field if I can't get at its value (safely)?
[21:18:45] peteyg: smathy: Yeah, not my code base, just scratching my head on why this is done.
[21:19:24] peteyg: tubbo: It's not. It's "ShippingMethod"
[21:21:36] peteyg: Yeah, makes sense. Also, ShippingMethod.first[:name] doesn't seem to behave as expected. It returns nil (and I'm sure there _is_ a value in the field)
[21:22:29] peteyg: Calling ShippingMethod.first along returns an instance where :name => "Value".
[21:22:35] peteyg: smathy: ^
[21:22:42] peteyg: s/along/alone
[21:25:31] peteyg: smathy: ShippingMethod.first.attributes returns 'nil' for the :name field.
[21:25:46] peteyg: Yes, but... why?
[21:27:02] peteyg: Rails 4.2.0. As for code, it's as I pastied (that's the crux of the model, anyways)
[21:28:55] peteyg: smathy: 2.2.1
[21:30:21] peteyg: smathy: Yes. So, ShippingMethod.first, it returns :name => "Value" as output. ShippingMethod.first.attributes returns "name" => "Value"
[21:32:50] peteyg: smathy: Here's exactly what I see for the output: http://pastie.org/10440454
[21:33:02] peteyg: Sorry if I was confusing earlier, but that pastie is the canonical output
[21:33:16] peteyg: Oops, typo'd in there...
[21:33:38] peteyg: smathy: http://pastie.org/10440456
[21:49:45] peteyg: smathy: Oh yeah, forgot to mention, we're using Pry, which is probably formatting it differently than vanilla IRB output...

2015-08-29

[20:44:49] peteyg: Ping timeout: 244 seconds

2015-08-11

[18:19:26] peteyg: Why is it that when saving the value "true" to a string field, the value is serialized to "1", but after migrating that column to text, saving "true" value to that field becomes a singular char "t"?
[21:22:28] peteyg: Why is it that when saving the value "true" to a string field, the value is serialized to "1", but saving "true" value to a text field becomes a singular char "t"? (MySQL)
[21:36:27] peteyg: @Radar: Sure. Let me create a pastie to illustrate the point.
[21:42:07] peteyg: @Radar: http://pastie.org/10344867
[21:46:29] peteyg: Radar: By the way, by "reproduce", you're implying this is a bug--I'm not so sure (though it can be). I'm just curious why the behaviour is there in the first place.
[21:47:59] peteyg: tubbo: Yeah, it's definitely an AR and not a MySQL issue, since in my Pastie you noticed I haven't even committed to DB yet (I called `.new`, not `.create`)
[21:48:21] peteyg: Pretty annoying, but I'll deal with...
[21:51:05] peteyg: tubbo: Also, this is probably different from Postgres's boolean column--I understand the Boolean column returning "1". The issue here is that String column returns "1" while Text returns "t" (my naive assumption was that they are both text-ish columns so would return the same output. I don't care if it's "t" or "1" so long as it's consistent between the two; clearly not the case)

2015-08-02

[19:10:52] peteyg: *.net *.split
[19:11:09] peteyg: has joined #RubyOnRails
[19:11:09] peteyg: has joined #ruby

2015-06-20

[20:15:02] peteyg: *.net *.split
[21:00:30] peteyg: has joined #RubyOnRails
[21:00:30] peteyg: has joined #ruby

2015-06-01

[01:44:54] peteyg: has joined #RubyOnRails
[01:44:54] peteyg: has joined #ruby
[01:45:04] peteyg: Read error: Connection reset by peer

2015-05-09

[21:23:38] peteyg: How would I write a join such that I select only models where at least one nested has_many association _does_ exist? Pseudocode: http://pastie.org/private/qg01zbmjfpz5vwz6k1nxpa
[21:23:57] peteyg: _does not_*

2015-05-01

[22:51:24] peteyg: Is there a way to early exist a Transaction block while committing any changes that have already occurred along the way?
[22:53:16] peteyg: Here's an example of what I'd like to do: http://pastie.org/10124369
[22:56:28] peteyg: baweaver: What do you mean?
[22:57:55] peteyg: baweaver: Ah, are you saying return a block that performs the action which would have occurred prior to the commit?
[22:59:50] peteyg: baweaver: Yeah, I get you...
[23:00:50] peteyg: So in other words there isn't a built-in way to commit a transaction manually, right?
[23:01:53] peteyg: baweaver: Ah, just found it. Pretty low-level and definitely not a public API, but: "ActiveRecord::Base.connection.commit_db_transaction"

2015-04-23

[03:47:56] peteyg: Does calling Thread.new { GC.start() }.join behave as expected (namely, trigger the global GC in a separate thread--though I understand the benefits are limited due to Ruby's GIL)?

2015-03-20

[00:50:24] peteyg: Is there a way to preload a bunch of records and then query for models with a specific property value without making another round trip to the db?
[00:51:18] peteyg: e.g. heroes = MyHero.where(:good_guys => true); heroes.where(:name => 'Bob'); #except the second portion of this line will still make another network/db call. Anyway to avoid that?

2015-03-12

[20:29:19] peteyg: Is there a way to get the diff between two ActiveRecord Relations object? (e.g. one has [Model1, Model2], and the other [Model1, Model3]. I'd like to find that [Model3] is the diff)

2015-03-03

[19:33:15] peteyg: In a migration, can I specify multiple columns that I'd like to add an index to as: "add_index :table_name, [:column1, :column2, etc]"?

2015-02-25

[18:44:00] peteyg: When given a UTC timestamp (e.g. "2015-02-25T18:00:00Z") and also a Timezone offset (e.g. "-0800"), what a method in Ruby to get the time in the TZ provided (I'd like "2015-02-25T10:00:00-0800" as the output)?
[18:44:27] peteyg: I'm using the standard Time class and no ActiveSupport, I should add.
[18:46:56] peteyg: @arup_r Do you care about holidays? Or just weekdays proper?
[18:47:43] peteyg: arup_r: then something like this will solve your problem: http://stackoverflow.com/a/10979698
[19:19:45] peteyg: arup_r: Your solution will only work if you wrap past ONE weekend.
[19:19:52] peteyg: arup_r: Unless that's all you care about, then I guess it's fine.
[19:25:17] peteyg: arup_r: Think about it. What if you put in start as "Time.now" and n as 21?
[19:26:08] peteyg: arup_r: If you have n as anything bigger than 14, you're going to miss out on extra days because you hard coded the constant "3" day lookahead.
[19:26:36] peteyg: arup_r: Instead you should be doing something like "(n % 7) * 3"
[19:26:45] peteyg: That way you'll lookahead 3 days for every weekend you encounter
[19:27:09] peteyg: "(n / 7) * 3" <- sorry, typo. Not mod (%), should be divide (/)
[19:28:49] peteyg: arup_r: That was incorrect, use this for the correct result: "(3/7.0).ceil * 3"

2014-12-01

[19:09:26] peteyg: Is there a way to tell Ruby execute a certain block of code for x amount of time? Semantically, I want to do something like: "Execute { block } for 5000 milliseconds. If it did not return in that time, throw Timeout error."
[19:11:07] peteyg: What's the difference between this channel and ruby-lang?
[19:11:22] peteyg: bulters: Oh :(
[19:12:23] peteyg: Huh, interesting.
[19:12:45] peteyg: So I should lurk in both channels to get maximum ruby exposure :P?
[19:13:46] peteyg: Hahaha :P
[19:14:04] peteyg: shevy: Why can't you register?
[19:15:15] peteyg: Wow, 3.times.to_a? Dang, that's a thing? Learned something new today...

2014-11-15

[03:23:59] peteyg: Is there a way to monkey patch a function so that it will automatically invoke another function prior to itself?
[03:24:25] peteyg: Basically for debugging purposes, I want to count how many times a function is called, so I want it to trigger another function which simply adds to a global counter

2014-10-20

[05:33:47] peteyg: Hey guys, I'm running into an odd model validation issue, demonstration code is here: http://pastie.org/private/5aabnr4fn8tiybupf8l3lqoeinrsitnirstnirsntiesrtientsrientiresntiersntirsntirsntintirsntiesrntirsntirsntirsntiresntir

2014-10-13

[22:11:52] peteyg: I have the following field validator for one of my models: "validates_format_of :link, with: /\A[A-Za-z0-9-]+\z/" -- However, for whatever reason, the "link" field cannot end with a number. It throws a validation error. However, if I use that exact same Regex matcher and use Ruby's built in =~ regex comparison, it returns a match perfectly fine. What gives?
[22:58:42] peteyg: Hey guys, I'm running into an odd model validation issue, demonstration code is here: http://pastie.org/private/5aabnr4fn8tiybupf8l3lq

2014-09-29

[23:27:05] peteyg: I have a model "Ticket", which belongs to another model "Order", which in turn belongs to a "User" model. How can I express the following "Ticket.where(order.date => 1.weeks.ago, user.status => :confirmed)"?
[23:35:00] peteyg: webdestroya: Odd, the joins(:user, :order) didn't work with the exception "Association named 'user' was not found on Ticket; perhaps you misspelled it?" User does "has_many :tickets, :through => :orders" though...
[23:36:41] peteyg: Ticket has belongs_to :order
[23:40:36] peteyg: webdestroya: Thanks! That worked. But for my own learning purposes, where in the docs can I read up on this kind of query construction/relations related stuff?
[23:43:14] peteyg: thanks :)

2013-05-06

[19:00:22] peteyg: Is there any reason why before_update and after_update are deprecated callbacks? What else should I use instead?
[19:04:35] peteyg: scyllinice: In a model, I have after_update: :after_update_function defined at the top. Then def after_update_function in the body of the model.
[19:05:08] peteyg: scyllinice: Ah, I see. So I'm doing it right, so long as I don't override the base before_update function

2013-04-14

[18:55:16] peteyg: @dimaursu16: You need a authenticity token when using PUT requests. It's to prevent CSRF vulnerabilities
[18:59:50] peteyg: dimaursu16: Also, are yountrying to render that JS from a view or something? Because "#{variable}" syntax isn't valid in JavaScript
[19:06:25] peteyg: dimaursu16: If you want to render Ruby values into a view, you need to use <%= variable %>, NOT what you're doing
[19:10:22] peteyg: dimaursu16: Np. You can obtain the authenticity_token via form_authenticity_token in the view.

2013-04-12

2013-04-11

[18:52:11] peteyg: I'm using a link_to helper to perform a :method => :put action, however I'm running into an issue where the user is logged out, presumably because the authentication token to prevent CSRF isn't being sent properly. How do I figure this out if the helper doesn't account for this stuff automagically?
[18:53:33] peteyg: pipework: Yes, I'm also using the :remote => true option to make it a AJAX put request
[18:54:24] peteyg: pipework: So use a form submit helper?
[18:54:47] peteyg: pipework: Ok, I'll give it a try. Thanks.

2013-04-05

2013-04-04

[23:41:43] peteyg: How would I simulate a https call in rails console? Using app.get gives me 'You must use HTTPS to perform this operation" :(
[23:43:25] peteyg: How would I simulate a https call in rails console? Using app.get gives me 'You must use HTTPS to perform this operation" :(
[23:55:58] peteyg: pipework: By simulate, I'm using app.get '/path/' in rails console
[23:56:23] peteyg: pipework: That's the main Rails app.

2013-04-01

[00:24:30] peteyg: What's the Ruby 1.8.7 equivalent/alternative of URI::encode_www_form?
[00:24:50] peteyg: Oops, this isn't Rails specific (I know there's .to_query in Rails)
[00:35:14] peteyg: zeroeth: Yes, but what I was asking was for Ruby 1.8.7's equivalent. URI::encode_www_form exists for Ruby 1.9.x but not 1.8.7 :(
[00:35:42] peteyg: zeroeth: That doc link you sent me simply confirmed that such a method does not exist for URI lib in 1.8.7

2013-03-31

[17:50:15] peteyg: Is there a way to check what ENV vars a currently running rails app is configured with from bash?
[17:55:43] peteyg: peteyg: Yeah, that's what I was trying to avoid... Hmm
[17:56:12] peteyg: shock_one: On another note, do you have any idea how to check where ENV vars are set? (Linux n00b here, sorry)

2013-03-19

[06:16:09] peteyg: Heys guys, is flash implemented as a cookie that gets consumed on the next page load?
[06:16:25] peteyg: (except when flash.keep is explicitly called?)
[06:17:25] peteyg: sevenseacat & tigris_: Okay, thanks. The docs doesn't seem to state if its session based, but that makes sense.
[06:18:09] peteyg: So I'm running into an interesint issue of flash not working under IE10. It works for FF/Chrome/Opera...
[06:18:43] peteyg: Any variable that I store in flash[:var] = "something I want to keep" does not propogate to the next action... O.o
[06:20:35] peteyg: sevenseacat: One sec, let me ply it down to the basics and gist it.

2013-03-11

[17:52:34] peteyg: Is there a helper function like {}.to_query, except it filters out any key with a nil value? i.e. {a:nil, b: 1}.filter_query would return "b=1" instead of to_query's "a=&b=1"?
[17:56:26] peteyg: Gowie & Radar: Cool, good point :).

2013-03-05

[22:52:36] peteyg: When I get an "Error: A partial is missing." error on the browser side, how come there's nothing in the logs that tells me which partial is missing and/or which partial it attempted to render? Is there any way to have the log contain such info to ease debugging?

2013-02-22

[18:17:59] peteyg: For migrations, is it recommended to use up/down or change?

2013-02-13

[00:00:14] peteyg: pipework: Both :)?

2013-02-11

[18:29:26] peteyg: Y_Ichiro_: For Rails?
[18:29:55] peteyg: Y_Ichiro_: Where do you see the advisories :O?
[18:34:43] peteyg: Y_Ichiro_: Roger :). Thanks

2013-02-08

[01:50:25] peteyg: mparodi: You can't add columns to models... What you've done was probably specify a few class variables, which is not the same thing.

2013-02-07

[00:39:08] peteyg: Following this doc: http://api.rubyonrails.org/classes/ActiveModel/Dirty.html I added the line "define_attribute_methods [:status]" to my model class, but I'm getting a runtime error "ArgumentError: wrong number of arguments (1 for 0) `define_attribute_methods'" Any ideas?
[00:48:43] peteyg: Bumping my previous question: Following this doc: http://api.rubyonrails.org/classes/ActiveModel/Dirty.html I added the line "define_attribute_methods [:status]" to my model class, but I'm getting a runtime error "ArgumentError: wrong number of arguments (1 for 0) `define_attribute_methods'" Any ideas?
[01:06:18] peteyg: waseem_: Thanks, but I got around that problem by using changed_attributes instead to track model dirtiness :).

2013-02-04

[19:12:31] peteyg: elaptics: Man, this makes using things like jquery-ui a complete pain in the butt if I have to change all instance of 'images/<images.png>' in that CSS file. Is this really the expected behaviour?
[19:16:01] peteyg: tubbo: Sucks :(.
[19:25:45] peteyg: elaptics: Ah, so if the directory is not images/, then it does get added to public/assets/ ?
[19:26:12] peteyg: tubbo: Not my choice to use jquery-ui or not ;). I'm just the code monkey patching code someone else wrote :P.
[19:27:03] peteyg: tubbo: And no, not using the gem to handle it. Though I suppose the gem version figures all that out for us, huh?
[19:27:26] peteyg: elaptics: Got it, good to know. I guess this is what some refer to as the 'black magic' of Rails that can be so confusing sometimes :).
[19:27:45] peteyg: elaptics: Lol, jesus
[19:29:38] peteyg: tubbo: Yeah, might as well just use that... Oh dear
[19:30:52] peteyg: elaptics: Hmm, ok. I see. I am using jquery-rails right now.
[19:31:02] peteyg: Bah, such a pain in the butt ~_~
[21:07:59] peteyg: With Resque, I see tasks being left over in Redis even if they don't fail with a key like: "resque:resque-retry:Queue::Normal:{...*task*...}"
[21:08:08] peteyg: And they just stay there perpetually
[21:08:14] peteyg: What's up with that O.o?
[21:08:44] peteyg: Spaceghost|work: Nope.
[21:09:11] peteyg: end_guy: Uh, the redis instance IS the 'cache'. And I can't exactly just flush the entire DB since it's used by other apps too :S...
[21:10:41] peteyg: Spaceghost|work: Have you worked with Resque? What should be happening? I'm guessing that the task shouldn't be crufting around after being processed, right?
[21:12:13] peteyg: end_guy: At some point in the future, memory will become an issue if they are *never* cleaned up. It's leaving about 10k keys a day behind and it's slowly increasing. But even on a small Amazon EC2 instance there are plenty of RAM so it's not the direst issue, but certainly not optimal...
[21:12:43] peteyg: Spaceghost|work: Yes, I do recall jobs being cleaned up before I installed Resque-Retry... :S
[21:15:31] peteyg: end_guy: No I haven't, but presumably that prunes dead workers, and not resque jobs, or am I wrong :O?
[21:15:56] peteyg: melkor: You're talking about input escaping?
[21:16:35] peteyg: melkor: http://stackoverflow.com/questions/2502360/html-textarea-tag-how-to-correctly-escape-html-and-javascript-content-displa
[21:18:06] peteyg: end_guy: Ah, see, the thing is, it's not a 'stuck' queue. The resque-retry keys are being dumped at the 'top level' (not in a list like Resque queues themselves). At any rate, this looks like a potential bug with Resque-retry, I'll poke around at the gem source
[23:25:03] peteyg: MacVim FTW! (I'd use that if I was using a Mac ;))