« Back to channel list

#RubyOnRails - 06 December 2013

« Back 1 day Forward 1 day »
[00:07:01] Vocino: what's the best way to remove line breaks and extra white space when you organize things with line breaks, e.g. https://gist.github.com/ba4f24a78d9c7ddd0f47 (or should i be doing this differently?)
[00:08:43] maletor: Trying to debug a JSON decode error. Any ideas what might have happened here? https://gist.github.com/maletor/894d59fd75085e031336
[00:09:22] toretore: Vocino: don't put whitespace and linebreaks in the string in the first place
[00:09:56] Vocino: toretore: rubocop complains that my shit isn't nice and lined up
[00:10:12] Vocino: and that the lines are too long
[00:10:20] toretore: well tell him to do fuck himself
[00:10:25] Vocino: good call
[00:10:48] toretore: maletor: where's the base64 from?
[00:13:36] maletor: toretore: it's a base64 encoding of a json string stuck into an email
[00:14:21] maletor: users land on /unsubscribe/:token
[00:14:41] maletor: technically they go through sendgrid link tracking first. i'm working to see if they fudged the URL somehow, but i doubt it
[00:14:51] maletor: what would cause all those weird encodings?
[00:15:01] toretore: let's see the generating code
[00:15:35] maletor: toretore: for sure
[00:16:15] maletor: toretore: gist updated
[00:18:27] digital-ghost: Can someone tell me what an Oauth provider is exactly?
[00:19:08] funburn: I've created a custom validation that sets model.errors[:base] on failure. How do I then have the controller set a flash[:error] with that value?
[00:19:38] toretore: maletor: seems to work fine, it must get mangled in between
[00:19:56] maletor: you think it's sendgrid click tracking? they rewrite the URL to hit their server
[00:20:07] maletor: then 301 to us
[00:20:18] toretore: well, it's a simple test
[00:20:24] pzuraq: Can I save nested record associations that are nested arbitrarily deep?
[00:20:29] toretore: if you know the data that does into the string
[00:20:31] maletor: toretore: how so? the error is intermittent
[00:20:39] maletor: fair enough
[00:20:43] toretore: well that's another issue then
[00:21:12] maletor: toretore: what's this 2\x9A\xDC\xB5\x9A7
[00:21:16] maletor: it's supposed to be a user id
[00:21:32] toretore: i'm guessing it isn't
[00:21:47] maletor: well the 2 is probably right.
[00:21:57] maletor: you can even see a .com
[00:22:19] toretore: do you know what data went into the string?
[00:22:22] maletor: any reason some parts of the decoded base64 are in tact?
[00:22:34] maletor: maybe if i can decode \x9A7
[00:22:40] maletor: what is that supposed to be?
[00:22:41] toretore: they're just bytes
[00:23:09] toretore: what you see as text may just be coincidentally within the ascii range
[00:23:45] maletor: eh. maybe. hard to believe the .com part though
[00:23:59] maletor: commas and colons are in tact
[00:24:03] tewlz: is it possible to render :nothing => true, :locals => { :newvar => :paramfromcurrentview } or will render nothing just not do anything?
[00:24:39] tewlz: don't have any code set up for it at the moment or I would just try it out.
[00:25:00] toretore: what's the point of that tewlz?
[00:25:49] toretore: maletor: where did you get that specific base64 from?
[00:25:58] tewlz: toretore: as I'm typing it out, I don't think I really knwo the point now, for a second I was thinking running some javascript to request new values would lose my local params, but if I'm not rendering a new action I shouldn't lose them, right?
[00:26:44] toretore: i have no idea what that means :)
[00:26:48] tewlz: me neither.
[00:27:24] tewlz: had a developer asking me to put a second set of eyes on something and I'm trying to figure out what he's doing.
[00:27:58] toretore: did you ask him?
[00:29:13] tewlz: he's afk atm, haven't put a whole lot of thought into, a lightbulb just went off and not I'm realizing I have no idea what I'm talking about
[00:29:30] tewlz: s/not/now
[00:34:29] pishposh: how do i set up a search form that allows the user to search by either of two fields? I want to send only the params that were filled in so that i don't have to check if the params are equal to the empty string when I'm figuring out which field the user filled in
[00:36:08] toretore: you can't do that
[00:36:08] bricker`LA: pishposh: you'd have to have two separate forms
[00:37:14] rhizome: or use any search gem/engine
[00:37:25] pishposh: bricker`LA: there has to be some kind of hack. I just don't want two different submit buttons
[00:37:51] toretore: the "hack" is to check the params on the server
[00:38:37] toretore: params.values_at(:one, :two).reject(&:blank?)[0]
[00:39:27] rhizome: oh, two text fields
[00:39:46] ddd: Issue: Address fields in form_for @shelter, using fields_for :address are not showing in view. I've rerun rails s but still no display. Gist: https://gist.github.com/ddd/7816702
[00:39:57] ddd: Shelter belongs_to :address & Address has_many :shelters. Address in Shelter#new is built using @shelter.build_address
[00:40:09] pishposh: toretore: yeah that's better than what i have
[00:40:12] ddd: since its accessed via @shelter.address.address1 and I'm doing a fields_for :address, shouldn't it be able to figure out (fields_for method) that i'm actually pointing at @shelter.address[:address1] for example? or am I using it wrong? I would think this would work because its a collection, just a collection of a singular address
[00:41:08] ddd: toretore: you mean https://gist.github.com/ddd/7816702#file-new-html-erb-L18 ?
[00:41:27] ddd: ahhh, lets see
[00:42:16] ddd: absolutely correct
[00:42:17] ddd: thank you
[00:42:32] ddd: good eyes! hehe
[00:42:54] drocsid: I'm trying to generate a new project ' rails new project 'and rails seems to be hanging on the bundle install
[00:43:16] ddd: drocsid: its grabbing deps probably, or figuring them out
[00:43:40] ddd: that can take a couple minutes depending on A) the number of gems, and B) the upstream availability (it has to get the gems Manifest from rubygems.org)
[00:43:45] drocsid: ddd: I guess I just panicked cause it was taking longer than usual
[00:44:19] ddd: yeah if its longer than say 5 minutes then i'd say its an issue
[00:45:04] ddd: i would then do a bundle --verbose install and see the output
[00:45:19] Criten: Any of you guys happen to use ember? :P
[00:45:26] Criten: #ember seems kind of dead currently
[00:51:12] tewlz: I'm about to start using ember.
[00:51:55] tewlz: It seems a bit more in line with rails than angular even if angular is getting all the attention.
[00:53:57] maletor: toretore: from parameters from bug reports
[00:54:05] maletor: toretore: about json decode errors
[00:57:14] christo_m: can someone please explain the bottom of this page here: https://github.com/intridea/omniauth/wiki/Managing-Multiple-Providers with regards to the create method for sessions_controller
[00:57:50] christo_m: specifically the case where theres user associated with the identity
[00:58:36] christo_m: he says in the bottom of the second paragraph after the code that you can just "create a blank user in the create method and log them in" what does he mean "log them in"
[00:59:00] christo_m: current_user = User.new ?
[01:01:12] rhizome: i think it means you want a user model to attach the identities to
[01:02:39] christo_m: @identity.user = User.new?
[01:02:56] rhizome: i'd probably use .create, but you may have different needs
[01:03:15] christo_m: but thats what you mean right, at the top of the create method?
[01:05:49] christo_m: rhizome: ya im not sure thats the correct way to do it , like hes saying
[01:06:02] christo_m: all thast going to do is keep creating user objects in the database, if i keep resigning in
[01:07:11] rhizome: by my read, you wouldn't want to keep creating users for a particular identity, but get the identity and assign a blank user if necessary.
[01:08:55] r08o: This might not be the most on topic problem, but I know a lot of you are using haml, and I am trying to convert and encountered a problem that I have not been able to find a solution for. How do I represent this https://gist.github.com/czepluch/7817008 in haml?
[01:13:59] ecnalyr: How do I make jquery stuff work after part of the dom has been updated via an ajax request in rails4? I'm replacing a div with a similar, updated div. I'm not entirely sure I understand what i'm supposed to 'bind' to 'ajax success'. The document ready funciton? or the div that gets refreshed?
[01:18:49] Radar: ecnalyr: Show us how you're doing the AJAX request please.
[01:18:59] ecnalyr: one moment
[01:22:33] ecnalyr: Radar https://gist.github.com/ecnalyr/2e386849fa9ec94cdd2d
[01:23:02] Radar: Oh, it's a remote form not a normal ajax request like I had though
[01:23:07] Radar: I don't know how to bind to those events sorry :(
[01:23:25] Radar: ecnalyr: Quick google comes up with this: http://stackoverflow.com/questions/3723118/rails-3-ajax-remote-form-call-backs
[01:28:23] ecnalyr: I just moved the script into the partial that gets reloaded ( <script>. . . </script ) and it works just ine
[01:28:32] ecnalyr: ugly as can be, and very confusing, but it works
[01:33:07] adizam: Anyone have quick/easy solution to traverse a directory (terminal, on a mac) and check for non utf-8 compliant characters? I'm getting errors across one of my production sites.. they seem completely random and I'm just trying to cover my bases here. I think its one of my other developers using a crappy IDE..
[01:33:34] adizam: Not that it matters, but, the error I'm getting across multiple pages (~13 to be precise) is: incompatible character encodings: ASCII-8BIT and UTF-8
[01:52:05] denym_: "~13 to be precise"
[01:52:31] denym_: close to collapsing the universe dude!
[01:53:10] Radar: adizam: Which file is it happening in?
[01:53:34] adizam: radar: seems to be related back to my layout
[01:53:53] Radar: <% encoding: utf-8 %>
[01:53:59] adizam: already done
[01:54:04] adizam: still occurring :)
[01:54:05] Radar: then *shrug*
[01:54:09] adizam: I'm working through it, yeah, its a weird issue
[01:54:09] Radar: Dreamer3: woman
[01:54:10] Dreamer3: december is kind of happening and no mac pro yet
[01:54:14] tubbo: adizam: is it IN the file or in some kind of input that the file is processing?
[01:54:15] Dreamer3: Radar: smart butt
[01:54:16] Radar: Dreamer3: omg no way
[01:54:17] tubbo: becuase that kind of thing happens
[01:54:31] Dreamer3: looking at theis 24" dell
[01:54:36] adizam: tubbo: its in the file.. My first thought was the input I'm processing.. since the massive amount of data being sent from my api.. but its all encoded as it should be
[01:54:39] Dreamer3: but wondering if apple is going to do a "one more thing" with displays
[01:54:42] tubbo: Dreamer3: i pity the foo who uses a trashcan for a damn computer
[01:54:42] adizam: and the proper headers are in place, and I've forced encoding.. and some other stuff
[01:54:52] Dreamer3: i don't but i want a 4k screen or better
[01:54:55] adizam: The only thing I can come up with right now.. I'm wondering if it relates to the request object being encoded in ascii-8bit
[01:54:56] tubbo: adizam: hmm
[01:55:00] Dreamer3: retina spoils you
[01:55:02] adizam: I do pass some request.env vars into the template
[01:55:06] Radar: adizam: Which version of Ruby?
[01:55:07] adizam: I'm about to dup & sanitize those, see if it helps
[01:55:08] Spami: in the routes file how can I do something like this :constraints => { :lat => /[\w+\.]+/, :png => /[\w+\.]+/} ?
[01:55:14] Radar: Spami: wat
[01:55:15] adizam: 1.9.3p429
[01:55:21] Radar: adizam: Try 2.0.
[01:55:37] adizam: Its on the todo list
[01:55:42] Spami: Radar, I have two params with dot, and I need to had a constraint to my route
[01:55:46] Dreamer3: I wonder why moonshine doesn't support ruby 2 yet
[01:55:53] Spami: it work with one rule but not 2
[01:55:54] Dreamer3: all the good patch sets I see are still for 193
[01:56:02] Radar: Spami: Can you show me an example of that?
[01:56:27] Spami: Radar, http://0.0.0.0:3000/api/v1/location/37.4302825/-122.1067732
[01:57:05] Radar: Spami: is constraints the right thing to be using there?
[01:57:05] Spami: match 'location/:lat/:lng' => 'location#get_ location', :via => :get, :as => :get_ location, :constraints => { :lat => /[\w+\.]+/, :lng: => /[\w+\.]+/}
[01:57:15] Spami: Radar, idk it seems
[01:57:38] Radar: Spami: seems to be: http://guides.rubyonrails.org/routing.html#segment-constraints
[01:57:47] Radar: Spami: I don't know what could be going wrong sorry.
[01:57:54] Radar: Spami: and please use get and not match :via => :get
[01:58:00] Radar: less typing that way
[01:58:18] Spami: what if it's either get and post ?
[01:58:25] Dreamer3: Spami: isn't digit \d
[01:58:40] sevenseacat: then you specify match via
[01:58:53] sevenseacat: you think long and hard about when you would need that though
[01:58:56] Spami: Dreamer3, yes, but doesn't solve my constraint issue :)
[01:59:10] Dreamer3: ok not paying that much attentoin
[02:00:01] sevenseacat: your regex doesnt match the numbers you're giving it
[02:00:10] sevenseacat: try experimenting on rubular.com
[02:00:49] sevenseacat: also, \w is word characters
[02:00:54] sevenseacat: so it will match stuff you dont want it to match
[02:01:07] Spami: sevenseacat, but the regex works so far, what doesn't work is 2 constraint for the same route
[02:01:18] sevenseacat: it does not 'work so far'
[02:01:25] Dreamer3: sevenseacat: that's what i was saying
[02:01:33] sevenseacat: http://rubular.com/r/ZTmm7tk5J2
[02:01:55] sevenseacat: http://rubular.com/r/KY7juwfEd6 even
[02:01:58] Dreamer3: \w includes numbers
[02:04:24] adizam: radar: https://gist.github.com/adizam/7cc68e18400afc4c51dd
[02:04:30] adizam: errors occurring on lines 51 & 52
[02:04:49] adizam: fairly confused :P
[02:09:17] Spami: ah my bad yes, doesn't catch the minus
[02:09:42] melvinram: Anyone using cloudfoundry.com?
[02:10:18] melvinram: I don't have a question. I'm just curious on others experience with deploying Rails apps using CF.
[02:10:33] adizam: radar: error output, if helpful at all -> https://gist.github.com/adizam/021ec9b5b7826c799d16
[02:10:34] enape_101: wtf? https://gist.github.com/naushadparpia/7815806
[02:10:40] adizam: Maybe its something cache related. Oy
[02:11:35] melvinram: enape_101: I don't see an end
[02:11:49] adizam: enape_101: Are you running in a directory that has been removed from another location?
[02:12:00] adizam: i.e. you deleted the directory in another terminal window
[02:12:05] sevenseacat: oh yes ive seen that before
[02:12:12] enape_101: hm well there are two people working on this app, me and one other
[02:12:12] sevenseacat: caused by what adizam said
[02:12:21] adizam: better yell and scream at the other guy
[02:12:21] enape_101: how to troubleshoot, or solve
[02:12:29] adizam: well, type ls
[02:12:32] sevenseacat: dont delete the ffolder you're working in?
[02:12:33] Radar: adizam: thanks
[02:12:42] enape_101: i didn't delete anything
[02:12:47] enape_101: i just pulled it now
[02:12:48] Radar: adizam: https://gist.github.com/adizam/021ec9b5b7826c799d16#file-gistfile1-txt-L14
[02:12:49] Radar: adizam: bro
[02:12:51] sevenseacat: someone likely did
[02:13:16] adizam: radar: seriously
[02:13:17] enape_101: what's the solution? sevenseacat
[02:13:24] adizam: radar: did I really completely overlook that this entire time
[02:13:25] sevenseacat: enape_101: don't delete the folder you're working in.
[02:13:34] sevenseacat: get it back out of the trash.
[02:14:23] enape_101: dunno what he deleted..
[02:14:24] enape_101: let me see..
[02:14:47] adizam: back to my original statement: yell and scream at the other guy
[02:15:36] adizam: radar: question tho
[02:16:05] adizam: radar: that is kicking off because of an exception.. so why would the exception be a unicode error relating to the exception notifier.. when.. hm.. what do I mean
[02:22:33] Radar: adizam: Stacktrace points to the error man.
[02:22:45] Radar: adizam: Try getting the error without exception_notification installed. I think you won't be able to.
[02:23:04] adizam: radar: Yeah. Rewiring up new relic to detect them and removing it in production
[02:23:14] adizam: rolling it out to our servers now. I guess I've spent so much time in node/angular land I just overlooked it
[02:23:18] adizam: Thank you :)
[02:30:49] enape_101: https://gist.github.com/naushadparpia/7815806
[02:30:53] enape_101: k finally got in, but what's this?
[02:31:19] enape_101: i've added :for_about to user model didn't help
[02:31:52] sevenseacat: you havent listed for_about in attr_accessible
[02:31:56] sevenseacat: this is all in the guides btw
[02:32:12] sevenseacat: http://guides.rubyonrails.org/v3.2.13/security.html#mass-assignment
[02:32:37] DanBoy: sevenseacat, wasn't there recently an issue with the guide links
[02:32:45] enape_101: i did sevenseacat
[02:33:02] enape_101: i've added it to the user model attr_accessible
[02:33:05] sevenseacat: enape_101: show us
[02:33:30] enape_101: https://gist.github.com/naushadparpia/7815806
[02:34:00] sevenseacat: enape_101: read the error carefully
[02:34:04] sevenseacat: and note which model it mentions
[02:35:28] enape_101: alright, let's try question.rb
[02:39:45] enape_101: not sure why i'm getting a # -*- coding: utf-8 -*- at the top everytime i save
[02:41:18] adizam: radar: Still getting it :>
[02:41:26] Radar: adizam: lol
[02:41:29] Radar: adizam: glhf
[02:41:50] Radar: adizam: This is usually the point I say "hand over a wad of cash and your code and I will solve it for you"
[02:41:53] Radar: but I am busy now :)
[02:45:19] enape_101: Radar, whats # -*- coding: utf-8 -*- mean
[02:49:01] Radar: enape_101: You tell me.
[02:53:05] dcope: with a models' error hash, is it possible to determine if the validation failed on the :format?
[02:53:48] sebkomianos: the model should have an error on :format, no?
[02:54:11] dcope: sebkomianos: Yes, it does and the error is in the errors hash... but is the a Rails way to determine that the validation failed due to format?
[02:54:43] dcope: So I'm validating the presence of and also the format. I'm wanting to display different errors to the user if one fails
[02:55:03] sebkomianos: I am in no way to say what is and what is not the Rails way
[02:55:25] dcope: sebkomianos: "Rails way" == not checking the unlocalized error message ;-)
[02:55:48] sebkomianos: dcope: haha, see, I was just about to tell you to just display the message :D
[02:56:12] dcope: i want to display custom messages and only display one message at a time
[02:56:22] dcope: where rails will give you as many errors that occurred in the hash
[02:57:13] jstrong: i am not following you dcope
[02:57:23] Radar: I am following dcope.
[02:57:29] Radar: I'm beeeehiiind you
[02:57:42] sevenseacat: no, rails doesn't single out types of error messages
[02:57:44] Radar: haha made you look around
[02:57:44] jstrong: yo no comprendo
[02:57:50] dcope: jstrong: so i have a User model that has an email. the email must not be blank (validates_presence_of) and it must adhere to a certain format (:format)
[02:58:04] dcope: sevenseacat: i didn't think so... can't find anything on api.rubyonrails.org to suggest. :(
[02:58:09] Radar: dcope: No, Rails does not provide a method for that.
[02:58:15] dcope: thank you all
[02:58:17] sevenseacat: so only validate the format if present
[02:58:18] Radar: dcope: Why do you care about the specific validation error?
[02:58:51] jstrong: dcope there's about a thousand email validation regexps floating in deep space
[02:58:54] jstrong: that would work
[02:59:04] dcope: jstrong: the regex isn't the problem :)
[02:59:18] sevenseacat: i dont think you've told us what the problem us
[02:59:23] jstrong: so what is the problem? you only want it to say "can't be blank" or "format invalid" and not both?
[02:59:30] dcope: Radar: i only want to show the user one at a time. I guess i could just i18n the error messages and then just show the user the first message
[02:59:34] Radar: dcope: You should know by now it's better to explain the problem that you're having rather than the solution that you've come up with for the problem.
[02:59:34] dcope: in the errors :P
[02:59:45] Radar: dcope: So do as sevenseacat said: only validate the format if the field is not blank
[02:59:53] jstrong: yeah that is what I was going to say
[03:00:13] jstrong: and I am not understanding why that solution does not work
[03:00:33] rushed: dcope: or fix your layout (or whatever the issue driving this is) so you can show all the messages... what user is going to want to get errors dribbled back to them one at a time :)
[03:00:53] jstrong: rushed you might want a ??? "streamlined" ??? experience!
[03:01:01] dcope: rushed: yeah, that's certainly a good point :)
[03:01:07] sevenseacat: that would be a pain in the ass 'you didnt specify an email' *specifies email* 'you didnt make it a valid email' *types valid email* 'you didnt confirm your email'
[03:01:14] sevenseacat: ACTION leaves site
[03:01:26] jstrong: lean validations
[03:01:29] jstrong: show them as you go
[03:01:32] jstrong: don't do them all up front
[03:01:37] dcope: sevenseacat: but then you supply an email and then submit the form and get another error
[03:01:44] dcope: assuming you supply a bad email
[03:02:57] Radar: p.s. setting type='email' on the field will validate it if you're using a good browser ;)
[03:03:07] Radar: email_field helper does that iirc
[03:03:25] jstrong: safari doesn't do those validations despite being webkit
[03:03:28] jstrong: pretty strange
[03:03:30] dcope: Radar: oooh, i wasn't aware of that
[03:05:21] sebkomianos: guys, could he somehow extend the validation method so it adds a different error message on each occasion?
[03:05:40] sevenseacat: each occasion of what?
[03:05:41] jstrong: well depends on what 'each occasion' is
[03:06:25] jstrong: if your 'each occasion' is a model state then yes, you can set up certain validations to run and send different messages by context
[03:06:42] Shackleford: I am looking to create a membership site in rails. Not a SaaS, just a members that can login and see their profile and info. From what I understand this is "baked" into rails with gems. Which gems should i look into to accomplish this?
[03:07:06] sevenseacat: Shackleford: if you're looking for a gem that does authentication, devise is likely your best bet.
[03:07:15] jstrong: Devise for authentication, or auth_logic (but use decvse!)
[03:07:32] Shackleford: do gems also set up database schema?
[03:07:51] sevenseacat: if they rely on it, they will provide it
[03:08:18] sevenseacat: devise will set up the schema necessary for whichever model you specify as being the user model
[03:12:51] rushed: Shackleford: gems are things you add, so somewhat the opposite of baked in :) but you might find some examples helpful in determining if you want to look into devise http://railscasts.com/episodes?search=devise
[03:18:08] jstrong: Radar, you are somewhat familiar with rails source, correct?
[03:18:14] Radar: jstrong: yup
[03:18:18] Radar: It's just Ruby code. Nothing to fear.
[03:18:37] jstrong: yeah the code itself doesn't look too crazily complex, but where would you start for getting a grounds up understanding?
[03:18:40] jstrong: because it is big
[03:18:54] sevenseacat: i'd start looking into bits as you need them
[03:18:57] jstrong: haha good answer
[03:19:56] sevenseacat: if you're just like 'im going to learn rails internals today' you'll get nowhere due to the sheer size and scope of it
[03:20:07] jstrong: yeah. fair enough
[03:20:17] jstrong: I guess I'll start with routing and actually submit that pull request for a bug I found a year ago.
[03:20:27] sevenseacat: good place to start :)
[03:20:40] sevenseacat: ive filed bugs with rails, never fixed any
[03:20:46] Shackleford: anyone use angular in the rails app
[03:21:32] rushed: Shackleford: none, ever, and none have written any blog posts about it or guides or anything that would be searchable by google for sure :)
[03:21:47] Shackleford: lol, I know what you mean
[03:21:56] jstrong: be the pioneer!
[03:22:00] Shackleford: but my specific question is using angular and devise
[03:22:49] Shackleford: never mind, I will pioneer into the world of google and figure it out. lol, thanks everyone.
[03:23:07] sevenseacat: well you didnt ask your specific question so no-one could help you
[03:23:21] willmarshall: Hey Radar - do you know how to test xhr requests in Spree? Not finding much documentation for spree_get, spree_post etc
[03:23:22] sevenseacat: <-- not a mind-reader
[03:23:36] sebkomianos: haha guys, are you regulars here?
[03:23:51] rushed: Shackleford: "angular devise current user" <= start there :)
[03:24:00] sevenseacat: some of us are.
[03:24:10] sevenseacat: we see a lot of silly shit.
[03:24:14] Radar: jstrong: yeah... I've just been looking at where I have needed the.
[03:24:24] rushed: Shackleford: or better yet "ember devise current user" :)
[03:24:25] Shackleford: perfect, thanks rushed. I will do some research and then comeback and ask questions, thanks.
[03:24:33] Radar: willmarshall: spree_get & spree_post just work the same way as Rails's own get & post
[03:24:49] sevenseacat: i need to get back to ember
[03:25:01] sebkomianos: sevenseacat: I thought I annoyed a guy called bf4 a couple of hours ago
[03:25:13] sevenseacat: you probably did
[03:25:42] jstrong: Radar: needed the what?
[03:26:55] sebkomianos: sevenseacat: feel free to be annoyed too if you fancy, I still haven't managed to solve my problem: http://stackoverflow.com/questions/20407501/extending-activerecord
[03:27:20] Radar: jstrong: needed to know how it works*
[03:27:45] sevenseacat: sebkomianos: interesting idea
[03:28:18] jstrong: btw slightly off topic, me and my brother had an idea: implement the original google page ranking algorithm for gemspecs and use dependencies as a link
[03:28:25] jstrong: as rubygems just ranks by downloads
[03:29:21] rushed: sebkomianos: why do you think a class macro would have access to the errors collection of a particular instance?
[03:29:25] sevenseacat: sebkomianos: i think you're going about it the entirely wrong way though
[03:30:03] sevenseacat: and why is this validation done at declare time, not validation time
[03:30:29] rushed: sebkomianos: also, have you presented a compelling reason for why you're trying to rework the existing (and functional) limit option to has_many? :)
[03:30:41] sebkomianos: this is part of a coding test
[03:31:07] sevenseacat: i'd say you're failing
[03:31:08] rushed: sebkomianos: maybe the test is to determine if you can avoid reinventing the wheel?
[03:31:19] sebkomianos: as much as I am new to ruby and rails I am myself confused as well in regards to why this should be done like this
[03:31:31] sevenseacat: TIL about the limit option of has_many
[03:31:51] sebkomianos: I have pretty much only added the "if options[:validate]" statement
[03:32:11] sevenseacat: its not in the docs D:
[03:32:28] sebkomianos: everything else (that is, the "has X, :things" part) was already implemented
[03:34:36] sebkomianos: I don't think a limit option exists for associations, you'd have to have a method in the class
[03:34:48] sevenseacat: it doesnt appear to exist
[03:34:52] luckyruby: Looking for some feedback on this code https://gist.github.com/luckyruby/81f4f737c9f2ac71ed79
[03:35:16] sevenseacat: luckyruby: test the shit out of it, then rewrite it.
[03:35:38] luckyruby: i mean aesthetically
[03:36:08] sebkomianos: sevenseacat: any leads on what would be the best way to implement it for ActiveRecord?
[03:36:11] sevenseacat: hence rewriting it.
[03:36:38] luckyruby: sevenseacat: yea, any suggestions on how to rewrite it to not be ugly?
[03:36:41] sevenseacat: sebkomianos: learn the difference between class methods and instance methods
[03:37:15] luckyruby: i'm tempted to write it in raw sql to make it less ugly
[03:39:00] jstrong: you can use includes instead of those left outer joins
[03:39:07] jstrong: and combine those with has many throughs for ultimate awesomeness
[03:39:29] jstrong: luckyruby mind including the relevant models being joined with their associations as defined in ruby?
[03:39:55] luckyruby: jstrong: yes! much nicer
[03:43:19] jstrong: luckyruby going to update the gist? :)
[03:43:22] luckyruby: thanks, figured there had to be some low hanging fruit there
[03:44:14] sebkomianos: sevenseacat: sorry, was afk, I have actually changed the code a bit https://gist.github.com/sebkomianos/a9419005d744daa49801
[03:44:15] luckyruby: any tips on making .where() look nicer?
[03:46:09] jstrong: luckyruby you want to break it into digestible pieces
[03:46:35] jstrong: prepaid_rentals.id IS NULL AND breakages.id IS NULL
[03:46:48] luckyruby: by using multiple wheres?
[03:49:44] jcutrell: Hey folks - I have an interesting SQL query question.
[03:50:14] jcutrell: I have class dates and courses (the course has_many classdates)
[03:50:47] jstrong: luckyruby https://gist.github.com/laspluviosillas/64e7e92c72cf372d4b78
[03:50:56] jcutrell: there is an integer field on the course model representing a number of days before a given class date to send a reminder email to students.
[03:51:11] jcutrell: So, course.reminder_day_interval
[03:51:18] jcutrell: as well as Classdate.startdatetime
[03:51:43] luckyruby: jstrong: excellent
[03:51:45] jcutrell: I'm wanting to query all class dates that are course.reminder_day_interval.days away from now.
[03:52:01] sevenseacat: jstrong: i'd look at using AR syntax instead of sql, eg. includes(:prepaid_rentals).where(prepaid_rentals: {id: nil})
[03:52:12] jcutrell: So a magic query would look like:
[03:52:13] jstrong: sevenseacat yes good point
[03:52:21] sevenseacat: but when would the id ever be nil
[03:52:29] jstrong: if you want to exclude
[03:52:35] jstrong: left outer join with nil id is one way of doing that
[03:52:46] luckyruby: jstrong: what's another way?
[03:53:13] jstrong: i think you can do it by putting a condition on the join directly but what you're doing is fine in my opinion
[03:53:19] jcutrell: Classdate.joins(:course).where("startdatetime < ? AND startdatetime > ?", Time.now + course.reminder_day_interval.days, Time.now + (course.reminder_day_interval + 1).days)
[03:53:35] jcutrell: Obviously the course is undefined in that example.
[03:54:08] jcutrell: (And I didn't get the order right on that example)
[03:54:18] jstrong: luckyruby the where that remains
[03:54:20] jstrong: what does that do exactly?
[03:54:39] luckyruby: X is for cancelled reservations
[03:54:52] jstrong: and the pickup datetime bit?
[03:54:53] luckyruby: to qualify for breakage, a reservation can't be cancelled and must be older than a certain # of days
[03:55:03] jstrong: so more fun
[03:56:32] luckyruby: jstrong: what are your opinions of defining those first 3 methods as inner methods within qualified_for_breakage?
[03:56:46] sevenseacat: i wouldnt define methods within methods
[03:56:52] sevenseacat: no point to it
[03:57:12] luckyruby: i know there's no nested methods in ruby but I think it may be clearer in intent
[03:57:15] jstrong: luckyruby https://gist.github.com/laspluviosillas/64e7e92c72cf372d4b78
[03:58:36] luckyruby: jstrong: looks great
[03:58:53] jstrong: rename the methods to whatever fits them best
[03:59:12] rhizome: available, unbroken
[03:59:22] jstrong: luckyruby is this rails 3 or 4
[03:59:58] jstrong: that's as far as I can take it without more knowledge of the app
[04:00:07] jstrong: there's probably some extra steps you could take it but yeah
[04:00:17] jstrong: tl;dr: take advantage of chainable ARel
[04:00:37] luckyruby: what about making active a scope of Reservation?
[04:00:46] jstrong: that's what I did
[04:01:11] luckyruby: scope :active, where("status <> 'X'") instead of a self method
[04:01:34] jstrong: same thing
[04:01:42] jstrong: well there are some differences but
[04:03:09] jstrong: class methods are better imo
[04:03:26] jstrong: scope was more of a thing in rails 2 before everything was an ActiveRecord::Relation object so scopes allowed you to chain
[04:03:32] jstrong: while class method queries would execute immediately
[04:03:44] Radar: scopes and class methods each have their place
[04:03:49] Radar: 1 line scopes can't be beaten by class methods
[04:03:50] jrobeson: now scopes are basically class methods that return all
[04:04:31] jrobeson: (if no result)
[04:04:50] jstrong: scopes are also somewhat more declarative
[04:05:06] jstrong: but if you want to pass in arguments then class methods are just better than putting a lambda in a scope in my opinion
[04:05:31] jstrong: and you also have to be careful because sometimes you require lambda's for scopes when you're using variables in the query and that trips up newbies
[04:12:06] jcutrell: this is what I ended up doing, for anyone interested:
[04:12:07] jcutrell: classdates = joins(:course).where("startdatetime > (timestamp '#{today_start}' + (reminder_day_interval * interval '1 day')) AND startdatetime < (timestamp '#{tomorrow_start}' + (reminder_day_interval * interval '1 day'))" )
[04:12:47] jstrong: jcutrell to be honest I wanted to help but since you typed out the message in about 10 different enters it was spread across the convo and really hard to put all the information together
[04:13:20] jcutrell: Makes sense. No worries - it was a pretty specific problem, so it would have been more frustrating than intriguing. :)
[04:13:22] jcutrell: Sorry about that.
[04:13:30] jstrong: do today_start and tomorrow_start come from params
[04:13:36] jstrong: potential sql vulnerability with that code
[04:14:36] enape_101: if i'm setting a date a) how do I get a calender drop down in the form? and b) how do I set am, pm when it displays?
[04:14:50] jstrong: enape 101 that's javascript territory
[04:15:12] jstrong: there's a number of date picker plugins to pick from, the one that comes with jquery ui being one of the most widely used
[04:15:20] jcutrell: jstrong they do not.
[04:15:29] jcutrell: jstrong that would be scary. :)
[04:15:43] jstrong: k, just checking
[04:15:58] enape_101: awesome, thanks jstrong
[04:16:18] jcutrell: jstrong: What's the easiest way to grab the output of an erb view into a variable? Trying to save record of emails sent through the system.
[04:16:45] jstrong: jcutrell a rails rendered erb view you mean?
[04:17:20] sevenseacat: render_to_string ?
[04:17:22] jcutrell: jstrong: Sure. Really, I just want to be able to abstract a long string out to a view file to run erb on and fill in templated values.
[04:17:49] jstrong: i think sevenseacat's answer is the right one
[04:17:53] jstrong: i wasn't aware of that method. nifty.
[04:18:18] jcutrell: I'm assuming it has access to ivars
[04:18:58] jstrong: from what i've read render_to_string does exactly what render does but to string instead
[04:19:02] jstrong: so exactly as advertised
[04:19:13] sevenseacat: i like when things do what they say on the tin.,
[04:19:17] jstrong: would deal with again
[04:24:43] jcutrell: It looks like you have to render_to_string with an action?
[04:24:57] jcutrell: I don't have a specific action tied to this. It's more like a partial.
[04:26:24] luckyruby: jstrong: https://gist.github.com/luckyruby/81f4f737c9f2ac71ed79 Thanks again. That was exactly the feedback I was looking for.
[04:27:56] jstrong: can't you move the prepaid amount part to sql as well
[04:30:29] luckyruby: jstrong: updated the gist
[04:31:03] luckyruby: I probably could but not sure it's worth doing
[04:32:50] jstrong: luckyruby yeah you could because atm it's a n+1 query
[04:33:01] jstrong: but at least a minor refactor is don't use .map(&:amount) use .pluck(:amount)
[04:33:23] jstrong: transactions.where(action: 'charge').pluck(:amount)
[04:33:44] jstrong: you can put that action: 'charge' bit into the transactions model as well with Transaction.charges and Transaction.refunds
[04:33:45] luckyruby: ah yea, keep forgetting about pluck
[04:34:03] jstrong: but really the best way would be with subqueries
[04:34:15] luckyruby: yea, they're already scopes of Transaction
[04:34:15] jstrong: which can be a royal pain to put together
[04:34:29] jstrong: at least while keeping ruby/arel syntax
[04:35:38] jstrong: luckyruby let me give it a shot just a sec
[04:37:16] luckyruby: jstrong: not sure it's an n+1 query in the way I'm using it. That's why I'm eager loading transactions.
[04:37:31] jstrong: that's true
[04:37:54] jstrong: in which case you'd want to keep the select and not the pluck as i showed
[04:37:59] jstrong: can the transactions get to be a pretty big array?
[04:38:11] jstrong: i guess it's probably fine for most purposes but in a large database you would probably need to use subqueries
[04:38:28] luckyruby: yea, i'll cross that bridge when I get there
[04:38:44] jstrong: in any case I'll take a shot just because I am terribly bored at the moment
[04:39:05] luckyruby: i don't think the array will be all that large. Breakage is for unused prepayments.
[04:39:14] luckyruby: which should be pretty rare (at least I would think)
[04:39:38] jstrong: https://gist.github.com/laspluviosillas/e0c41bc085a2a5b9a664
[04:39:44] jstrong: in the comfortable blissful world of theory that should work
[04:40:13] jstrong: but maybe overkill
[04:40:32] luckyruby: i think that'd make it faster but less dry
[04:41:45] enape_101: ah shit, unfortunetly there's no way to select a time with jquery datepicker
[04:41:59] luckyruby: enape_101: there are plugins for time
[04:42:03] jstrong: enape 101 just have a date field
[04:42:16] jstrong: and a separa??? nvm
[04:42:19] luckyruby: but usually I just add a time helper next to date picker
[04:42:41] luckyruby: then let your controller create a datetime object out of those params
[04:46:49] enape_101: hm, alright i'll try that thanks luckyruby
[04:54:20] tobobo: Can anyone help me debug using asset_sync with S3 and heroku?
[04:54:45] tobobo: when I run rake assets:precompile it takes about 10 seconds, doesn't raise any errors, but doesn't upload to S3
[04:55:59] Lann: so???i moved an app from one machine to another, how is it that devise is sending emails from my previous domain ???yet that domain is nowhere in my codebase?
[05:01:07] Radar: Lann: MAGIC
[05:01:14] Lann: seriously
[05:01:25] Lann: i have no idea where that number is coming from otehr than it was my old domain
[05:01:27] Radar: Lann: check config/initializers/devise.rb?
[05:01:31] Radar: What number?
[05:01:48] Lann: egrep -Ro '10\.0\.1\.3' .
[05:02:32] Lann: yet the server logs for a rails app in that folder show it sending confirmation links with that ip address
[05:12:21] enape_101: what's this? when i run rails s now -- uninitialized constant ActionView::Helpers::InstanceTag (NameError)
[05:12:41] rushed: enape_101: probably want to gist the entire error stack and related code :)
[05:12:43] enape_101: full error sorry: /usr/local/rvm/gems/ruby-2.0.0-p247/gems/jquery_datepicker-0.4/lib/app/helpers/form_helper.rb:33:in `<top (required)>': uninitialized constant ActionView::Helpers::InstanceTag (NameError)
[05:14:35] waseem_: enape_101: Probably an uninstalled gem. But bundler should shout about it. Try bundle exec rails s.
[05:14:50] enape_101: thanks waseem_, i'l try that
[05:16:10] enape_101: waseem_ same out put even with bundle exec rails s
[05:16:31] enape_101: i've just installed the jquery datepicker gem so not sure why i'm getting this error
[05:17:19] waseem_: enape_101: Neither do I.
[05:39:29] DarkGhost: I'm not very familiar with ROR but can I add myself as a user with this http://xpg-network.com/dg/ROR.png
[05:40:46] rvanlieshout: DarkGhost: use the rails console
[05:41:02] rvanlieshout: what you've pasted is just the mapping of url to controller actions
[05:41:07] DarkGhost: I don't have access to shell
[05:41:18] DarkGhost: so I can't add a user through that
[05:41:20] DarkGhost: through url?
[05:41:30] rvanlieshout: then you have to use the application
[05:41:34] rvanlieshout: in the way it is designed
[05:41:37] enape_101: full error sorry: /usr/local/rvm/gems/ruby-2.0.0-p247/gems/jquery_datepicker-0.4/lib/app/helpers/form_helper.rb:33:in `<top (required)>': uninitialized constant ActionView::Helpers::InstanceTag (NameError)
[05:43:08] DarkGhost: rvanlieshout ahh so I can't add myself through url or something with /users::
[05:43:24] rvanlieshout: DarkGhost: that depends on the application
[05:43:45] DarkGhost: i don't know what ::Format means
[05:43:46] rvanlieshout: rails doesn't describe how something should work and the routing table is nothing more then a mapping
[05:44:15] rvanlieshout: DarkGhost: imo you should a) forget about this table or b) learn about rails
[05:44:21] rvanlieshout: what if you just open the website?
[05:44:31] DarkGhost: it works but I thought I could add myself as a user and be all cool
[05:44:32] DarkGhost: but i guess not
[05:44:45] rvanlieshout: one just cannot say if that is possible
[05:44:52] rvanlieshout: without looking at the code
[05:45:32] rvanlieshout: Rails is not just a webapp
[05:45:39] rvanlieshout: it's a framework... one can create webapps with it
[05:45:53] rvanlieshout: without limitations or dictating what it should do
[05:46:45] DarkGhost: i understand that
[05:46:55] DarkGhost: what does the (::format) mean
[05:47:19] rushed: DarkGhost: ex: .js
[05:47:23] RubyPanther: I think it is for the floppy disk
[05:47:23] rvanlieshout: the format in what you want your answer in
[05:47:26] rvanlieshout: default would be html
[05:47:40] rvanlieshout: well.. unless the default has been changed
[05:48:03] rvanlieshout: and it's unknown what formats are supported by this app
[05:48:05] DarkGhost: ahh thank you RubyPanther that worked perfectly
[05:49:00] DarkGhost: whenever i go to one of those it redirects me to sign in
[05:49:01] RubyPanther: DarkGhost: You do know that you'll have to read a bunch of manuals eventually? Asking humans things that are in the basic tuts only slows you down
[05:49:03] DarkGhost: why didnt the person remove this
[05:49:18] DarkGhost: I'm not trying to learn ROR I'm just trying to see if this was a vulnerability
[05:49:26] rvanlieshout: DarkGhost: one should never remove that
[05:49:33] DarkGhost: i mean atleast visiblity to it
[05:49:42] RubyPanther: How can you possibly know without learning a bunch of stuff first?
[05:49:45] rvanlieshout: DarkGhost: the fact that you see this means the application is running in development
[05:49:50] rvanlieshout: DarkGhost: that's something wrong indeed
[05:50:17] DarkGhost: well RubyPanther I could ask the #ROR channel but gyess not
[05:50:50] rvanlieshout: DarkGhost: know that rails is not just a language.. it's a complete framework and knowledge of a lot of things is required before you could start using it
[05:51:15] grahamsavage: hey ok i have a couple of quick questions about pg gem
[05:51:35] grahamsavage: 1. How can you tell whether it has made a socket connection or a tcp connection and whether that connection is using SSL or not?
[05:51:44] grahamsavage: 2. how can you force it to make a socket connection?
[05:51:47] rvanlieshout: grahamsavage: by disabling others in your pg config
[05:51:59] rvanlieshout: grahamsavage: by using the proper configuration settings
[05:52:29] grahamsavage: i haven't defined a hostname and i haven't defined a port.. what are the proper settings?
[05:52:39] grahamsavage: oh in the pg_hba or whatever, i actually have to disable the other ones?
[05:53:54] rvanlieshout: don't know how you disable the others.. the pg gem documentation should inform you about what the defaults are
[05:54:04] grahamsavage: yeah i have been reading it
[05:54:12] rvanlieshout: http://deveiate.org/code/pg/PG/Connection.html#method-c-new
[05:54:14] grahamsavage: http://rubydoc.info/gems/pg/PG/Connection
[05:54:24] rvanlieshout: but it doesn't describe the defaults
[05:54:44] grahamsavage: lol yep.. also it drops down to C in the connection method and none of those variables are saved
[05:55:22] grahamsavage: i.e. it forwards it directly onto libpq
[05:55:40] rvanlieshout: and the defaults of libpq?
[05:56:01] grahamsavage: no idea... but i really don't like the design
[05:56:12] grahamsavage: lol.. type: TCP or TYPE: socket would be nice
[05:56:14] rvanlieshout: that i actually like.. this gem doesn't restrict the params
[05:56:27] rvanlieshout: what if you specify socket and remove host or hostname?
[05:56:32] rvanlieshout: that's the common way
[05:56:54] tfittsy: has anyone here tried using the rails-dust gem? there seems to be like no documentation on it, which makes me wonder if it's too new or just a bad way to go.
[05:58:01] grahamsavage: hmm stackoverlow says the 'socket' config line does not apply for PostgreSQL.
[05:58:19] rvanlieshout: tfittsy: no documentation is a bad sign indeed
[05:58:44] ddd: hmm, I have a Trip, a Leg and an Address model. A leg can have two addresses associated with it. start_address & end_address. Its associated with a single Trip. I was thinking I needed to: Leg has_many :addresses ; has_one :start_address, foreign_key: 'trip_id', class_name: "Address" ; has_one :end_address, foreign_key: 'trip_id', class_name: "Address" ; belongs_to :trip and Trip has_many :legs
[05:58:54] rvanlieshout: grahamsavage: host /tmp ?
[05:58:58] rvanlieshout: it'v seen that happen somewhere
[05:59:27] rvanlieshout: ddd: you don't need the has_many
[05:59:27] grahamsavage: rvanlieshout: yeah i saw that
[05:59:31] grahamsavage: i has no idea how it works :)
[05:59:41] tfittsy: rvanlieshout: I know LinkedIn just switched over to dust, but they use it with node. I was looking at mustache, and then handlebars, and now I'm looking at dust. From a feature comparison it seems the best but as far as getting it running in a view I'm not sure what to do.
[05:59:54] rvanlieshout: grahamsavage: sockets are located in /tmp
[06:00:10] grahamsavage: oh so if pg has one running.. it should exist
[06:00:14] rvanlieshout: tfittsy: can't help you there.. don't know about dust
[06:00:16] rvanlieshout: grahamsavage: exactly
[06:02:03] grahamsavage: local all postgres peer << that's from hba conf so you'd expect a socket file to exist
[06:02:08] grahamsavage: maybe i'll go ask in #postgresql
[06:03:25] Lann: My devise issue was resolved with rake assets:clean
[06:03:26] rvanlieshout: grahamsavage: a netstat -an or lsof could also show you the used method
[06:03:30] Lann: what did i copy over that I shouldnt have?
[06:04:02] grahamsavage: unix 2 [ ACC ] STREAM LISTENING 12618 /var/run/postgresql/.s.PGSQL.5432 << ryan
[06:04:20] rvanlieshout: grahamsavage: so there you have your socket
[06:04:44] rvanlieshout: and an lsof -p <pid of your ruby process>?
[06:06:48] ddd: rvanlieshout: The confusing part is, I have a Trip, made up of many legs. each leg has a start address and an end address which is only a portion of the entire trip (could have 6 legs to finish the trip for ex.) Trip needs a start address and an end address (the originating and final destination)
[06:07:25] rvanlieshout: ddd: and the trip addresses are in a specific order i assume?
[06:07:30] ddd: and I need to see all the legs it took to complete that trip. both leg and trip need addresses
[06:07:53] rvanlieshout: ddd: o wait..
[06:08:03] rvanlieshout: why does trip need addresses?
[06:08:13] rvanlieshout: shouln't it just have 6 legs?
[06:08:29] ddd: rvanlieshout: well Legs[0] will usually be the Trip.start_address. Legs[N]'s end_address will be Trip's end_address
[06:08:46] rvanlieshout: ddd: usually isn't good enough
[06:08:53] rvanlieshout: give your legs an index ofiets
[06:09:12] ddd: because the trip needs to record the origination address, and the final destination. we also need to track how many legs it took and where each leg started and ended along the route
[06:09:43] ddd: each leg's start address will be the previous leg's end_address.
[06:10:45] rvanlieshout: then a leg doesn't need to have both a start and end address
[06:11:02] ddd: rvanlieshout: here. We're getting, say, a dog out of the shelter. We're transporting from the shelter to a rescue. The rescue finds an adopter. We rarely get a single person who will transport the entire way. We get 5 or 6 people each driving a portion of the total route
[06:11:44] rvanlieshout: so what is the actual problem again? :)
[06:12:08] ddd: But for the trip (because the trip will have a start address and a final address regardless of the number of legs) we need to record where this animal originated from, and where it will end up
[06:12:32] grahamsavage: ddd: is this a real life problem?
[06:12:37] ddd: grahamsavage: yes
[06:12:44] grahamsavage: ddd: nice, i like it :)
[06:13:00] ddd: A trip will have several transporters, but each leg will have only 1.
[06:13:26] enape_101: http://stackoverflow.com/questions/20417254/uninitialized-constant-actionviewhelpersinstancetag-nameerror-jquery-dat
[06:13:32] ddd: Trip.transporters is all the Trip.legs transporters
[06:15:24] ddd: So the Trip is where we got the dog from, and where its going. We'll be recording each transporter, where they received the animal, and where they're going to (the next Leg transporter will meet the previous transporter at their Leg.end_address) and the *final* leg's end_address will be Trip's end_address
[06:15:43] ddd: but not sure how to properly model this if Address is a model in it's own right
[06:16:07] ddd: trying not to add address fields to every model and use an Address model instead
[06:17:41] ravionrails: so address belongs to trip and leg, so it should polymorphic imo
[06:18:10] ddd: so the problem is I can't use a has_one :address in Leg or in Trip. I can do a Trip has_many addresses, through: Legs but I need to have Trip have a start_address and an end_address (of type Address) in it's own right (so we can match and verify beginning leg and ending leg addresses against it)
[06:20:08] ddd: since we'll be getting transportation grants based on these trips, we need to document every inch these animals travel is basically the problem. and some of who we deal with just need Trip.start_address and Trip.end_address data and the names of Transporter(s). thats it. but we HAVE to record the individual legs that it took to get the whole Trip done too (for still others)
[06:21:01] ddd: plus the Leg.start|end_address data will be used to generate google map lookups from (as well as an overall Trip map)
[06:22:07] ddd: thats why its so important to capture the start and end addresses as well. Now, I can simplify associations if I just put a set of address fields in each model, but thats too repetative
[06:22:59] ddd: so I made an Address model. (but I'm wondering, and it was mentioned as a possibility) if I shouldn't just make an Address module and mix it in to each model
[06:23:02] enape_101: pls help guys, http://stackoverflow.com/questions/20417254/uninitialized-constant-actionviewhelpersinstancetag-nameerror-jquery-dat
[06:23:10] rushed: ddd: you might find these helpful https://github.com/mceachen/closure_tree https://github.com/collectiveidea/awesome_nested_set
[06:23:27] ddd: rushed: looking
[06:23:33] rushed: enape_101: probably want to gist the entire error stack and related code :)
[06:24:04] enape_101: alright, 1 sec rushed
[06:24:11] ddd: just seems like what i think would be the association choices work one way or on one side but not the other
[06:24:19] ddd: so confusing myself a bit :)
[06:25:21] ddd: and using habtm just seems like i'm doing it wrong.
[06:25:53] enape_101: rushed, https://gist.github.com/naushadparpia/7819419
[06:26:03] enape_101: tht's the full error, and the code i provided in s.o post is all there is
[06:26:06] rvanlieshout: ddd: what's wrong with habtm?
[06:26:06] enape_101: not sure what's breaking
[06:26:10] rvanlieshout: i've seen so much fuss about it
[06:26:38] ddd: rvanlieshout: it seems like i'm overstating the associations using habtm
[06:28:27] ddd: because Trip has_and_belongs_to_many :legs doesn't seem right. A leg doesn't have many trips. it has one. A trip has_many legs. its just that there are so many address needs per model
[06:31:17] ravionrails: Trip and Leg has two addresses, start_address and end_address
[06:31:20] ddd: make sense? (or did i explain enough to show where I'm failing to grasp something?)
[06:31:47] freedrull: i don't know why but s3_direct_upload is not rendering my form with the s3_uploader_form helper https://gist.github.com/mcfiredrill/7819456
[06:31:57] ddd: they are not always the same (*usually* the first leg's start is the same as Trip's, and the last leg's end_address is Trip's end_address)
[06:32:57] ddd: but sometimes we have to record that a person brought the dog from somewhere to the first leg's start address but that person isn't considered a leg (usually that's the 'puller')
[06:34:10] ddd: Shelter has the animal, a puller gets the animal and takes it to the first leg in most cases. The trip starts being recorded there. However, we also have instances where its the first leg that is the first leg AND the puller so the first leg *does* start there
[06:34:41] rushed: ddd: you need a rubber duck sir :)
[06:34:47] ddd: tell me about it
[06:35:26] ddd: the legs get paid for milage, the pullers usually don't unless they're a leg in which case they do.
[06:37:11] ddd: so for every bit that *is* paid, we have to record it. However, state laws also usually require that we record which shelter the dog was gotten from, who pulled it, where they took it, and to which leg it was handed off to (and to add MORE to the mix, we have to record which vet as required by law it was taken to, but the veet trip is a separate trip that gets recorded along with the To-The-Adopter trip as well
[06:37:51] ddd: forms a 'packet' on the dog's handling from shelter to vet to rescue to adopter.
[06:38:19] ddd: (bear in mind, i'm just using a dog for this example. We deal with all domesticated animals, not just cats and dogs)
[06:38:51] ddd: Anything that isn't required to be reported to Game and Wildlife or Dept. of Agriculture hehe
[06:39:20] rushed: enape_101: a) it looks like you're running rails 4.0.0.rc1, there is almost no situation where that is okay (you probably want '~> 4.0.1') b) there are several open issues on that gem which suggest it is not rails 4.x compatible https://github.com/albertopq/jquery_datepicker/issues
[06:40:00] enape_101: ah, thank you so much rushed thats most certainly it
[06:40:36] rushed: oops I'm a couple days behind... '~> 4.0.2' :)
[06:41:28] ddd: screw it. I'll review rushed's suggestions in the morning and sleep on the assocs tonight. maybe it will come to me in the morning
[06:41:45] ddd: didn't realize its almost 2am
[07:24:50] enape_101: how to get jquery datepicker working with rails 4?
[07:25:25] rvanlieshout: enape_101: rails is server-side
[07:25:27] rvanlieshout: jquery client side
[07:25:44] rvanlieshout: look at the client side for your problem
[07:26:09] enape_101: apparently it's clashing with ActionView::Helpers::InstanceTag
[07:26:18] rvanlieshout: jquery doesn't use an instance_tag
[07:26:25] enape_101: this is a known issue with rails 4 and jquery datepicker,
[07:26:27] rvanlieshout: show us the code and error
[07:26:50] enape_101: https://stackoverflow.com/questions/20417254/uninitialized-constant-actionviewhelpersinstancetag-nameerror-jquery-dat
[07:27:02] enape_101: here's my post rvanlieshout, if you look at the answer posted there is a fix
[07:27:12] enape_101: however, not quite sure how to implement it you might know better :)
[07:27:17] rvanlieshout: a jquery datepicker gem
[07:27:38] rvanlieshout: that gem could just not be complatible with rails 4
[07:27:49] enape_101: apparently that's the case
[07:28:00] sevenseacat: according to that SO thread, yes
[07:28:04] rvanlieshout: https://github.com/albertopq/jquery_datepicker/issues
[07:28:12] rvanlieshout: if you want to use rails 4, drop that gem
[07:28:17] rvanlieshout: and just include jquery's datepicker js yourself
[07:28:24] enape_101: ah that might be it huh
[07:28:29] enape_101: alright 1 sec, thanks rvanlieshout
[07:28:30] sevenseacat: i dont know why you would need a gem for a js library
[07:30:29] enape_101: sevenseacat, fair enough
[07:31:26] sevenseacat: gems that provide integration with rails, fair enough; but all that does is provide the jquery libraries
[07:31:59] enape_101: sevenseacat, gotcha..
[07:32:57] enape_101: getting a couldn't find file 'jquery-ujs'
[07:33:11] enape_101: after running bundle exec rake assets:precompile
[07:33:35] sevenseacat: put jquery-rails back in your Gemfile.
[07:34:01] enape_101: it's there still
[07:34:23] sevenseacat: question question question all with zero context
[07:34:50] enape_101: I removed jquery-datepicker gem but not jquery-rails
[07:35:06] enape_101: 1 sec you gave me an idea sevenseacat :)
[07:35:16] rvanlieshout: don't remove jquery-rails :)
[07:35:37] enape_101: nope i had jquery ujs in .js file
[07:35:45] enape_101: but i suppose that ships with jquery-rails
[07:35:46] rvanlieshout: remove that file
[07:36:24] helpa: http://i.imgur.com/m9m3wr9.gif
[07:37:37] intuxicated: in http://guides.rubyonrails.org/getting_started.html , section 5.7 , says "so let's add the show action before proceeding." where i should put this ? "post GET /posts/:id(.:format) posts#show"
[07:37:52] sevenseacat: intuxicated: you dont put it anywhere, its the output of running rake routes
[07:37:56] sevenseacat: it doesnt say to put it anywhere
[07:39:09] intuxicated: yeah it doesn't
[07:40:04] intuxicated: also doesn't say run rake routes
[07:40:33] sevenseacat: indeed, you dont have to
[07:40:36] sevenseacat: its being informative
[07:43:52] enape_101: so datepicker is great for dates, but wht about times?
[07:44:02] sevenseacat: timepicker? :)
[07:44:16] enape_101: ;) ok 1 sec
[07:48:16] enape_101: couldn't find file 'jquery-ui-timepicker-addon'
[07:48:48] sevenseacat: and where is this file?
[07:49:02] sevenseacat: no, where is the timepicker addon
[07:50:23] enape_101: lets try this //= require jquery.timepicker.js
[07:50:35] sevenseacat: are you just trying random pieces of code?
[07:50:41] rvanlieshout: that's bad :)
[07:51:03] enape_101: lol, no not sure how asset pipeline works completely yet but i thought by requiring it pulls the library
[07:51:16] sevenseacat: only if you have the library for it to require
[07:51:22] sevenseacat: where is the library and what is it called?
[07:51:32] enape_101: so i need the timepicker library
[07:52:05] sevenseacat: if you want to use it, you actually have to have it, yes.
[07:52:17] enape_101: that makes sense and all but where do i get it, to require
[07:52:40] sevenseacat: it's a js library
[07:55:03] bricker`LA: "obviously" is my least favorite word in the english language
[07:55:22] sevenseacat: i love when people use it when they're making wild assumptions.
[07:55:23] enape_101: iguess here http://jonthornton.github.io/jquery-timepicker/
[07:55:26] sevenseacat: obviously they're right.
[07:55:44] sevenseacat: that is one of the many jquery timepicker addons, yes
[07:56:00] enape_101: so i download than store that dir in my stylesheets/js
[07:56:05] enape_101: don't kill me
[07:56:35] sevenseacat: you would put the css and js files for it in vendor/stylesheets and vendor/javascripts, yes
[07:57:05] sevenseacat: vendor/assets/stylesheets and javascripts, rather
[08:01:42] clocKwize: guys, I'm looping over some data and creating a bunch of content_tags, If I return them in an array, they are ignored, how do I join them together in such a way that rails converts them to html and joins them to the content?
[08:02:47] rvanlieshout: clocKwize: .inject(&:+)
[08:03:08] rvanlieshout: cause join doesn't respect the html_safe property
[08:07:19] Macaveli: Morning lads
[08:11:35] bricker`LA: "2056 examples, 0 failures" hot damn
[08:14:07] enape_101: rvanlieshout, https://gist.github.com/naushadparpia/7820249
[08:14:14] enape_101: not sure why timepicker isn't working here
[08:14:44] sevenseacat: 'not working' is the most useful error ever
[08:15:11] enape_101: basically. datepicker does what it's supposed to do on the form
[08:15:18] enape_101: but timepicker does nothing it's just a text field
[08:15:33] sevenseacat: compare where you're calling the datepicker and where youre calling the timepicker
[08:15:55] bricker`LA: And you probably have an error in your JS console telling you what the problem is
[08:17:02] enape_101: on the date, but that's where it should be called
[08:17:49] sevenseacat: no, in the js
[08:19:00] enape_101: is it because one's coffee syntax & the other jquery?
[08:19:37] sevenseacat: one is being called after the document is ready. one is not.
[08:19:39] agent_white: < sevenseacat> compare where you're calling
[08:19:54] rvanlieshout: enape_101: coffeescript is a syntax
[08:19:55] rvanlieshout: jquery is not
[08:26:37] enape_101: i've added JQuery -> infront of timepicker so document is ready and it still isn't working
[08:27:01] tobago: i created a rake task: https://gist.github.com/trinibago/7820346 but I wonder about the yamlized time object.
[08:27:03] sevenseacat: what js errors are you getting?
[08:27:26] tobago: my goal is to dump table data into fixtures.
[08:27:39] enape_101: and one thought might be, how does the form know which needs the timepicker and which needs the datepicker as they're both date fields
[08:27:44] tobago: but the timestamps are not yamlized as I expected it.
[08:28:04] tobago: btw. the rails console to_yaml did what I expected.
[08:28:27] sevenseacat: enape_101: the form doesn't know. in the JS you're telling the plugin which fields to set.
[08:28:51] sevenseacat: you're telling the same field to be a datepicker and a timepicker.
[08:28:59] sevenseacat: it cant be both.
[08:29:19] enape_101: exactly, that's the main issue
[08:29:30] enape_101: so i guess i need another column
[08:30:37] tobago: so what's the difference between the rake task yamlizing and rails conosle yamlizing?
[08:35:26] rvanlieshout: tobago: the difference between a rake task and a console?
[08:35:53] tobago: rvanlieshout, not exactly. i created a rake task: https://gist.github.com/trinibago/7820346 but I wonder about the yamlized time object.
[08:36:00] tobago: my goal is to dump table data into fixtures.
[08:36:22] rvanlieshout: and the problem again?
[08:37:13] tobago: but the timestamps are not yamlized as I expected it.
[08:37:58] rvanlieshout: they are mysql::Time objects
[08:40:50] rvanlieshout: either provide a yaml presentation for those or replace them with the string version
[08:46:30] tobago: rvanlieshout, how to let to_yaml replace it with a string version?
[08:46:52] tobago: though I wonder why it seem to work in the rails console?
[08:47:25] rvanlieshout: tobago: change the object before you transform it in to yaml
[08:47:54] rvanlieshout: try .inspect.to_yaml?
[08:50:06] tobago: rvanlieshout, mmh. .inspect.to_yaml is not an option. it's just a very long string then instead of some fixtures.
[08:50:54] tobago: rvanlieshout, changing the object before to_yaml is also not option i think, because it can be all kind of object (ActiveRecord)
[08:51:12] rvanlieshout: a rails console does something before it shows the object on screen
[08:51:16] tobago: i still wonder why to_yaml works as expected in rails console?
[08:51:39] rvanlieshout: the same as why a Person.where(name: 'foobar') directly shows results in a rails console
[08:51:40] tobago: mmh. any idea what it does?
[08:51:58] rvanlieshout: actually no :)
[08:59:10] tobago: mmh. it's the same behaviour with to_json. in rails console it works as expected but in a rake task it's a blank object.
[08:59:41] rvanlieshout: could you pastie your code?
[08:59:54] rvanlieshout: with the to_json you use in a task and what separate what you type in a console
[09:22:38] tobago: anyone an idea how to teach ActiveRecord how to yamlize timestamp columns?
[09:22:43] tobago: attributes
[09:24:00] tobago: is there a point where to hook in?
[09:25:54] rvanlieshout: check the class in a rails console
[09:26:00] rvanlieshout: is that a mysql::time?
[09:32:44] Zendist: Hey fellow railers (?) is this book worth my money and time, or a hoax? http://learn-rails.com/learn-ruby-on-rails.html
[09:35:14] rushed: Zendist: lol, not a hoax :)
[09:37:01] Zendist: rushed: Have you looked through it? Or know someone who's read it? Interested in knowing if its any good before buying :)
[09:37:37] tobago: rvanlieshout, yes it is.
[09:37:58] tobago: it is a mysql::time
[09:39:56] rushed: Zendist: sorry, just got a copy a few days ago haven't dug into it yet
[09:56:55] Psy-Q: can i return Contract objects when searching on ContractLines and doing joins(:contract) on that? e.g. ContractLine.full_text_search("foo").joins(:contract) <-- what to do if i want to get contracts back whose contract lines match that full text search, which is implemented as a scope?
[09:57:29] Psy-Q: the join part seems to work, i just don't know how to get the contracts it has joined out of there
[09:58:13] tbuehlmann: you're getting back CcntactLine objects as you request them. you'd need to use Contact or write a scope for ContactLine
[09:58:56] Psy-Q: ah, damn, because Contracts don't have ContractLines, they have ItemLines or OptionLines which are both ContractLines...
[09:59:27] Psy-Q: i thought i could implement the full_text_search scope as a concern and include it in various searchable models, so i'm including it on the base ContractLine and the Contract doesn't know what kinds of lines it would have to search in :(
[10:00:33] Zendist: rushed: I bought it now, going to start a read through :) - found some actual reviews, and it seems solid.
[10:41:26] jankees: I have a question, I have a site setup with a pretty straight forward setup using devise
[10:42:06] jankees: I want my users be able to connect to another service (MoneyBird ??? Oauth) so they can use their download their contacts to our application...
[10:42:49] jankees: Can you be signed in to two devise and another Oauth provider at the sometime?
[10:46:44] rushed: jankees: you might find some examples helpful http://railscasts.com/episodes/235-devise-and-omniauth-revised http://railscasts.com/episodes/359-twitter-integration
[10:50:38] drim: trying to send jobs from controller to my EM thread. What should I do for this? Resque or AMPQ? ampq looks a big shot to handle what I want to do but not sure resque is async
[10:51:49] rushed: drim: resque is async & requires redis as well as separate workers to be spun up and managed
[10:52:14] drim: so why there is an em-resque gem?
[10:53:30] universa1: drim: read the gem description? look what problem they're solving
[10:53:52] universa1: are you sure you need async redis / resque access?
[10:54:00] rvanlieshout: async redis access?
[10:54:04] universa1: are you sure you even need resque
[10:54:13] rvanlieshout: redis is mega fast.. why would you need async for that indeed
[10:54:17] drim: maybe not, Im beginning with ruby/em
[10:54:20] universa1: rvanlieshout: well, something like futures, non-blocking reads whatever
[10:54:47] drim: from the controller, when the user is requesting a specific email thread, my EM need to get it from the imap connection
[10:54:59] drim: this is what Im trying to do
[10:55:11] rvanlieshout: universa1: but one would have serious issues if a redis database is slow in answering
[10:55:34] universa1: rvanlieshout: yeah, haven't used it extensively... so this was more things to think about ;)
[10:55:39] rvanlieshout: drim: does the user have to wait for the mail to be fetched?
[10:56:25] drim: I want to get all emails from the email_thread. User will see email only if he clicks on the email_thread
[10:56:37] drim: so this is why I want to do it async
[10:56:49] rvanlieshout: drim: ok.. and what's the problem in performing this async?
[10:56:57] drim: keeping all imap connection in EM
[10:57:13] drim: just wondering the best way to do that
[10:57:18] rvanlieshout: the connection itself?
[10:57:31] rvanlieshout: in most cases mail is fetched live
[10:57:33] rvanlieshout: to get live results
[10:58:00] drim: im using that https://github.com/ConradIrwin/em-imap
[10:58:53] rvanlieshout: i would first create this using a normal imap client library
[10:58:59] rvanlieshout: so that you at least have it working
[10:59:02] rvanlieshout: then worry about the async part
[11:00:59] drim: but Im developing an API so it need to be async
[11:01:26] rvanlieshout: no it doesn't
[11:01:32] rvanlieshout: don't try to solve all problems at once
[11:02:13] rvanlieshout: away for around 30 min...
[11:02:23] drim: I have to keep connection open for "live" email
[11:05:27] jammanbo: Is it possible to reference assets (images) that live in a gem from one of your app's scss files? The gem doesn't store them in an assets directory.
[11:14:54] nettoweb: guys, I'm doing a feature to generate reports to my visitor (total access in his products and a lot of other things)... can someone suggest some best practices to save these data and show?
[11:14:56] Psy-Q: can i not chain two .where() as OR conditions?
[11:15:07] nettoweb: I dont know because its a lot of data
[11:17:40] rushed: Psy-Q: last I looked options were write it in one clause using SQL or AREL backflips to get the OR clause in
[11:18:05] rushed: nettoweb: super vague question is super vague :)
[11:18:34] Psy-Q: rushed: hmm. AREL isn't documented much, is it? where/how would i pass that in? :|
[11:18:41] Psy-Q: ooh! i think that won't work
[11:18:55] Psy-Q: i have a scope called full_text_search that i would like to chain with ORs
[11:19:16] Psy-Q: and the scope is done in the shape of a where(), so if i could chain where() with OR between them, that'd make everything work fine
[11:20:13] Psy-Q: if i do Contract.full_text_search("foo").full_text_search("bar") it does an AND between those two. but i can also do Contract.full_text_search("foo").full_text_search("bar", ContractLine) to search inside any associated ContractLines as well -- but only with AND so far
[11:23:11] nettoweb: rushed: I have a app where te visitor can add products, create his companies... and in dashboard I'd like to show the statistic about how many clicks he got, how many access and etc
[11:23:27] nettoweb: rushed: I dont know well how to perform these sql
[11:23:49] nettoweb: rushed: I'm looking for some tips about this topic
[11:24:52] nettoweb: because it's a feature that most of the apps have (that I use). so must be some good pratices to not keep my app slow because reports
[11:25:08] rushed: nettoweb: coming to an internet chatroom with vague questions about ill-defined features is probably not going to get you much actionable advise :)
[11:25:12] nettoweb: I want to learn more about this
[11:25:28] Psy-Q: https://github.com/zhdk/leihs/blob/rca_fulltext_search/app/models/concerns/searchable.rb <-- this is my implementation (don't laugh)
[11:25:49] luckyruby: nettoweb: Hi
[11:25:53] Psy-Q: i'd like to make that chainable with OR, but looking at AREL it seems i would have to specify the whole where using AREL then
[11:26:00] nettoweb: rushed: I just want to know how people do these queries
[11:26:17] nettoweb: if you cant help, I'll look for other resource
[11:26:40] luckyruby: Can u guys see this?
[11:27:08] nettoweb: but I didnt undertand why people may not help me.
[11:27:30] Psy-Q: luckyruby: why shouldn't we?
[11:28:26] luckyruby: Using a new client and something about registering with nickserv to talk
[11:28:49] jglauche: hey, I need to run a migration on a rails 2.3 install, have both ruby 1.8 and 1.9 installed, but cannot get rake to work. Is it possible to run migrations on the ./script/console ?
[11:29:06] Psy-Q: luckyruby: ah! ok. yes, it seems to work. one of the services would bug you on status if you were blocked, i think
[11:29:36] luckyruby: jglauche: rvm?
[11:29:40] jglauche: luckyruby: rbenv
[11:30:00] luckyruby: What error are you getting
[11:30:05] rushed: jglauche: you'll probably have better luck gisting the rake error and fixing whatever is unhappy :)
[11:30:09] luckyruby: Gist please
[11:31:01] jglauche: so, I don't have rake on the 1.8.7 version I installed; https://gist.github.com/Joaz/7822310
[11:31:31] jglauche: and... gem install rake results in a segfault
[11:31:38] jglauche: https://gist.github.com/Joaz/7822322
[11:32:00] Fire-Dragon-DoL: drop ruby 1.8.7 lol
[11:32:12] jglauche: rails 2.3. wouldn't run in 1.9.3
[11:32:47] Fire-Dragon-DoL: maybe you can try downloading rake gem
[11:32:49] Fire-Dragon-DoL: and installing gro
[11:34:57] clocKwize: If I call ActiveRecord::Base.establish_connection do I need to release the connection some how?
[11:35:18] jglauche: yup, that worked
[11:36:19] waseem_: clocKwize: You don't have to. AR will take care of itself.
[11:36:45] clocKwize: ok, I'm getting a "PG::UnableToSend: another command is already in progress" somewhere in my app
[11:36:49] clocKwize: just trying to track it down
[11:37:12] nettoweb: rushed: could you tell me how I search for these advices? is it related to business intelligent? right?
[11:39:34] jglauche: clocKwize: I don't think it likes to have multiple database connections open
[11:39:51] jglauche: clocKwize: and AR will connect automatically
[11:39:54] clocKwize: jglauche: sure it does, thats what the connection pool does..
[11:40:22] jglauche: as I recall there was something like connection_established?
[11:40:43] clocKwize: it opens a bunch of connections, it looks like another thread or something using the same connection, not sure how or why though
[11:40:54] rushed: nettoweb: sorry, it's unclear to me what you're trying to do :)
[11:42:28] rushed: clocKwize: unicorn? or something else forking?
[11:43:30] clocKwize: everything just uses models to get data, except a controller than just calls establish_connection to ensure its up and returns (its a health check thing for monitoring)
[11:43:36] Fire-Dragon-DoL: mhhh... rvm + nvm + direnv and every rails app is a completely different standalone application O_O
[11:44:11] Fire-Dragon-DoL: so I need node too
[11:44:44] Fire-Dragon-DoL: I have like: .ruby-version .gem-set .envrc .bowerrc .nvmrc and .rspec
[11:44:59] Fire-Dragon-DoL: when I join a rails directory "everything changes" xD
[11:55:04] tobago: how to make Mysql::Time.to_yaml write the time as a string simply?
[11:55:13] rvanlieshout: .to_s.to_yaml
[11:55:33] tobago: with datetime it works this way, but time is failing.
[11:57:01] tobago: rvanlieshout, to_s.to_yaml does'nt work: wrong argument type String (expected Data)
[11:57:26] rvanlieshout: the .to_s fails or the .to_yaml?
[11:57:39] rvanlieshout: ah wait.. to need to call .to_yaml on a string
[11:57:42] rvanlieshout: it would be the same
[11:58:13] tobago: rvanlieshout, I'll update the gist
[11:59:10] tobago: rvanlieshout, https://gist.github.com/trinibago/7822549 doesn't work because of already posted error message
[11:59:31] tobago: message: wrong argument type String (expected Data)
[11:59:44] tobago: to_yaml expects a Data object
[12:00:10] tobago: and YAML::quick_emit seem to deliver one.
[12:01:09] rvanlieshout: where is that commented code from?
[12:01:26] tobago: my the previous version works for datetime types (timestamp) but it can't be reloaded for simple time types.
[12:01:27] rvanlieshout: that impilies that it creates a proper timestamp
[12:01:42] tobago: rvanlieshout, it's from https://rails.lighthouseapp.com/projects/8994/tickets/340-yaml-activerecord-serialize-and-date-formats-problem
[12:02:05] rvanlieshout: and what happens if you try that here?
[12:02:27] tobago: what shall I try?
[12:02:35] rvanlieshout: that commented version
[12:03:23] tobago: then it generates the posted yaml file and reloading the yaml file with rake db:fixtures:load breaks with the message below.
[12:04:13] tobago: it's the attribute start_time, which can't be reloaded, because it contains those "0000-00-00..." stuff
[12:04:30] tobago: or end_time also.
[12:05:04] rvanlieshout: replace 0000-00-00 1970-01-01
[12:05:36] tobago: rvanlieshout, manually?
[12:06:45] tobago: rvanlieshout, that is not an option, because it is generated and many more xaml files are concerned too
[12:07:55] tobago: I'd really like to know how to make your idea "self.to_s.to_yaml" work?
[12:08:08] tobago: that would solve my problem
[12:08:09] rvanlieshout: then read about tag:yaml.org,2002:timestamp and find out if they have a time only thing
[12:10:31] chrisan: anyone know if there is an equivalent states_select like https://github.com/stefanpenner/country_select which would include US + canada?
[12:13:02] cusco: while trying to deploy a app I'm having a error: NoMethodError (undefined method `fallbacks' for I18n:Module):
[12:13:42] rvanlieshout: cusco: should there be a fallbacks method?
[12:13:57] cusco: now I tried snooping arround and found some configs like: NoMethodError (undefined method `fallbacks' for I18n:Module):
[12:14:21] mikecmpbll: wrong paste? ;d
[12:14:29] cusco: I18n.fallbacks.defaults = [I18n.default_locale] + Setting.available_languages.map(&:to_sym)
[12:14:50] sevenseacat: so what makes you think you can call I18n.callbacks ?
[12:14:55] sevenseacat: fallbacks rather
[12:15:12] mikecmpbll: should probably be config.i18n.fallbacks
[12:15:17] mikecmpbll: not that i know that that exists or anything.
[12:15:25] sevenseacat: i think it does
[12:15:36] sevenseacat: but still, no context at all
[12:16:54] cusco: yes yes I understand
[12:17:14] cusco: this app doesn't seem to be known
[12:17:21] cusco: its openproject
[12:18:01] rvanlieshout: it's not about this app
[12:18:01] mikecmpbll: i hate when you spend months on something before you realise you've gone about it completely the wrong way. oh well. onwards and upwards..
[12:18:09] rvanlieshout: it's about using a library in a way it's not meant to be
[12:18:11] cusco: also has this file - wich i'm not sure its being loaded: I18n.fallbacks.defaults = [I18n.default_locale] + Setting.available_languages.map(&:to_sym)
[12:18:17] cusco: https://codeclimate.com/github/opf/openproject/I18nPatch
[12:18:24] mikecmpbll: pasting isn't your forte
[12:18:53] cusco: its inside config/initializers
[12:19:02] cusco: I'm usinc a MAC today ... not used to it :/
[12:19:21] mikecmpbll: cusco: that code doesn't appear to include the line that you referenced
[12:19:38] rushed: cusco: "MAC" like the cosmetics?
[12:19:39] cusco: no this line seems to be on a config for a single plugin, that I guess its not actiated
[12:19:56] cusco: rushed: yes, all white and stuff.. heh
[12:20:01] sevenseacat: well this is pointless
[12:20:13] cusco: how could I ask my problem better?
[12:20:25] sevenseacat: you could show us the code, the full error, and the backtrace
[12:20:34] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[12:20:50] rvanlieshout: cusco: it's not really a problem.. it's more like you want to use a car to float on water and then search for a problem about why it sunk
[12:21:05] rvanlieshout: who told you that that car could float in the first place?
[12:21:17] sevenseacat: top gear did >_>
[12:21:22] mikecmpbll: haha i was going to say that.
[12:21:32] sevenseacat: ACTION drives the hovervan
[12:23:14] cusco: rvanlieshout: well I'm trying to deploy the app first time
[12:23:29] cusco: so this is the error: http://paste.debian.net/69664/
[12:23:43] rvanlieshout: cusco: solution: remove the line that calls .fallbacks
[12:24:02] sevenseacat: so whats on application_controller.rb:128 ?
[12:24:12] mikecmpbll: debug stack trace 101
[12:24:16] sevenseacat: that sounds like it shouldnt be there
[12:25:26] cusco: line 128: return if I18n.fallbacks.defaults == (fallbacks = [I18n.default_locale] + Setting.available_languages.map(&:to_sym))
[12:25:44] cusco: just after: I18n.fallbacks = nil
[12:25:53] rvanlieshout: cusco: remove that line
[12:25:55] sevenseacat: what makes you think you can call I18n.fallbacks ?
[12:26:08] cusco: well the guys that wrote the app had some reason ... :p
[12:26:18] sevenseacat: well you should probably ask them then
[12:26:26] rvanlieshout: or read the documentation
[12:26:29] rvanlieshout: without that.. remove the line
[12:29:47] cusco: thank you very much
[12:29:57] cusco: I understand now that .fallbacks should not be called
[12:30:03] cusco: because it didn't exist
[12:30:20] cusco: as the error stated
[12:30:27] cusco: thank you
[12:31:27] mikecmpbll: looks like it existed in 2.3.8 or something
[12:33:30] solars: hi, I've got an app with multiple processes (passenger). The app receives a lot of requests and if some kind of budget is exceeded, sends emails and stores something in the db - however, it should do this only once, the problem is that the processes receive a hit fast after each other and then send the mails etc again.. I never had a concurrency problem so I'm not sure where to start tackling this.. can
[12:33:33] solars: anyone give me a pointer?
[12:34:41] jokke1: hey, i need some help and can't show you much code, because it's from the company i work for. However all other backend devs are preoccupied so i thought maybe you guys can help me even with only little information.. I'm experiencing a problem with mongomapper. In my controllers create method saving the resource fails because it won't pass a validation which checks if an array is not empty. This array is
[12:34:43] jokke1: a has_many mapping. The thing is: while the nested resource array is empty, ..._ids array is not.. Do you know what i mean? Maybe some of you have clues where this might come from..
[12:35:24] sevenseacat: sounds like its coming from the nested resource array being empty
[12:36:39] jokke1: https://paste.jreinert.com/zbwMDX/
[12:36:42] rushed: solars: how are you recording that the email was sent?
[12:37:36] solars: I think it's not recorded.. I'm just trying to find ways how to best work around such problems in general.. but I'm not sure yet :)
[12:37:41] jokke1: you see, language_ids is not empty while languages is
[12:37:45] solars: like to ensure that only 1 process executes it
[12:38:14] rushed: solars: ignoring the process overlap, why would the second request not send an email?
[12:39:07] rushed: solars: or perhaps gisting the code surrounding the mailer dispatch might get you some relevant suggestions :)
[12:40:10] solars: rushed, well it's basically a notification for a client, so we cannot send it twice (it's the same content)
[12:40:42] solars: rushed, it's using mandrill and quite a lot of code.. I have to think about introducing a lock on the object so the other processes ignore it... or wait somehow
[12:41:00] solars: I'm just unsure about the options regarding concurrency problems I have in rails/ruby
[12:41:37] rushed: solars: you're explaining the logical issue, not how the code is working :)
[12:43:09] solars: rushed, basically its like that: request hits app, app checks if budget < 0, updates budget (takes a while) sends email
[12:43:15] rushed: solars: for example if you're working with an existing model w/ a flag you could likely introduce optimistic locking and a db transaction and resolve it, if you're triggering based on other conditions then there are other approaches. anyway, like I said if you gist the code around the mailer dispatch you'll probably have the best luck :)
[12:43:26] solars: rushed, and the thing is that the requests are almost at the same time for 2 processes, so it's done twice
[12:43:39] jokke1: and this is not the only part where this happens. Another resource which belongs_to this App resource has app_id but not app
[12:46:39] jokke1: i should say model
[12:46:45] jokke1: instead of resource
[12:46:55] rushed: solars: right, so if budget is a model property then I would consider optimistic locking and a reload/db transaction around the update, but you should consider this a warning sign... if this is a counter you're managing without any locking and if you're double emailing for the edge case of sending the warning email it suggests to me you're probably undercounting other cases (ex: where two budget incrementing events arrive near each
[12:46:55] rushed: other)... so you'll probably want to do some reading on locking strategies in general and managing counters in the database specifically
[12:47:05] blackxored: Hey guys what's up I'm really pissed off that AMS is advertised in the rails_api gem and yet it doesn't work out of the box
[12:47:13] blackxored: or it's just me?
[12:50:36] solars: rushed, for the budget itself I've introduced a lock, the other requests just skip that part in this case - but this is just a workaround, they should not skip it but wait, I assume that's better done with a db transcation or something like that, yes
[12:52:17] rushed: solars: depending on what you mean by a lock, and how district your app processes are, that may not have any effect :)
[12:53:33] solars: rushed, well basically a var in the database, for simplicity, nothing else
[12:54:14] solars: rushed, do you know any pages where examples for such cases in rails, ruby in general or AR, datamapper, etc are explained?
[12:54:25] solars: I lack the knowledge basically
[12:56:05] rushed: solars: an example might help http://railscasts.com/episodes/59-optimistic-locking-revised
[12:57:03] solars: rushed, thanks a lot! I'll try to get into it a bit more :)
[13:02:44] mlangenberg: Would /script be a good place to keep some script to output CSV data for debugging / statistic purposes? Or would /lib be a better location?
[13:03:42] darrik: doesn't really matter. i make a bin/ folder inside my app for that, or write a rake task. i would say lib is not a good place for it
[13:04:40] mlangenberg: agreed, I'll stick to script
[13:19:58] Psy-Q: can i extract the "where" SQL bit from a .where statement (i.e. not the SELECT ... bit but only the part inside WHERE)?
[13:20:17] Psy-Q: then i could get two where statement's .to_sql and OR them inside a find_by_sql, that'd solve my problem
[13:52:12] Psy-Q: ah, i did it in another way
[13:57:27] nicolaas: Is anyone using passenger on heroku?
[13:58:33] rvanlieshout: nicolaas: don't worry about passenger vs unicorn on a slow platform
[13:59:23] nicolaas: I rock passenger on all my VP servers and I see its available on heroku now
[13:59:38] FooBarWidget: there are slight performance benefits, but in the end you're mostly limited by the resources that heroku gives you
[13:59:42] nicolaas: Thinking of giving it a go
[14:03:31] nicolaas: FooBarWidget: Care to elaborate?
[14:04:41] nicolaas: FooBarWidget: Which resources are you referring to?
[14:04:55] FooBarWidget: those are the hard limits
[14:05:16] nicolaas: Well, you get what you pay for??? I guess?
[14:05:22] rvanlieshout: nicolaas: worry about your own app more
[14:05:27] rvanlieshout: about how you use the database
[14:05:37] FooBarWidget: passenger does a few things a bit better than unicorn. for example passenger comes with an nginx core that buffers your requests/responses, while unicorn does not do that and in fact requires a buffering layer
[14:05:38] rvanlieshout: it's most likely way more important fo get speed benefits there
[14:05:54] FooBarWidget: this buffering layer that passenger provides protects the app against slow clients
[14:06:31] FooBarWidget: passenger also provides a better out-of-band garbage collection implementation than unicorn. out-of-band garbage collection allows you to decrease your response times by garbage collecting in between requests.
[14:06:53] FooBarWidget: however, with unicorn, you could end up in a situation where all your unicorn workers are garbage collecting, this negates the advantages of the feature
[14:07:03] FooBarWidget: passenger fixes this by ensuring only 1 process is GC'ing at a time
[14:07:26] nicolaas: So basically, its just better?
[14:07:46] FooBarWidget: well I'm the author, so I like to think so
[14:08:17] nicolaas: lol, awesome :)
[14:08:37] ddd: FooBarWidget: puma? discuss
[14:08:53] FooBarWidget: ddd: already discussed before: https://github.com/phusion/passenger/wiki/Puma-vs-Phusion-Passenger
[14:09:02] ddd: lol that was fast
[14:09:02] FooBarWidget: the conclusion says it all
[14:09:26] Criten: Good morning Rails!
[14:15:28] ddd: FooBarWidget: hmm, will have to check if passenger standalone supports RVM (and per project rvmrc files, which means multiple different rubies). Last time I ran passenger (this was at least a year ago) that was problematic
[14:16:01] ddd: fully respects rvm gemsets and such?
[14:16:09] FooBarWidget: it even supports multiple rubies now
[14:16:40] FooBarWidget: passenger 4 changed everything. https://vimeo.com/77539358
[14:16:48] ddd: yeah, thats a definite need. if can do so without the need to use reverse proxy mode, i'd be willing to switch to passenger again from unicorn
[14:17:19] FooBarWidget: and there's also node.js support and meteor support, if you happen to use that too
[14:17:20] ddd: unicorn and reverse proxying just makes it more complicated than I feel it needs to be
[14:17:48] ddd: cool! I'll check it out during the day today.
[14:18:21] ddd: the opensource version supports this? or just the paid enterprise?
[14:20:35] FooBarWidget: open source version
[14:20:47] FooBarWidget: most stuff is in open source
[14:21:11] FooBarWidget: the only stuff in enterprise is the stuff listed here (https://www.phusionpassenger.com/enterprise) and the stuff explicitly marked as 'enterprise-only' in the manual
[14:21:41] rvanlieshout: yeah.. +1 for passenger... happy with that in virtual hosting
[14:24:54] paritosh: hey guys, For some reason .. my controllers/models are getting cached in development , this is my development file https://gist.github.com/passion8/0df4262aa4940ca539a9 . Anyidea why ?
[14:32:23] wmoxam: paritosh: looks fine
[15:01:32] lamaster: i'm keep getting error RuntimeError (Circular dependency detected while autoloading constant ???) , error appears completely randomly on ajax call to different resources, not sure when issue has started to appear, after i added redis, or enabled concurrency support
[15:06:41] haukur: The signed_up_but_unconfirmed devise flash message is not firing after sign up. Instead it's showing the sign in flash message. What could be the cause?
[15:09:35] JRizzle: haukur: for future questions that you have please post a gists showing the code of your action, usually need all three of MVC for someone to debug your situation
[15:15:45] haukur: JRizzle: sorry, it was caused by a double redirect
[15:16:13] haukur: I had to add a after_unconfirmed_sign_up_path_for(resource)
[15:33:26] soahccc: Would somebody want to use this to monitor stuff? https://gist.github.com/2called-chaos/e60c5d539a648a5d1c1a I'm frustrated with all monitoring solutions I've found so far as they're either complicated as hell or don't support simplest things...
[15:34:22] JRizzle: new relic ?
[15:38:54] soahccc: JRizzle: I know them more for performance stuff
[15:39:56] soahccc: May take a look at it but one point I had with most of the solutions is that you need sometimes big dependencies on the machines you want to monitor. All things I would like to monitor are solveable via SSH
[15:44:03] makerops: im doing some basic testing with delayed_job
[15:44:13] makerops: https://gist.github.com/makerops/7826830 why does this keep throwing me an argument error?
[15:44:30] makerops: do I need to explicitly set params within the models method?
[15:47:44] Mattx: do you happen to know if it's possible to use rack-mini-profiler in a rails app that doesn't use active record?
[15:47:54] Mattx: I couldn't find how to do so
[15:50:21] Mattx: or any other profiler actually
[15:50:29] momomomomo: Mattx: From the README - "Currently supports Mysql2, Postgres, and Mongoid3 (with fallback support to ActiveRecord)"
[15:50:35] soahccc: JRizzle: NewRelic is really awesome but also really expensive :) The monitoring would cost more than the actual server. And by the looks of it they can't even test FTP connection
[15:50:37] Mattx: yep, I read that
[15:50:51] Mattx: this app doesn't use any of them :P
[15:51:04] Mattx: I just want to profile the controllers/actions/methods/whatever
[15:51:22] momomomomo: Mattx: Seems like mini profiler is pretty unambiguous about what it supports
[15:51:32] latortuga: makerops, show the actual error
[15:51:53] Mattx: if that was for me, the error is: undefined method `update_content_type=' for Tripod:Module (NoMethodError)
[15:52:14] Mattx: I'm looking for another profiler just for the code in a rails app
[15:52:15] makerops: latortuga, updated
[15:52:58] latortuga: makerops, is that line number correct? it's actually on the sleep line?
[15:53:30] makerops: latortuga, oh sorry, no, i didnt include the whole file
[15:53:41] makerops: its on the def update_agent line
[15:55:01] latortuga: makerops, what else did you change? I can't debug fake code man
[15:55:27] makerops: latortuga, i just updated it
[15:55:30] makerops: with the full set
[15:55:45] makerops: the errors is being produced by delayed_job
[15:55:55] makerops: not produced, btu outputed via
[15:56:05] latortuga: probably need to restart delayed job since you implemented your method
[16:00:19] makerops: latortuga, ah, ya, that may be it, I didnt reastart after adding params = {}
[16:00:24] makerops: that was it
[16:03:29] momomomomo: ugh, I don't know what just happened, but something in my JS pipeline has changed all of the links in my bootstrap navbar on dev :/ hoping it was just a point release issue on bootstrap-rails
[16:03:42] momomomomo: they all link to users now >:x
[16:08:18] momomomomo: ah, the joys of weird caching issues
[16:12:11] mikecmpbll: i remember when i first took on this app it wasn't using asset pipeline or any form of asset expiry, every time we released new JS we had to tell all the users to clear their browser cache
[16:12:50] momomomomo: mikecmpbll: memcached issue, not browser
[16:13:15] momomomomo: actually, a haml issue which rendered fine without the cache, but weirded out for some reason
[16:14:58] Mattx: actually it works! the error was due to another problem in my code :)
[16:23:53] schnittchen: will there be a 3.1.13 soon?
[16:26:33] momomomomo: current 3.x version is 3.2.16 schnittchen
[16:26:53] inish777: Hi all! I am trying to make JSON REST API for my web app. Is it possible to bind error code to validation error? for example, i want return {error_code: 50} in case of blank field, etc
[16:27:35] inish777: Or using HTTP status code is only variant?
[16:27:56] jammanbo: Ima going nuts. Trying to mount Gollum (sinatra app). `mount Precious::App => 'wiki', as: 'wiki'`. Fine that works. I now have wiki_path. But I need wiki_path('foo') => /wiki/foo. If I mount it as `wiki(/:xxx)` I get the oathe helper I need, but now Gollum just runs at `wiki/foo` i.e. it doesn't pass foo as the path to Sinatra. Anyone explain correct way to do this?
[16:28:26] jammanbo: s/oathe/path
[16:29:24] lxsameer: i'm looking for a gem to create and manage pages like those in CMSs
[16:30:36] jammanbo: lxsameer: In my experience they all suck, but the best luck was had with Refinery (long time since I used it). You searched CMS in the rubytoolbox?
[16:32:06] lxsameer: jammanbo: i don't need a cms i need a gem to generate pages in my project buddy
[16:32:31] jammanbo: sounds like a cms, but okay ...
[16:39:44] Mattx: I have yet another problem, but this time it's not my fault, I think
[16:39:45] Mattx: Rack::MiniProfiler.config.enabled = false
[16:39:55] Mattx: ruby says .enabled is undefined
[16:40:05] slacker87: is debugging javascript always painful?
[16:40:09] Mattx: but it's documented here: https://github.com/MiniProfiler/rack-mini-profiler
[16:40:17] Mattx: have anyone of you experienced the same?
[16:44:22] DonovanYoung: hey all... this is driving me to drink. I've got a Rails 3.2 site that someone has hotlinked urls to /images/image-name.png and it's filling my logs up with routing errors (no route matches, blah blah...)
[16:44:44] DonovanYoung: I just want to either 1) ignore them, or 2) redirect them to the /assets URL
[16:44:59] DonovanYoung: but get '/images', to: redirect('/assets') doesn't work
[16:45:10] DonovanYoung: google has failed me.
[16:46:25] DonovanYoung: this is running on heroku if that makes a difference
[16:46:47] crankharder: DonovanYoung: sounds like something i'd do in the web layer, but you may not have that option w/ heroku
[16:47:43] DonovanYoung: yeah, I can't find anything on the googles pointing me one way or another.
[16:48:28] DonovanYoung: if I had hair, I would have pulled it out already. I would have *thought* the redirect in routes.rb would do the trick, but it seems to be ignored
[16:49:35] DonovanYoung: even if I put a specific get '/images/image-name.png', to: redirect('/assets/image-name.png') route in, I just get a no controller specified error
[16:50:16] axl_: There should be an online contests where I get to submit some real bad code I have seen.
[16:50:35] DonovanYoung: and get '/images/:name', to: redirect('/images/%{name}') strips the .png off the end
[16:50:48] axl_: Anyway, I wanted to complain and I didn't now where to. I get to refactor this code: https://gist.github.com/gaganawhad/7827951
[16:53:45] Bira: axl_: It's not a contest, but you can submit code to thedailywtf.com if you want the world to see how bad it is :).
[16:54:07] axl_: Bira: thanks!!! I love the idea
[16:55:04] Bira: The site is a nice read too.
[16:56:42] axl_: Bira, yeah, that looks like a nice read??? but I'll be surprised if the accept any of my code. I mean the community that will understand what I mean is so small. anyway, thanks! :)
[16:57:22] DonovanYoung: please don't tell me freenode has failed me as well. =(
[16:57:41] DonovanYoung: this seems like such a common issue
[16:58:14] DonovanYoung: I just need to redirect /images/* to /assets/* <-- why is this so hard/impossible!??
[16:59:48] Bira: axl_: They accept a lot of different languages. If your entry is bad enough they'll probably accept it :).
[17:00:03] soahccc: hmm can I name a function freeze or is this no good?
[17:00:51] Hates_: DonovanYoung: you have an images folder already in public?
[17:01:34] Hates_: DonovanYoung: I've not used heroku so don't know how they setup routing
[17:01:43] purezen: Hi guys! I have been following some tutorials to begin with Rails.. Also completed more than half of Micheal Hartl's tutorial..
[17:01:59] momomomomo: purezen: great
[17:02:09] purezen: Now as advised by some, I want to begin with an application of my own..
[17:02:16] purezen: momomomomo, Hey! Thx..;-)
[17:03:00] purezen: I have an application in mind, which would allow people to upload and share 'notes' or 'docs (documents)' to begin with..
[17:03:21] purezen: Please provide with some guidance to get started.. Thanks! :-)
[17:03:44] Hates_: purezen: rails new mydocsharingapp
[17:03:54] purezen: Basically, the gems and plugins that I would require, or something of that sort.. apart from any advice.. of course.! :-)
[17:04:10] purezen: Hates_, Hey! Of course..;-)
[17:04:21] Hates_: purezen: probably paperclip/carrierwave for file uploads, devise for user authentication,
[17:04:28] Hates_: purezen: those are the main ones
[17:04:41] Hates_: purezen: the rest you'll have to figure out as you go along
[17:05:23] purezen: Hates_, Cool! I have an idea of using devise.. and making users.. of course..
[17:05:41] purezen: Also, would like to know which Ruby version to use?
[17:05:46] Hates_: purezen: the rest you'll have to figure out as you go along
[17:05:54] Hates_: purezen: ruby 2
[17:06:01] nettoweb: guys, with regex, how I get just the number between - ? https://gist.github.com/osnysantos/12163dbb57566ba8b09d
[17:06:02] Hates_: purezen: rails 4
[17:06:14] nettoweb: its a simple regex but I cant do work
[17:06:25] Hates_: nettoweb: what regex do you have so far?
[17:07:05] purezen: Hates_, That's great! Though, what about gem compatibility that I keep hearing about? Ruby 2 should be safe, you say?
[17:07:30] Hates_: purezen: yes
[17:08:22] nettoweb: but its getting the whitespace
[17:08:42] purezen: Hates_, K. One more thing, I am interested in working on the Non-UI stuff more.. Anything you can recommend me to get the 'styling' done easily?
[17:08:54] Hates_: purezen: bootstrap
[17:09:21] purezen: Hates_, Yeah. Ok.. shall stick with that. :-)
[17:10:07] purezen: Ok guys.. Shall do that for now. Thanks again.. Great coming here!!
[17:10:12] Hates_: nettoweb: \s(\d?)\s perhaps
[17:10:23] Hates_: nettoweb: http://rubular.com/r/on5bgN4XDg
[17:10:41] Hates_: nettoweb: oh whoops that has the whitespace too
[17:11:26] Hates_: nettoweb: oh, maybe not :)
[17:12:14] nettoweb: Hates_: I want just the number "* - 2 - *"
[17:12:18] nettoweb: the number 2
[17:12:24] Hates_: nettoweb: yes, that will do it
[17:13:37] nettoweb: Hates_: thank you
[17:15:09] Hates_: nettoweb: if it's always the second entry it might be better to split and strip "05/12/2013 16:57:49 - 3 - hi2".split("-").collect(&:strip)
[17:15:14] nettoweb: Hates_: I'm my string I have lots of /n, is there a way to iterate each of this lines?
[17:15:25] nettoweb: Hates_: good idea
[17:15:59] toretore: '05/12/2013 16:57:49 - 2 - hi'.match(/^(?<d>\d\d)\/(?<m>\d\d)\/(?<y>\d\d\d\d) (?<h>\d\d):(?<m>\d\d):(?<s>\d\d) - (?<num>[^ ]+) - (?<msg>.*)/)
[17:15:59] toretore: => #<MatchData "05/12/2013 16:57:49 - 2 - hi" d:"05" m:"12" y:"2013" h:"16" m:"57" s:"49" num:"2" msg:"hi">
[17:16:29] Hates_: nettoweb: just split on \n then iterate over them
[17:19:09] nettoweb: but in this case, I have to split before match? <%= lead.log.match(/^(?<d>\d\d)\/(?<m>\d\d)\/(?<y>\d\d\d\d) (?<h>\d\d):(?<m>\d\d):(?<s>\d\d) - (?<num>[^ ]+) - (?<msg>.*)/) %>
[17:19:30] AntelopeSalad: does anyone came across any strange issues with cancan's current_ability not working as intended?
[17:20:11] AntelopeSalad: i'm discovering bugs on my site that i can't reproduce but they all seem to point towards current_ability not being updated based on the new person logging in
[17:22:31] jokke1: i need to display forms for each nested model in the form of a model using simple form
[17:22:55] jokke1: s/forms/fields/
[17:23:04] jokke1: so i used simple_fields_for
[17:23:53] jokke1: or to be specific simple_fields_for :cms_branches do |branch_fields|
[17:24:06] jokke1: branch_fields.object is empty however
[17:24:20] jokke1: nil i mean
[17:24:54] jokke1: apparently i'm doing something wrong
[17:29:20] DonovanYoung: Hates_afk: yea, Heroku can't serve images from /public
[17:29:26] jokke1: uh never mind
[17:29:40] DonovanYoung: because they're only stored on the local dyno (so multiple dynos won't have them?)
[17:30:07] DonovanYoung: I'll try it... I've tried everything else so far.
[17:32:58] jokke1: there's no object for nested forms
[17:45:38] brycesenz: hello! Is anyone very familiar with gems and gem dependencies?
[17:54:37] s2013: if i have a date for a record and i want to find out which record would fall in a date range
[17:54:41] s2013: how would i do it?
[17:55:11] toretore: date between (dte1 and date2)
[17:59:22] latortuga: s2013, I think AR will handle date ranges properly if you pass them in
[17:59:25] s2013: so im trying where the start_date <= date and end_date >= date (start/end dates are what i need)
[17:59:32] s2013: hopefully that will work
[17:59:33] latortuga: s2013, where(start_date: [begin, end])
[17:59:45] latortuga: err not quite, a .. instead of an array
[17:59:49] momomomomo: toretore: s2013 make sure you do beginning of day.
[17:59:59] s2013: so date.beginning_of_day ?
[18:00:06] momomomomo: ie: http://stackoverflow.com/questions/19733736/search-for-database-objects-created-on-a-specific-day/19733874#19733874
[18:01:02] s2013: well not on that specific day.. basically our units are at different locations throughout the year. so we need to find where some units were on a specific day.
[18:01:11] s2013: we have a table with the unit and location
[18:01:19] s2013: and start_date and end_date
[18:01:31] s2013: so some units could be in a location for a month, others could be for a year, or however long
[18:01:36] momomomomo: right, so adapt the answer to your needs
[18:01:56] momomomomo: you can do a lambda with arguments
[18:02:19] s2013: yeah let me try. thanks
[18:02:38] momomomomo: scope :in_period, -> (start_date, end_date) { where('created_at between ? AND ?', start_date.beginning_of_day, end_date.beginning_of_day) }
[18:02:58] enricostn: hi, in a Rails 4 app with CanCan I'm getting undefined local variable or method `load_and_authorize_resource
[18:03:21] enricostn: I've just added the Gem and created a simple ability
[18:03:30] thinkclay: Has anyone built a back office admin / intranet in rails? I'm looking for a good starting point that will be flexible and let me build my own views but already has things like auth, asset management, view containers, etc
[18:03:50] momomomomo: s2013: holler at an internet point on that post if that helps :p
[18:03:55] enricostn: but in the controllers CanCan methods are undefined
[18:04:54] s2013: momomomomo++++++ * infinity
[18:05:08] enape_101: hey guys, can you help me get timepicker working https://gist.github.com/naushadparpia/7820249
[18:06:39] tubbo: thinkclay: that seems pretty generic. i think you could just make that with rails
[18:06:49] tubbo: thinkclay: sounds like a normal CRUD app with Devise to me
[18:07:56] s2013: thinkclay, yes thats pretty much what ido
[18:07:58] thinkclay: tubbo: yeah, but I'm hoping for a little further starting point.. Something like Rails Admin but with better features to create you own controllers and actions that hook into
[18:08:29] tubbo: thinkclay: i'm still not totally sure what you're after. do you want a CMS?
[18:08:33] tubbo: because there's RefineryCMS
[18:09:13] thinkclay: does RefineryCMS allow for easy extension that uses your own controllers?
[18:09:46] thinkclay: And what are the pros/cons of being on Rails 3.2 vs 4?
[18:09:57] enape_101: dunno why timepicker isn't working i've required it and downloaded the library https://gist.github.com/naushadparpia/7820249
[18:10:11] enape_101: then again i've never used it before, so I'm not sure if i'm doing it right please see gist
[18:11:58] s2013: enape_101, what do you mean not working?
[18:12:04] s2013: your gist shows one is working
[18:12:12] madnificent: thinkclay: i haven't used it myself, but there's a railscast about extending it. it seemed easier than I would have anticipated.
[18:12:44] s2013: try <%= f.input :time, as: :text %>
[18:12:58] momomomomo: be warned, madnificent refinery cmd can be tough to work with sometimes; I integrated it with an app once, though, and that went sort of smooth
[18:13:30] enape_101: s2013, it's just not pulling up the timepicker box, and acting just like a text_field
[18:13:50] enape_101: if you've used datepicker when you click the date field a calender pops up with jquery to choose a date
[18:13:55] enape_101: with timepicker this isn't happening
[18:14:06] enape_101: https://gist.github.com/naushadparpia/7820249
[18:14:13] s2013: i know what timepicker is
[18:14:37] s2013: try it in your js console
[18:14:47] momomomomo: enape_101: You're not initializing date picker on the #event_time object
[18:14:48] s2013: also yoru id says event_time
[18:14:59] s2013: but js is event_datge
[18:15:27] enape_101: the js is event_date for datepicker
[18:15:32] enape_101: and event_time for timepicker
[18:15:35] enape_101: on the time field
[18:15:35] tubbo: thinkclay: can't think of a single con when using rails 4.
[18:15:46] thinkclay: madnificent / tubbo : The public facing website to my app is small and trivial. The challenge is in the back office, I have to create accounting reports, downloadable documents, approval / denial processes. Basically I'm building the back-office to an alternative bank, and I'm not sure how best to go about it with using an existing gem or not.
[18:16:05] enape_101: s2013, sorry wasn't sure if you've used it before, so yeah not sure what i'm doign wrong here
[18:16:13] tubbo: thinkclay: you should probably just build that yourself. it will be easier to modify that later on when your client wants you to.
[18:16:37] thinkclay: tubbo yeah, the more i research the more it seems I should really skip any boilerplate
[18:16:40] tubbo: thinkclay: in my experience, people in the financial industry can be really picky :)
[18:16:50] thinkclay: tubbo that's an understatement :P
[18:17:14] tubbo: so to deal with these douchebags you need to make yourself agile, so you're not hacking someone else's gem later on
[18:17:35] tubbo: rails should give you *everything* you need to get this going, and you can use an auth gem like devise to speed up the process a bit
[18:17:56] diegoviola: https://twitter.com/mislav/status/408863318557065216 <-- most moronic thing i read this month, wow
[18:18:12] diegoviola: does github has an idiocy/moronic flag so maybe i could flag him or his comment
[18:18:34] tubbo: diegoviola: it doesn't, but that wouldn't matter...because you're on twitter. :P
[18:18:40] tubbo: who's the idiot now? ;)
[18:19:34] diegoviola: he pointed out that his project has more forks/stars
[18:19:34] tubbo: i think "open-source is discrimination" might have been the dumbest thing i've read this month
[18:19:41] diegoviola: that's why i mentioned the flag in gh
[18:19:59] tubbo: that doesn't *really* matter but he was clearly responding to a troll
[18:20:01] diegoviola: but yeah his comment was on twitter
[18:20:08] tubbo: the troll being that ruby-install is somehow better than ruby-build at all
[18:20:13] tubbo: or "won" the battle
[18:20:15] momomomomo: diegoviola: was quoting someone else apparently :p
[18:20:23] diegoviola: ok sorry about that
[18:20:34] diegoviola: i'm happy with chruby/ruby-install though
[18:20:38] momomomomo: but yeah, people picking fights about things like that are silly
[18:20:40] s2013: dt = tr.datetime.nil? ? tr.datetime : tr.created_at <-- is that the best way to set the datetime on something.. and if there is no date time, use created_at
[18:20:44] momomomomo: I use ruby-install
[18:20:50] tubbo: i actually don't use ruby-build for political reasons
[18:20:59] diegoviola: tubbo: what political reasons
[18:21:14] tubbo: ruby-install is just as good
[18:21:25] rhizome: mitt romney lead dev
[18:21:28] tubbo: diegoviola: i thought sstephenson sounded kinda like a jerk when he first released it
[18:21:37] tubbo: so i don't want to use his software
[18:21:42] tubbo: and it's not any better than ruby-install so whatever
[18:21:44] diegoviola: tubbo: fair enough
[18:21:47] s2013: am i the only one that wants to punch that mislav dude in the face
[18:21:50] toretore: author of ruby-build is a kim jong-un supporter
[18:21:55] rhizome: s2013: possibly
[18:21:56] s2013: he just has such a smug look
[18:21:57] tubbo: toretore: haha
[18:22:03] s2013: ive seen him somewhere else before
[18:22:13] diegoviola: tubbo: postmodern alternatives are just great imho
[18:22:17] tubbo: s2013: at your local metalcore show
[18:22:29] momomomomo: you guys are silly
[18:22:32] tubbo: diegoviola: the best part about churby and ruby-install? type `which chruby`. that's the entire source.
[18:22:54] rhizome: there's still a lot of brogrammer in ruby and rails
[18:23:02] enape_101: so no dice here? if i can provide anything else just ask https://gist.github.com/naushadparpia/7820249
[18:23:15] diegoviola: tubbo: yeah nice
[18:23:36] toretore: enape_101: this isn't #jquery
[18:23:36] tubbo: mislav's a good guy though :)
[18:24:11] momomomomo: toretore: I used to help there??? it's like an endless stream of noise
[18:25:11] tubbo: enape_101: make sure the event.js file is being loaded, make sure #event_date is the right ID to be querying (use the JS Console in your browser). apart from that...yeah #jquery might be your best bet. this isn't really a "rails problem".
[18:25:52] tubbo: s2013: mislav's made a lot of great tools: https://github.com/mislav/will_paginate https://github.com/mislav/git-deploy https://github.com/github/hub
[18:26:01] tubbo: so maybe in a commit msg or something? :D
[18:26:16] zcreative: what is the best way to use sprockets to require my stylesheets using sass to compile while still being able to use a separate variables.css.scss file?
[18:26:22] imkmf: +1, mislav seems like a cool guy, confused why people are so superficial about it
[18:26:31] imkmf: heh, just because of his haircut i mean
[18:27:07] tubbo: imkmf: i would expect anyone who sees a pic of me to immediately begin the chewbacca insults
[18:27:10] s2013: maybe im old school but i believe if you want to be treated like a professional you should act/look like one.. but thats just me
[18:27:22] helpa: There's a better way to do that.
[18:27:29] s2013: has nothing to do with how good of a person you are, how smart you are, etc.
[18:27:51] toretore: and maybe you shouldn't judge people by their looks
[18:28:01] s2013: looks != appearance
[18:28:05] ddd: if you're going to judge by looks rather than competency, especially if i'm going for a position that isn't public facing (as in dealing with customers face to face), I don't want to work for you
[18:28:12] tubbo: s2013: but they are one in the same.
[18:28:14] s2013: no one is judging anyone by their looks.
[18:28:17] ddd: yes you are
[18:28:22] ddd: you're playing the semantics game
[18:28:35] ddd: you sure you're not a recruiter
[18:28:54] s2013: no but i did hire people for my company.
[18:29:09] tubbo: s2013: i act/look like a professional to fool people like you into thinking i am one
[18:29:10] ddd: looks in *this* context means appearance. not facial features.
[18:29:16] ddd: tubbo: +1
[18:29:25] tubbo: acting is easy. doing is hard.
[18:29:39] s2013: we have had people come in fucking shorts to an interview
[18:29:50] ddd: i act like an asshole. being one is tough :)
[18:29:59] ddd: but, seems i pull it off fairly well
[18:30:00] s2013: anyways, whatever works for people.
[18:30:05] gwillen: s2013: Where are you located?
[18:30:07] tubbo: but i will agree with you there s2013, i will definitely raise an eyebrow if you come in looking like homeless to an interview.
[18:30:34] s2013: and austin.. basically you cant tell if someone is a genius programmer or homeless hipster
[18:30:39] gwillen: s2013: In the bay area you'd have trouble getting good talent if you refused to hire anybody who wore shorts to an interview :-P
[18:30:39] ddd: yuppie central! woohoo
[18:30:41] momomomomo: s2013: Depends where you're interviewing / when. I've had people ask me to come in to interview straight from work, and I show up wearing a Harley shirt & jeans - it's all dependent on the company / environment
[18:30:44] gwillen: s2013: nyc that's probably not true though
[18:31:25] momomomomo: plus, I look like this http://i.imgur.com/91oy69C.jpg so I'm not the most clean-cut either
[18:31:28] s2013: nyc has a huge community so it varies.
[18:31:32] momomomomo: looks don't equal professionalism
[18:31:57] amiel: momomomomo: that's some sweet hair!
[18:32:01] s2013: momomomomo, nice hair
[18:33:23] s2013: anyways, it all depends on each person/organization.
[18:34:19] EminenceHC: I wore shorts to my interview. Still got the job.
[18:34:19] tubbo: yeah the volume in NYC allows you to be a little more picky when it comes to devs
[18:34:25] tubbo: which is a great thing btw
[18:35:51] s2013: my dad was a businessman so i was raised to wear suit to go to work/interview and all that jazz. so maybe its different for me.
[18:35:57] s2013: but yeah whatever works for people :)
[18:36:35] tubbo: i almost always wear a suit to the interview
[18:36:44] tubbo: or something of that same caliber
[18:37:11] s2013: cool. same here. i havent work suit to work yet cause people would bel ike wtf.. but i do wear shoes, dress pants, shirt, etc.
[18:37:32] tubbo: nah i wouldn't do any of that shit just going to work everyday. not trying to impress anyone here :)
[18:37:56] tubbo: shit most of the company barely even sees me. i come in after they do and i leave later, so most people here never interact with me. just my teammates really.
[18:38:15] tubbo: also we don't have people coming into the office like ever
[18:38:23] s2013: we do have people visiting our office though
[18:38:32] tubbo: oh well then yeah you might want to look nice
[18:38:36] foucist: s2013: do you tend to believe things said by "experts" or "authoritative sources" etc?
[18:38:49] tubbo: you never know who will walk through the door, especially in NYC!
[18:39:04] s2013: we had someone from disney come in the office couple of weeks ago
[18:39:05] tubbo: plus dressing well makes you feel good.
[18:39:12] scyllinice: I wear shorts in the dead of winter and to work when I worked in an office..
[18:39:24] s2013: lol i came into the office on a weekend once. i was the only one. but i still dressed up.. i think its more ofa mental thing
[18:39:47] s2013: foucist, depends
[18:45:57] imkmf: anyone here pretty familiar with ryanb/nested_form?
[18:49:27] Spami: Hey, I'm trying to do a sub domain redirection in the routes file: https://gist.github.com/anonymous/c6947f1e3b83c48d46ea
[18:49:37] Spami: but No luck so far, any idea how to do it ?
[18:50:32] Spami: the main idea, is that we have admin.test.com/chicago/kayak and I want to redirect to test.com/chicago/kayak
[18:50:55] latortuga: Spami, what else have you tried?
[18:51:28] Spami: latortuga, this: https://gist.github.com/anonymous/c6947f1e3b83c48d46ea
[18:51:49] latortuga: I clicked on that link, thus "else"
[18:52:23] Spami: ah, well in the controller it works
[18:52:29] bmsatierf: Would it be possible to use some sort of scope for a conditional select instead of *Article.find(:all, :select => (Article.columns - ['body']))*? There is one very single column that I want to get rid on index/show.
[18:52:46] latortuga: Spami, what's wrong with that approach?
[18:53:29] toretore: bmsatierf: elaborate
[18:53:50] Spami: latortuga, I don't want to repeat the code in ton of different controllers, it's harder to maintain and not 'clean' I think It's better to do it in the routes
[18:54:00] Spami: the sooner the better ?
[18:54:21] latortuga: Spami, can you add a before_filter to ApplicationController?
[18:54:55] Spami: latortuga, true, but it need to be for only few controller
[18:55:11] bmsatierf: toretore: My model makes use of carrierwave (so it has a mount_uploader), and wouldn't like to show that extra column (file) which simply carries the file name
[18:55:14] toretore: Spami: how are your users getting to the admin subdomain in the first place
[18:55:35] toretore: bmsatierf: define "show"
[18:55:47] Spami: toretore, long story, short story, admin.site.com/myccount is their admin panel
[18:56:12] toretore: then it should be done at view level
[18:56:21] toretore: don't link to something that doesn't exist
[18:56:40] Spami: well, what if the link is somewhere else on the web ?
[18:56:49] Spami: should I just go on those servers and remove the link myself ???
[18:56:49] toretore: how did *they* get it?
[18:56:56] bmsatierf: toretore: by show I mean returning that column on the JSON response of my public API
[18:56:59] Spami: that's not the point
[18:57:06] toretore: (answer: because you gave it to them)
[18:57:24] Spami: yes, because at some point it was like this
[18:57:28] toretore: bmsatierf: then just don't include it in the json
[18:57:34] toretore: Spami: does it matter?
[18:57:50] Spami: what matter that what's done is done and now I have to fix it
[18:58:04] toretore: what's there to fix?
[18:58:21] bmsatierf: toretore: that's it, now I'm doing it like Model.find(:all, :select => (Model.columns - ['file'])), which works, but I think it would be better to use a scope
[18:58:39] toretore: bmsatierf: i don't see anything related to json there
[18:58:52] Spami: toretore, some of the routes should no be accessed by the subdomain bc they are public and getting indexed by google and we have duplicated content ?
[18:58:58] Spami: toretore, some of the routes should no be accessed by the subdomain bc they are public and getting indexed by google and we have duplicated content ?
[18:59:03] Spami: art my bad
[18:59:27] toretore: i don't see what the big deal is
[18:59:34] Spami: that doesn't matter
[19:00:32] toretore: my point is you were fixing the symptom, now you know how to fix the cause. if you want to spend time fixing all the symptoms it's already caused, well that's up to you
[19:03:33] thinkclay: whats the best way to install twitter bootstrap on just a single controller? I have an "admin" controller that many other controllers will extend and would like to use the bootstrap on just the admin and all children
[19:03:54] Spami: toretore, yes but that's wrong
[19:04:04] Spami: the cause is fixed, but links are out there
[19:04:09] Spami: and I can't fix them
[19:04:21] rhizome: is the issue that admin.test.com is server-wide, so subdom orgs/users should just get their regular site?
[19:04:40] rhizome: if it's an instant redirect
[19:05:54] toretore: thinkclay: use a separate layout
[19:07:28] thinkclay: thanks toretore
[19:07:44] Spami: rhizome, I don't understand
[19:08:21] thinkclay: well.. what about bootstrap assets.. dont they get pulled in on the main application layout or is there a way to configure that?
[19:08:54] toretore: you choose what assets you include in the layout
[19:09:17] toretore: <link href="bootstrap.css"/>
[19:09:29] thinkclay: okay cool. thanks again
[19:09:31] toretore: or lack thereof
[19:12:21] RubNoob: can anyone help me with an AJAX question? I have an AJAX request being made to a server controller, and the controller is returning JS, but the JS is not being executed.
[19:12:55] RubNoob: in other words, I have a javascript file that does an $.ajax submit to the server based on form inputs, etc., and the response is acutlly javascript (I can see it in the browser debugger), but it's not being executed
[19:13:11] toretore: why are you expecting it to be executed?
[19:13:35] tubbo: RubNoob: you have to execute it. also, you probably should be returning JSON and doing all your JS in one place.
[19:14:12] RubNoob: ok, let me clarify - I have a modal that has a form input, but when the user clicks "submit", I want to disable the text input and hcange the submit button until a response comes back
[19:14:49] enricostn: so, CanCan is not Rails4-ready. what are you using?
[19:14:58] RubNoob: rails 3 still
[19:15:25] enricostn: anyone with some Rails4 experience?
[19:16:39] RubNoob: toretore so given my backgorund, is it possible to execute the returned javascript/am I missing something?
[19:18:34] zcreative: RubNoob you can disable the form controls when you submit the form, then when the response comes in you can re-enable them.
[19:18:44] zcreative: just a couple lines of JS.
[19:20:16] RubNoob: zcreative ok, better question then I guess - I get the disable code no problem - is there a way to do a form_for without a model so that I can tie a button to the form?
[19:20:30] RubNoob: in other words, right now I have a form_tag with inputs and a submit_tag
[19:20:36] RubNoob: I'd like to tie my submit_tag to the form_tag
[19:20:56] kyledecot: Any Arel experts out there? I'm trying to something fairly complex w/ querying on a CONCAT
[19:21:00] zcreative: what template language are you using?
[19:21:11] zcreative: make sure your indentation is correct
[19:21:20] foucist: RubNoob: if it's inside the <% form_tag.. %> <% end %> it'll work
[19:21:35] RubNoob: oh ok - I guess I missed the most obvious part of that then :)
[19:21:40] RubNoob: thank you all, much appreciated!
[19:23:32] RubNoob: actually, one more foucist
[19:23:44] RubNoob: I have the form generated with an input inside of it like so:
[19:23:54] RubNoob: <input class="btn btn-primary submit-payment-email" name="commit" type="submit" value="Processing..." disabled="disabled">
[19:24:19] AntelopeSalad: enricostn: it's ready for 4.0, you just need to patch 1 thing
[19:24:26] RubNoob: in addition, I have JS code that disables the button on submit, so it's never submitting the form
[19:24:38] RubNoob: how can I submit the form after the button is disabled?
[19:24:54] RubNoob: doing a $(this).closest("form").submit() does not honor the JS submit
[19:25:02] jdsanders: Is there any way to make the stylesheet_link_tag helper throw an exception if the given file name isn't found in the asset manifest?
[19:25:06] enricostn: AntelopeSalad, could you please point me to some resource addressing this?
[19:25:47] enricostn: I can't find so much info in official repo
[19:26:27] kyledecot: I thought it threw Sprockets::FileNotFound if the asset wasn't found
[19:26:36] AntelopeSalad: enricostn: there's a ticket somewhere in the repo that has the fix, sec
[19:29:07] AntelopeSalad: enricostn: here's a gist of how i got it all working https://gist.github.com/anonymous/7830731
[19:29:25] s2013: if i have a list of records and i want to update an attribute for all of them, i should use update_all right?
[19:29:45] jdsanders: kyledecot: it doesn't seem to for me - just outputting "/stylesheets/file.css" as href
[19:30:14] jdsanders: maybe there's some strictness configuration that I'm missing...
[19:30:37] enricostn: AntelopeSalad, looking, thanks
[19:30:58] AntelopeSalad: enricostn: once you set that up then you're good to go, i've followed a lot of the wiki tutorials and didn't come into any other issues
[19:31:20] enricostn: ok, I'll try it thanks
[19:32:43] john35l: hey all, I have a question about strong parameters
[19:33:14] john35l: I can't access all the POSTed parameters even though I permit them
[19:33:18] logik-bomb: sunspot_rails & sunspot_solr with rails 4 and osx 10.9 -> https://gist.github.com/alopes/471775b2b86b4f763aa6/raw/d43289e170ec99d0f9bacc49644862a8e543bea4/gistfile1.txt What could be happening? Thanks
[19:33:34] john35l: this is what I'm talking about: http://pastebin.com/q3F8W4h6
[19:34:30] RubNoob: so - I have something like this: $(this).click ->.....
[19:34:56] RubNoob: I have no "preventDefault" lines of code in that block, and it does disable the button, but for some reason after the code I have in there completes, the form is not submitted?
[19:36:09] toretore: gist the full code
[19:36:19] ssb123: why does this variable get set to nil rather than throw an exception when called? test = "stuff" if false
[19:36:43] tubbo: ssb123: because false isn't true.
[19:36:51] tubbo: so nothing happens
[19:36:57] toretore: ssb123: it's complicated. bottom line: just don't do that.
[19:37:13] RubNoob: toretore https://gist.github.com/anonymous/7830871
[19:37:38] ssb123: Yes, I know that. I'm curious what ruby is doing - why it's getting set to nil.
[19:37:51] latortuga: ssb123, I read a blog post about that awhile back...hmm
[19:38:29] ssb123: I've been trying to find something to read but it's kind of hard to google.
[19:39:18] toretore: it has to do with the way ruby parses it. the test variable gets created before the if condition gets run. it gets run something like this: test = nil; if false; test = 'stuff'; end
[19:39:43] latortuga: ssb123, found a short treatment on rubyinside: http://www.rubyinside.com/what-rubys-double-pipe-or-equals-really-does-5488.html
[19:40:09] latortuga: scroll to Undefined Variables
[19:40:13] tubbo: ssb123: everything is an expression, so the assignment expression `test = "stuff"` can be thought of as 'inside' the boolean expression which wraps it
[19:40:24] tubbo: ssb123: it's the same thing as if you do `if false?; test = "stuff"; end`.
[19:40:27] john35l: ok, I put my entire example in this pastie: http://pastie.org/private/uja69fu2ebwu52z7mwlr7q
[19:41:13] latortuga: tubbo, I think he's more concerned about why the variable then exists instead of throwing a no method error
[19:41:17] john35l: I'm trying to POST attributes for 2 objects in the same request, but with strong params, I can only access the attribs for one of the objects
[19:41:51] toretore: RubNoob: you'll have to refer to jquery and whatever "livequery" is documentation for that
[19:41:55] john35l: I couldn't find anything about that searching online
[19:42:05] helpa: john35l: 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.
[19:42:05] toretore: john35l: !code
[19:42:23] john35l: toretore: http://pastie.org/private/uja69fu2ebwu52z7mwlr7q
[19:42:29] toretore: egg on my face
[19:42:37] latortuga: john35l, permit the params for a just like you do for b
[19:42:45] john35l: np, I posted it before my question :)
[19:42:53] latortuga: params.permit(:a1, :a2, :a3)
[19:42:55] toretore: well, not that much. because you pasted fake code
[19:42:58] helpa: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[19:43:22] john35l: latortuga: the params get put in the "b" hash before it even hits the permit code
[19:43:46] RubNoob: toretore OK, actually I am pretty sure I solved the issue, but now have a different issue
[19:44:03] RubNoob: the disable of the text input works, but the issue is that since I disabled it, it is not being submitted with the form on submit
[19:44:07] john35l: so by the time params are in the controller, they are already in the permitted params hash
[19:44:16] toretore: RubNoob: because you're using all these js tools without understanding how they work
[19:44:37] RubNoob: is there a better way to disable the input besides "attr('disabled', true)" so that the value within the text field is actually submitted?
[19:44:41] john35l: do strong params look at the active record object before the permit?
[19:45:00] latortuga: john35l, you need to show real code I think
[19:45:14] amiel: RubNoob: try the readonly attribute (instead of disabled)
[19:45:24] enape_101: so im using timepicker but when i display my time it outputs 15:00 instead of 1pm.. here's the code: <%= event.time.strftime("%H:%M")
[19:45:34] enape_101: how can i get it to display in regular time? i.e. 1:00PM
[19:45:35] latortuga: john35l, you also betrayed a misunderstanding of strongparams - it has nothing to do with activerecord
[19:45:40] toretore: enape_101: !g ruby strftime
[19:45:49] RubNoob: amiel ah, right, forgot about that nice little bit, I'll give it a shot, thank you
[19:46:13] amiel: enape_101: take a look at http://strfti.me/
[19:46:14] enape_101: thanks toretore, let me see
[19:46:20] john35l: latortuga: I get that, but that would be the only way it could force the params in that way, because my permit allows all those params
[19:46:21] ssb123: latortuga: that article is talking about my question.. but it doesn't explain why. haha.
[19:46:22] enape_101: alright thx amiel
[19:47:11] latortuga: john35l, real code => actual question => answer
[19:47:24] john35l: yup, I'm working on that now
[19:47:42] latortuga: john35l, this may help https://github.com/rails/strong_parameters#require-multiple-parameters
[19:48:23] tubbo: amiel: hah...why did they make a new one? http://foragoodstrftime.com/
[19:48:27] tubbo: !strftime
[19:48:30] tubbo: we should really add that
[19:48:45] john35l: latortuga: I'm going to give that a shot too
[19:49:44] diegoviola: cool, i didn't know it was Friday today, this is good
[19:50:25] scrogson: is there a way to add validations to an AR instance at runtime?
[19:50:30] makerops: if i am passing :lock, how can I poll it as well?
[19:50:48] scrogson: instance.extend(SomeModule)
[19:51:20] scrogson: I've been playing around with some ideas but can't seem to get anything to work
[19:51:27] enape_101: how do i override this: int: Updates were rejected because the remote contains work that you do
[19:51:27] enape_101: hint: not have locally. This is usually caused by another repository pushing
[19:51:27] enape_101: hint: to the same ref. You may want to first merge the remote changes (e.g.,
[19:51:27] enape_101: hint: 'git pull') before pushing again.
[19:51:45] enape_101: i'd rather not git pull, because i'll lose my current work
[19:53:59] enape_101: git push -f i guess
[19:54:19] momomomomo: enape_101: #git
[19:54:26] AntelopeSalad: enape_101: you could always git stash your current work
[19:55:04] scrogson: looks like I figured it out....
[19:55:12] momomomomo: scrogson: Someone was just asking about this the other day - it's not a good idea
[19:55:20] scrogson: instance.class.send(:include, SomeModule)
[19:55:28] momomomomo: scrogson: Adding validations (probably in a controller I'm guessing) to instances of models
[19:55:53] scrogson: it's for a more DCI approach to a problem
[19:57:16] scrogson: I'm creating a module called EscalationPolicy which will ensure that if you want to set the object to escalted you need to also agree to the terms...
[19:58:45] makerops: how do i poll for a lock"?
[19:59:37] momomomomo: scrogson: that can be done easily in a regular validation
[20:00:27] scrogson: momomomomo: yes, I'm aware...just looking at a different approach
[20:02:04] momomomomo: have you heard of the term Convention over Configuration scrogson
[20:03:01] scrogson: the conventional way also requires that I set an attr_accessor for an attribute that doesn't belong on the model
[20:04:03] scrogson: this way it only applies in this one context, rather than on every instance that's created...
[20:04:13] scrogson: might be overkill...but that's not the point
[20:06:03] nigerianceo: Heres a more ruby-oriented question: I want to read in the first 10 lines of a CSV file hosted on S3. I don't want to read the entire file into an IOStream
[20:06:17] nigerianceo: don't want to read entire file into memory*
[20:06:47] momomomomo: nigerianceo: http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html
[20:07:02] momomomomo: nigerianceo: What's the 4th header on the page?
[20:07:39] nigerianceo: thanks, that was helpful
[20:10:04] john35l: ok, I posted some real code for my issue with strong params: http://pastie.org/private/oqx3vzqh0dv86b9aijlrea
[20:10:28] john35l: latortuga: I tried adding another params.require but it didn't help
[20:10:51] john35l: ERROR ActionController::ParameterMissing: param not found: user
[20:12:22] latortuga: john35l, okay so what's your question now?
[20:13:16] john35l: how can I access all the params in the anon_user_controller?
[20:13:33] latortuga: john35l, from the params hash
[20:13:53] john35l: but that defeats the purpose of using strong params
[20:14:18] latortuga: john35l, it's the answer to your question, what are you actually trying to do?
[20:14:48] john35l: basically trying to pass params for 2 objects in 1 request
[20:15:22] john35l: params.require(:anon_user).permit([:name, :email, :type, :referrer, :ip])
[20:15:55] john35l: but at that line, name, email and type are not in the "anon_user" hash
[20:16:18] latortuga: that line says that you require that params has a key :anon_user and the hash associated with it can have that list of keys
[20:16:19] john35l: it's as if rails looks at the anon_user model before it hits the require
[20:16:35] latortuga: it does not, ignore your models
[20:16:58] john35l: so when I pass in: {"name":"Test Name", "email":"test@test.com", "type":"Anonymous", "referrer":"http://www.google.com", "ip":"127.0.0.1"}
[20:17:18] john35l: it creates this as params: {"name":"Test Name", "email":"test@test.com", "type":"Anonymous", "referrer":"http://www.google.com", "ip":"127.0.0.1", "anon_user":{"referrer":"http://www.google.com", "ip":"127.0.0.1"} }
[20:17:34] john35l: but why doesn't it also put name, email, type in the anon_user hash?
[20:18:05] latortuga: your code is the only thing that would be putting those things into the anon_user hash, check other before_filters
[20:18:39] john35l: I'm not adding the anon_user hash at all, rails does
[20:18:58] latortuga: john35l, I think that YOU think that the strong params calls to permit/require somehow changes your params, it does not touch them except to validate that what is coming in is in a correct format
[20:19:37] john35l: it does touch them, it creates the anon_user hash
[20:19:56] latortuga: prove that to me
[20:20:14] john35l: so when you call params.require(:object) it looks for hash named "object"
[20:21:34] latortuga: john35l, that's correct, it does NOT create a hash for :object when it doesn't exist
[20:22:19] brendan6: I'm trying to isolate a performance issue with a worker process I have and I notice the biggest bottleneck is coming from to_json. I am aware of yajl and oj but they only seem to make a marginal difference in the total run time. Running the same script in isolation run in a much more reasonable time (1 second vs 20 seconds). https://gist.github.com/HuffMoody/7831466 is a code sample. Does anyone have any suggestio
[20:22:19] brendan6: ns on how to proceed?
[20:24:02] john35l: latortuga: I guess I'll try without the require(:anon_user)
[20:24:30] john35l: but I have a breakpoint in the application controller, before it hits the anon_user_controller and it creates the anon_user hash before that
[20:25:06] latortuga: john35l, nothing is magically creating hash keys and parameters. your code is making it somewhere.
[20:25:23] john35l: I'm using rails 4.0 if that makes a difference
[20:26:16] s2013: anyway to pluck out more than one attribute and putthem as an array or hash?
[20:26:20] latortuga: john35l, show your before_filters in Application controller; rails 4/3 doesn't matter strong params works the same
[20:26:44] latortuga: s2013, I think rails 4 allows multiple attributes to pluck, 3 you'll have to use select and map I think
[20:27:29] latortuga: brendan6, is that worker benchmark from real code or your example code
[20:27:39] s2013: gotcha thanks
[20:27:44] brendan6: latortuga: I
[20:27:56] brendan6: latortuga: I'm running that exact code in my dev environment
[20:28:18] latortuga: brendan6, worker spin-up?
[20:28:46] brendan6: latortuga: It starts and completes in about 20 seconds if that's what you're asking
[20:29:07] latortuga: brendan6, what I mean is have you ruled out the time that the worker takes to start up as being the cause of your slowness
[20:29:12] brendan6: latortuga: commenting out the #to_json and the worker runs in 0.003 seconds
[20:29:21] latortuga: aha now we're getting somewhere
[20:29:42] latortuga: try some other operation, like to_hash or something
[20:30:57] brendan6: to_s runs in 1.92
[20:33:47] latortuga: brendan6, is this in a rails app?
[20:34:10] brendan6: latortuga: I actually just tried Yajl::Encoder.encode on that line and its running in 1.112 seconds now, to_json still at 20 seconds
[20:34:45] brendan6: latortuga: so despite the fact they run similarly in an isolated script, to_json is considerably slower in my rails app
[20:35:25] latortuga: brendan6, probably different methods, perhaps rails is clobbering the default version
[20:38:18] brendan6: latortuga: Hmm, well I seem to be getting somewhere now. I'm going to try and keep poking away to see if I can get my actual script to run in a reasonable amount of time. Thanks a lot for the help!
[20:53:34] CorySimmons: Hey guys, I'm trying to dump a .yml's content to the database. Proposal.create(proposal_data: YAML.dump(YAML.load(File.read(path)))) works, but Proposal.create(proposal_data: File.read(path)) does not. Not sure what I'm doing wrong.
[20:54:06] almodnev: i could use a little help
[20:54:20] almodnev: i really broke a client site and have no idea how to fix it
[20:54:46] CorySimmons: almodnev: details?
[20:55:01] almodnev: i tried to reset the app
[20:55:08] almodnev: i know nothing fyi..
[20:55:31] almodnev: and now this is the page.. http://www.breezyboatcity.com
[20:56:09] almodnev: i really have no clue about rails
[20:56:16] almodnev: or coding to be honest
[20:56:27] CorySimmons: rake assets:precompile
[20:56:52] almodnev: it goes through like it worked
[20:57:07] almodnev: then i do a series of commands..
[20:57:28] almodnev: i do a ps -x
[20:57:32] CorySimmons: Do you push your public folder to your server after you precompile your assets?
[20:57:34] almodnev: then kill the master
[20:57:36] CorySimmons: They go to your public folder.
[20:57:47] almodnev: cory i have no idea
[20:57:53] amiel: almodnev: you need to tell rails what to precompile (in config/application.rb)
[20:58:07] CorySimmons: almodnev: You have a /public folder in your project right?
[20:58:19] almodnev: i believe so but i have no idea
[20:58:19] CorySimmons: Where is this site hosted? How? Version control?
[20:59:14] CorySimmons: Check your file system
[20:59:17] CorySimmons: Like??? a window
[20:59:32] CorySimmons: I can't magically "wish" your site recovered
[20:59:39] CorySimmons: Work with me here buddy
[21:01:09] almodnev: it is on bitbucket
[21:03:14] almodnev: ok yes nav'd to public_html
[21:03:23] almodnev: precompliing in there now
[21:04:12] rhizome: what is "public_html"?
[21:05:00] rhizome: the directory that contains, app, db, etc.?
[21:05:49] almodnev: well i changed the error at least
[21:09:03] bricker`LA: Isn't there a "simple-git" or something out there? I remember seeing it. It's git but it makes it easier at the command line
[21:10:04] slash_quit: tagline: "simple-git, as easy as it gits"
[21:11:15] bricker`LA: slash_quit: you're hired
[21:12:48] slash_quit: and there i expected crickets chirping
[21:20:16] cpruitt: Anyone have a good ruby implementation of the Luhn algorithm for checking a credit card number format they'd like to share?
[21:22:23] amiel: cpruitt: ActiveMerchant has been around for a while
[21:22:24] amiel: see https://github.com/Shopify/active_merchant/blob/master/lib/active_merchant/billing/credit_card_methods.rb#L130
[21:23:43] cpruitt: amiel: Thanks. I'm really just looking for one method implementation. Rather not load ActiveMerchant just for that.
[21:24:01] cpruitt: Happens that this project called for payment processing that active merchant doesn't support
[21:24:02] amiel: I was pointing you to an example of the algorithm
[21:24:15] cpruitt: AH! Good point
[21:24:19] cpruitt: Sorry! Thanks.
[21:24:34] cpruitt: Guess clicking the link would have helped. lol
[21:26:42] bricker`LA: Anybody have any theories why deploying via capistrano would hang on the task where it uploads the assets manifest to the server? It writes about half of the file and then just hangs. My theory is that my internet is cutting out for a moment, but it happens a lot
[21:28:18] bricker`LA: Almost like ssh is limiting the size of the upload, but that can't be it because it does work sometimes
[21:34:10] demi1: I have applicatoin based on ruby on rails with scss. There is app/assets/stylesheets/application.css.scss file. I edit this file and no changes can be seen on the web page. Web page (opened in the browser) refers to the assets/application.css which is minificated. I wonder: how could I change scss file and I can see changes in the browser?
[21:35:14] slash_quit: demi1: production or dev?
[21:35:36] s2013: Unit.where("action !~ ?", 'master').where("action !~ ?", 'venue') <-- how can i refactor that?
[21:35:45] demi1: slash_quit: dev
[21:38:29] cpruitt: demi1: Your development CSS shouldn't be compressed. Check your development.rb and see if you have something set in there to do that.
[21:39:20] senayar: be sure you don't have rake your asset
[21:39:31] senayar: bundle exec rake assets:clean
[21:39:42] rhizome: s2013: array?
[21:40:12] s2013: are you asking?
[21:41:19] tubbo: s2013: Unit.where action: %w(master venue)
[21:41:29] tubbo: will generate WHERE action IN ('master', 'venue')
[21:41:48] s2013: yeah but im trying to do action !~
[21:41:53] tubbo: s2013: why
[21:41:56] s2013: so it doesnt have those
[21:42:14] s2013: i need it where it doesnt contian the words master or venue
[21:42:15] tubbo: s2013: iirc, a WHERE IN query is faster than a regex especially if you're not wildcarding anything
[21:42:37] tubbo: s2013: but you can always just do Unit.where action: /master|venue/
[21:42:58] tubbo: s2013: or wait, it's a not query...so i guess you want Unit.not action: /master|venue/
[21:43:16] s2013: Unit.not?
[21:43:42] tubbo: s2013: does a WHERE NOT query iirc
[21:43:45] tubbo: in rails 4 though
[21:43:48] s2013: i want list of units where the action doesnt contain the words master or venue
[21:43:49] s2013: im on rails 3
[21:44:00] s2013: what i had before works. i figured there is a shorter way to write it
[21:44:15] tubbo: s2013: there is, if you're using '!~' i think you can pass a regex into ther
[21:44:40] s2013: ok let me try
[21:45:55] s2013: i tried Unit.where("action !~ ?", /master|venue/)
[21:46:00] s2013: it didnt return the right results
[21:46:15] demi1: senayar: I'm sorry, I'm on the prod (not actually live site but will be). I did rake assets:clean and I see that it removed public/assets folder. And yes, now I see every change to the scss file. But how could I regenerate public/assets folder for prod?
[21:46:29] tubbo: s2013: what was the query?
[21:46:32] s2013: i though tyou could do something like where("action !~ ? or action !~ ?".. etc
[21:46:45] s2013: the one that worked?
[21:46:50] tubbo: s2013: you can but it's not any more efficient than running both those queries separately.
[21:46:59] senayar: demi1: with reading the doc for assets ?
[21:47:04] s2013: ok so what would be the most efficient way of doing it?
[21:47:24] senayar: http://guides.rubyonrails.org/asset_pipeline.html demi1
[21:47:48] tubbo: s2013: not sure...i feel like a '!~ <REGEX>' query would be, but maybe not.
[21:48:08] tubbo: s2013: might just be better to do a where().where() because that will do a 'WHERE ... AND' query
[21:48:26] s2013: yeah thats what im doing. k thanks.
[21:48:28] tubbo: s2013: is this text *actually* just master and venue?
[21:48:44] tubbo: s2013: or is it user-controlled? like are you actually trying to match or are you just combining the query into 1 big statement?
[21:49:33] demi1: senayar: yes I saw that doc but it still not easy for me to get answers on my questions... I wonder: after "rake assets:clean" did I miss something? Or if I'll regenerate public/assets everything will come back as was?
[21:49:59] senayar: nextime you will generate your asset it will pick them from your app/asset folder
[21:50:10] s2013: tubbo, basically i am looking for records that do not contain either of those words
[21:50:43] s2013: but the words can be master_access or whatever.. main keyword is master and venue
[21:50:59] s2013: its fine ill just use where().where(). thanks
[21:51:03] senayar: demi1: you generate assets before deploying
[21:51:05] rhizome: i think you have a data modeling problem. why is this distinction not made outside of the field?
[21:51:08] tubbo: s2013: well if i was thinking in SQL, i'd write that query to be `SELECT * FROM whatevers WHERE action != 'master' OR action != 'venue'`
[21:51:28] tubbo: s2013: because where().where() will generate WHERE ... AND ...
[21:51:29] rhizome: or, why is a regex necessary, vs. whole-word
[21:51:43] tubbo: yeah that also is a good question :)
[21:51:59] tubbo: seems like you're hacking data in there to satisfy some higher-level concern that should really be part of the data model itself
[21:52:47] s2013: the whole point is to fix the data itself. im fixing old records. its really messed up
[21:52:58] s2013: there is no uniformity, structure, etc.
[21:53:40] rhizome: that seems unlikely
[21:53:46] demi1: senayar: ok, thank you!
[21:59:22] diegoviola: i wrote a bunch of code without testing first, and since i'm new to writing tests, i'd love to start writing tests for that code i wrote, but where should i start?
[21:59:30] diegoviola: the project i'm working on uses rspec and capybara
[22:02:34] tubbo: diegoviola: unit tests
[22:08:51] amiel: diegoviola: I would also suggest starting with unit tests
[22:09:11] amiel: especially if you can test non-activerecord objects
[22:09:19] ziikutv: Evening ladies and gents
[22:09:34] ziikutv: I am wondering if there are any windows developers here that use Vagrant boxes?
[22:09:52] Gabriel403: I'm a bit news rails, is there's a web ui for creating controllers and models and such, or is it all command line?
[22:10:41] slash_quit: Gabriel403: command line
[22:11:03] ReinH: Gabriel403: some of us use text editors as well...
[22:15:12] pontiki: i'm seeing something i'm not expecting out of a _path helper: https://gist.github.com/tamouse/51b45bc1a02503448518
[22:15:35] pontiki: the path generated has a "." instead of a "/" before the :id at the end
[22:15:43] diegoviola: amiel: thanks
[22:16:23] slash_quit: pontiki: can we see your routes?
[22:16:36] amiel: pontiki: you probably want admin_registrant_path
[22:16:46] pontiki: oh, possibly...
[22:17:00] amiel: admin_registrants_path doesn't have an id, so the argument is used as the format
[22:17:48] pontiki: updated: https://gist.github.com/tamouse/51b45bc1a02503448518
[22:17:54] pontiki: it is plural...
[22:18:56] tubbo: pontiki: tamouse have you been hiding in this channel the whole time? :P
[22:18:59] pontiki: something is likely wrong there
[22:19:08] pontiki: no, i've been working
[22:20:49] amiel: pontiki: did you try admin_registrant_path(r)
[22:20:56] amiel: the url is prular
[22:21:12] amiel: but I bet the named helper is singular, that's what the string all the way on the left is
[22:21:26] pontiki: yup, that's it. thanks
[22:21:41] pontiki: ACTION internet beers amiel 
[22:24:34] tubbo: pontiki: ah ok
[22:24:50] ziikutv: So no vagrant users here
[22:25:21] imkmf: ziikutv: have used vagrant, not on windows
[22:25:27] tubbo: ziikutv: heh, doesn't seem that way. but you're on the right path, it's really the only way to dev on windows.
[22:25:44] tubbo: besides visual studio ;)
[22:26:09] ziikutv: guys i try to get a box up and it says "The guest machine entered an invalid state while waitingg to boot."
[22:28:59] Gabriel403: ziikutv: I've had the 'privilege' of setting up vagrant on windows for php dev, but not ruby, though that should make a difference
[22:29:48] pontiki: i use vagrant a bit, but only on *nix
[22:30:52] Gabriel403: I use it a lot on my mac, it's just easier getting stuff done in a linux vm
[22:33:27] tubbo: Gabriel403: you know linux comes with a vm hypervisor *in* its kernel, right? :)
[22:34:06] tubbo: my co-worker's machine is a hypervisor. i forget what the main OS is but it's just running an image of CentOS for him to actually interact with
[22:34:24] tubbo: i wish you could virtualize OS X easier...would be a no-brainer to put linux on as the base OS and then just run images of mac os
[22:35:01] ziikutv: i think i have virtualization disabled in bios lol
[22:39:48] rehat: in my schema, there is a 'force: true do' what does that do when creating tables
[22:42:14] bricker`LA: rehat: it overrides the table if it already exists
[22:42:25] bricker`LA: rehat: without it, you'll get a "table already exists" error
[22:42:33] rehat: ahh, thanks
[22:42:33] bricker`LA: (if it already exists)
[22:46:04] nesher: how do i set a device secret key ?
[22:46:30] imkmf: devise or devise, nesher?
[22:46:33] tubbo: nesher: you mean devise? i think it's in config/initializers/devise.rb
[22:46:58] bruvcloud: yah there it is
[22:47:14] imkmf: did you run `rails g devise:install`?
[22:47:16] imkmf: that should do it for you
[22:47:29] imkmf: otherwise, you can add it an initializer
[22:47:38] nesher: i am not sure what this devise does. So can i just add anything as a secret key?
[22:47:44] imkmf: config.secret_key = <key>
[22:47:49] imkmf: yeah, but you should run `rake secret` to get one
[22:47:53] imkmf: something long and randomized, obviously
[22:48:19] nesher: and use the result of rake secret as key
[22:48:49] nesher: thanks guys
[22:51:02] nettoweb: guys, I have a HABTM and want to migrate to has_many through, is there a simple way to do this? I've search but most of cases they create again the tables and did some tweaks
[22:53:54] bruvcloud: nettoweb: that's pretty much what you need to do.
[22:54:21] bruvcloud: nettoweb: since a habtm table already has the *_id fields you need to make it a through-model (for the belongs_to's), you should just be able to rename the table and be done with it
[22:55:54] nettoweb: now I have this has_and_belongs_to_many :plan,
[22:55:55] nettoweb: :join_table => "plan_has_user",
[22:55:56] nettoweb: :foreign_key => "user_id",
[22:55:57] nettoweb: :association_foreign_key => "plan_id",
[22:55:58] nettoweb: :class_name => "Plan"
[22:56:15] bruvcloud: nettoweb: !gist and try not to paste multiple lines of text into IRC...
[22:56:40] nettoweb: bruvcloud: srry, it was one line but I cant
[22:56:57] bruvcloud: nettoweb: that definitely wasn't 1 line lol
[22:57:11] nettoweb: but I need to create a primary key too?, right?
[22:57:24] bruvcloud: protip.. if you're on Vim, select everything you want in visual mode and type 'J' to put it all on one line
[22:57:40] bruvcloud: nettoweb: not really, you just need a table that has user_id and plan_id
[22:58:11] bruvcloud: nettoweb: and that table needs to correspond with your model name
[22:58:33] bruvcloud: so if your model is PlanUser, your table should be plan_users and it needs two integer columns at least: plan_id and user_id
[22:59:01] bruvcloud: nettoweb: doesn't your habtm table already have this data in it? i figure it's just a matter of renaming the table and building an AR class to represent it...
[22:59:03] bruvcloud: shouldn't be too hard
[23:00:37] celeretaudax: using restclient gem, how can i wait until i get a response before continuing to execute my script?
[23:01:01] celeretaudax: right now response = JSON.parse(request.execute)
[23:01:12] celeretaudax: but i want to ensure i have a response
[23:01:19] nettoweb: bruvcloud: yes, my current table is "plano_has_usuario" but I'm thinking I'll not rename
[23:02:25] bruvcloud: nettoweb: so your model will have to be called PlanHasUser?
[23:02:56] bruvcloud: nettoweb: remember to not fight the framework too much. most of the time if you have to do `self.table_name` in your AR model, you're doing it wrong!
[23:03:16] bruvcloud: the only time i've ever needed to do that legitimately was when i was making a view and we used a certain convention to designate views from tables in our DB
[23:04:01] nettoweb: bruvcloud: I'm struggle in my company to change this
[23:04:17] rehat: whats a good way to test a api endpoint in my rails app
[23:04:51] bruvcloud: rehat: mock it out or use vcr
[23:07:54] nettoweb: bruvcloud: Could not find the association :plano_has_usuario in model Usuario
[23:08:05] nettoweb: bruvcloud: maybe something with nomenclature
[23:10:17] bruvcloud: nettoweb: did you make a has_many :planos, through: :plano_has_userio?
[23:10:26] bruvcloud: ACTION doesn't know whatever language that is so forgive bad grammar
[23:11:51] beardofbees: I'm having trouble getting my PATH to recognize postgresql.app's version of psql
[23:12:02] tubbo: beardofbees: ughhhh
[23:12:03] beardofbees: "which" still brings up /usr/bin/psql
[23:12:03] tubbo: beardofbees: yeah
[23:12:17] tubbo: beardofbees: so if you do `echo $PATH`, you might notice that /usr/bin is like one of the first entries
[23:12:21] beardofbees: and i've done the PATH adds for everything
[23:12:22] tubbo: so it gets precedence
[23:12:30] tubbo: beardofbees: if you're on OS X, you need to edit /etc/paths
[23:12:37] tubbo: and restart your machine
[23:12:42] tubbo: just to edit a god damned path...yeah.
[23:12:46] beardofbees: the restart is going to be it then
[23:12:50] beardofbees: i haven't done that part yet ;)
[23:13:11] beardofbees: Already had the postgres.app etc. ahead of /usr/bin
[23:13:17] beardofbees: so lemme reboot and i'll pop back in
[23:13:19] nettoweb: tubbo: has_many :planos, :through => :plano_has_usuario, :class_name => "Plano"
[23:13:47] nettoweb: tubbo: yes, it's was difficult but I'll change all my app to english (ruby pattern)
[23:16:23] beardofbees: tubbo, I don't reboot often, but when I do, I'm pleasantly surprised how fast it is
[23:16:30] beardofbees: that said, still no love
[23:19:40] tubbo: beardofbees: haha
[23:20:13] eph3meral: is there any such thing as an init task in capistrano these days?
[23:20:20] tubbo: beardofbees: you edited /etc/paths to include your /Appligations/Postgres.app.. route?
[23:20:28] tubbo: eph3meral: what would an 'init' task do?
[23:20:29] eph3meral: I could have sworn there used to be e.g. cap deploy:setup for example
[23:20:42] rehat: how do I get the id of an ActiveModel? do I just do model.id
[23:20:43] eph3meral: tubbo, I mean yah I suppose I could just write my own and fire it off once
[23:20:44] tubbo: i kinda think there is
[23:20:55] tubbo: eph3meral: isn't that how it initially creates the directory structure?
[23:20:59] eph3meral: but there used to be a "defacto" one that would set up your dir with e.g. a shared folder etc
[23:21:08] tubbo: rehat: if your activemodel has an `id` method/attribute..
[23:21:09] eph3meral: tubbo, well the only way to create that structure is to do a deploy
[23:21:14] eph3meral: which... doesn't make complete sense
[23:21:26] beardofbees: tubbo, yep, definitely. I use oh-my-zsh, but also made sure to do it for /etc/paths and the bashrc, etc
[23:21:32] eph3meral: tubbo, well maybe not the *only* way but that's the only way there seems to be by default
[23:21:38] eph3meral: and the docs don't mention any kind of init task anymore
[23:21:40] tubbo: beardofbees: weird. that definitely worked for me..
[23:21:55] eph3meral: beardofbees, what's your zsh issue?
[23:21:56] tubbo: eph3meral: maybe they took it out. why do you want to set up a cap dir but not deploy to it?
[23:22:17] beardofbees: eph3meral, I can't get Postgres.app's version of psql to give me any love
[23:22:17] eph3meral: tubbo, because I need to put other things into /shared before I deploy so that I can then symlink those things in to /current
[23:22:30] beardofbees: i'm just at the end of RailsTutorial chapter 3 under the advanced section
[23:22:48] eph3meral: tubbo, and I need /shared/foo to exist before the deploy happens so I can do some pre-post processing
[23:23:07] eph3meral: beardofbees, oh... don't use the .app ?
[23:23:43] eph3meral: beardofbees, not sure what to say on that one - I never use .apps for shit that matters, they're totally borked comared to a conventional install so of course you'll have fucked up problems with e.g. the psql command line client
[23:23:44] beardofbees: but "which psql" always is saying /usr/bin
[23:23:46] tubbo: eph3meral: ah i see.
[23:23:55] eph3meral: breakingthings, yes because OSX comes with postgres already installed
[23:24:01] eph3meral: breakingthings, use homebrew instead
[23:24:02] beardofbees: eph3meral, should I just use home-brew?
[23:24:13] beardofbees: i didn't mean to put a -
[23:24:19] tubbo: beardofbees: fwiw i feel like the homebrew version works better, and forces you to ensure /usr/local/bin over /usr/bin for everything
[23:24:46] beardofbees: tubbo, that's cool, I'm just following rails tutorial to the letter ya know?
[23:24:58] beardofbees: hmm got a 404 on taps for "psql"
[23:25:03] eph3meral: beardofbees, moral of the story: when doing application development, stay away from anything .app related as a lib/dependency/critical-part-of-your-app-architecture
[23:25:18] eph3meral: beardofbees, always use the "linux" type equivalents from homebrew if they exist or compile from source failing that
[23:25:24] beardofbees: brew install postgresql works forme
[23:25:43] beardofbees: eph3meral, thanks for the good word :)
[23:25:59] eph3meral: beardofbees, cool, so you'll still need to make sure the correct psql is in your path, and you'll still need to isntall the service
[23:26:03] beardofbees: fwiw I don't really like running .app that much either
[23:26:08] eph3meral: beardofbees, brew info postgresql will show you the run commands
[23:26:16] beardofbees: eph3meral, hm, ok. it's downloading it right now
[23:26:48] beardofbees: i feel like i'm in sort of a funny position with the rails tutorial because certain pieces of it are a little too noob over all, even though I don't know rails except for what it's taught me
[23:26:49] eph3meral: beardofbees, you should probably nuke your Postgres.app and anything you've done related to i
[23:30:48] tubbo: i just want to comment all over the place in this code
[23:30:52] tubbo: # NOTE: really?
[23:30:57] tubbo: # TODO: this is totally unnecessary
[23:31:08] tubbo: # NOTE: why the fuck would you do it this way come on
[23:31:13] tubbo: # NOTE: bro do u even c0de!?
[23:36:28] eph3meral: tubbo, the unfortunate answer is, quite likely not
[23:37:23] tubbo: eph3meral: what
[23:37:28] beardofbees: path is a dick
[23:37:34] eph3meral: tubbo, specifically what I mean is most coders I meet are not fundamentally coders, they're dudes who thought computers would be a "good job" like being a doctor or something and they don't fundamentally care about actually coding
[23:37:36] tubbo: beardofbees: it's OS X that's the dick here.
[23:37:44] tubbo: $PATH works much better on linux
[23:38:00] beardofbees: i just did "brew update" and got undefined method 'to_sym'
[23:38:07] beardofbees: so much for making progress today :P
[23:38:19] tubbo: eph3meral: oh yeah, that might be true.
[23:38:22] tubbo: the east coast is newbie-land
[23:38:24] eph3meral: a programmer stays interested for hours because of the intrinsic value of the programming - posers are watching the clock and trying to do shit as quickly as possible
[23:38:28] tubbo: well this area at least :P
[23:38:56] tubbo: i wish i didn't care so much tbh
[23:39:06] eph3meral: tubbo, I'm right there with ya :)
[23:39:13] eph3meral: not sure if that's :) or :( honestly, lol
[23:39:16] tubbo: but honestly it's all for a good reason. i want leverage.
[23:39:32] tubbo: basically if i work at a company where nobody knows shit and i know a decent amount, i look like a fucking genius every day
[23:39:48] eph3meral: tubbo, well that or you look like a dick
[23:40:01] tubbo: nahh i'm not mean about it though
[23:40:02] eph3meral: and genius or not, perceptions require a delicate balance to mold
[23:40:43] tubbo: there's no reason to be mean, we're all in this boat together. my colleagues are definitely legit, but there's been a lot of GET THIS DONE FAST NOW DONT WRITE TESTS GOGOGOGOGOGO
[23:40:54] tubbo: and that's something that at least someone has to manage and mitigate
[23:40:58] tubbo: which no one has done
[23:41:00] tubbo: hence, shitty software
[23:41:32] tubbo: it's a hard job but mitigating the torrent of shit that will spew out if i let these assholes run wild and code without talking to each other makes all of our lives better.
[23:41:52] tubbo: fwiw, this will happen at every company if there's not some kind of system in place for work delegation and all that
[23:42:04] tubbo: guess that's why companies have hierarchies and shit :)
[23:42:31] tubbo: but i'm glad i work in a company with no hierarchy. i hate authority and levels of bureaucracy.
[23:43:06] rehat: what is a good way to debug a ParameterMissing error?
[23:43:32] eph3meral: rehat, puts
[23:43:39] eph3meral: rehat, rubymine?
[23:43:45] tubbo: rehat: require 'debug';debugger
[23:43:58] tubbo: rubymine - when you need your debugger to consume 90% CPU
[23:44:18] eph3meral: i don't use it, but it's the only gui ruby debugger I know of
[23:44:19] beardofbees: I gotta head out
[23:44:28] beardofbees: eph3meral, tubbo thanks for the help
[23:44:35] beardofbees: I will return to fight this probably tomorrow morning
[23:45:26] beardofbees: brew installs to /usr/local/bin yeah
[23:47:01] beardofbees: alright. later dudes