« Back to channel list

#RubyOnRails - 14 November 2014

« Back 1 day Forward 1 day »
[00:00:13] diegoviola: I had a job interview today with some recruiter, why is that I can't get a job anymore with just "rails" knowledge, they ask me to know a bunch of other stuff, like angular, ember, etc
[00:00:40] diegoviola: I guess they have a bunch of keywords they require me to mention
[00:00:52] Criten: buzzwords basically...
[00:01:15] rhizome: buzzword bingo
[00:01:26] Criten: I mean, it will increase your odds at a job if you are familiar with more tech then the other guy
[00:01:34] diegoviola: yeah so that's what I've been doing wrong, I didn't mention any buzzwords
[00:01:42] Criten: but i'm pretty sure if you know rails like the back of your hand you will land a job
[00:01:46] neredsenvy: I have an ActiveModel object nothing is stored in database I pull the data from API create a new instance of that object now what's the convention store the object into the session or store just the attributes ? Is there a preferred Rails way or does it not matter at all ?
[00:02:19] rhizome: punctuation is your friend
[00:03:35] diegoviola: the recruiter said "why don't you learn angular/ember and then apply again with us?"
[00:04:00] rhizome: no, because they aren't there to help you, but they're telling you that anyway.
[00:04:06] Criten: there are a whole sea of recruiters, go elsewhere :P
[00:04:30] rhizome: oh, they did tell you that
[00:04:57] rhizome: established companies can use regular rails ppl, ask them if they deal with any of those.
[00:05:17] Criten: Are you not interested in frontend tech?
[00:05:31] diegoviola: Criten: me? I'm more of a backend guy, but frontend is interesting too
[00:05:33] Criten: because it will improve your odds if you read up on some of that stuff
[00:05:51] rhizome: do you know js at all? jquery? coffeescript? put it in there.
[00:06:04] diegoviola: personally, I don't like javascript all that much, but I'd still do it
[00:06:24] rhizome: start liking it :)
[00:06:43] pipework: I like javascript. always have.
[00:06:43] Criten: it's not going away any time soon :P
[00:08:00] diegoviola: I guess you're right
[00:08:07] bricker`work: pipework: me too, so much hate :(
[00:08:23] pipework: Ever since the early 00's.
[00:08:36] Criten: ACTION also loves js
[00:08:36] pipework: But I would have loved Lua earlier if I had known about it.
[00:11:07] tubbo: you can also just fucking say that you know ember/angular
[00:11:13] tubbo: and then when you get the job do a crash course in it
[00:11:29] tubbo: i'm not sure why companies don't check up on that
[00:11:29] pipework: Lol, frameworks.
[00:11:51] tubbo: i feel like it's less about knowing the frameworks sometimes and more just being aware of them
[00:12:15] tubbo: you can learn how to use them in days, but being aware of them means that you're paying attention to things. lots of programmers don't pay attention to things and that can bite.
[00:12:20] pipework: I like telling people at interviews why their preferred framework really sucks whenever I can.
[00:12:20] bricker`work: tubbo: yeah, that is why hiring "Ruby developers" or "Javascript developers" is a stupid way to hire people.
[00:12:30] pipework: bricker`work: Hiring developers is stupid.
[00:12:38] Radar: #sickburn
[00:12:44] pipework: Radar: u got im gud
[00:13:13] tubbo: bricker`work: well you should at least know the language...frameworks are a little different
[00:13:22] Radar: diegoviola: Because every bastard knows Rails now and you need to differentiate yourself from those other bastards.
[00:13:34] Radar: tbh I only get hired now because I wrote a book about Rails 3 years ago
[00:13:40] Criten: Radar speaks truth
[00:13:44] Radar: if it were hiring on merit, lolololol
[00:13:48] diegoviola: Radar: I see
[00:14:03] tubbo: i can smell Radar's latest pull request all the way over here
[00:14:19] pipework: I only get hired because my farts stink of cotton candy.
[00:14:25] Radar: tubbo: there's actually two PRs, one in Ruby and one in Go.
[00:14:31] Radar: EACH MORE TREMENDOUS THAN THE LAST
[00:14:34] EminenceHC: I have a mailer. In the mailer view I have a .each which iterates through some records does some calculations on them and spits them out into a table. I am wondering if there is a way to sort by a number that is calculated in the view without storing it in the database. I understand a lot of this logic should be in the model instead of in the view but even still is it possible? https://gist.github
[00:14:34] EminenceHC: .com/EminenceHC/63dc8cfacd3dcec02d1c
[00:14:52] Radar: EminenceHC: IRC split your gist link over two lines
[00:15:01] EminenceHC: https://gist.github.com/EminenceHC/63dc8cfacd3dcec02d1c
[00:15:34] tubbo: EminenceHC: you mean like if you could each() with an index? :)
[00:16:15] tubbo: `th style="background:#737A35;color:#fff;"` i hate you :P
[00:16:23] pipework: ACTION slithers away
[00:16:26] EminenceHC: tubbo: Its for an email I had to.. sorry...
[00:16:31] tubbo: OHH right
[00:16:36] Criten: use an inliner
[00:16:38] tubbo: EminenceHC: email styling is THE WORST
[00:16:45] EminenceHC: tubbo: Ya its fucking awful.
[00:16:53] EminenceHC: I feel like im in the 90's
[00:16:54] Criten: You can improve the process a ton with the right tools
[00:17:07] pipework: And using mailers in a more proer way.
[00:17:09] tubbo: EminenceHC: anyway, what do you want to sort by?
[00:18:01] EminenceHC: tubbo: One of the completed percentages that is calculated in the view. (The fourth column in the view)
[00:18:30] tubbo: EminenceHC: you mean the numbers *inside* the each block?
[00:19:07] tubbo: EminenceHC: problem with that is you seem to need a school.id in order to calculate those numbers...
[00:19:19] tubbo: so you're already iterating in the each, you can't really sort by something that hasn't been calculated yet
[00:19:27] EminenceHC: tubbo: Normally I would sort with the query out of the database or just use a sortable table with JS.
[00:19:33] EminenceHC: tubbo: Yeah that is the problem.
[00:19:36] Radar: Perhaps do the sorting in different object ifrst ;)
[00:20:03] Radar: Like a class that's dedicated to doing all these queries for the school... let it do the queries then do the sorting on the schools then return an array and use that in your mailer.
[00:20:16] tubbo: yeah that's what i was gonna say. build some kind of collection object to wrap @survey1.schools and iterate over that, with the counts already baked in. then you can just sort(&:pre_count).each or whatever.
[00:20:32] tubbo: Enumerable is your friend.
[00:20:35] tubbo: (the Ruby module)
[00:21:04] EminenceHC: Radar: tubbo: Ah ok I just wanted to make sure that was possible before I refactored all of this into the model layer.
[00:21:20] Radar: Anything's possible if you wish for it hard enough
[00:21:28] tubbo: </tinkerbell>
[00:21:31] EminenceHC: Radar: Where the fuck is my pony then?
[00:21:39] pipework: EminenceHC: Waiting for you to wish harder.
[00:21:42] Radar: EminenceHC: Definitely not wishing hard enough.
[00:21:47] tubbo: Pony.new(owner: EminenceHC)
[00:22:35] tubbo: this object we're talking about would live slightly above those models
[00:22:47] tubbo: it's not a model in and of itself, just a regular old class
[00:22:57] elemenopy: hmmm this isn't working the way i would expect it to. i want to fire all threads at once https://gist.github.com/anonymous/edb0043b270d5afc8716 why is it not firing all threads at the same time?
[00:23:12] pipework: tubbo: Sounds like effort.
[00:23:22] pipework: Why can't he just use #sort with a block?
[00:23:25] EminenceHC: tubbo: A regular class is not considered a model?
[00:23:38] pipework: EminenceHC: A model is a business object for the application.
[00:23:56] pipework: It might be an instance of a class, or it might be a module, which doesn't really matter.
[00:24:00] tubbo: a model, IMHO, is something that *just* wraps data.
[00:24:09] pipework: tubbo: Then ruby is all model!
[00:24:33] pipework: Go read about MVC and then let's talk about how you should move beyond it.
[00:24:49] tubbo: i guess it's more of an app design thing. i don't chuck random classes into ./app/models, i just use that for "data models", like AR classes
[00:24:56] tubbo: it's probably not real MVC but whatever
[00:25:14] pipework: Well, rails' MVC pattern is the web version.
[00:25:21] elemenopy: oops wrong channel sorry
[00:25:24] tubbo: lol "web mvc" glad that term died
[00:25:34] pipework: Often referred to as mvc2, but not sure if it has a proper term.
[00:26:02] tubbo: the one thing that rails kinda messed up was using a bunch of helper methods rather than actual view classes
[00:26:14] pipework: There are actual view objects.
[00:26:17] tubbo: don't think that's going away anytime soon though
[00:26:17] pipework: They're just hidden.
[00:26:20] tubbo: i know but you can't edit them :(
[00:26:26] pipework: Sure you can.
[00:26:28] Radar: That's the thing that I hope Rails 5 fixes
[00:26:34] Radar: Actual view objects + form objects
[00:26:38] tubbo: Radar: you think they're gonna bake in support for that stuff?
[00:26:43] Radar: I hope so
[00:26:56] pipework: Radar: I hope rails 5 fixes stupid people's backwards opinions that take years for them to come around. That, and activerecord callbacks.
[00:26:57] tubbo: would be nice..
[00:26:59] Radar: There's been a bit of talk about it around the tracks.
[00:27:08] tubbo: Radar: i think that's slated for rails 6
[00:27:14] Radar: how boring
[00:27:17] tubbo: sorry that was meant for pipework :P
[00:27:21] Radar: ACTION wants another huge breaking Rails release
[00:28:09] tubbo: Radar: cash money
[00:28:15] tubbo: consultants be like MAKE IT RAIIIIIIN
[00:28:19] Radar: mmmmmhmmmmm
[00:28:25] Radar: And we also get a better Rails out of it
[00:28:34] pipework: And Radar gets to write another rails book.
[00:28:53] pipework: Co-authored by someone who totally hacks some shit up.
[00:28:54] mwlang: hmmm???.late to the convo???what is it Rails 5 hopefully fixes? :-o
[00:29:07] pipework: mwlang: I'm hoping it fixes bad people.
[00:29:12] Radar: mwlang: Not having view objects (as per traditional MVC) and not having form objects.
[00:29:27] tubbo: here's a question about form objects: if you have a view object, do you really need form objects?
[00:29:30] pipework: Conservatively, I hope it brings world peace.
[00:29:33] Radar: tubbo: yes
[00:29:34] pipework: tubbo: Yes.
[00:29:43] Radar: omg pipework and I agreed
[00:29:44] Radar: without faffing about
[00:29:52] Radar: ACTION takes the rest of the day off feeling accomplished
[00:30:10] tubbo: mwlang: the views part of rails is really not views, in most other MVC frameworks they're called "templates"
[00:30:25] mwlang: tubbo: ah, now I get ya.
[00:30:40] pipework: I prefer to see Templates, with Viewmodels and Form objects, then Controllers to Services.
[00:30:41] tubbo: as pipework and i said before, there *are* view classes they are just generated for you behind the scenes
[00:30:56] pipework: tubbo: And you can easily modify them, though you have to do it in runtime.
[00:31:03] tubbo: but if you ever do a `binding.pry` or `debugger` inside a template, you'll see exactly what the object is
[00:31:05] Radar: doesn't sound easy
[00:31:06] pipework: Or fork railses.
[00:31:14] tubbo: pipework: yeah i'm curious about how you'd modify them
[00:31:18] tubbo: and what the implications are behind that
[00:31:28] pipework: Radar: rking, I think, has done it well.
[00:31:33] mwlang: its probably getting time to re-envision the Rails architecture anyhow
[00:32:05] tubbo: my new framework is called jcfu - just controllers, fuck you.
[00:32:14] tubbo: put it together yourself i don't care
[00:32:38] pipework: My favorite tool is rack.
[00:33:39] pipework: Radar: Sorry, it was rf-. https://github.com/rf-/keynote
[00:34:01] pipework: I helped him with getting access to the view objects and modifying them.
[00:34:03] Radar: how is this different to draper?
[00:34:37] pipework: Radar: https://github.com/rf-/keynote#why-not-use-decorators
[00:34:52] Radar: aint nobody got time for that
[00:35:03] pipework: keynote isn't a decorator, it's a viewmodel.
[00:35:04] Radar: But yeah, his points make sense
[00:35:16] pipework: A presenter.
[00:49:42] duncannz: So I added a new field to a database, and changed all the relevant files in the views to add the new field. I also added it to the ".permit" section in the controller. I can save data to it locally (development environment) and I can access the production console and save to it. However on the production site data does not save to it, and there are no errors in the logs.
[00:50:10] duncannz: what steps might I have missed in adding this new field?
[00:51:55] smoak: im using accepts_nested_attributes_for on a one to many association, and im setting the attributes with _destroy: @parent.childs_attributes = [{ _destroy: true, id: 1 }] but when i call @parent.destroy the child doesnt get deleted from the db. if i call @parent.save; @parent.destroy everything works...is that really the way to do this?
[00:51:57] sevenseacat: deploying the code? restarting the server?
[00:52:23] duncannz: it is on heroku, I am not aware that I can restart the server
[00:52:58] duncannz: and yes the code is deployed, because the text field in the form is there and can be filled in
[00:53:41] sevenseacat: migrating your production database? who knows
[00:54:11] duncannz: done that, and it shows "status: up" for heroku run rake db:migrate:status
[00:56:21] duncannz: ok so /new triggers an error, method "new_field_name" does not exist. however /edit loads and you can fill out the form, it just doesn't save the edit
[00:56:48] Radar: duncannz: Are you sure you ran `heroku run rake db:migrate`?
[00:57:04] Radar: duncannz: Are you sure you committed the migration to your Git repo?
[00:57:09] duncannz: and heroku run rake db:migrate:status shows the correct migration name with "up" next to it
[00:57:20] duncannz: yes, and "git diff" shows no output
[00:57:28] Radar: then you've done everything right imo
[00:57:35] Radar: What does /new say?
[00:58:05] duncannz: well it says" error, if you are the owner check the logs". the logs say ActiveRecord::UnknownAttributeError (unknown attribute: new_field_name)
[00:58:23] Radar: I don't know how that could all happen
[00:58:33] Radar: Does the migration actually contain the code to add the field?
[00:59:28] duncannz: well it has an "add_column" call inside "def change". it was generated by "rails g migration AddFieldNameToTable field_name:string" but with my field name instead of "field_name"
[01:00:39] duncannz: oh sorry /new only errors out once you actually submit the form
[01:02:27] duncannz: this is really weird
[01:07:25] pipework: Rails In Peace
[01:07:29] helpa: Ruby, don't take your love to town!
[01:08:36] neredsenvy: What's happening xD
[01:08:57] helpa: http://i.eho.st/pgyl63n3.gif
[01:09:05] soahccc: Anyone knows a free tool to edit I18n ymls? There is localeapp.com which isn't free and all the rest (translate, translation_center) are engines (I need something separate) and only support rails 3 (I need it for a rails 4 app)... It can be a local tool as well but I wasn't able to find something decent :(
[01:09:14] pipework: soahccc: vim is pretty nice
[01:10:13] soahccc: pipework: Okay I wasn't clear... "[..] free tool to _conveniently_ edit I18n ymls?" :D
[01:10:21] pipework: soahccc: still vim
[01:10:29] wmoxam: soahccc: I heard atom.io is all teh hotness
[01:10:31] pipework: Or your preferred plain text editor.
[01:10:40] pipework: wmoxam: But how does it handle the large files?
[01:10:47] sevenseacat: sublime text is pretty good.
[01:10:58] pipework: vim, embarassingly, doesn't do well if you have syntax highlighting on.
[01:11:01] soahccc: pipework: the thing is to keep it in sync for multiple locales (I can do DE and EN but have to wait for FR)
[01:11:08] pipework: soahccc: Git is nice for that.
[01:11:19] pipework: Vim + Git is great for editing files and being able to sync them up.
[01:11:30] wmoxam: pipework: pretty shitty tbh
[01:11:42] pipework: wmoxam: Pretty fantastic, you must mean.
[01:11:54] pipework: I mean, it's shit about not helping you lose data.
[01:11:54] wmoxam: no, I mean atom +_ large files
[01:12:11] pipework: wmoxam: oh. Yeah, vim too though if you forget to turn off syntax highlighting.
[01:12:18] wmoxam: it just hangs until you kill it
[01:12:21] soahccc: well I do it manually atm but it sucks to have all locales open and insert the same key at the same line, etc. Locale app is pretty much what I am looking for but I was hoping for something self hosted
[01:12:39] pipework: soahccc: So arrange your i18n keys better?
[01:14:02] pipework: soahccc: I mean, for multiple languages, you'll still have to edit multiple files unless you had a key for every string at some level of indentation that specified the language, but that'd throw off some tooling, I think.
[01:14:57] soahccc: pipework: well as I said, locale app is pretty much what I want. It automatically adds unknown keys and I can point the french guy to a list with things he need to translate. I guess I have to beg my boss thne
[01:15:11] pipework: soahccc: Yeah maybe
[01:16:36] soahccc: synced sublime editing would be nice
[01:17:38] neredsenvy: Can someone help me out here
[01:17:39] neredsenvy: https://gist.github.com/anonymous/f9b197b0a0c2e1d54a1a
[01:17:54] neredsenvy: What exactly is happening here why is one method setting the variable and other is not
[01:18:44] webdestroya: neredsenvy: because the "foo" method is setting the response of a method = to something
[01:18:46] neredsenvy: If I have an instance of User object and I call in this object name = "Bar" this wont set the name variable value to "Bar" but if I call it self.name = "Bar" it will change the value
[01:18:49] webdestroya: which doesnt make sense
[01:18:59] webdestroya: "name = Bar" is not "set name equal to bar"
[01:19:07] sevenseacat: synced sublime editing?
[01:19:18] sevenseacat: so if you edit one file, it edits other files too? >_<
[01:19:39] webdestroya: neredsenvy: 'self.name' is the actual variable
[01:19:43] sevenseacat: name='bar' will set a local variable for that method to 'bar'
[01:19:52] soahccc: neredsenvy: because for receiverless assignment (i hope that is correct) you must do self.xxx = val. That is because the other is defining a local variable
[01:20:33] soahccc: sevenseacat: you know synced browsing in SFTP programs? 3 sublime panes, with cursors in each file
[01:20:43] soahccc: I use synced SSH a lot as well
[01:20:46] sevenseacat: that sounds terrifying
[01:21:01] pipework: soahccc: Whatever kind of drugs you're using, please turn them over to sevenseacat.
[01:21:06] pipework: She could use them more than you can.
[01:21:07] neredsenvy: soahccc I do that to xD
[01:21:22] ferr: Where could I find delay settings for mail? I've got AccountMailer.delay.password_changed(self)
[01:21:27] neredsenvy: Only thing is you need to use a proper software for it
[01:21:38] sevenseacat: put medication here ---> :O
[01:21:40] neredsenvy: not that crappy Sublime plugin horror
[01:21:49] soahccc: I mean sublime already supports multiple cursors, I just need them to be cross-file :D
[01:22:05] neredsenvy: Sublime/Vim + WinSCP Sync option nothing beats it
[01:22:09] pipework: soahccc: Put the insane down.
[01:22:12] pipework: neredsenvy: lol windows
[01:22:31] neredsenvy: pipework What on earth is wrong about developing on Windows ?
[01:22:36] soahccc: everything
[01:22:46] soahccc: sorry to stab you in the back there :D
[01:22:46] neredsenvy: Not really : P
[01:22:48] webdestroya: u gon get booed out of here with talk like that
[01:22:48] pipework: neredsenvy: The windows part is pretty bad.
[01:23:00] pipework: get yourself a vm, man
[01:23:50] neredsenvy: Nah I have Ubuntu, Yosemite and Windws 8
[01:23:56] neredsenvy: OSX at work (horrible)
[01:23:58] hnanon: Radar: here?
[01:24:12] soahccc: alright, I just use synced SSH on localhost and open the three files, problem solved xD
[01:24:28] soahccc: with vim at least!
[01:24:37] neredsenvy: Windows preferred above all
[01:24:37] pipework: I don't mind the OSX much. I prefer debian for most development, but I use all kinds of things for experimental and non-srs works.
[01:24:45] sevenseacat: if osx had a decent built-in package manager i'd be more likely to use it
[01:25:02] pipework: neredsenvy: You'll only be able to use a subset of the libraries that are popular.
[01:25:24] sevenseacat: now that it doesnt have to be a wall of blinding white and grey
[01:26:51] neredsenvy: I have yet to come across something I could do on Ubuntu that I can't do on Windows.
[01:27:13] sevenseacat: install ruby 2.1?
[01:27:35] pipework: neredsenvy: There's many things. Like fork(2)
[01:27:45] neredsenvy: I have ruby installed on Win8 : )
[01:28:05] diegoviola: I use Linux on a ThinkPad T510
[01:28:23] sevenseacat: nice, what tools did you use for that?
[01:28:25] pipework: neredsenvy is signed up for a bad time and he's quite excited about it!
[01:28:47] hnanon: The following relationships exist in my app:
[01:28:47] diegoviola: my ThinkPad is going to be 5 years old next year
[01:28:59] diegoviola: no, 4 years old
[01:29:08] neredsenvy: sevenseacat It's bundled with RubyMine 6.3.3
[01:29:27] neredsenvy: Run the installer first installs Ruby than IDE
[01:29:39] pipework: oh an IDE user too! Exciting.
[01:29:39] hnanon: Product shoe has Options size and color with variants of 8,9,10 and black, red, blue, respectively.
[01:29:46] hnanon: How should I model that?
[01:29:48] sevenseacat: oh... rubymine.
[01:31:07] hnanon: Product has many options through product_options, Options have many products through product_options, product_options belongs to product and option, options have many variants, variants belong to options.
[01:31:18] hnanon: That's what I currently have.
[01:31:21] neredsenvy: sevenseacat http://i.imgur.com/BtAriE4.png
[01:31:31] hnanon: All of those will be on one product/new form.
[01:31:37] sevenseacat: you poor thing.
[01:31:59] sevenseacat: how do you have multiple rubies installed?
[01:32:06] ferr: The app I currently check on emails are sent with delay method, how would I send them instantly without deleting this method?
[01:32:12] sevenseacat: does rubymine handle that too?
[01:32:14] neredsenvy: pipework What do you use ?
[01:32:17] youngmathimus0: i started on windows, gave that up quick
[01:33:34] pipework: neredsenvy: For what? Editing text?
[01:33:39] neredsenvy: I have not been a programmer for very long but I have learned in this time that no matter what you offer programmers they are never happy about it.
[01:33:52] antivert: hence why we write software
[01:34:27] pipework: I'm usually pretty happy when people offer me illicit substances.
[01:34:45] neredsenvy: Shame there not a cool saying like lawyered for us xD
[01:43:32] pipework: neredsenvy: what do you mean?
[01:43:46] neredsenvy: pipework About what ?
[01:44:03] pipework: [17:34:49] <neredsenvy> Shame there not a cool saying like lawyered for us xD
[01:45:47] neredsenvy: Lawyers after they prove someone right say lawyered : ).. Said by no lawyer outside HIMYM : ))
[01:46:58] sevenseacat: ive heard the term lawyered used when people ask for or get a lawyer
[01:47:34] pipework: I usually just go for some variation of 'fuck you' with a smile on my face.
[01:47:43] pipework: It's not always taken well.
[01:49:33] neredsenvy: I want to say that to so many clients and yet can't.
[01:50:02] pipework: neredsenvy: Get clients who like to communicate that way.
[01:50:27] neredsenvy: Hah : ) it was acceptable in college
[01:50:51] omosoj: is there anything wrong with this test? https://gist.github.com/anonymous/5502856b1f4509570011
[01:51:03] omosoj: (it's not working, i get a 422 error)
[01:51:09] Radar: yes there are many things wrong with the test.
[01:51:18] Radar: For one small payment $99.95 I can tell you
[01:51:32] sevenseacat: the test is pointless without the code that goes with it
[01:51:36] omosoj: do you accept omosoj dollars?
[01:51:38] Radar: sevenseacat: sshhh
[01:51:42] Radar: omosoj: AUD or USD only sorry
[01:52:09] pipework: omosoj: Nice not using rspec. You shouldn't use 'should' in the string in your tests.
[01:52:11] sevenseacat: ACTION sshhhs
[01:52:41] pipework: omosoj: Personally, I dislike request specs that assert on internals of the application.
[01:53:16] pipework: I'd test that you can delete the resource, that the response contains things you expect, and that you can't fetch the same resource you deleted(assuming that's a sane thing)
[01:53:26] Radar: 1) unformatted gist 2) no context about what users(:joe) is 3) No context about what store or products is 4) What is ProudctSale? 4) Where is the controller action? 5) What's the deal with accept and content type? 6) Why are you specifying authorization headers like that? 6)
[01:53:44] pipework: Radar: users(:joe) is a fixture or a factory that uses a lambda.
[01:54:02] pipework: Like the fixtures that fell out of favor, I think.
[01:55:30] sevenseacat: i like the idea of fixtures for some things. ill keep using them in future.
[01:56:18] omosoj: k, i'm reading all this and trying to understand
[01:57:10] pipework: sevenseacat: I like this neat thing where you can use a factory-like interface that will cache the results into fixtures, but you can still make some attributes dynamic.
[01:57:49] sevenseacat: i mean, some data truly is static and doesnt need to change or be created/altered between specs, such as user roles
[01:57:58] sevenseacat: chuck it in fixtures i say
[01:58:01] pipework: And it's flippin fast.
[01:58:52] sevenseacat: ive used them for more complex things and i find them fraught with danger for that, but for simple things, all good.
[01:59:39] pipework: I dislike maintaining them by hand.
[01:59:57] omosoj: pipework, did i 'assert on internals' in that test?
[02:00:58] pipework: omosoj: Yeah, you asserted on database state.
[02:01:35] sevenseacat: ive tried so many times to convince people not to do that
[02:01:38] sevenseacat: failed every time
[02:01:44] pipework: sevenseacat: Yeah. :(
[02:02:10] sevenseacat: feature specs test interface typically from a browser.... only test what you see in the browser
[02:02:12] omosoj: i don't understand :( assert_equal 204, response.status?
[02:02:28] sevenseacat: no, the lines below that
[02:02:34] omosoj: ah yes i see
[02:02:38] pipework: omosoj: https://gist.github.com/anonymous/5502856b1f4509570011#file-gistfile1-txt-L23-L24
[02:02:41] SteenJobs: rookie question: how might one in theory if they might possibly not know how to maybe create a username and password for a mysql db do so?
[02:02:52] SteenJobs: i???m asking for a friend....
[02:02:54] pipework: SteenJobs: how might one what?
[02:02:59] sevenseacat: SteenJobs: i dont know how to do it, but i would google it
[02:03:06] pipework: Create a user for mysql with a password?
[02:03:18] pipework: I'd travel to the Himalayas and ask a wise man there.
[02:03:31] SteenJobs: sevenseacat: i have. i only found really thin and disorganized results. what do you usually do when you set up a db?
[02:03:43] pipework: SteenJobs: a line of blow, why?
[02:03:56] sevenseacat: SteenJobs: i dont need to do anything, because i already have postgres configured and i use the same username/password for all my dev dbs.
[02:04:14] pipework: My favorite way to setup mysql is by using postgresql
[02:04:40] SteenJobs: ooo everyone???s giving me shit for this - the guy i???m building an app for uses hostmysite.com (don???t know why) and they use mysql
[02:04:42] sevenseacat: though i do use mysql in some apps and i have that in a vm and just use root because im freaking lazy.
[02:04:50] sevenseacat: if it gets hosed, i dont care.
[02:04:58] SteenJobs: but yea. i???m using mysql (been using sqlite this whole time) and so i???ve never had to configure a db
[02:05:07] pipework: SteenJobs: Just create one user and one password once. cybertzi has articles on it.
[02:05:07] sevenseacat: for a friend, hey >_>
[02:05:09] pipework: Then reuse.
[02:05:20] pipework: sevenseacat: He's speaking in the second person reverse normative form.
[02:05:23] omosoj: Radar, re: 5&6, are the accept/content-type/authorization unncessary? i just took it from other tests, and if i don't use them i get a 401 error
[02:05:25] pipework: ACTION doesn't even know what he said
[02:05:29] sevenseacat: the mysql docs have details on how to create new users.
[02:05:30] SteenJobs: pipework: my favorite type of form.
[02:05:46] pipework: omosoj: They're necessary if you care about them and want the tests to fail if they don't fit your assertions.
[02:05:50] SteenJobs: sevenseacat: haha yea my ???friend???.
[02:05:52] Radar: omosoj: *shrug* I don't know without seeing your controller code.
[02:06:05] pipework: The best kinds of tests are the ones that fail when you want them to and not when you don't.
[02:06:16] SteenJobs: sevenseacat: i guess first thing???s first, what other things need to be config???d when setting up a db? sqlite has spoiled me.
[02:06:27] SteenJobs: pipework: haha you???re on a roleeee
[02:06:45] sevenseacat: if this is for a production app, dont look at me, i dont go near that shit.
[02:07:04] SteenJobs: sevenseacat: wait???that must be explained. how does one not go near production?
[02:07:21] sevenseacat: i dont configure and set up production machines, i have devops people that handle that.
[02:07:21] SteenJobs: sevenseacat: i always assumed if you???re developing it???you then put it into production..?
[02:07:23] pipework: SteenJobs: They hand off the project to systems engineers.
[02:07:32] SteenJobs: oooo. gotcha.
[02:07:32] sevenseacat: i deploy stuff to production sure, but i dont configure it.
[02:07:52] SteenJobs: yea i think i???m riding solo for the most part on this one.
[02:08:33] SteenJobs: sevenseacat: i???m thinking though if i get the guy i???m working for to switch to heroku, i can use postgres and it should deploy in production seamlessly, no?
[02:08:54] pipework: *As long as you don't fuck it up.
[02:09:10] SteenJobs: haha right. it will go well as long as it doesn???t go not well.
[02:09:29] SteenJobs: p v ~p as they say, is a theorem of logic.
[02:09:55] SteenJobs: sevenseacat: ah theory is so pleasant sometimes...
[02:10:12] SteenJobs: wtf is hostmysite anyway. it???s tough to trust a site like that when their own site is so shitty.
[02:10:18] sevenseacat: i would never presume that an app built against sqlite will work flawlessly with postgres
[02:10:49] omosoj: updated test w controller: https://gist.github.com/anonymous/8e0e817dadb451c55e8d
[02:11:20] omosoj: seems like the destroy action isn't working. the first assertion fails. can't figure out why
[02:11:24] SteenJobs: sevenseacat: right but if i use postgres in dev i would hope it would work well in prod without any additional config.
[02:11:39] sevenseacat: omosoj: well, whats the response?
[02:11:42] pipework: omosoj: params[:per_page] ||= 15
[02:11:49] pipework: same for page.
[02:11:52] helpa: omosoj: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[02:11:52] Radar: omosoj: !gist-usage
[02:11:57] omosoj: sevenseacat, 422
[02:11:59] Radar: omosoj: Please add syntax highlighting to your gists
[02:12:00] Radar: omosoj: also, sign in
[02:12:05] sevenseacat: not the response code
[02:12:07] sevenseacat: the actual response
[02:12:15] pipework: Also, be careful with #permit!
[02:12:24] Radar: omosoj: I think sevenseacat means response.body
[02:13:21] omosoj: sevenseacat, when i run the tests? or json response?
[02:13:35] SteenJobs: damn. comp died???anyone say anything of relevance to me?
[02:13:42] Radar: omosoj: if the problem is with the tests then it's likely that we want to see the test response
[02:13:48] Radar: SteenJobs: Nope.
[02:14:37] omosoj: Failure:; Expected: 204; Actual: 422. that's it..
[02:15:28] sevenseacat: Radar: please finish debugging ruby so we can beat people over the head with it.
[02:17:07] omosoj: Radar, to answer you question from above about what ProductSale is... it's an associated model that Product accepts nested attributes from. but i saw that not even products are being deleted so i removed it to figure out what's going on
[02:17:21] agent_white: Radar: And feel free to uhhm... let me check out the beta version... ;)
[02:18:07] SteenJobs: is heroku a no brainer for hosting a prod app for a small business?
[02:18:21] sevenseacat: its an option.
[02:19:00] agent_white: sevenseacat: Wait is his book MEAP? I'd wanna pre-order it so I can start diving in.
[02:19:11] helpa: Debugging Ruby, a new ebook written by Ryan Bigg. https://leanpub.com/debuggingruby
[02:19:21] sevenseacat: you can read it now!
[02:19:29] SteenJobs: so many books???how long is your train ride exactly?
[02:20:01] Akuma: hello, what is the best way to do an SQL union?
[02:20:02] agent_white: ACTION squeals with delight
[02:20:14] sevenseacat: we need a !radarbooks factoid that just lists them all for your adoring fans.
[02:20:18] pipework: Akuma: Probably with SQL. :D
[02:20:34] cleopatra: I will create one inkscape pin-up
[02:20:38] Akuma: I mean with activerecord
[02:20:39] cleopatra: after that I'll look that book :)
[02:21:20] pipework: Akuma: It's not really supported.
[02:21:25] SteenJobs: pipework: you clearly come here to work on your material.
[02:21:26] pipework: Not nicely.
[02:21:42] pipework: SteenJobs: I'm not funny. If you want funny, see omarqureshi.
[02:21:46] pipework: Wherever that fucker went.
[02:21:49] agent_white: ACTION has purchased debugging ruby
[02:22:09] SteenJobs: haha get him back. i want proof.
[02:22:17] Radar: sevenseacat: one day, one day
[02:22:41] Radar: sevenseacat: yes
[02:23:37] agent_white: Radar: Is Klabnik still working on R4iA? Looks like he dove into the Rust end of things.
[02:23:41] SteenJobs: ok..i???m telling the guy to host on heroku because it???s better than hostmysite and so i can use postgres. if this plan fails i???m blaming it on you guys. k awesome.
[02:23:55] sevenseacat: SteenJobs: lol good luck
[02:23:58] Radar: agent_white: Not so far.
[02:24:07] SteenJobs: sevenseacat: as if i have any idea what i???m talking about.
[02:24:18] Radar: agent_white: He did the work on upgrading it to Rails 4 and he rewrote most of Chapter 6
[02:24:19] sevenseacat: but seriously yeah, i wouldnt take on production servers without knowing what youre doing.
[02:24:35] sevenseacat: especially for a business site.
[02:24:44] SteenJobs: sevenseacat: i mean it???s a pretty simple app, and heroku is pretty straightforward - there really isnt much config to be done.
[02:24:50] sevenseacat: all kinds of legal shit can be brought on your head if you get it wrong
[02:24:54] agent_white: Radar: Oh good deal! So it's not dormant? :P Also, couldn't pay more than the suggested for Debugging Ruby, so I'll need to get your paypal info once I get my next paycheck.
[02:25:00] sevenseacat: exactly, go with something like heroku
[02:25:05] sevenseacat: instead of DIY
[02:25:23] Radar: agent_white: It's not dormant since about 3 weeks ago. Myself, workmad3 and sevenseacat are working on it
[02:25:28] sevenseacat: ACTION waves
[02:25:31] SteenJobs: sevenseacat: ah ok. i???ll let him know that. i guess youre right, something like hostmysite is DIY.
[02:25:41] sevenseacat: Radar: saving the best for last, eh ;)
[02:26:09] agent_white: Radar: Oh wow! I had no idea! /me hugs Radar, workmad3, and sevenseacat
[02:26:31] Radar: agent_white: What's your GH username? I'll add you to the list of reviewers.
[02:26:46] agent_white: Radar: jakenotjacob :)
[02:26:53] agent_white: And thank you!
[02:31:03] pipework: agent_white: So we'll call you jaco then?
[02:31:26] agent_white: Works for me!
[02:34:24] pontiki: mmmmm jaco pastorius
[02:40:19] omosoj: how do i prepare the test database? rake db:test:prepare?
[02:40:57] pipework: omosoj: I've been having issues with that lately, but you'll want to do rake db:create:all and then rake db:test:prepare, or RAILS_ENV=test rake db:migrate
[02:41:41] omosoj: thank you, pipework.
[03:05:41] coldnebo: /msg nickserv help
[03:06:30] omosoj: oh man, just spent 4 hours trying to fix a problem. realized that it was something completely unrelated to what i was looking at. sheesh
[03:06:42] pontiki: that happens too often
[03:07:02] omosoj: don't know whether i should laugh or cry
[03:07:03] pontiki: generally after a huge pile of yak hair has accumulated, too
[03:07:54] omosoj: hopefully all the pain has seared into my brain that i need to check for that problem when this happens again. knowing me... it's not
[03:08:24] pontiki: nah, it'll be something completely different looking, until that pile of hair shows up again
[03:08:58] pipework: Make a wig with it!
[03:09:23] sevenseacat: only if the yak is a ginger
[03:09:41] omosoj: maybe a blanket instead. i have enough, and it's getting cold here
[03:09:57] pipework: mmm gingers
[03:12:43] SteenJobs: sevenseacat: i just did rake db:create:all for postgres - dev and test databases were created, but it???s giving me a third response ???FATAL: role "skyrank" does not exist??? - any idea? (skyrank is the name of the app)
[03:13:13] sevenseacat: its also the name of the role you tried to configure for postgres
[03:14:36] SteenJobs: sevenseacat: there???s nothing in the database.yml file for roleeeee, i can???t figure out where role is coming from.
[03:15:34] pontiki: it's called "username:" in the database.yml file
[03:15:46] pipework: Or user, but I use username.
[03:15:48] pipework: I think both work.
[03:15:59] pipework: SteenJobs: It's derived from config/database.yml
[03:16:23] SteenJobs: well that will explain it
[03:16:25] SteenJobs: thanks everyone
[03:16:38] SteenJobs: and do i need to config a password? or can i just leave it out
[03:16:46] pipework: SteenJobs: Whatever you have set.
[03:17:04] pipework: If you have a password set for the postgres role(user), then use it.
[03:17:19] SteenJobs: pipework: i never set any password, so i assume there is none.
[03:17:30] SteenJobs: except somehow there???s an env variable set for the password for production, but i never set a pword
[03:17:32] pipework: SteenJobs: Give it a go!
[03:17:37] pipework: The worse that can happen is that it doesn't work.
[03:17:49] pipework: Or maybe you'll be murdered, but we can't fret about details!
[03:18:00] SteenJobs: pipework: ha, i???m not even sure how to give it a go???
[03:18:07] pontiki: or.. Raptors
[03:18:22] pipework: SteenJobs: write the username in as the username value and then try to do a rake db:migrate or something
[03:18:56] SteenJobs: ah ok, when i do my first migration i???ll give it a try - assuming that there???s no password set, should i set one? or it doesn???t really matter
[03:19:19] pontiki: you can just do: rake db:migrate:status
[03:19:22] pipework: SteenJobs: in local development, probably not.
[03:19:32] pontiki: anything that actually makes it try to connect to the database
[03:19:57] pontiki: i believe the problem you have, though, is that you haven't actually created that role/user for postgres
[03:20:02] pontiki: but that may be foreshadowing
[03:20:21] SteenJobs: pontiki yea, i???m sure i didn???t do a lot of things???i???m not really sure how to set up a db
[03:21:02] pontiki: when i'm working with pg in dev/test, i never even bother to set the username/password
[03:21:15] pontiki: my login user is the default
[03:21:21] pipework: SteenJobs: Generally you set up a user in the database management system and then go and create the databases with rake db:create:all
[03:21:35] pipework: The rest is rinse, repeat, recycle for migrations and test prepare.
[03:22:04] SteenJobs: pipework: so i did rake db:create:all???and i set the usernames in my database.yml file
[03:22:12] pipework: SteenJobs: and den
[03:22:42] SteenJobs: well i ran into the problem of the prod db but changed the username and ran the rake again and i think i???m fine???just wanna make sure i didn???t miss any steps
[03:22:47] SteenJobs: because like hell i know what i???m doing
[03:28:02] whatasunnyday: For a toy app, I wanted to learn a little more about caching. For the purpose of my app, I create new records everyday (0-5) and and then use .group_by to organize them by date. This returns @model_by_date, a hash with the key as a date and the value being an array of records. Is fragment caching appropriate to use? I am doing <% cache @model_by_date %> but I'm not sure if this is right.
[03:43:30] Radar: WHO TOUCHED HELPA?!
[03:43:43] ferr: If I have this path, how would I make to manually to url? applicant_applicant_grading_path(id: applicant_grading.id)
[03:43:53] Radar: "to manually to url? "
[03:44:11] whatasunnyday: what happened to helpa
[03:44:30] Radar: helpa bounced because it detected a netsplit
[03:44:49] ferr: Radar: sorry for confusion, I see this at code but I need to enter it at browser
[03:45:04] Radar: ferr: look at how the route is defined in rake routes and replace the parts
[03:47:27] pipework: ferr: Why do you have application_applicant?
[03:47:33] pipework: I mean applicant_applicant
[03:48:45] ferr: pipework: sorry, this is not my project, I am just learning and doing tasks
[03:49:01] ferr: It took me like 3 days to setup everything and now I am stuck on such basic stuff
[04:11:50] Maletor: So how are GitHub and Facebook doing reply by email for conversations/messages? Or what is a good strategy in terms of signing the reply-to, which is something you will probably have to do.
[04:13:50] pipework: maletor: Set it to whatever is appropriate. I mean, if you're programmatically handling replies, you'll still need an address for people to reply to which you can receive mail from and handle.
[04:14:25] Maletor: Right now I have it so I get the message id and the sender and sign that.
[04:14:47] pipework: what do you mean by 'sign that'?
[04:14:48] Maletor: I'm looking for something a little more robust. Like, I'm noticing GitHub uses mailing lists.
[04:15:10] Maletor: Take a key and the data and create a cryptographic proof that it was from us.
[04:15:22] pipework: How is that related?
[04:15:25] Maletor: Verify that signature on the email processor.
[04:15:30] pipework: I thought the question was about routing email.
[04:15:44] Maletor: Nope, it's exactly about the reply-to.
[04:15:55] pipework: Why do you want to use the reply-to header?
[04:16:05] pipework: I mean, there are other headers for the threads and message id.
[04:16:27] Maletor: You could set X-Message-ID header but would you get that back in a reply?
[04:16:39] Maletor: And how do you verify it's authenticity?
[04:16:59] Maletor: If someone else gets that email they could reply as you from their email, no?
[04:17:01] pipework: authenticity being that the user might craft an email to join a thread they aren't really a part of?
[04:17:27] pipework: You'd probably want to do some application logic to make sure the sender is a part of the thread.
[04:17:54] Maletor: Aren't FROM headers easily forged?
[04:18:10] pipework: As for verifying authenticity of sender, there's better ways to verify the sender is actually who it came from.
[04:19:24] pipework: SPF records?
[04:20:16] Maletor: Ok, but let's just say Cloudmailin or whoever has already taken care of that.
[04:20:23] Maletor: It's safe to say FROM header is reliable?
[04:27:10] agent_white: Hey folks! Having issues testing session logout in my rails app. Any help appreciated! https://gist.github.com/jakenotjacob/94e0171e904de8ea6680
[04:28:54] agent_white: Or let me know if you need more information than that.
[04:29:32] pipework: agent_white: I could use some information on ground cherries.
[04:29:48] agent_white: pipework: If they have no worm-holes, they are fine to eat!
[04:31:55] agent_white: pipework: Any ideas on my issue? :( I know it's simple, I just shouldn't be mixing Hartl's tut with R4iA.
[04:32:03] agent_white: Hartl does things way differently.
[04:32:31] pipework: agent_white: Yeah, there's no session method on the example
[04:33:10] pipework: agent_white: I think you need a controller type not a feature type.
[04:33:19] agent_white: Ahhhh alrighty
[04:42:45] pipework: maletor: I hope that helped.
[04:43:04] pipework: maletor: Also, no you can't just assume the host took care of it, you need to verify the SPF record.
[04:43:15] pipework: http://en.wikipedia.org/wiki/Sender_Policy_Framework#Intra-domain_forgery
[04:43:45] pipework: maletor: Also DKIM
[04:44:33] agent_white: pipework: That did the trick. Thank you :)
[04:45:25] pipework: agent_white: What I would suggest is to separate your functional(feature) test out and only test the externally available bits.
[04:45:48] pipework: So test logging in and then visiting a page that requires login or has some different content because youer' logged in, maybe the page your'e redirected to after logging in, whatever.
[04:46:13] pipework: Then for log out, you'll want to log in and then log out, and then use the externally available stuff to verify that the user is logged out.
[04:46:23] agent_white: Ohhh... good idea! Will do!
[04:46:42] pipework: Then write controller tests that test similar things, but you can just set the session for the logout test instead of doing it through the web interface.
[04:52:10] SteenJobs: pipework: you ever deal with morris-js or flot-js?
[04:52:54] pipework: SteenJobs: I've looked at flot.
[04:53:09] pipework: I prefer d3
[04:53:39] SteenJobs: pipework: i???m using this template, and i can???t for the life of me get the charts to display. i???m getting an error in chrome console ???Uncaught Error: Invalid dimensions for plot, width = null, height = null???
[04:53:54] SteenJobs: pipework: i???m thinking i???m doing something wrong with the asset pipeline somehow
[04:54:10] pipework: Unfortunately I have to go poop in a porcelain bowl.
[04:54:16] pipework: While concurrently checking reddit.
[04:54:38] SteenJobs: pipework: hit me up when you???re back haha
[04:55:38] shortCircuit__: http://stackoverflow.com/questions/26922682
[04:59:37] Radar: shortCircuit__: no stacktrace?!
[05:00:10] shortCircuit__: He didn't give one, but I find the question very interesting.
[05:00:49] shortCircuit__: I add ed comment to add some stacktrace
[05:02:51] omosoj: is there a difference between writing 'belongs_to' in a model and putting add_reference in the migration?
[05:03:09] Radar: omosoj: yes
[05:03:19] Radar: one sets up the database, one sets up the model
[05:03:30] omosoj: so both are necessary?
[05:03:42] omosoj: k, thank you
[05:06:07] agent_white: Radar: Adding in testing logging out to my app, but a bit confused -- I know in R4iA we have a 'sign_in_as!' helper for a feature spec. pipework said testing logout is best as a controller spec, should I move testing signing in to a controller spec as well?
[05:06:49] agent_white: (I'm hopping between R4iA and Hartl's tut to figure out signing out)
[05:06:54] Radar: agent_white: I think it's best as a feature spec because how do you know the user can actually sign out?
[05:07:03] Radar: The controller test only asserts that the controller action works
[05:07:11] Radar: it doesn't assert that there's a link that let's the user sign out
[05:07:31] agent_white: Ahhh alrighty
[05:07:59] agent_white: Would it be a good idea then to add in Hartl's helper for testing to see if a user is signed in?
[05:08:15] Radar: which is that one?
[05:08:26] Radar: (oh and in r4ia I use login_as from Warden now)
[05:08:33] Radar: That's a change that I made this morning.
[05:09:13] agent_white: Radar: Hmmm, I'll go regrab the pdf. And his helper is "def is_logged_in?; !session[:user_id].nil?; end;"
[05:09:34] agent_white: Radar: If you could, you should add in a section on Logging out :) It would be awesome. Hartl just does his whole setup so differently.
[05:09:35] Radar: agent_white: The PDF won't be updated.
[05:09:49] Radar: The content at railsbook/rails_4_in_action will be though
[05:09:54] Radar: and I have a check for signed_in
[05:10:03] Radar: We don't have a test for signing out
[05:10:07] Radar: s/test/feature
[05:10:14] agent_white: Radar: Here's my code I had implemented, if it helps. https://gist.github.com/jakenotjacob/94e0171e904de8ea6680
[05:11:28] Radar: https://gist.github.com/jakenotjacob/94e0171e904de8ea6680#file-spec-support-authentication_helpers-rb-L2-L4
[05:11:31] Radar: Session is not available there
[05:11:35] Radar: That's why I use Warden's login_as
[05:11:55] agent_white: Radar: Thank you, I'll take a look into that :)
[05:13:04] agent_white: Radar: And quick sidenote -- Will Debugging Rails be released as a book? If so, will I be able to pay additional to get the hardcopy?
[05:13:19] Radar: agent_white: No, DR will never be released in hardcopy.
[05:13:28] Radar: hardcopy is hard to update vs softcopy
[05:13:40] agent_white: Ah good deal :)
[05:17:10] whatasunnyday: Can you guys think of any reason why when I use an etag (testing locally), it would always return 200 even if the etag matches? http://pastebin.com/R3Ny3biw
[05:17:21] whatasunnyday: Whoops. I'll convert it to a gist now.
[05:17:53] omosoj: i want to limit the number of associated attributes that are send out with a serializer. https://gist.github.com/anonymous/f40f250324a687a8c192 (line 3)
[05:18:37] omosoj: insetad of time created blah blah i want just one value to be sent
[05:18:38] whatasunnyday: Sorry, same question. Etag, development, always 200. Does this code seem odd to anyone? https://gist.github.com/whatasunnyday/f5edf7f230eeecd49f3d
[05:22:04] shortCircuit__: In that question should it be instance_eval or instance_exec ?
[05:38:00] SteenJobs: Radar: https://gist.github.com/SteenJobs/61736f116171322f3564#file-jquery-flot-js-L26
[05:38:19] SteenJobs: Radar: it???s a snippet from chrome console where i???m getting a js error and have no idea why, but i presume it???s the reason my graphs/charts aren???t showing up on the page.
[05:38:33] SteenJobs: Radar: mind you i don???t really know js
[05:38:50] SteenJobs: but i think it???s pipeline related - i can send you a pic of my directory tree
[05:38:59] kevinem: guys i'm back with yet another stupid question :)
[05:39:12] SteenJobs: no such thing as stupid questions, just stupid people.
[05:39:14] SteenJobs: not to worry
[05:39:24] kevinem: suppose an action gets called from different views
[05:39:36] SteenJobs: views don???t really call actions
[05:39:38] SteenJobs: actions call views...
[05:40:01] kevinem: form submission
[05:40:31] kevinem: do i have to use a hidden field to know from where the call came from?
[05:40:46] kevinem: or is there a more robust rails way? :)
[05:41:53] SteenJobs: how do you mean?
[05:41:56] SteenJobs: like what???s the use case
[05:42:09] kevinem: like the scenario is changing password...update method gets called
[05:42:19] kevinem: i have forced password change
[05:42:27] kevinem: user can change it himself
[05:42:42] kevinem: user can update his details
[05:42:44] SteenJobs: right so wouldn???t you just direct it to the edit method of your user controller?
[05:42:52] agent_white: Rescis: Is pastie or pastebin the bad one?
[05:42:58] agent_white: --what is the good one to use?
[05:43:01] agent_white: (besides gist)
[05:43:27] sevenseacat: pastie or gist are good
[05:43:32] helpa: Pastebin sucks because it loads slowly, has ads which are distracting and has terrible formatting. Please use Gist (http://gist.github.com) or Pastie (http://pastie.org).
[05:43:39] SteenJobs: ahhh she???s here :)
[05:43:46] SteenJobs: sevenseacat: want a challenge?
[05:43:47] sevenseacat: ahhhhhh shit run
[05:43:57] SteenJobs: i???m only here to make you better
[05:44:10] sevenseacat: im just about to run off for a bunch of meetings so :)
[05:44:15] kevinem: SteenJobs: i don't understand
[05:44:20] SteenJobs: ugh bad timing
[05:44:49] kevinem: sorry to interrupt the chit chat guys :D
[05:45:00] SteenJobs: kevinem: maybe i???m misunderstanding your question???but what would be the problem with just creating a form_for(@user) in the localhost:3000/user/edit page
[05:45:04] agent_white: kevinem: It's ok. We're only furious.
[05:45:19] SteenJobs: it will automatically be routed to the edit action in your users controller, and the user???s info will be updated
[05:45:35] SteenJobs: sevenseacat: but but but but i can???t figure this outtttt
[05:45:54] SteenJobs: sevenseacat: i???m getting a js error and i couldn???t have less of a clue what to do. and now my graphs/charts aren???t appearing :(
[05:47:35] kevinem: SteenJobs: but what about the forced password change...when use logs in first time...he is forced to a password change
[05:47:45] kevinem: just leave all those i think
[05:48:00] kevinem: is using a hidden field to know the scenario a bad idea?
[05:48:27] SteenJobs: kevinem: hmm, i???m not exactly sure how to do that..maybe route to the edit page automatically when a user logs in?
[05:49:18] kevinem: SteenJobs: but change password and edit needs to be two different views
[05:49:35] kevinem: i won't let the user edit his password on the edit page
[05:49:49] SteenJobs: and they can just navigate away
[05:50:03] kevinem: there is a hook
[05:50:05] SteenJobs: i just feel like hidden fields are messy because they can be messed with in theory
[05:50:16] SteenJobs: so why not just let them edit from the edit page?
[05:50:56] kevinem: somehow i like to have a different view for both of them :D i dunno why
[05:51:18] kevinem: isn't that how it happens commonly?
[05:51:38] kevinem: defferent page for changing password and different one for editing other info about user?
[05:52:40] SteenJobs: i guess it would depend on how much info a user has, i have an app where it???s one form, but that???s because all the user has is their name, email, and password.
[05:53:14] SteenJobs: wait - so would that mean that you have a different controller that takes care of password changes?
[05:53:33] kevinem: this is has more...i don't want the user presented with all those fields when he's trying to change the password
[05:53:38] kevinem: no! different action
[05:53:44] shortCircuit__: Yes!! I answered a question in the briefing session correctly!!
[05:54:10] kevinem: SteenJobs: one sec
[05:54:25] kevinem: i messed it up...i only have to do one thing
[05:54:45] SteenJobs: i was gonna say maybe just have a different controller - but what???d you come up with?
[05:55:08] kevinem: like when the update method is called from the usual edit page...all the attributes gets updated
[05:55:40] kevinem: but when it is called from the password change form submission...the check for new_password=confirm_password needs to be done
[05:56:04] kevinem: slighly different flow for each
[05:56:23] SteenJobs: well yea???, but you can still mix the do - at least i do. but i hear wanting to separate them.
[05:57:08] kevinem: like check for the existence of new_password in params and if it does
[05:57:12] kevinem: check it...right?
[05:57:51] kevinem: yeah that sounds good :)
[05:58:18] kevinem: SteenJobs: thats the way to go right?
[05:58:59] dan003400: Having issues with bootstrap collapse menus with turbo links
[05:59:13] dan003400: with them loading open, and not closing on page changes
[05:59:23] dan003400: what is the best way to handle this?
[06:04:27] SteenJobs: kevinem: are you not using has_secure_password in your user model?
[06:07:03] kevinem: i don't see it anywhere
[06:09:24] rails_noob: hey guys, if I get an association type mismatch what does it usually indicate? I???m assuming my issue is on ln32 but all my other controllers are set out the same and are working fine, it is also definitly sending the correct ID???s
[06:09:26] rails_noob: https://gist.github.com/ryanvermooten/d6916237cabba14cc44d#file-general_statements_controller-rb-L32
[06:09:54] SteenJobs: kevinem: look into it. it???ll take care of confirmation automatically
[06:10:32] kevinem: SteenJobs: uhhh okay!
[06:10:37] kevinem: lemme see that :)
[06:12:49] shortCircuit__: is redirect_to unavailable in the helper?
[06:15:00] shortCircuit__: redirect_to is unavailable in the helper
[06:24:15] shortCircuit__: actually thy redirect_to in the helper has a different syntax, http://apidock.com/rails/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods/redirect_to
[06:31:06] shortCircuit__: I have become Jon Snow. I know nothing
[06:31:32] siaW: what???s the difference. resource and resources (in routes.rb)?
[06:44:25] helpa: http://youtu.be/kfVsfOSbJY0
[06:46:10] x-light: happy friday tagrudev
[07:00:46] dan003400: Having issues with bootstrap collapse menus with turbo links
[07:00:53] shortCircuit__: happy childrens' day
[07:01:11] dan003400: with them loading open, and not closing on page changes
[07:01:56] Dbugger: Hello guys. Looking at some rails code i see status types like :created or :unprocessable_entity. I guess this things match with certain HTTP status codes. Is there a place I can see a relationship of them with their assosicated HTTP code?
[07:11:51] Varun_krishna: How do I disable /users/sign_up devise's route ?
[07:12:58] techsethi: shortCircuit__: Happy childern's day
[07:14:06] Varun_krishna: shortCircuit__: Man are you from India ?
[07:14:26] Varun_krishna: From which place ?
[07:14:41] Varun_krishna: Happy childrens day.
[07:21:07] agent_white: Hm. Where in Rails is the place to clear cookies? -- Trying to reload a page that keeps asking for a non-existant table entry.
[07:21:35] agent_white: (Trying to load my index page, it is attempting to check the current user's id when it shouldn't)
[07:22:18] agent_white: Ambiguous question since I'm not sure if anyone is even here to answer it :P
[07:26:19] agent_white: Found my answer: I needed to change `protect_from_forgery with: :exception` to `... with: :null_session`
[07:26:44] Varun_krishna: agent_white: are you trying to find(params[:id]) inside of the table?
[07:27:12] agent_white: Varun_krishna: Nah just "find(session[:user_id])"
[07:27:18] agent_white: In my application controller
[07:27:21] agent_white: I figured it out though :)
[07:27:40] Varun_krishna: so Find throws an error if you are trying to find a record that is not in the db.
[07:27:53] Varun_krishna: so use find_by_id(....)
[07:28:02] agent_white: Varun_krishna: Oh it wasn't that. It was when I reloaded the page, it tried to use previously set cookies.
[07:28:27] Varun_krishna: find_by_id returns null/nil if the record is not available.
[07:28:33] Varun_krishna: Oh I get that.
[07:29:17] Varun_krishna: What if you try find_by_id(sessuib[:user_id]) and check if you get the error.
[07:29:39] Varun_krishna: *session[:user_id] sorry for the typo.
[07:30:04] agent_white: Varun_krishna: Thank you for the help! But I already figured it out :)
[07:30:44] Varun_krishna: agent_white: No problem.
[07:41:03] tabish: umm. can someone break down collection (routes) for me?
[07:41:19] tabish: i read the guides, but it talks about search only. any other examples?
[07:42:21] shortCircuit__: Varun_krishna , Bengal
[07:48:59] siwica: anyone developing ruby in emacs? what modes are you using?
[07:49:00] agent_white: tabish: What do you mean?
[07:49:36] tabish: agent_white: use cases I suppose. Not really sure when you would use it (except for the search example in the guides)
[07:50:03] agent_white: tabish: Oh I mean, I'm not sure what you mean by "collection" and "routes" ?
[07:50:59] tabish: in rails you can add collection routes. ex. resources :photos do \n get 'search', on: :collection \n end
[07:52:49] agent_white: tabish: Oh wow! Never knew about that! Wish I could help you but I've never heard of it before.
[07:53:09] tabish: what the! I guess you learn new stuff everyday.
[07:56:26] tabish: gnite folks!
[08:07:02] shortCircuit__: I learnt a new thing, don't know how true. find() doesnot mean that it always takes an integer value, It looks for a begining number and uses it
[08:07:16] shortCircuit__: ACTION going to text .find(1-foobar)
[08:14:38] Dbugger: Hey guys, didnt Rails use to come with a "User" model before?
[08:14:40] Dbugger: Has taht changed?
[08:17:11] jeffmess: not that i'm aware of. guess most tutorials start with rails g model user ...
[08:19:33] hd1: anyone using mina know how to invoke a predeployment system command?
[08:26:29] Dbugger: Does anyone have a recommendation for tutorial or gem to handle Google login for building an app?
[08:38:35] shortCircuit__: Devise with omniauth2
[08:38:56] shortCircuit__: you can change the devise to something els
[08:39:09] shortCircuit__: no what was the gem for google omniauth
[08:44:19] shortCircuit__: gem 'omniauth-google-oauth2'
[08:47:55] shortCircuit__: i have enum state: [:pending, :accepted] , now I wants before_create :college_application.pending! <-- but this is wrong I guess. so should I :college_application.send(pending!) I don't know, I don't want to write another method :(
[08:52:24] jeffmess: does the pending! method do anything or are you just wanting to default the state to pending? on create?
[08:53:15] zewelor: shortCircuit__: try before_create 'college_application.pending!'
[08:53:51] shortCircuit__: ok, jeffmess, no pending! is just for setting the value. nothing else
[08:55:07] jeffmess: can't you just default all college applications to pending on the db level?
[08:55:31] shortCircuit__: that's why the enum , 0 for pending and 1 for accepted
[08:56:09] jeffmess: t.column :status, :integer, default: 0
[08:56:09] shortCircuit__: so self.pending! will set the value in the db to 0
[08:56:18] shortCircuit__: I have that already
[08:56:19] jeffmess: rails g migration
[08:56:54] shortCircuit__: I know this enum functionality , just don't want to make another method. that's it
[08:58:18] jeffmess: I'm so confused, enum automatically has pending! and accepted! methods, you're defaulting to 0 so on create there is no need to call pending! Am I being blonde?
[08:59:02] shortCircuit__: edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html
[08:59:11] shortCircuit__: http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html
[08:59:30] _lazarevsky: I need help setting up front end testing with capybara
[08:59:35] _lazarevsky: any help would be GREATLY appreciated fellows
[08:59:37] _lazarevsky: thanks so much
[08:59:40] solars: hi, quick question - does anyone know what causes bundler to hang on fetching source index for a certain project?
[08:59:49] solars: hangs and uses quite some cpu
[09:00:00] sevenseacat: its a cpu intensive task.
[09:00:38] solars: I mean of course more than a normal bundle install
[09:00:45] solars: and it doesn't continue
[09:05:56] shortCircuit__: is there a validates :all, allonw_nil: true, Filling out 9 fields just to create an object to see if a before_create methods works, is crazy
[09:06:40] shortCircuit__: Or can I use the test environment? then I can have factoryGirl and database cleaner
[09:07:40] shortCircuit__: I should write a test to do this.
[09:12:40] shortCircuit__: :'( I have to write a test for this. This so much excess work
[09:14:35] Morkel: When i join two tables in rails is it possible to acces the joined columns?
[09:15:18] FLeiXiuS: I'm looping through a bunch of username records using User.where(name: name).first_or_create in a rake task. However, I notice a new user account is getting created regardless if a record exists with the same name.
[09:15:26] FLeiXiuS: I'm hoping this is late night madness
[09:19:06] FLeiXiuS: Morkel, You mean a habtm table?
[09:19:37] FLeiXiuS: Like RecordsUsers Or CategoryProducts
[09:20:17] everettforth: using rvm, how do I uninstall rake 10.1.0 and install rake 10.3.2?
[09:20:19] Morkel: No, normal relations. Like: SELECT categories.id,categories.name,marker_styles.color FROM "categories" INNER JOIN "marker_styles" ON "marker_styles"."id" = "categories"."marker_style_id"
[09:20:34] Morkel: How can i acces marker_styles.color
[09:21:24] Morkel: FLeiXiuS: have you checked your DB constraints
[09:22:21] neredsenvy: Good morning.
[09:41:52] mikecmpbll: good morning
[09:42:04] carlesso: Hi guys. If i have a model with a date field, which is the better way to define a .where to grab all the objects where the date field is not null or empty string? (generally speaking)
[09:44:57] helpa: http://youtu.be/kfVsfOSbJY0
[09:47:40] mikecmpbll: carlesso: why would it be empty string? :)
[09:50:04] maloik: I have an authentication-based constraint that is setting a session value in order to be redirected correctly after logging in. I have access to the request object so I thought that would work, however upon inspecting this more closely the session value is nil... does a non-matching constraint cause this?
[09:51:03] helpa: maloik: 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.
[09:51:03] mikecmpbll: maloik: !code ?
[09:51:08] mikecmpbll: that's pretty hard to decipher.
[09:51:31] rails_noob: hey guys, I???ve been struggling with an issue all morning, I???m getting an association type mismatch, but I???m not sure where my issue is as it seems to be sending the right ids and my models seem right. I???ve attached my controller, logs, and models, let me know if you need anything else, https://gist.github.com/ryanvermooten/d92a1f79d68e7f7ff334 any help would be lovely, can???t seem to figure out whats going wrong.
[09:51:32] mikecmpbll: why would a constraint cause a session value to be altered
[09:56:01] maloik: mikecmpbll: https://gist.github.com/hannesfostie/cef9b912b98605961c20
[09:56:05] maloik: hope that makes sense
[09:56:09] carlesso: Hi guys. If i have a model with a date field, which is the better way to define a .where to grab all the objects where the date field is not null or empty string? (generally speaking)
[09:57:54] maloik: carlesso: we often use this gem https://github.com/fnando/normalize_attributes in combination with .where.not(field: nil) (or field: '' if that's what you normalize to)
[09:59:42] mikecmpbll: maloik: any reason you're using a constraint for this?
[09:59:54] mikecmpbll: seems more suited to controller logic to me.
[10:00:00] carlesso: maloik: thanks for the hint
[10:00:12] maloik: mikecmpbll: sidekiq/web is an engine, I don't want to go modifying that
[10:00:21] maloik: it's a mounted sinatra app
[10:01:48] mikecmpbll: and the problem is that the session value is nil in your constraint, but not in your controller method?
[10:02:42] maloik: other way around
[10:03:00] mikecmpbll: what session value?
[10:03:24] maloik: so first I get into the constraint code, set session[:admin_redirect_to] to what it needs to be, then exit the method to tell the routes the constraint was not met
[10:03:41] maloik: the next step is the route below that, redirects to /auth/openminds
[10:03:54] maloik: you log in and you're redirected
[10:03:59] maloik: at this point the session value is already nil
[10:04:32] mikecmpbll: the :admin_redirect_to?
[10:05:55] vimer: . What are some service provider in rails?
[10:06:08] vimer: +Hi all =x
[10:06:21] maloik: vimer: elaborate? I don't know what you mean
[10:06:46] vimer: maloik: Oho I mean are there very awesome companies in RoR? that builds RoR products
[10:06:57] mikecmpbll: vimer: yeah, me
[10:08:12] maloik: that's really hard to answer, possibly impossible... we don't know what you need, and I'm sure most people only know a couple (if any) companies (and their offering) well
[10:09:52] mikecmpbll: maloik: i dunno why it isn't working.
[10:11:06] shortCircuit__: We have only 3-4 companies probably in the whole of india working in India.
[10:11:35] shortCircuit__: They say rubee is not enterprize level
[10:12:09] shortCircuit__: and then there are a few using c++ and php and python and mainframe languages bla bla bla
[10:14:23] mikecmpbll: .net surely.
[10:17:42] neredsenvy: Heh not enterprize level, heh php xD
[10:25:29] FLeiXiuS: I'm trying to get a ranking of users by the number of 'sessions' associations they have.
[10:25:31] FLeiXiuS: User.select('users.*, count(sessions.id) AS sessions_count').includes(:sessions).references(:sessions).group('sessions.id').order('sessions_count DESC')
[10:25:50] FLeiXiuS: This returns only users with sessions. I need all users regardless
[10:30:43] workmad3: FLeiXiuS: for starters, you should be grouping by users.id, not sessions.id
[10:31:41] FLeiXiuS: workmad3, doh!
[10:32:13] FLeiXiuS: workmad3, You are 1000% right
[10:32:36] workmad3: FLeiXiuS: I'm surprised that isn't already doing a left join though... you may need to modify it to 'User.select(<same>).joins("LEFT OUTER JOIN sessions ON sessions.user_id = users.id").includes(:sessions).<group and order same>
[10:33:17] FLeiXiuS: I had tried something similar to that. Specifying the left outer - but I wasnt getting it where I needed it
[10:35:44] FLeiXiuS: workmad3, thanks a bunch. 5am coding generally leads to headaches and typos ;P
[10:36:10] workmad3: FLeiXiuS: ah, it was probably just the bad group then ;)
[10:36:14] workmad3: FLeiXiuS: btw, stop using mysql :P
[10:36:29] FLeiXiuS: workmad3, lol and use...?
[10:36:34] workmad3: postgres ;)
[10:36:37] FLeiXiuS: And yes it was the bad group
[10:37:10] workmad3: either that, or configure your mysql setup to conform to the SQL standard when it comes to groups, silent truncations, etc ;)
[10:37:37] FLeiXiuS: I've never dealt with postgres
[10:37:42] workmad3: (that group with your select should have raised an error in an SQL standard setup)
[10:39:22] FLeiXiuS: workmad3, Which DB would you suggest for devel then?
[10:39:36] workmad3: (what a surprise ;) )
[10:43:16] agent_white: Is there an easy way to reset the id field in a table when clearing that table (via `Tablename.destroy_all`) ?
[10:51:56] agent_white: I've dropped, reset, recreated my test database via rake but still no luck.
[10:53:15] siaW: agent_white: http://stackoverflow.com/questions/2097052/rails-way-to-reset-seed-on-id-field
[10:53:41] agent_white: siaw: I did see that, but noticed it was from 3 years ago and was iffy.
[10:53:48] masscrx: can anybody help me with this error ? https://gist.github.com/masscrx/76221d31744cf8d187b4
[10:54:04] agent_white: siaw: I also have tried "ActiveRecord::Base.connection.execute(update_seq_sql)" to no avail
[10:56:06] mikecmpbll: agent_white: what db?
[10:56:13] agent_white: mikecmpbll: postgresql
[10:56:32] agent_white: Trying out siaw's solution to see if maybe I was passing the wrong params to reset_pk
[10:56:52] agent_white: Though not sure what it means by "require it on an initializer"
[10:56:59] mikecmpbll: then did you try ActiveRecord::Base.connection.reset_pk_sequence!(table_name) ?
[10:57:22] agent_white: My table name is "Employee"
[10:57:22] mikecmpbll: and what was the result
[10:57:50] agent_white: `ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: syntax error at or near "Employee"`
[10:58:34] agent_white: mikecmpbll: `PG::UndefinedTable: ERROR: relation "Employee" does not exist`
[10:59:01] agent_white: My database name is "yumm_development"
[11:01:22] agent_white: the params all lower case and got a return value of "1" instead of nil... lets see...
[11:02:15] agent_white: Hmmm nothing still.
[11:02:37] agent_white: Might just need to tweak database_cleaner instead.
[11:04:58] shortCircuit__: https://gist.github.com/radar/504d767e936e793642c7 this spec looks exactly the same as mine
[11:05:14] shortCircuit__: even the file name
[11:08:33] mikecmpbll: agent_white: relation doesn't exist is a pretty clear cut error
[11:08:46] mikecmpbll: in whatever database you're connected to, there is no relation called "Employee"
[11:10:26] shortCircuit__: oh, now I remember, he should me how to write a good test
[11:10:27] agent_white: mikecmpbll: Hm. I basically just popped open rails console, then typed in the line above... could it be because there are no records in that table as I cleared it?
[11:10:40] mikecmpbll: it's because the table doesn't exist.
[11:10:57] mikecmpbll: find out what your table is called :)
[11:11:11] agent_white: But if I do `Employee.new` it returns ` #<Employee id: nil, name: nil, created_at: nil, updated_at: nil, pin: nil, manager: false>`
[11:11:28] agent_white: And I can save a record to that table?
[11:11:35] agent_white: So it exists, for sure! :D
[11:11:51] workmad3: agent_white: are you sure your table isn't really called 'employees'? :P
[11:12:06] workmad3: agent_white: Employee is the model in activerecord after all, not the table name
[11:12:40] doerteDev: do eventual matchers for cucumber/capybara functions work in any possible way? I won't get Then /^string (.*)(?:\,\d+) morestring $/ do |route, additional_info = 1| ... to work :(
[11:12:41] mikecmpbll: at least it's friday.
[11:12:58] workmad3: mikecmpbll: is that an excuse now? awesome! :D
[11:13:10] doerteDev: oh. friday. yay ...
[11:13:24] agent_white: workmad3: `railsconsole> Employee.table_name` => "employees"
[11:13:30] agent_white: If that's what you mean...
[11:13:32] workmad3: agent_white: there you go ;)
[11:13:39] agent_white: This is what I get for attemping this at 4:13am.
[11:13:53] mikecmpbll: agent_white: when you write SQL, it doesn't know what your ruby classes are called :p
[11:14:13] workmad3: agent_white: if you wanted to be snazzy, you could do ActiveRecord::Base.connection.reset_pk_sequence!(Employee.table_name)
[11:14:30] agent_white: workmad3: But the thing is like I said above... I did that via `ActiveRecord::Base.connection.reset_pk_sequence!("employees")`... got a return value of 1 instead of nil.
[11:14:34] agent_white: But the issue exists.
[11:15:09] glaksmono: anyone is around?
[11:15:14] mikecmpbll: glaksmono: no
[11:15:15] agent_white: mikecmpbll: At this point, I am writing neither SQL nor Ruby, just anything that may work ;P
[11:15:16] workmad3: agent_white: additionally, I'm not sure why you care so much :P
[11:15:30] workmad3: agent_white: so what if your id sequence isn't reset? ;)
[11:15:34] doerteDev: does ruby even allow something like functionname do |var = 'valueifnotset'| ?
[11:15:35] glaksmono: i set config.active_record.default_timezone to Jakarta, and for some reason when I do DATE_PART('hour', payments.created_at) AS hour, it seems like the time is in UTC, any ideas?
[11:15:50] agent_white: workmad3: Ohhh basically, I dropped a table, and am trying to reset the id seed so it will start from 1 instead of the last entry.
[11:16:02] workmad3: agent_white: yes... but why?L
[11:16:10] Varun_krishna: HI all is there any way to use node.js application inside rails 3 application ?
[11:16:17] agent_white: workmad3: I guess... I don't know why I care. Just figured that I probably should on my own? :P
[11:16:19] doerteDev: Varun_Krishna: wtf?
[11:16:39] workmad3: agent_white: the point of an autogenerated ID sequence is that it's completely meaningless
[11:16:53] workmad3: agent_white: it shouldn't matter if it's starting from 1 or from 99million ;)
[11:16:54] agent_white: workmad3: I guess... even if it doesn't matter... I kinda want to know how I should fix it, _should_ it matter in the future? idk. I'm learning Rails to bare with me! :P
[11:17:07] Varun_krishna: doerteDev: Yeah, there is already a application is built with node.js https://github.com/zhukov/webogram I want to use this application in my rails application.
[11:17:35] agent_white: workmad3: So there's no like "whoa you skipped to 25 from 1! there is going to be a performance decrease!" sorta-thing?
[11:17:42] mikecmpbll: how are you testing that the ID isn't reset, anyway?
[11:17:45] agent_white: from 1 to 25*
[11:17:45] doerteDev: Varun_Krishna: integrate it as a service somehow
[11:17:46] glaksmono: can someone help me?
[11:17:55] agent_white: mikecmpbll: Loading my index page ;PP
[11:18:00] mikecmpbll: how is that testing it
[11:18:01] doerteDev: glaksmono: never worked with it sry
[11:18:02] workmad3: agent_white: nope
[11:18:04] agent_white: mikecmpbll: "Couldn't find Employee with 'id'=6"
[11:18:12] mikecmpbll: once again, how is that testing it.
[11:18:15] Varun_krishna: doerteDev: I seriously don'tknow how to do that one.
[11:18:26] agent_white: Before I was just manually adding an employee with id of 6 to sweep it under the rug.
[11:18:39] mikecmpbll: to know whether the sequence is reset, you'll have to add a new Employee
[11:18:41] mikecmpbll: and look at it's ID
[11:18:51] agent_white: mikecmpbll: Well it makes me wonder why an index page is loading an id to begin with, for sure.
[11:18:52] workmad3: mikecmpbll: *its ;)
[11:18:54] doerteDev: Varun_Krishna: integrate a webservice into a rails app?
[11:19:10] doerteDev: neither do I. but there are people here who know such things. Just not me.
[11:19:31] Varun_krishna: No the link I shared you is a complete application, built on node.js
[11:19:33] agent_white: mikecmpbll: Uh.
[11:19:51] agent_white: mikecmpbll: I did something right in that process. What you said was correct.
[11:20:04] agent_white: Just not sure what :( I was doing that before, but always got the id+=1
[11:20:10] mikecmpbll: it is, about 60% of the time.
[11:20:10] workmad3: agent_white: you just didn't create 6 new employees before trying the test? :P
[11:20:21] agent_white: Maybe the first time I entered the "employees" table name right...
[11:20:38] agent_white: workmad3: I did, but not after getting the return value of 1.
[11:20:41] agent_white: Which... I should've.
[11:21:15] agent_white: mikecmpbll/workmad3: Thank you guys for your help. Now onto this next bug that still things I need an id of 6 to enter the index page.
[11:21:25] Varun_krishna: mikecmpbll: Hello
[11:21:27] workmad3: agent_white: I'd sort out that test personally ;)
[11:21:31] mikecmpbll: glaksmono: time is always stored in UTC
[11:21:41] workmad3: agent_white: as that's really the bug... the first one (id sequences not resetting) wasn't really a bug ;)
[11:21:42] doerteDev: Varun_Krishna: dunno, i wouldn't trust a software vendor that loads ambigious javascripts from an IP rather than an URl
[11:21:43] mikecmpbll: glaksmono: regardless of your rails timezone configuration.
[11:21:59] agent_white: workmad3: Yeah as you'd expect, I was working on "logging out users" prior to this.
[11:22:15] agent_white: Hahah, I'd like to pretend it was a 'bug' for an ego boost! ;P
[11:22:30] agent_white: "I've created a monster I cannot stop!"
[11:22:36] Varun_krishna: doerteDev: as of now there is no way to do this in rails, and they don't have an api for that.
[11:24:02] masscrx: ok, Yesterday I said that new FF dev edition is much faster and less RAM consumer, It was mistake, now 976 MB consumed RAM with one page opened o_O
[11:24:12] workmad3: masscrx: hehe
[11:24:13] doerteDev: Varun_Krishna: do what? somehow give you the possibility to integrate a "subwebpage" in your rails app written in a completely different platform code?
[11:24:39] doerteDev: Varun_Krishna: if you come up with a solution to do such things that are not iframeish you are a rockstar :P
[11:25:03] Varun_krishna: doerteDev: Yes, that is what I am trying to do.
[11:25:03] masscrx: after restart of course it consume again lass than original but after some time it is very hungry for memory
[11:25:48] Varun_krishna: doerteDev: The thing is that, I am not a guru inRoR, just a beginner .:)
[11:26:40] doerteDev: Varun_Krishna: well. no guru in $thing would describe himself as a guru in it.
[11:27:07] doerteDev: and I'm a RoR beginner as well, but the thing that you try to do sounds weird
[11:27:30] doerteDev: I mean, I bet Telegram has some sort of API. Then things might become easy. MIGHT!
[11:27:36] Varun_krishna: doerteDev: Yes, I agree, but there is a time for that. I have been programming in rails since this july
[11:27:39] doerteDev: then you should look into grape.
[11:27:54] doerteDev: Varun_Krishna: I been doing this for a month now.
[11:28:10] neredsenvy: Or a tunnel ?
[11:28:26] neredsenvy: And you can write half the app in ruby half in C
[11:28:31] Varun_krishna: doerteDev: Is this what you mean https://core.telegram.org/api ?
[11:28:35] neredsenvy: or Java or PHP or .NET
[11:28:39] workmad3: Varun_Krishna: your options are - 1. make API requests from rails to the node application (running on a different port or machine) and insert data from that into your pages, 2. Run the node app and direct different parts of your site to it via your web server (nginx or apache)
[11:28:58] neredsenvy: workmad3 It can be the same machine.
[11:29:05] neredsenvy: oh diff port yes
[11:29:20] workmad3: neredsenvy: ;)
[11:29:46] glaksmono: anyone know how to fix this timezone? created_at | 2014-11-14 11:29:07.401418+00
[11:29:54] glaksmono: so that i can have it +<whatever my local timezone is>
[11:29:57] workmad3: Varun_Krishna: you can't spin up the node app as part of the ruby process though
[11:29:59] glaksmono: i set the time_zone to Jakarta
[11:30:02] glaksmono: and for some reason it doesn't change it
[11:30:49] neredsenvy: Hehe I just got a message from the client "should we be concerned with security over not having captcha on registration form?" meanwhile they have HTTP GET /api/auth/username/plain_text_password
[11:30:54] Varun_krishna: workmad3: Ok thanks.
[11:31:01] neredsenvy: and say that's not a security concern
[11:31:42] mikecmpbll: glaksmono: i answered you already
[11:33:19] glaksmono: mikecmpbll, oops.. thanks.. really? how come i remembered that i had stored -8 for PST
[11:33:47] mikecmpbll: glaksmono: rails stores everything in UTC, then converts to your configured timezone when you grab data
[11:33:54] glaksmono: is there a way to query DATE_PART in specific timezone then?
[11:34:13] glaksmono: because i'm using result_transactions.select(
[11:34:19] glaksmono: and that's a SQL query
[11:34:37] mikecmpbll: can you convert it in ruby? after the select
[11:34:49] glaksmono: after the sleect?
[11:34:54] glaksmono: well i need to aggregate it using the timezone..
[11:34:55] mikecmpbll: after you've queried it
[11:35:02] glaksmono: how do you do that?
[11:35:13] mikecmpbll: oh, did you store a timezone?
[11:35:34] glaksmono: i'm not sure what's ur question
[11:35:38] glaksmono: so created_at i'm using timestampz
[11:35:49] glaksmono: t.column :created_at, 'timestamptz'
[11:35:59] glaksmono: although in postgres is still GMT +00
[11:36:08] Varun_krishna: workmad3: There ? is this https://core.telegram.org/method/auth.sendCode can be used with rails?
[11:36:09] mikecmpbll: what are you trying to do.
[11:36:27] glaksmono: mikecmpbll, now i want to aggregate data based on DATE_PART 'hour', but on the Jakarta timezone
[11:36:28] mikecmpbll: when you call @foo.created_at, it will be converted to your application's configured timezone.
[11:36:48] mikecmpbll: right, what's jarkarta's gmt offset?
[11:36:55] glaksmono: +8 i believe
[11:36:59] mikecmpbll: you can just add 8 :/
[11:37:07] workmad3: mikecmpbll: probably depends on date :)
[11:37:15] workmad3: (like most timezones)
[11:37:17] agent_white: workmad3: Think my "RecordNotFound in TablesController#index... Couldn't find Employee with 'id'=6" has to do with "protect_from_forgery?" It points to the error being here: https://github.com/jakenotjacob/Yumm/blob/master/yumm/app/controllers/application_controller.rb#L17
[11:37:27] mikecmpbll: workmad3: what would you recommend? :) aggregate in ruby?
[11:37:34] glaksmono: like this? DATE_PART('hour', payments.created_at)+8 AS hour,
[11:37:41] glaksmono: looks so ugly and terrible haha
[11:37:55] mikecmpbll: glaksmono: sure. but like workmad3 said it might change depending on when in the year
[11:38:20] workmad3: agent_white: no... it's gotten past the forgery detection (which just checks for a valid session)
[11:38:25] agent_white: workmad3: I have changed protect_forgery... to "protect_from_forgery with :null_session"
[11:38:44] workmad3: agent_white: if it was that, you'd be getting session[:employee_id] as nil, not as 6
[11:39:01] glaksmono: mikecmpbll, gosh, don't think this is a good solution.. there's no way we can store it with our localized timezone?
[11:39:08] agent_white: Ahhh alrighty. Cause I had changed that forgery to :null_session when it was giving me errors when logging out.
[11:39:08] Varun_krishna: agent_white: Man please change it to find_by_id and try if it is the same result.
[11:39:09] glaksmono: making that postgres record to +8 or something
[11:39:35] agent_white: workmad3: What general area should I be looking in?
[11:39:57] agent_white: Varun_Krishna: Hahah my tweak worked before... where should I be putting that?
[11:40:02] defswork: I'd like some of my helpers to be namespaced - (i.e. called as Something.link_helper) - how can I do this ?
[11:40:04] workmad3: agent_white: well, the issue is that your session is established for an employee with ID 6... but said employee doesn't exist in your test run
[11:40:23] agent_white: I need to clear that session
[11:40:33] workmad3: agent_white: .find_by_id will just not error if no record is found
[11:40:34] agent_white: I... think. :P
[11:40:36] Varun_krishna: agent_white: Employee.find_by_id(session[:employee_id]) if session[:employee_id]
[11:40:41] workmad3: agent_white: which isn't really what you want here, I suspect
[11:40:54] workmad3: agent_white: you want to tell if someone is logged in with an incorrect session
[11:41:00] agent_white: Varun_Krishna: Whoa
[11:41:02] workmad3: Varun_Krishna: that isn't the issue
[11:41:09] workmad3: Varun_Krishna: that would just mask the issue
[11:41:21] agent_white: Ahhh... yeah cause his little fix got me to see the index.
[11:42:22] Varun_krishna: workmad3: Ok, I thought he his trying to access the user that is not available in the session.
[11:42:23] workmad3: agent_white: I need to run away, I'm afraid... but yeah, the issue is that your session has a bad ID in it from somewhere
[11:42:38] agent_white: workmad3: No worries at all! I appreciate your help!
[11:43:07] shortCircuit__: halp!! https://gist.github.com/argentum47/daeda9f32c8e7a3c323c
[11:43:14] agent_white: workmad3: Uhm.
[11:43:27] agent_white: workmad3: I added in "session.clear" above that "@current_employee" line.
[11:43:32] neredsenvy: In rails controllers is request a reserved word ? Or can it be used for method name ?
[11:43:34] agent_white: Seemed to work...
[11:43:41] agent_white: Not sure if I'm masking it though.
[11:43:45] workmad3: agent_white: sure... if you want to log out everybody on every request...
[11:43:54] Varun_krishna: agent_white: what happened now ?
[11:44:10] agent_white: Varun_Krishna: I got to the homepage again... but like workmad3 said, not the fix.
[11:44:29] mikecmpbll: neredsenvy: http://api.rubyonrails.org/classes/ActionController/Base.html
[11:44:35] workmad3: agent_white: you should be looking in your test suite, not in the codebase, I suspect ;)
[11:44:43] workmad3: agent_white: as that's where the session will be established
[11:44:52] agent_white: workmad3: Alrighty! Will do!
[11:44:56] agent_white: Thanks again for all your help!
[11:45:03] shortCircuit__: workmadmadmad hints helps and rails specs
[11:46:20] mikecmpbll: neredsenvy: specifically: http://api.rubyonrails.org/classes/ActionController/Base.html#method-i-request
[11:46:41] Varun_krishna: agent_white: lol
[11:47:50] agent_white: Varun_Krishna: Thank you for your help as well :)
[11:49:13] shortCircuit__: common its a friday
[11:49:33] mikecmpbll: !isitfriday?
[11:49:48] agent_white: Now I have no idea where the bug went.
[11:49:56] mikecmpbll: agent_white: chase it.
[11:49:58] agent_white: Can't make it happen again after clearing the session :/
[11:50:22] agent_white: mikecmpbll: I know :( Baaah.
[11:50:54] agent_white: Commit #xyz: "That one bug fixed itself. next"
[11:53:52] shortCircuit__: Umm, I=Now when I try to create an academic detail I have an invalid authenticity token error
[11:54:04] shortCircuit__: but I have secrets.yml
[11:54:46] shortCircuit__: Can't verify CSRF token authenticity Completed 422 Unprocessable Entity in 153ms
[12:01:36] agent_white: Welp. Fixed my FactoryGirl config. But that bug... who knows.
[12:05:20] sprihodko: Hi. Trying to move haml code to helper. Have tried it like this but not working http://pastie.org/9718860. How should i change content_tag ?
[12:07:56] mikecmpbll: sprihodko: what happens?
[12:08:04] mikecmpbll: no good to just say "not working"
[12:08:12] shortCircuit__: why can't I signup here http://lucapette.com/users/sign_in
[12:10:41] shortCircuit__: so suddenly I am no one.
[12:10:48] greengriminal: does anyone see any issues with calling dependent: :destroy https://gist.github.com/anonymous/c78375a2be829289c6b4#file-example-rb-L2
[12:11:41] mikecmpbll: greengriminal: no?
[12:11:57] sprihodko: mikecmpbll: it returns only link. And if i add + sign to concat it then i get error unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
[12:12:15] mikecmpbll: sprihodko: show the version with your + sign in it.
[12:13:09] barhum2013: what do you guys think of elasticsearch for rails?
[12:13:24] mikecmpbll: sprihodko: you probably need to wrap your link_to arguments in parentheses.
[12:13:39] mikecmpbll: "foo: " + link_to(.., ..)
[12:14:03] shortCircuit__: if I do a bundle console then I get a fatal error
[12:14:21] sprihodko: mikecmpbll: here http://pastie.org/9718869
[12:14:23] mikecmpbll: shortCircuit__: and what is bundle console meant to do?
[12:14:30] mikecmpbll: sprihodko: read up
[12:15:01] shortCircuit__: http://bundler.io/v1.1/bundle_console.html https://gist.github.com/MyArtChannel/941174#comment-48326
[12:15:28] mikecmpbll: sprihodko: you'll also need to make the whole thing HTML safe.
[12:15:47] mikecmpbll: shortCircuit__: i see, new one on me.
[12:16:38] sprihodko: mikecmpbll: now works but show it like this From: <a href="/users/4">Homer Simpson</a>
[12:16:49] mikecmpbll: sprihodko: yep, that's because it's not been marked html safe
[12:17:06] mikecmpbll: ("foo" + link_to()).html_safe
[12:17:59] mikecmpbll: or "foo".html_safe + link_to() will probably work too
[12:18:37] sprihodko: mikecmpbll: I put it in a wrong place:) Thanks to you!
[12:21:51] siaW: How do i use SecureRandom to print some random number?
[12:21:59] neredsenvy: When matching a string to regex why does ==~ work but !=~ does not work ?
[12:22:14] arrowcircle: hi! what is the best way of changing class of STI model?
[12:25:53] wm3|away: neredsenvy: ==~ doesn't do what you think, I suspect
[12:26:30] neredsenvy: It's what I been thinking that matches the string as equal where as I need to check the pattern/format
[12:26:41] wm3|away: neredsenvy: in that '==~' would be seen as the interpreter as 'a == (~/regex/)'
[12:26:47] wm3|away: neredsenvy: what you really want is =~
[12:26:50] wm3|away: neredsenvy: and !~
[12:26:56] shortCircuit__: Do I have to write binding.pry in order to use pry in my rails application. Isn't there a way to browser through the app using pry.
[12:27:07] wm3|away: neredsenvy: try '"hi" ==~ /hi/' for confirmation ;)
[12:27:28] neredsenvy: wm3|away Thanks I'll try it out
[12:32:49] doerteDev: lol. failed epicly. Damn you factorygirl -.-
[12:32:57] shortCircuit__: I found the source of error the <input name="authenticity_token" ..> filed has gone missing. But how did this happen all of a suddent?
[12:37:04] sandelius: How does Rails know in which order to require controller files in production?
[12:40:35] siaW: can you require ???SecureRandom??? in model class?
[12:41:50] mikecmpbll: sandelius: probably look in to the eager_load! method
[12:42:03] mikecmpbll: pretty sure that's what gets used when your app initializes, if config.eager_load is set to true.
[12:43:24] mikecmpbll: iirc it's just alphabetical unless a file it loads has explicit require statements
[12:44:04] sandelius: mikecmpbll a controller might inherit from another controller and that class needs to be loaded before
[12:46:40] ddv: siaw: of course why not
[12:47:21] emka: anyony know how I can get ckeditor gem to add absolut paths to uploaded images?
[12:47:23] shortCircuit__: Where did my input field go :'( :'(
[12:48:07] mikecmpbll: sandelius: a look at the code, like I suggested, shows that it uses require_dependency https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb#L468-L475
[12:48:23] sandelius: mikecmpbll yeah I'm reading it now
[12:48:25] agent_white: So if I am testing for invalid attributes to a form. Do I need to specifically test for each error for each form field being incorrect?
[12:48:38] agent_white: Not sure what the point is of "too much testing"
[12:48:50] mikecmpbll: a bit of digging in to require_dependency shows that it does some special stuff with constants which will probably explain how it can load files which depend on other classes not yet loaded.
[12:48:59] emka: This change only add absolute url to images added via file browser that is already on the server? https://gist.github.com/emilkarl/68dcc751e9fedec9e219
[12:50:49] agent_white: ie - With a form of two fields, do I need to write in a test "fails on invalid field 1" ... "fails on invalid field 2"... then specific errors for each (empty field, too long, etc.) ?
[12:51:14] agent_white: Or just test one field for the general "could not update/create" error?
[12:53:08] walidvb: hi guys, i have a model that has a column called description, i can see it in schema.db, but i can't create an object with that attribute.
[12:53:38] walidvb: that model use to have a description function, which I figured might be the cause of this, but even renaming the funcion doesn't help
[12:53:58] walidvb: Charge.attribute_names simply doesn't list that attribute... any clue?
[12:54:14] walidvb: (i did restart my server, etc )
[12:56:51] helpa: walidvb: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[12:56:51] sevenseacat: walidvb: !debug
[12:58:09] walidvb: sevenseacat: https://gist.github.com/walidvb/fa3b3bf8518db59504fa :)
[12:58:30] walidvb: (i've just changed description method to get_description
[12:58:43] sevenseacat: and whats the error
[13:00:33] walidvb: sevenseacat: the error is unknown attribute error when I Charge.new(description: "foo")
[13:00:41] sevenseacat: gist the full error
[13:01:07] walidvb: ActiveRecord::UnknownAttributeError at /gifts unknown attribute: description
[13:01:08] walidvb: well, it's literally just that:
[13:01:32] walidvb: sevenseacat: on a Charge.create! call, to be precise
[13:01:42] sevenseacat: walidvb: gist the full error with backtrace.
[13:02:22] walidvb: sevenseacat: there you go, thx https://gist.github.com/anonymous/cd547edddcfebaab344b
[13:02:32] walidvb: (called from console
[13:03:00] sevenseacat: using spring or something like that?
[13:03:38] walidvb: no i'm not
[13:03:44] walidvb: an app pre-loader?
[13:03:45] P-NuT: Hey all, has anyone used rails on a raspberry pi with good results?
[13:04:06] P-NuT: Or is it better to use something like sinatra / capistrano?
[13:04:20] sevenseacat: walidvb: yeah
[13:04:24] sevenseacat: restart it, if so
[13:04:30] walidvb: sevenseacat: ok think i found the error, 1min
[13:05:04] walidvb: migration error, branch confusion, etc.
[13:05:47] walidvb: gotta take a break, i think
[13:06:03] sevenseacat: it happens :) dont worry about it
[13:06:14] rocknrollMarc: window add help
[13:06:28] walidvb: been working on user stats to do some data analysis, my brain is on fire i think ^^
[13:06:54] agent_white: FIRE IN THE DISCO
[13:07:52] walidvb: agent_white: http://cl.ly/image/1M2l2S3w1726
[13:08:39] walidvb: fire fire FIRE!
[13:14:39] P-NuT: Fire in theeee Taco Bell!
[13:20:05] agent_white: FIRE IN THE... GATES OF HELL!
[14:05:22] newsarpk92: I am having an issue with overwriting parameters in my view
[14:06:16] doerteDev: PARAMETERS!
[14:06:20] doerteDev: oh wait ... no...
[14:06:47] newsarpk92: http://pastie.org/9719083
[14:06:51] newsarpk92: this is my view
[14:07:06] newsarpk92: if it is in "another_place"
[14:07:17] newsarpk92: all the parameters are overwritten by the bottom one
[14:07:36] newsarpk92: in which case if it is emtpy then it sends empty ones
[14:07:51] newsarpk92: how do I prevent that?
[14:07:53] jokke: i want to have polymorphic associations the other way around so that a has_many can contain references to different models
[14:07:56] jokke: is this possible?
[14:11:22] mikecmpbll: jokke: probbaly with a has_many through
[14:11:40] zly: Hi. I have a little problem with devise
[14:11:43] jokke: mikecmpbll: hm ok
[14:11:56] zly: I'm requesting a reset_password email, I'm using it
[14:12:09] zly: but when my password is too short
[14:12:19] zly: it's rendering modal, but without the basic page
[14:12:26] zly: without any stylesheets or javascripts
[14:12:44] zly: I didn't overwrite anything except create action in passwords_controller
[14:13:05] mikecmpbll: jokke: has_many :somethings; has_many :items, through: :somethings
[14:13:27] mikecmpbll: then your something model has a polymorphic belongs_to/(has_one?) to the item
[14:13:42] mikecmpbll: i'm basically thinking out loud so it might be a load of shit.
[14:15:28] workmad3: mikecmpbll: I've done that before
[14:15:36] workmad3: mikecmpbll: except the join table was a view
[14:16:08] mikecmpbll: hadn't considered that.
[14:16:37] workmad3: it could impose some nasty performance issues
[14:16:50] workmad3: but that depends on the source query for the view tbh :)
[14:17:12] workmad3: and you could probably set it up as a materialised view anyway
[14:17:29] mikecmpbll: i'm looking at views at the moment as a potential solution to amalgamating data from many of our clients
[14:17:42] mikecmpbll: (seperate databases)
[14:18:31] workmad3: jokke: the basic problem with a polymorphic has_many is that it would involve querying several tables, which would lose most of the type information without writing some pretty funky queries
[14:18:56] workmad3: jokke: and unless you were willing to list the types that could be in there from the rails side, the number of tables to query would be everything...
[14:19:15] workmad3: jokke: hopefully that starts to show the potential problems? :)
[14:21:35] newsarpk92: sorry to bump but anyone can't help me?
[14:23:24] workmad3: newsarpk92: sorry... just re-reading your original statement and I'm afraid I have no idea what you mean or what the problem is :/
[14:24:47] newsarpk92: I'll post the entire page
[14:26:04] newsarpk92: http://pastie.org/9719113
[14:26:07] newsarpk92: this is the entire page
[14:26:12] newsarpk92: as you can see it's got 3 radio buttons
[14:26:20] newsarpk92: if you click last two it triggers javascript
[14:26:30] newsarpk92: and hides the other two
[14:26:43] newsarpk92: so what happens is if I click to the second button
[14:26:54] newsarpk92: and fill up the parameters and then click next button
[14:27:03] newsarpk92: all the parameters apart from the first one is sent as empty
[14:27:44] workmad3: newsarpk92: ok... well, for starters you access the value of an input by using $(this).val(), not $(this).attr("value")
[14:28:35] newsarpk92: but that part works fine
[14:28:43] workmad3: newsarpk92: also, just hiding the input fields doesn't stop them being sent
[14:28:53] newsarpk92: yeah I noticed that
[14:28:57] newsarpk92: but it overwrites that
[14:28:59] workmad3: newsarpk92: you need to disable them
[14:29:06] newsarpk92: how do I disable it?
[14:29:13] workmad3: newsarpk92: you add the disabled property
[14:29:26] workmad3: ACTION checks
[14:29:29] workmad3: nope google is still working
[14:29:58] newsarpk92: I meant one line code example?
[14:30:06] newsarpk92: I don't know what you mean by disabled property
[14:30:09] newsarpk92: where do I add it?
[14:31:27] newsarpk92: $(".another_place").hide(); $(".another_place").disabled();
[14:31:56] workmad3: is .another_place an input?
[14:34:55] newsarpk92: it's a div thing
[14:35:25] newsarpk92: it's a css style + div class
[14:35:43] workmad3: ok... fancy guessing what my answer is, considering I said *input* elements? :P
[14:37:00] newsarpk92: I don't get it?
[14:42:25] pontiki: ah, if you have multiple fields with the same name, and you want to preserve each set, you'll need to treat them as arrays.
[14:42:48] pontiki: newsarpk92: you might instead want to make field names that are unique for each section of the form
[14:44:34] newsarpk92: isn't that against DRY idea?
[14:44:44] newsarpk92: if I change it
[14:44:52] newsarpk92: then I have to check that in my back end as well?
[14:45:28] newsarpk92: btw I changed my JS like this http://pastie.org/9719149
[14:45:36] newsarpk92: it is still doing the same thing
[14:45:54] workmad3: newsarpk92: well yeah... because that code is completely useless...
[14:46:49] workmad3: newsarpk92: for starters, disabled is for input elements (which I was trying to hint at for you to try and figure things out), second it's a function...
[14:46:55] pontiki: how is that repeating yourself?
[14:47:01] pontiki: they're two separate things
[14:47:48] newsarpk92: well for the back end
[14:47:59] newsarpk92: it's checking the same property
[14:48:01] workmad3: newsarpk92: and third, .disabled() flips the property, which you probably don't want (you want to set it to a specific value)
[14:48:05] grn_: Hi! I implemented a state machine using STI. The transitions are implemented using becomes!(AnotherState). I have a problem when referencing the state machine from another model after a transition. An instance of the old state class is returned with the type field set to the new class. Reloading the model updates the reference. However, is there a way in which this happens automatically, without an explicit reload?
[14:48:40] newsarpk92: So only workaround is to create a hash
[14:48:43] newsarpk92: and send that?
[14:48:44] workmad3: newsarpk92: which you would probably have figured out pretty quickly if you'd bothered to google for 'javascript disabled property' or 'jquery set disabled input' or something
[14:49:02] pontiki: newsarpk92: if you set the naming, you can refer to the properties on the back end as: params["#{location}_address_street"]
[14:49:43] newsarpk92: setting the naming?
[14:49:49] newsarpk92: for div class?
[14:49:54] workmad3: ACTION sighes
[14:49:55] pontiki: and location can be based on the value returned in the location radio button
[14:50:15] pontiki: you're already programmatically setting the field names
[14:50:26] pontiki: does not seem difficult
[14:50:50] pontiki: the text fields
[14:50:57] workmad3: pontiki: disabling the input fields in the un-used section also doesn't seem difficult... and yet here we are :)
[14:52:07] pontiki: do disabled fields get removed from the post?
[14:52:19] pontiki: i did not know that
[14:54:49] greengriminal: So the rails docs states that using #destroy is less efficient than using #delete... Oh and furthermore using destory allows methods and certain actions to be ran. Whats the point in me saying all of this?
[14:55:09] mekhami: good question greengriminal, what is the point
[14:55:12] ddv: no idea
[14:55:29] mwlang: where in rspec???s call chain is the database getting cleared before test suites run? I want to set up an rspec testing environment that???s not on a Rails project so I just need some details on where to look.
[14:55:29] tbuehlmann: greengriminal, if you want to delete associated records or run code on destroying a record, you use #destroy
[14:55:36] tbuehlmann: #delete will just delete the record in the database
[14:55:44] greengriminal: Its because i have the following gist and was going to ask if which is better: https://gist.github.com/anonymous/80fe0c6dda560b0002c8#file-example-rb-L13-L15
[14:56:32] greengriminal: tbuehlmann: so i should really be using #destroy_all in which case
[14:56:38] tbuehlmann: greengriminal, if you simply want to delete the email_logs, use #delete. it will query the db just once and delete the records
[14:56:40] mwlang: greengriminal: destroy triggers any callbacks you might have defined.
[14:56:47] mwlang: delete does not.
[14:56:54] tbuehlmann: #destroy_all will get the records from the db, fire callbacks and then delete
[14:57:19] greengriminal: mwlang: That's what i initially said. Using destroy will give you the ability to make call any callbacks
[14:57:39] mekhami: my application spends a lot of time in DOM processing, anyone know of some low-hanging fruit type methods to reducing that time?
[14:57:55] greengriminal: Thanks. Just wanted a little clarity.
[14:58:26] tbuehlmann: greengriminal, DOM building or parsing css/js and stuff?
[14:58:42] workmad3: tbuehlmann: you mean mekhami right? :)
[14:58:50] tbuehlmann: I do, thanks
[14:58:55] mekhami: tbuehlmann, i am not entirely sure, i'm basing this off of newrelic reporting, but it's likely the css/js stuff
[14:59:08] tbuehlmann: are you using turbolinks?
[15:00:26] workmad3: mekhami: do you know if it's an actual issue that impacts UI performance noticably yet, or is it a case of you're spending a 'lot of time there' because the page stays open and refreshes frequently, remaining usable throughout?
[15:01:16] mekhami: workmad3, that's also a good question. we do have some pretty slow page load times and the session traces themselves are long, but we do a lot of page stays open/ajax request updates graphs type stuff as well... it's hard to just eyeball i guess
[15:01:24] mekhami: tbuehlmann, the fact that i don't know means probably not? =P
[15:02:30] tbuehlmann: well, that'd save you parsing time at least
[15:02:40] tbuehlmann: might have a read: https://github.com/rails/turbolinks
[15:03:27] workmad3: mekhami: yeah... would need to spend some time looking at the information newrelic is providing and figure out what it's really saying
[15:03:55] mekhami: workmad3, i'm pretty much jsut getting started but i've found myself on wild goose chases running after things that weren't actually problems hah
[15:04:10] tbuehlmann: also, is this development?
[15:04:39] mekhami: here's the kicker
[15:04:48] mekhami: our web server is configured to run in 'staging' environment or something
[15:04:56] mekhami: because the dev team and sysadmin here are ...
[15:05:06] mekhami: i don't really have the right words. but, i don't know how to correctly configure it.
[15:05:33] tbuehlmann: staging will be like production
[15:06:02] mekhami: my point is i think the entire system is configured incorrectly and i'm almost positive our assets aren't running correctly which would contribute to this problem
[15:06:14] mekhami: do you actually know of 'how to configure your app for production' resources?
[15:06:48] tbuehlmann: I'm pretty happy with the default production.rb so far
[15:07:14] tbuehlmann: "assets aren't running correctly" means what exactly?
[15:07:30] workmad3: tbuehlmann: I tend to tweak it a little... but only to insert deployment config :)
[15:07:31] pontiki: there's a book "deploying rails apps"
[15:07:37] pontiki: can't say if it's any good
[15:07:42] greengriminal: Given the following:https://gist.github.com/anonymous/bdcb9ce87c993d98bba3 which gives back: 12737 records. If i call #destroy_all on this it will run 12737 times.
[15:08:01] greengriminal: To make this more efficient could I not make use of #find_in_batches?
[15:08:02] tbuehlmann: workmad3, my deployment stuff is at another place, but yeah
[15:08:26] workmad3: pontiki: the ancient out-of-print one from pragprog?
[15:08:42] pontiki: maybe? i don't know, i've only seen the title
[15:08:44] workmad3: pontiki: or the slightly less ancient out-of-print 'Deploying Rails' book from pragprog? :)
[15:11:27] pontiki: same answer applies
[15:11:39] workmad3: pontiki: if you even have to figure out an ancient, rails2 mongrel cluster you should try to find a copy of Deploying Rails Applications (even more so if it's also using Apache :) )
[15:11:51] pontiki: why are you saying this to me?
[15:11:52] mekhami: i mean what should the production.rb even look like
[15:12:06] workmad3: pontiki: dunno... because it's friday?
[15:12:14] tbuehlmann: rails 2? phew, I'm out
[15:12:28] workmad3: mekhami: like ruby code :P
[15:13:20] pontiki: tired of this place
[15:13:42] mekhami: workmad3, can i query you my production.rb file and see if there's some glaring errors
[15:15:02] workmad3: tbuehlmann: and yeah... I encountered some things that really disliked being configured outside of production.rb, so I switched our deployments from dropping a config file in config/initializers to providing a production.rb that pulls in the original one and pushes in production config (mail servers, memcached servers, syslog logging, etc.)
[15:15:16] workmad3: pontiki: I know what you mean :(
[15:16:26] workmad3: mekhami: tbh, if the app is running then chances are your production.rb is fine
[15:17:04] mekhami: right, but we can't switch it to a production environment (it slows down by a large magnitude)
[15:17:15] workmad3: mekhami: a lot of the config issues are more to do with making sure the webserver is configured properly, app server is configured properly, that you're compiling assets, etc.
[15:17:32] workmad3: mekhami: then compare it to your staging.rb and flag up any differences
[15:17:56] workmad3: mekhami: once you have a list of differences, google what each one does to see if it's likely to be a culprit ;)
[15:18:29] mekhami: well the problem is i 'm sure there are options in BOTH files that are likely wrong =P
[15:19:03] workmad3: mekhami: what a fantastic learning opportunity for you then? ;)
[15:19:12] workmad3: ACTION needs coffee and brownie
[15:19:38] workmad3: although my scales disagree on the second requirement...
[15:20:26] mwlang: workmad3: coffee + brownie + tennis :-)
[15:20:39] doerteDev: what do you guys do to work around capybara's inability to test redirects?
[15:20:56] mwlang: doerteDev: not use capybara. :-)
[15:21:00] mekhami: workmad3, fortunately i found a new job. unfortunately, it won't be in rails! so i won't be bothering you guys as often ;)
[15:21:09] mekhami: wat? why can't capybara test redirects?!
[15:21:20] fwaokda: my simple_form gem is at version 3.0.2, but i want to get support for bootstrap 3 and so im reading i need 3.1.0.rc1 -- how can i update to the latest? I've tried bundle update
[15:21:39] workmad3: mekhami: because it follows them
[15:21:56] doerteDev: mekhami: how would you do it?
[15:21:59] kevinem: does anybody have any idea about this?
[15:22:04] mwlang: doerteDev: I basically don???t test like that. If I need to test a redirect action, I use rspec and controller spec.
[15:22:11] workmad3: mekhami: seeing as it's intended to test what you see in the browser rather than test HTTP responses :)
[15:22:26] kevinem: i have a page that renders with /user/change_password
[15:22:34] pontiki: this is problematic because it's always changing
[15:22:57] doerteDev: fwaokda: you can update the gemfile
[15:23:05] kevinem: and it renders...but when redirect :back is called
[15:23:07] doerteDev: and write the specific version you need behind the gemname
[15:23:11] workmad3: doerteDev: I'm with mwlang... if a redirect is actually important (as opposed to just ending up with the right stuff in the browser) then test with a controller spec rather than through capybara...
[15:23:17] kevinem: engine says no such route
[15:23:32] mwlang: wowee???.Perl takes about 20 seconds to parse an XML file with ~1million elements???.Nokogiri is still going on the same file 5+ minutes.
[15:23:41] doerteDev: kevinem: does your gemfile start with source 'https://rubygems.org' ?
[15:23:53] mekhami: workmad3, i guess i expect it to be able to tests response code 301 and new URI?
[15:23:56] workmad3: kevinem: redirect :back is very problematic
[15:24:05] doerteDev: mwlang: only perl can parse perl :D
[15:24:10] fwaokda: doerteDev, is there a way to have it to update to most recent? or do i need to specify a version number?
[15:24:10] apeiros: mwlang: using a sax parser in perl and a dom parser in ruby?
[15:24:18] workmad3: mekhami: you don't get access to response codes through capybara (which is a good thing, IMO) :)
[15:24:30] doerteDev: fwaokda: sure, you can specify the github repo and say "get HEAD"
[15:24:52] doerteDev: mekhami: WAT?
[15:25:03] doerteDev: workmad3: WAT?
[15:25:20] fwaokda: doerteDev, thanks!
[15:25:20] doerteDev: expect(status_code).to << yes you can
[15:25:24] doerteDev: but that's about it :P
[15:25:31] mwlang: apeiros: using XML::Twig in Perl. I just wanted to see how Ruby did with one of these huge files.
[15:25:33] doerteDev: okay testing this in a controller spec makes sense
[15:25:35] mekhami: doerteDev, that's probably RSpec not capybara?
[15:25:35] workmad3: doerteDev: depends on the driver ;)
[15:25:50] workmad3: doerteDev: most of the headless browser drivers don't actually expose the status code
[15:25:54] doerteDev: I am using capybara and I have such tests
[15:25:56] kevinem: workmad3: but what can i do?
[15:26:23] doerteDev: kevinem: does your gemfile start with source 'https://rubygems.org' ?
[15:26:33] kevinem: the action may get called under different scenario
[15:26:45] apeiros: mwlang: seems like twig was indeed a streaming parser. so not a very meaningful comparison.
[15:26:52] kevinem: doerteDev: yup...what has it to do with this? O.o
[15:27:05] doerteDev: might explain routing problems when updating a gemfile
[15:27:05] mwlang: apeiros: ah. Good point. I did not think about that.
[15:27:06] workmad3: kevinem: personally, I tend to fix the redirect after such an action
[15:27:32] doerteDev: workmad3: thanks. I guess I'll write controller tests then.
[15:27:36] apeiros: mwlang: but yeah, ruby (pretty much no matter which lib) is rather useless for DOM parsers with large documents
[15:27:41] apeiros: objects expensive :(
[15:27:59] doerteDev: have no controller tests yet, didn't yet read into them
[15:28:20] kevinem: doerteDev, workmad3: it was working just fine...and then i removed the action which was rendering the page which is called by redirect :back and this started happening
[15:28:30] kevinem: but i tried bringing the action back
[15:28:33] workmad3: kevinem: most likely, your previous action was a POST, PUT or DELETE, and the URL for it doesn't have a GET route... a redirect has no provision for specifying the HTTP verb
[15:28:36] kevinem: same thing keeos happening
[15:28:37] apeiros: thinking about that - it'd be nice if ruby exhibited COW mechanics
[15:28:53] apeiros: whatever. week-end! cya :D
[15:29:15] mwlang: apeiros: ok. I wanted to count how many <product> tags there are. I figured I???d just fire up Nokogiri and count ???em the way I knew how, but I think I need another approach???perhaps just a simple grep and line count.
[15:29:22] workmad3: kevinem: :back works on http referer... so that's gonna be incorrect for your requests right now
[15:29:24] kevinem: workmad3: nope...it's trying get onlyi think as i see from the console logs
[15:29:27] doerteDev: thanks anyways guys
[15:29:35] workmad3: kevinem: the redirect will always be a GET, yes
[15:29:54] workmad3: kevinem: my point is that it's probably trying to redirect you back to a route that doesn't have a GET
[15:29:54] kevinem: and the previous page was also get
[15:30:11] ajenkins: Hey guys/girls. I need some help with averaging time. I have a PG table with two columns, started_at and ended_at. I need to query the average of the difference between those two columns. Any help or direction is appreciated.
[15:30:28] kevinem: workmad3: no the route is get only
[15:30:31] workmad3: kevinem: really? the 'previous page' isn't the submission URL for the form now? :P
[15:30:57] workmad3: kevinem: as I'm assuming you're trying to reload ;)
[15:31:13] tvon: Does anyone know, if I have simplecov setup for rspec and cucumber, will the report generated by cucumber overwrite the output from rspec?
[15:31:24] kevinem: it's a form...but it submits to the action which is calling the redirect
[15:31:34] apeiros: mwlang: nokogiri provides a sax parser too
[15:31:40] apeiros: probably sufficient for simple counting
[15:31:45] workmad3: kevinem: right... and that action failed because the redirect errored... correct?
[15:31:46] apeiros: should be quite a lot faster
[15:31:49] kevinem: when i press an enter again on the browser...the page does render
[15:31:55] apeiros: anyway, afk :)
[15:31:58] mwlang: yeah, its churning
[15:32:21] kevinem: workmad3: nooo...the action doesn't fail
[15:32:49] kevinem: it works perfectly and redirects back
[15:33:06] kevinem: because the password entered for change was proper
[15:33:12] workmad3: kevinem: if it works perferctly then what's the probelm?
[15:33:21] kevinem: wait a sec
[15:33:27] kevinem: can i show you pictures?
[15:33:32] workmad3: kevinem: sure
[15:33:48] kevinem: okay :) i thought u guys don't like pictures ;)
[15:33:56] workmad3: kevinem: but I'm gonna guess you have an issue when the form update isn't successful, from your extra statements? :P
[15:34:07] workmad3: kevinem: as long as it's not pictures of code
[15:34:34] kevinem: not code (y)
[15:35:24] kevinem: workmad3: :-/
[15:35:28] kevinem: u were right
[15:35:44] kevinem: i noticed it while taking screenshots only
[15:35:55] workmad3: kevinem: it tries to redirect you back to the form submission url that doesn't respond to GET, yeah? ;)
[15:35:56] kevinem: No route matches [POST] "/user/change_password"
[15:36:32] workmad3: kevinem: welcome to why people don't actually use redirect_to :back
[15:36:54] olistik: hello everybody
[15:37:07] tbuehlmann: hello olistik, how are you doing?
[15:37:13] kevinem: workmad3: yeah! i've learned that :)
[15:37:18] workmad3: kevinem: instead, what people tend to do is track which actions they want to redirect back to in the session
[15:37:24] kevinem: but what will i do? :-/
[15:37:28] olistik: tbuehlmann: I'm cool, thx :-)
[15:37:35] kevinem: ohhh...kkk...
[15:37:46] workmad3: kevinem: and instead do 'redirect_to session[:stored_location] || root_path' (or some other suitable default)'
[15:38:17] workmad3: right... coffee
[15:38:37] kevinem: workmad3: rails is coming up to be cool :)
[15:38:53] kevinem: i've been on this rails for months
[15:39:11] kevinem: not being able to find out what to do...
[15:39:32] kevinem: searching in the dark :D with a rails 2 app in hand and nobody to support :)
[15:40:04] kevinem: but it's beginning to get interesting ;)
[15:40:24] olistik: @kevinem "rails 2 app" feels scary nowadays ;-)
[15:41:10] kevinem: olistik: you don't know how scary it looks man! i used to wake up seeing bad dreams about rails 2 :P
[15:41:47] kevinem: and this particular app i'm working on was not written properly
[15:42:07] olistik: I've been there, back in the days on ree based app on a Mongrel cluster without the support of Bundler
[15:42:29] olistik: that's something I don't really miss ^_^'
[15:42:38] kevinem: but you should've known rails :)
[15:42:50] kevinem: i don't know rails properly even now :D
[15:44:08] kevinem: and the problem was that when i'm into a problem and come here for soln...people say, rails 2? that's gotta be something else...go away ;)
[15:44:30] kevinem: not rude though...just saying :)
[15:44:38] kevinem: anyways thnx guys
[15:45:57] mekhami: tbuehlmann, as i expected, turbolinks breaks all my javascript/ajax stuff =P
[15:56:36] newsarpk92: I have an end point
[15:56:41] newsarpk92: and at the end it finishes like:
[15:56:43] newsarpk92: index and render :index and return
[15:56:49] newsarpk92: but I am getting this error
[15:57:42] newsarpk92: Missing template end_point/accept_req, application/accept_req with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in: * "dir/app/views" * "anotherdir/.rvm/gems/ruby-2.1.2/gems/devise-3.3.0/app/views"
[16:01:19] newsarpk92: it's quite weird
[16:01:26] newsarpk92: if I don't use index and render
[16:01:29] newsarpk92: but use index render
[16:01:31] newsarpk92: then it works
[16:01:44] newsarpk92: in a separate line
[16:02:22] pontiki: this is why it's better to gist your code instead of retyping it into the chat
[16:16:06] EminenceHC: .NET is open source now.. goodbye rails.
[16:21:21] dyu: updating a field in my model won't work. i instantiate it using .new(). and updating a field then calling .save() anywhere doesn't seem to work.
[16:22:49] tbuehlmann: dyu, if you want to update, why do you use .new?
[16:22:49] vimer: dyu: did you check with console?
[16:22:49] vimer: if that is creating the object in model?
[16:24:22] dyu: tbuehlmann: it's a new variable at that point. but i have to call an external api so i change a blank field to something right after
[16:24:37] dyu: vimer: yes. it looks like it's only showing the sql for .new
[16:25:29] dyu: interesting thing though is that i have logging and the INSERT sql shows up after me calling save
[16:27:04] pipework: EminenceHC: lololol
[16:32:10] Steventen: hi, guys. I'm having a hard time trying to figure this out. I don't know why, the assets on my website look like this: <script src="/assets/["jquery-1.8.3-ui-1.9.2-ujs-2.0.3", "application"].js" type="text/javascript"></script>
[16:32:38] workmad3: steventen: what's in your layout
[16:32:39] Steventen: looks like the array is not parsed or something..
[16:33:40] Steventen: workmad3: <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
[16:36:02] workmad3: steventen: you may need to separate them out then :)
[16:36:47] hoffmanc: hello: has anyone run into an issue with preload, where a select n+1 results, where swapping it out with eager_load does not?
[16:37:03] newsarpk92: I want to add a message board to my app
[16:37:22] newsarpk92: I have different pages and this message board should be specific to those pages
[16:37:29] newsarpk92: what should I use
[16:37:43] hoffmanc: the preload queries execute, but then additional queries fire, referencing the same IDs in the preload queries
[16:39:05] newsarpk92: what I mean is not like forum tho
[16:39:14] newsarpk92: it's like a forum page for each existing page
[16:39:19] newsarpk92: kind of chat room
[16:39:40] newsarpk92: but without fancy ajax stuff
[16:47:22] newsarpk92: anybody awake?
[16:47:44] centrx: leave me alone
[16:47:45] centrx: I'm tired
[16:47:51] centrx: stop shining that flashlight in my face
[16:47:54] centrx: you smell bad
[16:47:58] centrx: I like trains
[16:47:59] newsarpk92: do you know a gem?
[16:48:07] newsarpk92: that does what I am looking for?
[16:48:10] Senjai: centrx: I love you
[16:48:26] centrx: right back at you toots
[16:48:43] Senjai: newsarpk92: http://www.catb.org/esr/faqs/smart-questions.html
[16:49:16] newsarpk92: my question is not applicable to stackoverflow
[16:49:27] Senjai: newsarpk92: Your question is obviously not applicable here.
[16:49:31] Senjai: So ask it properly
[16:49:47] Senjai: and if people know the answer, they will respond
[16:50:00] pwk: smart-questions must have changed a lot since i last read it if all that it says in there is things about stackoverflow =)
[16:50:00] helpa: 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.
[16:50:17] Senjai: pwk: It undergoes minor revisions
[16:50:19] newsarpk92: it's not a code issue
[16:50:21] workmad3: unless they've /ignored you to prevent brain aneurisms...
[16:50:23] newsarpk92: it's an advise issue
[16:50:28] newsarpk92: therefore stackoverflow is not applicable
[16:50:39] pwk: newsarpk92: read through the link
[16:50:45] Senjai: newsarpk92: ^
[16:51:42] newsarpk92: it doesn't mention any advice issues
[16:51:57] pwk: you are some kind of miracle reader
[16:52:05] pwk: that's a lot of text, nobody can read it all that fast =)
[16:52:29] newsarpk92: plus I skimmed through
[16:52:48] newsarpk92: and read the irc part
[16:53:03] Senjai: newsarpk92: What's your question?
[16:53:13] workmad3: newsarpk92: out of curiosity... do you think that we're obliged to design your code-base for you? :/
[16:54:04] workmad3: Senjai: he wants to know a gem for a fairly specific, almost-forum-type thing he wants in his app
[16:54:33] Senjai: newsarpk92: https://www.ruby-toolbox.com/categories/forum_systems
[16:54:39] Senjai: Ask google and ye shall receive
[16:54:51] workmad3: Senjai: !gg ftw ;)
[16:54:53] newsarpk92: My question is, I am looking for a gem, that can be used in pages among users to chat each other but kind of simple one
[16:55:09] newsarpk92: It's like a new google group page for a given page
[16:55:17] mekhami: newsarpk92, what if the answer was just no
[16:55:18] Senjai: newsarpk92: Probably doesnt exist. You might have to write code.
[16:55:31] workmad3: Senjai: uh oh, you just doomed his vision :P
[16:55:32] newsarpk92: forum systems are too complex for this
[16:55:52] Senjai: newsarpk92: Right, but if you cant find it, then you're going to have to make it
[16:55:54] newsarpk92: @mekhami then I would write it :(
[16:55:55] Senjai: workmad3: :P
[16:56:03] mekhami: newsarpk92, then get to work
[16:56:10] newsarpk92: but I thought there are loads of gems
[16:56:16] newsarpk92: surely someone done it
[16:56:31] pwk: newsarpk92: what's wrong with research on what exists, finding about how well the existing things fit your expectation, and then deciding for yourself if you use existing things, or write your own, or some hybrid?
[16:56:50] newsarpk92: wait what I am looking for
[16:56:52] workmad3: newsarpk92: yes there are loads of gems, no that does not mean that 'someone surely must have done it' is valid logic for saying that a gem must exist for every single idea someone on the internet dreams up
[16:56:54] pwk: newsarpk92: that by the way is explained *in detail* in the "Before You Ask" section of the smart-questions link
[16:56:55] dyu: is it possible to create and then update a model object in the same controller method?
[16:57:00] newsarpk92: can be described exactly like facebook wall in group pages
[16:57:16] Senjai: newsarpk92: We write code here. Gems are not drop in replacements for prorgammers
[16:57:30] Senjai: newsarpk92: We would use google to answer your question, so I would suggest you do the same
[16:57:44] Senjai: programmers*
[16:58:10] workmad3: newsarpk92: and when it comes to that sort of thing, you need to do your own research first, then come on here and say something like "Hi guys, I'm trying to find out if something exists that does <brief description>. I've already searched for <searches you've done> but not found anything. Have I missed something or does this simply not exist?"
[16:59:03] newsarpk92: but I already googled
[16:59:08] pwk: workmad3: no no no, it's an "advice question", you don't research those, you do not do any work yourself, you just go to a possibly fitting irc channel and start dumping your thoughts! I'm sure that's how it is done :)
[16:59:18] workmad3: newsarpk92: rather than what you did, which was "I need to do <garbled sentence that sounds like a forum>. What should I use?" and then spend 10 minutes arguing about how it's not a question for SO :P
[16:59:30] mekhami: Hi guys, I'm trying to find out if something exist that <makes me breakfast in the morning when I visit the index.> I've already searched for <breakfast maker index and pancakes on redirect> but not found anything. Have I missed something or does this simply not exist?"
[16:59:39] hoffmanc: MINASWAN (Matz is nice and so we are nice)
[16:59:49] helpa: hoffmanc: Matz is nice and so we are nice
[16:59:49] workmad3: hoffmanc: !minaswan ;)
[17:00:28] workmad3: hoffmanc: also, I think it needs extending to MINASWANEAFOAF
[17:00:42] workmad3: MINASWAN Except After Four on a Friday...
[17:02:38] workmad3: newsarpk92: and we had no idea you'd googled... or what you'd googled... so we would have no idea if we were simply wasting our time repeating stuff that you'd already searched for
[17:02:57] workmad3: newsarpk92: whereas if you actually stated what you'd searched for, we could offer suggestions on other terms you may not have considered
[17:03:32] workmad3: newsarpk92: and, in case you hadn't realised, many of us here get rather annoyed when we think that we're basically being used as personal google slaves for free:P
[17:03:48] newsarpk92: I searched for "facebook wall kind of gem", "simple chatroom without ajax gem", "forum page gem"
[17:04:10] newsarpk92: "rails message board gem"
[17:04:33] newsarpk92: I found faye and pusherchat
[17:04:40] newsarpk92: but they are more kind of one chatroom stuff
[17:05:12] newsarpk92: I also checked ruby-toolbox but there is nothing under communication section that would be useful for me
[17:05:15] workmad3: newsarpk92: great... now someone who hasn't decided to completely give up on your query could potentially help you
[17:05:22] greengriminal: Does anyone have any suggestions that may help this be much quicker? https://gist.github.com/anonymous/f972b08b94a1c2171d0a
[17:06:11] centrx: greengriminal, database indexes
[17:06:57] savish: Hey guys I am having an issue following the rails guide and creating join tables, I am creating an engine and I am getting the error NameError: uninitialized constant Xaaron::Group::GroupsRole, I have posted a question at http://stackoverflow.com/questions/26935018/unitialized-constant-xaarongroupgroupsrole if some one could help me out that would be great.
[17:07:02] workmad3: greengriminal: also, realtime returns seconds, not milliseconds
[17:07:06] greengriminal: centrx: "For every index on a table, there is a penalty both when inserting and updating rows" from a blog i just read
[17:07:14] workmad3: greengriminal: milliseconds are fractional seconds
[17:07:29] workmad3: greengriminal: ah, way... misread your log statement, sorry :)
[17:07:50] centrx: greengriminal, Yes that is the trade off with indexes, but they are essential for good read performance
[17:08:20] greengriminal: workmad3: It's okay
[17:08:31] greengriminal: centrx: having too many indexes can slow down the performance of the db
[17:08:43] workmad3: greengriminal: right... but do you know what 'too many' actually is? :P
[17:09:14] greengriminal: lol no but what would you call too many
[17:09:26] centrx: greengriminal, The index cost of an insert or an update is very low compared to the cost of reading an entire table just to get one row
[17:10:01] greengriminal: centrx: That i will keep in minde
[17:10:30] workmad3: greengriminal: I'd call 'too many' as 'adding indexes after I've performance tested my database and gotten to the point of diminishing returns'
[17:10:50] workmad3: greengriminal: and I'd start by adding indexes to fields I'm searching & joining on as a minimum ;)
[17:11:04] dyu: asking again....is it possible to create and then update a model object in the same controller method?
[17:11:06] workmad3: greengriminal: that blog post was basically saying "Don't index everything, that would be crazy! Just index the bits you need"
[17:11:23] dyu: updating a field in my model won't work. i instantiate it using .new(). and updating a field then calling .save() anywhere doesn't seem to work.
[17:11:23] savish: dyu, yes it is but why would you
[17:11:27] centrx: greengriminal, e.g. your gist query can go from 13 min to 5 seconds, while the cost of the index is just an extra 1 millisecond on top of a 5 ms INSERT
[17:12:28] dyu: Savish: i make an api call right after creating the object. the return value is saved in the object
[17:12:57] smoitra: I am looking for an interesting web project to implement with rails can anyone help me ?
[17:13:11] greengriminal: centrx: guess using a index is the way forward
[17:13:18] savish: dyu, i know in backbone you can do something where you are like: create, wait and return said object assuming in your api you are saying and return this object after creation
[17:14:06] savish: who ever posted on stack for me, thank you - i fail at naming apparently
[17:16:11] soahccc: ow my god, circleception http://files.sven.bmonkeys.net/images/glTail_2014-11-14_18-12-04.png
[17:16:25] centrx: soahccc, You're infected
[17:18:04] soahccc: centrx: what do you mean?
[17:18:25] centrx: soahccc, That image clearly shows plaque is building up on your neurons
[17:22:30] smoitra: I am looking for an interesting web project to implement with rails can anyone help me ?\
[17:23:10] mekhami: must be a friday thing
[17:24:39] savish: can you define interesting? smoitra
[17:25:21] mekhami: or web project? or help me? lol
[17:25:31] savish: or anything
[17:26:09] smoitra: something new , never implemented before ??
[17:26:26] savish: realizing that its probably not for you?
[17:26:30] mekhami: you're literally not saying anything anyone can respond to smoitra
[17:26:46] savish: maybe he is a troll?
[17:27:35] savish: any one else just wanna sleep?
[17:28:31] workmad3: Savish: getting that way, yes
[17:28:52] savish: pillows and blankets for every one
[17:28:53] centrx: You are tiring me out with your rails magic
[17:30:40] masscrx: I have customers with invoices, where to store for example figures with entire tax for all invoices or entire sum of all invoices ? Make it on the fly or store in table customers with some logic for calculate ?
[17:31:13] savish: i would create a new table that links to the invoice and store it there?
[17:31:24] savish: if its the tax for an invoice
[17:31:32] savish: or create a new column in the invoice table
[17:31:43] masscrx: hmm good point, another table only for these information
[17:31:54] savish: depends on the info
[17:32:05] savish: if its just a number repersenting the tax, then create a column
[17:32:13] savish: if its more and its related to the invoice create a new table
[17:32:26] masscrx: Savish: I have to store customer's info such : total sum of invoices in current year, total tax of all invoices
[17:32:46] pontiki: Savish: i would dearly love to sleep
[17:32:50] pontiki: but i must work
[17:32:57] masscrx: so if customer would has 100 invoices, RoR must make some operation for this to calculate sum
[17:33:26] savish: they seem like a join table for the total and a new table for all the invoices total (i think .. )
[17:33:29] pontiki: you'd think
[17:33:53] masscrx: one table will be enough, with customer_id and all info
[17:34:09] pontiki: and if you looked, you'd probably find one: http://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-sum
[17:34:32] masscrx: pontiki: I know how to calculate, Im thinking now about performance
[17:34:53] pontiki: it's done in the database, the fastest way possible
[17:35:08] masscrx: good point as well
[17:35:26] masscrx: ok so problem resolved
[17:40:51] pontiki: ??? no one sings me lullibies / and no one makes me close my eyes ???
[17:42:15] rhizome: silenced all my life
[17:44:39] rhizome: masscrx: aggregations like that should probably be calculated in your case via instance methods on user, but can also be in a different table in larger situations
[17:49:42] Senjai: pontiki: o/
[17:51:17] pontiki: hola, Senjai
[17:53:03] Senjai: Happy friday all! #fridayhug
[17:54:51] EminenceHC: someone please make my day and do !friday
[17:55:33] helpa: EminenceHC: Why not try Chinese Food? http://www.youtube.com/watch?v=wWLhrHVySgA
[17:55:33] workmad3: EminenceHC: !hungry
[17:55:53] workmad3: EminenceHC: !ponon
[17:55:56] helpa: EminenceHC: http://www.youtube.com/watch?v=yzC4hFK5P3g
[17:55:56] workmad3: EminenceHC: !ponpon
[17:56:25] EminenceHC: OMG I am going to explode.
[17:57:01] helpa: http://youtu.be/kfVsfOSbJY0
[17:57:05] bricker: EminenceHC: that's for you, buddy.
[17:57:10] EminenceHC: YAAAAAYYYYYYYYYYYYYYY!!!!!!
[17:58:18] EminenceHC: You guys are life savers.
[18:00:29] tfitts: is there a way to get the remote_ip in application_controller? I want to enable before_filter :authenticate_user! for all remote IPs but not for local IPs
[18:04:27] smathy: tfitts, the `request` method in a controller returns this object: http://api.rubyonrails.org/classes/ActionDispatch/Request.html
[18:07:23] soahccc: Can it be that "Unused Eager Loading" detection of the bullet gem is not "bullet proof"? I have the same thing just with different where conditions but only one should include it's association :/
[18:08:32] savish: So I have this design problem I cannot get around, A user can have many group and there for many roles, as each group has a sub set of roles. so how do I do this on the front end. Where admins can change their role and their associated permissions - all in rails with no (i prefer it this way) javascript?
[18:09:04] savish: they should be able to add new groups and then based on the groups added selected a new role fro each group
[18:09:11] savish: I am very confused on how to do this
[18:09:45] tfitts: smathy: it returns that object in a controller for any of my models, but in application_controller I get NameError: undefined local variable or method `request' for ApplicationController:Class in my application_controller
[18:09:54] soahccc: code for my bullet question: https://gist.github.com/2called-chaos/82e68055a8ea9842392a
[18:10:46] pontiki: Savish: doing that without any javascript means you have to return to the server to build the new form elements
[18:11:12] savish: so it would be a mess
[18:11:35] savish: is what you are saying
[18:11:45] pontiki: no, i'm not saying it would be a mess
[18:12:14] pontiki: i'm saying that's how you'd implement such a thing
[18:12:39] savish: does this type of thing exist? is there any examples?
[18:13:39] pontiki: yes. multitudes. it's a very common thing to do. have an object, associate it with another, then add things to it
[18:14:18] savish: I have the whole relationship set up I just need to find either a rails engine or a gem or a open source project to see how they are doing it so I have some direction to go in
[18:14:22] savish: do you know of any?
[18:14:53] pontiki: do you want to see an example of nested models/forms?
[18:15:31] SteenJobs: when i try and install lunchy for postgres, i receive the error ???No such file or directory - getcwd???, any ideas?
[18:15:37] pontiki: nearly ever rails tutorial / example makes use of this concept.
[18:15:48] pontiki: even if it uses javascript, Savish ?
[18:16:03] SteenJobs: pontiki: which concept? i missed the beginning of what seems like an interesting convo.
[18:16:05] savish: really? I didn't see any on the rails guide thing unless I am dumb. I prefer to not use javascript right now because I want this to be a dead simple project
[18:16:07] pontiki: SteenJobs: what is luncy?
[18:16:15] pontiki: argh. lunchy
[18:16:33] pontiki: savish, adding a comment to a post is pretty much the same idea
[18:16:52] savish: I've done that
[18:16:59] centrx: rails-admin ?
[18:17:11] SteenJobs: pontiki: it???s a wrapper for launchctl, so you can start the db server by just using lunchy start postgres
[18:17:12] savish: would that have something similar to what I'm trying to do?
[18:17:36] SteenJobs: Savish: what are you trying to do? i missed the beginning...
[18:17:39] Dbugger: Guys. For some reason Guard does not detect changes on files it is supposed to be watching. Is there an issue with Ubuntu 14.04 and watching file changes?
[18:18:46] pontiki: Dbugger: i've noticed sometimes guard would not see a file change if it was in a new directory. also, if the change is on a remote file system (or was made on a remote system that has the local file system attached)
[18:19:02] pontiki: but i'm not expert
[18:19:10] savish: SteenJobs, So I have a user who can have many groups and groups can have many users, groups have many roles and roles have many groups, I have a triple join table where you have user_id group_id and role_id, as an admin I am trying to say you can edit there groups and roles a user belongs to and do it with out javascript (if possible)
[18:19:19] rhizome: Dbugger: have you changed your guardfile from the default? i.e. edited it?
[18:20:04] savish: SteenJobs, thus if you have 5 groups and 5 different roles you should be able to change one role/group for a user and have it properly update. the other rule is you cannot assign a role to a user when that user does not belong to the group the role does.
[18:20:34] SteenJobs: Savish: would a polymorphic association help?
[18:20:49] Dbugger: pontiki, it is all inside a VM
[18:21:05] Dbugger: rhizome, I tried with the default as well as with a modification. Nothing works
[18:21:08] pontiki: are you doing the editing on the host machine, Dbugger ?
[18:21:19] rhizome: did you restart guard? what file?
[18:21:26] Dbugger: pontiki, yes
[18:21:30] rhizome: ...is not being seen
[18:21:43] Senjai: bricker`work: Did you have to change names to get helpa to recognize you? :P
[18:21:52] savish: SteenJobs, I can't see how, they are just many to many relationships
[18:21:52] Dbugger: If I edit the file from the host, it does not see the changes??
[18:22:07] savish: I think I figured a way to do this
[18:22:18] pontiki: Dbugger: that's where the listen library tends to fail, because the VM is attaching the local file system
[18:22:23] savish: in fact I see it in my head
[18:22:43] pontiki: i mean host file system
[18:22:44] SteenJobs: Savish: right, but in terms of the way you???re assigning roles, there might be a more efficient way, no?
[18:22:49] Dbugger: pontiki, let me test that
[18:23:03] savish: SteenJobs, I figured a way to do it :D and rails-admin gave me that idea
[18:23:15] SteenJobs: Savish: let???s hear it!
[18:23:41] Dbugger: pontiki, well editing from the guest didnt work neither....
[18:23:56] savish: Edit each group -> role association one at a time just like http://rails-admin-tb.herokuapp.com/admin/draft/new instead of doing it all at once.
[18:24:03] savish: saves me the head ache
[18:24:20] pontiki: Dbugger: are you still running guard on the directory that's attached?
[18:24:27] rhizome: Dbugger: is guard running inside or outside the VM?
[18:25:33] Dbugger: pontiki, yes
[18:25:45] Dbugger: rhizome, guard runs in the guest
[18:26:02] pontiki: there's at least a couple issues logged on that
[18:26:07] Dbugger: rhizome, pontiki, I think the problem is that I am using nfs for vagrant. maybe with rsync would work better
[18:26:23] Dbugger: let me test it
[18:27:02] rhizome: i'm wondering about mtime functionality myself
[18:27:13] TheNet: what's the best way to store a list of users in a row? I just learned mysql doesn't support arrays
[18:27:40] rhizome: why do you want to store a list of users in a row?
[18:28:18] TheNet: I want to store a list of users that played in a certain game
[18:28:51] TheNet: I have a table that stores past games
[18:29:06] rhizome: use a has_many through and use the association
[18:29:25] Dbugger: rhizome, pontiki, na, using rsync didnt work neither
[18:30:15] SteenJobs: pontiki: i???m now getting ???The program "postgres" is needed by pg_ctl but was not found in the
[18:30:16] SteenJobs: same directory as "pg_ctl". when i try running pg_ctl to start the server and write to a logfile.
[18:32:55] pontiki: SteenJobs: i'm not sure how i'm supposed to help
[18:33:02] pontiki: i didn't even know what lunchy was about
[18:33:14] SteenJobs: pontiki: haha this is separate from lunchy :)
[18:33:50] SteenJobs: pontiki: this is just trying to run pg_ctl, which is the only command i could find that writes to a logfile. ugh i need a database expert. this db stuff is wasting my time.
[18:33:51] bricker`work: mmmmm... lunchy...
[18:34:04] SteenJobs: pontiki: there are more important things to be doing???like rails stuff
[18:34:23] nobitanobi: What does make more sense to do my_results.map { |c| c.amount }.sum.to_f OR my_results.map { |c| c.amount.to_f }.sum?
[18:34:49] pontiki: this is all i ever do: sudo apt-get install postgresql
[18:35:14] centrx: nobitanobi, The first one is probably clearer to read, and negligibly faster performance
[18:35:25] nobitanobi: centrx: thanks
[18:35:38] smathy: tfitts, you must be trying to use it when there's no request in play, eg. in a class context. !gist your code.
[18:36:45] weaksauce: SteenJobs what are you trying to accomplish?
[18:36:56] SteenJobs: weaksauce: ahh he comes out of hiding haha.
[18:37:03] liquid-silence: ACTION is going to attempt a week without vim & tmux
[18:37:10] SteenJobs: weaksauce: just trying to setup postgres - i???ve been using sqlite so i haven???t had to deal with db config.
[18:37:34] pontiki: liquid-silence: going on a retreat? :)
[18:37:41] SteenJobs: weaksauce: there???s a specific command for starting postgres and having it write to a logfile but i can???t get that to work - and i wanted to install lunchy which wasn???t working - other than that, my db is up and running.
[18:37:43] weaksauce: sounds terrible liquid-silence
[18:37:47] SteenJobs: weaksauce: OS yosemite
[18:38:16] SteenJobs: liquid-silence: want to give me a crash course on the utliity of vim? i never really use vim except for doing git rebases...
[18:38:33] weaksauce: SteenJobs http://postgresapp.com/
[18:38:38] liquid-silence: SteenJobs vim is epic
[18:38:39] weaksauce: make it easy on yourself
[18:38:47] liquid-silence: weaksauce brew install postgresql
[18:39:05] SteenJobs: weaksauce: have both postgresapp AND i brew installed postgresql
[18:39:26] SteenJobs: liquid-silence: i have postgres working???it???s just getting it to write to a logfile and getting lunch to work.
[18:39:54] weaksauce: why liquid-silence
[18:40:20] weaksauce: I like brew and all that but i don't need to be a dba when all I need is a quick dev server
[18:40:32] SteenJobs: weaksauce: i???m gonna need this in prod too
[18:40:47] weaksauce: SteenJobs you aint gonna be using yosemite on prod
[18:40:54] SteenJobs: weaksauce: true.
[18:40:59] SteenJobs: weaksauce: valid point haha
[18:41:10] SteenJobs: weaksauce: but i installed it using brew anyway, the config wasn???t too bad.
[18:41:18] SteenJobs: weaksauce: i???m pretty sure i did it correctly...
[18:41:25] SteenJobs: liquid-silence: what???s epic about vim?
[18:41:48] pipework: SteenJobs: It's a fantastic editor that supports almost every feature that any other editor supports and more.
[18:41:49] weaksauce: SteenJobs if you use postgresapp it has logging built in
[18:41:52] liquid-silence: there is too much to say
[18:41:59] SteenJobs: weaksauce: ahh. gotcha.
[18:42:09] SteenJobs: liquid-silence: i???ll look into it then!
[18:42:20] weaksauce: SteenJobs vim is excellent
[18:42:21] liquid-silence: then again so does emacs :P
[18:42:25] pipework: One thing I have a hard time replicating in vim is the 'click-through' definition jumping like in redmine. I know I can use ctags, but I mean the actual 'click'
[18:46:14] weaksauce: pipework map <LeftMouse> or <C-LeftMouse> to something if you want it
[18:46:52] pipework: weaksauce: Yeah, I just don't know how to trigger the ctag jumping with any of that. I haven't gotten very advanced at scripting vim stuff.
[18:46:53] xibalba: my macvim broke in yosemite and i can get it to work. uninstalled/recompiled, removed all caches/plugins, all traces. still no dice
[18:47:02] pontiki: i thoght redmine was a wiki/pm thing
[18:47:58] pipework: pontiki: I don't know, that damn IDE.
[18:48:33] pontiki: i just upgraded
[18:48:47] pontiki: but i use it for a while, then i'm all "meh" and back to emacs
[18:48:57] Sylario: I'm trying to call ::Sass::Engine from rails console, and it says : NameError: uninitialized constant Sass
[18:49:08] Sylario: But i have sass and sass-rails in gemfile
[18:49:14] pipework: pontiki: I'd use emacs if it weren't for the keyboard combinations that hurt my weak ginger hands. :(
[18:49:21] pipework: It's so cool. :(
[18:49:24] pontiki: it's a bitch
[18:49:31] pontiki: but i'm imprinted on it
[18:49:39] pipework: I wish vim just used lua instead of vimscript
[18:50:20] weaksauce: pipework neovim will
[18:51:23] pipework: weaksauce: Yeah, but I'll have to wait for years before it's done. (
[18:51:43] weaksauce: actually they are shooting for a 1.0 release in feb or so
[18:52:16] weaksauce: the rate of development and the number of people on it is really impressive
[18:52:35] josephndenton: After being forced to use vim for a few years, nothing else seems as productive (though I assume that can be said for any editor)
[18:53:06] weaksauce: a vim plugin for visual studio is pretty good
[18:53:14] SteenJobs: liquid-silence: any idea why there???s no log file for postgres in my usr/var/log folder?
[18:53:43] pipework: weaksauce: I'll just keep reading their feature list and waiting until I see something exciting.
[18:54:45] towski_: anyone know why bundler needs to be a separate executable
[18:54:46] weaksauce: pipework true asynchronous plugins written in ruby would be awesome
[18:55:08] omosoj: hey all, do these associations looks right? https://gist.github.com/anonymous/1a21713f9e2b237c7115
[18:55:39] tallgirltaadaa: anyone have clue why my flash message only shows up.. once navigate to a new page... ive tried flash.now with no results..
[18:57:35] weaksauce: SteenJobs just type pg_config
[18:57:51] SteenJobs: weaksauce: thanks. also for some reason the server isn???t starting now. ughhh.
[19:01:42] bricker`work: omosoj: looks okay except promocode should be promo_code if you're going to leave off the class_name option
[19:02:28] bricker`work: omosoj: also, don't use has_one as a proxy method, instead just define a promo_code methd on Product that calls `self.store.promo_code`
[19:03:13] omosoj: bricker`work, like has_one :promo_code?
[19:03:49] SteenJobs: weaksauce: ok, i have a server.log file now - i just can???t start the db - could this be related to my having shut it down last night with control c?
[19:04:13] omosoj: (barring your critique of its usage, which i'm reading now)
[19:04:20] weaksauce: ps aux | grep postgres
[19:04:27] weaksauce: see if it's got some baggage there
[19:05:07] omosoj: bricker`work, i see what you are saying re the model method. cool! do i need through belongs_to, through association in that case?
[19:05:34] SteenJobs: weaksauce: https://gist.github.com/SteenJobs/a79c1f0b56bb91221b88 - not sure what i???m looking for, but super cool that the command did something ha
[19:05:36] weaksauce: in any event why do you need a log? SteenJobs
[19:06:12] weaksauce: looks like it's already running SteenJobs
[19:06:50] SteenJobs: weaksauce: i guess just so i can look if there are errors, but in terms of it running - there???s nothing running in my terminal windows???last time i ran the db the server was able to be accessed from terminal.
[19:08:18] SteenJobs: weird. i???m getting database ???jesiegel2000??? does not exist???but it does???lemme go back and check the config file
[19:09:07] SteenJobs: nvrm the database is called something else, but no idea why it???s assuming the name is jesiegel2000 (my os user
[19:10:37] SteenJobs: weaksauce: i ran psql name_of_db and i think it worked???but yesterday when i was in terminal it ran the postgres db server the same way that the rails server is run, where the window just shows the log and the running server.
[19:11:24] weaksauce: from your rails project you can run bundle exec rails db
[19:11:37] weaksauce: and it will put you in the console with the correct user
[19:12:38] weaksauce: postgres is different than sqlite because it's a server while sqlite is a file on your disk that assumes full access rights if the person is allowed to open the file
[19:12:46] SteenJobs: weaksauce: stop knowing everything???.
[19:12:57] SteenJobs: weaksauce: so in order to access the postgres server i need to do it through rails?
[19:13:23] SteenJobs: weaksauce: i tried..i???m getting No such file or directory - getcwd
[19:14:30] weaksauce: lol. no but that's the easiest way. did you run rake db:create then migrate after updating your credentials in database.yml?
[19:18:10] SteenJobs: weaksauce: yea???
[19:18:17] SteenJobs: weaksauce: i did when i created the db last night
[19:19:30] SteenJobs: weaksauce: i???m wondering if it has something to do with the fact that it???s checking through rvm paths. i???ll gist you the full error
[19:20:06] SteenJobs: weaksauce: https://gist.github.com/SteenJobs/a79c1f0b56bb91221b88
[19:22:01] weaksauce: that's bundler failing...
[19:22:16] weaksauce: try bundle install and see if that works
[19:23:02] nobitanobi: What is a good approach when I need to run a task just once? Should I include it in tasks directory and then remove it?
[19:23:27] pipework: nobitanobi: Depends.
[19:23:39] pipework: Describe the task and how you intend to run it.
[19:24:05] weaksauce: SteenJobs you are likely using mysql or the sqlite3 gem make sure those are commented out and that pg is in there
[19:24:11] nobitanobi: pipework: It's a task to populate some missing columns of a Model using another model, and I intend to populate it using rails console
[19:24:32] nobitanobi: but I think it's better to put it in the task and then run it with rake task in heroku
[19:24:34] nobitanobi: better than rails console
[19:24:43] SteenJobs: weaksauce: ok i???ll check. i???m pretty sure i didn???t overlook that though???one sec.
[19:24:58] weaksauce: SteenJobs spring might be running rails in the background which would need to be killed
[19:25:01] pipework: nobitanobi: I usually start by writing a test for a class that only does what the task needs to handle. TDD that locally. When it's done, wrap calling that task into a rake task.
[19:25:10] pipework: Then you can call that rake task, after deploy, anywhere you want.
[19:25:21] xibalba: do you guys use vim or macvim?
[19:25:23] SteenJobs: weaksauce: ok i have pg and no mysql/sqlite - how do i kill spring?
[19:25:28] nobitanobi: yah, I will do that
[19:25:37] pipework: If it's just a migration of db schema, then write migrations and then write parts that handle data migration in that class I mentioned before.
[19:25:41] xibalba: SteenJobs; ps aux | grep -i spring
[19:25:43] weaksauce: use ps aux to find it and then kill the pid
[19:25:45] xibalba: kill -9 [pid]
[19:25:49] bricker`work: SteenJobs: Remove it from your Gemfile :)
[19:26:11] pipework: pgrep bitches
[19:26:11] SteenJobs: xibalba: how does one have enough room in their brain to know bash syntax as well? haha
[19:26:16] SteenJobs: bricker`work: i don???t need spring?
[19:26:23] xibalba: SteenJobs, over a decade as a sysadmin
[19:26:24] pipework: SteenJobs: It helps if you like doing acid.
[19:26:38] bricker`work: SteenJobs: spring is one of those things that nobody needs or asked for but DHH decided he liked it so now it's in Rails by default
[19:26:40] weaksauce: long time doing things over and over again
[19:26:46] bricker`work: see also: turbolinks
[19:27:20] weaksauce: bricker`work on paper spring is cool but you will lose a day to some dumb bug here and there when all you needed to do was restart the server
[19:27:42] SteenJobs: pipework: relationship to acid???go!
[19:27:55] pipework: bricker`work: Lots of people were using preloaders though.
[19:28:13] bricker`work: pipework: yeah, doesn't mean it should added to Rails by default
[19:28:29] pipework: bricker`work: Agreed.
[19:28:30] xibalba: what bootstrap gems do you guys use?
[19:28:31] pipework: I don't use it though.
[19:28:35] pipework: xibalba: nil
[19:28:37] bricker`work: The default Gemfile should read: "gem 'rails'"
[19:28:47] SteenJobs: xibalba: i ran ps aux, which thing listed is the argument for pid?
[19:28:56] weaksauce: the first one
[19:28:57] xibalba: ps aux | grep -i spring
[19:29:07] SteenJobs: ha i wasn???t clear
[19:29:12] pipework: bricker`work: Strong parameters is good though.
[19:29:18] pipework: But rails shouldn't depend on it.
[19:29:22] SteenJobs: i have the list - but what do i put as the argument, just the number on the list?
[19:29:28] weaksauce: it's a table so it tells you if you scroll back and look at the header as long as you didn't pipe it to grep
[19:29:39] xibalba: SteenJobs, yes `kill -9 [PUT PID HERE]`
[19:29:46] xibalba: or kill -9 1
[19:29:53] weaksauce: but yeah the first number is the pid of the process
[19:29:59] pipework: weaksauce: pgrep or gtfo
[19:30:07] weaksauce: still don't like that command
[19:30:18] pipework: It's supported on the platforms that matter.
[19:30:27] xibalba: run kill -9 1
[19:30:30] xibalba: and see what happens
[19:30:45] pipework: xibalba: permissions error
[19:30:51] xibalba: sudo kill -9 1
[19:31:05] pipework: why not send a sigint?
[19:31:13] xibalba: same thing
[19:31:30] weaksauce: pipework it's supported on my computer just don't like indiscriminate killing.
[19:31:48] pipework: weaksauce: What.
[19:31:50] xibalba: http://en.wikipedia.org/wiki/Unix_signal#Miscellaneous_signals
[19:31:51] pipework: pgrep is not pkill
[19:31:53] xibalba: 9 = SIGKILL
[19:32:03] pipework: xibalba: sigint is not sigkill
[19:32:16] xibalba: kill -9 = kill SIGKILL
[19:32:29] pipework: And I asked about sigint
[19:32:37] pipework: Why you no sigint?
[19:33:09] pipework: Just trying to be as terrible as possible?
[19:34:00] weaksauce: pipework alias pgrep="ps aux | grep "
[19:34:06] SteenJobs: i killed the spring process and it automatically restarted.
[19:34:11] SteenJobs: who knew it could regenerate
[19:34:14] pipework: weaksauce: no. pgrep already exists.
[19:34:20] nobitanobi: thanks pipework
[19:34:23] weaksauce: pipework I know
[19:34:29] weaksauce: I don't like the output of pgrep
[19:34:46] pipework: what's not to like?
[19:35:24] pipework: man pgrep, bru
[19:36:28] weaksauce: pipework I have done that before but nothing matches what I am looking for
[19:36:32] xibalba: you guys seen this? http://bropages.org
[19:36:51] pipework: weaksauce: No one but you knows what you're looking for.
[19:36:55] pipework: So you're kind of on your own.
[19:37:16] xibalba: SteenJobs that site will be good for you
[19:37:30] SteenJobs: weaksauce: effff. killed spring (finally) and bundle exec rails db is still giving me the getcwd error.
[19:37:52] xibalba: SteenJobs, did yo delete your CWD
[19:38:01] xibalba: current working directory
[19:38:10] SteenJobs: xibalba: haha great page. i know most of those commands already. but great read :)
[19:38:26] SteenJobs: xibalba: haha i know what CWD is???and not that i know of..
[19:38:40] pipework: Knowing a command and knowing all the switches and ways you can use the command aren't always the same thing.
[19:38:49] weaksauce: pipework basically a filtered list of the ps aux command.
[19:39:03] pipework: weaksauce: What specifically are you looking for?
[19:39:11] pipework: Command name, user, what?
[19:39:21] SteenJobs: xibalba: here???s the error: https://gist.github.com/SteenJobs/a79c1f0b56bb91221b88
[19:39:49] weaksauce: I like to see everything that ps aux shows. the most verbose that I could get pgrep was pid and the args
[19:39:57] weaksauce: but to each their own
[19:40:00] rubyonrailed: Hey, I have a custom path for a form submission. Inside the controller action I have this to create a user. https://gist.github.com/anonymous/dfbf3ba605542ab2b86f It saves fine, but it does not supply an id. Anyone know whats going on?
[19:40:03] pipework: Sounds like you should level up your pgrep knowledge.
[19:40:15] pipework: dat man pgrep tho
[19:40:22] SteenJobs: noooo xibalba left!!
[19:40:48] pipework: It'll be back.
[19:41:05] brendan6: anybody run into the error ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: ["development", "test"]?
[19:41:33] pipework: brendan6: Have you considered setting up a production key in your database.yml?
[19:41:49] pipework: Did you remove or delete the key or the environment file?
[19:42:23] agent_white: hey folks. Have this wierd extra-blank entry when I'm iterating through some objects for a view. http://i.imgur.com/nTu4oev.png -- Here is my code... just can't seem to find what is causing it. Checked for empty records in the database but nada. https://github.com/jakenotjacob/Yumm/blob/master/yumm/app/views/tickets/show.html.erb#L10
[19:42:29] agent_white: And help appreciated!
[19:42:52] pipework: agent_white: You are number one ux designer in world
[19:42:58] agent_white: I know right?
[19:43:20] agent_white: Took awhile to get "poop" correct, but it's perfect.
[19:43:29] pipework: agent_white: Check @ticket.items.length
[19:43:57] SteenJobs: pipework: use your magic. why can???t i get the damn postgres server in console?
[19:44:08] pipework: If 2, then @ticket.items.last.map{|item| [item.name, item.quantity, item.comment]}
[19:44:17] pipework: SteenJobs: bundle exec rails dbconsole
[19:44:24] agent_white: pipework: wat. How is there two.
[19:44:37] pipework: agent_white: Are you calling @ticket.items.build?
[19:44:39] weaksauce: pipework I have read every line of the pgrep man page. what invocation shows memory usage et al? not sure if the linux version of pgrep is better.
[19:44:40] pipework: Or new, whichever.
[19:44:44] SteenJobs: pipework: still getting that same No such file or directory - getcwd error
[19:44:55] pipework: agent_white: Are you rejecting blank items from the create?
[19:45:00] pipework: SteenJobs: cd ~
[19:45:06] pipework: Then cd back into the project directory
[19:45:14] agent_white: https://github.com/jakenotjacob/Yumm/blob/master/yumm/app/controllers/items_controller.rb#L5
[19:45:14] SteenJobs: pipework: worddd.
[19:45:19] pipework: agent_white: Gotta reject! those params that are empty
[19:45:49] SteenJobs: pipework: at least i???m getting a different error, ???could not locate gemfile???
[19:45:52] pipework: agent_white: Also consider adding validations to Item that require certain fields.
[19:46:00] pipework: SteenJobs: Are you sure you're in the project directory?
[19:46:12] pipework: Is there app/, config/, Gemfile, etc?
[19:46:35] SteenJobs: o wait. you wanted me to cd ~ and then back to project directory before running the command. i thought you wanted me to run the command in ~. one sec.
[19:46:38] agent_white: pipework: Wait where to reject? -- I did add in validations in the model for those required fields.
[19:46:49] pipework: agent_white: Before you call #save
[19:47:26] pipework: agent_white: You aren't using nested attributes on the ticket, right?
[19:47:33] pipework: The only way you're adding items is through this controller?
[19:47:38] SteenJobs: pipework: holy shit. it worked. why did cding out do that? but also instead of giving me what looks like rails server, it???s giving me name_of_database=#
[19:47:39] brendan6: pipework: My database.yml is not on gitignore and its looks like https://gist.github.com/HuffMoody/906f1c4187d9f8077e6d
[19:47:59] agent_white: pipework: Uhhh nope! Just through the controller.
[19:48:10] savish: can some one tell me why this: <%= select_tag 'Groups', options_for_select(Xaaron::Group.all { |g| [g.group_name, g.id]})%> only gives me group objects and not the name and id like I wanted?
[19:48:13] weaksauce: SteenJobs that's the thing about rvm it operates off cd
[19:48:21] weaksauce: and that's the db shell
[19:48:32] weaksauce: you can query the database directly from it
[19:48:32] SteenJobs: weaksauce: that i know, but i was already in my project directory
[19:48:48] SteenJobs: weaksauce: o ok cool. but it won???t give me the logs right away like rails server i guess?
[19:48:51] pipework: agent_white: So yeah, reject any fields in the private params method, that are empty. Like, don't pass an empty item.
[19:49:08] rhizome: Savish: use collection_select
[19:49:34] pipework: agent_white: What I would do is use params.require(:item).permit(:name, :quantity, :comment).reject(&:empty?)
[19:49:35] agent_white: agent_white: Good deal! Looking into it now.
[19:49:41] savish: OHHHHHHHHH OK
[19:49:58] pipework: agent_white: Then you only want to create if there's actually an item with those fieldses.
[19:50:19] SteenJobs: weaksauce: if you want a real challenge, i???m using a template and i???m pretty sure i did everything correctly, yet i???m getting a mysterious js error.
[19:50:30] SteenJobs: weaksauce: everything being integrating to the asset pipeline
[19:50:43] brendan6: pipework: Found the cause, it looks like ELB is overwriting my database.yml ...now to figure out why
[19:50:56] agent_white: pipework: Awesome! Thank you! Just added it to all of my controller params.
[19:51:21] Senjai: Client asks for list of things that were missing certain things. Gets a csv of 8000 rows. Suddenly decides not to try to fix it himself and listen to us
[19:51:30] weaksauce: gist it SteenJobs
[19:51:51] SteenJobs: weaksauce: k cool. i???ll send you the repo also???it???s a brand new project so not a lot of files.
[19:51:55] rhizome: things amirite
[19:52:12] pipework: agent_white: In create use @item = @ticket.items.create(item_params) if item_params.any?
[19:52:32] agent_white: pipework: As well as rejecting empty params?
[19:52:33] pipework: Then you save the build and the conditional with save.
[19:52:36] pipework: agent_white: Yes
[19:53:28] weaksauce: SteenJobs fwiw there is very little reason to dig into the sql logs unless you have a specific need to
[19:54:01] SteenJobs: weaksauce: yea, you???re right. i guess i just didn???t like the feeling of thinking some functionality, even if irrelevant, wasn???t working. i thought maybe it indicated that my install wasn???t right.
[19:54:09] agent_white: pipework: Awesome, thank you! Recreated my test db to try it out and found the bug I lost yesterday :D
[19:54:12] agent_white: Onto the next one!
[19:54:29] pipework: write some tests, SteenJobs!
[19:55:07] SteenJobs: pipework: i did! and i used a GUI to check the database and it???s all good! i just thought maybe it was going to collapse down the line
[19:55:25] pipework: SteenJobs: fuck guis and manual tests. :D
[19:55:35] SteenJobs: haha i need to get used to it
[19:56:17] jtperreault: fuck guis and manual tests. -pipework 2016
[19:56:18] pipework: Don't tell my employer, but I tend to never even look at the admin web application when I'm adding to it. I just write tests, write code, and move on.
[19:56:25] jtperreault: i'd vote for him
[19:56:59] pipework: It helps when someone else has done the work of making it easy to add things without them looking terrible though.
[19:57:29] SteenJobs: weaksauce: https://github.com/SteenJobs/skyrank - the error is ???document ready flot-data.js:5
[19:57:30] SteenJobs: Uncaught Error: Invalid dimensions for plot, width = null, height = null jquery.flot.js:136???
[19:58:17] louism2wash: hey guys, is there a way to call valid? on an object without triggering callbacks set on validation?
[19:59:00] pipework: louism2wash: wouldn't that be the point though?
[19:59:08] pipework: To know if it's valid, you have to run the validations.
[19:59:46] weaksauce: SteenJobs what url are you going to? can you gist the full error with the stacktrace?
[20:00:24] SteenJobs: weaksauce: yessir. going to localhost:3000. the home.html.erb page under static_pages
[20:00:43] pipework: If you're talking about extraneous callbacks on the validations themselves, the way to not call them is to not have them and to not use callbacks. If you must, you use callbacks on objects that will absolutely only ever be used with the intent of firing the callbacks.
[20:00:51] pipework: May God have mercy on your soul.
[20:03:00] SteenJobs: weaksauce: https://gist.github.com/SteenJobs/82a1becb42cfce5e59d5
[20:03:36] tubbo: my rule of thumb is to only use callbacks in a situation where the callback is only affecting the model it came from
[20:03:50] tubbo: so for example, a before_validation to calculate a given field
[20:04:00] tubbo: either that or to kick off background jobs.
[20:04:11] tubbo: though that's probably not the best use for them
[20:04:14] louism2wash: pipework: it's for testing purposes, the callback is populating an attribute and I want it so that the attribute can never be blank... however, the callback will always set a value on that attribute as long as the callback runs. Maybe the test for the callback being triggered is sufficient in this case? Thanks for the input.
[20:04:42] rhizome: what is that test supposed to prove?
[20:05:07] louism2wash: rhizome: that a password was encrypted
[20:05:33] pipework: louism2wash: I personally don't use callbacks unless the functionality they provide cannot be implemented any other way. When I do use callbacks I make a class that wraps the object I want to put the callback on and put the callback on that class so that I can use the class with callbacks and the class without.
[20:06:07] pipework: Rather than one class that has some way to do the same things with and without callbacks.
[20:07:29] louism2wash: pipework: thats a great solution
[20:07:49] SteenJobs: weaksauce: also the dropdown menus in the navbar aren???t working, only the side bar (in additioin to the graphs/charts not appearing.
[20:08:26] louism2wash: pipework: I'll probably look to implement something like that but for now I'm just going to skip the test for the presence of the attribute that is populated by callback. The test for running the callback will be sufficient
[20:09:25] pipework: louism2wash: Sure. I tend to think of tests, separately from coverage, as a set of assertions on any given 'system' you define that will break when the
[20:09:32] pipework: Fucking cat.
[20:09:35] agent_white: Where is the best place to clear invalid session id's?
[20:09:57] louism2wash: cats and keyboards
[20:10:03] pipework: agent_white: You can clear them when they're invalid or when they're checked.
[20:10:14] pipework: ... That will break when the assertion is no longer true.
[20:11:05] pipework: agent_white: What is your current session_store?
[20:11:16] pipework: If it's cookie_store, I should probably slap you upside the head.
[20:12:05] agent_white: pipework: Erm.
[20:13:59] louism2wash: pipework: I see... sounds like in my case the validation on the model that the field was populated isn't necessary. As long as my test suite is correctly testing that the callback is performing as expected then that is all that I need in the way of testing my system.
[20:15:02] pipework: louism2wash: Sounds good.
[20:15:09] agent_white: pipework: Looks like I did have it in a cookie.
[20:15:13] louism2wash: pipework: thanks for the help
[20:15:13] agent_white: Not sure how I did that.
[20:15:30] pipework: agent_white: ohdear.
[20:15:32] agent_white: pipework: Where do I want to store it?
[20:15:33] pipework: louism2wash: Cheers.
[20:15:39] dandaman: i know it's everyones take that you should do stuff yourself as opposed to relying on gems(IE. build your own admin rails interface instead of using the rails_Admin gem), but what about stuff like authentication and authorization? devise and cancan seem like great tools
[20:15:42] pipework: agent_white: Pick a session store that doesn't store the session on the client.
[20:16:05] pipework: dandaman: Well, I use one of two things for authentication with HTTP. warden or sorcery.
[20:16:31] pipework: For authorization, I don't use role-based stuff. Capabilities or death.
[20:16:34] agent_white: pipework: CacheStore?
[20:17:03] agent_white: Never knew about this.
[20:17:04] pipework: agent_white: activerecord session_store
[20:17:27] pipework: agent_white: Depends on what you need. activerecord-session_store isn't a bad place to start.
[20:17:56] agent_white: It's a internal restaurant POS system
[20:18:31] SteenJobs: weaksauce: i got the charts and graphs to appear, but the top navbar dropdowns are still not working.
[20:18:52] agent_white: pipework: Cheers! Never knew about that stuff. Thank you.
[20:19:35] whatasunnyday: I wanted to search an ar relation to see if an object existed. I did a query like Model.where(...) and afaik, the only way to search that relation by attribute without hitting the database again was by using select { |m| m.attribute == attribute }. Is there a method like find_in_relation which executes the where clause and lets me find something that matches in the relation? Tried searching the docs and couldn't find anything.
[20:19:44] pipework: agent_white: Anytime sir.
[20:20:23] SteenJobs: pipework: devise seems too easy (my last app i built authentication from the ground up with hartl???s help)???does it really do a good, secure job?
[20:20:53] whatasunnyday: SteenJobs, yes. I can't remember which ruby conf I saw the presentation but someone asked who is using devise and like 3/4 the room raised their hands.
[20:21:06] SteenJobs: wow???cool stuff
[20:21:08] whatasunnyday: (i did not attend the conf, i was watching it on conffreaks i believe)
[20:21:20] SteenJobs: it just seems so easy which gives the false appearance that it must be easy to break through.
[20:21:30] pipework: SteenJobs: Devise isn't insecure by most security postures, but it's sure hard to work with when you need to customize.
[20:21:50] SteenJobs: pipework: what kinds of cases would require customization?
[20:21:53] pipework: I always push super hard to never ever use devise.
[20:22:03] SteenJobs: pipework: and honestly i swear - i spend more time trying to get dropdown menus to work than anything else.
[20:22:07] whatasunnyday: i like sorcery if you're looking for something more light weight
[20:22:21] pipework: SteenJobs: All kinds of stuff. I mean, I do things like TLS mutual auth, totp, whatever.
[20:22:28] whatasunnyday: but i'm happy with devise personally. i haven't done a huge amount of work with it so maybe pipework has really good arguments against it
[20:22:29] Kedric: I have a open ended question. Why would you use AngularJS with rails?
[20:22:36] SteenJobs: pipework: i know what???.none of that means haha.
[20:22:37] pipework: But devise is a rails engine that you have to know how to reach into to change things.
[20:22:43] whatasunnyday: kedric, so you don't have to write your own two data binding system
[20:22:50] pipework: kedric: Who cares that you're using rails?
[20:23:00] pipework: The question is, do you like dom-bindings?
[20:23:03] whatasunnyday: more importantly, yeah what pipework said
[20:23:18] SteenJobs: pipework, whatasunnyday: right, i???m just trying to think if i would end up in a scenario where i would need to customize - which is why i asked what type of situations would require customization.
[20:23:22] whatasunnyday: if you're looking for something more light weight than angular, you can try mithril
[20:23:40] Kedric: pipework: I thought one of the main reasons for using it was the whole single page application. With form helpers and all I wouldnt see it used much in the CRUD kind of projects that I write
[20:23:50] pipework: SteenJobs: If all you want are the features listed and customizing views and a controller here and there, devise doesn't make that too hard.
[20:23:57] whatasunnyday: SteenJobs, if you're new (coming from hartl), i would personally recommend using devise
[20:24:13] pipework: Step beyond that and you're stepping into not just modifying something mostly railsy, you're having to know things about how devise works.
[20:24:23] SteenJobs: whatasunnyday: not thaaat new. i???ve been working on a few projects post-hartl???i just meant that i started with hartl.
[20:24:31] pipework: Extra mental overhead and harder to work and reason about. Your changes are now subject to rails upstream and devise upstream.
[20:24:32] whatasunnyday: if you have some knowledge of programming, authentication and other stuff, i might recommend sorcery for a more light weight api.
[20:24:51] pipework: Start with devise until you've learned why to hate it.
[20:24:59] whatasunnyday: what pipework said
[20:25:02] SteenJobs: ok cool. i mean i can always just built it from the ground up again.
[20:25:25] SteenJobs: but then again, i can???t even get to finishing my authentication until i get this damn dropdown menu to work.
[20:25:25] pipework: SteenJobs: Yeah.
[20:25:48] whatasunnyday: pipework, what do you use? hand rolled?
[20:26:39] pipework: whatasunnyday: For authentication? I tend to use warden or sorcery for HTTP.
[20:26:43] pipework: But I build on top of that.
[20:27:14] whatasunnyday: pipework, do you have a private gem that you reuse for sending password resets or just rewrite everytime?
[20:27:21] whatasunnyday: and other associated authentication stuff
[20:27:54] pipework: whatasunnyday: Well, I don't have any reuse for that feature. There's some generally the same things, but I don't want them hidden in a gem and I haven't abstracted enough to be fully flexible.
[20:28:08] pipework: There's been mostly different strategies and requirements for password resets.
[20:28:55] pipework: However the eventual just mailing of a password reset with a token is something I could reuse to some success, but it'd just be a class/object/method for a mailer that can handle generating a token and a url.
[20:29:30] SteenJobs: pipework: yea, i was thinking about taking the ground up work from hartl and putting it in a private gem so i can just reuse it, not a good idea?
[20:29:55] SteenJobs: also, who wants to help figure out why a dropdown menu isn???t working!!! don???t all jump up at once.
[20:30:12] weaksauce: whatasunnyday sorcery looks nice. basically devise without all the plumbing done for you
[20:30:46] SteenJobs: weaksauce returns???.
[20:30:49] whatasunnyday: weaksauce, yep. pretty much. its a well maintained gem from what i remember and the api is very intuitive.
[20:30:57] helpa: SteenJobs: Please explain your problem better as we are having trouble understanding what you mean. A Gist (http://gist.github.com) is always helpful!
[20:30:57] pipework: SteenJobs: !explain
[20:31:10] SteenJobs: pipework: hey hey hey, i know the rules!
[20:31:14] pipework: weaksauce: sorcery is cool because it generates code for you, it doesn't hide it in an engine.
[20:31:25] whatasunnyday: pipework, are you generall con rails engines?
[20:31:26] weaksauce: yeah that's quite nice pipework
[20:31:55] whatasunnyday: i like rails engines a lot but i haven't had to write or debug many so my opinion is pretty uneducated. i like the concept tho.
[20:32:10] pipework: whatasunnyday: If you're going to do it, provide great ways to modify or change or specify different things in your engine unless the engine is fully insulated from the host.
[20:32:14] whatasunnyday: it feels natural that might use them in the future internally or for a gem
[20:32:14] SteenJobs: pipework: https://github.com/SteenJobs/skyrank - posting the repo because it???s new so pretty small, and i have a feeling my issue is asset pipeline related - on my home.html.erb file under static_pages, my dropdown menus on the top navbar aren???t working.
[20:32:28] pipework: SteenJobs: Links to the files in question, pls. Gotta lunch
[20:32:40] SteenJobs: pipework: o right. meant to do that, sorry.
[20:34:02] pipework: whatasunnyday: Make it easy to customize if there's going to be any need to do so, if not then make sure it's pretty well insulated from the host.
[20:34:11] pipework: But protip: People almost always want to customize.
[20:34:30] whatasunnyday: pipework, i am pretty confused not by your comment but what's under neath it
[20:34:36] whatasunnyday: the papercode Paradox ... bit
[20:34:51] SteenJobs: pipework: https://github.com/SteenJobs/skyrank/blob/master/config/initializers/assets.rb, https://github.com/SteenJobs/skyrank/blob/master/app/views/static_pages/home.html.erb, https://github.com/SteenJobs/skyrank/tree/master/app/assets/javascripts.
[20:35:22] pipework: SteenJobs: I'll look after the lunchings.
[20:35:27] pipework: whatasunnyday: Which what?
[20:35:37] SteenJobs: pipework: aright, i???ll just cry in the corner until you???re done lunching.
[20:36:14] whatasunnyday: hmm, maybe its my irc client. i see this longish line underneath your and steenjobs most recent messages:
[20:37:16] pipework: whatasunnyday: XChat does that.
[20:37:22] pipework: Usually for when you tab away and come back.
[20:37:33] weaksauce: SteenJobs what are you trying to use to get dropdowns?
[20:37:40] pipework: But you can press windows/command plus l to get it to place a line.
[20:37:43] pipework: That's L as lower case.
[20:39:14] SteenJobs: weaksauce: bootstrap???if that asnwers your q?
[20:39:26] SteenJobs: weaksauce: the side menu ones use js though in their tags and they work
[20:41:49] weaksauce: SteenJobs do you have the bootstrap javascript?
[20:44:39] weaksauce: SteenJobs can you gist the rendered html that is not working?
[20:45:02] SteenJobs: yea, np. i presume it???s not a problem with the html because it came from a working template
[20:45:10] SteenJobs: so i assume i just screwed something up somehow with the asset pipeline
[20:45:24] agent_white: pipework: That session broke all my things D:
[20:45:45] pipework: agent_white: Generally switching session stores breaks old sessions, yeah.
[20:46:44] SteenJobs: weaksauce: https://gist.github.com/SteenJobs/cebc872a8c3dc5fcb0d4
[20:47:09] agent_white: pipework: I'm just getting wrong arg# errors on all those "params.require" chunks of code
[20:47:39] aep: how can i debug when nginx says that rails closed the connection prematurely and there is nothing in the rails logs
[20:47:41] pipework: agent_white: I'll look after lunch.
[20:47:48] agent_white: pipework: All good :)
[20:48:02] aep: i'm using unicorn. looks like some sort of timeout to me
[20:52:21] omosoj: can someone help me out with this db design: https://gist.github.com/anonymous/1a21713f9e2b237c7115
[20:53:21] gsd: i've got several rails dev positions in the los angeles area if you know anyone looking: https://www.assetavenue.com/careers
[20:53:22] weaksauce: SteenJobs rendered html not the erb
[20:55:44] newton: if I have a resource's path set to /, and a root - will I really be looking at any clashing issues? (root goes to the resource's index anyway)
[20:56:35] SteenJobs: weaksauce: ah sorry. one sec.
[20:57:48] rhizome: newton: no, but why wouldn't you just use one or the other?
[20:58:23] whatasunnyday: pipework, yeah i'm using xchat, that explains it
[20:58:28] mekhami: oh god i'm about to have the 'i accepted another job offer' meeting with my current boss
[20:58:33] mekhami: save me, people, i can't handle conflict
[20:58:41] nobitanobi: What is the proper way to do a ">" comparison of a date field with ActiveRecord? .where('my_date >= ?', Date.today) ?
[20:58:41] rhizome: handle it anyway
[20:58:42] pipework: mekhami: Why? Just give your 2 week notice.
[20:58:55] pipework: You don't have to have much more of a conversation if you don't want.
[20:58:57] whatasunnyday: mekhami, its less awkward than you think.
[20:58:58] mekhami: pipework, it feels dramatic lol
[20:59:05] pipework: mekhami: If you like that, I guess.
[20:59:12] mekhami: i don't! but i've only been here a month
[20:59:19] whatasunnyday: people change jobs all the time. its standard procedure.
[20:59:22] mekhami: and i literalyl just signed on as full time employee
[20:59:25] rhizome: if you're conflict-averse it will feel dramatic, that's how it works. however, it's not necessarily so.
[20:59:41] SteenJobs: weaksauce: i can???t copy and paste from chrome console - how else can i get the rendered html
[20:59:45] whatasunnyday: mekhami, it was probably a poor choice to take your current job but there's not much looking back you or the company can do. just make it easy for them to transition.
[21:00:11] weaksauce: SteenJobs right click on the page and view source
[21:00:14] whatasunnyday: what's a better use of time? yelling at a random engineer who joined and quit or improving the bottom line and keep the ship sailing?
[21:00:18] mekhami: whatasunnyday, it was a fantastic choice when i started =P but i got a much better thing going
[21:00:28] SteenJobs: weaksauce: neat trick.
[21:01:05] SteenJobs: weaksauce: https://gist.github.com/SteenJobs/9d6b16aa75a2bacf360f
[21:01:07] weaksauce: SteenJobs that one is essential imo ;)
[21:01:21] whatasunnyday: i think its kinda sucks to still be shopping for offers as soon as you get a job but i don't know your situation so no judgement. i'm just saying it probably isn't a big deal to your boss.
[21:01:27] weaksauce: can you paste all of the html SteenJobs
[21:01:29] SteenJobs: weaksauce: haha yea i???ve been using chrome console and doing individual inspecting elements, but that???s a huge one. just never noticed it.
[21:01:40] SteenJobs: weaksauce: yea. thought you just wanted the problematic section.
[21:01:57] weaksauce: that helps too but the problem is probably in the very very top
[21:02:16] mekhami: dude the old days of 'i hacked this site's source code and i changed it and opened it up and now their title is poop lol they'll never notice. hey, why didn't it change on their site'? i was a dumb kid
[21:02:37] xibalba: ACTION remembers the old days of novell servers
[21:03:01] SteenJobs: weaksauce: https://gist.github.com/SteenJobs/9d6b16aa75a2bacf360f
[21:03:08] xibalba: https://www.youtube.com/watch?v=gXUxLqqmhNs
[21:03:27] SteenJobs: weaksauce: yea in the head - i think i know what you???re gonna say, but there???s a reason for it. it seems that bootstrap.css isn???t loading, but when i require it in my application.css file, it messes up the page.
[21:04:21] SteenJobs: weaksauce: nevermind, i added it and the page is fine, but still no luck with the menus
[21:05:39] weaksauce: did you follow these instructions? http://getbootstrap.com/javascript/#dropdowns
[21:08:34] weaksauce: SteenJobs should it not be navbar instead of nav for the class
[21:09:44] SteenJobs: weaksauce: for the ul class?
[21:10:21] SteenJobs: weaksauce: because if so, it???s fine the way it is...
[21:11:27] aep: can i someonehow optimize multiple calls to find_by(key:val) as one block?
[21:13:59] s2013: hmm trying to figureo ut how id do do this.. how can i check if an admin edited a resource or the owner of the resource did
[21:14:30] s2013: we have a callback that sets a resource (photo) to unapproved everytime its edited.. but i dont want that to be the case if the admin edits it
[21:19:12] SteenJobs: weaksauce: i???m pretty certain the html is fine???it???s gotta be something i???m missing in the pipeline.
[21:19:39] weaksauce: not sure SteenJobs the header looks like it's including the correct stuff
[21:20:04] weaksauce: when you view source and click on one of the links for bootstrap does it go to the right resource?
[21:21:49] SteenJobs: weaksauce: yea it does.
[21:22:00] SteenJobs: weaksauce: i mean it works on the preview for the template, so the html is definitely ok.
[21:22:08] SteenJobs: weaksauce: like if you go to the download site and preview it first.
[21:24:19] SteenJobs: weaksauce: this is quite the challenge, i told you haha
[21:28:30] bricker`work: SteenJobs: what is the problem
[21:28:58] SteenJobs: bricker`work: we have the mystery of a not working dropdown menu
[21:29:19] SteenJobs: bricker`work: i wish it was something more proportionate to the amount of effort trying to fix it.
[21:29:55] weaksauce: SteenJobs does the page look like it's being styled with bootstrap css?
[21:30:04] weaksauce: if not then you have a problem there
[21:30:07] SteenJobs: weaksauce: yea. looks exactly like it should.
[21:30:59] bricker`work: SteenJobs: not working?
[21:31:23] bricker`work: SteenJobs: what is supposed to make it work? Some bootstrap thing?
[21:31:44] SteenJobs: bricker`work: correct not working. and yea, bootstrap.
[21:32:26] bricker`work: SteenJobs: have you included the dropdown.js file in your javascript?
[21:32:51] SteenJobs: yup. it???s included in the application.js file.
[21:33:26] bricker`work: SteenJobs: Do you have any errors in your javascript console?
[21:33:53] SteenJobs: one but unrelated to the dropdown menus - the error is even found on the preview page for the template itself, so no important errors.
[21:35:22] bricker`work: SteenJobs: have you tried removing turbolinks?
[21:35:37] SteenJobs: bricker`work: i have not. would that possibly help?
[21:36:23] xibalba: trying to figure out the difference in time, https://gist.github.com/anonymous/28e4f16cdc02b2717324, dunno why it comes back as a rational
[21:36:29] SteenJobs: bricker`work: didn???t work.
[21:37:00] weaksauce: SteenJobs did you remove spring?
[21:37:14] SteenJobs: weaksauce: i killed spring earlier, but i didn???t remove it.
[21:37:27] bricker`work: SteenJobs: Did you remove turbolinks from your Gemfile, bundle install, and restart your app (including Spring)?
[21:37:40] mwlang: xibalba: (ends_at - DateTime.now).to_f
[21:37:42] SteenJobs: nope. just removed it from the head
[21:37:49] bricker`work: SteenJobs: Turbolinks hooks into click events so I wouldn't be surprised if it broke bootstrap events
[21:37:52] SteenJobs: i???ll delete both from the gem file and bundle install now. one sec.
[21:39:01] xibalba: mwlang, https://gist.github.com/anonymous/9693a968d677f771dbe5
[21:39:11] xibalba: i'd expect maybe 1.5
[21:39:28] xibalba: Time seems to work better for this purpose than DateTime
[21:39:30] Radar: Why DateTime?
[21:39:31] Radar: Why not Time?
[21:39:40] mwlang: Yeah, use Time
[21:39:42] xibalba: must be lagged
[21:39:51] mwlang: I didn???t catch that in my quick glance.
[21:40:21] SteenJobs: bricker`work, weaksauce: bad news - it didn???t help
[21:40:32] helpa: Why not Zoidberg? (\/) (o,,o) (\/) WOOP WOOP WOOP
[21:40:45] nobitanobi: I have a column that is called delivered_at in my Order model. How can I find all the Orders that were delivered within a span of 7 days from Today? So, in the past 7 days?
[21:40:46] weaksauce: SteenJobs good news - it removed one possible point of problems
[21:40:50] xibalba: i guess i ended up w/datetime due ot the datetime select form helper
[21:40:55] SteenJobs: weaksauce: truth!
[21:41:24] rhizome: things that don't work in production. grar
[21:41:56] bricker`work: SteenJobs: check the click listeners on your link, make sure the dropdown stuff is registered
[21:42:00] bricker`work: SteenJobs: you can check in Chrome
[21:42:21] mwlang: xibalba: generally speaking, do short distance duration calcs using Time and long-distance (days, years) calcs using Date.
[21:42:53] mwlang: I don???t do much with DateTime???seems to be a ???toy class??? to me.
[21:43:00] xibalba: thanks,. i remember i arrived at dateimt from using the form helper datetime_select
[21:43:45] mwlang: yeah, Rails helpers can lead you down the wrong path like that.
[21:44:09] pipework: Time is hard in any language, Ruby and Rails just ups the ante for the hardcore.
[21:44:22] xibalba: so in my create action on my controller i store the datetime_select params into the attribute, ccan i convert it ot time before storeing it in a DateTime field
[21:44:50] xibalba: testing that now, appeasrs now
[21:47:32] xibalba: {"ends_at(1i)"=>"2014", "ends_at(2i)"=>"11", "ends_at(3i)"=>"14", "ends_at(4i)"=>"19", "ends_at(5i)"=>"00"} how can i convert a params hash from datetime_select like this to a Time object
[21:47:48] xibalba: i guess i could jsut do it manually and peel out 1i, 2i,etc..
[21:47:55] SteenJobs: bricker`work: ok just figured out how to check listeners - when i click, stuff pops up in console
[21:51:58] SteenJobs: bricker`work: could it be possible that somehow it???s registering a double click, and thus immediately closing the menu?
[22:17:58] shlant: anyone know if it's normal for memory usage to be ~50% lower right after reboot vs a long running server? I have a ruby app running on the server and I'm not sure if there's a memory leak
[22:18:33] shlant: the memory usage eventual plateaus, but I'm not sure if that's normal
[22:20:08] sholden: Hey everyone??? As far as I know, there???s no way to queue the dependent action on an association. I???d like to delay writes when removing from an association in a similar way to #build, until I save the parent record. Does anyone know a way to do that or gem that adds support?
[22:28:56] mwlang: sholden: I typically do those things in a transaction block.
[22:29:26] mwlang: basically, if you???re doing a bunch of things and if any one thing might fail, then start a transaction and do your thing and let exceptions lead to database rollbacks.
[22:29:40] xibalba: need some input on this time issue
[22:29:44] xibalba: unlimited_browsing_session.ends_at.utc.should == 120.minutes.from_now.to_datetime.utc.to_s
[22:30:00] xibalba: my bad i meant, unlimited_browsing_session.ends_at.utc.should == 120.minutes.from_now.to_datetime.utc
[22:30:30] xibalba: expected: Sat, 15 Nov 2014 00:30:08 +0000 \n got: Sat, 15 Nov 2014 00:30:08 +0000 (using ==) \n Diff: 'ntohing here'
[22:30:33] mwlang: xibalba: read up some: http://danilenko.org/2012/7/6/rails_timezones/ Very good tutorial on working with time.
[22:30:34] xibalba: but adding to_s ont hem works
[22:30:54] sholden: mwlang: yeah??? i???ve done the same in the past, but I???ve got after_destroy callbacks on these image objects that clean themselves up from a remote api. I could add that to an after_commit, but I???d much rather just queue up actions until save.
[22:31:29] sholden: I???m hoping maybe I can do something with the association callbacks. just trying to see if anyone has already done the work for me :P
[22:31:34] savish: Hello every one, So I have been having some issues with triple join tables and trying to say you have many of this and this has many of you. I have posted a rather extensive stack question at http://stackoverflow.com/questions/26939923/triple-join-table-not-working-the-way-i-expect-rails-engine-4-1-x and I am curious if some one can take a look and give me some tips, advice and solutions to my issue. Theres internet points in it for
[22:31:34] savish: you :D. It details my issue with tipple join tables and getting data from them as well as setting data in them. Your help is apprciated
[22:33:05] mwlang: sholden: Ah. I???ve done something like that just having a class in the models folder that handles special logic like that.
[22:33:09] hnanon: I need some help modeling some relationships.
[22:33:27] hnanon: I've been toiling for 3 days trying to get my form to work.
[22:34:03] hnanon: Imagine a product (shoe) that has multiple options (color, size, etc.) and variants (8, 9, 10; red, black, blue).
[22:34:24] mwlang: basically as I iterated over the records, I set class level variable with the records that are queued and once I???ve done the parent record updates and saves, I then handle the queued data.
[22:34:42] hnanon: Currently, products have many options through product_options.
[22:34:51] hnanon: Options have many products through product_options.
[22:35:09] hnanon: product_options belongs to products and options.
[22:35:11] mwlang: hnanon: you might find inspiration in the Spree commerce app.
[22:35:14] hnanon: Options have many variants.
[22:35:24] hnanon: Variants belong to options.
[22:35:42] hnanon: mwlang: I looked, I want something simpler.
[22:36:34] hnanon: Should I just dump the product_optins join table and instead say products have many variants through options?
[22:36:45] mwlang: hnanon: the code for spree does many similar things to what you just described???that???s why I thought it might actually have something you could extract out.
[22:37:12] hnanon: It's similar but their relationships are even more complex.
[22:38:23] sholden: I???d like to add something more like ActiveModel::Dirty for ActiveRecord::Associations::CollectionAssociation
[22:38:51] sholden: and store both @target and @original_target or something
[22:39:09] bricker`work: sholden: check it
[22:39:28] bricker`work: sholden: https://github.com/SCPR/secretary-rails/tree/master/lib/secretary
[22:39:32] bricker`work: see dirty_associations
[22:42:51] sholden: bricker`work: Ahh yep. This is along the lines of what I was thinking.
[22:42:58] sholden: thanks for the link
[22:45:43] rhizome: bug hunting success
[22:48:18] samselikoff: im looking to add an admin interface to an engine im writing, and im thinking about using ember for the interface. any ideas on how i could do this?
[22:50:42] bricker`work: samselikoff: learn ember, apply knowledge
[22:51:56] samselikoff: :p I more mean, how should I serve up the ember app from within my engine
[22:54:09] rhizome: try, then ask questions either here or in #ember if you have problems. not sure what you're asking for.
[22:58:01] sholden: samselikoff: just like any other asset??? there???s nothing special required
[22:58:43] samselikoff: sorry, i meant to say ember-cli
[22:59:29] sholden: I???d ask around in #ember, but if you want to dig through an example app that uses rails + ember, https://github.com/discourse/discourse is a good place to start.
[22:59:32] samselikoff: i noticed resque had a separate resque-web
[22:59:52] samselikoff: repo and was wondering if I should do the same, for my engine
[23:00:31] samselikoff: yah. i think i need to think through it a bit more
[23:21:25] aiguu__: Which is the common practice for creating record, ex 1: User.create(params[:user]) or, ex 2: User.create({ foo: params[:foo], bar: params[:bar] })
[23:21:47] aiguu__: #1 seems to let you rely on models for validation etc
[23:22:04] aiguu__: #2 seems to clutter the creation process and need to update if the model updates etc
[23:23:51] aiguu_: #2 also seems to clutter the root of params which is messy to me
[23:27:06] pipework: aiguu: Using strong_parameters is important here
[23:27:43] pipework: whitelist the params using require and permit before passing the params hash or a subset of it into the #create or #update methods.
[23:28:25] aiguu: so passing the hash in is fine as long as you have whitelisted attributes (to prevent someone updating something bad I guess)
[23:31:07] aiguu: thanks :)
[23:31:55] aiguu: can you give an example of why strong parameters is important so I can know what I am protecting again? :)
[23:34:37] pipework: aiguu: Look into the readme.
[23:50:34] xibalba: suggestions on having auth tokens on a user who has many devices? i'd like each device ot have it's own auth token as opposed to one token for all the devices
[23:52:07] pipework: xibalba: Do that.
[23:52:56] xibalba: i see devise provides an auth_token, it's only one however. contemplating how to many it so each device has it's own token. i suppose i can associate devices to the user and generate the auth tokens on the device
[23:53:44] SteenJobs: pipework: never got the dropdowns to work.
[23:53:50] SteenJobs: pipework: seems like we tried everything...
[23:54:00] pipework: SteenJobs: I don't use boobstrap. :(
[23:54:14] SteenJobs: haha aright
[23:54:31] SteenJobs: anyone else a dropdown expert? haha i swear i waste more time with dropdowns than anything else
[23:56:35] rubyonrailed: How do I point a gem at a pull request?
[23:56:47] pipework: rubyonrailed: With bundler and a Gemfile probably
[23:57:19] rubyonrailed: gem 'rails_gem', :git => 'git://github.com/gme.git', :branch => "patch-1"
[23:59:01] rubyonrailed: lol nvm I figured it out