StevenXL

Activity Graph

Page 1 of 5 | Next »

2017-03-24

[12:09:24] StevenXL: Quit: Connection closed for inactivity

2016-07-27

[12:35:51] StevenXL: Good morning everyone.
[12:37:03] StevenXL: I am dealing with some legacy code. My former CTO thought it would be a good idea to use a shared examples group in which, within the shared examples, we send a private message to the controller to simulate a request - for example - `send(:http_method, :action, params)
[12:39:24] StevenXL: universa1: I'm not following. I thought that the `send` method was used to invoke a private method on any object.
[12:40:48] StevenXL: universa1: I think I'm following what you are saying. We have one object - it happens to be an instance of a controller - and we are using `send` to invoke a private method on it, correct? Otherwise, there'd be no reason to use `send`.
[12:40:51] StevenXL: Am I missing something?
[12:42:03] StevenXL: OK: Here is a shared example: https://gist.github.com/StevenXL/9c386386f0bd05db1f72547595ff4883
[12:43:16] StevenXL: Here is an example of how we use it: https://gist.github.com/StevenXL/e578fd4f4a770f53683f920ab9f71f1a
[12:43:39] StevenXL: universa1: I see what you are saying yes. My apologies for not being clearer.
[12:44:58] StevenXL: what we're getting at is that, in the first gist, if I put in `binding.pry` and invoke `self`, I'm not going to get a controller I've defined.
[12:45:05] StevenXL: Is that what you are getting at?
[12:45:49] StevenXL: ok thanks, I fully agree with that.
[12:47:23] StevenXL: Yup. I just put in a binding and invoked `self` and got this: `RSpec::ExampleGroups::ApiV2CandidateInvitationsController::PATCHAccept::Behaviors`.
[12:47:30] StevenXL: So I hear what you folks are saying.
[12:48:29] StevenXL: The reason why this was done this way is because we "hand-rolled" a logging system, and we wanted to test that the CreateApiEventJob was invoked whenever we hit certain controllers, regardless of the method, etc.
[12:49:28] StevenXL: What would be the recommended way to set up a shared example group that would test this, without resorting to calling private methods?
[12:50:55] StevenXL: workmad3: Not familiar with that. I'll have to look it up. Maybe it's my ignorance and I'm blaming it on the person that wrote the code.
[12:51:15] StevenXL: workmad3: (Not familiar with dynamic dispatch, I mean).
[12:51:46] StevenXL: universa1: That's the path I would have taken, but I'm a software engineer with <= 6 mths of exp, for what that is worth.
[12:53:22] StevenXL: workmad3: Yes that is true. Only problem with it is that whatever gets written to the database is not being cleaned up. I could try and use an after(:each) block in the shared examples, and have no problem going that route, but I thought I'd try to fix the root problem first.
[12:55:45] StevenXL: workmad3: transactional fixtures is set up in the test database. DatabaseCleaner makes the tests fail because the method called invokes (somewhere down the line) a controller action that needs a record in the db, and DatabaseCleaner cleans up the db too soon.
[12:56:35] StevenXL: workmad3: Yup. In that example when we use the shared example group, we're creating a database record
[12:56:42] StevenXL: workmad3: Yup exactly.
[12:56:58] StevenXL: And we do that because the action called by that controller "needs" that record in the db.
[12:57:10] StevenXL: I tried stubbing it out but couldn't get it to work.
[12:57:32] StevenXL: I'll paste the relevant controller code
[12:58:44] StevenXL: workmad3: Would I then invoke this proc in the shared examples group? (My understanding is that a proc is just an anonymous function).
[12:58:50] StevenXL: Or is that not the right thing?
[12:59:19] StevenXL: Oh I like that!
[12:59:47] StevenXL: and since then the code would run in the example group, hopefully that cleans up the records.
[13:00:26] StevenXL: that is really awesome.
[13:00:38] StevenXL: Can you folks explain to me (or link me) to what you mean by test code is loaded off disk?
[13:00:47] StevenXL: I'm confused as to waht counts as a transaction and what doesnt.
[13:04:01] StevenXL: I see. So that code (the factory girl create) is being run when the test suite is being "built". It doesn't run as an example. The transactional fixtures does a rollback after each example (?), and therefore misses the stuff created outside of an example.
[13:04:58] StevenXL: Wow - that's incredible. Thank you so much for that explanation. I'm learning a lot from this issue.
[13:05:14] StevenXL: Very grateful for your and universa1 help!
[13:27:39] StevenXL: workmad3: I switched from send to public_send, which I think is clearer, and I am sending in a proc to delay the creation of an object. Everything is working great on that one example. Going to try and roll it out to the test.
[21:37:13] StevenXL: folks* what's the current best practice when doing an OR query in Rails 4?
[21:37:17] StevenXL: Is a query string fine?
[21:38:20] StevenXL: tubbo: Thank you.

2016-07-26

[18:56:08] StevenXL: ACTION Hello everyone. I have a question on testing. I have the following code:
[18:56:58] StevenXL: render json: { errors: submission.errors.full_messages }
[18:56:58] StevenXL: render json: submission, serializer: Api::V2::CandidateInvitationSerializer
[18:56:58] StevenXL: if submission.accept(accept_params[:candidate_cover_letter])
[18:56:58] StevenXL: submission = submission_scope.includes(request: :position).first
[18:57:21] StevenXL: I don't really care what happens with this code, so I want to allow submission.accept to return true.
[18:57:24] StevenXL: How would I be able to do that?

2016-07-17

[12:08:35] StevenXL: has joined #RubyOnRails
[12:08:35] StevenXL: Changing host
[12:08:35] StevenXL: has joined #RubyOnRails
[12:08:35] StevenXL: Changing host

2016-07-16

[09:26:52] StevenXL: Ping timeout: 264 seconds
[09:28:41] StevenXL: has joined #RubyOnRails

2016-07-11

[16:51:35] StevenXL: has joined #RubyOnRails
[16:52:10] StevenXL: Hello everyone. I have a quick question. I need to run some JavaScript (CoffeeScript), but only if a certain query parameter was passed into my controller. How can I pass data to the JavaScript?
[16:58:20] StevenXL: jhass: this is a special case in my app
[16:58:43] StevenXL: I'd like to avoid an entire gem if possible, but i'll look at what they do and see if i can hand-rolll it.
[17:00:24] StevenXL: jhass: That gem explains exactly how to do it!
[17:00:25] StevenXL: https://github.com/gazay/gon
[17:03:46] StevenXL: Good call!!!

2016-06-24

[22:59:08] StevenXL: Quit: leaving

2016-06-13

[22:06:14] StevenXL: has joined #ruby
[22:06:14] StevenXL: has joined #RubyOnRails
[22:14:25] StevenXL: Quit: leaving

2016-06-05

[10:53:37] StevenXL: Ping timeout: 260 seconds
[15:54:20] StevenXL: has joined #RubyOnRails
[15:54:20] StevenXL: has joined #ruby
[15:54:20] StevenXL: Changing host

2016-05-11

[19:13:51] StevenXL: Hi everyone. I am using simpleform and need a datepicker. I've searched online for about 10 minutes, but all teh solutions seem to be from 2013.
[19:14:09] StevenXL: I was wondering if there was a standard / best pratice in terms of how to implement a datepicker on the site.
[19:16:11] StevenXL: a1fa: ok thank you.
[19:16:28] StevenXL: a1fa: are you using that with simpleform?
[19:19:42] StevenXL: awesome thansk i'll take a look

2016-05-09

[13:56:20] StevenXL: Hi everyone. I use carrierwave (0.10.0) in my Ruby app. That, in turn uses mini_magick, and mini_magick uses ImageMagick. I have deployed my app to Heroku.
[13:56:40] StevenXL: Do I need to do anything special so as to avoid being vulnerable to the "ImageTragick" bug?
[13:59:28] StevenXL: tildes, thank you. The system does in fact allow user to upload photos for their profile.
[14:03:14] StevenXL: tildes: I haven't looked at the fixes yet. I am looking at it now, and I like the policy fix, but I don't know how to do that to a heroku deploy, and if it will persist when a dyno is restarted.
[15:04:22] StevenXL: tildes, univera1 you guys are right
[15:04:28] StevenXL: Heroku already has the fix.
[15:04:45] StevenXL: https://devcenter.heroku.com/changelog-items/891
[15:05:00] StevenXL: It was not the first link on Google, which to my simple brain that can't look 5 links down means I missed it.

2016-05-02

[15:21:39] StevenXL: Remote host closed the connection
[15:21:40] StevenXL: has joined #ruby
[15:21:40] StevenXL: has joined #RubyOnRails

2016-04-21

[20:44:01] StevenXL: Hi. Does anyone have a good tutorial on how sessions work, that is not the Rails Guides? (I'm collecting a few resources and the Rails Security guide is already on my list - first one I thought of).

2016-04-07

[02:34:15] StevenXL: has joined #RubyOnRails
[03:18:11] StevenXL: has joined #ruby
[15:51:37] StevenXL: Hi guys. I have a rake task that creates a SQL file. I want to turn this on my heroku dyno and then download the file.
[15:51:56] StevenXL: I've had this problem often, and was just wondering if anyone has any recommended solutions.

2016-04-06

[02:45:56] StevenXL: has joined #ruby
[02:46:00] StevenXL: has joined #RubyOnRails
[04:04:27] StevenXL: Ping timeout: 260 seconds
[04:20:22] StevenXL: has joined #ruby
[04:20:22] StevenXL: has joined #RubyOnRails
[04:20:22] StevenXL: Changing host
[04:20:22] StevenXL: has joined #RubyOnRails
[04:20:22] StevenXL: has joined #ruby
[04:25:16] StevenXL: Ping timeout: 268 seconds
[04:40:51] StevenXL: has joined #ruby
[04:40:52] StevenXL: has joined #RubyOnRails
[04:45:23] StevenXL: Ping timeout: 248 seconds
[04:56:15] StevenXL: has joined #RubyOnRails
[04:56:15] StevenXL: has joined #ruby
[05:01:02] StevenXL: Ping timeout: 260 seconds
[05:08:19] StevenXL: has joined #RubyOnRails
[05:08:19] StevenXL: has joined #ruby
[05:13:04] StevenXL: Ping timeout: 260 seconds
[09:00:40] StevenXL: has joined #RubyOnRails
[09:00:40] StevenXL: has joined #ruby
[09:05:16] StevenXL: Ping timeout: 264 seconds
[11:00:55] StevenXL: has joined #ruby
[11:00:56] StevenXL: has joined #RubyOnRails
[11:05:17] StevenXL: Ping timeout: 244 seconds
[12:09:32] StevenXL: has joined #ruby
[12:09:32] StevenXL: has joined #RubyOnRails
[12:09:32] StevenXL: Changing host
[12:09:32] StevenXL: has joined #RubyOnRails
[12:09:32] StevenXL: has joined #ruby
[12:14:33] StevenXL: Ping timeout: 268 seconds

2016-04-05

[00:00:39] StevenXL: has joined #RubyOnRails
[00:00:39] StevenXL: Changing host
[00:00:39] StevenXL: has joined #RubyOnRails
[02:11:41] StevenXL: Quit: leaving
[13:41:24] StevenXL: has joined #RubyOnRails
[15:33:46] StevenXL: /join #thoughtbot
[15:34:01] StevenXL: confused as to how that didn't work
[18:04:48] StevenXL: Ping timeout: 246 seconds
[18:37:58] StevenXL: has joined #RubyOnRails
[22:47:17] StevenXL: Quit: leaving

2016-04-04

[03:19:24] StevenXL: Ping timeout: 246 seconds
[03:40:52] StevenXL: has joined #RubyOnRails
[04:00:27] StevenXL: Quit: leaving
[14:17:51] StevenXL: has joined #RubyOnRails
[14:28:56] StevenXL: Ping timeout: 244 seconds
[14:36:22] StevenXL: has joined #RubyOnRails
[14:36:22] StevenXL: Changing host
[14:36:22] StevenXL: has joined #RubyOnRails
[15:58:50] StevenXL: Ping timeout: 244 seconds
[16:02:31] StevenXL: has joined #RubyOnRails
[16:03:13] StevenXL: (And ladies).
[16:03:41] StevenXL: I have a quick question. I have a model called Organization. It has many individuals, and I've stubbed it out so that organization.individuals returns an array
[16:03:50] StevenXL: [business_owner1, business_owner2]
[16:03:50] StevenXL: allow(organization).to receive(:individuals) do
[16:06:45] StevenXL: unfortunately, what I am testing also makes a call to organization.individuals.business_owners. How can I stub out a chained call liek this?
[16:10:55] StevenXL: Ah - I see. There's a facility for this in RSpec: https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/message-chains
[21:00:52] StevenXL: Read error: Connection reset by peer
[22:08:24] StevenXL: Changing host
[22:08:25] StevenXL: has joined #RubyOnRails
[23:24:44] StevenXL: Ping timeout: 244 seconds

2016-04-03

[21:33:48] StevenXL: has joined #RubyOnRails
[21:33:58] StevenXL: Hello everyone.
[21:34:19] StevenXL: I have a quick question. Are ActiveRecord callbacks an example of the Observer pattern?
[21:34:50] StevenXL: (I know that there is an ActiveRecord::Observer class, but I'm interested in the callbacks themselves).
[21:49:46] StevenXL: smathy: thanks that's exactly the answer I was looking for.
[21:50:40] StevenXL: smathy: It's not an assignment question. I've decided that to become a better developer, I need to do more than simply learn how to use a framework's API.
[21:50:56] StevenXL: The first thing I'm tackling is learnign more about Software Design Patterns.
[21:51:08] StevenXL: But thank you that helped a lot.
[21:51:27] StevenXL: Dang it I can't get this right: :-)
[21:52:17] StevenXL: No. I'm actually going to be using Addy Osmani's Learning JavaScript Design Patterns as well as Design Patterns in Ruby.
[21:52:35] StevenXL: I like the idea of implementing in two different languages to solidfy the insights.

2016-03-23

[14:36:31] StevenXL: has joined #RubyOnRails
[14:37:27] StevenXL: Hey guys. I have a problem that is very odd to me. I am (trying) to remove active admin from my project but it removes activesupport as well.
[14:37:35] StevenXL: Just trying to understand why that would be the case.
[14:39:13] StevenXL: epochwolf: I'm as surprised as you are!
[14:41:53] StevenXL: Quit: leaving

2016-03-13

[16:18:24] StevenXL: has joined #ruby
[16:19:02] StevenXL: hello everyone. I am trying to send a string to an API that will use that string as the "from" field in an email. (I am using Mandrill).
[16:19:31] StevenXL: Unfortunately, The string I am trying to send has invalid characters. For example "bs, ms <support@example.com>"
[16:19:53] StevenXL: The "," after
[16:20:05] StevenXL: The "," after "bs" is invalid. How can I escape it so that it is valid?
[16:21:28] StevenXL: j2k: I believe that the SMTP standards don't allow certain characters in that from field. One of those characters is the comma.
[16:23:10] StevenXL: My problem is that I want to turn "bs, ms, mba" into "bs\, ms\, mba", with the hope that the backslash characters will escape the comma and it can be used in the from field."
[16:23:16] StevenXL: I am having trouble achieving that.
[16:27:41] StevenXL: Ah I got it!
[16:27:45] StevenXL: Thanks folks!
[16:31:13] StevenXL: Quit: leaving

2016-03-10

[00:40:07] StevenXL: Quit: leaving

2016-03-09

[23:53:19] StevenXL: has joined #RubyOnRails
[23:53:39] StevenXL: Hi everyone. I am trying to persist some data to the database (postgres), and I keep getting a rollback. How can I figure out what the rollback is due to?

2016-01-19

[00:09:27] StevenXL: Quit: leaving

2016-01-18

[21:27:11] StevenXL: has joined #ruby
[21:27:11] StevenXL: has joined #RubyOnRails
[21:27:11] StevenXL: Changing host
[21:27:11] StevenXL: has joined #RubyOnRails
[21:27:11] StevenXL: has joined #ruby
[21:54:51] StevenXL: Quit: leaving
[22:23:34] StevenXL: has joined #RubyOnRails
[22:23:34] StevenXL: has joined #ruby

2016-01-11

[04:11:47] StevenXL: Yea that's what we need, inside the object.
[04:12:53] StevenXL: OK - so that's likely 1 of possibly 2 problems.
[04:13:49] StevenXL: In your controller, message params is expect an object like this: {message: {body: "hello", conversation_id: 1, opened: yes, user_id: 1, author: "steven")
[04:14:17] StevenXL: What's important to note there is that you need an object that, inside of it, has a message property.
[04:14:26] StevenXL: Right now, you are passing in an object that has a body property.
[04:14:57] StevenXL: that's why we are getting the error that the params is missing.
[04:28:00] StevenXL: rubyonrails574: it doesn't need to have all of those properties unless you've required them in your model.
[04:28:32] StevenXL: For example, if you only required the mode, then the controller needs to see something like this, at a minimum:
[04:28:45] StevenXL: {message: {body: "Hello"}}
[04:29:12] StevenXL: in other words, to get it to work in a very hackish way, before you make the ajax call, you can get the right format by doing this:
[04:29:32] StevenXL: data = {message: message}
[04:30:18] StevenXL: and since that second message evaluates to {body: "gdas..."}, what you are really doing is this: data = {message: {body: "hello"}}
[04:31:37] StevenXL: OK, so you solved problem #1.
[04:31:59] StevenXL: Problem #2 is getting the controller to parse the JSON correctly.
[04:32:10] StevenXL: More likely, you are passing the data into the control incorrectly.
[04:33:03] StevenXL: I would suggest two things: 1) look at this stack overflow answer. https://stackoverflow.com/questions/12693947/jquery-ajax-how-to-send-json-instead-of-querystring
[04:33:11] StevenXL: You need to include the content-type header.
[04:33:39] StevenXL: Do that first. And if that doesn't work, then try using both the content type header as well as the using JSON.stringify(data) like we were doing before.
[04:34:05] StevenXL: At any rate, the problem you have now is properly passing json data to your controller. If that doesn't fix it, you can google around and the fix is out there.
[04:34:18] StevenXL: OK, I do have to go. Let me know if that fixes it.
[04:34:27] StevenXL: sounds good
[11:47:10] StevenXL: Ping timeout: 272 seconds
[16:12:38] StevenXL: has joined #ruby
[16:12:38] StevenXL: has joined #RubyOnRails
[16:12:38] StevenXL: Changing host
[16:12:38] StevenXL: has joined #RubyOnRails
[16:12:38] StevenXL: has joined #ruby
[16:16:39] StevenXL: Client Quit
[16:17:06] StevenXL: has joined #ruby
[16:17:07] StevenXL: has joined #ruby
[16:17:07] StevenXL: has joined #RubyOnRails
[16:17:07] StevenXL: Changing host
[16:17:07] StevenXL: has joined #RubyOnRails
[16:17:31] StevenXL: Hello everyone. I am trying to create a pull request, but when I go to do so, I get the following error: There isn???t anything to compare.
[16:17:34] StevenXL: salido:master and StevenXL:master are entirely different commit histories.
[16:17:35] StevenXL: How can I fix this?
[16:37:48] StevenXL: havenwood: thanks. I made some really bad mistake here. Trying to fix this is a nightmare.
[18:37:35] StevenXL: Ping timeout: 240 seconds
[19:17:39] StevenXL: has joined #ruby
[19:17:40] StevenXL: has joined #RubyOnRails
[19:57:41] StevenXL: Quit: leaving