« Back to channel list

#RubyOnRails - 25 March 2016

« Back 1 day Forward 1 day »
[00:05:17] valetudo: has joined #RubyOnRails
[00:06:00] Maletor: Does rails support consolidation of queries? For example two calls to a Users table. One to fetch the assignors and one to fetch the assignees. Includes gets us close. Would this be over optimizing. It's probably still faster than Ruby, but just curious.
[00:06:30] gabr13l: has joined #RubyOnRails
[00:08:00] pawnbox: has joined #RubyOnRails
[00:10:38] gabr13l: Hi, I’m using both Resque and DelayedJob in my app. I recently found out about ActiveJob::Base and have added the following to config/initializers/active_job.rb: ` ActiveJob::Base.queue_adapter = :resque`. But I’m wondering can I user ActiveJob w/ both Resque and Delayed job in the same app? Or do I just use ActiveJob w/ one job lib per app? As always thanks!
[00:11:46] statelesscode: has joined #RubyOnRails
[00:12:25] havenwood: gabr13l: Can you just ditch Delayed::Job?
[00:13:11] gabr13l: havenwood: that’s a great question. I don’t know if I can run resque jobs at a later date like w/ delayed job. I’m researching that as well as the best way to use active job now.
[00:13:36] gabr13l: and yes FWIW I’d prefer to just ditch delayed::job if that is possible.
[00:16:35] havenwood: gabr13l: Maybe checkout resque-scheduler and see if it fits for you: https://github.com/resque/resque-scheduler
[00:16:50] gabr13l: awesome. thanks!
[00:17:35] xlegoman: has joined #RubyOnRails
[00:19:09] mostlybadfly: has joined #RubyOnRails
[00:20:18] cabinB: question about helper methods. I have a bunch declared in application_controller. Can they also be declared in other controllers? If I have a helper method that's specific to invoice_controller, can I declare it there? (Sorry, not in front of ide right now or I'd try it)
[00:21:02] cabinB: BTW, I don't mean declare the *same* ones in invoice_controller.
[00:21:08] rikkipitt: has joined #RubyOnRails
[00:22:07] matthewd: cabinB: Yes, though note they'll only be available while rendering the controller they're defined on
[00:22:47] cabinB: matthewd, thanks. yep, i figured the scope would be limited to the controller they exist in. that helps a lot so i can unload some code from the application_controller.
[00:23:00] matthewd: cabinB: Though I generally wouldn't expect to have a large number of controller-defined helper methods anyway... most should be defined in the appropriate helper modules
[00:23:00] gingray: has joined #RubyOnRails
[00:23:31] cabinB: related question: is declaring helper_method the same and declaring private methods in the controller?
[00:23:56] sonofdirt: has joined #RubyOnRails
[00:24:14] matthewd: helper_method means you can call it from the view
[00:24:24] matthewd: i.e., it is a helper method
[00:24:40] dalbuschat: has joined #RubyOnRails
[00:24:49] matthewd: Otherwise it's just an ordinary method on the controller (which is all you need, if you're not calling it from the view)
[00:25:42] cabinB: matthewd: such a great simple answer. thanks! (as you can tell, fairly new to ror). I haven't yet looked into helper.rb files. I assume you just create one for each controller you want it aligned with, and offload more code out of your controller?
[00:26:16] cabinB: Rails 4.x, by the way.
[00:26:30] matthewd: They're really different things for different purposes
[00:26:35] Pupeno: has joined #RubyOnRails
[00:26:38] matthewd: So it depends what your current methods are doing
[00:28:03] cabinB: matthewd I see. it's more complex than a simple yes/no answer. for now i'll just put code in the controllers, refactor later once i learn about helper modules
[00:28:34] cabinB: out of curiosity, what local IDE do you use? and you have a preference for any specific cloud IDE?
[00:29:25] matthewd: Vim, and none
[00:30:10] moeabdol: has joined #RubyOnRails
[00:30:34] Pazician: has joined #RubyOnRails
[00:32:55] cabinB_: has joined #RubyOnRails
[00:33:23] Devalo: has joined #RubyOnRails
[00:33:25] cabinB_: grrr it happened again (disconnected!)
[00:33:42] cabinB_: matthewd sorry got disconnected for a sec. not sure if you answered the IDE question
[00:33:43] ryanwinchester: has joined #RubyOnRails
[00:33:59] rikkipitt: has joined #RubyOnRails
[00:34:01] ryanwinchester: has left #RubyOnRails: ("Laters")
[00:34:01] matthewd: [10:59:25] <matthewd> Vim, and none
[00:34:18] matthewd: (there's a log link in the topic)
[00:34:19] superlou: has joined #RubyOnRails
[00:34:27] pwnd_nsfw: IDE for rails is a bit uhhh.... unnecessary, I think
[00:35:22] cnk: Largely - though some people's vim / sublime / emacs setups are close to IDE status
[00:35:45] cabinB_: thanks guys!
[00:35:45] pwnd_nsfw: I still use good ol' command line
[00:35:46] cnk: cabinB_: RedMine is almost tempting but I just use emacs
[00:36:19] htmldrum: has joined #RubyOnRails
[00:36:19] htmldrum_: has joined #RubyOnRails
[00:36:45] Pupeno: has joined #RubyOnRails
[00:36:45] Pupeno: has joined #RubyOnRails
[00:36:51] benlieb: has joined #RubyOnRails
[00:37:33] pawnbox: has joined #RubyOnRails
[00:38:32] yfeldblum: has joined #RubyOnRails
[00:38:40] cabinB_: I gotta say, this channel is awesomely helpful. When I get experienced enough to help, I definitely want to do like you guys are doing. Good community.
[00:38:50] SteenJobs: has joined #RubyOnRails
[00:39:57] RegulationD: has joined #RubyOnRails
[00:41:00] SteenJobs: hey guys - what’s the recommended way to change an image on hover? e.g.: i have an SVG for my login button, and when the user hovers over the button, i want the image to change - right now the button uses the link_to helper with an image_tag helper inside…i can give it a custom class and set the background image of that class, but that would mean changing the html too
[00:41:16] SteenJobs: alternatively i can just use onmouseover in the image_tag
[00:41:48] pwnd_nsfw: has joined #RubyOnRails
[00:43:23] smathy: SteenJobs, I'd do it with a :hover CSS selector and a different background image.
[00:43:56] SteenJobs: smathy: aright, will do
[00:44:02] SteenJobs: although why is that preferable to using onmouseover?
[00:45:08] smathy: Why use JS when you don't have to?
[00:45:34] TheGreatGudsby: has joined #RubyOnRails
[00:45:39] smathy: ...and the browser is better/more-reliable at handling the exit event.
[00:45:41] SteenJobs: valid point!
[00:45:59] SteenJobs: is there any preference to setting the background-image on the <a> tag vs the <img> tag?
[00:46:17] hahuang65: has joined #RubyOnRails
[00:46:18] twilling: has joined #RubyOnRails
[00:46:45] smathy: SteenJobs, you won't have an img tag with a background image.
[00:46:52] chipotle: has joined #RubyOnRails
[00:46:56] bl4ck_ic3: has joined #RubyOnRails
[00:47:11] SteenJobs: smathy: yea yea, sorry poorly worded
[00:47:23] smathy: SteenJobs, you'll have an a with a background image, and an a:hover with the hover background image.
[00:47:27] SteenJobs: i meant setting backgorund-img on the <a> tag vs using an image tag instead
[00:47:47] SteenJobs: are there any subtle differences that would change
[00:47:52] smathy: SteenJobs, if you use the img tag then you won't ever see the background image.
[00:47:56] Guest38597: has joined #RubyOnRails
[00:48:02] SteenJobs: i knowwww haha
[00:48:05] SteenJobs: i meant now there’s an image tag
[00:48:16] SteenJobs: i can remove that, and use the background image property of the <a> tag instead
[00:48:37] SteenJobs: are there any practical differences between the two approaches of displaying an image
[00:48:46] yfeldblum: has joined #RubyOnRails
[00:48:56] smathy: Yes, the background image will repeat by default, look at the docs.
[00:49:03] SteenJobs: ok cool, thanks
[00:49:24] SteenJobs: but yea, i mean then you just set the background-repeat to no-repat
[00:51:21] akshat: has joined #RubyOnRails
[00:51:28] htmldrum1: has joined #RubyOnRails
[00:51:40] htmldrum2: has joined #RubyOnRails
[00:52:23] sleungcy: has joined #RubyOnRails
[00:53:33] SteenJobs: that approach is working terribly with bootstrap
[00:53:35] SteenJobs: javascript it is
[00:56:06] bl4ck_ic3: hello everybody
[00:57:17] silentpost: has joined #RubyOnRails
[00:59:19] Guest38597: has joined #RubyOnRails
[01:00:05] dvinciguerra: has joined #RubyOnRails
[01:02:31] sonofdirt: has joined #RubyOnRails
[01:03:00] kpwarr: with Strong Parameters, I can't figure out what would be the right way to merge url paramters with post parameters. if merge the corresponding parameter objects I get a deprecation warning
[01:05:15] kpwarr: here coupon is the object populated with the post parameters, and print_center_id is a url parameter: `params.require(:coupon).permit(:name).merge(params.permit(:print_center_id))`
[01:11:45] kpwarr: oh, it seems that I have to first use .to_h on the merged params to safely cast to a hash
[01:11:45] sbarg: has joined #RubyOnRails
[01:17:31] pawnbox: has joined #RubyOnRails
[01:17:52] kinduff: has joined #RubyOnRails
[01:19:00] sonofdirt: has joined #RubyOnRails
[01:19:04] chipotle: has joined #RubyOnRails
[01:19:05] halfamind: has joined #RubyOnRails
[01:20:18] siaW: has joined #RubyOnRails
[01:20:37] siaW: hi in rails there are things like “root to: 'home#index’”
[01:20:45] siaW: is “root” a method name?
[01:20:52] siaW: what can i call it?
[01:21:17] siaW: them same with thing like “ resources :topics, only: [:show]”
[01:21:39] siaW: what are they collectively called? “resources” and “root”
[01:23:17] cnk: my guess is that root and resources are method calls in the router. What they do is create routes
[01:23:53] siaW: thank you
[01:24:05] siaW: i was confused thinking of how to call them
[01:24:25] siaW: so if resources and routes are method calls
[01:24:31] siaW: what will “topics”
[01:24:33] siaW: resources :topics, only: [:show]
[01:24:51] siaW: and “only”
[01:24:54] siaW: and “show”
[01:25:36] cnk: topics is an argument to that method and the only: [] part is a hash (without the {}) that passes config options to the resources method
[01:26:13] matthewd: siaw: It sounds like you need a ruby tutorial; asking about each element in turn is unlikely to be an effective way to learn
[01:27:01] siaW: :topics and :show are symbols
[01:27:21] siaW: and they are parameters passed to “resouces” and “only” in this case
[01:27:35] cnk: Perhaps - but the Rails DSL is a language of its own. Knowing Ruby makes it easier to map the DLS into language parts but it is still a little .... interesting
[01:27:52] siaW: exactly, that’s why i’m asking
[01:28:11] siaW: i’d rather ask a stupid question than act like i know for sure what these things are
[01:28:25] cnk: siaw: topics is a paameter to resources
[01:28:41] cnk: but only is a key in the hash
[01:28:46] cnk: so not really a parameter
[01:28:48] tds5016: has joined #RubyOnRails
[01:28:49] Trynemjoel: has joined #RubyOnRails
[01:29:00] siaW: yeah right
[01:29:34] siaW: thanks cnk
[01:29:42] tds5016: hi all. Question... How would I set up strong_params to allow an object with strings with spaces as keys?
[01:29:49] pwnd_nsfw: has joined #RubyOnRails
[01:30:15] QualityAddict: has joined #RubyOnRails
[01:30:22] tds5016: params.permit(foo: [bar: ["value with spaces"]])
[01:30:32] tds5016: something like that?
[01:31:15] matthewd: Ruby is ruby; if you're asking what a particular Rails method does, that's easy to answer... if the answers you're seeking look like "it's a method/parameter/symbol", then you're asking about basic ruby syntax
[01:31:28] matthewd: tds5016: Strong params doesn't care about the value
[01:31:43] Radar: tds5016: example parameters please
[01:31:49] TheNet: has joined #RubyOnRails
[01:32:07] jottr: has joined #RubyOnRails
[01:32:09] tds5016: matthewd: params.permit(foo: [bar: ["value with spaces"]])
[01:32:11] tds5016: for example
[01:32:21] tds5016: bar can have "value with spaces" as a key
[01:32:44] tds5016: matthewd: does that make sense?
[01:33:31] tds5016: what I'd have passed in as my arguments would be... {foo: {bar: {"my values": 'the value'}}}
[01:34:17] Pupeno: has joined #RubyOnRails
[01:34:24] matthewd: Oh, okay...
[01:34:34] matthewd: What happens if you use the thing you're suggesting?
[01:35:18] Uber|Dragon: has joined #RubyOnRails
[01:35:26] tds5016: it doesn't allow the parameters through as far as I can tell.
[01:38:17] tashamama: has joined #RubyOnRails
[01:39:21] Trynemjoel: has joined #RubyOnRails
[01:40:21] tds5016: matthewd: it looks like that's also turning bar into an object instead of an object
[01:40:45] blackmesa: has joined #RubyOnRails
[01:40:46] tds5016: which... it is... but it should be bar: {}, not {bar: {}}
[01:42:10] matthewd: tds5016: I think you're going to need to show us what's actually going on
[01:43:57] baweaver: has joined #RubyOnRails
[01:44:24] tds5016: matthewd: let me try something else...
[01:44:27] tds5016: I can't really post code :-/.
[01:46:08] matthewd: If your parameter names are proprietary, you'll need to either reproduce the problem in something you can share, or hire a consultant
[01:47:30] pawnbox: has joined #RubyOnRails
[01:48:18] tds5016: matthewd: is there a way to show what params allowed to pass?
[01:49:56] Rubie: has joined #RubyOnRails
[01:52:08] owenjones: has joined #RubyOnRails
[01:54:38] Rubie: hi all: i have a model that will be responsible for caching an API requests and storing them to the database, but I'm having trouble thinking of a good name...would a model named TwitchApiCache make sense?
[01:54:50] Pupeno: has joined #RubyOnRails
[01:54:50] Pupeno: has joined #RubyOnRails
[01:54:55] IrishGringo: has joined #RubyOnRails
[01:56:15] Inside: has joined #RubyOnRails
[01:56:15] matthewd: tds5016: to_h ?
[01:56:23] polyidus: has joined #RubyOnRails
[01:58:31] TheNet: has joined #RubyOnRails
[01:59:12] crystal77: has joined #RubyOnRails
[02:01:51] zave: anyone here use RubyMine? I'd like to script download. is there a place for one to download it from?
[02:02:04] zave: with a script, i mean
[02:02:15] zave: using wget, i suppose.
[02:02:49] zave: i've seen this, https://gist.github.com/bogdanRada/5974873, but it's hard to confirm that url
[02:04:04] zave: well heck, that worked.
[02:04:21] sbarg1: has joined #RubyOnRails
[02:04:50] eduardodeoh: has joined #RubyOnRails
[02:04:59] jstransky: has joined #RubyOnRails
[02:05:16] SteenJobs: is there a way to redirect after sign in with devise based on the scope of the new session view? so if an admin user logs in through users/sessions/new the user will be redirected to the usual route, but if the admin user logs in through admin/sessions/new, the user will be redirected to the admin panel
[02:05:52] Trynemjoel: has joined #RubyOnRails
[02:05:57] Darmani: has joined #RubyOnRails
[02:06:08] Darmani: Hello my children<3
[02:06:10] itkin-: has joined #RubyOnRails
[02:06:31] Darmani: Radar: Breh?
[02:06:53] jbermudes_: has joined #RubyOnRails
[02:07:09] zave: SteenJobs: i'm using rolify and pundit for scoped roles. i haven't absorbed it all yet, but i know allows one to scope roles all the way to the instance level.
[02:07:24] QualityAddict: has joined #RubyOnRails
[02:07:28] pwnd_nsfw: pundit is great
[02:08:39] zave: and i'm using it alongside devise, yes.
[02:09:16] TheNet: has joined #RubyOnRails
[02:09:56] SteenJobs: ya, it sseems devise’ internals work by checking the url for the scope - so even though the user and admin models point to the same controller, devise/sessions#new, it still differentiates based on the scope in order to map to the correct model
[02:10:12] SteenJobs: problem is, i’m not sure how to gain access to that scope value when redirecting a sign in
[02:10:49] pwnd_nsfw: with a little help, I was advised to use one model for authentication
[02:11:03] pwnd_nsfw: and have my models that differ have a 1:1 polymorphic association
[02:11:53] pwnd_nsfw: So, I have a User model that contains only the data necessary for authentication (email, password, etc.), then Customer and ServiceProvider models belong_to User
[02:11:57] pwnd_nsfw: Works out pretty well
[02:12:20] pwnd_nsfw: I can still separate the logic, and authentication was not a pain in the ass to work around... because there was no working around to do
[02:13:53] pwnd_nsfw: SteenJobs, https://github.com/himadriganguly/devise-polymorphic-association/
[02:13:55] pwnd_nsfw: may be of help
[02:14:18] eyck: has joined #RubyOnRails
[02:14:24] SteenJobs: ya, but we intentionally want to separate our admin users into their own model rather than using a single user model and applying an admin role
[02:14:38] pwnd_nsfw: Reread what I said
[02:14:42] pwnd_nsfw: it still has it's own model
[02:14:44] SteenJobs: but yes, in general any not auth related user data should be abstracted to a separate model
[02:14:50] pwnd_nsfw: Except authentication is handled simply
[02:15:36] pwnd_nsfw: Do you have two login forms on the same page SteenJobs ?
[02:15:39] pwnd_nsfw: or just the one?
[02:15:50] SteenJobs: there is no registration module for the admin user model
[02:16:13] SteenJobs: but yea, no, the sessions views are distinct
[02:16:24] blackhuey: has joined #RubyOnRails
[02:16:46] SteenJobs: each in their respective namespace
[02:17:12] SteenJobs: actualllllly
[02:17:48] workmad3: has joined #RubyOnRails
[02:18:32] SteenJobs: pwnd_nsfw: i’m not totally sure that i’d be able to get and admin_user to login to the main part of the app thru the user login flow anyway, unless they’re part of the same model
[02:19:03] SteenJobs: since devise works based on the resource namespace, using the regular login will be within the user namespace, and the person logging in is not a user + admin, they’re just an admin
[02:22:09] hahuang65: has joined #RubyOnRails
[02:22:38] polyidus: has joined #RubyOnRails
[02:25:34] kies: has joined #RubyOnRails
[02:25:36] hahuang61: has joined #RubyOnRails
[02:27:52] uglybandersnatch: has joined #RubyOnRails
[02:29:59] TheNet: has joined #RubyOnRails
[02:31:41] ascarter: has joined #RubyOnRails
[02:32:43] sonofdirt: has joined #RubyOnRails
[02:37:50] tds5016: okay, now I have a better problem. I'm trying to use accepts_nested_attributes_for... but the class I'm accepting attributes for uses the class I'm giving the attributes to as a delegate.... to put it another way: foo accept_attributes_for :bar, and bar uses delegate :foo
[02:38:11] tds5016: so when I try to update bar through foo in my controller... I get that the delegate is nil.
[02:38:15] tds5016: Any idea how to fix that?
[02:40:36] siaW: has left #RubyOnRails: ()
[02:41:42] blackmesa: has joined #RubyOnRails
[02:43:28] sonofdirt: has joined #RubyOnRails
[02:44:18] yatish27: has joined #RubyOnRails
[02:45:16] IrishGringo: has joined #RubyOnRails
[02:45:32] Kamuela: has joined #RubyOnRails
[02:46:36] Rubie: has joined #RubyOnRails
[02:47:19] pawnbox: has joined #RubyOnRails
[02:49:34] benlieb: has joined #RubyOnRails
[02:55:13] kdough: has joined #RubyOnRails
[02:56:52] ascarter: has joined #RubyOnRails
[02:57:01] TheNet: has joined #RubyOnRails
[02:58:37] kdough1: has joined #RubyOnRails
[03:03:52] kknight: has joined #RubyOnRails
[03:04:26] owenjones: has joined #RubyOnRails
[03:04:41] ascarter: has joined #RubyOnRails
[03:07:49] djbkd: has joined #RubyOnRails
[03:09:05] silentpost: has joined #RubyOnRails
[03:11:40] IrishGringo: has joined #RubyOnRails
[03:14:15] yfeldblum: has joined #RubyOnRails
[03:14:21] sonofdirt: has joined #RubyOnRails
[03:15:05] yfeldblum: has joined #RubyOnRails
[03:17:35] pawnbox: has joined #RubyOnRails
[03:18:15] FLeiXiuS: has joined #RubyOnRails
[03:23:49] halfamind: has joined #RubyOnRails
[03:27:42] fedexo: has joined #RubyOnRails
[03:28:37] Darmani: has joined #RubyOnRails
[03:33:49] NewSoul007: has joined #RubyOnRails
[03:34:14] NewSoul007: has left #RubyOnRails: ()
[03:37:02] spinsus: has joined #RubyOnRails
[03:37:54] yfeldblum: has joined #RubyOnRails
[03:40:07] ascarter: has joined #RubyOnRails
[03:43:10] blackmesa: has joined #RubyOnRails
[03:43:50] johnflux: has joined #RubyOnRails
[03:47:37] pawnbox: has joined #RubyOnRails
[03:54:35] FLeiXiuS: Is it bad to use rails as a proxy for SSO?
[03:54:42] FLeiXiuS: I feel weary about doing so.
[03:54:56] dextertzu: has joined #RubyOnRails
[03:58:54] RegulationD: has joined #RubyOnRails
[03:59:15] chouhoul_: has joined #RubyOnRails
[04:01:28] anicma: has joined #RubyOnRails
[04:05:48] Pupeno: has joined #RubyOnRails
[04:07:48] SteenJobs: has joined #RubyOnRails
[04:09:12] johnflux: has joined #RubyOnRails
[04:11:37] TheGreatGudsby: has joined #RubyOnRails
[04:16:34] merida: has joined #RubyOnRails
[04:16:43] braincrash: has joined #RubyOnRails
[04:20:17] merida_: has joined #RubyOnRails
[04:22:34] Marquel: has joined #RubyOnRails
[04:23:16] treaki_: has joined #RubyOnRails
[04:28:16] DragonPunch: has joined #RubyOnRails
[04:31:50] Pazician: has joined #RubyOnRails
[04:31:52] crameth: has joined #RubyOnRails
[04:34:58] Devalo: has joined #RubyOnRails
[04:41:22] ascarter: has joined #RubyOnRails
[04:41:28] atrius: has joined #RubyOnRails
[04:45:41] [an]onymous: has joined #RubyOnRails
[04:45:59] blackmesa: has joined #RubyOnRails
[04:46:52] pawnbox: has joined #RubyOnRails
[04:51:09] Inside: has joined #RubyOnRails
[04:51:09] Inside: has joined #RubyOnRails
[04:51:27] skeleklin: has joined #RubyOnRails
[04:53:57] yfeldblum: has joined #RubyOnRails
[04:54:13] skeleklin: (awkwardly messages into the void to check that I connected correctly)
[05:04:16] sevenseacat: has joined #RubyOnRails
[05:05:37] griffindy: has joined #RubyOnRails
[05:06:51] skeleklin: If anyone wants to help a newb with laying out model relationships for a class and its inheritors, I've written up a (codeless) Gist of my dilemma: https://gist.github.com/kalynrobinson/4c497aa17f93e9b160b6#file-entityrelationshipnewbhelp-txt
[05:09:44] arup_r: has joined #RubyOnRails
[05:15:49] jobewan: has joined #RubyOnRails
[05:15:59] eyeamaye: has joined #RubyOnRails
[05:16:51] pawnbox: has joined #RubyOnRails
[05:17:42] sudoubuntu: has joined #RubyOnRails
[05:22:31] baweaver: has joined #RubyOnRails
[05:24:13] krz: has joined #RubyOnRails
[05:31:22] AntiSpamMeta: has joined #RubyOnRails
[05:34:34] neanderslob_: has joined #RubyOnRails
[05:37:24] rakm: has joined #RubyOnRails
[05:41:07] benlieb: has joined #RubyOnRails
[05:47:18] blackmesa: has joined #RubyOnRails
[05:55:36] davee_: has joined #RubyOnRails
[05:56:34] pawnbox: has joined #RubyOnRails
[05:58:43] choke: has joined #RubyOnRails
[05:58:58] davee_: has joined #RubyOnRails
[05:59:43] RegulationD: has joined #RubyOnRails
[05:59:57] hahuang61: has joined #RubyOnRails
[06:00:23] User458764: has joined #RubyOnRails
[06:01:28] davee_: has joined #RubyOnRails
[06:03:03] jenrzzz: has joined #RubyOnRails
[06:03:40] Rubie: has joined #RubyOnRails
[06:03:56] mank: has joined #RubyOnRails
[06:04:01] davee__: has joined #RubyOnRails
[06:06:36] davee__: has joined #RubyOnRails
[06:06:57] Pupeno: has joined #RubyOnRails
[06:07:04] euphoriaa: has joined #RubyOnRails
[06:07:46] Brando753: has joined #RubyOnRails
[06:08:19] djbkd: has joined #RubyOnRails
[06:08:30] baweaver: has joined #RubyOnRails
[06:10:16] braincra-: has joined #RubyOnRails
[06:19:20] tjbiddle: has joined #RubyOnRails
[06:19:29] apotry: has joined #RubyOnRails
[06:23:14] Balzrael: has joined #RubyOnRails
[06:25:04] sudoubuntu: has joined #RubyOnRails
[06:27:35] krz: has joined #RubyOnRails
[06:29:39] uglybandersnatch: has joined #RubyOnRails
[06:31:08] aganov: has joined #RubyOnRails
[06:36:18] pawnbox: has joined #RubyOnRails
[06:45:00] yatish27: has joined #RubyOnRails
[06:45:36] yfeldblum: has joined #RubyOnRails
[06:47:40] epitron: has joined #RubyOnRails
[06:48:42] blackmesa: has joined #RubyOnRails
[06:50:35] njero: has joined #RubyOnRails
[06:52:42] dionysus69: has joined #RubyOnRails
[06:52:56] neanderslob_: has joined #RubyOnRails
[06:56:19] tildes: has joined #RubyOnRails
[06:58:36] s2013: has joined #RubyOnRails
[07:06:15] pawnbox: has joined #RubyOnRails
[07:11:29] sudoubuntu: has joined #RubyOnRails
[07:20:00] User458764: has joined #RubyOnRails
[07:22:08] norc_: has joined #RubyOnRails
[07:22:31] defsdoor: has joined #RubyOnRails
[07:23:40] smoitra: has joined #RubyOnRails
[07:24:26] baweaver: has joined #RubyOnRails
[07:25:37] SteenJobs: has joined #RubyOnRails
[07:27:27] jenrzzz: has joined #RubyOnRails
[07:29:15] benlieb: has joined #RubyOnRails
[07:30:16] davee__: has joined #RubyOnRails
[07:31:53] scepticulous: has joined #RubyOnRails
[07:32:13] ascarter: has joined #RubyOnRails
[07:32:56] Cohedrin: has joined #RubyOnRails
[07:35:00] chipotle: has joined #RubyOnRails
[07:35:18] hightower2: has joined #RubyOnRails
[07:36:10] pawnbox: has joined #RubyOnRails
[07:40:22] krz: has joined #RubyOnRails
[07:42:51] ascarter: has joined #RubyOnRails
[07:42:51] drupald: has joined #RubyOnRails
[07:43:05] helpa: has joined #RubyOnRails
[07:45:02] edwinvdgraaf: has joined #RubyOnRails
[07:45:50] ascarter: has joined #RubyOnRails
[07:49:04] pawnbox: has joined #RubyOnRails
[07:50:05] blackmesa: has joined #RubyOnRails
[07:51:26] lxsameer: has joined #RubyOnRails
[07:56:19] sergey_makagon: has joined #RubyOnRails
[07:57:27] scepticulous: has joined #RubyOnRails
[08:00:31] RegulationD: has joined #RubyOnRails
[08:00:37] hahuang61: has joined #RubyOnRails
[08:04:32] Dimik: has joined #RubyOnRails
[08:06:20] DoubleMalt: has joined #RubyOnRails
[08:07:45] Pupeno: has joined #RubyOnRails
[08:09:46] navo: has joined #RubyOnRails
[08:18:43] darutoko: has joined #RubyOnRails
[08:19:27] arup_r: has joined #RubyOnRails
[08:21:32] Spami_: has joined #RubyOnRails
[08:28:20] shibly: has joined #RubyOnRails
[08:29:51] shibly: has left #RubyOnRails: ()
[08:31:14] Devalo: has joined #RubyOnRails
[08:33:10] Pazician: has joined #RubyOnRails
[08:35:18] gokulnath: has joined #RubyOnRails
[08:38:25] fox_mulder_cp: hi. i have a ansible playbook, which called from delayed_job gem task. if i start playbook from bash - it works fine, when i try start playbook from job - i see ssh connect error. app run under my credentials.
[08:39:44] rogue_koder: has joined #RubyOnRails
[08:39:56] mank: has joined #RubyOnRails
[08:39:58] yfeldblum: has joined #RubyOnRails
[08:40:29] rogue_koder: has joined #RubyOnRails
[08:42:12] merida: has joined #RubyOnRails
[08:42:44] mank: has joined #RubyOnRails
[08:44:05] shibly: has joined #RubyOnRails
[08:44:41] dtzuzu: has joined #RubyOnRails
[08:44:48] shibly: has left #RubyOnRails: ()
[08:45:20] tvw: has joined #RubyOnRails
[08:45:21] edwinvdgraaf: has joined #RubyOnRails
[08:46:06] TvL2386: has joined #RubyOnRails
[08:48:03] scepticulous: has joined #RubyOnRails
[08:48:48] edwinvdg_: has joined #RubyOnRails
[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:26] marr: has joined #RubyOnRails
[08:51:30] blackmesa: has joined #RubyOnRails
[08:51:49] flappynerd: but it doesn't say what (if any) controller handles it, it just says INFO: omniauth (foo) request phase initiated
[08:52:03] makknife: has joined #RubyOnRails
[08:54:32] defsdoor: has joined #RubyOnRails
[08:55:13] Trynemjoel: has joined #RubyOnRails
[08:57:24] artto: has joined #RubyOnRails
[08:57:52] mytrile: has joined #RubyOnRails
[08:58:14] mytrile: Hey guys, is there an easy way to test controller with routes IP constraint
[08:58:43] mark2: has joined #RubyOnRails
[09:00:52] valetudo: has joined #RubyOnRails
[09:03:07] quazimodo: has joined #RubyOnRails
[09:07:50] tjbiddle_: has joined #RubyOnRails
[09:11:47] arup_r: has joined #RubyOnRails
[09:17:12] fox_mulder_cp: hm. %x(ssh host 'date') seems zero output
[09:20:17] quazimodo: I can't decide
[09:21:14] quazimodo: it's hard to tell for me if it's quicker or more maintainable to build my responsive pages separately and let rails decide what to send to the device, or to style it with css & lots of JS to repurpose/position controls and elements to make sense in mobile or web views
[09:21:34] blackmesa: has joined #RubyOnRails
[09:28:12] artto: has joined #RubyOnRails
[09:37:44] nibbo_: has joined #RubyOnRails
[09:39:36] euphoriaa: has joined #RubyOnRails
[09:39:52] eyck: has joined #RubyOnRails
[09:39:52] Pupeno: has joined #RubyOnRails
[09:41:46] Vircung: has joined #RubyOnRails
[09:43:50] atrius: has joined #RubyOnRails
[09:43:56] fernandomm: has joined #RubyOnRails
[09:45:25] matthias_: has joined #RubyOnRails
[09:46:33] dtzuzu: has joined #RubyOnRails
[09:46:43] Cork: has joined #RubyOnRails
[09:47:45] eyck_: has joined #RubyOnRails
[09:50:24] moeabdol1: has joined #RubyOnRails
[09:50:42] edwinvdgraaf: has joined #RubyOnRails
[09:51:26] merida_: has joined #RubyOnRails
[09:57:44] s2013: has joined #RubyOnRails
[10:01:14] RegulationD: has joined #RubyOnRails
[10:01:18] artto: has joined #RubyOnRails
[10:02:29] hahuang61: has joined #RubyOnRails
[10:04:56] srinidhi: has joined #RubyOnRails
[10:06:01] qejk: has joined #RubyOnRails
[10:08:29] gingray: has joined #RubyOnRails
[10:08:40] artto: has joined #RubyOnRails
[10:13:07] scepticulous: has joined #RubyOnRails
[10:15:49] User458764: has joined #RubyOnRails
[10:22:37] srinidhi: has joined #RubyOnRails
[10:25:32] FLeiXiuS: I have an XHR request thats always returning 404
[10:25:40] FLeiXiuS: Even though I can navigate to the site locally.
[10:25:56] sevenseacat: what do your logs say?
[10:26:48] FLeiXiuS: sevenseacat, http://pastie.org/10773261 is the request.
[10:27:16] sevenseacat: good to know, but not what i asked
[10:27:22] sandstrom: has joined #RubyOnRails
[10:27:41] FLeiXiuS: sevenseacat, I think I got it.
[10:28:11] FLeiXiuS: sevenseacat, Its sending as type OPTIONS
[10:28:48] sevenseacat: not according to that code, unless you're dealing with a cross-origin preflight check
[10:28:54] sergey_makagon: has joined #RubyOnRails
[10:29:37] FLeiXiuS: sevenseacat, I dont have any known middle ware.
[10:29:54] sevenseacat: also good to know, but not related to what I said
[10:30:27] sevenseacat: you're making an ajax request to a random IP address - is that the url you're using for your own site?
[10:30:44] sevenseacat: if not, then you're making a cross-origin request
[10:31:07] FLeiXiuS: It's not - so I'm suspecting COR is the killer.
[10:31:24] sevenseacat: yes, the preflight check is an OPTIONS request.
[10:31:32] uglybandersnatch: has joined #RubyOnRails
[10:32:46] beauby: has joined #RubyOnRails
[10:34:04] FLeiXiuS: sevenseacat, Ideally, I can wildcard the ACL header?
[10:34:28] sevenseacat: i don't know what you mean by that, sorry
[10:34:42] Pazician: has joined #RubyOnRails
[10:35:04] FLeiXiuS: Sorry, there's a request header Access-Control-Allow-Origin
[10:36:43] FLeiXiuS: sevenseacat, Meh, apparently not. That or my headers arent being set correctly
[10:36:58] fox_mulder_cp: hi again. i have ssh-agent with my private key loaded on host, where rails app. i try to start ssh command from delayed_job gem task, but see, that no SSH_AUTH_SOCK and SSH_AGENT_PID variables.
[10:37:04] sevenseacat: sounds like opening a security hole to me
[10:37:22] fox_mulder_cp: how to load it from my ~/.agent file into task environment
[10:37:36] sevenseacat: but cors isnt something I'm super familiar with - just enough to know it's a thing
[10:37:41] robbyoconnor: has joined #RubyOnRails
[10:44:10] Guest72543: has joined #RubyOnRails
[10:44:51] FLeiXiuS: sevenseacat, That makes two of us.
[10:45:45] artto: has joined #RubyOnRails
[10:48:36] FLeiXiuS: sevenseacat, Even using a localhost url, it's still sending an options request. Rawr.
[10:48:49] edwinvdgraaf: has joined #RubyOnRails
[10:49:16] sevenseacat: if its a different domain, it will happen
[10:51:05] fox_mulder_cp: if i try ruby with script 'a = `ssh host 'date'`' and ruby ssh.rb - all seems ok
[10:52:46] Devalo: has joined #RubyOnRails
[10:59:00] lxsameer: has joined #RubyOnRails
[11:01:27] htmldrum_: has joined #RubyOnRails
[11:01:27] htmldrum: has joined #RubyOnRails
[11:02:48] AimlessRAven: has joined #RubyOnRails
[11:03:23] AimlessRAven: hi all, i have products and orders, whats is the good way to find most selling product, aka product with most orders.count
[11:05:17] fox_mulder_cp: alethea: product.orders.count ?
[11:05:19] mdw: has joined #RubyOnRails
[11:05:48] patrick-sartent: has joined #RubyOnRails
[11:05:55] AimlessRAven: fox_mulder_cp: yea, but if i wanna show top 5 selling products
[11:07:20] rubyonrails213: has joined #RubyOnRails
[11:08:41] aganov: has joined #RubyOnRails
[11:08:47] blackmesa: has joined #RubyOnRails
[11:15:01] User458764: has joined #RubyOnRails
[11:17:27] flappynerd: has left #RubyOnRails: ("Leaving")
[11:18:10] AimlessRAven: arup_r: can i ask you something
[11:19:31] fox_mulder_cp: AimlessRaven: SomeModel.last(5) # last 5 records in ascending order
[11:19:34] fox_mulder_cp: SomeModel.last(5).reverse # last 5 records in descending order
[11:20:09] fox_mulder_cp: AimlessRaven: first qa on SO by google://"active record select top 5" ^)
[11:20:54] sevenseacat: fox_mulder_cp: and yet you totally missed the point of their question
[11:21:27] sevenseacat: fox_mulder_cp: how does your solution help them find the best selling products by order count?
[11:25:28] valetudo: has joined #RubyOnRails
[11:25:40] Pupeno: has joined #RubyOnRails
[11:28:04] FooMunki: has joined #RubyOnRails
[11:28:23] G: has joined #RubyOnRails
[11:33:14] RedDwarf: has joined #RubyOnRails
[11:37:07] futilegames: has joined #RubyOnRails
[11:38:06] mank: has joined #RubyOnRails
[11:39:29] mank: has joined #RubyOnRails
[11:42:00] TheGreatGudsby: has joined #RubyOnRails
[11:42:58] mank: has joined #RubyOnRails
[11:45:06] snowy: has joined #RubyOnRails
[11:48:04] dtzuzu: has joined #RubyOnRails
[11:49:07] mdw: has joined #RubyOnRails
[11:51:58] s2013: has joined #RubyOnRails
[11:55:43] pawnbox: has joined #RubyOnRails
[11:57:11] chipotle: has joined #RubyOnRails
[11:57:56] AimlessRAven: has joined #RubyOnRails
[11:58:31] AimlessRAven: can anyone help me to create db request to find 5 most selling products find by orders.count
[12:01:25] AzaToth: has joined #RubyOnRails
[12:01:54] RegulationD: has joined #RubyOnRails
[12:03:15] hahuang61: has joined #RubyOnRails
[12:03:32] htmldrum_: has joined #RubyOnRails
[12:03:33] htmldrum: has joined #RubyOnRails
[12:03:39] tknz: has joined #RubyOnRails
[12:03:46] tbuehlmann: AimlessRaven: so you want a result set having all products with their corresponding orders, then group them by product id and selecting an orders_count
[12:07:00] _Tariq: has joined #RubyOnRails
[12:08:25] gokulnath: has joined #RubyOnRails
[12:10:06] AimlessRAven: tbuehlmann: how this looks like
[12:10:34] jottr: has joined #RubyOnRails
[12:11:33] sevenseacat: its not really an example if you want them to write the code for you
[12:12:09] Trynemjoel: has joined #RubyOnRails
[12:12:35] tbuehlmann: what's the exact association you have? we can do that step by step
[12:12:37] arup_r: AimlessRaven: Product.joins(:orders).groups('orders.product_id').select("orders.product_id, COUNT(orders.product_id)") something like...
[12:13:10] arup_r: if you have association between Product and Order like 1:N ..
[12:13:27] AimlessRAven: now i try this code
[12:13:42] tbuehlmann: I'm out, let arup_r help you
[12:15:15] context: why are you select()ing? just use count()
[12:15:43] AimlessRAven: arup_r: mm dont work,
[12:15:51] AimlessRAven: i have association, i can use @product.orders
[12:15:55] AimlessRAven: but this request dont work
[12:16:08] context: Order.group(:product_id).count ?
[12:16:12] jottr: Hi everyone. Is there a faster, more efficient way of selecting a large amount of entries from a db? I'm doing `User.where(newsletter: true)`, which is really slow on a large set.
[12:16:54] context: http://guides.rubyonrails.org/active_record_querying.html#retrieving-multiple-objects-in-batches
[12:17:00] arup_r: AimlessRaven: did you get error?
[12:17:21] context: jottr: although im guessing you probably dont need ALL of those users in the first place
[12:17:22] AimlessRAven: arup_r: no, but when i put my variable in pry, dont show my products
[12:17:47] AimlessRAven: arup_r: i need to request 5 product with most orders
[12:18:00] context: do 2 queries.
[12:18:04] arup_r: yeah, I left `.having` to add for you..
[12:18:07] jottr: context: Well, I only need those with newsletter: true
[12:18:41] arup_r: or, you can also order by final result and then limit(5) ..
[12:18:58] context: http://guides.rubyonrails.org/active_record_querying.html#retrieving-multiple-objects-in-batches
[12:19:07] arup_r: AimlessRaven: not needed having, order by the count and limit(5) will give you
[12:19:25] context: Order.group(:product_id).order("COUNT(product_id)").count[0..5]
[12:19:26] _Tariq: has joined #RubyOnRails
[12:19:42] arup_r: context: he needs products I think
[12:19:45] context: Product.where(id: ^^those_damn_ids).all
[12:19:48] jottr: context: thx a bunch
[12:19:50] AimlessRAven: arup_r: so this will looks like this @top_products = Sellor::Product.joins(:orders).group('orders.product_id').select("orders.product_id, COUNT(orders.count)").limit(5)
[12:19:53] context: yeah... so use Product...
[12:19:54] quazimodo: has joined #RubyOnRails
[12:20:08] context: you don't have to do every_damn_thing in one query
[12:20:14] arup_r: AimlessRaven: close, but you need a orders also then limit
[12:20:50] arup_r: You will order the result of group by in decending order and the take top 5 from it by `limit(5)`
[12:20:51] context: and stop joining the tables. you just slowed down your query by like 3x probably
[12:21:31] context: also, 1 query is not always faster than >1
[12:21:59] arup_r: context: so you meant, make thr group in order table, then get the product ids for maximum sell and the use those product id to fetch products from Product model using `IN`?
[12:22:20] AimlessRAven: arup_r: i dont know how this looks like
[12:22:23] arup_r: so 2 query. Not bad idea though
[12:23:54] arup_r: AimlessRaven: Order.group(:product_id).select("COUNT(product_id) AS product_count, product_id").order('product_count').limit(5)
[12:24:20] arup_r: this gives you top 5 product id, if I am not mistaken.. untested though
[12:24:37] arup_r: or explicit .order('product_count DSEC').limit(5)
[12:25:33] arup_r: then save those product ids in a var like product_ids = Order.group(:product_id).select("COUNT(product_id) AS product_count, product_id").order('product_count DSEC').limit(5).map(&:id)
[12:25:48] arup_r: then Product.where(id: product_ids)
[12:26:04] arup_r: context: is this what you said?
[12:26:06] sevenseacat: doesnt retain order of products by order count.
[12:27:58] arup_r: sevenseacat: where it needs fix? without rails console hard to pass though.. :)
[12:28:27] sevenseacat: i dont believe in spoonfeeding complete answers to people, so
[12:29:43] AimlessRAven: this dont work, odnt show my top 5 products
[12:30:19] sevenseacat: especially when the people requesting complete answers are this unhelpful
[12:34:10] context: no reason to use select() at all
[12:34:29] sonofdirt: has joined #RubyOnRails
[12:35:06] acosonic_: has joined #RubyOnRails
[12:35:18] arup_r: context: then db throws error when there is not select clause but you used GROUP By
[12:35:39] fox_mulder_cp: wow. me add ansible task running from rails background task
[12:35:53] context: well when you do group() stop doing .all and you an aggregate such as........... count?
[12:36:15] context: 07:19 context| Order.group(:product_id).order("COUNT(product_id)").count[0..5]
[12:36:31] context: 15 minutes ago. you can get somewhere with that. see the .count
[12:36:32] arup_r: hm. context then how would you pick the `id`?
[12:36:38] edwinvdgraaf: has joined #RubyOnRails
[12:36:49] context: you see the .group()
[12:36:51] arup_r: I have to try now.
[12:36:52] context: it says product_id
[12:37:10] arup_r: Yes I saw
[12:37:15] context: api.ror.org sucks cause you cant copy links
[12:37:26] sonofdirt: has joined #RubyOnRails
[12:38:08] context: http://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-count
[12:38:19] arup_r: I need to try the query, I have not used that format. Order.group(:product_id).order("COUNT(product_id)").count gives { product_id: counts, .. } like that I think, right?
[12:38:24] sevenseacat: sure you can, thats what the 'link' link is for
[12:38:35] context: arup_r: correct.
[12:38:51] FCser: Hmm I have a new has_many :through association that is not saving. Triple checked and I think everything is setup correctly - params are correct but it just does not save.... http://pastie.org/10773333
[12:39:02] arup_r: and now how are we doing there top 5?
[12:39:07] arup_r: ok... order
[12:39:08] lorn: has joined #RubyOnRails
[12:39:26] arup_r: on Hash we are calling [0..5] ..
[12:39:54] context: ... its an example
[12:40:06] context: limit(5) should work
[12:40:07] sevenseacat: fcser: what do your logs say when you make the request to save?
[12:40:10] context: then just use them all
[12:40:28] johnflux: has joined #RubyOnRails
[12:40:34] FCser: sevenseacat: They save the Minimum night stay - it seems the association is not even acknowledged
[12:40:35] arup_r: context: [0..5] on hash gives a `nil`
[12:40:37] FCser: no errors
[12:40:41] context: or ignore me
[12:40:46] sevenseacat: fcser: thats not what i asked. please gist the logs.
[12:41:15] arup_r: context: but .map(&:first) with your code should work
[12:41:23] arup_r: instead of [0..5]
[12:43:18] artto: has joined #RubyOnRails
[12:43:27] drptbl: has joined #RubyOnRails
[12:43:29] flashpoint9: has joined #RubyOnRails
[12:44:00] FCser: sevenseacat: https://gist.github.com/anonymous/7e251e8ae42d5cc4aaf1
[12:51:47] krz: has joined #RubyOnRails
[12:52:57] TheNet: has joined #RubyOnRails
[12:54:18] context: arup_r: .keys works too
[12:54:35] arup_r: hm. that is elegant
[12:54:43] arup_r: forgot that
[12:56:40] halfamind: has joined #RubyOnRails
[12:57:27] yos7ph: has joined #RubyOnRails
[13:00:07] pixelhandler: has joined #RubyOnRails
[13:00:22] FCser: Any other logs? I think that's all that's relevant
[13:01:58] context: do you have accepts_nested_attributes_for ?
[13:02:07] FCser: I have not tried that yet
[13:02:16] FCser: will give it a go, from what I read it wasn't required
[13:03:14] futilegames: has joined #RubyOnRails
[13:04:36] context: probably not
[13:04:43] context: how are you storing room_ids ?
[13:04:47] context: in a join table ?
[13:05:40] tildes: has joined #RubyOnRails
[13:06:06] stannard: has joined #RubyOnRails
[13:07:34] FCser: Yes a join tablecalled room_minimums with minimum_night_stay_id and room_id
[13:08:04] FCser: the migration is in the list here http://pastie.org/10773333
[13:08:21] FCser: I've recreated this from scratch multiple times - there must be some simple thing I'm overlooking
[13:08:58] FCser: I tried adding accepts_nested_attributes to the models but nothing appears to save yet. Will check into that more it must be related...
[13:09:00] context: if its a model you need accepts_nested_for
[13:09:28] context: but it problably needs to be room_minimums[][:room_id]
[13:09:30] context: in the form
[13:09:43] context: or define your own room_ids= in the model
[13:10:19] theblang: has joined #RubyOnRails
[13:10:22] dionysus69: has joined #RubyOnRails
[13:10:44] AimlessRAven: has joined #RubyOnRails
[13:10:48] matthias_: has joined #RubyOnRails
[13:10:55] arup_r: has joined #RubyOnRails
[13:11:18] _Tariq: has joined #RubyOnRails
[13:11:18] AimlessRAven: hi all, @order_items = Sellor::OrderItem.group(:variant).count now i find my variant, now i wanna group this query by product
[13:12:11] sypheren: has joined #RubyOnRails
[13:12:31] FCser: context: thanks - I'll check into doing those as well - it's using 'collection_check_boxes' so I thought the name attributes would 'just work'
[13:12:44] context: oh, never heard of that :x
[13:13:13] context: fcser: in that case maybe ignore everything i said, haha
[13:13:35] FCser: still helps me double check stuff thanks
[13:13:42] chouhoulis: has joined #RubyOnRails
[13:15:02] _Tariq: has joined #RubyOnRails
[13:15:14] Trynemjoel: has joined #RubyOnRails
[13:15:31] chipotle: has joined #RubyOnRails
[13:16:40] _Tariq: has joined #RubyOnRails
[13:17:02] Pupeno: has joined #RubyOnRails
[13:17:14] B4daBing73: has joined #RubyOnRails
[13:17:15] drbayer: has joined #RubyOnRails
[13:19:49] mwlang: has joined #RubyOnRails
[13:20:19] USvER: has joined #RubyOnRails
[13:20:50] silentpost: has joined #RubyOnRails
[13:22:44] j3r0: has joined #RubyOnRails
[13:23:52] Rubie: has joined #RubyOnRails
[13:24:01] th0m_: has joined #RubyOnRails
[13:25:26] mwlang: hmm…I have working code that breaks when I attempt to place it under rspec. Is there something special about the session variable in controllers that keeps me from using Hash’s #fetch as expected? https://gist.github.com/mwlang/8cd2b091211cd66a895d
[13:26:27] mwlang: when I test that session is a hash in the rspec, I get a pass for that, so I’m at a loss as to why fetch is complaining on 2 for 1 params passed.
[13:27:30] USvER: Guyz, how one can add validation rules in runtime based on model instance itself?
[13:28:05] USvER: self.class.send :validates .... addind validation to all instances
[13:28:26] USvER: But i want to add only for current instance
[13:28:50] stannard: has joined #RubyOnRails
[13:29:08] _Tariq_: has joined #RubyOnRails
[13:30:25] USvER: I guess i've found my unswer. singleton_class instead of class
[13:30:31] mwlang: USvER: I think I would just do a before_validation :something_fancy_with_this_instance and conditionally do evaluation when it’s triggered based on whatever the circumstance is you’re trying to do this.
[13:30:56] USvER: mwlang i try to implement dynamic attributes
[13:31:16] USvER: mwlang ans schema is stored in the db
[13:31:52] mwlang: ah, so I guess you’re meta programming your models.
[13:32:26] treaki: has joined #RubyOnRails
[13:32:41] rogue_koder: has joined #RubyOnRails
[13:33:52] AimlessRAven: @order_items = Sellor::OrderItem.group(:variant).count, how to group this by product, rails tell me undefined method for hash if i try 1 more .group(:product)
[13:36:42] crystal77: has joined #RubyOnRails
[13:38:32] sudoubuntu: has joined #RubyOnRails
[13:42:54] dvinciguerra: has joined #RubyOnRails
[13:44:34] sonofdirt: has joined #RubyOnRails
[13:45:27] roshanavand: has joined #RubyOnRails
[13:45:55] akshat: has joined #RubyOnRails
[13:46:20] mdw: has joined #RubyOnRails
[13:46:36] halfamind1: has joined #RubyOnRails
[13:48:18] GeorgesLeYeti: has joined #RubyOnRails
[13:48:39] GeorgesLeYeti: I have an issue with htmltoword gem.
[13:48:49] GeorgesLeYeti: https://gist.github.com/GeorgesLeYeti/2423fd2be6b21f086cfa
[13:48:50] dtzuzu: has joined #RubyOnRails
[13:48:52] AimlessRAven: @order_items = Sellor::OrderItem.group(:variant).count how to group this by product
[13:49:08] AimlessRAven: this is hash, and i cant user again group, any suggestions ?
[13:49:12] fexilal: has joined #RubyOnRails
[13:49:42] GeorgesLeYeti: The result in HTML is: Hello World RoR! (with World in bold)
[13:50:06] htmldrum_: has joined #RubyOnRails
[13:50:06] htmldrum: has joined #RubyOnRails
[13:50:40] GeorgesLeYeti: But in my word document the result is: Hello WorldRor!
[13:50:58] GeorgesLeYeti: It didn't that the space between World and RoR!
[13:51:57] fexilal: GeorgesLeYeti : gist?
[13:52:38] GeorgesLeYeti: I try to gsub spaces by &nbsp; but word is considering it as a character so it didn't break line between words
[13:52:45] GeorgesLeYeti: fexilal: https://gist.github.com/GeorgesLeYeti/2423fd2be6b21f086cfa
[13:53:45] yellow5: has joined #RubyOnRails
[13:55:48] GeorgesLeYeti: http://pastebin.com/Zg27rTxp
[13:56:41] GeorgesLeYeti: http://pastie.org/10773412
[13:57:09] AimlessRAven: @order_items = Sellor::OrderItem.group(:variant).count,, how to group this result again by product
[13:58:35] phredus: has joined #RubyOnRails
[14:00:04] flashpoint9: has joined #RubyOnRails
[14:01:46] fexilal: GeorgesLeYeti : try moving the space from between the </strong> and </test> to after World
[14:02:47] RegulationD: has joined #RubyOnRails
[14:04:00] hahuang61: has joined #RubyOnRails
[14:07:32] stannard: has joined #RubyOnRails
[14:08:19] hxegon: has joined #RubyOnRails
[14:08:34] AimlessRAven: how to make double db request
[14:08:41] AimlessRAven: select in select
[14:09:24] fexilal: AimlessRaven : do you mean nested queries?
[14:09:38] AimlessRAven: @order_items = Sellor::OrderItem.group(:variant).count
[14:09:42] AimlessRAven: but this return me hash
[14:09:49] AimlessRAven: i need this result to group by product
[14:13:11] AimlessRAven: fexilal: any idea
[14:13:33] gabr13l: has joined #RubyOnRails
[14:14:08] pwnd_nsfw: http://imgur.com/XoYsoBm
[14:14:47] pwnd_nsfw: Wrong channel
[14:14:53] smathy: has joined #RubyOnRails
[14:15:00] sevenseacat: there's so many of those oreilly covers going around
[14:15:06] fexilal: saved though. thanks =
[14:15:36] fexilal: AimlessRaven: a little more information would help
[14:16:28] AimlessRAven: fexilal: ok, i have order_items, and i group this order item by variant.count
[14:16:37] AimlessRAven: now this result @order_items = Sellor::OrderItem.group(:variant).count
[14:16:40] jottr: I'm still struggling with using CSV::Table.delete_if . Not sure what I am doing wrong. https://git.io/vajUL Maybe someone could have a look?
[14:16:44] AimlessRAven: i need to group by product
[14:16:58] AimlessRAven: but this result is hash, and i cant group hash
[14:17:40] smathy: jottr, that's nothing to do with Rails, go learn ruby.
[14:17:50] jottr: smathy: sorry wrong channel then
[14:18:32] rogue_koder: has joined #RubyOnRails
[14:19:29] systemsgotyou: has joined #RubyOnRails
[14:19:59] AimlessRAven: arup_r: do you know how ?
[14:20:24] arup_r: No, I said you that time, but didn't get any responses, So I gave up.
[14:22:19] AimlessRAven: okey :) thanks
[14:24:27] rogue_koder: has joined #RubyOnRails
[14:24:55] sandstrom: has joined #RubyOnRails
[14:27:46] chipotle: has joined #RubyOnRails
[14:29:37] sypheren: has joined #RubyOnRails
[14:29:53] davee__: has joined #RubyOnRails
[14:30:11] trinaldi: has joined #RubyOnRails
[14:31:26] meoblast001: has joined #RubyOnRails
[14:31:55] arBmind: has joined #RubyOnRails
[14:33:04] uglybandersnatch: has joined #RubyOnRails
[14:34:07] treehug88: has joined #RubyOnRails
[14:36:03] Pazician: has joined #RubyOnRails
[14:39:55] jobewan: has joined #RubyOnRails
[14:40:03] adam|: has left #RubyOnRails: ()
[14:40:18] adam12: has joined #RubyOnRails
[14:44:39] krz: has joined #RubyOnRails
[14:45:34] tubbo: hey folks, i'm having some issues getting started with parallel_tests on elasticsearch.
[14:46:11] tubbo: using elasticsearch-rails and elasticsearch-persistence to index stuff, we have our own IndexManager class that defines a class method called current_index_prefix. this method is used to prefix all index names with the name of the site, its locale, and the test number.
[14:46:18] tubbo: err, the $TEST_NUMBER, from ENV.
[14:46:37] tubbo: however, in all i've been able to observe i can't get $TEST_NUMBER to not be blank.
[14:46:48] Pupeno: has joined #RubyOnRails
[14:47:54] mank: has joined #RubyOnRails
[14:49:52] tubbo: https://gist.github.com/tubbo/c70e3803197a27143b87
[14:50:52] htmldrum: has joined #RubyOnRails
[14:50:56] htmldrum_: has joined #RubyOnRails
[14:51:32] adavia: has joined #RubyOnRails
[14:53:59] Devalo: has joined #RubyOnRails
[14:54:29] epochwolf: tubbo: looks like the environment isn't being carried over.
[14:55:00] tubbo: it's actually $TEST_ENV_NUMBER because i can has documentation
[14:55:08] tubbo: what a shitty named var
[14:55:12] tubbo: ENV['TEST_ENV_NUMBER'] gfy
[14:57:31] mary5030: has joined #RubyOnRails
[14:57:35] mdw: has joined #RubyOnRails
[14:58:16] mary5030: has joined #RubyOnRails
[14:59:36] mdw7: has joined #RubyOnRails
[15:00:17] User458764: has joined #RubyOnRails
[15:02:56] jtong_: has joined #RubyOnRails
[15:03:03] crankharder: anyone know a way to prefix elasticsearch so that I can separate dev and test indices?
[15:03:51] Burlan: has joined #RubyOnRails
[15:07:01] Rubie: has joined #RubyOnRails
[15:07:43] diegoaguilar: has joined #RubyOnRails
[15:07:43] tbuehlmann: crankharder: I strongly believe tubbo can help you with this
[15:08:01] tjbiddle: has joined #RubyOnRails
[15:09:21] griffindy: has joined #RubyOnRails
[15:10:30] dionysus69: has joined #RubyOnRails
[15:11:32] epochwolf: ACTION gives tbuehlmann a cookie
[15:17:39] mdw: has joined #RubyOnRails
[15:18:15] siaW: has joined #RubyOnRails
[15:18:32] disgrntld: has joined #RubyOnRails
[15:18:53] siaW: does it make sense to have a year attribute of some model to be of type string?
[15:19:08] siaW: i’m reading someone’s code on github and they have something like that
[15:19:21] siaW: i was thinking year attribute should be of type integer
[15:21:01] tbuehlmann: as a year can be subject to arithmetic calculations, I'd prefer an integer over a string
[15:21:24] mark2: has left #RubyOnRails: ()
[15:21:32] siaW: just as i thought
[15:21:41] smathy: I've had it as a string before, when it's really just a label.
[15:23:18] mank: has joined #RubyOnRails
[15:24:46] mank: has joined #RubyOnRails
[15:28:52] Ergo: has joined #RubyOnRails
[15:29:57] ecnalyr: has joined #RubyOnRails
[15:30:04] lxsameer: has joined #RubyOnRails
[15:32:31] halfamind: has joined #RubyOnRails
[15:32:51] siaW: in a rails controller for the index method there could be something like this
[15:33:00] siaW: @users = User.all
[15:33:10] Trynemjoel: has joined #RubyOnRails
[15:33:21] siaW: is there a better way to write this?
[15:33:28] pwnd_nsfw: how do you mean...
[15:33:31] tbuehlmann: what's wrong with it?
[15:33:34] pwnd_nsfw: depends on what you want from the User model
[15:33:43] pwnd_nsfw: if you want all of the records, I can't see a better way heh
[15:34:05] siaW: ah i see
[15:34:47] pwnd_nsfw: User.where.not(id: nil)
[15:35:37] siaW: more efficient :D :D :D
[15:35:48] KensoDev: has joined #RubyOnRails
[15:36:23] hotpancakes: has joined #RubyOnRails
[15:39:32] smathy: siaw, more efficient how?
[15:39:33] RegulationD: has joined #RubyOnRails
[15:39:43] siaW: i was being sarcastic ;)
[15:40:26] smathy: ACTION chooses to believe the whole question was sarcasm
[15:40:46] acosonic_: has joined #RubyOnRails
[15:41:29] speakingcode: has joined #RubyOnRails
[15:42:27] speakingcode: has left #RubyOnRails: ()
[15:43:24] Trynemjoel: has joined #RubyOnRails
[15:45:06] halfamind: has joined #RubyOnRails
[15:45:42] mois3x: has joined #RubyOnRails
[15:45:49] epochwolf: siaw: what are you trying to do with all users?
[15:46:01] siaW: display them
[15:47:55] Rubie: has joined #RubyOnRails
[15:48:19] epochwolf: siaw: all on the same page at once?
[15:48:20] Uber|Dragon: has joined #RubyOnRails
[15:48:38] siaW: paginated
[15:49:00] epochwolf: Then just load the subset you need for each page.
[15:49:37] dtzuzu: has joined #RubyOnRails
[15:50:34] polishdub: has joined #RubyOnRails
[15:51:05] pawnbox: has joined #RubyOnRails
[15:51:33] pawnbox: has joined #RubyOnRails
[15:51:38] htmldrum: has joined #RubyOnRails
[15:51:40] htmldrum_: has joined #RubyOnRails
[15:52:30] arBmind1: has joined #RubyOnRails
[15:56:45] mank: has joined #RubyOnRails
[15:57:51] mank: has joined #RubyOnRails
[15:59:10] kdough: has joined #RubyOnRails
[16:01:22] halfamind: has joined #RubyOnRails
[16:02:02] arup_r: has joined #RubyOnRails
[16:02:42] halfamind1: has joined #RubyOnRails
[16:04:45] hahuang61: has joined #RubyOnRails
[16:07:20] krz: has joined #RubyOnRails
[16:07:24] drbayer: has joined #RubyOnRails
[16:09:09] halfamind: has joined #RubyOnRails
[16:09:48] pixelhan_: has joined #RubyOnRails
[16:10:32] tlarevo: has joined #RubyOnRails
[16:11:14] pawnbox: has joined #RubyOnRails
[16:11:39] Trynemjoel: has joined #RubyOnRails
[16:14:32] dvinciguerra: has joined #RubyOnRails
[16:14:52] s_aly: has joined #RubyOnRails
[16:15:39] s_aly: has left #RubyOnRails: ("Leaving")
[16:16:40] d0nn1e: has joined #RubyOnRails
[16:18:21] halfamind: has joined #RubyOnRails
[16:23:14] shinnya: has joined #RubyOnRails
[16:26:14] Ergo: has joined #RubyOnRails
[16:26:40] sypheren: has joined #RubyOnRails
[16:27:20] jtong: has joined #RubyOnRails
[16:32:30] hightower3: has joined #RubyOnRails
[16:34:11] spinsus: has joined #RubyOnRails
[16:36:20] cnk: has joined #RubyOnRails
[16:37:34] arBmind: has joined #RubyOnRails
[16:40:09] DoubleMalt: has joined #RubyOnRails
[16:41:37] bl4ck_ic3: has joined #RubyOnRails
[16:42:19] benlieb: has joined #RubyOnRails
[16:42:38] mrgreenfur: has joined #RubyOnRails
[16:44:19] jottr: has joined #RubyOnRails
[16:44:36] gokulnath: has joined #RubyOnRails
[16:46:04] silentpost: has joined #RubyOnRails
[16:46:05] zave: has joined #RubyOnRails
[16:51:19] mdw: has joined #RubyOnRails
[16:52:25] htmldrum: has joined #RubyOnRails
[16:52:30] htmldrum_: has joined #RubyOnRails
[16:52:35] makerops: has joined #RubyOnRails
[16:55:13] Devalo: has joined #RubyOnRails
[16:58:27] pawnbox: has joined #RubyOnRails
[16:58:34] sneakerhax: has joined #RubyOnRails
[16:59:41] chipotle_: has joined #RubyOnRails
[16:59:56] flashpoint9: has joined #RubyOnRails
[16:59:58] kies: has joined #RubyOnRails
[17:00:58] manfrin: has joined #RubyOnRails
[17:06:46] diegoaguilar: has joined #RubyOnRails
[17:09:07] sbarg: has joined #RubyOnRails
[17:11:20] Dimik: has joined #RubyOnRails
[17:11:47] futilegames: has joined #RubyOnRails
[17:15:18] davee_: has joined #RubyOnRails
[17:17:04] choke: has joined #RubyOnRails
[17:17:50] s2013: has joined #RubyOnRails
[17:28:13] sandstrom: has joined #RubyOnRails
[17:30:10] matthias_: has joined #RubyOnRails
[17:30:43] jgt: has joined #RubyOnRails
[17:36:26] s2013: has joined #RubyOnRails
[17:37:36] djellemah_: has joined #RubyOnRails
[17:39:41] djellemah_: has joined #RubyOnRails
[17:40:23] chouhoulis: has joined #RubyOnRails
[17:41:13] chouhoulis: has joined #RubyOnRails
[17:44:00] arBmind: has joined #RubyOnRails
[17:50:16] intrigueD: has joined #RubyOnRails
[17:50:20] dtzuzu: has joined #RubyOnRails
[17:51:50] jero_: has joined #RubyOnRails
[17:52:24] FooMunki: has joined #RubyOnRails
[17:53:10] htmldrum: has joined #RubyOnRails
[17:53:10] htmldrum_: has joined #RubyOnRails
[17:54:21] jottr: has joined #RubyOnRails
[17:57:22] dopie: has joined #RubyOnRails
[17:57:57] yellow5: has joined #RubyOnRails
[17:58:48] arBmind1: has joined #RubyOnRails
[17:59:05] Tokenizer: has joined #RubyOnRails
[18:03:57] ascarter: has joined #RubyOnRails
[18:04:59] greengriminal: has joined #RubyOnRails
[18:05:30] hahuang61: has joined #RubyOnRails
[18:07:09] bePolite_: has joined #RubyOnRails
[18:08:28] DoctorMonocular: has joined #RubyOnRails
[18:08:44] yfeldblum: has joined #RubyOnRails
[18:08:44] jerohm: has joined #RubyOnRails
[18:11:03] Trynemjoel: has joined #RubyOnRails
[18:11:30] choke: has joined #RubyOnRails
[18:13:46] jtong: has joined #RubyOnRails
[18:16:34] CodaBrink: has joined #RubyOnRails
[18:17:00] bl4ck_ic3: has joined #RubyOnRails
[18:17:31] boontdustie: has joined #RubyOnRails
[18:17:31] sinanislekdemir: has joined #RubyOnRails
[18:18:19] arup_r: What you people use as a JS driver with Capybara ? a. capybara-webkit b. Poltergeist?
[18:18:53] smathy: Poltergeist.
[18:19:07] smathy: I love the "failing on JS errors" thing.
[18:19:20] arup_r: ok., I was thking capybara-webkit .
[18:19:37] arup_r: but I have no reason to support my choice as you did :)
[18:20:24] djbkd: has joined #RubyOnRails
[18:20:35] arup_r: thanks smathy
[18:25:19] djbkd: has joined #RubyOnRails
[18:25:48] jottr: has joined #RubyOnRails
[18:25:50] edwinvdgraaf: has joined #RubyOnRails
[18:26:58] roshanavand: has joined #RubyOnRails
[18:28:02] ss_much: has joined #RubyOnRails
[18:28:51] srinidhi: has joined #RubyOnRails
[18:30:24] hahuang61: has joined #RubyOnRails
[18:33:18] ascarter_: has joined #RubyOnRails
[18:35:02] bronson: has joined #RubyOnRails
[18:35:19] uglybandersnatch: has joined #RubyOnRails
[18:36:33] sbarg: has left #RubyOnRails: ()
[18:38:08] audy: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[18:40:34] ascarter: has joined #RubyOnRails
[18:40:38] arBmind: has joined #RubyOnRails
[18:41:35] futilegames: has joined #RubyOnRails
[18:42:09] ych: has joined #RubyOnRails
[18:42:09] tvw: has joined #RubyOnRails
[18:43:11] djbkd: has joined #RubyOnRails
[18:44:34] sonofdirt: has joined #RubyOnRails
[18:45:11] polyidus: has joined #RubyOnRails
[18:48:27] eyeamaye: has joined #RubyOnRails
[18:49:24] kirillzh: has joined #RubyOnRails
[18:49:42] kirillzh: How to upload files directly to S3 in Rails API?
[18:50:23] flashpoint9: has joined #RubyOnRails
[18:50:24] railshelp: has joined #RubyOnRails
[18:51:21] ascarter_: has joined #RubyOnRails
[18:51:31] kirillzh: I've tried Paperclip and CarrierWave, but they seem to be overcomplicated, all I want to do is upload file directly to S3 over Rails server and return AWS url.
[18:52:18] drptbl: has joined #RubyOnRails
[18:52:47] bronson: has joined #RubyOnRails
[18:53:05] mdw: has joined #RubyOnRails
[18:53:31] jtong_: has joined #RubyOnRails
[18:53:56] htmldrum: has joined #RubyOnRails
[18:53:56] htmldrum_: has joined #RubyOnRails
[18:54:00] smathy: kirillzh, try typing your question into google, add -paperclip -carrierwave if you can't skim past the first two results.
[18:54:59] tjohnson: has joined #RubyOnRails
[18:55:31] User458764: has joined #RubyOnRails
[18:55:52] Devalo: has joined #RubyOnRails
[18:56:54] nogic: has joined #RubyOnRails
[18:57:43] nogic: has joined #RubyOnRails
[18:57:58] manfrin: has joined #RubyOnRails
[18:59:04] djellemah_: has joined #RubyOnRails
[19:01:43] mary5030: has joined #RubyOnRails
[19:02:04] jgt1: has joined #RubyOnRails
[19:03:19] ineedrailshelp: has joined #RubyOnRails
[19:05:33] arup_r: any idea why my test is getting failed when using js: true, otherwise login to app is happening... https://gist.github.com/aruprakshit/3cebc35ed092f862e846 I am not able to trace any reason.
[19:05:38] arup_r: any pointer please
[19:06:34] theajnin: has joined #RubyOnRails
[19:07:50] theajnin: can anyone help me here. I need some direction on how to complete a task
[19:08:07] davee_: has joined #RubyOnRails
[19:08:13] arup_r: theajnin: ask ask
[19:09:17] theajnin: I have a simple rails blog, I want to run a background job that goes through my blog posts and every 5 minutes marks one of them as "featured" and the featured post is then show on the sidebar
[19:09:35] slash_nick: theajnin: check out sidetiq
[19:10:08] theajnin: yup im looking at that right now, just unable to get it to work
[19:10:30] davee_: has joined #RubyOnRails
[19:12:56] davee_: has joined #RubyOnRails
[19:13:49] smathy: arup_r, anything in your rails_helper (or spec_helper) for js: true ?
[19:14:08] arup_r: I will add it there..in the gist
[19:14:15] arup_r: nothing special though
[19:15:26] ur5us: has joined #RubyOnRails
[19:17:22] arup_r: smathy: JS causing issue I got, and http://stackoverflow.com/a/8882580/2767755 explained why that error. I fixed it now. taking hints from http://stackoverflow.com/a/8698940/2767755
[19:17:28] ascarter: has joined #RubyOnRails
[19:17:55] smathy: arup_r, also, I'm not sure your expectation will wait for the page to reload - is current_path some special rspec-y thing that waits for the reload?
[19:17:56] arup_r: I just switched the config.use_transactional_fixtures = false when it is a JS driver
[19:18:12] smathy: Ah cool, yep.
[19:18:26] arup_r: let give those answer +1 first
[19:22:58] Robbie: has joined #RubyOnRails
[19:23:59] s2013: has joined #RubyOnRails
[19:24:21] gremly: has joined #RubyOnRails
[19:24:36] ascarter_: has joined #RubyOnRails
[19:25:07] jenrzzz: has joined #RubyOnRails
[19:27:23] duncannz: has joined #RubyOnRails
[19:28:33] drbayer: has joined #RubyOnRails
[19:34:23] diegoaguilar: has joined #RubyOnRails
[19:39:40] Trynemjoel: has joined #RubyOnRails
[19:41:58] mwlang: has joined #RubyOnRails
[19:43:33] mois3x: has joined #RubyOnRails
[19:47:57] arup_r: any body used Capybara + Poltergeist to test Alert pop up? It is not opening for me :/
[19:48:18] arup_r: if any body used, can you give me the code you have? :)
[19:49:04] arup_r: seems like the feature they had added https://github.com/teampoltergeist/poltergeist/pull/516 .. but no impact here
[19:49:27] siaW: anyone knows why my test is failing after i validated a users phone number? https://gist.github.com/siaw23/ed23ebee4c7c68e77f11
[19:49:38] drbayer: has joined #RubyOnRails
[19:49:46] rodfersou: has joined #RubyOnRails
[19:51:05] htmldrum: has joined #RubyOnRails
[19:51:05] dtzuzu: has joined #RubyOnRails
[19:51:09] htmldrum_: has joined #RubyOnRails
[19:52:09] hello9: has joined #RubyOnRails
[19:52:45] fexilal: siaw : try assert user.valid? instead?
[19:53:06] hello9: can anyone recommend some 'really' good TDD resources (preferably Rails specific)? I've looked through the more famous books, and some tutorials etc. but have yet to find anything exhaustive enough (especially with regards to integration testing)
[19:53:18] drbayer: has joined #RubyOnRails
[19:53:33] blackmesa: has joined #RubyOnRails
[19:53:49] manfrin: Michael Hartl's rails tutorial has a lot of testing built in
[19:53:54] fexilal: hello9 : www.railstutorial.org
[19:53:55] manfrin: some integration testing
[19:54:01] manfrin: ^^ that's michael hartl's
[19:54:11] siaW: fexilal: failing with same error
[19:54:22] hello9: yes, that was from when i first tried rails ever ;). Ill give it another look, thanks!
[19:54:39] hello9: i remember skipping the testing parts hahaha
[19:54:49] manfrin: Does anyone know if there's a way to see *completed* sidekiq jobs? We have a weird bug where a payment auth happened twice, want to see if the job was enqueued twice somehow.
[19:55:20] manfrin: Found one stackoverflow question asking the same (with eerily similar details), but 0 answers.
[19:55:46] manfrin: I know I can see stats of completed jobs by day, but nothing in the docs talk about finding a completed job
[19:55:56] drbayer: has joined #RubyOnRails
[19:56:02] zave: has joined #RubyOnRails
[19:56:03] fexilal: siaw : you didn't assign the phone number in test.rb
[19:57:35] chouhoulis: has joined #RubyOnRails
[19:57:57] siaW: fexilal: yeah right!
[20:04:30] bronson: has joined #RubyOnRails
[20:11:30] hahuang65: has joined #RubyOnRails
[20:12:37] siaW: fexilal: i’m getting errors that all output my validation error message. i’m thinking that i have to put something in the setup in the controller here: https://gist.github.com/siaw23/ed23ebee4c7c68e77f11#file-users_controller_test-rb
[20:12:49] siaW: i think i need to someone assign the number in the controller
[20:13:43] snowy: has joined #RubyOnRails
[20:14:22] siaW: maybe in factories
[20:15:14] akshat_: has joined #RubyOnRails
[20:16:57] siaW: fixed it
[20:17:46] theajnin: hi can someone help me here?
[20:18:34] cnk: theajnin: Nope sorry, it's after noon. this door is closed
[20:19:00] theajnin: I have a simple rails blog, I want to run a background job that goes through my blog posts and every 5 minutes marks one of them as "featured" and the featured post is then show on the sidebar
[20:19:01] cnk: helpa: !ask
[20:19:51] cnk: http://edgeguides.rubyonrails.org/active_job_basics.html
[20:20:30] cnk: theajnin: Had you seen active_job and need specific help? or just needed to know what to Google?
[20:20:37] helpa: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[20:20:55] cnk: smathy: how come that works for you but not me?
[20:21:37] smathy: There's a whitelist.
[20:21:53] theajnin: @cnk I've found the Sidekiq gem and have been trying to make it work, just unsure how to approach it.
[20:22:51] jobewan: has joined #RubyOnRails
[20:22:56] syndikate: has joined #RubyOnRails
[20:23:12] cnk: have a look at the active jobs stuff. It is built in (since ? rails 4) so is likely the simplest to get running
[20:23:13] smathy: theajnin, which part of the ActiveJob that cnk just pointed you to didn't you understand?
[20:23:20] dopie: has joined #RubyOnRails
[20:23:24] smathy: *ActiveJob guide
[20:26:25] smathy: cnk, 4.2 btw.
[20:27:16] cnk: ahh more recent than I thought. All the more reason there are are lot of other options that might come up if thejnin googled
[20:27:43] cnk: theajnin: Hope the guide sets you right. If not, hope someone here can help
[20:28:26] ebbflowgo: has joined #RubyOnRails
[20:29:11] acosonic_: has joined #RubyOnRails
[20:30:29] zave: is this a bad place to ask a question about unicorn?
[20:31:26] context: depends if you are talking about the http server or the mystical creature
[20:31:38] zave: lol.the server.
[20:31:46] context: considering the amount of traffic at this current time i dont think anyone will mind
[20:33:17] zave: cool. thx. after deploy with capistrano, and confirming that the new code is in the current release, and that the deploy restart unicorn after publish, an older release is still being served.
[20:33:29] zave: restarted*
[20:33:51] zave: even after restarting unicorn manually. mulitple times.
[20:34:11] cnk: zave: did you double check capistrano's symlinks?
[20:34:28] cnk: that sounds like the deploy failed - probably enen rolled back
[20:34:39] theajnin: @cnk in my index method i first find the random post using this: @random_post = Post.offset(rand(Post.count)).first
[20:35:22] theajnin: @cnk to enqueue the job after 30 seconds GetFeaturedPostJob.set(wait: 30.seconds).perform_later(@random_post)
[20:35:40] smathy: zave, also, are you confirming (eg. with process id change) that unicorn has actually restarted?
[20:35:56] theajnin: @cnk in the perform helper class how do i pass the data forward to the action in which i want to mark a post as featured?
[20:36:05] manfrin: So you're enqueueing a new job every time someone hits the index
[20:36:11] zave: cnk: the current directory is symlinked to a release. i'll double check that it's linked to the latest. smathy: i'll check that too.
[20:36:23] rattatmatt: has joined #RubyOnRails
[20:36:30] sudoubuntu: has joined #RubyOnRails
[20:37:05] theajnin: @manfrin after every 30 seconds i want to cycle through my posts and mark one of them as features
[20:37:14] cnk: theajnin: I don't think you do. I think you need for your delayed job to mark something featured in the db and then have your controller action just look for the featured post
[20:37:26] manfrin: you shouldn't be triggering a job in your index
[20:37:31] cnk: this is async so there aren't actions in the delayed job
[20:37:37] manfrin: you need sidekiq and sidetiq for scheduling
[20:38:06] smathy: Using `index` actions as a cheap cron daemon.
[20:38:14] cnk: the delayed job needs to interact with the database , not the web server
[20:38:18] smathy: Where cheap is an alias for stupid.
[20:38:21] manfrin: in that case you dont need any async stuff
[20:38:44] manfrin: just check for existence of featured where updated_at > 30 seconds ago
[20:38:58] manfrin: cheap cron!
[20:38:59] TheGreatGudsby: has joined #RubyOnRails
[20:39:21] smathy: ...and let your index viewers pay the price ;)
[20:40:01] theajnin: I've been trying to do it with the sidekiq gem as well, I am just unsure how to make it work.
[20:40:25] bl4ck_ic3: has joined #RubyOnRails
[20:40:38] smathy: theajnin, as I asked earlier, which part of the ActiveJob guide didn't you understand?
[20:40:46] manfrin: you make a worker and use sidetiq (another gem) to have it occur ever 30 seconds
[20:40:56] cnk: theajnin: So super high level, you want to change the featured post every 5 min, right?
[20:41:12] cnk: so you need somethng that runs to the db every 5 min and updates which post is featured
[20:41:36] theajnin: yeah cycles through the db and marks 1 of them as featured every 5 minutes
[20:41:46] smathy: ...or just change it if featured_set_at < 5.minutes.ago
[20:42:31] cnk: OK so given we are on the same page so far, I don't understand your earlier 'actions' question
[20:43:27] theajnin: regarding the action where do i perform the find random post snippet of code, in the sidekiq method called perform?
[20:43:43] theajnin: where do i perform this: @random_post = Post.offset(rand(Post.count)).first
[20:43:43] context: wherever you want?
[20:43:49] manfrin: so why are you using sidekiq to perform the update?
[20:44:26] manfrin: you're using index to spawn a job -- if 10 people hit your index you're going to have 10 jobs
[20:44:32] manfrin: and featured gets changed 10x in a few seconds
[20:44:37] openstruct: has joined #RubyOnRails
[20:44:49] cnk: whereever sidekiq jobs are defined.
[20:44:56] cnk: sorry haven't used it
[20:45:08] manfrin: what you do is you make a job that occurs on its own (use sidetiq) and in that worker just find a post and set it to featured
[20:45:08] smathy: theajnin, it only needs to be changed when someone comes to view the page, just record the datetime when you change it, and every request check to see if that's older than 5 minutes and if so change it again before presenting the response.
[20:46:01] tbuehlmann: what about using the rails cache with an expiration of 5 minutes?
[20:46:03] manfrin: like, you either use workers (in which case you don't actually want to enqueue jobs, you want to schedule them), or you just update if the last update is >5 minutes
[20:46:15] manfrin: tbuehlmann ++
[20:46:25] manfrin: that's actually a pretty great idea
[20:46:46] zave: cnk: thank you. your suggestion to confirm, by pid, that the unicorn was actually restarting led me to the solution. which is that there was no problem in the first place. it was serving the correct codebase.
[20:46:47] smathy: ...except now you have to teach someone who can't understand the ActiveJob guide how to do caching.
[20:46:51] smathy: ACTION is out
[20:46:57] theajnin: i have to specifically use a background process to perform this
[20:47:14] smathy: x-whyyyyyy!
[20:47:29] cnk: zave: OK then. Glad it is all resolved
[20:47:45] smathy: Hey, that was my suggestion.
[20:48:01] cnk: yes yes it was. zave thank smathy
[20:48:08] blackmesa: has joined #RubyOnRails
[20:48:14] bronson: has joined #RubyOnRails
[20:48:15] manfrin: theajnin why
[20:48:18] smathy: ACTION thanks himself
[20:48:26] smathy: Tough crowd.
[20:48:39] drink: ACTION thanks smathy
[20:48:54] apotry: has joined #RubyOnRails
[20:48:55] theajnin: part of the assignment asks for this specifically, this is the only thing I've never worked with thats why I am having difficulty
[20:48:57] cnk: \ everyone thanks smathy
[20:49:00] zave: smathy: duh, my bad. twas actually your suggestion. thank you both :D
[20:49:23] drink: thank you zave
[20:49:34] manfrin: theajnin read this: https://github.com/tobiassvn/sidetiq/wiki/Basic-Usage
[20:49:48] manfrin: if you still have questions, I think maybe programming is not for you
[20:49:49] manfrin: ACTION snarks
[20:49:52] manfrin: that was mean
[20:50:01] drink: ACTION snorts
[20:50:02] tbuehlmann: smathy: hehe, yeah. but I think that could work easily
[20:50:04] smathy: My fragile ego is recovering, *sniff*, thanks everyone.
[20:50:20] smathy: tbuehlmann, I have less confidence in the OP ;)
[20:50:55] theajnin: ahaha manfrin its ok, its my first time working with rails still getting used to it
[20:51:21] smathy: theajnin, in future, when it's an assingment, lead with that please.
[20:51:38] smathy: Then we'll all skip the "you're doing it the wrong way" and "why" portion of this waste of time.
[20:51:58] theajnin: my bad first time asking for help on freenode, still new to all of this
[20:52:32] smathy: You did not terribly.
[20:52:36] smathy: theajnin, you really should read that guide that you were given though.
[20:52:43] choke: has joined #RubyOnRails
[20:53:25] theajnin: i've read the guide, I guess whats confusing me is, how the flow of all of these jobs work
[20:53:45] theRoUS: has joined #RubyOnRails
[20:54:15] manfrin: you'll need one job, that job finds a random post, marks it as featured, and unmarks the other
[20:54:38] manfrin: you make that job run every 5 minutes (with sidetiq, it's one line, the link I gave above shows *exactly* how to do that)
[20:55:06] manfrin: in your index you can get your featured post by doing @featured = Post.where(is_featured: true) or whatever your column looks like
[20:55:39] samcreate: has joined #RubyOnRails
[20:55:45] smathy: There are two processes, your app and a worker, your app calls a method on a job which puts it in a queue, meanwhile the worker is reading jobs from the queue and if they're ready to be run, it's running them.
[20:56:24] smathy: theajnin, ^
[20:56:25] manfrin: in this case, since you're running on a regular schedule, you don't need the app server to add a job; you just have a regularly running job
[20:57:44] smathy: Sure, a job can be hard coded as a configuration option - it's still handled the same way though.
[20:59:35] jenrzzz: has joined #RubyOnRails
[20:59:47] Rubie: hi all: I have a model that queues an activejob to make an external api call, but once the API call comes back i want to be able to return that data in the model, is this possible?
[21:00:32] smathy: rubie, are you in the same class as theajnin ?
[21:00:55] smathy: rubie, what do you mean by "return that data in the model" ?
[21:01:56] Rubie: smathy: return the data received from the API call, which happens as a background job
[21:02:17] mary5030: has joined #RubyOnRails
[21:02:32] smathy: rubie, return to what/where?
[21:02:42] gingray: has joined #RubyOnRails
[21:03:01] intrigueD: has joined #RubyOnRails
[21:03:49] Rubie: smathy: i basically want my model method to, start a background job using activejob/delayedjob, which will fetch data from an external api, then once the background job is finished fetching from the api, i want to return that data in the model
[21:04:08] mary5030: has joined #RubyOnRails
[21:04:32] Rubie: so the model returns the API data that was fetched in an activejob
[21:05:14] smathy: rubie, "return data to the model" means to save this new data to the DB?
[21:05:42] Rubie: smathy, the data gets saved to the DB in the activejob class
[21:06:46] Rubie: i'd like to get that data out of the database once the activejob has saved it
[21:07:08] arup_r: confusing..
[21:07:11] smathy: rubie, so get it.
[21:07:23] matthewd: rubie: It sounds like you want your model to wait for the job to finish... is that true?
[21:07:41] matthewd: Then why are you doing the work in the background? :/
[21:07:59] smathy: The *model* is waiting for the job to finish?
[21:08:04] smathy: What does that mean?
[21:08:09] smathy: What does any of this mean?
[21:08:35] Rubie: because if there are a lot of requests coming in i dont want to slow down the site waiting for api calls to come back
[21:09:18] arup_r: that is ok. but the "yes" answer to the question doesn't sound clever.
[21:09:51] matthewd: I'm confused. You don't want to wait for it, but...
[21:09:53] matthewd: Code please.
[21:10:00] s2013: has joined #RubyOnRails
[21:10:08] smathy: rubie, so you create a job, some time later a worker picks up that job, hits the external API, updates the model in the DB. You said all that is working already.
[21:10:23] Rubie: smathy: correct
[21:10:35] arup_r: happy weekend to all you people!.. bye.. time to sleep
[21:10:43] nickenchuggets: has joined #RubyOnRails
[21:11:08] CodaBrink: has joined #RubyOnRails
[21:11:18] smathy: rubie, great, so that's all good. So what piece is missing?
[21:12:21] Rubie: smathy: when i run the model function in the console, I want to get back the API response, but instead i'm getting a commit transaction for the ActiveJob
[21:12:55] manfrin: handle the response in the job
[21:13:17] manfrin: or, make the api call a method on your model, and have that method called from the job
[21:13:36] DragonPunch: has joined #RubyOnRails
[21:13:42] acosonic_: has joined #RubyOnRails
[21:13:45] smathy: rubie, the model function you're running is the function that queues the job?
[21:13:46] manfrin: def refresh_data; {your api call} {update from information} end
[21:13:58] Rubie: smathy: yes
[21:14:07] manfrin: def refresh_data_async; YourRefresherJob.enqueue(self.id) end
[21:14:26] matthewd: rubie: !code
[21:14:26] helpa: rubie: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[21:14:30] nickenchuggets: has joined #RubyOnRails
[21:14:33] nickenchuggets: So, I'm trying to start testing with Minitest and Guard, and it appears that request and env are nil for just about every test
[21:14:52] manfrin: nickenchuggets stub them
[21:15:02] nickenchuggets: I thought that was done already?
[21:15:13] manfrin: why would they be stubbed
[21:15:13] patrick_star: has joined #RubyOnRails
[21:15:19] hahuang65: has joined #RubyOnRails
[21:15:35] nickenchuggets: well I mean, why would they be missing
[21:15:56] smathy: rubie, so you have a method that's creating a job and instead of doing that you want that method to make an API call?
[21:16:40] nickenchuggets: I thought that, Rails provided functionality for making controller tests convenient, and would like, handle most of that
[21:17:07] nickenchuggets: like, Rails provides me with "get, post, patch" etc helper methods for testing...
[21:17:20] nickenchuggets: so why would there be a missing env and request error
[21:17:23] nickenchuggets: saying those things are nil
[21:17:28] nickenchuggets: if I need to stub them
[21:17:29] Rubie: i want the method inside my model to return the API data, part of doing that is creating the background job to fetch the data from the external API, then ideally i want that job to return the data back to the model so it can be returned
[21:17:31] cnk: nickenchuggets: depends on what kind of tests
[21:17:39] cnk: are these controller tests or integration tests?
[21:17:42] nickenchuggets: I don't think these things need to be stubbed honestly
[21:17:49] nickenchuggets: I don't think that's the solution
[21:18:00] nickenchuggets: controller tests
[21:18:07] nickenchuggets: just using rake test
[21:18:17] cnk: could you show a test and the error?
[21:18:35] manfrin: https://gist.github.com/manfrin/48eef897e3c03f764d0a
[21:19:19] nickenchuggets: https://gist.github.com/brlafreniere/81fab56315fb56c084ba
[21:19:21] smathy: rubie, then no, you can't do that. The method that creates the job has no way of knowing when the job will be run, the best you could do would be for it to enter a loop checking if the DB had been updated and when it sees that update then return that new data.
[21:19:53] nickenchuggets: I think it might be related to Devise actually
[21:20:05] manfrin: nickenchuggets the line that's failing isn't in your gist
[21:20:06] matthewd: .. and as soon as you start waiting for the job, you've gained nothing by running it in the background
[21:20:24] nickenchuggets: manfrin: k, one sec
[21:20:31] Rubie: smathy: okay
[21:20:32] sandstrom: has joined #RubyOnRails
[21:20:53] smathy: rubie, yeah, when I said "the best you can do" - I didn't mean to do that, I meant that if your requirement is REALLY as you've stated then that's the only real way to do what you're asking.
[21:20:58] manfrin: rubie did you look at my gist
[21:21:02] Rubie: mathewd: don't you want to send all slow api calls to a background job?
[21:21:05] cnk: nickenchuggets: see line 5?
[21:21:19] manfrin: if you're using the api call to update a model (db, not to a user), then what I put will work
[21:21:24] matthewd: rubie: Yes, *so that the web request doesn't wait for it*
[21:21:24] cnk: Your template needs something you are not providing
[21:21:29] manfrin: if you're doing this to display to a user, that's a whole different issue
[21:21:48] cnk: either turn off template rendering or add whatever your layout needs from env to the test environment
[21:21:53] DragonPunch: has joined #RubyOnRails
[21:21:54] nickenchuggets: k https://gist.github.com/brlafreniere/81fab56315fb56c084ba
[21:21:54] smathy: ^ there are so many "if"s which are a different issue, if only we'd heard some of them.
[21:21:59] Rubie: manfrin: this is all just for backend
[21:22:08] manfrin: then my gist answers your question
[21:22:14] Rubie: manfrin: but i want to be able to do this in the console
[21:22:16] manfrin: https://gist.github.com/manfrin/48eef897e3c03f764d0a
[21:22:41] manfrin: yeah, calling .refresh will enqueue a job
[21:22:49] manfrin: regardless of where you call it (console, controller)
[21:23:42] nickenchuggets: cnk: k, I think my template needs... something related to Devise, because user_signed_in? is a Devise method
[21:23:59] manfrin: nickenchuggets http://stackoverflow.com/questions/27284657/undefined-method-env-for-nilnilclass-in-setup-controller-for-warden-error
[21:24:04] cnk: Could be
[21:24:19] manfrin: also http://stackoverflow.com/questions/19489608/rails-4-rspec-devise-undefined-method-env-in-controller-specs-for-sign-in
[21:24:31] cnk: those sound like likely suspects
[21:24:37] nickenchuggets: k, well it isn't the first one, not using copybara or webrat
[21:24:52] matthewd: rubie: If you show some code, we might be able to advise further. Without it, I think I'm lost.
[21:25:02] manfrin: I answered rubies question
[21:25:31] matthewd: manfrin: You answered some of the possible interpretations of the question
[21:25:31] manfrin: 9834yu5923uher
[21:25:44] dvinciguerra: has joined #RubyOnRails
[21:25:50] dtzuzu: has joined #RubyOnRails
[21:25:55] Rubie: manfrin: this will be like a cache, so the id might not be present in the database yet, so calling perform would not work
[21:25:59] rubyonrails750: has joined #RubyOnRails
[21:26:16] smathy: rubie, matthewd's comment earlier is very important, if you don't have a user waiting, or some other reason to offload this work, you shouldn't be using an async job at all.
[21:26:17] manfrin: why wont the id be present
[21:28:21] Rubie: smathy: even if you are getting 1000's of these requests per second?
[21:29:17] Rubie: manfrin: we can't create a new model until we have data fetched from the api, once we get the data then we save it and will have the id
[21:30:11] manfrin: so make a job that makes the call and creates the model
[21:30:18] manfrin: what's the hard part?
[21:30:30] Rubie: thats what i have
[21:31:03] smathy: rubie, well now you're talking about "requests" - that has a specific meaning in the context of a web app.
[21:32:20] smathy: rubie, do you mean a web request? If so then you *do* have a user that'd be waiting, and maybe they're the entity to which you want to return this data. I wouldn't know because your description of this problem has been opaque from start to end.
[21:32:49] matthewd: .. and you refuse to show any code
[21:33:00] matthewd: Well, not even refuse.. just pointedly ignore requests
[21:35:19] queequeg1: has joined #RubyOnRails
[21:36:35] rubyonrailed: has joined #RubyOnRails
[21:36:35] anoob: has joined #RubyOnRails
[21:38:35] anoob: has joined #RubyOnRails
[21:39:03] theajnin: @manfrin so this is what I have so far... this is the perform method in my sidekiq gem, @random_post = Post.offset(rand(Post.count)).first @random_post.update_attribute(:is_Featured, true)
[21:39:20] theajnin: @manfrin in this index action, FeaturedWorker.perform_in(5.seconds)
[21:39:36] chouhoul_: has joined #RubyOnRails
[21:39:47] manfrin: 1) you need to mark the current featured posts as is_featured: false before
[21:40:10] manfrin: 2) Column should be is_featured, you dont capitalize column names in ruby/rails
[21:40:22] manfrin: 3) why are you enqueuing a new job every index hit?
[21:40:39] theajnin: where do i enque this job?
[21:41:42] dtzuzu: has joined #RubyOnRails
[21:42:01] benlieb: has joined #RubyOnRails
[21:42:39] snowy: has joined #RubyOnRails
[21:43:26] Rubie: matthewd: https://gist.github.com/anonymous/65a3891c59bec7344e53
[21:45:10] Rubie: smathy: yes i mean web request, the user would be waiting thats why I would want to put it in a background job while other data is fetched for them as well, once the request comes back then i want to show them that data
[21:45:40] Rubie: smathy: really i just want to be able to call the method in the console and get back the API data
[21:45:55] smathy: rubie, OMG, FINALLY! So you want to return the data TO THE USER/BROWSER?!?!?!
[21:46:13] smathy: rubie, no, you don't want to do that, because in the console it doesn't matter if you sit there for 20 seconds.
[21:46:20] new_bruins: has joined #RubyOnRails
[21:47:17] matthewd: > put it in a background job while other data is fetched for them as well, once the request comes back then i want to show them that data
[21:47:25] smathy: Anyway, maybe someone can help you now that you've actually explained what you're trying to do. Your quote with be is depleted.
[21:47:28] Rubie: smathy: i want it to be able to scale up
[21:47:52] new_bruins: what is the best way to deploy a rails app to an ec2 instance?
[21:49:18] djbkd: has joined #RubyOnRails
[21:49:52] mwlang: I don’t usually test controllers and especially instance variable assignments, so…here’s the odd-ball question: Is this the right way to test back-to-back requests and ensure I get the same instance variable results both times? https://gist.github.com/mwlang/9df1bdb1ebf7a1a62ae8
[21:50:24] TheGreatGudsby: has left #RubyOnRails: ()
[21:50:24] TheGreatGudsby: has joined #RubyOnRails
[21:50:43] jenrzzz: has joined #RubyOnRails
[21:50:43] jenrzzz: has joined #RubyOnRails
[21:51:25] Rubie: matthewd: i want to be able to call FinderModel.lookup_by_email("somebody@aol.com") and have it return the data that comes back from the API, but all im seeing in the console is the transaction for the activejob
[21:51:29] mwlang: basically, I’m not sure how that assigns method actually works in rspec controller specs and am wondering if I’m really capturing two events.
[21:51:52] bronson: mwlang: 'assigns' is getting pulled from rails 5.
[21:52:00] matthewd: rubie: You're presenting conflicting requirements
[21:52:06] bronson: er, has been. it's now in the controller testing gem.
[21:52:09] mwlang: bronson: oh, lovely.
[21:52:24] matthewd: rubie: It can't execute in the background to avoid people waiting, but also return the result from the method call
[21:52:41] mwlang: better not waste a lot of time writing this puppy. Just trying to untangle a mess of code I inherited from another dev team with user sessions and logins.
[21:53:24] bronson: agreed. it's kinda too bad because I always looked at `assigns` as a contract between the controller and the view.
[21:53:33] Rubie: matthewd: so how would you make an external api call more scalable?
[21:53:48] cnk: ya that test would pass but I am not sure how informative it is for the actual running app
[21:53:52] bronson: but it's never been a good contract so now it's gone. shame there's nothing better to replace it.
[21:54:02] cnk: bronson: agreed
[21:54:08] smathy: mwlang, I'd always do it in a capybara test if you wanted to test through multiple pages.
[21:54:21] mwlang: bronson: oh, and on rake vs rails — I don’t have the time to get into that code to help out. I could see I’d need to devote some time to ramp up before moving to actually building things there.
[21:54:40] Rubie: matthewd: say when a user visits the site there are 10 external api calls that need to happen that average 1 second a peice, wouldn't it make sense to make those calls in the background?
[21:54:41] smathy: mwlang, also, generally, if you want things like sessions setup and so on.
[21:54:57] nickenchuggets: so I decided... to just re-write my tests
[21:54:59] mwlang: yeah, it’s a contract I prefer not to test at all.
[21:55:24] bronson: mwlang: I had the same thought. I'd like to fix it too but, given my limited time, dunno why I'd think I could do any better a job.
[21:55:29] mwlang: but this code I’m looking at is ridiculously gnarly, yet “almost works"
[21:55:46] matthewd: rubie: Perhaps... but the ways of doing that are very different to this
[21:56:12] mwlang: smathy: good point bringing capybara into the mix.
[21:56:20] matthewd: rubie: But mostly, I just wouldn't put a bunch (or, ideally, any) external API calls in the request path
[21:56:25] anoob: what's the right callback to sanitize data for a model? for example, i don't want to save a phone like "+55 (47) 3373-0396" with non numeric characters ...
[21:57:09] anoob: i want to save just "554733730396"
[21:57:36] mwlang: anoob: a before_save callback will probably do the trick nicely enough.
[21:57:38] cnk: I would do a before save
[21:57:51] smathy: ACTION wouldn't change a phone number
[21:58:13] anoob: ah ... and the phone attribute has a validation ...
[21:58:21] nickenchuggets: oh, well, I'm retarded
[21:59:04] mwlang: ACTION goes to rethink controller action testing strategy….
[21:59:06] nickenchuggets: my issue has nothing to do with testing
[22:01:26] mwlang: bronson: you mentioned a controller testing gem…is that to say that assigns lives on, but now in a gem to be installed if we want it back for R5?
[22:01:38] bronson: mwlang: yep
[22:02:08] bronson: and I guess controller tests are getting gently shown the exit.
[22:02:28] nickenchuggets: yep, I'm retarded
[22:03:09] nickenchuggets: I added the line "include Devise::TestHelpers" in app/controllers/...
[22:03:19] manfrin: if each time a user hits your site, you're making 10 api calls
[22:03:22] nickenchuggets: instead of in test/controllers/...
[22:03:39] nickenchuggets: including devise test helpers in the wrong place :p
[22:03:40] manfrin: then make it so the client makes those calls, not rails, else you're making 40 trips
[22:04:53] stannard: has joined #RubyOnRails
[22:05:54] cnk: nickenchuggets: ahhhh. Glad you found the root of the issue
[22:07:54] tildes: has joined #RubyOnRails
[22:09:45] owenjones: has joined #RubyOnRails
[22:11:15] quazimodo: has joined #RubyOnRails
[22:21:02] mwlang: hmmm…did Rails 1.2 actually have request.remote_host ?
[22:21:21] mwlang: if so, what does that become in Rails 4?
[22:21:43] Scriptonaut: has joined #RubyOnRails
[22:23:33] Scriptonaut: hey guys, I created a heroku staging environment for my app. It seems to run fine, but when I run a rake task to set all the passwords to 'password', I get an error saying that I need to set my Devise secret key to some long string. I went to devise.rb in my initializers, and above the secret_key, it says, "Changing this key will render invalid all existing confirmation, reset password, and unlock
[22:23:39] Scriptonaut: tokens in the database". Wouldn't this screw up all the existing reset password tokens of my users? Why am I having to suddenly add this? It has worked fine in production for years
[22:25:20] CodaBrink: has joined #RubyOnRails
[22:27:02] cnk: mwlang: 1.2 ? that's even older than some of my stuff
[22:27:31] mwlang: cnk: just thankful its not 0.10 :-)
[22:27:48] cnk: APIDock is a fairly decent way to be able to see old and new docs http://apidock.com/rails
[22:27:56] maxx88: has joined #RubyOnRails
[22:28:02] cnk: I had me one of those - fortuntely it is long gone
[22:28:38] _Tariq: has joined #RubyOnRails
[22:28:48] mwlang: I dumped the request.env keys to console and making educated guesses.
[22:29:12] matthewd: mwlang: You probably want either request.remote_ip or request.ip -- know their differences, though
[22:29:50] djellemah: has joined #RubyOnRails
[22:31:20] mwlang: matthewd: After about three more, I’m suspecting these are SSO headers I’m looking at, so betting I need ‘em verbatim — we do have a couple of SSO integrations, so need to get some more background info from the client.
[22:31:35] manfrin_: has joined #RubyOnRails
[22:31:37] zave: has joined #RubyOnRails
[22:35:03] CodaBrink: has joined #RubyOnRails
[22:35:41] TinkerTyper: has joined #RubyOnRails
[22:37:10] uglybandersnatch: has joined #RubyOnRails
[22:39:54] gabr13l: has joined #RubyOnRails
[22:40:55] patrick_star_2: has joined #RubyOnRails
[22:45:09] owenjones: has joined #RubyOnRails
[22:46:25] jobewan: has joined #RubyOnRails
[22:47:36] pwnd_nsfw: has joined #RubyOnRails
[22:49:35] one_zero: has joined #RubyOnRails
[22:53:41] Devalo: has joined #RubyOnRails
[22:56:01] DonOtreply: has joined #RubyOnRails
[22:57:15] zave: has joined #RubyOnRails
[23:00:06] zave: anyone here know how to make unicorn http server restart on machine reboot?
[23:01:38] havenwood: zave: "Provide the necessary config file for your favorite init system to control your daemon."
[23:01:42] havenwood: zave: https://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/
[23:02:35] zave: havenwood: thank you
[23:02:47] stannard: has joined #RubyOnRails
[23:03:02] CodaBrink: has joined #RubyOnRails
[23:03:05] bl4ck_ic3: has joined #RubyOnRails
[23:03:50] one_zero: has joined #RubyOnRails
[23:06:18] rodr1go: has joined #RubyOnRails
[23:08:02] CodaBrink: has joined #RubyOnRails
[23:16:49] CodaBrink: has joined #RubyOnRails
[23:18:46] eyeamaye: has joined #RubyOnRails
[23:18:53] Dreamer3_: has joined #RubyOnRails
[23:19:42] FooMunki: has joined #RubyOnRails
[23:21:17] daguilaraguilar: has joined #RubyOnRails
[23:23:21] stannard: has joined #RubyOnRails
[23:23:36] Inside: has joined #RubyOnRails
[23:23:36] Inside: has joined #RubyOnRails
[23:24:20] s2013: has joined #RubyOnRails
[23:25:25] arBmind: has joined #RubyOnRails
[23:28:33] JoshL: has joined #RubyOnRails
[23:32:43] robbyoconnor: has joined #RubyOnRails
[23:39:15] sonOfRa: has joined #RubyOnRails
[23:39:16] hxegon: has joined #RubyOnRails
[23:43:49] quazimodo: has joined #RubyOnRails
[23:43:52] quazimod1: has joined #RubyOnRails
[23:43:56] Quintasan_: has left #RubyOnRails: ()
[23:44:02] stannard: has joined #RubyOnRails
[23:44:11] Quintasan: has joined #RubyOnRails
[23:47:24] CodaBrink: has joined #RubyOnRails
[23:49:18] _Tariq: has joined #RubyOnRails
[23:49:46] rubyonrails088: has joined #RubyOnRails
[23:55:28] ebbflowgo: has joined #RubyOnRails
[23:56:06] Cohedrin: has joined #RubyOnRails
[23:57:46] siaW: has left #RubyOnRails: ()