Activity Graph

Page 1 of 1


[08:09:17] swemoney: has joined #ruby
[08:33:07] swemoney: Quit: Textual IRC Client: www.textualapp.com


[03:39:15] swemoney: has joined #ruby
[03:39:57] swemoney: has joined #RubyOnRails
[03:42:55] swemoney: I just ran into a bug where Person.items has some duplicates in my database. (i.e. I've called Person.items << some_item more than once) .. This is a has and belongs to many relationship. If I do Person.items.uniq or Items.people.uniq, it'll return the list correctly. Is there an easy way to clean up these duplicates?
[03:43:34] swemoney: from the database, I mean.
[04:09:29] swemoney: Think that would work on postgres too?
[04:56:16] swemoney: Quit: My MacBook has gone to sleep. ZZZzzz…
[05:02:34] swemoney: has joined #ruby
[05:07:36] swemoney: Quit: Textual IRC Client: www.textualapp.com


[00:51:48] swemoney: Quit: Textual IRC Client: www.textualapp.com


[10:37:57] swemoney: has joined #ruby
[10:39:43] swemoney: Can anyone help me find a ruby way of taking an array like ["key_name_1", "val_1", "key_name_2", "val_2", "key_name_3", "val_3"] and turning it into a hash?
[10:41:54] swemoney: Perfect! I knew there had to be a bunch of ways. Thanks!
[11:17:59] swemoney: Quit: My MacBook has gone to sleep. ZZZzzz…


[09:55:05] swemoney: has joined #ruby
[10:47:19] swemoney: Quit: Textual IRC Client: www.textualapp.com


[02:46:45] swemoney: has joined #ruby
[03:11:47] swemoney: I'm not sure where else to ask this. Does anyone know a way to log in to the amazon developer dashboard (developer.amazon.com) via ruby? I've been playing with Mechanize and Watir for a while without a lot of success. Any time I submit the login form I get redirected back to the login page. I feel like it's a cookie issue.
[03:20:03] swemoney: Quit: My MacBook has gone to sleep. ZZZzzz…
[03:42:48] swemoney: has joined #ruby
[03:50:09] swemoney: allisio: thanks. I've tried changing the user agent. sadly, no change.
[03:51:50] swemoney: allisio I'm looking into checking that now. When I use Mechanize, I get a session_id and session_id_time cookie.. I feel like there should be others that are probably set via javascript or something.
[03:52:10] swemoney: I would think using watir with phantomjs would allow for those javascript cookies, thou
[03:53:36] swemoney: allisio cool.. thanks. I'll keep cracking at it. Was hoping there was a wheel somewhere I didn't have to reinvent. I don't understand why Amazon doesn't have a reporting API for their mobile ads reports.
[04:52:52] swemoney: allisio hah. I think I figured it out. I found a javascript call which set an amznTest cookie to test if cookies were enabled. When I set that cookie manually before submitting the login, it appears to go through.
[06:21:22] swemoney: Quit: My MacBook has gone to sleep. ZZZzzz…
[09:03:08] swemoney: has joined #ruby
[09:10:44] swemoney: Quit: Textual IRC Client: www.textualapp.com


[00:59:02] swemoney: has joined #RubyOnRails
[01:00:12] swemoney: Does anyone know if it would be possible to use ActionCable and use the users geolocation to only broadcast to nearby users?
[01:04:44] swemoney: matthewd: How would you conceptualize this? I'm having trouble figuring out how I would go about it. I have a chat room with a handful of "interests". The user joins a room, but then I only want them to actually be able to chat with people around them.
[01:05:10] swemoney: I've considered just filtering the messages on the client side but that seems wasteful and hacky.
[01:07:15] swemoney: I've also thought about just broadcasting to each individual user (like "roomname_userid" as the broadcast channel), but I don't know how well that would scale if I have to broadcast to 100 users or something
[01:09:07] swemoney: matthewd: I'm thinking much more local (like 10 miles). That would be a LOT of sections. heh.
[01:11:20] swemoney: matthewd: I see. That's something that could work. Would be a little weird on the edges of each "section" but I might just have to deal with that
[01:14:55] swemoney: matthewd: I like it. Thanks for the help. I'll see how well it works.
[01:23:31] swemoney: Read error: Connection reset by peer


[00:47:19] swemoney: curious about best practices for setting up your env variables in production? do I just export ENV_VAR_NAME? Seems kind of fragile..
[00:47:40] swemoney: i???m kind of new to deployments, so excuse the ignorance.
[00:49:59] swemoney: i???ve been seeing things about a .env file or a local_env.yml ??? but doesn???t that defeat the purpose of using env variables in the first place since the sensitive information is stored in a file again?
[00:55:01] swemoney: uberjar: right.. i???ve got that setup already. is the issue with storing sensitive information in a file solely with source control? so I should just copy the local_env.yml to the server via capistrano like my database.yml?
[00:56:43] swemoney: but when we???re back to how do i set up the env variables, persistently, on my production server?
[00:57:36] swemoney: that???s what i figured.
[00:58:04] swemoney: i???m using capistrano to deploy to a VPS
[00:59:10] swemoney: uberjar: do those persist through reboots and all?
[01:00:55] swemoney: wethu: | works w/ ruby code too.. i split metamagic over multiple lines that way
[01:01:30] swemoney: i wasn???t sure if i was missing something
[01:01:53] swemoney: thanks, uberjar
[01:03:58] swemoney: rushed: I actually knew about the tools and still manually converted all of my erb. forces me to go over everything to clean it up
[23:04:31] swemoney: has anyone run into an error about a method passing 1 argument for 0 (in a view helper).. but looking at the code, the helper method definitely accepts an argument. and it also seems to work fine in development.
[23:04:45] swemoney: the error is happening in production
[23:06:45] swemoney: i???ve checked the method name a dozen times. it???s weird really weird.
[23:08:01] swemoney: ya. i actually searched the whole codebase for the method name and it???s only being declared the once and called twice from the same view.
[23:08:55] swemoney: figures i???ve been working on getting this VPS setup and deploying the app and after 2 days, I finally get things running and i hit the strangest problem yet
[23:10:48] swemoney: i???ll play around a little more. just thought i???d poll the audience for common problems.
[23:13:45] swemoney: bah. got it. i guess my unicorn init script isn???t restarting properly.
[23:17:15] swemoney: i???d probably lean on the wrong side..
[23:17:23] swemoney: might even be against facebook???s tos


[12:39:25] swemoney: https://gist.github.com/swemoney/7333f4b4212e76113749 <??? any reason I don???t get a named route to GET image_path here? I want just the show action to route to / but it???s being weird.
[12:39:42] swemoney: to be clear, the route works. It would just be nice to have the url helpers


[10:10:30] swemoney: Is there an easier way to deal with multiple filters on a resource? like an Image has tags, pages and nsfw .. I???m finding myself checking for tags param with if, else every time i need a controller to use those tags.
[10:10:56] swemoney: i haven???t even broached displaying the nsfw stuff, yet. i want to filter that my sfw, nsfw, and both.
[10:13:42] swemoney: universa1: nsfw is a checkbox on the the Image model, tags are separate.
[10:15:56] swemoney: universa1: something like that could work. i???ll give it a shot. thanks.
[10:16:47] swemoney: hah. understandable from the quotes that hang at the bottom of the line. x=P


[02:48:32] swemoney: I???ve never done an admin/moderator user before. Is just adding a ???is_admin??? attribute to the user model good/secure enough?
[02:50:29] swemoney: zrl: cool. right now it???s pretty simple. figured i???d set the is_admin from the console on a very limited basis and they just need access to be able to delete stuff that doesn???t belong.
[02:51:20] swemoney: zrl: thanks
[12:30:12] swemoney: is there any built in/easy method to validate that an object belongs to the logged in user before updating/destroying it? or just check in each controller action?
[12:36:12] swemoney: Sylario: hm. interesting. thanks. i???ll take a look at that.


[10:47:13] swemoney: Anyone know how to use a custom font to annotate an image with paperclip? The processor should work great as it???s line-for-line what I???m doing on the command line with the convert command, but I can???t seem to get it to load the font I???m trying to use.
[10:51:44] swemoney: https://gist.github.com/swemoney/b20cde6af8a9b6ef3467 <??? if anyone can help
[14:55:51] swemoney: if i have a Tag model and an Image model and I don???t want to let the users make new tags, how can I validate that all of the tags the user selects exist when the user creates/saves an Image?
[15:01:27] swemoney: would validates :tags, inclusion: { in: Tag.all } be a crappy way of doing this?
[15:06:10] swemoney: that doesn???t appear to be working, anyways. I get a RecordNotFound error on the tag, which is nice, but it would be nicer to tell the user about it with a standard validation error


[01:03:02] swemoney: if i have a Person model that has_and_belongs_to_many pictures, how can i grab the top 5 people with the most pictures?
[01:26:42] swemoney: thats what i???m gathering. Google is leading me to a counter cache column..


[17:35:16] swemoney: https://gist.github.com/swemoney/8aff4cafbcb349fe7f50 <??? this does what I need it to but it???s definitely not very efficient as it hits the database for each ???group??? in the loop .. any ideas on how to clean it up?
[17:37:25] swemoney: sweeeeet. i was looking for something like that. thanks.
[17:44:43] swemoney: tbuehlmann: That worked great! thank you.
[19:49:48] swemoney: if i have a default scope on my model of order(???last_name ASC???) .. how can I one-off a request that orders by first_name? adding an extra .order() doesn???t seem to do it.
[20:11:43] swemoney: strange issue here. I have an image upload form with a drag/drop area. I drop a file on. Submit the form and the image saves and everything goes great. But if I click the ???upload image??? link again, the dropzone doesn???t work unless I manually refresh the page???
[20:12:24] swemoney: might this be a webbrick problem? or a turbolinks problem? not sure where to start on figuring it out.
[20:14:57] swemoney: nvm. found something on stackexchange. guess it???s turbolinks.


[02:31:44] swemoney: Having trouble conceptualizing this. I have People and Things. /things.json returns all of the things and /person/1/things.json returns just that persons things. I want to ALWAYS return all of the things, but for the person_things, I???d like to just put that person???s things in the front of the json array.
[02:35:37] swemoney: ooooo.. even the url makes it look useful! thanks.
[02:38:00] swemoney: ya. that makes sense. thanks
[17:37:23] swemoney: I???m in development and put some images in app/assets/images/foo, but when i try to use image_tag or image_path ???foo/bar.jpg???, i get a no route error for /images/foo/bar.jpg .. i???m stumped.
[17:52:26] swemoney: any ideas about why I might be getting no route matches [GET] /images/foo/bar.jpg in development while using the image helpers? this project is pretty new so I can???t think of anything I might have broken yet
[17:53:56] swemoney: ugh. nvm. i???m an idiot. the file was named wrong. *facepalm*
[17:54:11] swemoney: might be a sign that I should take a nap


[15:08:11] swemoney: Does anyone know of a gem that does a sort of ???Facebook tagging???? I have a list of tags that I want to limit the user to using so typing one should autocomplete and only allow that tag to be used.
[15:17:44] swemoney: Sigma00: Thanks. Kinda figured I???d have to do some work but figured it was worth an ask if the wheel was already invented. heh.
[15:28:10] swemoney: Sigma00: Thinking of giving this jquery plugin a shot. looks like it will do most of what I want for the client side without a lot of hacking needed. https://github.com/aehlke/tag-it


[02:17:20] swemoney: Can anyone help me visualize the best approach for a multi-page image upload process? I want page that will probably just use jquery.fileupload.js to upload a handful of images.. and then i want to go to the next page after the upload for applying data such as captions and titles and such???
[02:20:43] swemoney: abolishme: that???s kind of what I???m thinking now. I was thinking of adding a ???saved??? property to the image.. so the image wouldn???t be valid until the user saved the metadata for it.
[02:21:12] swemoney: do some cleanup after a day or something to remove any image that hasn???t been saved for x time.