« Back to channel list

#RubyOnRails - 23 September 2013

« Back 1 day Forward 1 day »
[00:00:44] Radar: trappist: Rabl and (I think) Active Model Serializers allow you to gain access to the routes for the application using helpers and without using dirty hacks to do so
[00:01:01] Radar: trappist: Is this just one of the JSON responses in your app?
[00:01:23] trappist: oh, rabl... I always forget about it until I hit something like this, then always end up using it
[00:01:40] trappist: Radar: no, not the only one by a long shot but the first one that's given me any trouble
[00:02:08] Radar: alright. in that case then I would really recommend using rabl/AMS
[00:02:54] Jdubs: Okay, I've got it figured out. new problem: how should I check to make sure an object is properly destroyed from the database?
[00:03:09] Jdubs: I tried find, but it gives me a database error saying it couldnt find it
[00:03:17] Jdubs: Which is good I suppose, but how do I test it
[00:03:24] Radar: Jdubs: what problem are you trying to solve?
[00:03:48] Jdubs: I run a method that deletes objects from the database matching a criteria, then want to check if it's still there.
[00:03:48] alx-: Jdubs: object.should be_destroyed
[00:03:53] Jdubs: awesome ! :)
[00:04:53] Jdubs: alx- radar: i'm getting "expected destroyed? to return true, got nil"
[00:05:14] Jdubs: am I supposed to call it before or after I destroy the object?
[00:05:52] Radar: box.opened?
[00:05:59] Radar: Makes sense, right?
[00:07:49] Jdubs: I finally got it to work by doing this "Token.find_by_id(token.id).should == nil" is this syntax ok?
[00:08:36] Radar: Jdubs: Why doesn't token.destroyed? work?
[00:08:55] Jdubs: it was getting back nil instead of true for some reason, not sure why
[00:12:11] Jdubs: but it IS destroyed which is weird
[00:13:51] cwin: I'm wondering if anyone knows how I can combine the search results from two models using Tire. I have two models, Posts and Channels. In my index view, I have a loop that outputs both when users search. However, I'd like to combine these results in one loop and variable. I've pasted my controller code here… @all_objects is where things are breaking down: http://pastie.org/8347521
[00:13:52] Radar: Jdubs: nil is still false in Ruby.
[00:14:06] Radar: Jdubs: Well, nil == false => true anyway
[00:14:23] Jdubs: well im not sure why it's having that problem :/
[00:14:30] Jdubs: the object gets deleted from the database
[00:14:36] Jdubs: but destroyed still returns nil
[00:15:36] Jdubs: i tried reloading the object first but then i get a database error saying it couldnt find the object
[00:16:29] Radar: Can you show me all the code for your test please? According to rails docs destroyed? should never return nil;
[00:18:25] Jdubs: it might be that im using rails 2.0
[00:19:05] Jdubs: after the object is destroyed i just run token.should be_destroyed
[00:19:08] Jdubs: which returns nil
[00:19:24] Radar: Jdubs: show me the code please.
[00:20:35] Jdubs: http://pastie.org/8347540 test is at the bottom
[00:22:50] Encore: hey, so, i've just joined a new project/startup and they're using HTML slim. what are some good sources for learning html slim? or does it simply convert your regular html into slim format afterwords?
[00:23:31] Encore: Great, thnx Radar
[00:23:44] Radar: np happy to help
[00:28:20] optobear: Jdubs: destroyed? will only be true if you call destroy on the object in question. in your case, you've deleted the record matching token "behind its back" by calling ::destroy_expired, rather than by calling token.destroy
[00:28:45] Radar: what optobear said
[00:28:50] Jdubs: oh ok, so is the best way to test it is using find_by_id?
[00:29:04] Radar: Your test attempting to find the token by its id is right.
[00:29:08] optobear: Jdubs: that'll work
[00:29:26] Jdubs: is there a better syntax?
[00:30:59] optobear: it's ok like that, but .should_not be_present is more Englishy, so maybe easier to read
[00:32:28] s2013[nyj]: Radar, the attr_accessor worked. thank you for that.
[00:33:29] Radar: Jdubs: maybe lambda { token.reload }.should raise_error(ActiveRecord::RecordNotFound)
[00:33:44] Jdubs: alrighty thanks :)
[00:34:27] s2013[nyj]: is there anyway i can make this into more dry code or something more rubyesque? @image.image_from_url(params[:image][:url], params[:image][:w], params[:image][:h]
[00:35:40] optobear: Jdubs: that's also good. it's a good thing to be aware of the difference between yr object in memory and the db record of it. calling reload will try to refresh the in-memory object from the db, and in this case, should fail, per Radar's test
[00:36:11] Jdubs: optobear radar: thanks a lot guys :) trying to contribute to an open source project by writing all the tests :)
[00:45:48] amccloud: Is there anyway to have plural and singular resource routes? e.g. collection actions will be /venues and member actions /venue
[00:46:17] Radar: zzak: yes
[00:46:27] Radar: amccloud: why?
[00:46:43] amccloud: "SEO" requirement :(
[00:47:26] amccloud: Radar: I believe we met in Vegas at /usr/lib :)
[00:48:27] Radar: amccloud: Sounds likely :D
[00:48:48] Radar: amccloud: You'd have to define the member routes by hand if you wanted that.
[00:49:09] Radar: get '/venues/:id/something', :to => 'venues#something'
[00:49:11] Radar: Oops, /venue.
[00:50:22] amccloud: You told me about the edge docs for rails 4 not containing generators and that convinced me to give rails a shot :) Love it!
[00:50:24] Radar: amccloud: Were you the guy with the author girlfriend?
[00:51:43] amccloud: Radar: Would I have to do that outside of the resource?
[00:51:51] Radar: yeah, just above it
[00:52:19] Radar: Is the SEO really that pedantic?
[00:52:47] amccloud: Almost all of our routes need to have this behavior
[00:56:09] Radar: amccloud: you could do this https://gist.github.com/radar/6665384
[00:57:52] amccloud: :only nothing?
[00:58:03] Radar: Yeah, so all the typical resource routes are defined under /venue
[00:58:20] Radar: You may want to include index in that and *ex*clude it from the /venue
[00:58:34] s2013[nyj]: can i use pry on a model method?
[00:59:26] Radar: s2013[nyj]: yes
[00:59:54] s2013[nyj]: k cool. i cant seem to figure out why the image isnt being resized
[01:00:03] Radar: pry can be used in any ruby code ever
[01:00:45] Radar: brb in 15 or so
[01:04:07] s2013[nyj]: hmm everything is nil. odd
[01:07:27] s2013[nyj]: can someone check my code and see why images arent being resized https://gist.github.com/ss2k/2ffe08060c9259d84980
[01:07:36] s2013[nyj]: it saves the image but in the original width and height
[01:15:05] amccloud: Radar: I went with https://gist.github.com/amccloud/67c52da64f8cfc4276e5
[01:15:29] Radar: s2013[nyj]: I don't think AR would support writing a file like that to the database
[01:15:44] Radar: s2013[nyj]: you should write that image to the filesystem and then save the path to that image to your database
[01:15:51] Radar: amccloud: nice :)
[01:18:45] s2013[nyj]: Radar, i thought thats what i was doing. maybe i dont understand how the gem is working
[01:19:10] s2013[nyj]: but i thought it changed the dimensions before saving the path to the db
[01:19:23] s2013[nyj]: im not trying to save the image to the db. just the path. which works fine now
[01:20:28] Radar: s2013[nyj]: show me what line of the code you've given us is a) getting a path and b) saving it to the DB
[01:24:25] s2013[nyj]: in the create action thats what its doing or atleast i thikn it is
[01:32:21] cwin: I'm wondering if anyone knows how to effectively search two models using Tire and ElasticSearch – my brain is about to explode. I've posted my code here: http://stackoverflow.com/questions/18950470/search-multiple-models-with-tire-and-elasticsearch
[01:44:49] rehat: do I need to do a db:migrate when changing the model class? Like adding a validates
[01:45:16] alx-: no - only when you add a migration
[01:47:48] echosystm: how do you create an ajax request manually and still have all the ujs stuff triggered?
[01:48:26] echosystm: for example, i have a button that submits some json data
[01:48:33] echosystm: there is no actual form to submit
[01:53:56] Radar: echosystm: What UJS stuff?
[01:54:27] echosystm: ajax:before... ajax:*
[01:54:47] Radar: ah. I don't know.
[01:54:51] Radar: I thought that might've been global?
[01:55:46] atal421: in general, if i want to run a "thing" (gem, engine, plugin, script, whatever the correct term is) right before "rails server" or "padrino start" (or whatever you named your sinatra app, 'ruby my_app.rb')
[01:55:59] atal421: what do i do?
[01:56:05] Radar: atal421: why do you want to run this thing? What does it do?
[01:56:06] atal421: what am i googling?
[01:56:59] atal421: Radar: "it" is an idea. a custom line of code… like, i want to run puts "hello world" before anything else
[01:57:43] Radar: atal421: initializers are your friend
[01:58:13] atal421: but what if i want this to just work in every framework, and in the command line
[01:58:38] Radar: what do you mean "every framework"?
[01:58:46] Radar: Oh, padrino and sinatra have their own things
[01:58:49] Radar: ask in their channels?
[01:59:03] atal421: Radar: for example… let's say i want to run the "flog" gem right when rails starts up, just so i know how much pain is behind the code. just like i'd want to run it before padrino or sinata or nyny
[02:04:52] atal421: Radar: i'll rephrase, if i want to run code that autoruns before rails boots, as a gem, where do i start looking?
[02:05:10] Radar: atal421: There isn't a place for that. Use initializers.
[02:10:09] robonerd: by any chance is rails 4 slimmer than rails 2/3 ?
[02:15:55] echosystm: if youre making a manual ajax request (in js, not a form), do you have to trigger the ajax:* events manually too, or is there some easy way to do it?
[02:16:30] soahccc: Hmm what can that be? "Circular dependency detected while autoloading constant Room::Accessors". I don't have and don't even know unloadable (that's what I find when googling for it)
[02:16:31] echosystm: eg. is there some $.rails.ajax() method?
[02:16:45] soahccc: Room::Accessors is my module btw
[02:23:36] Radar: soahccc: code plz
[02:23:39] Radar: robonerd: what do you mean?
[02:24:59] soahccc: Radar: I think I fixed it by renaming the module. The problem occurred in asset:precompile not in dev mode. I had a module Room::Accessors (concern) and a model Room and that is no good
[02:25:32] soahccc: It's now RoomConcerns::Accessors
[02:27:26] Radar: module named Room, class named Room?
[02:29:43] s2013: is there anyway i can pass parameters to a before_save or after_save
[02:30:13] s2013: because im still trying to figure out how to resize the image and save that
[02:30:35] jaymiejones86: s2013 not using carrierwave or paperclip?
[02:30:35] s2013: i thought worse case i can just use imagemagick and convert it that way but i need the width and height being passed
[02:30:39] s2013: im using paperclip
[02:30:56] jrobeson: Radar, how's it goin?
[02:31:03] jaymiejones86: s2013 I thought you could do sizes with paperclip like you can with carrierwave
[02:31:03] Radar: jrobeson: goodo
[02:31:13] s2013: jaymiejones86, you can. but they arent dynamic. they are preset
[02:31:23] jrobeson: Radar, beat the game already?
[02:31:39] s2013: basically im trying to resize remote image to custom dimensions
[02:31:42] s2013: and save it in the filesystem
[02:31:57] jrobeson: hm.. i never handle resize on upload
[02:32:17] jrobeson: i always do it with a background process or on the fly
[02:32:31] jrobeson: that way the best image stays in place.
[02:33:11] jrobeson: in case people want to change the parameters of the resize later, people don't have to reupload their photos again
[02:34:23] s2013: hmm but will it resize the image before its displayed?
[02:35:47] jrobeson: s2013, that's what i do.. or background processes like via delayed job, resque, sidekiq
[02:36:02] jrobeson: usually i'm stuck with using cron when working outside of something like rails
[02:36:02] echosystm: Radar: i just worked it out
[02:36:05] jrobeson: but here you can use those
[02:36:50] s2013: hmm maybe its overkill but i guess i can try to save the width and height in the database
[02:36:55] s2013: and just use that
[02:36:55] echosystm: <button ... data-remote="true" data-url="/x/y/z" data-method="put" data-params="x=y">Yay</button>
[02:37:00] jrobeson: why would you do that s2013 ??
[02:37:06] echosystm: you have to stuff everything into the data-params attribute
[02:37:19] jrobeson: why would you save the image and height, the image already has that metadata
[02:38:17] chendo: so you can tell the browser what the size is before it loads it
[02:38:18] jrobeson: err widht and height*
[02:38:20] chendo: to prevent redraw
[02:38:36] jrobeson: you can still do that.. if you're already processing it anyways
[02:38:41] s2013: jrobeson, save the width and height that was submitted
[02:38:48] s2013: not the actual h/w
[02:38:53] poli: hello all! I need a hand on nested forms with variable names differing from class names: https://gist.github.com/mpoli/c462bdeb6548f6377de5
[02:38:59] jrobeson: s2013, for what purpose
[02:39:11] s2013: how would i resize it then
[02:39:15] s2013: if i dont know what size to resize it to
[02:39:27] jrobeson: chendo, in most cases people are setting the width and height on a gallery level.. which then gets applied to each <img>
[02:39:38] jrobeson: so there's no need to store it per image
[02:40:01] jrobeson: s2013, well if it's a gallery.. store the width and height of the thumbnails there..
[02:40:17] chendo: jrobeson, that would only work if every photo has the same aspect radio
[02:40:34] jrobeson: chendo, well. nothing is going ot be perfect, you're going to be forcing it to a size anyways
[02:40:53] jrobeson: in that case.. you can still query the aspect ratio
[02:41:03] jaymiejones86: s2013 what about checking to see if a width and height params exists, if so, in the controller have a call to a class that does the resizing which takes the image, width and height… whether it then goes to a background job or not, is up to you.
[02:41:05] jrobeson: and then decide the best way to force it to the requested size
[02:41:09] chendo: jrobeson, ruining the aspect ratio is always going to be bad
[02:41:20] chendo: and to query the aspect ratio, you'd need to read the image metadata somehow
[02:41:28] jrobeson: which is already necessary
[02:41:29] chendo: and if you're storing it on S3, then that's going to be a non-trivial hit
[02:41:43] chendo: there's nothing wrong with storing it in the DB
[02:41:52] jrobeson: nobody said anything about s3
[02:42:10] jrobeson: chendo, storing the entire image a database?
[02:42:19] chendo: storing the image dimensions in the database
[02:42:22] jrobeson: k.. just makin sure
[02:42:31] s2013: jrobeson, its not that complicated man.. its an image resizer.. you enter url, and width and height you want to resize it to
[02:42:32] s2013: simple as that
[02:42:44] chendo: and even if it's not in S3, having to parse image metadata on every time you want to know the image dimensions isn't great
[02:42:56] jrobeson: there's a thing called caching.. :)
[02:43:07] jrobeson: his usecase isn't that complex chendo
[02:43:14] jrobeson: you're overhtinking it
[02:43:43] chendo: i only saw something about storing the width and height
[02:43:53] chendo: now that i've actually read it, yeah sure
[02:44:58] jrobeson: i wonder how much more dry this test can be.. hmm
[02:47:14] s2013: does self.save! make sense in after_save ?
[02:48:05] sevenseacat: infinite loop much?
[02:52:43] jaymiejones86: i really think it could be all handled in its own class, whether thats called in the model or controller, which has particular params passed to it.
[02:52:59] s2013: k i sort of figured it out. now the only issue is that the images do not have any format
[02:53:02] s2013: and imagemagick cant resize it
[02:53:21] jaymiejones86: why do they not have a format?
[02:53:21] s2013: now i gotta figure out how to save image with a format like png, jpg, etc.
[02:53:33] s2013: http://localhost:3000/system/images/images/000/000/006/original/open-uri20130922-4202-19g3x0e?1379904656
[02:53:42] s2013: thats an example image url
[02:53:59] s2013: i dont know why it doesnt.. probably some paperclip config. but im one step closer
[03:10:40] ner0x: Is it possible to prefetch an associated tables count(*) ?
[03:16:16] poli: What way would you recommend for depolying a application on my own server, very low traffic?
[03:17:26] s2013: k i cant seem to figure out why my images do not have a filename attached to it
[03:17:28] s2013: filetype rather
[03:18:45] poli: s2013: carrierwave?
[03:19:25] Radar: s2013: show me how you're saving that image please.
[03:19:35] optobear: is there a customary spot in a rails app for static files that you don't intend to serve up? in my case, i have font files and image files which are used in generating pdfs, and i want them in the file system, under version control, but out of the asset pipeline
[03:19:41] Radar: poli: Recommend to do what? The deployment? The serving of the applications?
[03:19:48] Radar: optobear: public
[03:19:49] s2013: paperclip but im adding a path and seeing if it works
[03:19:51] poli: Radar: The serving.
[03:20:03] Radar: poli: Nginx + Unicorn
[03:20:23] optobear: Radar: thanks
[03:21:23] poli: Radar: thanks
[03:26:48] CognitiveCorgi: Why hello there everyone!
[03:32:13] s2013: oh man. now its saving the extension but i cant display the image.. blah
[03:34:10] s2013: https://gist.github.com/ss2k/2ffe08060c9259d84980 this is my updated gist
[03:44:20] Radar: hello CognitiveCorgi
[03:44:46] Radar: s2013: Where is the code for displaying the image?
[04:13:32] et-nid: Hellooooo
[04:16:07] Radar: et-nid: hello
[04:21:25] tweeeaks: Radar: is rails 4 in action out yet? only see 3 on amazon and pre-order options on manning.. just a little confused because of the available tags under the toc on the manning site
[04:21:58] helpa: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Steve Klabnik, Ryan Bigg, Yehuda Katz
[04:22:35] jrobeson: i'm thinking about buying the book
[04:23:05] toastynerd: tweeeaks: pretty sure they haven't started shipping print books but they do have MEAP available
[04:24:03] tweeeaks: toastynerd, ahh gotcha - thanks
[04:25:04] Radar: tweeeaks: no it's not out yet
[04:25:15] Radar: tweeeaks: Steve Klabnik still hasn't finished writing it
[04:25:23] Radar: And Manning is still dicking me around on royalty payments they owe me
[04:26:19] Radar: Things that shit me: a) poorly indented code b) code not correctly formatted using Markdown c) being owed money
[04:26:39] jrobeson: poorly indented by who?
[04:26:49] Radar: There's no excuse for shitty formatting.
[04:27:08] jrobeson: it's the easiest way for me to judge code that's for sure..
[04:27:20] jrobeson: badly indented is a huge mark
[04:27:32] jrobeson: because i've never seen badly formatted code that in itself was good
[04:28:32] tweeeaks: thanks Radar, looking forward to the book.. and screw Manning, thats bullshit
[04:29:15] Radar: My dream is to pry the rights to the book from their hands and self-publish it on Leanpub
[04:29:17] Radar: For half the price.
[04:30:17] jrobeson: so why was manning chosing for r4ia ?
[04:30:31] Radar: Yes, that will mean converting a 235,000 word manuscript written with XML into Markdown but I am that angry with Manning I would damn well do it.
[04:30:54] Radar: jrobeson: They chose me
[04:31:25] jrobeson: i wonder how you could achieve your goal there
[04:31:29] Radar: I had an idea of how bad they were 3 months into publishing. I wrote a better review tool than theirs… in 12 hours. Fuelled by rage.
[04:31:41] Radar: jrobeson: Costly legal action.
[04:31:55] jrobeson: so r3ia was done with somebody else?
[04:31:55] Radar: Or I could purchase the rights off them too, which is also costly.
[04:32:09] Radar: I wrote r3ia myself, but had a ton of people who reviewed it and offered corrections
[04:33:01] jrobeson: how did you publish it then?
[04:33:28] Radar: I submitted it to Manning's system and they did all the sacrifices involving goats that are required to get a book to print.
[04:33:50] tweeeaks: ACTION heh
[04:34:02] jrobeson: a sad lesson to learn here i see :(
[04:34:06] Radar: Mainly typesetting and stuff like that
[04:34:15] Radar: publishing a technical book in print is bullshit. Tech changes too fast.
[04:34:30] Radar: If you want a print copy, pay me a squillion dollars and I will typeset it for you and put it in a pretty binding.
[04:34:40] Radar: But updating that printed copy is pretty hard and time consuming.
[04:35:01] jrobeson: i only want the print book since i don't have a second monitor.. but really i should just get a tablet
[04:36:51] tweeeaks: have multiple monitors, systems, and a couple tablets...but still love a print copy for some reason xD - but you're completely right about tech print books being lame, couldn't agree more
[04:41:36] RxDx: can I install rails 4 on bluehost shared webhosting service?
[04:41:58] Radar: RxDx: Is there anything that is stopping you from doing that?
[04:53:01] s2013: how do i have a rails app without database? from what i saw it said something about changin require 'all' or whatever but i think that might be older one
[04:53:30] s2013: SQLite3::CantOpenException im getting that in production but works fine in dev
[04:53:37] s2013: but i do not even have a database
[04:57:13] s2013: wtf im getting undefined method 'routes'
[05:05:38] CognitiveCorgi: MAy I ask you guys something?
[05:05:40] yaymukund: why doesn't `params.require` work for nested keys, a la `permit`? For example: `params.require(user: [:login, :password])`?
[05:06:08] CognitiveCorgi: Just from personal opinion: Will Windows cause so much trouble I should change my OS?
[05:06:08] sevenseacat: CognitiveCorgi: you just did
[05:06:35] optobear: CognitiveCorgi: in developing in rails, my word
[05:07:01] jrobeson: CognitiveCorgi, you odn't have to change your OS.. but using a virtual machine would be a good idea
[05:07:08] CognitiveCorgi: Yeah that was the reaction to someone trying to teach me.
[05:08:04] CognitiveCorgi: Well, to show me a technique to help me with building a ticketing system. I'm realatively new so he was like "Oh, I'll teach you how to.. oh, windows. Nevermind then. "
[05:08:15] CognitiveCorgi: I laughed, but he was serious and left. :<
[05:08:24] jrobeson: CognitiveCorgi, just install a virtual machine seriously..
[05:08:44] sevenseacat: i would have left too
[05:08:47] CognitiveCorgi: Why thank you three. Thanks jrobeson, will do
[05:08:55] CognitiveCorgi: Thinking mac or ubuntu.
[05:08:56] yaymukund: :( sucks that he wasn't more uhh communicative about why windows was bad. BUT I would generally agree that if you plan to work on ruby, windows is an uphill battle
[05:08:57] optobear: CognitiveCorgi: unix-based systems like linux or os x are massively easier
[05:09:14] jrobeson: CognitiveCorgi, well if you get a mac.. you need a new computer
[05:09:16] optobear: CognitiveCorgi: +1 ubuntu
[05:09:25] jrobeson: there is a lot out there for mac for sure though
[05:09:42] jrobeson: i wouldn't suggest using mac at all without the hardware
[05:09:47] jrobeson: i mean the mac os
[05:09:48] lgarvey: ironically getting started on a windows computer with Rails development is signifcantly easier than on a mac or linux machine.
[05:09:59] CognitiveCorgi: Yeah yaymukund, he was just like "Gahhh.. windows. Well maybe I could try a... I'm sorry, I can't. :p " and left.
[05:10:00] jrobeson: because of rails_installer ?
[05:10:09] jrobeson: never used anyting like that myself
[05:10:25] jrobeson: CognitiveCorgi, why didn't he suggest a virtual machine :(
[05:10:41] yaymukund: CognitiveCorgi: if it makes you feel any better, I know rails pretty well but I wouldn't know where to start with windows either. Based on what you just said, it sounds like he *couldn't* have helped you even if he wanted to :p
[05:11:02] yaymukund: (I haven't used windows pretty much since XP)
[05:11:04] CognitiveCorgi: I know right lgarvey? Grinding through intro tutorials and on all of them the windows tutorials were shorter so it nearly led me to the conclusion windows was the ideal OS for rails.
[05:11:08] jrobeson: if you want the best performance.. you'll want to install the virtual machine's hard drive to a native partition, but you won't need to initially
[05:11:35] jrobeson: windows isn't ideal for any of the open source language development
[05:11:48] lgarvey: CognitiveCorgi: for the 15 minute blog, or some simple development a windows machine will work great. But eventually the tooling and general development environment on windows won't work so well for you.
[05:11:48] jrobeson: python, ruby, php, it's no ideal for any of em
[05:12:29] jrobeson: you might choose to switch officially to some sort of unix eventually.. but unless you wanna plunk down money for a mac, i woudln't recommend trying to overdo it
[05:12:30] lgarvey: CognitiveCorgi: So feel free to get started on windows, but if you continue for long enough with Rails you'll eventually become familiar with linux even if you still use a windows machine for your day-to-day development
[05:12:41] sevenseacat: dammit basecamp - 'last activity 4 hours ago, latest project update september 20', PICK ONE
[05:12:47] CognitiveCorgi: Hm. Well then, regretting not cashing a couple hundred more for a mac. D:
[05:13:01] CognitiveCorgi: Hopefully virtual machine won't compromise performance
[05:13:05] lgarvey: sevenseacat: I thought we'd solved caching issues alreadY?!
[05:13:12] sevenseacat: basecamp hasn't
[05:13:14] lgarvey: sevenseacat: russian doll caching is magic
[05:13:15] jrobeson: CognitiveCorgi, it will.. you should set it up with a antive partition
[05:13:24] jrobeson: a native partition
[05:13:30] jrobeson: then it will be alot less compromised
[05:13:30] lgarvey: sevenseacat: you sprinkle it around and it means your users never see weird shit like that ever..
[05:14:06] jrobeson: sevenseacat, you use basecamp for your companys development?
[05:14:31] sevenseacat: we use basecamp for client liaison
[05:15:02] CognitiveCorgi: Thank you all for being so supportive by the way! Was more than a bit intimidated to ask you all at first.
[05:15:03] sevenseacat: i think its a pile of junk
[05:15:31] CognitiveCorgi: Hm. Thank you jrobeson, will check that out
[05:15:52] jrobeson: CognitiveCorgi, if you wanna be sure not to be imtimidated in the future !ask
[05:16:00] jrobeson: i wonder.. nah.. i overdid it :)
[05:16:04] helpa: CognitiveCorgi: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[05:16:04] jrobeson: CognitiveCorgi, !ask
[05:16:32] jrobeson: you do that.. and people will be more than happy to help
[05:16:40] CognitiveCorgi: Why thank you helpa. :)
[05:16:52] jrobeson: helpa gets all the credit :(
[05:17:21] CognitiveCorgi: Ahah, you've helped a whole lot too jrob! ^^
[05:17:31] jrobeson: well i told helpa to send the link to you.. he's a bot
[05:17:44] jrobeson: he? is that right.. hmm
[05:17:52] jrobeson: is helpa gendered?
[05:22:09] Radar: helpa is a helpa
[05:33:41] CognitiveCorgi: maybe transgendered?
[05:40:44] tagrudev: morning d00ds
[05:43:16] Shidash: I saved the ID of one model (plugin) in an attribute of a different model (step). What is the best way to use the ID saved in step to access attributes in plugin?
[05:43:50] atal421: can i stop rails server from within rails?
[05:43:51] Shidash: I tried <%= Plugin.find(params[step.usedplugin]) %>, but that gives me the error Couldn't find Plugin without an ID for some reason even though step.usedplugin is where the ID is saved in step
[05:44:27] RustyShackleford: do "pros" utilize things like generators/scaffolds, or is it preferable to add/write files yourself as you need them?
[05:45:19] optobear: RustyShackleford: generators, frequently. scaffolds, no
[05:46:02] RustyShackleford: also, how to properly learn ruby?
[05:46:10] RustyShackleford: I know way more about rails than I do about ruby
[05:48:49] optobear: RustyShackleford: generators depends a fair bit on the generator. migrations are always generated, controllers and models not so much. "the pros" weigh up how much of a pita it is to do the generated code by hand vs. how much of a pita it is to remove the stuff they didn't want generated
[06:13:55] lgarvey: RustyShackleford: http://rubykoans.com/
[06:14:01] BrazenBraden: I cannot call a table "Connection" can I :(
[06:15:45] optobear: BrazenBraden: dunno about can't, but doing so would be "brave"
[06:16:33] BrazenBraden: I have one called that but now when I'm trying to do @user.connection.settings I get an error and on further investigation, .connection is a public active record method -.-
[06:16:47] BrazenBraden: I need another "safe" word for "Contact"
[06:17:16] optobear: BrazenBraden: how is Contact a problem?
[06:17:45] BrazenBraden: Contact isnt, but currently, Contact is taken by my engine name.. so everything is within Module Contact
[06:17:55] BrazenBraden: and having a table with the same name confuses Rails
[06:18:31] BrazenBraden: I could rename my engine...
[06:18:48] BrazenBraden: Contact would be a better name for the table
[06:20:06] BrazenBraden: The thesaurus recommends "Intercourse" lololol
[06:23:28] RustyShackleford: if I want to use bootstrap in my project, should I download the bootstrap package or use a gem?
[06:27:10] jrobeson: depends on if you plan on using less or sass or not
[06:27:23] jrobeson: and if you want to be in charge of updating the bootstrap versions yourself
[06:27:28] RustyShackleford: i can't remember which I used the last time
[06:27:35] jrobeson: well you don't have to use any
[06:27:42] RustyShackleford: but I was using one of sass or less
[06:27:52] RustyShackleford: I should have saved that code...
[06:27:53] jrobeson: do you plan on using the features of less or sass?
[06:28:08] jrobeson: i know i do. so i'm using bootstrap-sass
[06:28:09] RustyShackleford: i was using the one with inheritance
[06:28:39] RustyShackleford: so I could make my own .mybutton class which inherits from .buttom
[06:31:27] RustyShackleford: anyway, I need a gem to use sass?
[06:31:42] RustyShackleford: with bootstrap, that is
[06:31:58] sevenseacat: bootstrap-sass? :)
[06:32:26] RustyShackleford: well I'm asking, is there a reason that I need to use a gem to use bootstrap+sass?
[06:32:40] jrobeson: not if you wanna set it all up yourself
[06:32:45] RustyShackleford: could I use the .zip you can download from bootstrap and use sass also?
[06:32:45] jrobeson: and run sass commands yourself..
[06:32:47] jrobeson: and whatever
[06:32:52] jrobeson: i'm sure you could
[06:32:57] jrobeson: but you'll have to go read about how to do it
[06:33:04] jrobeson: i'm not gonna waste my time explaining that
[06:33:15] jrobeson: i just use bootstrap-sass save myself some trouble
[06:33:35] jrobeson: oh.. if you download from bootstrap.. you will have less files.. not sass
[06:33:45] jrobeson: or just only css files with neither less or sass
[06:35:20] linkon: hello guys
[06:35:39] linkon: how to add form fields dynamically in rails
[06:36:41] tigris_: so recently my dev setup has decided when i run `rails generate …` or rails anything for that matter, it just prints the usage and help for a rails new, ignoring my generate or any other command…. this is rails 3.2.14 installed system wide, does anyone know how to debug this? I assume rails does not think i am inside a rails app root folder, even though i am? perhaps i have a file that confuses it or missing a file?
[06:43:39] echosystm: i'm using less-rails and the frigging thing wont reload the cache when i edit files. seems to be a common problem on the googles. has anyone used this and have a solution?
[06:44:36] optobear: linkon: what do you mean?
[06:45:01] krz: are there any issues with running shell commands within the rails application?
[06:45:17] kizzx2: krz: no, in general
[06:45:47] kizzx2: krz: but usually when people want to do that they may try to store states in local file — which could cause problems if you have multiple nodes hosting teh application
[06:46:29] kizzx2: krz: doing that may also make your application less portable — i.e. you can't port directly to Windows (not that i know if Rails runs on Windows or not, lol)
[06:46:44] linkon: <optobear>i have a project that should be access by certain people which i have added them as accessors.but how to give them access dynamically?
[06:47:28] krz: thanks for the input kizzx2
[06:47:59] optobear: linkon: show us your code
[06:50:26] tbuehlmann: booo, no speed improvements for my test suite using ruby 2.1.0preview1 instead of 2.0.0 :)
[06:51:58] linkon: <optobear>i need to develop this code how i am asking?i have no idea on it
[06:55:24] optobear: linkon: try rephrasing your wuestion then, i don't understand it
[07:24:49] BrazenBraden: Struggling to connect models in different engines: http://hastebin.com/pawohiroha.rb
[07:28:50] jacobat: I don't think engines are meant to have associations between them.
[07:30:52] BrazenBraden: As long as you keep the namespaces, it should be fine no?
[07:46:51] jacobat: BrazenBraden: You might be able to make it work, but it seems to be going against the whole idea of splitting things into engines
[07:47:16] BrazenBraden: well, my engines do need at least a single entry point into their respective models
[07:47:41] Cork: to set custom headers with a thin server, do you have to do it in the controller or is there a config somewhere you can set it in?
[07:52:19] Cork: found it => config.action_dispatch.default_headers
[07:54:22] prateekp: is there any way to convert a pdf into xml
[07:55:44] jacobat: BrazenBraden: You can access the model of an engine without an association.
[07:57:35] prateekp: is there any way to convert a pdf into xml
[07:57:42] BrazenBraden: jacobat: yes, but the contact details are specific to a user so I need to get that through the user table..
[07:59:05] jacobat: BrazenBraden: I like to think of it more like "I need to get the contact details for user id N" - and just have a ContactDetail.for_user_id(user_id) method
[07:59:44] BrazenBraden: ok.. so should skip idea of doing something like user.contact
[08:00:25] jacobat: BrazenBraden: You could make a contact method on user if you want
[08:00:50] BrazenBraden: jacobat: I might just do that.. but let me see how what im busy doing works..
[08:10:42] yatish27: Bundler.require(:default) also load the gems inside the group of development and test. How do i stop that ?
[08:18:32] poli: I have a pretty complex SQL query that I would like to run and just assign the result to a variable. How can I do that?
[08:19:08] tbuehlmann: yatish27, it shouldn't do that. are you certain that's the case?
[08:19:55] yatish27: Bundler.require(:default) in rails c production returns the development group gem
[08:20:01] yatish27: tbuehlmann:
[08:20:47] cheeti: after user sign up it's not showing confirmation message why? it's showing You need to sign in or sign up before continuing message.
[08:22:06] tagrudev: certainty, yolo
[08:22:46] tbuehlmann: yatish27, the dependencies listed there do not represent the loaded dependencies
[08:25:39] yatish27: tbuehlmann: but then Y are the development group gem getting loaded?
[08:26:14] yatish27: tbuehlmann: Gem.loaded_specs.keys shows the development gems
[08:28:11] tbuehlmann: that's the case for me on rails 4, too. but they are not loaded at all.
[08:34:05] Georg3: anyone here switch from php to ror or know both?
[08:34:42] Georg3: Were you proficient in PHP or would you switched earlier on in your learning?
[08:38:49] jrobeson: Georg3, i think it's more relevant to know whether one switched from a similiar php framework or not
[08:38:58] Macaveli: Is there a tool that can generate Documentation from my Rails code
[08:39:08] Macaveli: "Basic" Documentation
[08:39:14] jrobeson: if you were already using an mvcish framework ,then the rails structure won't seem out of wack
[08:39:33] jrobeson: what kind of documentation? out of the box rails has a doc task used with rake
[08:40:13] Georg3: jrobeson, hmm ok
[08:40:30] Macaveli: jrobeson what is this doc tasks?
[08:40:41] Georg3: I'm learning PHP, about to branch into the OOP / MVC aspect of it and I'm not 100% sure I want to stay with PHP
[08:40:50] henn1nk: can i fire up an controller method with delayed job? i need this for generating pdf files with wicked_pdf
[08:40:57] Georg3: Python and Ruby on Rails are both very attractive languages
[08:41:47] henn1nk: Georg3: Langues: Python/Ruby. Webframeworks: Django(python), Ruby On Rails(ruby) for example.
[08:41:51] jrobeson: Macaveli, i'm sure some lovely googling would work out great for you
[08:51:17] Georg3: I suppose I'll give Ruby a try and see how I like it
[08:51:35] Georg3: Anyone recommend the Code School courses for Ruby & RoR?
[08:52:06] cheeti: hi will u explain how to asynchronous actionmailer in rails 4? i used delay but its working in development but not in production why?
[08:52:56] Macaveli: jrobeson I'm looking at yard atm
[08:53:03] Macaveli: jrobeson any experience
[08:53:34] jrobeson: you haven't yet specified what kind of docs yet..
[08:55:21] Scient: cheeti: you need something like sidekiq, and it needs to be configured in your production env etc
[08:55:28] Scient: its not magic, it wont work just out of the blue
[08:55:40] Scient: it works for you locally because locally mails are not sent async. in reality
[08:58:17] cheeti: i am running sidekiq with bundle exec sidekiq command. but it's not sending mails in production
[08:58:47] cheeti: <Scient> i am running sidekiq with bundle exec sidekiq command. but it's not sending mails in production
[08:59:06] Scient: are you running the correct queues?
[08:59:49] Macaveli: jrobeson Let's start with flow/diagram documentation
[08:59:55] Macaveli: jrobeson any ideas for that?
[08:59:58] jrobeson: ah i know nothing of that
[09:00:03] cheeti: <Scient> yes i am running mailer queues
[09:00:07] jrobeson: api docs is what that automated stuff does by default
[09:00:24] jrobeson: but you still have to markup your models
[09:01:03] Scient: cheeti: then start by looking at your sidekiq dashboard and logs
[09:01:33] jrobeson: ugh.. i am making am ess of this controller test :(
[09:03:48] cheeti: <Scient> devise confirmation mailer does not showing any error but it's not sending. i followed http://stackoverflow.com/questions/13452020/background-mailing-through-sidekiq-and-devise-async-queue-fills-up-but-mails-ar this url
[09:09:12] lxsameer: i use default scaffold controller of rails, when i try this url "/resources/1.json" my request redirect to "/" why ?
[09:09:21] helpa: lxsameer: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[09:09:21] sevenseacat: lxsameer: !debug
[09:29:16] henn1nk: i added a method "protect_against_forgery?" in my mail_helper.rb but… the application controller seems to load this helper… but i don't want this?
[09:30:52] henn1nk: i don't understand why this helper is loaded :/
[09:34:37] certainty: tagrudev: sub?
[10:10:20] DaniG2k: guys I'm trying to use a bootstrap 3 theme from bootswatch
[10:10:49] DaniG2k: does anyone have any experience in using a theme that isnt bootstraps vanilla one?
[10:11:28] workmad3: DaniG2k: not on bootstrap 3
[10:11:54] universa1: DaniG2k: so what is your problem?
[10:13:14] jrobeson: i've been waiting for the bootstwap gemmy thing to update
[10:13:20] DaniG2k: universa1: its not a problem really. I'm just trying to figure out what to put where. I'm using the bootstrap-sass-rails gem for convenience as it pulls all the css/javascript by itself but, I'd like to use this theme: http://bootswatch.com/spacelab/
[10:14:23] workmad3: DaniG2k: you may get some inspiration from here: https://github.com/maxim/bootswatch-rails
[10:14:34] universa1: DaniG2k: so put the files from the theme into vendor/assets/... and create an appropriate app/assets/application.css.scss where you import the stuff in the proper
[10:14:39] DaniG2k: or at the very least the bootstrap 3 alternate theme (http://getbootstrap.com/examples/theme/)
[10:14:45] workmad3: DaniG2k: but basically, you need to get the variable overrides into place so that they can override the variables in the bootstrap sass file
[10:15:21] DaniG2k: workmad3: ok
[10:15:34] DaniG2k: workmad3: overriding is better?
[10:16:45] workmad3: DaniG2k: better than what?
[10:18:10] DaniG2k: better than removing vanilla bootstrap first
[10:18:16] DaniG2k: since I'm importing the gem now
[10:18:49] workmad3: ok, I'm now confused as to what you're doing...
[10:18:55] jrobeson: DaniG2k, the bootstrap alternative theme is easy to use with bootstrap-sass
[10:19:08] jrobeson: it's just including the theme file.. in your sass file
[10:21:09] roadt: hi, i have a Post model, and has_many Comment, i add 'comments_count'to Post, and in migration i do ' Post.all.each{|p| p.comments_count = p.comments.count ; p.save! }' , but comments_count is always nil. event successfully migrated. is anything i missed?
[10:21:33] roadt: s/event/even/
[10:22:29] MickeySoFine: I'm looking to use paperclip with my app which is on rail 4
[10:22:54] MickeySoFine: I've added the plugin and run the schema migrations etc
[10:23:37] MickeySoFine: I've added the has_attached_file :photo to my model but and updated the views, but when I upload an image its shown as missing
[10:24:04] MickeySoFine: anyone have this happen on rails 4?
[10:25:31] geozin: nested form is not working and has no errors
[10:28:12] helpa: geozin: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[10:28:12] universa1: geozin: !debug
[10:35:31] tbuehlmann: alltime favorite question: what database field type do you use for states ("active", "inactive", "something between") if you don't want to setup an association for them? integers? strings?
[10:36:32] ljarvis: strings, integers are useless for describing a state outside of your app
[10:36:32] henn1nk: attaching an pdf file to a mail… the mail is just a link to the file…. https://gist.github.com/henn1nk/6668810#file-order_mailer-rb-L54
[10:36:54] hamush: does anyone happen to know if it's possible to define dynamically named class methods in an activesupport::concern?
[10:37:30] maloik: hamush: can you give an example ?
[10:38:25] tbuehlmann: ljarvis, I could have a mapping in my model, like a hash
[10:40:01] hamush: i am writing a mixin using activesupport::concern.. i'd like to define a class method that will dynamically define other methods on the class it is mixed into, based on parameters it is passed
[10:40:47] geozin: <universa1> here is my gist https://gist.github.com/anonymous/6668855
[10:44:22] tomoyuki28jp: It seems like re-running a certain rspec test with guard result wrong simplecov output. Is there a way to make it properly? (Sorry to be more complicated, I use parallel_tests together.)
[10:49:44] geozin: <universa1> here is my gist https://gist.github.com/anonymous/6668855 have a look
[10:52:04] ljarvis: tbuehlmann: right, which is useless outside of your app
[10:52:15] ljarvis: tbuehlmann: ie, open up an sql console and run queries
[10:54:14] afrodiziak: hey guys can anyone help me finding out what is going on? i am getting this error with my ror app on heroku https://gist.github.com/lipeno/6ea2cc1d996e6e078dc5
[10:54:28] henn1nk: i am trying to attach an pdf file to my outgouing email. but now i receive the pdf file "inline/plain" in my email… see gist: https://gist.github.com/anonymous/6668973#file-order_mailer-rb-L53
[10:56:11] ravionrails: two resque scheduler apps not work with single redis server, some workaround for it
[10:57:15] ravionrails: i have tried this, but it doesn't work https://github.com/firstbanco/resque-scheduler/commit/d8a680ee05c687d42c812fc1ace4a0feb804001e
[10:57:21] geozin: nested form is not working
[10:57:32] DaniG2k: guys which one is a better rails app deploying solution? Heroku or AWS?
[10:57:43] geozin: here is my gist https://gist.github.com/anonymous/6668855
[10:58:36] DaniG2k: I mean....cheaper :P
[10:58:43] DaniG2k: I'm broke like a joke
[10:58:58] ljarvis: but you'll have to manage deploys (heroku does all that for you)
[10:59:03] ljarvis: so it's a tradeoff
[10:59:16] DaniG2k: I also have a server I pay for yearly with another website
[10:59:23] DaniG2k: but its not cloud and doesnt scale
[10:59:29] ravionrails: geozin, update gist with html rendered
[10:59:31] DaniG2k: i guess I could put my app there for now
[11:00:01] elaptics: DaniG2k: you could try something like digital ocean - that's pretty cheap
[11:00:37] dangerousdave: DaniG2k: so doing stadard deploys will not be a problem for you?
[11:00:39] afrodiziak: hey guys can anyone help me finding out what is going on? i am getting this error with my ror app on heroku https://gist.github.com/lipeno/6ea2cc1d996e6e078dc5
[11:00:51] geozin: <ravionrails> means what?
[11:01:29] ljarvis: afrodiziak: paste your application layout
[11:02:25] ravionrails: geozin, what's the problem you are facing in nested form?
[11:02:39] afrodiziak: ljarvis layout https://gist.github.com/lipeno/ec53c49aa9dd229522bb
[11:02:40] ravionrails: afrodiziak, too bad indentation
[11:03:21] DaniG2k: dangerousdave: Ive never tried
[11:03:26] DaniG2k: dangerousdave: is it difficult?
[11:03:29] ljarvis: afrodiziak: one of the uiToolbox[...] is returning nil
[11:03:48] dangerousdave: DaniG2k: oh, not really
[11:03:52] ljarvis: afrodiziak: nil + "/" will raise the exception you experienced
[11:04:18] geozin: <ravionrails> in my gist 9th line is nested form i am not getting it as input(it does not shows in view)
[11:04:21] ljarvis: "/" + nil rather
[11:04:43] ljarvis: afrodiziak: so either ['css'] or ['js'] is returning nil
[11:05:02] hamush: anybody know of an alternative to define_method() that's not private in ruby 1.8? i'm trying to programmatically define class methods in an activesupport::concern module for mixin to another class
[11:05:13] ravionrails: have u build members on project => @project.members.build
[11:05:15] ljarvis: hamush: no, use define_method
[11:05:27] hamush: ljarvis, what should i do about it being private?
[11:05:30] ljarvis: hamush: it's supposed to be private
[11:05:35] ljarvis: hamush: add a public method that calls it?
[11:05:41] ljarvis: hamush: or use send()
[11:05:57] tbuehlmann: ljarvis, totally get your point. what about "integers after freaking faster! and smaller!"?
[11:06:11] hamush: ah, i didn't realize that send() bypassed class privacy, that sounds like the cleanest approach for my use, thanks!
[11:06:17] ljarvis: hamush: but you might want define_singleton_method
[11:06:37] hamush: oh, thanks, i will read up on define_singleton_method, too
[11:06:47] ljarvis: tbuehlmann: I would say the trade-off isn't worth it, and you can index the column anyway
[11:08:54] afrodiziak: ljarvis right, thanks
[11:09:30] geozin: any body help me for solving nested form
[11:10:18] ravionrails: gist your controller code
[11:11:29] ravionrails: geozin, have you build members on projects in your action
[11:12:15] MickeySoFine: if I have a category model in my engine, when I want to create a relationship in and item model does the category model 'has_many :items' or do I have toappend the name of my engine?
[11:12:57] liquid-silence: hmmm dynamic graphs :(
[11:13:05] liquid-silence: well the data is dynamic
[11:13:10] liquid-silence: the graphs not so much
[11:13:18] MickeySoFine: should it read: has_many :engine_items ?
[11:14:06] ravionrails: MickeySoFine, no
[11:14:24] geozin: <ravionrails> no
[11:14:43] geozin: <ravionrails>is it necessary to build in projects controller
[11:15:38] ravionrails: geozin, just do this and you will get the input (@project.members.build)
[11:15:51] ravionrails: yes it is necessary
[11:16:41] ShinySides: I'm using the railscasts nested form example, but when I call the link_to_add_fields function I get an error saying cant convert symbol into integer, I'm really not sure what the issue is, even if I remove the method from the helper I get the same error, makes me think that the error comes out even before the method is called, this is how I call it = link_to_add_fields 'Add Answer', f, :faqs
[11:17:09] hamush: anybody know if there's an alternative to define_singleton_method() that works with ruby 1.8?
[11:19:10] hamush: nm, i think i found a solution, actually
[11:19:30] liquid-silence: ok so I have a q&a site, the user builds these multiple choice questions, now I want to do reporting on it, but I don't know what questions there will be :(
[11:19:30] geozin: <ravionrails> where these should add
[11:19:44] ljarvis: hamush: just use define_method in that case
[11:19:56] ravionrails: in your new action where you have @project
[11:19:57] liquid-silence: so its more of a architectural thing here, I could build the reports manually and look for specific questions
[11:20:04] liquid-silence: but not sure if thats the best way
[11:20:14] liquid-silence: as he might want to have reports on other combinations of questions
[11:20:28] liquid-silence: so I am thinking a report builder of some sorts
[11:21:40] liquid-silence: maybe I should look at Ruport
[11:23:58] pduersteler: anyone who can recommend a formtastic-bootstrap3 gem/repo that works nicely with both form types?
[11:29:24] hamush: it's looking like define_method() is creating an instance method, but i'd like it to be a class method
[11:32:25] hamush: for my context, send(:define_method) = define instance method on my class, self.class.send(:define_method) = define class method on systemwide singleton Class
[11:32:59] hamush: any additional tips i might try to get a class method defined on the class i'm trying to mix into?
[11:33:40] hamush: in my context self = my class's class object that i want the method defined on
[11:34:05] hamush: but i think activesupport::concern might be messing with things behind the scenes in a way i'm not aware of
[11:35:08] ljarvis: hamush: classes are just instances of Class
[11:35:23] hamush: yeah, i understand that
[11:35:59] hamush: what i meant was that self.class.send() defines a class method on Class and that self.send() defines an instance method on my class
[11:36:32] geozin: <ravionrails> it is visible working nested form for only one check box
[11:36:52] ljarvis: hamush: class A; end; class << A; define_method(:foo) { "bar" }; end; A.foo #=> "bar"
[11:37:16] MickeySoFine: I'm using a url of but my items/_form.html complains that there is no items_path, how can I set the correct one?
[11:37:31] ljarvis: hamush: that was foo is defined on the singleton class of A, it's basically what define_singleton_method does
[11:37:54] MickeySoFine: I have a category_item route instead
[11:37:55] hamush: ljarvis, my situation is complicated (and perhaps this is the root of my problem) by my use of activesupport:concern
[11:38:26] ljarvis: hamush: i dont see how that makes a difference
[11:39:22] hamush: well, with as::c, it expects my class methods to be defined in a module called ClassMethods, which it is
[11:39:27] ravionrails: MickeySoFine, use nested path
[11:39:41] hamush: and in that context, when its executed, self = my class
[11:39:44] ljarvis: hamush: and how are you using define_method? (and why?)
[11:40:04] hamush: but when i call self.send(:define_method), it creates an instance method on my class, which is unexpected
[11:40:22] ljarvis: hamush: right, but you want an instance method on ClassMethods
[11:40:44] hamush: i'm using it inside of a class method in that ClassMethods module , and hoping to define additional class methods on my class
[11:41:04] ljarvis: hamush: then you want it to be an instance method on ClassMethods
[11:41:17] ljarvis: those instance methods are added to the class instance of your class
[11:41:28] hamush: hmmm... will that cause problems for me if i mix that module into other modules that have differently named dynamic class methods?
[11:41:51] ljarvis: hamush: it sounds like you're hitting a dead horse with a dead horse
[11:42:19] hamush: what makes you say that?
[11:43:02] hamush: basically, i want a way to define a set of dynamic methods on a class, similar to how activerecord associations work
[11:43:12] ljarvis: right, again.. instance method on ClassMethods
[11:43:25] ljarvis: all of the methods you add to the ClassMethods module are instance methods
[11:43:56] hamush: agreed, my problem is that since i want my methods to be dynamically named, i have to use define_methods() in my statically named instance method in ClassMethod
[11:44:12] hamush: but for some reason, define_methods() defines an instance method in that case
[11:44:18] hamush: which doesn't make sense to me
[11:44:52] ljarvis: but you want an instance method
[11:45:38] hamush: well, i want to define an instance method that "becomes" a class method on my other class... what i mean is that these dynamically defined instance methods "become" instance methods on my class for some reason
[11:47:13] hamush: so in my debugger, after running self.send(:define_method, :hello) {"hello"}, i can execute OtherClass.new.hello, but not OtherClass.hello, even though self=OtherClass
[11:47:37] hamush: i'm suspecting that as::c is doing something magic behind the scenes that is causing me trouble, my next move might be to take it out of the picture and see what happens
[11:47:50] sevenseacat: thats how define method works?
[11:48:08] hamush: ahh, is there an alternative for defining class methods?
[11:48:18] hamush: (that works in ruby 1.8 ? :)
[11:48:58] sevenseacat: http://stackoverflow.com/a/12782937/560215
[11:49:03] sevenseacat: google is awesome.
[11:49:08] ljarvis: hamush: https://gist.github.com/leejarvis/22d0ef7c53d14889f035
[11:49:31] ljarvis: does that make sense to you?
[11:49:45] ljarvis: that will define the foo method on A
[11:49:53] hamush: sevenseacat, i read and tried that, but in my case it only allowed me to define methods on Class (i'm doing this from a ClassMethods module in an activesupport::concern, btw)
[11:50:07] ljarvis: no you have to open the singleton class of A
[11:50:14] ljarvis: like in my example
[11:50:23] ljarvis: again, that's how define_singleton_method works
[11:50:45] sevenseacat: you tried it wrong
[11:51:42] hamush: hmmm... i wonder if there's a way to do it that wouldn't force me to name my OtherClass in the module... i'd like to use this module in multiple places
[11:52:14] ljarvis: did you even read my gist?
[11:52:22] sevenseacat: well you havent shown a single line of code that you have, sooooo
[11:52:28] ljarvis: just replace A with self
[11:52:44] ljarvis: (class << self; self; end).send(:define_method, m, &block)
[11:52:55] ljarvis: remember self is A
[11:53:15] ljarvis: so you open up the singleton class of A, and then return that singleton class, then call define_method on it
[11:53:18] hamush: ljarvis, yes, i did, thanks for that, thought that you were implying that a specific reference was required
[11:53:29] ljarvis: right, no :)
[11:53:46] ljarvis: also, stop using 1.8
[11:54:02] ljarvis: then you dont have to worry about this crap
[11:54:27] hamush: oh believe me, i would if i could :)
[11:54:52] Macaveli: in methods for what is a "&" used? Like here -> def language_flags_for_anonymous(&block)
[11:55:31] geozin: how to write a this <% for role in User.where(:flag => nil ) %> where flag is nil or flag is 1
[11:56:07] sevenseacat: why do people use for in ruby
[11:56:09] ljarvis: geozin: User.where('flag is null or flag = 1')
[11:56:25] ljarvis: or flag: [nil, 1] but not sure if that would work plus it's ugly
[11:56:34] sevenseacat: dont think it would
[11:56:41] sevenseacat: (havent tested it)
[11:56:45] mikecmpbll: Macaveli: denotes a block/proc/whatever
[11:56:50] DaniG2k: geozin: sevenseacat is right you should probably use .each
[11:57:00] DaniG2k: geozin: and also, that logic should probably be in a controller and passed into the view
[11:57:39] mikecmpbll: ljarvis: why wouldn't it work? looks better to me too.
[11:58:10] sevenseacat: you never tried to do 'something = null' in sql?
[11:58:29] ljarvis: mikecmpbll: i prefer writing it myself, so I hadn't tried it
[11:58:41] mikecmpbll: ljarvis, sevenseacat: well, it does work.
[11:58:51] BrazenBraden: What does it mean when you do something like @var << var ?
[11:58:53] mikecmpbll: rails just blows it out
[11:58:59] BrazenBraden: specifically, the '<<' bit
[11:58:59] ljarvis: BrazenBraden: append var to @bar
[11:59:10] BrazenBraden: ok.. so it makes an array? hash?
[11:59:17] ljarvis: BrazenBraden: << is a method, @var.<<(var) is the same thing
[11:59:31] mikecmpbll: BrazenBraden: it's a synonym for push
[11:59:37] ljarvis: mikecmpbll: no its not
[11:59:41] ljarvis: BrazenBraden: no, it just means @var defines a << method, if it's an Array, that appends var to @var
[12:00:40] ljarvis: BrazenBraden: you can define << on any object you wish fwiw, it's just used commonly for "push this onto that"
[12:00:53] mikecmpbll: ljarvis: interesting. what's the difference between the methods?
[12:00:54] BrazenBraden: okie cool. thanks
[12:01:07] ljarvis: mikecmpbll: you're gonna hate me for calling you on that when i tell you
[12:01:28] mikecmpbll: ACTION prepares to hate
[12:01:31] hamush: ljarvis, i'm pretty sure that did the trick, thanks so much for your help!
[12:01:39] ljarvis: mikecmpbll: << takes a single argument
[12:01:59] ljarvis: mikecmpbll: they're defined as different methods, though (which was my point) :P
[12:02:06] ljarvis: hamush: np
[12:02:28] ljarvis: also, << looks pretty when chained, @look << "ma" << "looks like" << "c++"
[12:17:57] BrazenBraden: would be nice if there was a printable version of the rails guides
[12:18:03] BrazenBraden: like a pdf version or something
[12:22:13] mikecmpbll: BrazenBraden: you can get them for kindle, if you're that way inclined.
[12:22:50] BrazenBraden: mikecmpbll: dont have a kindle.. call me old-fashioned but I like the feel of paper between my fingers
[12:23:00] mikecmpbll: BrazenBraden: old-fashioned.
[12:23:05] sevenseacat: kindles are awesome
[12:23:13] sevenseacat: i would be a lot poorer if i didnt have one
[12:23:31] BrazenBraden: sevenseacat: i dont read enough to warrant getting one
[12:23:37] sevenseacat: ACTION does
[12:24:08] liquid-silence: sevenseacat I also prefer paper back books
[12:24:19] sevenseacat: i dont, they're a pain in the butt
[12:24:24] mikecmpbll: my local library would be a lot poorer for not having all my late fees if I had one.
[12:24:33] BrazenBraden: sevenseacat: but it is so nice to just smell a book sometimes
[12:27:32] liquid-silence: sevenseacat I normally make notes in books
[12:33:44] elaptics: liquid-silence: you can make notes on the kindle too
[12:33:53] liquid-silence: yeah not the same thing :)
[12:34:19] liquid-silence: gah this shit is bugging me now
[12:34:24] elaptics: I know, but fwiw it pisses me off if I buy a 2nd hand book and find loads of notes in it too :)
[12:35:09] Macaveli: Can anyone explain what that "?" does here: klazz = I18n.locale.to_s == code ? "current" : ""
[12:35:21] elaptics: Macaveli: it's a ternary
[12:36:50] elaptics: Macaveli: i.e. single line if / else
[12:36:58] BrazenBraden: is having a model called "System" going to mess me about with Rails internals?
[12:37:20] Macaveli: elaptics thanks now I can investigate further
[12:40:42] boycey: hi everyone. any way to get a resque worker to use less memory? I have 60 workers, eating up 7GB ram completely
[12:41:43] boycey: i need to get around 400 workers
[12:41:55] boycey: how can i reduce the ram a little? =D
[12:42:02] elaptics: boycey: use sidekiq instead
[12:42:34] rvanlieshout: boycey: buy a new server, install > 40gb ram and you're done
[12:43:34] BrazenBraden: is having a model called "System" going to mess me about with Rails internals?
[12:45:09] elaptics: BrazenBraden: don't think it would
[12:45:26] BrazenBraden: elaptics: okie thanks
[12:46:37] universa1: boycey: just out of curiosity: what are your workers doing?
[12:49:16] liquid-silence: ok so I have a resultset object, it has a question_id, answer_id or a value, the user can either enter freeform or select a answer from a list, I now want to build some reporting on it, but I need to do it in a clever way, because I don't really know what the questions are going to be,, what do you guys suggest, I was thinking of a report model that containers the x and y axis questions or something?
[12:50:16] elaptics: cheeti: fail :)
[12:50:47] boycey: universa1: a lot of data processing…
[12:51:05] liquid-silence: universa1 ^^, any ideas?
[12:51:53] universa1: liquid-silence: tbh i'd make an example and see what i want there. do it for some real data, and abstract it out afterwards
[12:52:15] liquid-silence: I have real data, the issue is the user can change the questions at any time
[12:52:28] liquid-silence: so I want to be able to give him the ability to add the graphs
[12:52:48] liquid-silence: so I am thinking of having say he wants average salary per city, per job title
[12:52:51] universa1: liquid-silence: so built the reporting you want now, you'll most likely see why building that
[12:53:07] universa1: how and what you can abstract / generalize it
[12:53:45] liquid-silence: I was thinking, "As a user I want to report on question 1, grouped by question2 and question 3'
[12:54:00] universa1: but tbh.: there are better tools for creating reports over data, so i've personally just gone with a more or less good export facility
[12:54:25] liquid-silence: universa1 its reports that need to display on screen
[12:55:13] ksinkar: How does one access cookies set for a particular path in our rails controller?
[12:55:25] liquid-silence: export functionality will not do anything for us
[12:56:07] ksinkar: Current the Action Dispatch cookie class only allows me to access root path cookies like this 'cookies[<cookie_name>]'
[12:56:20] universa1: liquid-silence: hmm, ask your users what they want? ;)
[12:56:37] liquid-silence: universa1 trying to make it as generic as possible though
[12:56:52] liquid-silence: so he has told me, he wants to report on x y and z
[12:57:02] liquid-silence: so I could make queries etc… like that
[12:57:09] universa1: liquid-silence: ok
[12:57:25] liquid-silence: dev / prod will not have the same id's etc...
[12:57:31] liquid-silence: so its difficult to build reporting
[12:57:45] liquid-silence: based on id's or even if he changes the question name, or the answers
[12:57:57] universa1: liquid-silence: yeah.
[12:58:16] liquid-silence: if the questions where hardcoded then it would be easy
[12:58:17] universa1: liquid-silence: still, i'd just do it for an example, build it out for 3 random questions, see how and what data i need to load how
[12:58:22] liquid-silence: but he has the ability to add questions
[12:58:34] universa1: liquid-silence: and then generalize it from there
[12:58:59] universa1: liquid-silence: given what you said about your structure, you need to do it all in memory anyways, and can't do much in the db :-)
[12:59:21] liquid-silence: I could, write the query for the db
[13:01:25] henn1nk: can't i call two times mail() in a action mailer method?
[13:03:34] MickeySoFine: how come when I create a delete link_to in and engine it doesn't simulate a delete command and instead displays the show action?
[13:04:08] MickeySoFine: it works in inside a normal app
[13:04:30] universa1: MickeySoFine: how does the generated html look like?
[13:05:11] MickeySoFine: universa1: <%= link_to "Delete", item, method: :delete, :confirm => "Are you sure?" %>
[13:05:17] henn1nk: MickeySoFine: http://railscasts.com/episodes/77-destroy-without-javascript-revised
[13:05:27] universa1: MickeySoFine: that is the code that generates html
[13:05:35] universa1: MickeySoFine: that is not the generated html.
[13:06:42] MickeySoFine: universa1: https://gist.github.com/anonymous/6670124
[13:07:35] henn1nk: https://gist.github.com/henn1nk/6670131 this generates just one email :/ - is there no way to call the mail action two times?
[13:08:01] universa1: MickeySoFine: do delete links in your app work? and does the generated html look different from the one from the engine?
[13:11:48] MickeySoFine: universa1: yeah they match
[13:12:09] MickeySoFine: only difference in the first is an engine and the later is an app
[13:12:54] msimkins: henn1nk: What are you trying to do, send to multiple people, or send one email for each attachment ?
[13:13:27] henn1nk: msimkins: diffente attachments for different people, but i have an better idea, i am trying another way atm
[13:13:55] msimkins: henn1nk: OK, let me know what you end up with
[13:19:03] henn1nk: msimkins: ok works perfect
[13:19:26] henn1nk: msimkins: https://gist.github.com/henn1nk/11dbe7edba256983ea0a
[13:20:27] michael_mbp: I'm using instance_eval(&block) instead of yield for a builder pattern, but the problem I'm facing is any assignments made in the block are always treated as local variables rather than calls to the setter! The setter gets called if 'self. is passed as a receiver (means of context).
[13:21:57] boycey: elaptics: thanks =D
[13:25:42] retro|cz: Hello. Can I change logger path on the fly?
[13:26:01] retro|cz: I have multitenant app and I want to have separate logs for each instance.
[13:26:11] michael_mbp: I'm going with yield, at least there' no ambiguity of context when it comes to setting attrs.
[13:27:41] BrazenBraden: in a migration file, how do you declare a belongs_to :table when the table is namespaced behind another engine?
[13:28:14] michael_mbp: oh the table name has the engine name
[13:28:47] michael_mbp: my_fancy_plugin_customers
[13:29:01] michael_mbp: for the MyFancyPlugin gem's Customer table
[13:29:02] BrazenBraden: The Contact table is in the Address engine. The User table is in the User engine. User must reference Contact.
[13:29:34] michael_mbp: so the table names would be address_contacts and user_users
[13:29:56] michael_mbp: you'd want to pass those as :class on your relations
[13:30:14] BrazenBraden: I am doing that inside the model files.. but what about the migration files?
[13:30:35] michael_mbp: just add the foreign key
[13:30:44] michael_mbp: I didn't have to give it any special name
[13:31:11] BrazenBraden: so in my migration, i can just do "t.belongs_to :contact" and then specify the class in my Model file?
[13:31:15] michael_mbp: whether I referred top-level models or models within my namespace.
[13:31:26] michael_mbp: yeah give that ago
[13:31:41] michael_mbp: it has worked for me albeit not across nmespaces, but I think it should
[13:31:49] michael_mbp: worse case, it may need some clarification
[13:31:56] momomomomo: BrazenBraden: Or, you can specify the join_table http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
[13:32:16] momomomomo: BrazenBraden: michael_mbp Popped in the middle of the conversation, but it sounds like that's what you might be getting at
[13:32:18] michael_mbp: i.e. t.belongs_to :address_contact
[13:32:37] BrazenBraden: momomomomo: I thought about that but was hoping the rails associations would bypass that
[13:32:48] michael_mbp: np momomomomo :)
[13:33:06] BrazenBraden: michael_mbp: want it to be just "contacts" so it is "contact_id" in the user table
[13:34:39] michael_mbp: yeah I keep the attribute names like that
[13:37:09] BrazenBraden: omg it works!
[13:37:34] BrazenBraden: I swear I spend more time tweeking my models than I do actually coding lol
[13:37:43] michael_mbp: oh I remember :)
[13:38:03] michael_mbp: I've been bulding a gem for 2 months all TDD
[13:38:09] michael_mbp: integrates into a much larger app.
[13:38:36] michael_mbp: right now I'm toying on another rails plugin.
[13:39:36] BrazenBraden: yea.. the system we building consists of about 12 engines
[13:39:47] BrazenBraden: we looking at over 100 tables..
[13:39:51] BrazenBraden: its a nightmare lol
[13:40:03] michael_mbp: BrazenBraden: it's much easier when everything is modular
[13:40:15] BrazenBraden: i agree, thats why we chose the engine route
[13:40:44] michael_mbp: yeah you get full control, I love it.
[13:41:00] michael_mbp: oh btw, have you setup any config objects?
[13:41:25] greengriminal: Can someone just confirm for me if this is the right way to declare the accept_nested_attributes_for in rails 4. https://gist.github.com/anonymous/6670558
[13:41:31] michael_mbp: Ok so I see how a Config instance is typically used to store the configuration as attrs.
[13:41:52] greengriminal: Was taking a read of: http://www.railsexperiments.com/using-strong-parameters-with-nested-forms/ and matched it to my the gist I sent in
[13:42:09] michael_mbp: I take it this is to allow a change whilst the app is in operation, as apposed to say storing the config statically in YAML or worst case as a Hash right?
[13:42:13] BrazenBraden: greengriminal: it looks good to me
[13:42:31] BrazenBraden: I take it your filters has a has_one rule or something?
[13:43:43] BrazenBraden: michael_mbp: i rue the day I got to start working on the config and setup and linking and stuff
[13:44:13] BrazenBraden: just linking the individual engines together.. although thats kinda what im doing now on a model level
[13:44:37] michael_mbp: well I'm adding in the config ability at the start, right now.
[13:44:47] michael_mbp: it's working nicely using the yield pattern.
[13:45:13] michael_mbp: I tried to go with instance_eval but it's so ambigous re. context esp. when dealing with setters.
[13:45:47] michael_mbp: i.e. for instance evail you'll need to do something like set_option(:foo, 'value') inside the block
[13:46:01] michael_mbp: as foo = 'value' evaluates as a local variable assignment!!
[13:46:14] BrazenBraden: michael_mbp: you shooting over my head lol
[13:46:20] michael_mbp: and self.foo = 'value' just looks lame.
[13:46:30] BrazenBraden: michael_mbp: its ok
[13:46:40] BrazenBraden: michael_mbp: i will end up getting confused and will never get this form done lol
[13:48:58] BrazenBraden: the women in this office are jabbering soo loud I'm having to blast my classical music into my earholes just to block them out
[13:49:50] michael_mbp: I used to work on the IT floor, and the bloody helpdesk phones were driving me insane.
[13:50:00] michael_mbp: need my quiet to think, I quit.
[13:50:28] BrazenBraden: how did you work without a job?
[13:50:32] michael_mbp: oh yeah and there were lots of chatty women.
[13:50:57] michael_mbp: ok no, I quite my job :)
[13:51:15] michael_mbp: tbh I've worked much longer as a consultant.
[13:51:18] le_gars: I how do you empty a table from rails console? On rails 2.3
[13:51:47] BrazenBraden: rake db:reset
[13:52:02] BrazenBraden: that reset the entire dtabase mind
[13:52:06] michael_mbp: that's the whole db though?
[13:52:12] le_gars: I dont want that
[13:52:16] michael_mbp: you can do a truncate via SQL?
[13:52:32] BrazenBraden: yea just use a sql statement
[13:52:36] le_gars: I have a Login table in my db and I would like to reset it
[13:52:41] michael_mbp: or Model.delete_all but you don't reset the id count.
[13:52:44] BrazenBraden: dont know of any rails or rake commands that you can use
[13:52:47] michael_mbp: truncate it then.
[13:53:07] le_gars: Truncate alrite, cheers!
[13:53:36] alx-: michael_mbp: do you use any websites to get clients?
[13:53:37] michael_mbp: ActiveRecord::Base.execute('TRUNCATE TABLE bosses')
[13:53:59] michael_mbp: alx-: I've got http://omakaselabs.com for now
[13:54:50] alx-: looks good
[13:55:27] michael_mbp: le_gars: you might have to do connection.execute()
[13:55:57] michael_mbp: alx-: are you freelancing then?
[13:56:12] le_gars: michael_mbp: ok, thanks
[13:56:56] alx-: michael_mbp: i'd like to either find a job or start freelancing once i finish my current project
[13:57:14] greengriminal: Trying to render out some json and have a normal association going on here. Also have included the accepts_nested_attributes_for rails4 way and am not having any luck: https://gist.github.com/anonymous/6670727
[13:57:19] alx-: i'm not sure how difficult finding clients would be
[13:57:32] greengriminal: The error I am getting is: no such column: filters.rule_id
[13:58:05] michael_mbp: filters is model/table then greengriminal ?
[13:58:30] michael_mbp: have you added the rule_id column?
[13:58:49] michael_mbp: missing migration :)
[13:59:04] greengriminal: Not at all ^_^ going to try something then will let you know
[13:59:54] greengriminal: okay michael_mbp: You will notice there is a mistake on line 15 which is not right
[13:59:59] greengriminal: it should be filter_attributes.
[14:00:54] greengriminal: But regardless this did not resolve this. I most likely am missing a migration then. So I need to do a rails g migation add_rule_id_to_filters rule_id:integer correct?
[14:02:36] michael_mbp: You could have tested this via the console, Filter.first.rule
[14:02:55] michael_mbp: Oh and your model is wrong
[14:02:59] michael_mbp: belongs_to :rule
[14:03:12] michael_mbp: Criterium as well.
[14:04:20] michael_mbp: In Rails lingo (thanks to its inflextion handling) has_many :potatoes but belongs_to :farmer
[14:07:23] Macaveli: Can you show rails code nicely in markdown?
[14:08:46] Macaveli: michael_mbp how exactly with <code> or with something special for rails?
[14:10:22] Macaveli: michael_mbp also possible with highlighting colors as in sublime?
[14:11:05] michael_mbp: Macaveli: see my blog, mwdesilva.com - the code snippets are done in rails (my blog is a rails app)
[14:11:48] et-nid: Does anyone know a good irc channel / web app / anything to find programming jobs?
[14:11:53] et-nid: as in freelance or outsourced?
[14:12:09] michael_mbp: Macaveli: you can use RedCarpet it's a gem
[14:12:19] michael_mbp: and you'll need Pygments for the syntax highlighting.
[14:12:22] Macaveli: michael_mbp I'm currently using Mou
[14:12:37] michael_mbp: But... I think there's a newer pluging for Markdown
[14:13:03] Macaveli: I'll checkout RedCarpet! I want to use markdown to write all my documentation because word does not offer good code positioning
[14:13:16] michael_mbp: Mou is the desktop app yeah?
[14:13:24] michael_mbp: Mmm I do all my blog posts in markdown
[14:13:28] Macaveli: michael_mbp this is correct :)
[14:13:46] Macaveli: michael_mbp you have a new follower :)
[14:14:35] Macaveli: talking about french cuisine i was in Saint Tropez for a week last week #offtopic michael_mbp
[14:14:55] clocKwize: can someone mention @mbaldry on twitter (I'm testing some twitter steaming stuff :D)
[14:15:17] Macaveli: clocKwize pm me and I will do it
[14:15:28] michael_mbp: done clocKwize
[14:15:31] michael_mbp: Macaveli: nice!
[14:15:47] Macaveli: Done here 2 clocKwize
[14:15:53] clocKwize: sweet :) thanks
[14:20:08] TeckniX: michael_mbp: nice
[14:20:16] BrazenBraden: see anything wrong with this?
[14:20:17] BrazenBraden: = f.select("user", "role_id", @roles.collect { |r| [ r.name.titleize, r.id ] }, {include_blank: 'None'})
[14:21:18] michael_mbp: role_id as a string?
[14:21:50] BrazenBraden: michael_mbp: no it is a column name but having :role_id didnt seem to work and the rails api examples all have it in " "
[14:21:58] michael_mbp: yeah that's ok ignore me :)
[14:22:06] michael_mbp: @rolles.all.collect!
[14:22:32] BrazenBraden: @roles = User::Roles.all (in the controller already)
[14:22:39] michael_mbp: that's good then hmm.
[14:22:41] BrazenBraden: getting the error: undefined method `merge' for
[14:22:49] BrazenBraden: cos its not a hash
[14:22:56] BrazenBraden: and array doesnt have a merge function
[14:23:05] BrazenBraden: but i have just replicated the api
[14:23:10] BrazenBraden: *api examples
[14:23:35] michael_mbp: it's complaining I believe re. the option, which is a hash
[14:23:50] michael_mbp: the select method maybe attempting to merge it
[14:24:05] BrazenBraden: it shouldnt... it is supposed to take an array there
[14:24:11] BrazenBraden: no hashes involved in a select
[14:24:23] michael_mbp: select(object, method, choices, options = {}, html_options = {})
[14:24:25] BrazenBraden: @roles.map = same result
[14:24:36] michael_mbp: BrazenBraden: the @roles.map is correct
[14:24:51] BrazenBraden: not .collect then?
[14:24:58] michael_mbp: .map == .collect
[14:25:15] BrazenBraden: this is from the API (copy pasta): select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {include_blank: 'None'})
[14:25:56] michael_mbp: try include_blank: true
[14:26:06] michael_mbp: I doubt that would have much of a difference
[14:26:07] alexander25: hi everyone, since upgrading my rails application to rails 4, with simple_form none of my forms get populated with submitted values
[14:26:18] BrazenBraden: michael_mbp: can be true or a string
[14:26:18] ljarvis: alexander25: did you upgrade simple_form?
[14:26:29] alexander25: i have searched for quire some time to fix this but not able to find the cause, i tried reinstall simple_form but each form fail
[14:26:39] BrazenBraden: michael_mbp: no diff btw
[14:26:40] michael_mbp: ok tell you what
[14:26:44] michael_mbp: gist the error and backtrace
[14:27:00] alexander25: ljarvis: im using gem "simple_form", :github => "plataformatec/simple_form" in my gemfile
[14:27:07] alx-: BrazenBraden: you could give collection_select a try
[14:27:25] ljarvis: alexander25: 3.0.0 has launched, you should use '~> 3.0.0' (not that it would fix your problem, but it's a start)
[14:27:26] michael_mbp: also can you check that @roles.any? is true
[14:27:39] BrazenBraden: michael_mbp: http://hastebin.com/yepiwafici.vbs
[14:28:02] BrazenBraden: alx-: I started with the collection_select but didnt have much luck there.. can try again but looking at the docs, this should work fine
[14:28:07] alexander25: ljarvis: okay thank you I try that, its just strange every form fails app wide must be simple_form issue then
[14:28:22] ljarvis: alexander25: possibly
[14:28:28] michael_mbp: BrazenBraden: always use gist.github.com
[14:28:39] alexander25: simple_form is compatible with rails 4 even?
[14:28:40] michael_mbp: and I know your problem
[14:28:45] ljarvis: alexander25: 3.0.0 is, yes
[14:28:55] ljarvis: alexander25: I use it
[14:29:03] BrazenBraden: michael_mbp: i tried it and dont like it.. i prefer hastebin.. want different syntax highlighting, change the extension at the end
[14:29:13] BrazenBraden: .php | .rb | .txt whatever
[14:29:17] Macaveli: michael_mbp is it possible to add structure to markdown for like example an overview with links to titels
[14:29:40] michael_mbp: you'll have to handle that via partials
[14:29:53] michael_mbp: and do some document parsing.
[14:29:57] alexander25: ljarvis: and your forms do repopulate correctly on errors after form submit? hmm i even reinitialised the initialiser for simple_form and restart my app to no avail
[14:30:38] michael_mbp: BrazenBraden: comment out everything insdie your form block
[14:30:43] michael_mbp: Just leave the select
[14:30:44] michael_mbp: and try again
[14:30:50] ljarvis: alexander25: yeah they work fine
[14:31:05] michael_mbp: hell try putting
[14:31:13] michael_mbp: ["foo", 1] for that 3rd param
[14:31:14] BrazenBraden: all that is inside my form block is a loop to get the systems out
[14:31:35] michael_mbp: go to basics and figure your way from there :)
[14:31:48] BrazenBraden: but this is the basics lol
[14:31:56] BrazenBraden: i will add my view code to the haste
[14:31:58] michael_mbp: did you try my suggestion?
[14:32:21] michael_mbp: select("user", "role_id", ["foo", 1])
[14:32:24] BrazenBraden: michael_mbp: not sure how to strip out the other code cos without the loop, nothing will happen..
[14:32:33] BrazenBraden: and ["foo", 1] doesnt change anything
[14:32:47] michael_mbp: yeah I need your whole view then
[14:32:53] michael_mbp: and gist.github.com please
[14:33:16] BrazenBraden: michael_mbp: Nooooooooo :P http://hastebin.com/lewubehini.rb
[14:33:25] BrazenBraden: gist is annoying
[14:33:32] michael_mbp: god that's horrible!
[14:33:42] BrazenBraden: how so? its beautiful!
[14:33:50] BrazenBraden: my eyes orgasm at the sight
[14:34:01] BrazenBraden: on your period?
[14:34:13] ljarvis: you can't use select("user, "role_id", options)
[14:34:13] BrazenBraden: *on their period?
[14:34:31] BrazenBraden: ljarvis: por que why?
[14:35:07] michael_mbp: the outer form is a form_tag instead of form?
[14:35:21] skroon: when I try to run: rake stats, i'm getting the error "Not a directory - ./spec/factories_spec.rb" anyone seen that one before?
[14:35:22] alx-: BrazenBraden: try select_tag
[14:35:36] michael_mbp: alx-: yeah I was wondering about that.
[14:35:40] BrazenBraden: yes. because form_for wants to use a model object and Im a tad confused cos every object is linked to every other object ;p;
[14:35:45] BrazenBraden: alx-: will do
[14:36:08] michael_mbp: BrazenBraden: for your nested associations you may need to revert to the form way
[14:36:10] BrazenBraden: i just read that if you have nested attributes, you can use the fields_for which automatically give you a form object
[14:36:18] michael_mbp: with _tags you loose that.
[14:36:24] BrazenBraden: michael_mbp: yea i know
[14:36:49] BrazenBraden: thing is.. form_for wants a singular model result..
[14:36:54] michael_mbp: so your outer one will be form_for :users do |f|
[14:37:05] BrazenBraden: im trying to generate a table of a users with edit stuffs
[14:37:10] ljarvis: that won't work
[14:37:20] michael_mbp: nah that's nasty
[14:37:41] michael_mbp: you'll want to iterate around the form_for
[14:37:44] BrazenBraden: table of users with all the systems and possible role selects per system
[14:38:07] michael_mbp: and make sure each form_for has some unique identifier to the user you've just iterated over
[14:38:29] alexander25: so installed the latest version and did a re-init of my simple_form initializer
[14:38:45] alexander25: still app fails to repopulate the form data, im now using a simple feedback form and model to test this
[14:38:55] alexander25: what could cause a rails app to not repopulate its forms?
[14:39:13] sevenseacat: you writing poor code
[14:39:43] liquid-silence: sevenseacat lol
[14:39:49] liquid-silence: you have not even seen his code
[14:40:02] michael_mbp: that's sevenseacat he has amazing insight.
[14:40:04] liquid-silence: alexander25 whats the form_for variable are you populating the model?
[14:40:08] alexander25: the form data *is* submitted
[14:40:14] michael_mbp: and I'm not kidding :)
[14:40:15] BrazenBraden: michael_mbp: but that would mean like 50 forms on the page
[14:40:25] michael_mbp: BrazenBraden: yes it would.
[14:40:30] sevenseacat: i havent seen his code, you are correct.
[14:40:35] BrazenBraden: michael_mbp: isnt that rather... counter-productive?
[14:40:50] alexander25: liquid-silence: Im using = simple_form_for @feedback, :remote => false, :html => { :class => '' } do |f|
[14:41:02] michael_mbp: yes, well you need to re-evaluate your approach then
[14:41:07] liquid-silence: is @ feedback populated?
[14:41:10] michael_mbp: as for the deep nesting.
[14:41:18] AntelopeSalad: does anyone know why applying a concern to a specific get route appends ?concern=fooable to the url and skips running the concern, but the concern itself works fine when applied to a resource?
[14:41:21] liquid-silence: gah simple forms :(
[14:41:22] BrazenBraden: michael_mbp: the nesting is killing me :P
[14:41:39] sevenseacat: simple_form is awesome
[14:41:42] michael_mbp: you'll have to go with a select_tag then
[14:41:50] michael_mbp: and forget the nesting
[14:41:52] alexander25: form data in my console output is Parameters: {"utf8"=>"✓", "authenticity_token"=>"bo+oDHrpFvB7r8N2gsOMGtKR8ohiJhTiZ8bXP8eehao=", "feedback"=>{"message"=>"asdfasdfsadfsda", "category"=>"security", "subject"=>"asdfasdfsad"}, "commit"=>"Submit »"}
[14:42:01] BrazenBraden: michael_mbp: nesting makes the most sense
[14:42:09] michael_mbp: once you get all the params in the POST controller, you can rebuild the nesting there
[14:42:16] alexander25: perhaps because i switched from thin to puma? thats the only reason i can think of nothing has changed
[14:42:22] michael_mbp: you don't HAVE to have it all nested in the form you know.
[14:42:23] sevenseacat: alexander25: show us your code.
[14:42:29] BrazenBraden: michael_mbp: you mean once i get the page to load? lol
[14:42:30] sevenseacat: controller + view.
[14:42:38] michael_mbp: BrazenBraden: no
[14:42:45] michael_mbp: once you submit your form
[14:42:58] rehat: how could I use capybara to select a check box that looks like this https://gist.github.com/rehat/6671467
[14:42:59] BrazenBraden: i need to have a form before i can submit it
[14:43:00] michael_mbp: it will hit a create or update action
[14:43:02] michael_mbp: you can handle it there.
[14:43:30] alexander25: sevenseacat: this is the form haml https://gist.github.com/anonymous/b261ef69a660b247be67
[14:43:53] BrazenBraden: michael_mbp: i think my brain is tired.. its been focused this screen for 4 hours solid
[14:44:07] BrazenBraden: I will come back to this tomorrow I think
[14:44:13] alexander25: and my feedback controller: https://gist.github.com/anonymous/1ec411c7800139ed740f
[14:44:20] BrazenBraden: at least I made progress with my associations :)
[14:44:40] BrazenBraden: now I can do user.contact.person.address.city and it works lol
[14:44:45] alexander25: i updated it to use the strong_params it fails on any form though, also the devise user registration forms fails and several others , its app wide :( and very hard to track down :(
[14:45:23] sevenseacat: alexander25: so what happens when you submit your form?
[14:45:51] mikecmpbll: it fails, duh.
[14:46:03] alexander25: it reloads the form and gives an error *if* i leave any of the required fields empty, but the values of the form fields that where filled in are not repopulated like before in rails 3
[14:46:07] rehat: is there a way to use Capybara check() function to check a checkbox by its value html tag?
[14:46:55] alexander25: even if i fill in any field it says "cannot be blank"
[14:47:08] uhsf: My app is working correctly at my IP address, but at my domain name url, assets are missing. What could be causing this? I have set config.serve_static_assets = true in config/environments/production.rb, using thin.
[14:47:14] alexander25: could it be problem with the model validations i gist my model too perhaps i use some old rails 3 code there
[14:47:40] alexander25: sevenseacat: in my feedback model Im using validates_presence_of :category, :subject, :message
[14:48:16] alexander25: so it basically fails every time on these 3 fields even if i have them filled in it always throws an error and not populate the form input field with the values i entered :( although they are in my rails posts
[14:48:25] sevenseacat: alexander25: so what is @feedback in your controller, after you try creating it
[14:48:36] sevenseacat: let's actually debug it
[14:50:28] MickeySoFine: anyone know why turbolinks is not included in a default engine?
[14:51:10] michael_mbp: no one uses it.
[14:51:25] michael_mbp: well seriously :p
[14:51:32] alexander25: sevenseacat: that is => #<Feedback id: nil, category: nil, subject: nil, message: nil, created_by: nil, created_at: nil, updated_at: nil>
[14:51:40] DoctorMo_: normally if you need to pass a model from within the model -- like an instance method of Foo that calls a method that requires a foo as an argument-- you just use self, eg requires_foo(self)
[14:51:48] sevenseacat: alexander25: so your params arent getting to it properly
[14:51:50] alexander25: so everything is nil very strange i did a raise in create method after the @feedback = Feedback.new(feedback_params)
[14:51:53] DoctorMo_: what do you use if you make the same call from within a concern? base?
[14:52:10] sevenseacat: alexander25: what are your submitted params?
[14:52:11] alexander25: sevenseacat: no correct so it seems only where to look for the cause
[14:52:34] alexander25: sevenseacat: my params are => {"utf8"=>"✓", "authenticity_token"=>"bo+oDHrpFvB7r8N2gsOMGtKR8ohiJhTiZ8bXP8eehao=", "feedback"=>{"message"=>"asdfsad", "category"=>"error", "subject"=>"asdfsa"}, "commit"=>"Submit »", "action"=>"create", "controller"=>"feedbacks"}
[14:52:39] alexander25: just some quick entry
[14:53:16] alexander25: im also using gem "protected_attributes" in my gem file beside the new rails 4 params could that cause issues?
[14:53:23] sevenseacat: ahhhh wtf why
[14:53:25] alexander25: i thought they could be used both together, but now i feel not so sure
[14:54:00] sevenseacat: all these gems meant to put in legacy support, then people wonder why the new stuff doesnt work
[14:54:13] alexander25: removed them, and restarted app and tried but same result :(
[14:54:38] alexander25: sevenseacat: its the only legacy gem i had still in, i thought it could be used in the upgrade fase
[14:55:00] sevenseacat: it can be, but you shouldnt use it and strong parameters at the same time
[14:55:11] sevenseacat: which are you using
[14:56:34] alexander25: i did not correctly restarted, ugh that really seems to be the issue
[14:57:12] alexander25: just came to mind after the debug ;p a bit on the wrong side of the debug chain ;p had it be my first idea it would saved some time thank you for the support ;;p
[14:57:20] sevenseacat: you were passing your model a bunch of params, your model was silently dropping them because you didnt specify attr_accessible
[15:01:09] MickeySoFine: why would "data-turbolinks-track" => true be left out of my application.html.erb went I make and engine and not an app?
[15:01:53] Flashmasterson: i'm at '1.2 up and running' portion of the rails tutorial and am getting this message when i enter the supplied code into the terminal: ".gemrc: command not found"
[15:02:04] alexander25: im also try to get rails 4 to work with r spec it crashes on every run, using rspec-rails gem
[15:02:39] alexander25: anyone has r spec and rails 4 working correctly together?
[15:03:04] universa1: alexander25: yes.
[15:03:30] universa1: Flashmasterson: .gemrc is a file, not a command
[15:03:33] greengriminal: Trying to wrap my head around writing a controller spec for a nested attribute. However I feel as though it is incorrect: https://gist.github.com/anonymous/6671782
[15:03:38] alexander25: If i post my stracktrace could you guys help me a bit to get it to work? Spend an hour yesterday trying to digg into the cause of the issue
[15:03:48] universa1: Flashmasterson: link
[15:04:00] alexander25: running bin/rspec throws /config/environments/test.rb:1:in `<top (required)>': uninitialized constant Version (NameError) but that is not full trace
[15:04:01] greengriminal: Have been looking at similar questions on stack but their more pointing to model test. I don't want to do this.
[15:04:26] kaneda^: hey all, is it possible to render a template into a variable instead of actually rendering it?
[15:04:36] ksinkar: Currently the Action Dispatch cookie class only allows me to access root path cookies like this 'cookies[<cookie_name>]'. Does anyone know how to access a cookie with a given path?
[15:04:47] kaneda^: as in, if i have a view, i want it to give me the completed HTML into a variable instead of rendering it
[15:05:24] Flashmasterson: universa1: ok is this step even necessary? the tutorial says the latest version of rvm should include the rubygems under that section
[15:05:59] universa1: Flashmasterson: as i don't know where exactly you're i can't tell. post a link please.
[15:06:27] alexander25: ah nevermind i found solution, i copied test.rb from another project named "Version" so that was causing issue wrong namespace
[15:06:50] Flashmasterson: universa1: i see, the file isn't online; it's a pdf
[15:07:37] Flashmasterson: universa1: this is the text: "Listing 1.1. Creating a gem configuration file.
[15:07:38] Flashmasterson: Here subl is the command-line command to launch Sublime Text on OS X, which you can set up using the Sublime Text 2 documentation for the OS X command line. If you’re on a different platform, or if you’re using a different editor, you should replace this command as necessary (i.e., by double-clicking the application icon or by using an alternate command such as mate, vim, gvim, or mvim). For brevity, throughout the rest of this tutorial I
[15:07:38] Flashmasterson: Listing 1.2. Suppressing the ri and rdoc documentation in .gemrc.
[15:07:38] Flashmasterson: Once you’ve installed RubyGems, installing Rails should be easy. This tutorial standardizes on Rails 3.2, which we can install as follows:
[15:07:38] Flashmasterson: To check your Rails installation, run the following command to print out the version number:
[15:07:39] Flashmasterson: $ subl ~/.gemrc
[15:07:40] Flashmasterson: install: --no-rdoc --no-ri
[15:07:40] Flashmasterson: update: --no-rdoc --no-ri
[15:07:47] kaneda^: the other option is that i actually have it request the web page via Net::HTTP or something
[15:07:50] kaneda^: and then i store the results
[15:08:03] kaneda^: but that seems silly, i have all the info it needs to render, i just want to ship that page instead of rendering it
[15:09:40] Zander: anyone have experience with the rapns gem ?
[15:10:08] kaneda^: right now it seems like if i want to avoid a net request to get the full HTML that would be rendered i'll have to rewrite the logic for the render in the controller to create the HTML before shipping it
[15:10:28] kaneda^: i have to assume that there's like an HTML preview for render :template => "foo/bar"
[15:10:30] universa1: Flashmasterson: just ignore that or replace subl with cat
[15:10:30] liquid-silence: Flashmasterson wtf?
[15:10:59] universa1: Flashmasterson: the .gemrc file contains global settings for installing gems
[15:11:36] Zander: Anyone have experience with the rapns gem ? very little info on the next
[15:11:43] universa1: Flashmasterson: you don't necessarily need one, but since many aren't using the supplied docs/ri stuff locally anymore, many disable it like shown in your excerpt ;)
[15:12:51] Flashmasterson: universa1: hmmm ok, but the next step (installing rails) generated an error in my terminal. not sure if it's connected with what you just said.
[15:12:52] soahccc: Just would like to get some opinions about this capistrano approach. Curious if I should make a release of that, currently we're just using it internally... https://gist.github.com/2called-chaos/bfa60758a70e6964a060
[15:12:58] Flashmasterson: universa1: it reads:
[15:13:42] universa1: soahccc: had a look at caphub ?
[15:13:47] Flashmasterson: universa1: "Install Rails
[15:13:47] Flashmasterson: Once you’ve installed RubyGems, installing Rails should be easy. This tutorial standardizes on Rails 3.2, which we can install as follows: gem install rails -v 3.2.7"
[15:13:51] helpa: Flashmasterson: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:13:51] momomomomo: Flashmasterson: !gist
[15:14:24] kaneda^: so, any ideas on how to render TO a variabl?
[15:14:27] kaneda^: s/variabl/variable
[15:14:37] Flashmasterson: helpa: ah this is nice, thanks
[15:14:54] universa1: kaneda^: render_to_string
[15:15:03] universa1: Flashmasterson: !auto
[15:15:28] rikkipitt: hey guys, anyone use rails_admin?
[15:15:29] universa1: anyways: gtg :-)
[15:15:34] helpa: rikkipitt: Nope. No one. Ever. In the history of the world.
[15:15:34] universa1: rikkipitt: !anyone
[15:15:38] Zander: Anyone have experience with the rapns gem ? very little info on the next
[15:15:56] universa1: Zander: see above ;) also:
[15:15:57] helpa: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[15:16:01] kaneda^: universa1: you rock, thanks
[15:16:37] rikkipitt: I'm looking to find out if I can edit the drop down select column (and possibly add another column in brackets) in rails_admin
[15:16:43] Zander: #universa1 cant see can you post again
[15:16:45] Flashmasterson: i get this message when entering "gem install rails -v 3.2.7" : ERROR: Error installing rails:
[15:16:45] Flashmasterson: ERROR: Failed to build gem native extension.
[15:17:04] kaneda^: Flashmasterson: could be missing libraries or gcc stuff
[15:17:23] rikkipitt: universal1 & help, thanks duly noted. I'm new to the ruby on rails irc
[15:17:27] Flashmasterson: kaneda^: ok how do i find out for sure and fix it?
[15:17:29] soahccc: universa1: Looks interesting, it's not really about the recipes (I could just copy over a lot out of recipe collections) but more the helper sort of style (like the symlink thing which expands to 3 commands executed on the remote side)
[15:17:52] universa1: soahccc: yeah, i figured the same after looking more closely at it :-)
[15:18:17] universa1: soahccc: it looks interesting, but i've the feeling many are moving away from capistrano ;)
[15:18:25] uhsf: Why thin serves assets correctly at my IP address, but not at my domain name url?
[15:18:44] universa1: uhsf: differences between development and production env
[15:19:01] soahccc: universa1: uhm to what? puppet and stuff or is the world hiding a secret? :D
[15:19:04] uhsf: universa1: both are production
[15:19:13] kaneda^: Flashmasterson: try the --verbose and --debug flags
[15:19:22] momomomomo: Flashmasterson: Paste your errors into http://gist.github.com
[15:21:38] mikecmpbll: uhsf: what happens when it doesn't work …
[15:22:06] rikkipitt: rails_admin, has_many/belongs_to etc selectors - is it possible to add fields to the drop down to help clarify options?
[15:24:10] mikecmpbll: rikkipitt: what does it have by default?
[15:24:10] momomomomo: universa1: I use capistrano for deployments, and had no idea there was a tide of change to something else. Care to elaborate?
[15:24:48] rikkipitt: hi mikecmpbll: from what I gather I think it uses name/title (if in the db) or possibly the first column if not
[15:25:03] mikecmpbll: and you want to include values that aren't in the DB?
[15:25:17] alx-: rikkipitt: see grouped_collection_select
[15:25:41] Flashmasterson: kaneda^: ok so i just enter —verbose or —debug into the terminal?
[15:25:44] rikkipitt: mikecmpbll: nah, something like "title (subtitle)"
[15:25:53] momomomomo: Hello nongeek
[15:25:54] kaneda^: Flashmasterson: alongside your gem install, yes
[15:25:59] rikkipitt: thanks alx-: will do
[15:26:00] nongeek: Can I find RoR creator here?
[15:26:02] soahccc: momomomomo: I guess either to puppet/chef or simpler things (capistrano from scratch is not really easy)
[15:26:04] momomomomo: Flashmasterson: gem install rails -v '3.2.13' --verbose
[15:26:19] DaniG2k: nongeek: the creator
[15:26:36] DaniG2k: nongeek: the creator is omnipresent
[15:26:40] momomomomo: soahccc: It's not exactly hard mode either, once you've got one deployment with it up; but, I do want to learn more about chef/puppet :o
[15:27:22] nongeek: my mean is Ror creator
[15:27:32] mikecmpbll: nongeek: no.
[15:27:46] nongeek: he don't use IRC?
[15:27:57] DaniG2k: nongeek: I doubt he's here
[15:27:57] mikecmpbll: lots of people created Rails, but I guess you mean DHH
[15:28:12] DaniG2k: nongeek: where are you from?
[15:28:26] nongeek: a very far country
[15:29:05] soahccc: momomomomo: Yeah if you have it one time you just start to copy and paste it (this is why I created cap4us for us). I never got used to chef/puppet but it's to overkill for our few servers imho.
[15:29:43] mikecmpbll: iran. but anyways, nah you won't find him here.
[15:29:49] nongeek: DaniG2k: Can I send Pm?
[15:29:51] rikkipitt: mikecmpbll: / alx-: I don't think grouped_collection_select is what I'm after in rails_admin…
[15:29:55] momomomomo: soahccc: My thoughts exactly, I should extract my stuff into a plugin, but new deployments internally are few
[15:30:01] soahccc: Btw are people still using unicorn? Saw some movements there as well but I like my unicorn :<
[15:30:46] nongeek: mikecmpbll: Yeah, is it a problem?
[15:30:46] mikecmpbll: rikkipitt: i still don't know exactly what you're trying to change
[15:30:49] soahccc: momomomomo: We don't have that much new projects as well but I was sick of copying new, useful tasks to older projects :)
[15:30:54] mikecmpbll: nongeek: no, it's not a problem?
[15:31:03] momomomomo: soahccc: I use unicorn - sometimes knowing how it works for small deployments is worth it over jumping to puma for a small user base
[15:31:14] nongeek: I want to help Ror project as a translator
[15:31:35] nongeek: but I don't know how can I do it :(
[15:31:50] nongeek: mikecmpbll: Can you guide me?
[15:31:50] momomomomo: nongeek: that's great - most interaction with the codebase happens on the github repo: https://github.com/rails/rails/
[15:32:17] mikecmpbll: nongeek: http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation
[15:32:34] Flashmasterson: momomomomo: thank you
[15:32:34] soahccc: momomomomo: We could handle a lot with unicorn so far (we survived a TV spot to a somewhat good time with just ONE server :) ) so we never saw a reason to switch
[15:32:41] mikecmpbll: nongeek: https://github.com/rails/docrails/wiki/translating-rails-guides
[15:33:14] momomomomo: soahccc: Aye, that's kind of my thoughts, but I hear puma is pretty quick… and it looks easier to deploy - I should give it a try sometime
[15:33:22] nongeek: mikecmpbll: Can I ask some questions via pm?
[15:33:33] Flashmasterson: kaneda^: the —debug command is more clear but what does the —verbose command do?
[15:33:39] momomomomo: Would be interested to hear from anyone not using unicorn at the moment (unless you're using passenger, then no me gusta)
[15:33:49] kaneda^: Flashmasterson: makes it more verbose
[15:34:08] rikkipitt: mikecmpbll: I'll try and clarify… Model A has a related model B, in rails_admin model A will show a drop down or multiselect so you can associate models. It shows the name or title column from Model B in the drop down. I was wondering how configurable those select options are in terms of text
[15:34:29] mikecmpbll: rikkipitt: i see
[15:34:57] Flashmasterson: kaneda^: hahaha alright
[15:35:14] mikecmpbll: https://github.com/sferik/rails_admin/wiki/Railsadmin-DSL
[15:35:44] mikecmpbll: Look under "Fields - Output formatting"
[15:36:01] rikkipitt: thanks mikecmpbll: I'll see if I can figure it out
[15:36:55] soahccc: momomomomo: Did you ever find out about the trick to speed up USR2 reloads? :)
[15:37:35] nongeek: mikecmpbll: Can you help me about jobs too?
[15:37:44] mikecmpbll: nongeek: what about them?
[15:37:45] Flashmasterson: kaneda^: it's more verbose, and i entered the debug flag as well but am still getting "ERROR: Error installing rails:
[15:37:45] Flashmasterson: ERROR: Failed to build gem native extension." at the end of each
[15:38:06] nongeek: mikecmpbll: How can I finding a job after rails
[15:38:48] momomomomo: soahccc: I use kill :QUIT : :TTOU
[15:38:51] momomomomo: quit or ttou
[15:38:55] mikecmpbll: nongeek: I have no idea, in that part of the world.
[15:38:56] soahccc: momomomomo: Took me a while but I18n added a huge delay to the first served request for each worker so I did a I18n.t("foo") in the after_fork
[15:39:11] nongeek: Ok, Thank you
[15:39:51] momomomomo: soahccc: Not sure I follow - were you talking about killing your workers with USR2?
[15:40:07] mikecmpbll: Flashmasterson: have you gisted the entire error yet?
[15:40:36] nongeek: mikecmpbll: Do you have your own company?
[15:40:41] mikecmpbll: nongeek: nope.
[15:40:53] nongeek: Are you a raisl developer?
[15:40:57] mikecmpbll: nongeek: yes.
[15:41:06] nongeek: Can I see your github?
[15:41:29] soahccc: momomomomo: yes, that is how we do our zero downtime deployment
[15:41:31] momomomomo: soahccc: I follow now - you're just speeding up the first request by processing a fake one after fork
[15:41:59] Flashmasterson: mikecmpbll: i haven't but will now
[15:42:08] soahccc: momomomomo: Not really a request but I18n doesn't get loaded with the application and depending on it's usage you save like 4-8 seconds
[15:42:27] momomomomo: soahccc: right on
[15:43:54] soahccc: momomomomo: just curious but what is :TTOU supposed to mean?
[15:46:01] momomomomo: soahccc: http://unicorn.bogomips.org/SIGNALS.html
[15:46:33] Flashmasterson: mikecmpbll: alright here it is https://gist.github.com/Flashmasterson/6672521
[15:47:20] mikecmpbll: Flashmasterson: lmfao. worlds longest error.
[15:47:24] soahccc: momomomomo: Oh I see :)
[15:47:55] Flashmasterson: mikecmpbll: no kidding
[15:48:14] Flashmasterson: mikecmpbll: an open wound
[15:48:33] DaniG2k: someone send me something funny please
[15:48:38] DaniG2k: time is going by SO SLOWLY
[15:48:54] soahccc: If somebody is interested, just found an old video logstalgia+tv spot... First minute contains the interesting part, no sound => http://www.youtube.com/watch?v=zvm1BU8XgLs
[15:49:00] breakingthings: Please rate my service on a scale of 1-Infinity on my website breakingthingscomedygold.com
[15:53:20] momomomomo: cmooooooon specs
[15:53:40] Flashmasterson: mikecmpbll: can you even do anything with that?
[15:54:08] mikecmpbll: Flashmasterson: make; sh: make: command not found
[15:54:11] manvsmachine: Hey can someone maybe help me out with a web fonts / asset pipeline problem?
[15:54:31] mikecmpbll: Flashmasterson: what environment?
[15:54:57] Flashmasterson: mikecmpbll: i wish i knew what 'environment' was, i'm very new to this
[15:55:13] Flashmasterson: mikecmpbll: yeah mountain lion
[15:55:19] mikecmpbll: Flashmasterson: have you installed XCode
[15:55:32] momomomomo: Flashmasterson: Are you trying to install with chruby, rbenv, rvm, or?
[15:56:31] levberlin: Hi Guys, if anyone wants more personalized Rails help, I'm around all day to videochat/screenshare at https://onscreenexpert.com. Just search for "lev" or "rails". Totally free, just trying to get some feedback on the site in exchange :)
[15:56:36] Flashmasterson: momomomomo: i think rvm, whatever the rubyonrails tutorial says
[15:56:52] Flashmasterson: mikecmpbll: no not yet, is that necessary and free?
[15:56:57] momomomomo: Flashmasterson: https://rvm.io/rvm/install
[15:57:22] mikecmpbll: Flashmasterson: yes.
[15:57:30] Flashmasterson: momomomomo: i tried that and it just confused me a lot, maybe soon
[15:58:36] mikecmpbll: Flashmasterson: the first line of your error is: Exception `NameError' at /Users/toreystriffolino/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/... which shows that you have ruby 1.9.3 installed with RVM.
[15:58:40] mikecmpbll: or at least partially.
[15:59:18] Flashmasterson: mikecmpbll: ok and installing/using xcode will install it fully?
[15:59:30] mikecmpbll: Flashmasterson: who knows, but it will certainly give you make
[15:59:52] mikecmpbll: Flashmasterson: AppStore -> install XCode -> open XCode -> preferences -> Install Command Line Tools.
[16:02:51] DoctorMo_: another weird question -- I have a user that can "watch" things (basically subscribe to them). The things are different. Right now users can watch both Foos and Bars, and in the future they are likely to be able to watch other arbitrary things. So I want a has_many association with all the different things, eg has_many :watched_things -- what is likely to be my best route?
[16:03:17] mikecmpbll: DoctorMo_: polymorphic association.
[16:03:23] DoctorMo_: there is already an association of has_many watchings
[16:03:29] DoctorMo_: mikecmpbll: it's more complex than that
[16:03:35] mikecmpbll: DoctorMo_: why?
[16:03:45] DoctorMo_: I have a Watching model, that's polymorphic
[16:04:00] DoctorMo_: watchings have watchable_id and watchable_type
[16:04:08] mikecmpbll: DoctorMo_: okay.
[16:04:17] DoctorMo_: so there's your polymorphism
[16:04:25] mikecmpbll: DoctorMo_: so what's the problem?
[16:04:35] DoctorMo_: now I want a has_many :through style association
[16:04:41] DoctorMo_: with the actually watchable things
[16:04:55] DoctorMo_: in one collection, ordered in the database as if they are all the same type
[16:05:06] mikecmpbll: DoctorMo_: why?
[16:05:28] DoctorMo_: well, because they all need to be listed and paginated in the same index
[16:05:37] mikecmpbll: doesn't mean you need them in the same table.
[16:05:44] DoctorMo_: they aren't in the same table
[16:06:15] mikecmpbll: DoctorMo_: you're either explaining yourself terribly, or i'm being thick. whether anyone else has an idea what you're on about will confirm that either way.
[16:06:20] DoctorMo_: what I mean is that they need to be sorted on the db side instead of in memory
[16:06:47] mikecmpbll: sorted by what?
[16:07:06] DoctorMo_: eh, that gets complicated, let's just say updated_at
[16:07:17] DoctorMo_: I'm putting together a gist right now, hang on
[16:07:37] momomomomo: mikecmpbll: I'm lost, but not really following that well either
[16:07:54] mikecmpbll: I'll take that.
[16:08:13] DoctorMo_: it'll be clear from the gist, one sec
[16:11:21] DoctorMo_: https://gist.github.com/PeteMichaud/1a13fc76c792447e266f
[16:13:08] pwz2000: I am receiving a NoMethodError undefined method `paginate' for users controller. Pointing to @letsgos = @user.letsgos.paginate(page: params[:page]). My show page has <%= will_paginate @letsgos %> . Is there something wrong my coding?
[16:13:10] DoctorMo_: so I guess I could fake this by making my own watched_topics method on the User object and writing a potentially complex query... I'm asking if there's a better way?
[16:13:57] pwz2000: obviously there is something wrong. Looking for a fix lol
[16:14:09] DoctorMo_: pwz2000: is it saying the nil class has to method 'paginate'?
[16:14:38] pontiki: pwz2000: please show real code and real error / trace
[16:15:14] mikecmpbll: DoctorMo_: you can do your has_many :through association. but I take it that's not what you want?
[16:16:02] momomomomo: Another Mo :o
[16:16:35] momomomomo: weird, as my twitter is DrMomer
[16:16:38] DoctorMo_: mikecmpbll: I don't know how to be more clear about what I'm asking. In effect, I want a has_many :through association, but I want that association to contain models of various types (determined by the watchable_type ). has_many :through normally contains collections of exactly 1 concrete type, which is NOT what I want
[16:17:11] mikecmpbll: DoctorMo_: you can't create associations that return heterogeneous collections
[16:17:12] alexander25: hey guys i have some custom code to split routes in /config/routes/* but this breaks my r spec
[16:17:19] mikecmpbll: DoctorMonocular: afaik.
[16:17:19] alexander25: the stack trace is https://gist.github.com/anonymous/b422abc057e3be3177f9 anyone idea how i could fix this?
[16:19:09] helpa: alexander25: 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:19:09] momomomomo: alexander25: !code
[16:21:29] alexander25: momomomomo: this https://gist.github.com/anonymous/7b0f37ebf91818b9be58 initialiser makes it possible
[16:22:00] alexander25: but that breaks when i try to run bin/spec with this error https://gist.github.com/anonymous/b422abc057e3be3177f9/raw/e8b3b89e8d2500887361e67bfcf33179d171f512/gistfile1.txt
[16:22:15] alexander25: its a bit to much rails internals for me to pinpoint what exactly goes wrong i don't get that message
[16:22:54] MickeySoFine: how to I force my engine to use the layout of the app thats using it?
[16:23:14] alexander25: perhaps that initialiser is not even causing the issue anyways r spec fails to run :(
[16:23:52] alexander25: exact error is /gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil:
[16:24:00] alexander25: anyone who can make sense of that error message ;)
[16:24:19] momomomomo: alexander25: Not without digging in for more time thanI have available at the moment, sorry - someone else might be able to help
[16:27:23] mikecmpbll: alexander25: you will usually get a long way by googling error messages
[16:27:36] ryannielson: Is there a way to add an error to a form in a custom validation that's not attached to an attribute?
[16:27:53] alexander25: mikecmpbll: found out it might be a devise issue so made sure i have the 3.1.0 version which i have but don't resolve sadly
[16:28:35] alexander25: the whole error line did not return anything good but cutting it up i found out this is known issue with devise in previous versions, perhaps ./bin/rake does not run inside my project scope? using the bundle devise version?
[16:28:37] mikecmpbll: ryannielson: errors.add(:base, "message")
[16:29:22] ryannielson: mikecmpbll: Great, thank you
[16:29:36] naquad: is there some high level wrapper on Net::SSH? i need just run command
[16:35:52] gabebug: should AcitveModel::Model have all the validation code necessary in rails 4? i'm defining a form object, and although all the methods are there for validation, it does not appear to be triggering: https://gist.github.com/gabetax/6673248
[16:37:52] gakins: Hitting a bit of a brick wall. I have a database in production that I can't access in development. I'd like to use mocks to simulate the database.. using Mocha in development.rb now.. but anytime I use the ActiveRecord::Base object, I get an error that the database isn't available Does anyone have any suggestions for substituting mocks for real database objects in development?
[16:38:31] gakins: And.. I should mention it's Ruby 1.8.7 and Rails 2.1
[16:39:18] godd2: I'm trying to follow the Railscast for nested attributes, and he uses a method called build, but I have no idea where that method came from. Can anyone shed some light?
[16:41:39] gabebug: gakins: can you come up with an example of your app code and your tests that are mocking? i think the answer lies on how thoroughly you're mocking/stubbing the active record class. if your tests need integration, can you build out a phony table in your test database to mimic your production database?
[16:42:44] roadt: hi , is it possible to make a full engine to override app 's view files?
[16:43:07] roadt: e.g. to implement a 'Mod engine' to the main app.
[16:43:10] godd2: I figured it out. It had to do with the difference between has_one and has_many for building.
[16:44:01] gabebug: godd2: can you think to the exact snippet in the asciicast of it for reference? are you referring to the 'builder' yielded by f.fields_for ?
[16:44:41] gakins: gabebug: Thanks. https://gist.github.com/akinsgre/6673364 I could build some tables in my dev database, but for this example.. I'm only getting a single value. It seems like overkill to create a database structure just for that.
[16:45:14] godd2: Railscast #196 @4:50
[16:46:01] godd2: But I did end up figuring out my confusion with a bit of googling: http://stackoverflow.com/questions/2472982/using-build-with-a-has-one-association-in-rails (top answer)
[16:47:25] gabebug: gakins: so what may be causing the issue is the second you do EmployeeID.new, active record is trying to connect to the database to fetch the schema to know what attributes to define on the model
[16:47:26] pwz2000: nvm idiot me needed to restart server
[16:48:16] gakins: gabebug: Yeah.. I figured that.. so I'm wondering if I can avoid that by doing something differently with the mocks.. or the configuration
[16:48:30] slash_nick: That's DocMonoc
[16:48:45] slash_nick: momomomomo: ^ (damn, i was paged up several pages)
[16:49:41] gabebug: gakins: one option would be to work purely with a mock object instead of returning EmployeeID.new. there _may_ be a library that lets you stub out some of active record's internals, but i haven't had to go that route before
[16:52:20] gakins: gabebug: Thanks I don't really need an object, I just need the value from the database.. so I might have to write some of my own app code to work from the classes instead of instances.
[16:52:25] cesarstafe: hi people.. I am trying to upgrade an old app from 3.0.6 to rails 3.2.13 and I had some issues with "dynamic_matchers.rb:55:in `method_missing': undefined method `class_inheritable_accessor' for ActiveRecord::Base:Class (NoMethodError)" ... somebody here that can have a clue about how to solve it?
[16:54:55] TeckniX: hello peeps - I have a hash that sometimes contains data, sometimes doesn't - I do myHash.has_key("text")? to see if a key exists, but if the hash is empty, then i get a 'nilClass' error - is that normal behavior? YAML debug is myHash: when it's empty
[16:55:41] TeckniX: cesarstafe: http://stackoverflow.com/questions/6617769/how-do-i-replicate-class-inheritable-accessors-behavior-in-rails-3-1
[16:56:39] cesarstafe: TechniX: thanks!
[16:56:49] tbuehlmann: TeckniX, that's not normal. whether or not the hash is empty, you will have a hash and calling #key? will work
[16:57:13] TeckniX: tbuehlmann: that's what I figured - just not sure why the error then
[16:57:29] interactionjaxsn: DoctorMonocular: it seems that you have to set up a belongs_to :watchable, polymorphic: true on each of the things you want to watch. And from the user establish a has_many :tasks, as: :watchable. also set up the references association on the table. so from tasks. t.references :watchable, polymorphic: true
[16:58:26] makerbreaker: if anyone needs a freelancer, i have nothing in the pipeline
[16:58:35] makerbreaker: adn am looking for a bit of work
[17:00:52] TeckniX: tbuehlmann: just added myHash.empty? and instead got "You have a nil object when you didn't expect it"
[17:01:10] tbuehlmann: your hash is nil then?
[17:01:29] TeckniX: tbuehlmann: but debug shows it as myHash:
[17:01:43] TeckniX: maybe I just need to check if nil and call it a day
[17:02:46] interactionjaxsn: TeckniX: myHash.fetch( :key ) { do something here if nothing }
[17:03:13] TeckniX: interactionjaxsn: I'll try that - thanks
[17:05:54] tbuehlmann: that won't do if the hash is nil..
[17:06:04] bobbobbins: hey, i have this single line of code: https://gist.github.com/bobbobbins/a28fcbdd3d6bfce1f01d and its working fine to return image, but i wanted to be able to access product_translation from image, so I added it to the join, but image still only returns the ProductImage values, nothing from the joined tables…any idea why?
[17:06:07] JRizzle: makerbreaker: rails only bud ?
[17:06:36] momomomomo: bobbobbins: Add your models to the gist
[17:06:48] momomomomo: tbuehlmann: What's your question?
[17:07:38] tbuehlmann: momomomomo, I don't have one, but thanks for asking :>
[17:08:35] bobbobbins: ok, its updated
[17:10:10] TeckniX: yup myHash.nil? check just works - thanks for the help all
[17:11:36] diegoviola: i have a rails 4 app, how do i go into translating views and such... i18n, having multiples locales in yaml files, etc
[17:11:39] foucist: bobbobbins: so your product_images table has product_translation_id ?
[17:11:42] diegoviola: sorry about the n00b question
[17:11:48] momomomomo: bobbobbins: your query is gone
[17:12:12] foucist: momomomomo: it's in the middle of the model
[17:12:23] pipework: diegoviola: one change at a time.
[17:12:36] diegoviola: pipework: sure but where do i start?
[17:12:44] bobbobbins: momomomomo: , its line 12 of product_image.rb
[17:12:52] pipework: diegoviola: Probably by creating yaml files for the locales.
[17:13:19] diegoviola: pipework: right, thanks
[17:13:27] tbuehlmann: diegoviola, http://guides.rubyonrails.org/i18n.html
[17:14:06] boytoy: diegoviola: this one is cool too: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale
[17:14:10] bobbobbins: foucist: yeah, product_translation_id is in product_images
[17:16:14] bobbobbins: but I'm only getting an array of values from product_images returned…i can't do something like image.product_translation.id at the moment
[17:16:34] pipework: !internationalization
[17:16:39] helpa: http://guides.rubyonrails.org/i18n.html - Guide on i18n by Sven Fuchs and Karel Minařík
[17:16:47] pipework: I gnu there was a guide.
[17:16:55] bobbobbins: but i can see the join taking place in the debug code
[17:17:17] foucist: bobbobbins: hmm? your query is returning an array? or you're saying image.product_translation is an array?
[17:17:35] bobbobbins: oh wait, i think i might see the problem
[17:17:39] bobbobbins: yeah, its returning an array
[17:17:39] momomomomo: bobbobbins: Don't you want joins( :product_images, product_option_value_images: [:product_option_values])
[17:18:21] foucist: bobbobbins: probalby shouldn't be an array, you can always do image.first.product_translation ..
[17:19:14] bobbobbins: hah, image.first does work…i didn't know i could do that
[17:20:01] bobbobbins: (I'm kinda new to rails)
[17:20:14] momomomomo: we all were at some point bobbobbins
[17:20:20] momomomomo: yay specs passed, out to lunch
[17:25:30] AntelopeSalad: is there a work around so that truncated fields don't get double escaped?
[17:43:57] inimit: how come this doesn't work in Rails 3 but worked in Rails 2? <% render :layout => 'shared/emails/rounded-box', :locals => { :color => 'grey' } do %><h1>Test</h1><% end %>
[17:45:05] pipework: inimit: Becuase ERB
[17:45:11] pipework: <% isn't <%=
[17:45:44] inimit: pipe, I tried to do that.. and when I have the yield in the rounded-box it yields the whole thing again
[17:45:57] helpa: inimit: 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.
[17:45:57] pipework: inimit: !code
[17:47:42] inimit: https://gist.github.com/anonymous/6ed86bc4ae2db82427bd
[17:48:47] pipework: inimit: Ah so the yield is the issue here. Rails hijacks yield. you'll want to use content_for, I think.
[17:49:35] inimit: I want a nested layout
[17:49:43] inimit: content_for doesn't really do that
[17:52:58] inimit: funny thing is this used to work in rails 2.3
[17:53:57] pipework: yield will repeat the whole view inside that view.
[17:54:05] pipework: The whole thing.
[18:01:27] inimit: pipework: how do I get it to only yield what's in the block?
[18:02:34] pipework: inimit: content_for. http://guides.rubyonrails.org/layouts_and_rendering.html#understanding-yield
[18:05:08] inimit: still doesn't make sense for what I'm trying to do.. did you see the code and what my intentions are pipework ?
[18:07:02] teeray: anyone know of a way to set an expectation on one of a set of messages being sent to an object (I'm in RSpec)… looking for a matcher like my_thing.should_receive_one_of([:foo, :bar, :baz])
[18:08:46] inimit: here's the rails 2 answer.. http://stackoverflow.com/questions/2951105/rails-render-partial-with-block
[18:10:20] pipework: inimit: see #capture
[18:10:28] inimit: just found that :)
[18:10:59] denym_: Radar are you there?
[18:11:19] pipework: rails does lame surprising things with #yield
[18:13:18] foucist: inimit: btw, you tried <%= render instead of <% render right?
[18:13:30] inimit: yea, it yielded the whole email again
[18:13:48] Macaveli_: can you use DAUX.IO with pow?
[18:13:51] inimit: sucks that it used to work.. was pretty elegant
[18:14:43] foucist: inimit: how is it better than content_for ?
[18:14:51] pipework: inimit: It made sense. Now the context of yield is the whole view being passed, not just what you'd expect.
[18:15:29] pipework: foucist: content_for is for named stuff, he wants to evaluate a block with a helper and output content. a named block is probably not as reusable.
[18:15:41] poli: This seems so basic yet I am having issues: I call a a=Model.where() that returns a ActiveRecord::Relation. Then a.each gives me a Enumerator. How do I get access to the fields of each of the returned elements?
[18:16:04] bricker`work: poli: a.each { |record| record.id }
[18:16:14] foucist: pipework: for some reason this rings a bell for a reverse yield type of deal with a helper (it was in haml though).. but i can't remember the details
[18:16:30] poli: bricker`work: Thanks.
[18:19:32] alexander25: hey guys anyone knows how to render an action from another controller?
[18:19:34] alexander25: https://gist.github.com/anonymous/b60a4039e29f94f9f943 like that
[18:19:39] Macaveli_: is there an app for php on mac? Or should i just use mamp?
[18:19:57] alexander25: i have a homecontroller#index where i render a beta signup form when the user is not signed in, but i post this to a beta controller with that code from gist
[18:20:13] pipework: Macaveli_: Wrong place.
[18:20:21] alexander25: i would like to just render the home#index view instead and pass the validation errors to it, or is that really a off-rails way?
[18:20:24] Macaveli_: pipework indeed wrong channel :p
[18:20:48] pipework: alexander25: Rather than rendering an action, you should render a template.
[18:21:58] pipework: inimit: http://www.igvita.com/2007/03/15/block-helpers-and-dry-views-in-rails/
[18:22:41] alexander25: thank you pipework that indeed was it
[18:23:22] alexander25: pipework: doing that the form submits and then i have http://books.dev:3000/beta is there a way to remove that beta from the url also?
[18:24:18] pipework: alexander25: I'd have to see the controller and the routes that are related. Maybe add your form_for as well.
[18:28:32] denym_: hey there quick active admin related question... I have listed my user, is it possible to show the count of has_many customers in the user table?
[18:28:51] pipework: 'listed my user'? What, exactly, do you mean?
[18:29:29] foucist: denym_: @user.customers.size ?
[18:33:30] arietis: what does missing :action means?
[18:34:03] denym_: your action is missing
[18:34:13] arietis: which one?
[18:34:15] foucist: check under the couch!
[18:34:26] denym_: check the line where it happens
[18:34:36] arietis: root to: 'index'
[18:34:40] foucist: arietis: where did you see the error
[18:35:00] pipework: arietis: That's not a proper reference.
[18:35:02] denym_: controller#indey
[18:35:06] pipework: You need controller#action
[18:35:29] arietis: aha, thanks
[18:37:28] denym_: foucist: no this doestn work; I guess because he dont look up the customers in the user_admin.rb
[18:38:34] foucist: denym_: i'm not familiar with active admin, what i said wasn't likely to be particularly relevant
[18:39:28] denym_: the problem is noone seems familiar with aa :(
[18:39:48] arietis: is there any visualizer for rails apps?
[18:39:55] arietis: drag and drop one
[18:40:09] foucist: denym_: that's a lie! active admin is pretty commonly used
[18:40:53] pipework: arietis: Of what?
[18:41:07] pipework: denym_: AA is laem, imo.
[18:41:25] arietis: pipework: of views
[18:41:40] pipework: arietis: In what way? Creating views?
[18:41:52] pipework: Like a WYSIWYG similar to dreamweaver?
[18:41:52] arietis: i'm using RubyMine for writing logic etc
[18:41:54] bricker`work: epochwolf: aren't you quite familiar with active_admin ?
[18:41:59] helpa: talk to epochwolf about ActiveAdmin
[18:41:59] arietis: pipework: yeah
[18:42:09] epochwolf: bricker`work: sup bricker buddy
[18:42:21] bricker`work: denym_ has some questions for you
[18:42:22] pipework: arietis: Not in rails, no. But you can use any tool that does that if you like, and then edit it with a text editor to add ERB to the view.
[18:42:45] epochwolf: Is the application source public?
[18:42:54] denym_: foucist: yeah for sure, but noone has an answer for my problem :)
[18:43:08] bricker`work: denym_: epochwolf is here to help you
[18:43:22] diegoviola: i'm trying to translate some views into different languages, do i need to put the locale files in config/locales? or they can also be on app/views, etc?
[18:43:48] epochwolf: ACTION puts on his black cape, fancy hat, and rainbow codpiece. 
[18:43:57] pipework: diegoviola: I'd put them in the default for now.
[18:44:12] diegoviola: pipework: so config/locales?
[18:44:22] pipework: diegoviola: If that's the default.
[18:44:26] bricker`work: diegoviola: config/locales is autoloaded
[18:44:52] denym_: epochwolf: hey there quick active admin related question... I have listed my user, is it possible to show the count of has_many customers in the user table?
[18:45:23] epochwolf: denym_: user has_many :customers?
[18:45:43] denym_: epochwolf: ok the question is kinda wrong... just want to see the count of customers rows regarding to the user_id
[18:45:52] denym_: epochwolf: right
[18:46:11] epochwolf: so you want a customer count column in the index?
[18:46:34] epochwolf: okay, can I see the source of app/admin/users.rb?
[18:46:45] denym_: alead put in the has_many customers in the user.rb
[18:46:49] epochwolf: denym_: do you have a customers_count on the users table?
[18:47:22] epochwolf: okay, if you want it to be fast and sortable you need to do a counter cache
[18:48:01] denym_: I dont mind about the sortable... its just a column with the count
[18:48:16] epochwolf: https://github.com/epochwolf/litsocial/blob/master/app/admin/users.rb#L14-L23 Okay, look at this to see how to do a custom index.
[18:48:43] epochwolf: https://github.com/epochwolf/litsocial/blob/master/app/admin/stories.rb#L41-L45 then look here to see what a custom column looks like.
[18:50:04] epochwolf: if you want the source for edit_links, I can provide that. It's not part of ActiveAdmin.
[18:50:18] pskrz: I have a table whose rows have same-table / inter-table, many-to-many relationships. What is a good way to handle this in CRUD fashion?
[18:50:49] inimit: thanks pipework, that helper was exactly what I was trying to do
[18:51:49] denym_: dont get it dont see anything on the index that helps in my case
[18:51:49] denym_: i need something like `column customers.count`
[18:54:50] bricker`work: denym_: this may help you http://guides.rubyonrails.org/association_basics.html#counter-cache
[18:55:02] bricker`work: Also, the Rails guides need to have links to those headers
[18:55:12] bricker`work: so you don't have to view source to get a link to it
[18:58:25] levberlin: Hi Guys, if anyone wants more personalized help, I'm doing free videochat/screenshare sessions. Just visit https://onscreenexpert.com and search "lev" or "rails". It's free, but feedback on the site is welcome :)
[18:59:48] bakis: has anyone used the apns gem for rails? I'm sending a request and the return value is nil but i don't think it's sending. just using "APNS.send_notifcation('token', "test")
[19:00:55] denym_: bricker`work: ok i have this in my model, but I cant call it to the user.rb from active admin because the method has to be on the customer.rb
[19:02:18] denym_: bricker`work: ah wait
[19:05:45] dsrx: if a User has_many :widgets, does user.widgets.create bypass validations on the Widget model?
[19:11:32] dsrx: well, it doesn't save the associated model, but it still shows on user.widgets until user.widgets.reload is called
[19:11:51] dsrx: oh, I geuss that makes sense
[19:12:08] elaptics: dsrx: yep, that's right
[19:12:41] elaptics: I assume you mean that widget is the associated model, though that's the model you're talking about when you're calling saved on it
[19:15:09] denym_: bricker`work and epochwolf: thanks for your help, works fine now and a complete other solution in mind but this seems the smartes
[19:16:04] epochwolf: denym_: column("Customers Count"){|u| u.customers.count }
[19:17:23] denym_: epochwolf: wtf this works too oO
[19:17:25] denym_: what would be smarter to use the live count or the counter_cache?
[19:17:39] epochwolf: counter_cache would be smarter
[19:17:57] denym_: less queries I guess
[19:18:18] denym_: (5.3ms) SELECT COUNT(*) FROM "customers" WHERE "customers"."user_id" = $1 [["user_id", 6]]
[19:18:39] denym_: do that with like 1000 of users :)
[19:19:35] pipework: As if they'll ever have that many.
[19:22:16] zachrab: how can i make a first of the month with ActiveSupport::TimeWithZone?
[19:23:25] TeckniX: How do I use the modulo operator within a view - I'm getting undefined method `%' for nil:NilClass
[19:23:56] TeckniX: zachrab: beginning_of_month() ?
[19:24:47] pipework: You preferably don't.
[19:25:17] pipework: Write methods on the model or non-view object.
[19:25:59] zachrab: TeckniX: on what class?
[19:26:10] slash_nick: zachrab: NilClass
[19:26:25] zachrab: slash_nick: nil? really?
[19:27:05] TeckniX: zachrab: http://apidock.com/rails/ActiveSupport/CoreExtensions/Date/Calculations/beginning_of_month
[19:27:15] TeckniX: How do I use the modulo operator within a view - I'm getting undefined method `%' for nil:NilClass
[19:27:26] pipework: Write a method elsewhere.
[19:27:26] TeckniX: alrighty then
[19:27:30] TeckniX: like app helper?
[19:27:42] pipework: TeckniX: Also, your problem is that you're getting nils in the view.
[19:27:50] pipework: Not that you "can't use % in the view"
[19:27:52] slash_nick: TeckniX: not running "nil % x" will also help
[19:28:51] TeckniX: pipework: slash_nick thanks - I'm just doing an items.each do | item, index |
[19:29:03] TeckniX: was trying to output a div on index % 4== 0
[19:29:35] epochwolf: zachrab: Time.now.beginning_of_month
[19:29:59] TeckniX: was following the application_helper function from http://stackoverflow.com/questions/5809917/conditional-tag-wrapping-in-rails-erb - guess I'll do the modulo in the app helper
[19:36:24] dangerousdave: I love the official devise documentation: "Devise also ships with default routes. If you need to customize them, you should probably be able to do it through the devise_for method."
[19:40:34] epochwolf: dangerousdave: https://github.com/epochwolf/litsocial/blob/master/config/routes.rb here's how to do that.
[19:41:09] pipework: dangerousdave: Watch out though, epochwolf computes in the same way Stallman does. http://stallman.org/stallman-computing.html
[19:42:13] dangerousdave: epochwolf: thanks, but i found it amusing the way the docs couldn't be sure
[19:42:51] godd2: Is there a way to permit all nested attributes using strong parameters?
[19:43:15] epochwolf: pipework: that's a fucking lie, I use a mac motherfucker
[19:43:28] workmad3: dangerousdave: they're just pointing out that they don't expose everything you can do with routes, so you might find it difficult or impossible to do certain customisations
[19:43:30] boytoy: epochwolf: cool app
[19:43:33] boytoy: epochwolf: is that forem?
[19:43:43] epochwolf: pipework: btw, when you're done with workmad3's mom, I have an appointment. :)
[19:43:47] pipework: epochwolf: lul. <3
[19:43:57] epochwolf: boytoy: no?
[19:44:08] workmad3: epochwolf: I just relayed that to your mom
[19:44:17] epochwolf: pipework: also, my personal wobsite has taste: http://epochwolf.com/
[19:44:21] workmad3: epochwolf: she said she'd ground you for 2 weeks
[19:44:27] boytoy: well if it was i'd want to share https://github.com/kakekake89/boytoy-blocker
[19:44:29] pipework: epochwolf: Is like chicken taste, yes?
[19:44:32] boytoy: your loss i guess
[19:44:35] epochwolf: workmad3: my mom is 8 hours away, she can't ground me :P
[19:44:46] workmad3: epochwolf: wanna bet? :P
[19:45:01] epochwolf: workmad3: yes
[19:45:42] epochwolf: payable on my mom effectively ground me. No internet access for 1 week for doing the nasty with your mom. :)
[19:46:08] workmad3: epochwolf: :P
[19:46:19] epochwolf: Proof being I can't pm you from this account for 1 week starting tomorrow at 9pm EST.
[19:46:22] workmad3: epochwolf: btw, if your mom is only an 8 hour drive away, you're not with my mom :P
[19:46:49] epochwolf: workmad3: plane travel only takes 12 hours and I can work remotely.
[19:46:50] workmad3: or, as I should say, 'mum' :P
[19:47:10] workmad3: epochwolf: also, my mum has 2 cats
[19:47:19] epochwolf: ACTION dies instantly.
[19:56:39] vim_shim_: https://gist.github.com/jteneycke/0ea1fa9f44169b414d27
[19:56:40] vim_shim_: ActiveModel::ForbiddenAttributesError in Admin::OrdersController#create
[19:57:15] vim_shim_: First bout with strong parameters. Can't quite see what i'm missing here.
[19:58:15] vim_shim_: Any idea what could be wrong with my create method?
[19:58:47] bricker`work: vim_shim_: is "status" the only form field coming in?
[19:59:14] vim_shim_: bricker`LA: It's the only one I have on the form.
[19:59:30] vim_shim_: bricker`LA: Even when I do permit! it gives me this.
[20:00:07] bricker`work: vim_shim_: show the relevant line from the log, with the params
[20:00:42] vim_shim_: bricker`LA: Added to gist
[20:02:51] pskrz: is anyone sitting on a great resource for self-referential associations?
[20:03:13] epochwolf: pipework: yes?
[20:03:13] pskrz: how do i get a hold of him?
[20:03:22] dangerousdave: just mapped the following for devise to get rid of the /users in the url https://gist.github.com/deathwishdave/21238fc8e33354cefc89. Works, but problem is new_user_session_path still liks to the /users path.
[20:03:36] chrstphrhrt: Hi, question about project structure. Coming from Django making "pluggable apps" to build projects out of. Now working with Rails and not sure whether to use app templates or engines for common features. Is there a convention?
[20:03:37] bricker`work: vim_shim_: just based on the example and the log you showed me, it should be working.
[20:04:04] vim_shim_: bricker`LA: That's what has me scratching my head. Anything else I can show you?
[20:04:20] bricker`work: chrstphrhrt: engines are useful, but there is a bit of technical overhead in making/using/maintaining them, so I would only do it for larger features.
[20:04:27] bricker`work: vim_shim_: perhaps the Order model
[20:04:43] godd2: If anyone can help me with a strong params issue, here is a gist of it: https://gist.github.com/anonymous/6676116
[20:05:29] vim_shim_: bricker`LA: Added to gist
[20:07:13] bricker`work: vim_shim_: I don't have a good answer.
[20:07:26] chrstphrhrt: bricker`work: ok cool thanks
[20:08:03] vim_shim_: bricker`LA: Ok, thanks for helping me frame my problem.
[20:08:53] godd2: vim_shim_: try changing Order.create(order_params) to Order.new(order_params) on line 17
[20:10:58] vim_shim_: godd2: Still happens if I change it to that.
[20:10:59] gestahlt: Uhm i got a mountable engines but i cant seem to get JavaScript running. How can i include JS in an Engine? I mean where is the best way to include it since i have no application layout?
[20:11:13] vim_shim_: It seems like it might be a Cancan thing https://github.com/ryanb/cancan/issues/835
[20:12:08] v_litvak: I am currently working on an app, that uses subdomains for each user,
[20:13:24] v_litvak: i am building a json web service for it
[20:13:41] pipework: I know JSON! He's a swell guy.
[20:14:34] vim_shim_: Fixed my problem with https://github.com/ryanb/cancan/issues/835#issuecomment-18663815
[20:14:41] v_litvak: the problem is that when I tried to make a request to a different subdomain, the browser would give a cross origin javascript error
[20:15:03] alexander25: anyone knows if there is a better way to do this in rails 4 : http://makandracards.com/makandra/12807-custom-error-pages-in-rails-3-2 ?
[20:15:18] alexander25: custom error pages for rails i had this implemented but preferable have no /404 route that the user can type either
[20:15:22] v_litvak: so, i thought i would just make a quick proxy like I used to, in order to make calls through my server
[20:15:51] v_litvak: but the issue is that it is the same app that makes the request to itself, so i would get a double render error
[20:15:59] v_litvak: I was wondering if anyone knew of a better way to do this?
[20:18:10] axl_: what is the easiest way to render a the html as a string, as generated by a partial through a controller ?
[20:18:28] bricker`work: render_to_string
[20:21:00] rehat: anyone know of a good page on how to do a form that populates another form select box based on the selection of another select box?
[20:21:07] axl_: bricker`work: can i use a partial with render_to_string in my control r?
[20:21:13] axl_: controller *
[20:22:00] bricker`work: axl_: what are you trying to do?
[20:22:44] helpa: what are you trying to do
[20:23:01] axl_: i have an ajax get request to respond to using a html string i generate using a view partial
[20:23:17] pipework: axl_: Where is _bro?!
[20:23:30] yaymukund: rspec supports an .rspec-local file if, for example, I want a different --format from the rest of my dev team. Does guard-rspec support a similar rc file if e.g. I want `all_on_start: false`, but everyone else wants `all_on_start: true`?
[20:23:36] axl_: pipework: didn't he come over ?
[20:23:46] axl_: he told me he wanted to go meet you
[20:23:52] pipework: axl_: Must've gotten distracted with his pet bear and gypsy girlfriend.
[20:24:06] axl_: aaah….
[20:24:18] axl_: gypsy girlfriends…. they tend to do that
[20:27:31] Flashmasterson: ii entered 'sudo gem install rails' in my terminal and got this message:" WARNING: Improper use of the sudo command could lead to data loss
[20:27:32] Flashmasterson: or the deletion of important system files. Please double-check your
[20:27:32] Flashmasterson: typing when using sudo. Type "man sudo" for more information.
[20:27:32] Flashmasterson: To proceed, enter your password, or type Ctrl-C to abort.
[20:27:32] Flashmasterson: Password:" i'm also unable to type in my password for some reason
[20:27:45] pipework: Sure you are.
[20:27:58] pipework: But don't use apt-get for fetching rails.
[20:28:05] pipework: Like, ever.
[20:28:46] Flashmasterson: pipework: so how do i properly update rails?
[20:28:54] pipework: Flashmasterson: by installing the gem.
[20:29:09] Flashmasterson: pipework: i'm working with the pdf of the ror tutorial but need some help
[20:29:21] pipework: I don't know what that is.
[20:29:29] gwillen: pipework: the word 'apt-get' did not appear in anything Flashmasterson said
[20:29:39] pipework: Flashmasterson: If you're on windows, you'll have to find someone else with no moral values and a weak sense of freedom.
[20:29:53] gwillen: pipework: ok, so far you're being useless and anti-helpful here
[20:29:58] Flashmasterson: pipework: i'm not, but i appreciate your assumption
[20:30:07] tubbo: gwillen: you know what's useless and anti-helpful? windows.
[20:30:08] pipework: gwillen: You're right, I'm sober though. I'm assuming that he installed ruby using apt-get.
[20:30:18] pipework: Flashmasterson: Ah good then. Let's continue.
[20:30:32] sophomorical: terminal wont show the password you type in, just fyi
[20:30:35] pipework: Flashmasterson: Most rubyists typically don't develop or deploy using a system ruby.
[20:30:35] tubbo: Flashmasterson: FIRST OF ALL what OS are you using lol
[20:30:42] tubbo: maybe pipework shoulda asked you that first ;)
[20:30:53] Flashmasterson: pipework: mountain lion
[20:30:58] pipework: Flashmasterson: Oh neat.
[20:31:01] tubbo: yeah you're using 1.8
[20:31:17] pipework: Look, I ran out of alcohol at my desk today. Pick on me more. I'm sober and fussy. L(
[20:31:18] tubbo: Flashmasterson: d/l xcode command line tools and Homebrew, then `brew install ruby`.
[20:31:24] pipework: ^ that works.
[20:31:28] nettoweb: guys, I'm using a gem called 'permalink_fu' to permalinks… in my local app is OK… title like "Produção" became "producao". But in my production app (CentOS), the accents were removed so my url are like 'produo'.
[20:31:53] gwillen: Flashmasterson: ok, to answer your original question: 1) that message is normal; 2) when you type your password, it won't show anything, but it's still working.
[20:32:00] tubbo: Flashmasterson: you can get xcode clt from developer.apple.com, brew from homebrew.github.io iirc, and ruby from brew :)
[20:32:13] tubbo: gwillen: oh yeah i forgot about that lol
[20:32:17] Flashmasterson: gwillen: thanks, i thought i broke something
[20:32:21] pipework: Flashmasterson: So you'll want to get Xcode installed, and then install commandline tools from inside xcode. After that, you'll want to checkout homebrew, it's a neat package management system, and then run `brew install ruby` to get a ruby.
[20:32:26] gwillen: Flashmasterson: nope, it always shows that message the first time you run 'sudo'.
[20:32:38] gwillen: Flashmasterson: it's just to caution you that you're using root, which means you can break things. :-)
[20:32:38] pipework: Flashmasterson: I use chruby and ruby-install myself, but that's mostly a more advanced setup.
[20:32:45] Flashmasterson: tubbo: it says 'installing' in the app store but don't see a reassuring bar of progress
[20:32:56] tubbo: Flashmasterson: sometimes life hands you lemons.
[20:33:08] tubbo: it's your job to make lemonade. so grab some syntax sugar and get to it.
[20:33:21] tubbo: Flashmasterson: oh did you install Xcode itself?
[20:33:26] tubbo: well you'll just have to wait a tad longer then :)
[20:33:39] toretore: sometimes life hands you melons
[20:33:45] Flashmasterson: tubbo: ok cool, as long as this is a legit way of downloading it
[20:33:53] pipework: It takes a long time.
[20:33:56] tubbo: Flashmasterson: if you install xcode command line tools you should ostensibly get the right C compilers to get Ruby, but that's it. just a bit smaller.
[20:34:13] tubbo: Flashmasterson: by "a tad" i'm talking the diff between downloading 1.5 GB and about 300 MB :)
[20:34:19] tubbo: so it's a pretty big diff
[20:34:33] tubbo: but tbh i had trouble getting xcode command line tools to work on this machine so you might as well just leave it
[20:34:56] tubbo: Flashmasterson: go have your libation of choice and relax for a minute. maybe watch an episode of aqua teen hunger force.
[20:34:58] AntelopeSalad: where would you put common js code that you expect to use between controllers? just drop it into the application.js?
[20:35:05] Flashmasterson: tubbo: ok. it took me just under a day to download mountain lion… don't know if that gives you a hint at my speed
[20:35:13] tubbo: AntelopeSalad: all JS code is loaded before every request, so you can technically put it anywhere.
[20:35:25] Flashmasterson: tubbo: is aqua teen still funny?
[20:35:28] tubbo: Flashmasterson: whoa, what kind of connection do you have?
[20:35:45] Flashmasterson: tubbo: modem/router 4g clear
[20:35:52] Flashmasterson: tubbo: whatever that means
[20:35:58] AntelopeSalad: tubbo: hmm yeah that is true, i didn't even think of that
[20:35:59] tubbo: Flashmasterson: it means slow and cheap
[20:36:08] Flashmasterson: tubbo: terrific
[20:36:29] AntelopeSalad: do you think for good measure it would make sense to have a shared.js file so someone looking at your project understands it's being used in multiple places?
[20:37:05] tubbo: AntelopeSalad: yes. i typically use application.js as just a manifest, and i include all of my JS through that file. so you should have a file for shared JS code.
[20:37:15] AntelopeSalad: ok thanks, i'll do that then
[20:37:15] tubbo: AntelopeSalad: i don't ever put any actual JS into application.js
[20:39:51] Spami: Guys, an idea how to get the rails debugger gem to stay in my in app code a not jumping into rails/ruby source code
[20:40:20] AntelopeSalad: tubbo: how did you deal with scoping issues then btw?
[20:40:27] alexander25: hey guys im still trying to fix my r spec which fails in rails 4 with error, have looked at it a few times but really stuck on it
[20:40:39] alexander25: the full trace is https://gist.github.com/anonymous/26f4986259483bbe9c46/raw/06df5ecd471db2a2af8a8b8afcaae327d66ca9c9/gistfile1.txt anyone might want to take a quick look and perhaps know what this is causing?
[20:41:15] alexander25: Spami: what debugger gem do you use the default one ? gem "debugger" just like that?
[20:42:04] AntelopeSalad: using window.foobar seems like such a massive hack, but it does work
[20:42:33] interactionjaxsn: alexander25: this? => https://github.com/rails/rails/issues/10559
[20:44:07] alexander25: Spami you could use something like https://github.com/pry/pry and use that to debug your code im not sure how to let the debugger only run your local code
[20:44:28] alexander25: interactionjaxsn: thx i did not found that topic yet its quite long going to look into it
[20:44:54] alexander25: Spami: or use ruby mine you can set visual breakpoints in your code, but perhaps you don't like an IDE just an suggestion
[20:45:25] Spami: alexander25, i'll look into that thanks
[20:45:31] interactionjaxsn: alexander25: i'm not sure it's your issue. just making a guess on that. hope it works out for you
[20:45:55] alexander25: I do have rails 4.0 final but not sure still have a look at it though
[20:46:32] tubbo: AntelopeSalad: scoping issues?
[20:47:15] tubbo: alexander25: yeah devise 3.x depreacted token authentication. grep your project for that line and remove it. probably in config/initializers/devise.rb...
[20:47:35] tubbo: alexander25: there's a write-up on the plataformatec blog about it, in the release notes. a gist is provided to replicate some of the token behavior.
[20:47:52] tubbo: devise is becoming more and more like a bunch of extra crap i don't need
[20:48:04] AntelopeSalad: tubbo: yeah if you just start dropping functions in a file then they won't be available to use in other places
[20:48:06] tubbo: just b/c i've been doing so much work in ember, devise's win is totally lost.
[20:48:12] alexander25: I already found it was an issue with 3.0.1 pre versions and made sure i have that version but still that did not resolved
[20:48:20] AntelopeSalad: you can attach them to window but that feels really dirty
[20:48:46] alexander25: tubbo: thanks yes I have already looked into that not fully removed all references so it seems
[20:49:02] rehat: I'm new to web dev, if I want to create a dynamic select form that changes based on another form selection is there a way to do that in rails or do I have to use a little bit of javascript
[20:49:18] pipework: rehat: It's a client-side thing, so it'll be javascript.
[20:51:02] toretore: DYNAMIC SELECT
[20:51:16] toretore: isn't that like so 3 years ago
[20:51:30] alexander25: seems like the rails 4 edge should solve my routing issue
[20:51:53] alexander25: what is actually the correct rails syntax in Gemfile should it be gem "my gem" or gem 'my gem' single or double quotes?
[20:52:06] alexander25: i tend to refactor all to use double quotes but not sure on the preferable syntax?
[20:52:11] Encore: hey, so, i'm using Last.fm api and searching for Last.fm artists with LastfmAPI.artist_search(term).map { |a| Lastfm::Artist.new(a) }
[20:52:39] helpa: alexander25: http://rubycentral.com/book - Programming Ruby is a free online book on Ruby.
[20:52:39] toretore: alexander25: !pickaxe will explain this
[20:52:41] Encore: however, search results are really slow. any idea how i can increase the speed on search results
[20:53:08] V8Energy: current_user has many following_users (current_user.following_users) and following_users have many items (following_users.items). What I want to do is display all the items of following users and sort them by date. what's the best way to do that?
[20:53:15] alexander25: toretore: that app is down Heroku | No such app
[20:53:39] tubbo: AntelopeSalad: that's not true...function myFucntion() {} attaches itself to the window
[20:53:43] tubbo: AntelopeSalad: if it's called in the window socpe
[20:53:55] alexander25: now getting rails edge, hopefully fixes my spec issue, not sure if that is the way to go, the edge version must be unstable (?)
[20:54:08] toretore: alexander25: !g ruby pickaxe online html
[20:54:56] timhansen: afternoon, all
[20:55:15] alexander25: toretore: just was curious about double or single quotes, does it really makes any difference
[20:55:16] V8Energy: current_user.following_users.each do |user| user.items.each |item| datatable << item end end datatable.sort(:date) <-- seems inefficient
[20:55:57] tubbo: V8Energy: current_user.following_users.items.each {} doesn't work? :)
[20:56:26] V8Energy: i think i tried that and it didn't. let me try again :P :P :P
[20:57:09] fryguy: current_user.following_users.includes(:items).each might work too
[20:57:23] tubbo: V8Energy: the most efficient way, btw, would be current_user.following_users.includes(:items).items
[20:57:29] alexander25: using rails edge even worst idea ;p would there be a way to monkey patch rails with that error fixed somehow, ugh look into devise initialiser again first
[20:57:30] V8Energy: tubbo: following_users returns an array, so it wouldn't have .items ?
[20:57:47] tubbo: current_user.include(:following_users).following_users.includes(:items).items
[20:57:49] terrellt: V8Energy: following_users should be returning an AR:Association.
[20:57:55] toretore: alexander25: the linked book will explain this to you
[20:57:58] terrellt: V8Energy: If it's not, fix your scope.
[20:58:00] tubbo: V8Energy: ^^^ that's 1 query
[20:58:12] timhansen: i'm having issues setting the child of a has_one belongs_to association i have. https://gist.github.com/willc0de4food/395851d07045c9614043
[20:58:19] toretore: alexander25: don't use a non-release version of rails
[20:58:33] V8Energy: terrellt: it returns #<ActiveRecord::Associations::CollectionProxy::ActiveRecord_Associations_CollectionProxy_User:0xb59e2e8c> and it complains that .items doesn't exist
[20:59:06] timhansen: i've tried sending the ID instead, as well as setting params[:priority] to the record of the priority whose ID gets sent
[20:59:17] terrellt: V8Energy: ...You sure user has_many :items?
[20:59:25] timhansen: and by sending the id, i mean, sending the param as priority_id
[20:59:31] interactionjaxsn: Encore: you can pass in params to reduce the amount of results returned. and - excuse my ignorance here as i don't have any experience with the api - why do you need to call new on all the results?
[20:59:37] alexander25: toretore: okay nice i bookmark the book and read it tomorrow in full
[20:59:53] V8Energy: terrellt: when i do .items on a single user, it works. and yes, the model has_many :items.
[21:00:01] tubbo: timhansen: that's usually what i do, i call the input object[association_id], and i set association_id. the FK.
[21:00:10] V8Energy: tubbo: it didn't work. undefined method `items' for #<ActiveRecord::Relation::ActiveRecord_Relation_User:0xb66937bc>
[21:00:25] terrellt: I guess that might be too deep for AR:Relation to handle.
[21:00:29] interactionjaxsn: V8Energy: you have to iterate over all the following users
[21:00:35] tubbo: V8Energy: try doing a has_many through
[21:00:59] terrellt: V8Energy: current_user.include(:following_users).following_users.includes(:items).map(&:items) will do it, but it's definitely less efficient than a query.
[21:01:26] tubbo: V8Energy: has_many :following_users_items, through: :following_users, class_name: 'Item'?
[21:01:33] tubbo: (i don't actually know if that will work)
[21:02:12] timhansen: tubbo: when i try to use association_id i get an "undefined method" error when rendering the view
[21:02:28] terrellt: tubbo: I'd be surprised, that won't be able to just get item_id out of the following_user.
[21:02:37] tubbo: timhansen: undefined method on association_id? try running migrations.
[21:02:47] V8Energy: tubbo: why not simply do has_many :items, through: :following_users ?
[21:03:15] tubbo: terrellt: following_user doesn't have an item_id. item has a following_user_id. that's why i think it will not work. might need another join model
[21:03:31] tubbo: V8Energy: oh i dunno, i was just trying to be explicit. you can do that, too, if the User doesn't have an items method.
[21:03:38] terrellt: tubbo: Yeah, that's what I said.
[21:03:44] tubbo: V8Energy: FollowingUser would have to have an item_id...
[21:04:01] tubbo: so you might need a FollowingUserItem class that just belong_to :following_user and belongs_to :item
[21:04:16] timhansen: tubbo: i have run them. maybe this is a problem for tomorrow
[21:04:40] terrellt: V8Energy: Item.where("user_id IN (?)", following_users)
[21:04:48] timhansen: tubbo: thanks
[21:04:51] tubbo: timhansen: what's this?
[21:04:55] tubbo: oh well fuck you too bitch
[21:05:04] tubbo: i've never seen `format.json { render action: 'show', status: :created, location: @ticket }` before.
[21:05:41] breakingthings: I noticed that the other day, in a generated rails controller. I was wut.
[21:06:09] breakingthings: I didn't get to play with it to see why it's there, but the only thing I could think it could be doing would be remote forms.
[21:06:22] breakingthings: But I don't know shit so there's that too.
[21:06:25] terrellt: V8Energy: Or even prettier, Item.where(:user => following_users)
[21:07:40] tubbo: breakingthings: it's just sending the 'Location:' header, IIRC, but i'm not sure why it's doing that unless it's a redirect.
[21:09:10] V8Energy: terrellt: that worked
[21:09:21] terrellt: V8Energy: high five.
[21:09:39] terrellt: ACTION awkardy high fives the polydactyl dude.
[21:09:43] terrellt: Awkwardly too.
[21:10:00] V8Energy: but i am still trying to get current_user.following_users.items to work as it looks prettier and perhaps would be more efficient?
[21:11:31] tubbo: V8Energy: you think current_user.following_users_items is less expressive than current_user.includes(:following_users).following_users.includes(:items)?
[21:11:54] V8Energy: I would use current_user.includes(:following_users).following_users.includes(:items) if it worked
[21:12:04] V8Energy: i am trying to understand why it doesn't
[21:12:45] tubbo: V8Energy: you might need to do an .all.items to get it to work.
[21:12:49] gwillen: V8Energy: I don't think you can get away with chaining includes like that. Perhaps put a has_many :items :through => :following_users, and then use the items relation?
[21:13:04] tubbo: that is what ended up working
[21:13:47] V8Energy: i think perhaps my model associations are messed up. https://gist.github.com/slavajacobson/4158051f3dd8be3e9a03
[21:13:56] V8Energy: wishes = items
[21:14:24] V8Energy: am i gonna get slapped in the face?
[21:14:28] tubbo: i didn't know you were IN a has_many through
[21:14:33] tubbo: that might complicate things a bit
[21:15:13] tubbo: V8Energy: what does `source: :following` do?
[21:15:35] godd2: tubbo: It tells rails explicitly what the model name is
[21:15:37] gwillen: maybe I'm missing something here, but if you want the wishes on the current user, just do current_user.wishes
[21:15:46] gwillen: the point of the :through is you don't need to chain a bunch of stuff
[21:15:55] tubbo: godd2: i thought that's class_name
[21:16:17] tubbo: V8Energy: yeah is following_users just a collection of User objects?
[21:16:32] tubbo: if so, you should be able to do user.following_users.items, because following_users is just Use
[21:16:39] V8Energy: i am kind of trying to replicate twitter there
[21:16:53] toretore: V8Energy: does wishes have a user_id column?
[21:16:56] tubbo: V8Energy: you should be ok with this https://gist.github.com/tubbo/e271b167568767158e9b
[21:17:01] V8Energy: toretore: yes
[21:17:23] tubbo: then current_user.following_users.wishes would make snese
[21:17:32] tubbo: though i'm not sure that will still work..
[21:17:34] V8Energy: hmm i'll try that
[21:17:58] godd2: Don't you users also belong to many relationships?
[21:18:52] V8Energy: tubbo: it still complains that .wishes is undefined
[21:19:11] toretore: Relationship.where('whatever_id = ?', user_id).includes(:follower => :wishes)
[21:19:40] toretore: user_id is the user whose followers' wishes you want to get to
[21:19:53] godd2: V8Energy: can you gist the error output of it complaining about wishes being undefined?
[21:20:31] V8Energy: https://gist.github.com/anonymous/2b506af491378751bf8f
[21:21:23] godd2: You can't just call wishes on the array of following users
[21:22:02] godd2: Youd have to either call current_user.wishes, or iterate throught current_user.following_users and call wishes on each of them and store them into an array
[21:23:07] V8Energy: godd2: i was gonna do that originally but it's inefficient
[21:23:40] terrellt: godd2: That's not an array. He's hoping to end with something like Wish.where(:user => current_user.following_users) but via doing current_user.following_users.wishes
[21:23:43] V8Energy: best solution right now which works is: Wish.where(:user_id => current_user.following_users)
[21:23:49] terrellt: I would have given up by now.
[21:24:26] terrellt: def following_user_wishes; Wish.where(:user => current_user.following_users); end; <-- Done, money saved.
[21:24:27] godd2: terrellt: current_user.following_users doesn't return an array of active record objects?
[21:24:46] terrellt: godd2: No, it returns an ActiveRecord::Relation - a building block for a query. When you actually start pulling objects out of it it becomes an array.
[21:26:23] godd2: V8Energy: Defining User to have many wishes through following users *should* allow you to call current_user.wishes provided current_user is a User object
[21:26:45] V8Energy: yes that works
[21:29:32] crunch-choco: i can read that sinatra is for "small" projects, padrino for "medium" projects, rails for "big" projects, what do "small","medium", and "big" mean? is it related to lines of codes or trafics or anything else?
[21:32:17] alexander25: finally fixed my issue it was bad syntax in one of my splitter routes, yeah r spec again working
[21:32:30] alexander25: is there a way to generate specs from existing controllers / models possible?
[21:32:50] alexander25: i have a very little test coverage and some "spec scaffold from existing" would be great
[21:34:04] jstrong: ^^ qotd right there
[21:34:32] alexander25: im also using grow notify and growl gem to notify in osx but the performance under guard just s*cks its very slow anyone could recommend something that works better?
[21:37:57] alexander25: jstrong: im using guard at the moment would zeus not do the same sort off?
[21:38:06] Encore: how can one increase search results when pulling data from an-external API?
[21:38:09] alexander25: i only noticed the growl notifications are sometimes off quite a bit
[21:38:11] Encore: results speed*
[21:38:22] jstrong: Encore: not possible
[21:38:27] Encore: caching works after the fact
[21:38:47] jstrong: alexander25: yes it would
[21:38:49] Encore: jstrong, shit. search is simply to slow on our app. we're pulling from last.fm api
[21:39:07] jstrong: Encore: are you pulling on the server?
[21:39:27] Encore: jstrong, yes.
[21:39:43] Encore: and then indexing it in our database
[21:40:03] toretore: Encore: you need to explain which part exactly is slow
[21:40:25] jstrong: I'm assuming the api call itself is slow but it might be how you process the results
[21:40:44] toretore: it it's getting the data from l.fm then you can't do anything about that
[21:40:52] jstrong: Encore: external api calls are slow and unreliable by nature. if you do it on the server then it is a liability as it can lead to requests getting clogged. if it is truly the API and not something you're doing with the API then I'd implement it client side.
[21:41:43] jstrong: by implementing it in JS then it's the clients machine that pings last.fm and you basically eliminate request pipeline issues
[21:41:54] jstrong: then you could send the JS api results to server for indexing as that's generally a good diea
[21:42:15] Encore: excellent, thanks jstrong!
[21:44:57] Encore: jstrong, here's a snip from the artist.rb where we're returning results for Artist searches: https://gist.github.com/anonymous/9048b54e6e1835dbbdb4
[21:45:48] jstrong: are you using past events?
[21:46:23] Encore: jstrong, yessm
[21:46:45] jstrong: is that called on every artist that's returned from the search?
[21:47:31] Encore: jstrong, yes
[21:47:37] jstrong: that's your problem then
[21:47:40] jstrong: it really isn't the api
[21:47:49] jstrong: it's that you're doing one or two api requests for every single artist
[21:48:08] jstrong: that's like individually fetching 10 cups of coffee and heating them up individually
[21:48:15] jstrong: instead of heating up a thermus
[21:48:25] jstrong: you need to do ONE api call to load all events for all artists related to the search
[21:48:37] jstrong: and then assign the event objects to your artist objects
[21:48:44] jstrong: thus making one or two calls at most
[21:49:03] terrellt: (PS: If you can do it, cache it too.)
[21:49:41] Encore: jstrong, ok, i get it. thanks! and terrellt, we are but that's after making the initial requests (which are slow).
[21:50:33] terrellt: jstrong: Doesn't look like last.fm's API supports bulk event requests.
[21:51:30] jstrong: terrellt: that's kind of lame
[21:52:17] diggitydane2: Has anyone here used code climate?
[21:52:26] jstrong: diggitydane2: yes
[21:53:06] diggitydane2: jstrong: did it provide you with good feedback? or was it more general, like "your model is over 300 lines"
[21:53:34] jstrong: diggitydane2: I loved it. Why don't you check for yourself though? dead easy to set up and has no credit card trial for private repos.
[21:54:01] terrellt: Couldn't use it - we use a master and develop branch and they don't support different branch names for open source projects.
[21:54:38] jstrong: diggitydane2: it just detects code smells so it detects complexity and duplication.
[21:54:52] diggitydane2: jstrong: I'm planning on it. just trying to get some general feedback on it. most reviews I found seemed contrived
[21:55:19] jstrong: its purpose is narrow but what it does it does well, and if you're shorthanded on QA staff as … virtually every small team is.
[21:55:22] terrellt: diggitydane2: From what I've seen, it doesn't hurt.
[21:55:23] jstrong: then it's really useful
[21:55:50] mattvv: anyone here use a feature flipper in their rails project? if so what gem would you recommend?
[21:55:50] terrellt: Got an open source project? Travis/Coveralls/Code Climate call it a day.
[21:56:22] diggitydane2: cool, I'll try it out
[21:57:09] jstrong: terellt: huh. was setting up jenkins as we speak because I evaluated codeship and wasn't too impressed
[21:57:13] jstrong: terellt: I'll look into coverails
[21:59:47] terrellt: jstrong: Coveralls is just hosted Simplecov results really. Which is cool with me.
[22:00:00] jstrong: so it would work with jenkins theoretically
[22:00:51] terrellt: jstrong: Code has to be hosted on github at the moment.
[22:01:34] jstrong: terellt: it is
[22:01:51] terrellt: jstrong: Then yeah. It's $5/month for 1 private repo.
[22:01:58] terrellt: Free for open source ones.
[22:02:12] terrellt: jstrong: https://coveralls.io/docs/ruby
[22:05:34] Radar: denym_: yes
[22:05:41] Radar: good morning everyone
[22:05:56] Leighton: Radar: mornin
[22:07:27] jstrong: afternoon to you sir
[22:07:57] terrellt: Oh, this is true, it's 3:00, what am I saying.
[22:29:53] Flashmasterson: is it normal for xcode to take 3 hours downloading?
[22:30:12] Flashmasterson: i have a modem/router 4g clear connection… whatever that means
[22:30:19] alx-: yeah, it's been really slow for me before
[22:30:49] Flashmasterson: ok about how long was yours?
[22:31:21] blitz: I'm using rails 2.3.18 and have a weird active record association situation I'm looking for input on. I have a Card model with card_number and merchant_id, and a fraud_lookups table with card_number, merchant_id and fraud_score rows. I need to have a has_many to has_many relationship between both where the lookups with the same card_number and merchant_id are the foreign-primary key constraints
[22:31:23] alx-: i think a couple of hours
[22:51:07] Stalkr^: helpa !learn
[22:53:15] alexander25: trying to have rails 4 + devise + some custom params and nested attributes for my sign_up form
[22:53:18] alexander25: i have this : https://gist.github.com/anonymous/d4adb1c943ebe8a5f58f
[22:53:31] alexander25: but the syntax s incorrect, how could i add nested attributes to the strong_param definition?
[22:53:58] alexander25: just adding "profile_attributes" inside the first block fails with an error invalid attributes
[22:54:38] agent_white: Afternoon folks
[22:55:02] DoctorMonocular: I have a model that accepts nested attributes for a polymorphic child model, but the child model is failing to save because the id and type fields aren't populating. Dig it: https://gist.github.com/PeteMichaud/7186e2048f36dfd0dee1
[22:55:18] DoctorMonocular: postable_id and postable_type are nil when Topic.create gets called
[22:55:34] DoctorMonocular: er I mean when @topic.save gets called
[22:55:59] dllama: hi guys, quick question. is there a way to get caching data to show up in production logs?
[22:55:59] DoctorMonocular: I'm pretty sure they are supposed to auto populate from the parent objects upon saving, but it's not happening
[22:56:11] dllama: production.log*
[22:56:27] V8Energy: is it possible to join/merge ActiveRecord::Associations with an array of hashes based on a certain key/column?
[23:05:55] RustyShackleford: is the bootstrap-sass gem the best way to do rails+bootstrap
[23:09:53] s2013: RustyShackleford: thats a question thats giong to get you flamed in this channel
[23:10:10] s2013: because they hate the word "best" since its subjective even though everyone here is very opinionated
[23:10:21] s2013: but thats the gem i use and it works better than the other ones
[23:10:25] RustyShackleford: i phrased it poorly I suppose
[23:11:00] s2013: imo its the easiest gem to work with but you can also just do it w/o a gem since its jsut couple of files
[23:11:26] RustyShackleford: s2013, how much does bootstrap-sass differ from plain bootstrap?
[23:11:48] s2013: not that much
[23:12:57] RustyShackleford: are there any downsides to downloading the zip and including it in my project?
[23:13:08] RustyShackleford: for some reason that sounds less intimidating to me
[23:13:23] V8Energy: s2013 but can you easily override css in bootstrap just like you can do it easily with foundation (which supports sass)?
[23:13:37] s2013: yeah V8Energy
[23:13:44] s2013: i haent used foundation much but you can override it
[23:13:59] s2013: the way i do it is have a file called overrides and then just put stuff there
[23:14:07] V8Energy: i like how easily it's done with foundation http://railscasts.com/episodes/417-foundation
[23:14:08] s2013: RustyShackleford: try both see what you like
[23:14:15] s2013: i heard good things about foundation though
[23:14:18] vim_shim: RustyShackleford: Do you know about Sass? http://sass-lang.com/
[23:14:59] RustyShackleford: man, choice can be so paralyzing
[23:15:02] vim_shim: RustyShackleford: It's quite a lot better to work with than plain css. Which is why you might choose bootstrap-sass
[23:15:08] s2013: i dont understand the difference between sass and scss
[23:15:16] RustyShackleford: different syntax, same shit
[23:15:24] vim_shim: s2013: Curly braces
[23:15:44] RustyShackleford: bootstrap relies on LESS though, doesn't it?
[23:15:53] s2013: i mean yeah
[23:15:56] s2013: bootstrap does, rails doesnt
[23:16:08] s2013: thre is also bootstrap-less or whatever for rails. but its more complicated and not worth it imo
[23:16:20] s2013: let me find you a very good tutorial i used RustyShackleford
[23:16:21] vim_shim: They rewrote it in Sass, because it's better.
[23:16:29] s2013: is that bs3 vim_shim ?
[23:16:44] RustyShackleford: if I include the compiled bootstrap css in my project, could I use either less or sass?
[23:16:55] vim_shim: s2013: Not sure if they're migrating yet.
[23:16:56] RustyShackleford: i'm kinda confused how all these things fit together
[23:17:01] s2013: just follow this RustyShackleford http://railsapps.github.io/twitter-bootstrap-rails.html
[23:17:35] vim_shim: RustyShackleford: Plain css sucks, so people wrote different higher level implementations that compile down into it.
[23:21:42] vim_shim: Yep, but people like Sass so much they *rewrote* it to use Sass instead.
[23:23:16] s2013: any idea whats a decent salary for a junior level rails dev and what should you know as a junior dev?
[23:24:29] vim_shim: http://www.indeed.com/salary?q1=junior+ruby+on+rails&l1=&tm=1
[23:25:46] s2013: damn why did it dip down so low
[23:27:51] s2013: also what are some things you should be familiar with as a junior developer?
[23:30:00] vim_shim: If you can build a complete non-trivial application, you're pretty much set, beyond knowing specific gems that any given company needs.
[23:32:28] vim_shim: Like something more complex than a blog with at least some group of interacting models.
[23:33:28] vim_shim: When I was working a startup as a Junior Ruby Dev I mostly just got bitch work finagling with css and integrating jquery plugins.
[23:33:35] s2013: yeah thats what i dont want
[23:33:45] s2013: i interviewed with few companies. one already made a very good offer
[23:33:54] s2013: but its mostly just parsing json, nothing much more than that
[23:34:10] s2013: and i have few more final interviews scheduled this week
[23:34:32] s2013: so im holding out for something that is a bit more interesting
[23:34:37] vim_shim: Then I think you're doing good friend.
[23:34:59] vim_shim: What have you done before?
[23:35:05] s2013: in rails or in general?
[23:35:23] s2013: in general i have about 5 years or programming experience but i had a 5 year gap
[23:35:30] s2013: years of*
[23:35:42] s2013: but as far as rails go, i built few apps for startups including one from scratch
[23:36:00] vim_shim: The guy's that know what they're doing just want to spend all their time focusing on the data model while some one else does all the fussy bits.
[23:37:27] vim_shim: So if I can tell you to just read some docs and integrate something you've never seen before, you're valuable if I just want to focus on optimizing the database.
[23:37:56] s2013: would you expect a junior dev to know about procs, sti, mixins, etc?
[23:39:46] ryanf: procs and mixins, hopefully. sti, probably not
[23:39:48] s2013: a while back i talked with this startup and asked them if i could just help them out, be an intern or whatever. i said id do it for free just to get some ruby / rails stuff under my belt.. i told them i havent been doing rails long and im just looking to work on a project with someone senior
[23:40:05] ryanf: I'd expect a junior dev to be able to do the research to learn about sti
[23:40:16] s2013: they asked me to explain sti in rails, procs, mixins, and some obscure stuff
[23:40:36] s2013: and it wasnt even a junior dev position. more l ike an intern
[23:40:56] vim_shim: It's a measure of how far you've researched into the Rails ecosystem.
[23:41:04] s2013: that pissed me off. everyone is like you dodged a bullet cause they would never work with someone who would ask such questions especially to someone just starting out
[23:41:08] ner0x: When having an account record that has four different "type" Type1: Pay, Type1: Free, Type2: Pay, Type2: Free would STI be a good candidate? The only things that would change would be the "limits" on things and what the relationship names would be.
[23:41:48] s2013: vim_shim: funny thing is i asked the guy to explain what sti was. he said "its just sti". i dont think he knew it himself cause i looked him up later and went to his github and saw he started rails like 2 months before i did cause he was doing all the tutorials at that time
[23:42:02] s2013: im pretty sure he just googled some rails questions and asked me
[23:43:04] vim_shim: just make yourself a website and pitch yourself to your friends. Knowing rails is the new microsoft excel.
[23:43:39] vim_shim: it's very useful skill to have, to be able to write custom web page wrappers to databases.
[23:44:29] vim_shim: http://www.amazon.ca/The-Passionate-Programmer-Remarkable-Development/dp/1934356344
[23:49:20] vim_shim: I know this shit and I feel like i have amazing disruptive power man. You know what's out there? Incredible dated microsoft access legacy systems - just waiting to be replaced by the new open standard.