flappynerd

Activity Graph

Page 1 of 2 | Next »

2016-04-04

[20:10:00] flappynerd: has joined #RubyOnRails
[20:10:33] flappynerd: ok, I have a bit of an oddity... foo.some_association is populated with information, but if I run a method foo.bar and bar attempts to access some_association, the length is zero
[20:10:50] flappynerd: any ideas what might cause that? I've been debugging a while now and I don't see anything obvious at the moment
[20:11:16] flappynerd: also odd: foo.bar appears to be working as desired when I use it inside a view
[20:11:38] flappynerd: but inside spec, the association is zero length when inside of bar
[20:42:43] flappynerd: has left #RubyOnRails: ("Leaving")

2016-03-25

[08:49:34] flappynerd: has joined #RubyOnRails
[08:50:55] flappynerd: so I'm using devise and omniauth, and when I use e.g. user_omniauth_path(:foo) the link generated goes to /users/auth/foo
[08:51:05] flappynerd: how can I intercept that request and do some pre processing?
[08:51:10] flappynerd: e.g. set a session var
[08:51:22] flappynerd: my rails console shows the GET /users/auth/foo request
[08:51:49] flappynerd: but it doesn't say what (if any) controller handles it, it just says INFO: omniauth (foo) request phase initiated
[11:17:27] flappynerd: has left #RubyOnRails: ("Leaving")

2016-03-15

[00:10:07] flappynerd: Kamuela, I've never seen - in file names honestly
[00:10:13] flappynerd: css selectors sure
[00:10:48] flappynerd: Kamuela, - is too likely to have other semantic meanings IMO, like "minus" etc, wheras _ is typically considered as having no more or less meaning than A-Z
[00:14:04] flappynerd: js is awesome
[00:14:07] flappynerd: es6 is even better
[00:14:12] flappynerd: aloneintheworld, /join ##javascript
[00:14:14] flappynerd: don't listen to the FUD
[00:14:27] flappynerd: aloneintheworld, also, don't use coffeescript, especially with react, use ES6 with react
[00:14:52] flappynerd: yes, feelings are so objective
[00:15:00] flappynerd: SteenJobs, that's not the fault of JS, that's the fault of browsers
[00:15:09] flappynerd: and it's not odd, it's great
[00:17:48] flappynerd: what debugging nightmare?
[00:17:52] flappynerd: I don't have an issue with debugging JS
[00:17:56] flappynerd: chrome dev tools is great
[00:18:04] flappynerd: I think you're Doing It Wrong (TM)
[00:57:40] flappynerd: SteenJobs, the lack of actual understanding that you have of javascript is a bit annoying
[01:01:14] flappynerd: also a bit embarrassing honestly, for your own sake I hope you don't ever express your gross misunderstandings of JS in job interviews for example
[01:39:20] flappynerd: clorisu, you can change that by not using mysql ;)
[01:39:22] flappynerd: use postgres
[01:42:14] flappynerd: clorisu, hmm, fair enough, you should avoid MySQL like the plague after you finish your tutorial
[01:42:43] flappynerd: it's not garbage, MySQL has a bunch of problems, easily factually demonstrated
[01:42:48] flappynerd: it's hyperbole, but not garbage
[01:43:30] flappynerd: Arcaire, lol, demonstrably, ok I guess if you say it that makes it true
[01:44:09] flappynerd: all you've done is say "are not!", that's hardly an argument
[01:45:24] flappynerd: clorisu, well, sockets may refer to TCP/IP sockets or unix domain sockets
[01:46:13] flappynerd: hmm, attempted ad hominems
[01:46:23] flappynerd: typical for someone who has no actual argument
[01:47:02] flappynerd: capin, Arch isn't exactly bad, but I can't personally recommend it in basically any case other than "I wanna mess around"
[01:47:08] flappynerd: 100% rolling releases are such a bad idea
[02:05:22] flappynerd: google wrote angular
[02:05:36] flappynerd: so, that's pretty much proof that just because you're a big company doesn't mean you can't write total crap :P
[02:06:34] flappynerd: what does MySQl actually do better than Postgres? how bout we get factual here?
[02:06:59] flappynerd: anything at all?
[02:07:14] flappynerd: cuz I can name plenty of stuff that Postgres does that MySQL simply does not
[02:07:27] flappynerd: not even "better", literally just functionality that doesn't exist in MySQL that does exist in Postgres
[02:07:41] flappynerd: Radar, but is that really better?
[02:07:54] flappynerd: most people I know (and myself) would consider that exactly one of the bad things about MySQL
[02:08:11] flappynerd: besides, good validation in the rails layer for example should be present to prevent that kind of thing in the first place
[02:08:29] flappynerd: Arcaire, more attempted ad hominems
[02:08:43] flappynerd: Arcaire, come back when you have an actual fact based argument
[02:11:34] flappynerd: yeah heroku's postgres is mega expensive tho :/
[02:23:01] flappynerd: meh, sure, like I said, clorisu don't worry too much about using MySQL for your tutorial
[02:23:33] flappynerd: clorisu, I just wanted to bring to your attention that Postgres has numerous benefits over MySQL and there are also several intrinsic problematic issues with MySQL
[02:23:40] flappynerd: plenty of places use MySQL in prod, it's not like you can't
[02:25:13] flappynerd: SteenJobs, but it is kind of about which is better... I mean it should be mostly about "does this meet my requirements", but given information presented about the problematic things in MySQL I don't see why anyone would choose MySQL knowing those problems
[02:25:43] flappynerd: eh, I mean has MySQL actually fixed the internationalization problems yet?
[02:26:16] flappynerd: the mere existence of WINDOW queries and ltree is enough for me to choose Postgres of MySQL any day
[02:26:58] flappynerd: I heard recent version of mysql have introduced JSON columns, which I guess is cool, I've still got no compelling reasons to choose MySQL and plenty of reasons to avoid it
[02:36:37] flappynerd: SteenJobs, assuming an application will always "be simple" or will never grow beyond initial specs is a mistake
[02:36:49] flappynerd: smathy, when would that be useful?
[02:38:23] flappynerd: clorisu, sure, like I said, no worries, use it for your tutorial, just be aware that DB choice is meaningful and MySQL has some problems
[02:40:00] flappynerd: smathy, that's still easy to solve with postgres
[02:40:31] flappynerd: SteenJobs, postgres is no more difficult to setup or learn than MySQL, it's all more or less a matter of familiarity
[02:40:43] flappynerd: why familiarize oneself with a generally inferior option
[02:41:54] flappynerd: smathy, it might be a fair point that technically this is something that mysql "does" that postgres "does not" but it's not something I think can be used as a rationale for using MySQL over Postgres given the other problems with MySQL
[02:42:17] flappynerd: and if you're talking about elegance Postgres still has a large amount of more elegant solutions than MySQL
[02:42:28] flappynerd: yes but there was a purpose reason I asked it
[02:42:36] flappynerd: I should have added "that has a meaningful impact"
[02:42:42] flappynerd: that, to me, is not a meaningful impact
[02:42:55] flappynerd: s/meaningful/significant/ or s/meaningful/non-negligible/
[02:44:03] flappynerd: even if that's the case, I still prefer not to use a DB that doesn't care about my data
[02:45:12] flappynerd: so, lets take it out of the realm of my preferences
[02:45:20] flappynerd: everyone should avoid using a database that doesn't care about their data
[02:48:25] flappynerd: this conversation has covered several of the problems with mysql and several of the benefits and features of Postgres
[02:48:37] flappynerd: and plenty more can be found on google
[02:49:09] flappynerd: yes, this conversation has covered that already, and it can be found in abundance on google
[02:49:56] flappynerd: SteenJobs, btw I wanted to mention, now that you're back, that all of your assertions regarding javascript so far are patently false and misinformed
[02:51:05] flappynerd: well I guess it was weaksauce as well
[02:51:19] flappynerd: js has iterators and js is not a "sloppy language"
[02:51:33] flappynerd: the spec is well defined, browsers are to blame for most of the issues in the ecosystem, not the JS language
[02:52:27] flappynerd: "<SteenJobs> the lack of higher level iterating is also a bit annoying", what do you view JS as lacking in this regard?
[02:53:28] flappynerd: I'm aware that InnoDB has FK constraints
[02:53:31] flappynerd: that's not what I'm talking about
[02:53:46] flappynerd: but yes, that's something that can bite noobs for sure, not realizing the difference between the two
[02:54:56] flappynerd: hmm, well I haven't use mysql since well before 2010 so I'm sure some things have changed
[02:55:20] flappynerd: actually, no I used MySQl around 2013 and we ended up with major issues with internationalization
[02:55:55] flappynerd: I dunno, maybe that's fixed too, but I'm not sure why I would go back when Postgres hasn't had a problem with this stuff
[02:56:08] flappynerd: SteenJobs, what's your specific issue/contention ?
[02:56:14] flappynerd: ruby handles a lot of things differently
[02:56:45] flappynerd: you didn't say "they're different", your assertion was rather pointed and different in character
[02:58:45] flappynerd: Radar even already gave a specific example here
[02:58:52] flappynerd: and there are several other examples
[02:58:59] flappynerd: I dunno, like I said, I'm sure they're improving things all the time
[02:59:15] flappynerd: but I don't know why I would choose something that's fixing old problems instead of making modern improvements
[03:06:41] flappynerd: SteenJobs, what's something you are used to being able to do in ruby in a nuanced way that you can't do in JS with the same nuance?
[03:07:21] flappynerd: clorisu, I'm pretty sure debugger is deprecated, you probably want to use pry and or byebug
[03:07:43] flappynerd: clorisu, however, you may be able to fix that, are you using rvm?
[03:08:01] flappynerd: SteenJobs, you don't need to do that in JS either
[03:08:13] flappynerd: sevenseacat, yeah I suppose since he's using sudo that does answer the question
[03:08:25] flappynerd: and yes I looked at the pastie, hence how I saw he's trying to install debugger
[03:09:11] flappynerd: sure, presence of /usr etc
[03:09:25] flappynerd: SteenJobs, .forEach
[03:09:35] flappynerd: or _.each if you're using underscore or lodash
[03:10:03] flappynerd: but really you should be using an ES5 polyfill and an ES6 polyfill and babel, in which case it's a non-issue
[03:10:25] flappynerd: SteenJobs, _.each works for pojos too
[03:10:43] flappynerd: i.e. _.each will work for the ruby equivalent of a hash
[03:11:13] flappynerd: well that wasn't actually your original point
[03:11:19] flappynerd: and transpilers are great, I see no issue
[03:12:39] flappynerd: invalid analogy
[04:05:24] flappynerd: has joined #ruby
[04:12:18] flappynerd: has left #ruby: ("Leaving")
[04:51:07] flappynerd: has left #RubyOnRails: ("Leaving")

2016-03-14

[22:06:29] flappynerd: has joined #RubyOnRails
[22:06:44] flappynerd: how much support does rails have for postgres jsonb?
[22:07:02] flappynerd: i.e. I'm considering possibly wanting to use a jsonb column instead of e.g. serialize: JSON
[22:07:21] flappynerd: wondering how much/how well that might be supported (if at all) and or where to look (documentation wise) to find out
[22:10:53] flappynerd: Radar, ah nice, ok thanks I'll play with that
[23:47:22] flappynerd: can I manually retrieve the CSRF token that will/would be given for a form?
[23:47:32] flappynerd: I'd like to do some manual form submits through e.g. Postman
[23:48:04] flappynerd: hmm, well I was hoping to do it without making an actual rendering request to get/draw the form
[23:48:19] flappynerd: hmm, I suppose that might work
[23:50:07] flappynerd: could I just spit out the auth token in JSON?
[23:50:22] flappynerd: that'd be easier, I mean I suppose I could do a request to render the form and then grab #authenticity_token
[23:50:30] flappynerd: but it would be easier to be able to spit that out via json

2016-03-10

[00:17:47] flappynerd: has joined #RubyOnRails
[00:18:24] flappynerd: hi, so I've got a somewhat interesting connundrum... I need to add join records, but I need the lookup to happen on a column that's different than either of the foreign keys
[00:19:02] flappynerd: how can I do that? I've tried a few things, but mainly I'm wondering if/how I can manually get the auto-generated unique ID of the new record in the fields_for object
[00:19:26] flappynerd: e.g. fields_for :posts_tags do |f| ... I know I can reference e.g. f.object
[00:19:35] flappynerd: and for records that already exist, I can reference f.object.id
[00:19:42] flappynerd: but what about new objects?
[00:19:58] flappynerd: I've been googling around to try to find docs on the f.object but I'm not sure where to look
[00:20:01] flappynerd: and so far I haven't found it
[00:20:52] flappynerd: hi smathy :)
[00:21:09] flappynerd: smathy: well yes, but there's a unique id that goes on the form, it's more of an index rather than an id
[00:21:30] flappynerd: post[post_tags_attributes[1234586990192938][tag_id] for example
[00:21:36] flappynerd: derp, missing ]
[00:21:47] flappynerd: how can I get the 1234586990192938 number off of f.object manually?
[00:22:20] flappynerd: smathy: that comes from f.link_to_add
[00:23:08] flappynerd: like, typically in regular HTML you can specify a form array with <input name="things[]"> but that only works for things that are a flat array, it wouldn't work for <input name="things[][some_attribute">
[00:23:50] flappynerd: so you'd need to use something like <input name="things[0][some_attribute]"> and <input name="things[1][some_attribute]"> then <input name="things[n][some_attribute]"> etc etc
[00:24:00] flappynerd: the f.link_to_add auto generates some kind of index for me
[00:24:29] flappynerd: but I have to do this more or less manually because the attribute I need to use to look up the proper FK doesn't exist on the join model
[00:34:57] flappynerd: here's what I've got so far https://gist.github.com/anonymous/d45649b49650f96b10b8
[00:37:25] flappynerd: it seems like maybe this is a limitation of rails
[00:37:59] flappynerd: jstransky: if you need to separate/deliniate then you must use {} I'm pretty sure
[00:38:25] flappynerd: the "nice" and or "shorthand" where you leave off braces won't work because it wouldn't know where one hash begins and the other ends
[00:38:53] flappynerd: jstransky: correct
[00:39:59] flappynerd: jstransky: it's a thing because... it's a thing? lol I dunno what you want
[00:40:08] flappynerd: shorthand doesn't work if you need to delineate two hashes
[00:40:19] flappynerd: jstransky: how is the function supposed to know where one hash begins and the other ends?
[00:45:47] flappynerd: moses: I would probably make e.g. a PagesController and make named routes for each page
[00:46:12] flappynerd: moses: e.g. PagesController#about_us and PagesController#faq
[00:46:24] flappynerd: smathy: well the link to remove just removes the form from the page
[00:46:32] flappynerd: afaik this is all pretty much default rails form helpers
[00:46:48] flappynerd: if you want to manage 1:M or in this case M:M relationships on a form
[00:46:57] flappynerd: smathy: and I didn't make those random numbers, rails does
[00:47:48] flappynerd: smathy: the code in "orignal.haml" is working as expected
[00:48:03] flappynerd: smathy: right, I did
[00:48:15] flappynerd: that's just my attempt to get it working given the new specs I need
[00:48:35] flappynerd: and as is not entirely surprising to me, the random hex stays the same on each input
[00:48:50] flappynerd: when I use form helpers, as you can see in original.haml rails generates proper separate indexs for me automatically
[00:49:11] flappynerd: but I want to do the lookup not based on one of the standard foreign keys in my join table
[00:49:38] flappynerd: e.g. normally it works fine because manager_id is a field on the join model, but I need to lookup using a different field on the Manager model
[00:51:08] flappynerd: smathy: and also, btw, remove works fine whether the join record exists or not, if the record exists it adds a _destroy field and if the record doesn't exist it just removes that row from the page
[00:51:47] flappynerd: maybe Radar knows something about this?
[00:52:09] flappynerd: if I can get that unique index off of ff or ff.object I think I'll be fine
[00:52:21] flappynerd: just not sure where to find the docs on that particular class
[00:53:00] flappynerd: Radar: I am wanting to make a form for a join model but use something other than one of the foreign keys on the join model as the lookup mechanism https://gist.github.com/anonymous/d45649b49650f96b10b8
[00:53:13] flappynerd: that's what works with a normal join model and then what I've got so far
[00:53:47] flappynerd: Radar: ok, any idea where I can find the docs on the "f" and "f.object" respectively of a `form_for @foo |f|` call?
[00:53:51] flappynerd: that's probably all I need
[00:53:56] flappynerd: just haven't been able to find it yet on google
[00:54:21] flappynerd: k I'll check that, thanks
[00:55:27] flappynerd: smathy: well it's created by rails
[00:55:36] flappynerd: I don't think rails really cares about it on the backend
[00:55:58] flappynerd: but... it is... it's created by ff.text_field
[00:56:25] flappynerd: well, it's created by some kind of javascript that rails has when making these kinds of forms
[00:56:36] flappynerd: I guess it's created by whatever rails calls on click of f.link_to_add
[00:57:09] flappynerd: yep, I'm using nested_form_for
[00:57:33] flappynerd: ooh I might have found it
[00:57:37] flappynerd: ff.index might be the trick
[00:58:33] flappynerd: thanks Radar
[00:58:40] flappynerd: Quit: flappynerd
[01:16:39] flappynerd: has joined #RubyOnRails
[01:17:13] flappynerd: ok one more, if I've got an array in my params, e.g. params[:post][:post_tags_attributes] can I concat/add to that array?
[01:17:37] flappynerd: when I try using + as with normal arrays I get an error, google says this is because params is not really a hash but rather a api.rubyonrails.org/classes/ActionController/Parameters.html
[01:40:24] flappynerd: Quit: flappynerd

2016-03-07

[21:16:05] flappynerd: has joined #RubyOnRails
[21:22:50] flappynerd: if I define a route with a custom as: handler, how do I reference that route?
[21:23:00] flappynerd: I'm getting undefined method for my route path
[21:23:58] flappynerd: tubbo, ok what about a route that requires a param?
[21:24:03] flappynerd: tubbo, http://pastebin.com/c59SrKNu
[21:24:49] flappynerd: https://gist.github.com/anonymous/ab89382249d6fb8441de
[21:25:10] flappynerd: tubbo, ah, yes rake routes, thanks, I'll check
[21:29:14] flappynerd: tubbo, huh, in fact yes, post_customthings_post ... odd, but whatever
[22:36:36] flappynerd: has left #RubyOnRails: ("Leaving")

2016-03-04

[22:15:27] flappynerd: has joined #RubyOnRails
[22:16:42] flappynerd: is there a route helper I can use for something like this? https://bpaste.net/show/f033a64e7805
[22:17:06] flappynerd: similar to how I automatically get things like edit_post_path(@post)
[22:17:16] flappynerd: I think I can use as: for this? but I'm not sure how
[22:17:48] flappynerd: I've been reading some docs on routing, but I'm still not sure how to write this, code wise
[22:17:58] flappynerd: smathy, ok what would my :as look like then?
[22:18:27] flappynerd: well I have a guess for the as: but I'm not sure what to guess for the actual path specifier
[22:18:40] flappynerd: as: "post_comments" basically is what I would do
[22:18:53] flappynerd: but then what do I use for the path? is it literal? e.g. would I then do post_comments_path(@post) ?
[22:21:11] flappynerd: has left #RubyOnRails: ("Leaving")

2016-03-02

[04:18:14] flappynerd: there's practically zero difference between that code and my code
[04:18:17] flappynerd: only the model name
[04:18:29] flappynerd: @employee = Employee.new
[04:18:33] flappynerd: form_for @employee
[04:18:52] flappynerd: when I dump the @employee in the controller it is what I would expect, it's an Employee model instance
[04:27:15] flappynerd: havenwood, http://hastebin.com/wogezeqaga.rb
[04:29:32] flappynerd: havenwood, oops, here ya go http://hastebin.com/pefisiwahu.rb
[04:30:00] flappynerd: "First argument in form cannot contain nil or be empty"
[04:30:35] flappynerd: that is the actual code
[04:30:55] flappynerd: I'm not sure what you mean by that
[04:31:17] flappynerd: oh, I see, ok
[04:34:59] flappynerd: havenwood, https://gist.github.com/anonymous/d317315bf05b935bbb66
[04:36:51] flappynerd: havenwood, not sure what you mean, sorry
[04:37:16] flappynerd: havenwood, yes it seems evident that @employee is mostly what you would, effectively call "empty", e.g. the fields inside of it are nil
[04:37:22] flappynerd: but it is a new employee instance
[04:37:28] flappynerd: and that's the code that the guides are using
[04:42:06] flappynerd: k, no worries, thanks
[04:45:13] flappynerd: makenoise, hmm, odd that does work
[04:45:22] flappynerd: I guess I must have messed something up somewhere else
[04:49:03] flappynerd: meh, ok it was actually just a typo
[04:49:10] flappynerd: all good now, pebkac :)
[06:28:42] flappynerd: Quit: Leaving
[23:09:44] flappynerd: has joined #ruby
[23:09:54] flappynerd: can I rescue multiple exception types with the same handler?
[23:10:06] flappynerd: rescue FooException, BarException => e
[23:10:21] flappynerd: or must I have a separate rescue line for each?
[23:15:21] flappynerd: is there any reason I can't put a begin/rescue/end blog inside a rescue handler?
[23:15:46] flappynerd: e.g. I'd like to attempt to log some info about the exception, but if that logging in turn fails, I want to at least fail gracefully and not throw another exception
[23:18:15] flappynerd: I mean, I figured it didn't seem like it would be a problem, but might as well ask
[23:20:10] flappynerd: has left #ruby: ("Leaving")