« Back to channel list

#RubyOnRails - 10 February 2014

« Back 1 day Forward 1 day »
[01:07:02] helpa: Tokenizer: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[01:07:02] Radar: Tokenizer: !debug
[01:07:04] helpa: Nom nom. Thanks, Radar!
[01:07:04] Radar: !botsnack
[01:07:18] Radar: Tokenizer: Protip: you'll get better help if you share with us your code and take the time to explain it.
[01:07:33] Tokenizer: url_for() method is't available in a module ...
[01:07:40] Tokenizer: simple as that
[01:08:12] Radar: Tokenizer: Yes. Code isn't available everywhere automatically. Everything has its context.
[01:08:47] codesoda: Albright: data-* can be avoided, you just get a degraded experience
[01:09:21] codesoda: Albright: or have to render forms in place of links with data attributes
[01:09:31] RubyTitmouse: Tokenizer: include ActionView::Helpers ; include ActionDispatch::Routing ; include Rails.application.routes.url_helpers
[01:09:57] Albright: codesoda: Degraded in what way? I mean, can???t I just have paths like post/123/delete that cause deletion on a normal GET request?
[01:11:05] RubyTitmouse: depending on version
[01:11:31] codesoda: Albright: you'd have to make that a small form in the page instead, probably containing a single button with an X in it or soemthing
[01:11:45] Tokenizer: Radar: link sarchasm
[01:12:02] Radar: Tokenizer: Exactly.
[01:12:19] Albright: codesoda: As a n00b, I find that absurd.
[01:14:20] Jarg_: well, i just tried to run virutal box ubuntu machine but got a fatal error
[01:14:32] RubyTitmouse: Matz is nice, but DHH says "F U"
[01:14:33] centrx: Albright, It is always doable, but as a noob it would be easiest to stick with the Rails convention for deleting
[01:14:58] Jarg_: said 'no bootable device found'
[01:15:02] Jarg_: or something to that effect
[01:15:37] Jarg_: 'no bootable medium found, halted'
[01:15:47] Jarg_: whats that mean all u geniuses?
[01:16:31] centrx: Jarg_, Probably you have to set up the ISO as a device/CD in virtualbox
[01:16:47] Jarg_: how i do it
[01:17:49] centrx: Jarg_, Open up the settings for the new virtual machine
[01:19:22] Jarg_: change boot order?
[01:19:24] centrx: Jarg_, Go to Storage and add a CD/DVD device
[01:19:30] centrx: maybe I am not sure
[01:19:32] centrx: It is an ISO
[01:19:43] centrx: It might work out of the box if you burned the ISO to a CD
[01:19:51] centrx: but that should not be necessary with a virtual machine
[01:19:59] Jarg_: no i just have the virual box
[01:20:08] Jarg_: dont have the actual llinux iso
[01:20:33] centrx: Jarg_, Oh, well you were downloading Ubuntu right?
[01:20:41] centrx: Jarg_, You need to download an ISO...
[01:21:45] Jarg_: im dling it still
[01:21:54] centrx: Jarg_, Time to wait then :)
[01:22:14] centrx: Jarg_, The virtual machine has nothing inside it, you need to install from the ISO to give it an OS
[01:22:28] centrx: Jarg_, When the download finishes, see http://askubuntu.com/questions/64915/how-do-i-install-ubuntu-on-a-virtualbox-client-from-an-iso-image
[01:22:28] Jarg_: i gotta go to work ill be back ltr centrx
[01:22:46] Jarg_: cya centrx
[01:26:32] Radar: centrx: jayne finally caved on #rails. The channel is now +i :)
[01:27:23] pipecloud: Radar: huh, it's owned by freenode staff. How odd.
[01:27:27] Radar: pipecloud: yup
[01:27:39] pipecloud: Radar: Is it still a rubbyonsnails channel?
[01:27:52] Radar: I have no idea.
[01:28:21] pipecloud: I'm hoping for a good channel on trains.
[01:30:08] pontiki: you can register #choochoo
[01:30:25] tubbo: #ishittrainsbitches
[01:30:38] tubbo: #ishittrainsbitchesnowwhat
[01:40:13] RubyTitmouse: http://stuff.rubypanther.com/images/ror_is_fun.gif
[01:46:56] BrightNewFuture: Does rspec normally delete the contents of tables before running tests, when testing rails? Can I make it stop that?
[01:47:12] BrightNewFuture: http://stackoverflow.com/questions/21667710/how-to-add-pages-to-refinery-cms-testing-dummy-app-database
[01:48:43] yaw: how do I use the same text field for either username/email using Devise?
[01:55:30] centrx: Radar, Aha! Yes, I noticed
[01:55:45] centrx: Radar, We had quite a party in here on that day. I tried to make this channel about trains too...
[02:08:00] pontiki: cute pic, RubyTitmouse
[02:10:35] RubyTitmouse: pontiki: one of these years I'll find my crayons and color it
[02:12:08] pontiki: or use sharpies!
[02:12:11] pontiki: i <3 sharpies
[02:13:21] pipecloud: I use the blood of my victims^wenemies
[02:18:12] RubyTitmouse: I'd probably hurt myself with sharpies
[02:19:10] pipecloud: Only your brain if you sniff hard enough!
[02:19:48] RubyTitmouse: I was changing the whiteboard in a restaurant (they used an item number already taken in the db) and my wife handed me a sharpie, I was thinking, just what I need, to get high and deface the client's shop
[02:20:11] dzisentuboca: ARe you guys sick of fucking niggers?
[02:20:15] dzisentuboca: THEY ARE THE WORST
[02:20:24] RubyTitmouse: no, you are the worst.
[02:20:46] pipecloud: Radar: +b dzisentuboca ~CLIENTE04@187.153.59.178
[02:21:05] RubyTitmouse: dzisentuboca: http://programming-motherfucker.com
[02:21:10] dzisentuboca: That is why I am a member of this forum
[02:21:19] dzisentuboca: called Chimpout Forum!
[02:21:30] dzisentuboca: Here is the URL! http://www.chimpout.com/forum
[02:21:33] Radar: +b dzisentuboca!*@*
[02:21:43] Radar: pipecloud: on it
[02:22:12] Radar: +b *!*@187.153.59.178
[02:22:21] Radar: -b dzisentuboca!*@*
[02:30:36] BrightNewFuture: RubyTitmouse why did you send him to that particular website? I like it, haven't seen it before, but why? Just curious.
[02:31:33] RubyTitmouse: BrightNewFuture: because A) it is my favorite website and B) it is quoting a strong black character from a popular movie C) I wanted him to see the programmer gun pointed at his face
[02:31:52] BrightNewFuture: Lol, makes sense.
[02:32:21] RubyTitmouse: I usually only link it when people ask for reading recommendations or say "agile"
[02:35:02] pontiki: must have flood control turned on
[02:36:07] pontiki: craftsmanship is now a methodology?
[02:36:20] tubbo: lol as opposed to what
[02:36:23] pipecloud: I like how his thoughts on agile are "fuck you, tell me what you want. I don't really want to care about the rest."
[02:36:24] tubbo: just slapping shit together? :D
[02:36:28] pontiki: a way of thinking
[02:36:35] pontiki: a way of doing
[02:36:52] tubbo: i'm definitely more aligned with the "slapstick" philsophy of development
[02:37:00] pipecloud: A good way of doing business if you're a consultant, but it sure makes being a full time employee a lot of fun.
[02:38:11] pontiki: methodologies are management tools for pretending that mediocre people can write exceptional code
[02:38:59] snkcld: how does rake db:migrate generate the schema.rb files?
[02:39:25] snkcld: im trying to move my models off mongoid towards activerecord, and i need to move the 'field' out of the mongoid model, into the activerecord migration
[02:44:40] centrx: snkcld, Not sure I follow how that is related?
[02:46:17] centrx: snkcld, Looks like it uses "SchemaDumper"
[02:46:27] centrx: snkcld, Not sure if that is for all migrations, or only for a rake db:schema:dump
[03:07:14] n88: can someone take a peek at my link_to(image_tag()) and see why the image isn't actually a link
[03:07:17] n88: https://gist.github.com/n8fischer/44e2ffd5326f61f9afec
[03:09:53] ARMIGER1: Are environment variables loaded before initializers when pushing to Heroku?
[03:10:47] rushed: ARMIGER1: should be
[03:10:48] centrx: n88, What HTML is being produced?
[03:11:57] n88: centrx: check the gist again i just added the html
[03:12:47] ARMIGER1: rushed: That's what I thought, too. Everything was working great when I did that with Rails' secret key, but when I tried to push Devise with the devise_secret_key in an environment variable (with the variable already pushed to Heroku), it says it doesn't see it.
[03:13:30] centrx: n88, That should work..
[03:13:55] n88: centrx: i thought so too...
[03:14:43] n88: but it isn't in any browser
[03:14:47] centrx: n88, It works in this doohickey http://www.w3schools.com/html/tryit.asp?filename=tryhtml_imglink
[03:15:38] n88: centrx: i am honestly confused
[03:15:55] n88: the images are there, the html says they should be links
[03:22:38] bklane: I am trying to use Mechanize and grab a data-id attribute of a div..anyone know how to use the data attributes?
[03:28:35] ARMIGER1: rushed: Ok. Give me a bit.
[03:33:11] Adminator: \j wordpress
[03:34:19] n88: Adminator: don't do it!
[03:36:16] Adminator: wish I knew more about web dev technology choices, don't want to dive deep in the wrong direction
[03:36:59] centrx: Adminator, Have you made any progress?
[03:37:27] codesoda_: n88: you need to pass the image into the block
[03:37:32] Adminator: fakin nosy bots
[03:37:56] codesoda_: <%= link_to "facebook.com" do %> \n <%= image_tag ......
[03:40:09] ARMIGER1: rushed: The error is at https://gist.github.com/ARMIGER1/63a6afc79fb303eea20c.
[03:42:25] rushed: ARMIGER1: so if you look at the flow the error is in the precompile stage, not in running your app, assuming you're on Rails 3 you'll want to set config.assets.initialize_on_precompile to false in your production.rb - for more details see https://devcenter.heroku.com/articles/rails-asset-pipeline
[03:43:22] ARMIGER1: rushed: Do I still need config.assets.initialize_on_precompile to true in Rails 4 as well?
[03:45:19] riskish: are there any other beginners here that want to go through railstutorial.org together?
[03:45:32] ARMIGER1: rushed: Ah, looks like it doesn't need the option.
[03:46:26] ARMIGER1: rushed: Should I perhaps try precompiling locally to see if it works?
[03:47:42] rushed: ARMIGER1: I wouldn't, you'll just spam out files that you'll have to cleanup before you start developing again, did you check "heroku config" and the initializer?
[03:50:00] ARMIGER1: I did. "heroku config" lists the environment variable as there, and the initializer looks correct. The initializer, specifically is devise.rb, and the relevant line states: "config.secret_key = ENV['DEVISE_SECRET_KEY']"
[03:51:43] dopie: hey where can i learn about mailer captchas?
[03:51:47] rushed: ARMIGER1: is this your first deploy? is the devise.rb saved and committed?
[03:54:56] ARMIGER1: rushed: Heroku lists it as my 14th deploy. It's definitely saved and committed. If you would like to see devise.rb, it's here: https://github.com/ARMIGER1/moneyvate-core/blob/master/config/initializers/devise.rb.
[03:58:29] rushed: ARMIGER1: and you confirmed that heroku config lists DEVISE_SECRET_KEY (not SECRET_KEY or some other permutation?)... anything interesting change since your last deploy?
[04:00:07] ARMIGER1: rushed: Yep, heroku config specifically lists 'DEVISE_SECRET_KEY'. The only interesting change since the last deploy is the addition of Devise.
[04:01:12] rushed: ARMIGER1: are you sure the "heroku config" is returning results your staging app as opposed to production?
[04:01:27] absolutezeroff: to anyone who's familiar with activeadmin: how does one make it so that the activeadmin css only takes effect in the admin dashboard itself
[04:01:28] snkcld: rake -T is not showing db:tests:... am i missing something?
[04:01:53] ARMIGER1: rushed: Yes. The command I'm running in the terminal is: heroku config --remote staging
[04:12:22] ARMIGER1: rushed: Even when I check the rails console in my staging environment, it lists it as being there.
[04:15:45] RubyTitmouse: hey, does anybody have a link to that old "wtf is polymorphs" monkey picture from lifo's blog? Radar?
[04:19:02] eoinkelly: snkcld: I don't think db:tests: is part of default rails setup - are they tasks you setup yourself?
[04:42:04] snkcld: im trying to use serialize to serialize my array as a string in the database, but i would like to access it as an array proper, in my code
[04:42:14] snkcld: do i need to explicitly _deserialize_ it when i need it?
[04:45:19] centrx: snkcld, If it a serialized attribute, it should serialize and deserialize automatically? http://apidock.com/rails/ActiveRecord/AttributeMethods/Serialization/ClassMethods/serialize
[04:45:30] sprocket: can anyone recommend a favoured autocomplete plugin for rails 4?
[04:45:56] sprocket: i'm upgrading an old rails 2 app and the auto_complete plugin is no longer supported
[04:46:11] sprocket: actually, i suppose for rails 4 it'd be an autocomplete gem
[04:48:19] snkcld: centrx: the code which is still seeing it as a string, is actually brought in via included module
[04:48:32] snkcld: i wonder if i included the module _after_ the serialize statement, if it would help
[04:48:37] codesoda_: sprocket: when you say autocomplete you mean hitting the server for data?
[04:48:43] centrx: snkcld, Maybe yeah
[04:48:58] codesoda_: sprocket: because chosen is a great option https://github.com/harvesthq/chosen
[04:49:11] Radar: Anyone in here from the EU and can do a bit of VAT math for my jetlagged brain?
[04:49:12] sprocket: codesoda_: yes - calling a controller method
[04:49:38] Radar: I've got two bits of code giving me two different amounts. Trying to calculate the VAT inclusive amount for a product that's 100 Euros and the rate is 21%.
[04:50:01] Radar: One bit of code says 16.67, the other 17.36.
[04:50:16] codesoda: sprocket: there are a lot of rails gems for chosen, including adding ajax functionality http://rubygems.org/search?utf8=%E2%9C%93&query=chosen
[04:50:28] sprocket: awesome, thank you!
[05:03:09] yuko7: is mass assigment only relevant for update_attributes(rails 3)
[05:03:27] yuko7: would it matter if i up date my attributes one by one
[05:03:41] codesoda: yuko7: its only applicable if you are using attr_accessible on your models
[05:05:01] yuko7: codesoda: i know. im asking if even if i dont specify anything on attr_accessible...can i use other update methods ....does attr-accesible only affect update_attributes
[05:08:31] codesoda: yuko7: it would affect update_attribute as well
[05:09:15] codesoda: yuko7: if you don't have attr_accessible you need to make sure you use the permit method on the params
[05:09:40] yuko7: Yahkob: i said rails4
[05:09:44] yuko7: i said rails3*
[05:09:57] codesoda: yuko7: you can et this functionality via a gem
[05:10:26] codesoda: yuko7: check this http://weblog.rubyonrails.org/2012/3/21/strong-parameters/
[05:11:15] yuko7: codesoda: let me rephrase it does mass assignment affect only method that mass assign or does it also affect other method . example if you wanna update just one attribute. the answer seems to be yes..i just want confirmation
[05:12:25] codesoda: yuko7: you can always do my_model.attribute_name = "some value", reagrdless of attr_accessible or strong parameters
[05:12:40] yuko7: adn thank you for confirming
[05:13:19] codesoda: without strong parameters you'd want to set controller specific params in that way
[05:14:13] codesoda: yuko7: my gut feeling is you might be wanting to read about decorators or presenters to abstract some fat you are adding to a controller
[05:15:01] yuko7: codesoda: your gut feeling would be wrong..just doing some reading
[05:17:54] rushed: yuko7: you get into very long, very specific lines of questioning for just reading (this seems similar to your laser focus on migration edge cases yesterday), at some point you might find things go more smoothly if you start doing as questions will have real context to ground them :)
[05:18:37] yuko7: rushed: yesterday i was working on a migration stuff . im pretty much done
[05:28:11] RubyTitmouse: yuko7 don't be a vampire lolol and don't spill the soda jeeze
[05:28:31] codesoda: kids, play nice
[05:30:35] RubyTitmouse: yuko7: https://www.youtube.com/watch?v=91C7ax0UAAc MVC Public Service Announcement #1 - Controller Obesity
[05:30:54] pzuraq: hey, I'm having an issue with accepts_nested_attributes_for, getting "Couldn't find Door with ID=2 for Trim with ID="
[05:31:05] pzuraq: Here's the stack trace and relevant code: https://gist.github.com/pzuraq/9788f46522f85ce7a0d5
[05:31:12] Radar: ACTION falls off chair
[05:34:14] RubyTitmouse: pzuraq: you've probably got a view bug that is dropping the trim id, or else you have some broken data in your db
[05:36:33] RubyTitmouse: "trims_attributes"=>[{"name"=>"test", "start_year"=>2000, "end_year"=>2000, "model_id"=>nil,
[05:37:03] pzuraq: RubyTitmouse: Right now I'm trying to create a new trim and associate existing doors with it
[05:37:06] RubyTitmouse: so there was a trim when the form was built, it was either built wrong, or is not the the right one
[05:37:15] pzuraq: so the trim doesn't have an id
[05:37:54] RubyTitmouse: pzuraq: with nested stuff you have to be really careful about chicken/egg situations
[05:38:31] RubyTitmouse: it isn't always less work to nest :)
[05:39:11] pzuraq: I might just write a custom controller for my api for this one case
[05:39:29] pzuraq: where I need to nest arbitrarily deep, and associate/create new models
[05:47:36] agent_white: So... small victory... I found a fellow roobnoob on /r/progbuddies and we are writing an app! *self-highfive*
[05:50:08] Asitha: Hey does anyone here use REXML::ParseException
[05:50:12] Asitha: I mean REXML
[05:50:38] Asitha: I started getting a ParseException out of no where, and wondered if anyone else was having any issues with it
[05:51:00] helpa: Asitha: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[05:51:00] Radar: Asitha: !debug
[05:52:31] Asitha: This is the full trace I get - https://gist.github.com/asithade/8910961
[05:52:52] Asitha: Missing end tag for 'hr' (got "body") Line: 6 Position: 153 Last 80 unconsumed characters:
[05:52:55] Asitha: That's the error
[05:54:56] Radar: Please provide the following information in a new Gist:
[05:54:56] Radar: The code that you think is causing your problem.
[05:55:00] Radar: Seriously it's the first line :()
[05:55:12] Radar: I don't know if it's possible for me to be any more disappointed.
[05:58:04] Asitha: I updated the gist with the gem files code, and the section that's causing the issue
[05:58:05] Asitha: https://gist.github.com/asithade/8910961
[05:58:53] Radar: It would seem to be a problem with that gem... you should file an issue about it: https://github.com/asithade/imgur-ruby
[05:58:58] Radar: Except it's your gem :)
[05:59:07] Asitha: and I haven't changed it at all :S
[05:59:11] Asitha: and it was working less than 10 minutes ago
[05:59:12] Radar: Any particular reason why you're using REXML and not Nokogiri?
[05:59:32] Asitha: I'm new and that was how the gem I worked off was using it
[05:59:50] Radar: Nokogiri's got a better API and puts up with a lot more shit than REXML.
[06:00:02] Radar: I don't know why this code is erroring... I would need to dive deeper.
[06:00:14] Radar: And now it's time to go out and do other things than code. Good luck!
[06:00:25] Asitha: Thanks anyway :)
[06:38:02] drale2k: when localizing you website, is there a reliable way to do it automatically without asking the visitor for their language?
[06:38:20] drale2k: i am thinking about using the browser language maybe?
[06:39:49] sha256sum: drale2k: I don't use localization too much, but maybe this will help: http://guides.rubyonrails.org/i18n.html#setting-the-locale-from-the-client-supplied-information
[06:41:13] rvanlieshout: a browser supplies that ^
[06:41:18] drale2k: sha256sum: thanks
[06:41:28] drale2k: i love when i read code and than is says "Of course, in a production environment you would need much more robust code, .."
[06:41:41] sha256sum: drale2k: lol
[06:42:06] rhizome: startcom grr
[06:42:24] sha256sum: drale2k: where it should say "be aware that this example is the cheap way out and should not be tried in the real world"
[06:44:08] drale2k: i think the best way to go is to sniff it from the Accept-Language and have a drop down where you pre-select the language sniffed
[06:45:20] drale2k: i am worried about going completely automatic and then serving some canadian dude a japanese website ;O
[06:59:53] USvER: This drive me nuts
[07:00:07] USvER: Rails returns me cached template
[07:00:24] USvER: That don't even exist enymore
[07:00:57] rvanlieshout: when? restarted your rails server after you've changed / deleted that template?
[07:01:01] USvER: And this is in dev environment after rake tmp:clear
[07:01:15] USvER: Even reboot does not help
[07:01:36] USvER: madnesssssss
[07:01:36] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[07:08:59] USvER: rvanlieshout: https://gist.github.com/USvER/a6a6af53964142c4893f
[07:13:06] USvER: this is madnessssssssssss
[07:15:23] USvER: Somebody help me... I'm in desperate
[07:16:00] USvER: Need to show my work... and can't do shit....
[07:16:12] USvER: frustration over9000
[07:17:22] rushed: USvER: your gist doesn't include much that would let anyone help you :)
[07:17:53] USvER: that is all code i have
[07:18:04] USvER: still my rails returns me some old stuff
[07:18:19] USvER: that is not existing anymore
[07:18:31] USvER: including old controllers
[07:18:52] rushed: USvER: what old stuff, what's in the console, did you search for it, are you sure you're hitting the application you're editing (how did you confirm), etc
[07:19:08] USvER: i have one and only app
[07:19:16] USvER: if i turn off rails it is off
[07:19:25] USvER: if i turn it on it is on
[07:19:54] USvER: still root page returns me old cached template
[07:20:22] USvER: i have removed all code from controller
[07:20:26] USvER: removed all templates
[07:20:34] USvER: removed all layouts
[07:20:56] USvER: i even tryed to break my app by typing shit to the controller action
[07:21:10] USvER: still app is starting and working
[07:21:20] USvER: no errors
[07:21:40] USvER: i would love it to be like that in the future when i finish my app
[07:21:50] rushed: USvER: if you don't provide code, logs, html, etc it's going to hard for anyone to help :)
[07:21:54] USvER: but now..... fuckkkkkk
[07:22:06] USvER: what do you want to see
[07:22:13] USvER: i can show you screen in skype
[07:22:21] USvER: if you don't believe me
[07:22:30] rushed: USvER: scroll up lol
[07:23:09] USvER: rushed: ok... will try to explain again
[07:23:31] USvER: rushed: my rails app returning me old cached template
[07:23:36] rushed: USvER: explaining is not going to help
[07:24:18] USvER: then i helpless
[07:24:35] USvER: will smash my head in the table
[07:24:58] rushed: USvER: gisting what you seeing, the logs that were generated when you requested is, and the related code that shouldn't have produced it might help... but just explaining something that shouldn't be happening will just get you people agreeing "yes, that sounds like it shouldn't be happening" :)
[07:27:42] USvER: rushed, ok how about that
[07:28:12] USvER: rushed, removing all routes, and opening root returns me old template
[07:28:27] USvER: and console say nothing
[07:28:55] USvER: still if i ctrl-c rails app i'm getting nothing
[07:29:06] USvER: how is that possible?
[07:30:52] rushed: USvER: maybe you're not recognizing the verb gist as related to https://gist.github.com/ (you might checkout the channel topic for more details including https://gist.github.com/radar/996779 )
[07:31:46] USvER: ok shutng up... shooting up
[07:41:27] rabbi1: data: {src: 'works' } how can i have element starting with number ? data: { 1x: 'error' } i want it to be data-1x: 'works' ??? any help ?
[07:42:34] rushed: rabbi1: '1x' =>
[07:42:55] rabbi1: rushed: thanks answer in such a rush ;) appreciate
[07:43:24] rushed: rabbi1: might not be valid json though so might want to reconsider
[07:43:29] rabbi1: '1x': '' this isn't possible? should go the old way ?
[07:43:45] rhizome: what's the old way?
[07:45:01] pontiki: rabbi1: the post : format only applies to symbols
[07:45:10] pontiki: '1x' is a string
[07:45:35] rabbi1: rushed: yeah, tried this data: { :'1x' => 'error' } no errors but no end result also
[07:46:20] pontiki: have you tried it without the leading : ?
[07:47:09] rabbi1: pontiki: yeah, just did, no errors, but image is not displayed
[07:48:15] pontiki: assuming this is some sort of tag, link, or content generator?
[07:48:34] rabbi1: pontiki: yeap
[07:48:49] rabbi1: actual html: <img src="img/flex-admin-logo.png" data-1x="img/flex-admin-logo@1x.png" data-2x="img/flex-admin-logo@2x.png" class="hisrc img-responsive" alt="">
[07:49:01] rabbi1: rails: <%= link_to image_tag("flex-admin-logo.png", alt: "myTaxWare", class: "hisrc img-responsive", data: { '1x' => "flex-admin-logo@1x.png", '2x' => "flex-admin-logo@2x.png"}), root_path, class: "navbar-brand" %>
[07:49:16] pontiki: so that's what it emits? that is what i would expect then
[07:49:54] pontiki: what is handling the data- attributes on the client side?
[07:50:17] rabbi1: hisrc i guess
[07:50:52] pontiki: what is the html you are expecting? that html is just what the link_to should create
[07:50:59] rabbi1: pontiki: hold on, found a helper tab
[07:51:14] rabbi1: will give it a try
[07:51:55] rabbi1: pontiki: https://github.com/haihappen/hisrc-rails
[07:53:00] pontiki: so the rails part is right
[07:53:03] rabbi1: pontiki: cool, it's documented???.. i missed it. works good now
[07:53:06] rabbi1: thanks for support
[07:53:08] pontiki: look into why your javascript isn't working
[07:53:32] rabbi1: just had to use the helper responsive_image_tag in place of image_tag
[08:02:25] USvER: rushed: This helped config.assets.cache_store = :null_store
[08:02:39] USvER: rushed: total bullshit.....
[08:06:18] RubyTitmouse: USvER: http://deepinanime.blogspot.com/2009/11/rails-is-ghetto-original-copy.html
[08:17:44] Macaveli: Morning to you all
[08:18:06] BrazenBraden: morning all.. how does one use simple_form with a has_many through: association? https://gist.github.com/brazenbraden/3b18d94fc38b2f639cf4
[08:19:42] rvanlieshout: BrazenBraden: the sames as a normal has_many association
[08:20:06] BrazenBraden: rvanlieshout: that is what I did but it claims it cannot find an association for :group
[08:20:26] rvanlieshout: a contact doesn't have a group
[08:20:36] BrazenBraden: rvanlieshout: my bad :(
[08:20:46] BrazenBraden: i had :group instead of :groups
[08:30:42] macpool_: in bootstrap-sass documentation "Comment out components you do not want from bootstrap-custom."
[08:30:51] macpool_: how do I do it?
[08:31:19] macpool_: currently, the file contains "@import "bootstrap/bootstrap";" onl
[08:31:52] rvanlieshout: macpool_: open the source of the gem and read what bootstrap/bootstrap imports
[08:32:38] macpool_: but how do I put the components not required
[08:33:01] macpool_: if i donot want @import "tables"; ?
[08:33:42] Macaveli: What site do you guys use for simple image hosting?
[08:34:32] pontiki: i'm using S3
[08:35:08] Macaveli: pontiki, free?
[08:35:10] dachi: yes s3 is good
[08:35:42] rhizome: imgur is free
[08:35:57] bricker`LA: I've been paying money this whole time
[08:35:59] rhizome: you don't get what you don't pay for
[08:36:06] dachi: https://developers.google.com/picasa-web/ this is free
[08:36:12] macpool_: rvanlieshout: do I need to create bootstrap.scss file as well to comment out the components?
[08:36:23] pontiki: no, it's not free, but it's p.cheap
[08:36:51] rvanlieshout: macpool_: nope
[08:37:14] rvanlieshout: just remove the import bootstrap/bootstrap
[08:38:14] yuko7: is it normal that devise validates passwords and email but not first and last name (i don tusually use devise)
[08:39:21] macpool_: rvanlieshout: removing it has removed the entire bootsrtap from the app
[08:39:50] macpool_: if I try to put the components there, it thrown an errro
[08:39:52] rvanlieshout: you should import the parts you want
[08:39:59] rvanlieshout: bootstrap/components
[08:41:35] kies: looking at hstore for postgres, do i want to index the entire column or specific keys?
[08:41:36] RubyTitmouse: Macaveli: a junk drawer on a VPS
[08:42:15] pontiki: yuko7: how would you validate them?
[08:43:01] macpool_: thanks rvanlieshout
[08:43:14] yuko7: pontiki: my question is why is that devise validates one and not the other. im looking for a list of what devise validates
[08:43:57] Macaveli: When password saving password in Firefox it uses another site name, any way to set it. http://postimg.org/image/fehjh8sot/
[08:44:08] pontiki: look in the code
[08:44:28] pontiki: not all apps require knowing a person's name, first or last
[08:44:37] pontiki: why should devise force this?
[08:45:31] pontiki: sounds like a firefox question
[08:45:43] yuko7: pontiki: not all app require to validates the password to be less than 8 characters why would devise force this
[08:45:56] pontiki: i don't know
[08:46:03] yuko7: i don't know either
[08:46:50] pontiki: but if you are going to use devise at all, then a password of some kind is necessary, and all the shills that call themselves security experts say the same thing about minimum password length, so i'll give that to devise's authors
[08:48:58] pontiki: if you want to know definitively, read the source code
[08:50:40] kies: yuko7, devise only uses email and password by default, you can easily add first name and last name and use validates_presence_of or whatever in your model
[08:53:00] pontiki: that is so, the question was "is it normal" though
[08:58:21] kies: ah, well i would say yes, at the bare minimum if you're doing authentication, you'd probably want a email to send emails/password recovery and a password to login. the password length is changeable as well.. so if you dont like the default change it
[09:21:35] BrazenBraden: am I causing myself issues by having a model called Group ?
[09:22:17] agent_white: call it Posse
[09:22:28] pontiki: well played
[09:22:58] BrazenBraden: is that a 'yes'?
[09:23:11] pontiki: i would say 'yes'
[09:28:10] universa1: BrazenBraden: why don't you try it? and then google for rails reserved keywords
[09:29:00] BrazenBraden: universa1: I have tried it.. works fine until I tried Contact.group.name lol
[09:29:51] universa1: BrazenBraden: calling the association on the class makes no sense, rofl
[09:30:17] BrazenBraden: universa1: "Contact" is another model
[09:30:50] universa1: BrazenBraden: class Brazen; has_many :bradens; end Brazen.bradens makes no sense.
[09:30:59] universa1: BrazenBraden: Brazen.first.bradens does.
[09:31:28] pontiki: therein lies the problem, when you use a model name that matches an arel method
[09:32:05] pontiki: what actually is Group supposed to represent viz Contact?
[09:32:07] universa1: but then you don't call arel methods on an instance ;)
[09:32:13] pontiki: like a mailing list?
[09:32:40] pontiki: a collection of contacts?
[09:33:36] universa1: so my point being: you need to be exact in what you're writing, else your examples might make no sense at all.
[09:34:09] BrazenBraden: pontiki: yea a collection of contacts
[09:34:40] BrazenBraden: Contact has_many Groups though Cntact_Groups basically
[09:35:01] pontiki: yeah, sadly that's not going to work
[09:35:11] pontiki: i can't actually think of a better word
[09:35:30] pontiki: but it just overloads things
[09:35:36] BrazenBraden: pontiki: yea lol, coming up with alternative words which mean the same thing can be tricky
[09:36:00] BrazenBraden: I mean.. "Collection" could work but then again, that would prob clash with a rails word again
[09:36:05] pontiki: agent_white's Posse sounds pretty good right now
[09:36:39] BrazenBraden: pontiki: maybe just changing "Group" to "Grouping" would suffice?
[09:37:35] pontiki: if it works for you
[09:37:47] pontiki: it will not collide to the best of my knowledge
[09:38:57] BrazenBraden: aight.. will propose that change to the boss.. perhaps he can think of a better alternative to "group"
[09:39:13] pontiki: crowd, company, party, band, troop, pack, gathering, gang, bunch, congregation, *posse*, bevy, assemblage, league, circle (g+!), faction, camp, clique, coterie, cabal (!), ensemble, combo
[09:40:29] pontiki: WeFewWeHappyFew
[09:40:44] pontiki: i'd probably use that
[09:43:30] HardFu: anyone deploying to Amazon OpsWorks?
[09:43:45] pontiki: haven't even looked at it, HardFu
[09:44:13] HardFu: it's great, I like it better than Heroku, because I'm more in control of things
[09:44:49] pontiki: i don't use heroku, either
[09:45:13] BrazenBraden: i like Heroku just for throwing up a dev project just to see how it runs in production
[09:46:01] HardFu: We currently use Heroku for our production, but moving to AWS in a month or so
[09:46:28] BrazenBraden: Heroku is so expensive -.-
[09:46:40] BrazenBraden: AWS isnt much cheaper either...
[09:47:13] pontiki: i just use VMs for staging stuff
[09:48:12] BrazenBraden: pontiki: that is fine for yourself but what if you want a client to see and interact with the beta product?
[09:48:36] pontiki: i can throw VMs practically anywhere, including AWS
[09:49:30] BrazenBraden: i was initially shocked by the cost of rails hosting (because I was looking at all the dedicated rails hosts like Linode and such)... happy to discover that other cheaper hosts support rails (although you do have to configure and deploy yourself)
[09:50:05] pontiki: turnkeylinux hubs are a great way to toss something up to show off
[09:51:43] BrazenBraden: i wish i had more hours in the day
[09:52:41] BrazenBraden: or at least if we could live without sleep.. have some miracle vitamin or pill that could keep us operating at 100%
[09:52:47] HardFu: It is expensive, but using Heroku/AWS I can focus on building the business (which pays for hosting costs) and not on system managing
[09:53:27] BrazenBraden: HardFu: tis true.. but it can be abit out of budget for a freelancer working on his own projects
[09:53:39] HardFu: yes, that's another case
[09:54:08] BrazenBraden: Im thinking of signing up with someone like HostMonster or Site5 and use them as my host..
[09:54:20] pontiki: DO is p.cheap
[09:54:26] BrazenBraden: guess once you have a good recipe for deploying and the host is all set up, shouldnt be too bad
[09:54:35] pontiki: and you can startup/shutdown drops easily enough
[09:54:40] pontiki: digital ocean
[09:54:55] pontiki: that's the key, BrazenBraden
[09:55:13] pontiki: i love this trend towards completely disposable servers
[09:55:48] HardFu: and spinning new ones with a click ;)
[09:55:57] BrazenBraden: D.O seems alright as far as prices go... about the same as a standard host
[09:56:18] BrazenBraden: I think Linode (which was the cheapest I found earlier) is $20 a month
[09:56:19] pontiki: but it's a whole VPS
[09:56:37] pontiki: i'm paying ~$35/mo for my gandi VPS
[09:57:10] BrazenBraden: pontiki: i wouldnt mind paying that or more for a good vps IF I had income coming in to cover that expense
[09:57:12] pontiki: which is a bit more since i have a lot more RAM and disk
[09:57:28] pontiki: yeah, that would help...
[09:57:40] pontiki: it's just serving up my own stuff, no income generation
[09:58:09] egrouse: i have a 16gb / 2tb / i5 quad dedicated server for less than that
[09:58:10] BrazenBraden: i am busy on a project for a client (my first personal project). at least he is paying for the hosting
[09:58:48] pontiki: you mean independent project?
[09:59:27] HardFu: We're making about $10k monthly off our app, so hosting costs are preferable to spending times on ops
[09:59:30] BrazenBraden: pontiki: you could say that. I work for a company as a dev but in my spare time do my own thing too
[09:59:46] pontiki: yeah, cool :)
[10:00:06] pontiki: where, egrouse ?
[10:00:19] egrouse: as in physically? france
[10:00:25] pontiki: no, as in through whom
[10:00:28] egrouse: its from here: http://www.kimsufi.com/ but they've changed all their ranges now
[10:00:38] egrouse: so the one i have is no longer available... but they have many similar cheap ones
[10:00:57] Tokenizer: how can I say a date's month is january in ruby/rails? something like Time.now.jan_first <= my time <= Time.now.jan_last
[10:01:02] BrazenBraden: aight guys.. lunch time. bbs 1 hour
[10:03:33] pontiki: those are rather impressive prices
[10:04:05] pontiki: like about a quarter of what they used to run
[10:04:35] pontiki: Tokenizer: use a data range
[10:04:52] egrouse: they are indeed cheap
[10:05:13] egrouse: mine is im pretty sure i5 quad 3.2 / 16gb ddr3 / 2x 1TB soft raid / 100mbs net
[10:05:33] egrouse: hugely overpowered for my needs but eh its only ??23 a month or something so fuck it
[10:05:34] pontiki: .where(:my_date, (Date.new(2014,1,1)...Date.new(2014,2,1)))
[10:05:56] pontiki: assuming you're on rails 4 that is...
[10:10:36] pontiki: i think this will also work generically: .where(:my_date, (Time.now.beginning_of_month .. Time.now.end_of_month) )
[10:12:23] pontiki: you can also just do my_time.month == Time.now.month outside of an arel expression, of course
[10:12:41] pontiki: many possibilities
[10:15:17] pontiki: egrouse: the thought of having dedicated iron for less than i pay for a VPS makes me itch a bit
[10:15:27] egrouse: yeah man thats why i got it
[10:15:30] egrouse: i started getting a vps
[10:15:39] egrouse: but then after id bought vps, backup, etc etc
[10:15:43] egrouse: it was more than a dedi
[10:15:47] egrouse: so i just cancelled it and got this
[10:18:16] Ven: Hi, I got a bit of a strange behavior in a testcase ... When I use assert_difference, my `post :create, parent_id: @parent, project: {}` gives me "cannot find route : {parent_id => {project here}}". When I use `assert_not_difference`, I don't have that error (the test does fail, but that's expected)> Any idea of what's going on ?
[10:20:30] Ven: https://gist.github.com/Nami-Doc/1c4f261c1b496ad682c5
[10:23:09] workmad3: Ven: could you put the entire failed stack trace on that gist too please, and your controller code
[10:23:55] Ven: workmad3: how can controller code change anything to how routing works ? It doesn't even hit the controller
[10:24:22] workmad3: Ven: because controllers typically generate a route when creating in order to redirect to the new item
[10:24:44] workmad3: Ven: and it's unknown from what you have there what is causing the failure
[10:25:23] workmad3: Ven: hence the request for both that and more complete stack traces :P
[10:30:33] helpa: clocKwize: good morning IRCers, I hope that this day finds you hale and hearty
[10:30:33] workmad3: clocKwize: !gm
[10:33:21] osdc_bot: Hello, there.
[10:33:35] ace_striker: ! image helpa
[10:33:36] osdc_bot: http://mw2.google.com/mw-panoramio/photos/medium/3240716.jpg#.png
[10:34:16] ace_striker: ace_striker: ! hello
[10:34:25] Ven: workmad3: https://gist.github.com/Nami-Doc/1c4f261c1b496ad682c5
[10:35:04] oznik_: good late coold morning y'all
[10:36:18] ace_striker: ! youtube goodmorning
[10:36:19] osdc_bot: http://www.youtube.com/watch?v=Yu6--WBPBHo&feature=youtube_gdata
[10:36:36] soulnafein: What's the best way to deal with ActionController::BadRequest? rescue_from doesn't seem to work. Is there a way to define a default rescue method for that type of exception? Specifically it has been caused by some sql injection bot trying to type crap in the url.
[10:37:56] rvanlieshout: soulnafein: why would you want to rescue from that?
[10:38:50] greengriminal: I am having a CORS issue that requires preflight my application.rb is as followed: https://gist.github.com/anonymous/8913680#file-application-rb-L12-L26.
[10:39:10] greengriminal: Did go through: http://www.tsheffler.com/blog/?p=428 which he mentions
[10:39:34] greengriminal: if you want to follow this technique, you?ll need to make sure your routes allow access to HTTP ?:options? methods
[10:41:01] soulnafein: rvanlieshout: interesting point of view. Although there is nothing I can do about it and I don't want to pollute my exception logging app. Shouldn't that behave just like a normal wrong url (e.g. 404)?
[10:41:12] greengriminal: So in saying that would the following be okay: match 'edit', to: 'editor#index', via: [:get, :options], as: 'url'
[10:41:34] rvanlieshout: soulnafein: it doesn't know if it exists cause it will not parse the url
[10:42:46] rvanlieshout: greengriminal: if it tries to access 'edit' with options then yes
[10:43:31] soulnafein: rvanlieshout: would you suggest ignoring that exception instead? I can ignore it from my exception handling app and forget about it...
[10:43:52] workmad3: greengriminal: it would help if you said what your actual CORS issue was
[10:44:32] yuko7: how do you differentiate implementation and behavior
[10:44:54] greengriminal: workmad3: This was the response I got in the browser: https://gist.github.com/anonymous/8913740
[10:45:02] yuko7: its advises to test behavior and not implementation but whats what
[10:45:06] rvanlieshout: soulnafein: exactly
[10:45:12] workmad3: yuko7: generally by considering if someing has to happen vs whether it's happening as a by-product
[10:45:23] soulnafein: rvanlieshout: that answer my question. Thank you.
[10:45:48] greengriminal: workmad3: And i have to say this blog is a good read: http://www.tsheffler.com/blog/?p=428
[10:48:28] yuko7: workmad3: for example its advised not to test scopes because its "implementation" not behavior..if i have scope :order_class {where('class: ').order}
[10:49:07] yuko7: workmad3: testing it would be testing implementation? how come
[10:51:41] workmad3: yuko7: it would depend somewhat on how you tested it... if you did a very high level test where you created some test data and then tested that 'MyModel.order_class.to_a' gave you back an array containing the expected items, that's testing behaviour (because you could rewrite the scope to work completely differently and, as long as it behaved the same visibly (gave you back the same results in the same order) then the
[10:52:32] workmad3: yuko7: whereas if you did something like test that MyModel.order_class.to_sql == "Some specific SQL string" then you're testing implementation, not behaviour... you couldn't change that scope in any way without breaking it
[10:52:33] yuko7: workmad3: now if you have ten scopes are you gonna test them all..thats a lot of work
[10:53:48] workmad3: yuko7: not particularly... if you are writing your tests first, then you're never writing 10 scope tests all at once
[10:54:33] workmad3: yuko7: instead, for a scope, you'd start by considering specifically what types of models you should be getting back (as you should be doing) and then codifying that in a test straight away
[10:55:21] workmad3: yuko7: and it may be that you introduce a scope as part of the implementation for some other task... at which point, I wouldn't bother writing a test for it specifically
[10:55:58] workmad3: yuko7: basically, as with just about anything worthwhile, you need to think through what exactly you want to do... there is no get out of jail free card when it comes to actually thinking about what you want and how you want to achieve it :P
[10:58:13] yuko7: workmad3: so that gets confusing - some people recommend not to test scope at all. testing User.where(color: 'red') then testing the order User.order....whether its tdd or not its a pain
[10:59:57] Lewix: scopes are part of rails and are actively tested there
[11:00:52] Lewix: yuko7: you can trust rails to execute the proper SQL query for you?
[11:00:55] workmad3: yuko7: please note that I never said you should be testing User.where(...) and User.order()...
[11:01:21] workmad3: yuko7: I said that you should test that User.order_class returns the models that you expect from a known set
[11:01:48] alex88: someone uses guard-livereload? when I run `bundle exec guard start` I get the guard console, but then I've to manually press return to make guard accept connections, trigger browser updates
[11:01:54] workmad3: yuko7: which is a *very* different thing
[11:01:58] alex88: isn't a way to make it do that automatically?
[11:02:25] workmad3: alex88: I didn't need to hit return
[11:03:00] workmad3: alex88: check what files you have guard-livereload watching... changes to those files will cause guard to trigger livereload automatically
[11:03:21] workmad3: alex88: changes to other files won't (and means you should extend what guard-livereload is watching, probably)
[11:03:34] alex88: workmad3: this is what I got, http://pastie.org/8718355 on line 1 browser ws connection is "pending" then I hit return and it connects, I change a file and it reload, but until I don't press return, browser never gets connected
[11:03:41] alex88: maybe it's an issue with rubinius
[11:04:12] workmad3: Lewix: you can trust that rails will execute SQL correctly... but you can't necessarily trust that you haven't made a mistake in the code for your scope and you're returning the wrong stuff ;)
[11:04:47] workmad3: Lewix: which is a difference between testing that a scope works (testing rails, unnecessary) and testing that your specific 'foobar' method returns foobars and nothing else ;)
[11:06:12] Lewix: workmad3: I think that's it's fallacy to believe that everything can be tested. At some point you have to decide if it's worth the effort and weight the pros against the cons
[11:07:05] Lewix: workmad3: I agree though
[11:10:28] workmad3: Lewix: sure, that's a general over-arching principle ;)
[11:11:38] workmad3: Lewix: and whether to test a specific scope will depend quite a bit on whether it's already covered by a test for something else (because it was introduced as part of creating something that manipulates foobars, and that test will fail if your foobar scope is wrong)
[11:12:34] workmad3: Lewix: but the 'don't test scopes because of X' (replace X with your choice of overly simplistic reasoning) is, IMO, not a good idea to spread :)
[11:13:00] workmad3: at least, not as an explanation to someone trying to understand in a bit more depth
[11:24:56] ace_striker: i am in very strange error here ..so i am creating a record with this create def https://gist.github.com/igauravsehrawat/8914233 but i am getting that new record does not exist . ..any help plz
[11:25:10] ace_striker: the error : http://postimg.org/image/gceqwpqhd/6a521f09/
[11:28:07] workmad3: ace_striker: redirect_to material_path(@material)
[11:28:51] workmad3: ace_striker: although that's not directly causing your error :)
[11:29:01] workmad3: ace_striker: would need to see your form in that gist too, I'm afraid
[11:30:08] ace_striker: workmad3: thanks.. i am uploading gist ..
[11:30:23] ravionrails: also controller name is singular here instead of Materials
[11:31:37] ace_striker: ravionrails: will that affect..to cause error
[11:32:27] ravionrails: routing will be affected , but what's the whole error you got
[11:32:34] ace_striker: http://s10.postimg.org/5pbiketd5/routing_error.png the routing error
[11:32:49] ace_striker: workmad3: ravionrails : my form https://gist.github.com/igauravsehrawat/8914317
[11:33:31] ace_striker: ravionrails: i am getting now routing error ..on form save action
[11:36:16] ace_striker: i think i have restart again.
[11:36:56] ravionrails: convention over configuration : controller name should be plural
[11:37:57] ravionrails: if you not follow one thing it will create
[11:38:32] ace_striker: thanks ravionrails workmad3
[11:44:42] ghigt: hi, I have a question about db requests
[11:45:26] ravionrails: sorry for invalid keys
[11:45:43] yuko7: workmad3: how to access the session[] in a model test
[11:46:15] yuko7: or sign_in
[11:46:46] ghigt: I have 2 models (Collections and Interests) and I would like to select all the collections where there is not the interest targeted
[11:46:51] workmad3: yuko7: you don't
[11:47:02] ghigt: But my request doesn't select empty Collections
[11:47:03] workmad3: yuko7: model tests don't have sessions or a concept of being 'signed in'
[11:47:30] yuko7: workmad3: i have a scope that return the user minus the current user
[11:47:40] yuko7: workmad3: i need to sign in to be the current user to test it
[11:48:03] workmad3: yuko7: don't have a scope that relies on the current user
[11:48:17] workmad3: yuko7: have a scope that removes a user passed in as a parameter
[11:49:06] yuko7: workmad3: it doesnt change anything if the currentuser is the user passed
[11:49:22] workmad3: yuko7: except that then in your test you can pass an arbitrary user
[11:49:27] workmad3: yuko7: and not have to worry about a session
[11:50:21] workmad3: yuko7: and more generally - your model layer will get horrendously muddled with your controllers if you start trying to rely on concepts like the session and session-related stuff like 'current_user' inside it
[11:50:56] workmad3: yuko7: so when you need to rely on data - pass it into the model layer, so you can operate in the model on passed-in data regardless of where it came from
[11:52:06] workmad3: yuko7: it'll also mean that when you need to do something like re-use your model inside a rake task or a cron-job (where there isn't a session or a current_user) then you won't get horrible errors because of that ;)
[11:54:33] yuko7: workmad3: thanks for the clear explanation
[11:54:48] yuko7: workmad3: what's the difference between lambda scope and non lambda scope
[11:55:45] workmad3: yuko7: used to be that you needed a lambda scope in order to pass in params... rails 4 wants you to use lambda scopes all the time, so you can forget that non-lambda scopes exist
[11:56:17] workmad3: yuko7: also, if you have a scope that isn't stupidly-simple, the suggestion is to create it as a class method for clarity
[11:56:54] yuko7: workmad3: thats what im about to do but can we pass arguments with lambda scopes?
[11:57:21] workmad3: it's just messy
[11:57:33] yuko7: workmad3: how?
[11:57:48] swombat: What's the most sensible setup for a new bootstrap 3 site these days (willing to learn new tech, but already familiar with LESS, rails 3, etc)
[11:58:01] universa1: ->(who) {where(user_id: who)}
[11:58:25] Lewix: ACTION didn't know that one
[11:58:59] workmad3: or lambda{|who| where(user_id: who)}
[11:59:19] workmad3: either way, it's not exactly the clearest code :)
[11:59:35] workmad3: hence the normal recommendation to push that into a class method
[12:00:14] krz: when manually destroying a user record via User.find(...).destroy. whats the cleanest way to remove the respective sessions as well?
[12:00:26] Lewix: ->(who) is it new or it's been there for ages
[12:00:40] krz: this is easy enough if it were dont in the controller. but lets say it needed to be done in rails console
[12:00:44] workmad3: Lewix: it's been there since they introduced the -> syntax
[12:00:45] krz: dont=done
[12:00:56] workmad3: krz: if it's a cookie-based session... you can't
[12:01:14] omarqureshi: Lewix: introduced in 1.9
[12:01:17] omarqureshi: stabby lambda
[12:01:22] ace_striker: convention works..
[12:01:25] omarqureshi: since it looks like a knife.
[12:01:33] workmad3: krz: you just need to add code that invalidates the session if it's for a non-existent user_id
[12:01:43] Lewix: i like it
[12:01:56] Lewix: it's sexy
[12:02:02] workmad3: Lewix: I don't... I dislike the args coming after the ->
[12:02:34] workmad3: Lewix: as it *really* screws people up when they switch between ruby and coffeescript... (foo)-> in CS, ->(foo) in ruby
[12:02:44] rvanlieshout: swombat: use a bootstrap gem
[12:02:49] swombat: As in, my question is, do you use scss, less, etc?
[12:03:02] krz: workmad3: as in check if session[:user_id] has an actual id in the user table, in some controller?
[12:03:07] swombat: or is that basically purely a matter of taste
[12:03:20] krz: if not then session[:user_id] = nil ?
[12:03:29] krz: and redirect?
[12:03:33] rvanlieshout: swombat: it is
[12:03:41] rvanlieshout: as using bootstrap is
[12:03:43] rvanlieshout: (though i like it)
[12:04:24] workmad3: krz: I think there's a reset_session method in rails (or call sign_out or similar if you have such a thing available in your auth framework)
[12:04:29] workmad3: krz: but that's the gist of it
[12:07:34] Astralum: helpa, please. I use searchkick. How I get id from search result?
[12:09:34] rvanlieshout: Astralum: read the documentation of searchkick?
[12:09:55] Astralum: rvanlieshout, yes :)
[12:10:22] rvanlieshout: what have you tried so far?
[12:11:56] greengriminal: I am trying to simply override the devise invitable mailer view so that includes the widget id in my accept invited url. I have the following gist: https://gist.github.com/anonymous/8914787
[12:12:38] greengriminal: I mean how difficult is it to get the following: http://localhost:3000/users/invitation/accept?invitation_token=iksvqzq3MGWbc6usaGDa?widget_id=1
[12:13:12] greengriminal: which with my setup does not work
[12:13:29] rvanlieshout: you shouldn't get ?inv...?widget_id= but ?inv...&widget_id=...
[12:13:32] rvanlieshout: but what doesn't work?
[12:14:23] Astralum: rvanlieshout, I don't know how to get the id of any significant products of the object Searchkick::Results
[12:14:32] helpa: Astralum: 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.
[12:14:32] rvanlieshout: Astralum: !code
[12:14:51] greengriminal: rvanlieshout: Okay well I don't get the ampersand at the end of the token
[12:15:13] rvanlieshout: greengriminal: does @widget_id have a value?
[12:16:59] Astralum: rvanlieshout, http://pastebin.com/unVALWsY
[12:18:05] Astralum: rvanlieshout, http://pastie.org/8718539
[12:18:27] Lewix: workmad3: ah i see. i dont use much cs
[12:18:31] rvanlieshout: Astralum: so ads would be something you iterate over
[12:18:34] rvanlieshout: ads.each do |ad|
[12:18:37] rvanlieshout: then query for ad.id
[12:20:07] Astralum: rvanlieshout, It's not good idea
[12:20:49] rvanlieshout: Astralum: cause?
[12:24:01] Astralum: rvanlieshout, http://pastie.org/8718551
[12:24:54] Astralum: rvanlieshout, It selected many unnecessary fields
[12:25:42] rvanlieshout: Astralum: a) why
[12:25:46] rvanlieshout: Astralum: b) then specify that
[12:26:56] timmi_qt: I am using fancybox2-rails gem for being able to open webpages in modal windows. Everything works fine, except that all images are missing, e.g. the close button is no "x", rather just black. I tried using fancybox-rails (version 1), which does work with images, but I need the fancybox2, because of the "afterClose" attribute. Does anyone have expierience with fancybox2-rails? I've been looking for hours now :(
[12:30:45] Astralum: rvanlieshout, Elastic returns the identifiers. And I need to get them then I could do something like that: Ad.select('title', 'id').find(1, ...). Otherwise he will receive all the fields from a table.
[12:32:38] rvanlieshout: so why not do that?
[12:33:29] Astralum: rvanlieshout, what is it?
[12:34:33] rvanlieshout: https://github.com/ankane/searchkick#personalized-results
[12:35:01] rvanlieshout: oh wait.. that's not the response
[12:35:30] rvanlieshout: but stil.. you can remap your results into something that only has two fields
[12:35:37] rvanlieshout: but shouldn't you solve that later on?
[12:38:55] Astralum: rvanlieshout, Yes, you understood correctly what I want to do. Simple I want to choose 2 a field from the table. But I can't understand how to do this using searchkick.
[12:39:19] rvanlieshout: dunno.. but what is your problem with having complete ad objects?
[12:42:29] Astralum: rvanlieshout, Creates unnecessary overhead
[12:42:49] rvanlieshout: Astralum: and the code to remove that won't?
[12:46:59] Astralum: rvanlieshout, I have many fields in the table. On the page you want to use only 2-4 field. And the data is passed into the page using ajax. The less is passed, the better.
[12:47:32] rvanlieshout: how is it passed
[12:52:22] Astralum: rvanlieshout, http://pastie.org/8718637
[12:52:25] hiall: Trying to do a maths response but based upon form data so my operator is a string. Is there a way of achieving this? http://paste2.org/tLdx9GE3
[12:53:33] toretore: hiall: if operator == '<'; first < last; end
[12:53:37] Astralum: rvanlieshout, This is my bad decision. I want to do the same but when there is a sample from the table. But as I understand searchkick not allow it.
[12:53:54] rvanlieshout: Astralum: dunno how searchkick initializes these instances
[12:54:12] hiall: toretore: so I'd have to case all operators? hmmn ok
[12:55:28] Astralum: rvanlieshout, I will directly use elastic, without searchkick.
[12:56:09] ravionrails: i want to know about scalable architecture for rails app , any good references
[12:56:20] helpa: Ruby on Rails doesn't scale - nothing to see here - move along. http://twitter.com/
[12:56:35] ravionrails: ok for a web app
[12:59:19] rvanlieshout: ravionrails: i would worry about setting up your app proplery
[12:59:31] rvanlieshout: cause wrong db or app design is most likely to cause issues
[13:00:56] ravionrails: thats why i am talking about rails, because i have to change my app also
[13:01:14] ravionrails: - to be scalable
[13:01:22] rvanlieshout: 'scalable' is a buzz word
[13:01:32] rvanlieshout: rails is uses in huge applications for sure
[13:02:19] cheeti: pls suggest me that how to add placeholder for simple form dropdown? https://gist.github.com/mamatharao/8915521 it's not working for validation. with out selecting anything from clienk it's validating true.
[13:02:36] rvanlieshout: cheeti: read about include_blank
[13:05:12] cheeti: <rvanlieshout> thanks
[13:05:38] spygame: what's the best way to check if a given timestamp is within the next 48 hrs ? is there any built-in function for DateTime to check dates in future ?
[13:06:08] rvanlieshout: spygame: timestamp < 48.hours.from_now
[13:06:15] rvanlieshout: && timestamp > Time.now
[13:12:47] BrazenBraden: I am fighting a tad with getting the right info out of my models for a collection select box.. basically, I have a contact which has a company. the contact can belong to a number of groups. I want to be able to select only the contacts that have a certain group and get the company name to be in the select box.. https://gist.github.com/brazenbraden/c0a394b67aea4da58410
[13:17:52] HardFu: Guys, I found a solution for OpsWorks JSON to application.yml, and documented it, in case someone finds it useful
[13:17:53] HardFu: I found a great solution for OpsWo
[13:18:00] HardFu: http://zaman.io/how-to-import-aws-opsworks-json-into-rails-app/
[13:23:14] artmann_: Hi, I'm trying to record a set of Games that consist of 2 players but I have some trubble to get the relationships right, any ideas? https://gist.github.com/Artmann/78fab2f7259eacb162c6
[13:24:36] DaniG2k: does anyone know how I can monitor how much traffic is used with one of my rake tasks?
[13:24:55] ravionrails: so Player and Game have many to many relationship?
[13:25:02] BrazenBraden: artmann_: for one, your has_many for player in class Game is not plural
[13:25:21] artmann_: Yea there will be an m2m relation
[13:25:37] artmann_: 1 player can play alot of games and a game consists of 2 players
[13:25:44] BrazenBraden: artmann_: and class GamePlayer must also belong_to player
[13:26:08] artmann_: updated, Is this a valid approach?
[13:26:18] ravionrails: so in Player and Game should have has_many :game_players imo
[13:28:10] artmann_: Relationships gets confusing sometimes :P
[13:30:13] BrazenBraden: speaking about relationships... any idea on my question above? :3
[13:48:49] yuko7: i use a local variable in my action (controller)...user instead of @user, how do i test that assign(:user) is for @user. what do i use for user
[13:49:41] pontiki: you can't test the value of a local variable inside the controller
[13:49:55] prateekp: how to pass a parameter like "https://community.topcoder.com/tc?module=Static&d1=tutorials&d2=hungarianAlgorithm" through utl
[13:50:05] pontiki: you have to use an instance variable
[13:50:21] pontiki: maybe you actually want to use something else in that test anyway
[13:50:40] prateekp: actually there are & character which splits the parameter
[13:50:44] prateekp: so how can this be avoided
[13:51:46] pontiki: prateekp: that full url string is the parameter value you want passed?
[13:52:02] pontiki: i would suggest encoding it
[13:53:53] prateekp: i did URI.encode(url) but its not changing & character
[13:55:52] prateekp: can number of parameters passed be fixed to 1
[13:56:39] pontiki: do you mean escape?
[13:57:53] prateekp: i used URI.encode(url) but i guess & character is not encoded
[13:58:23] pontiki: hmm.. thought it would be...
[13:58:36] pontiki: but you can also pass as a second char the list of unsafe chars
[13:58:49] pontiki: hang on a tic, let me test something
[14:01:37] pontiki: alright, here's an interesting little ditty: URI.escape(myurl, %r{[[:punct:]]})
[14:02:00] pontiki: that will make it escape all punctuation
[14:05:00] prateekp: pontiki: it returns https%3A%2F%2Fcommunity%2Etopcoder%2Ecom%2Ftc%3Fmodule=Static%26d1=tutorials%26d2=hungarianAlgorithm which is not the actual page
[14:05:20] pontiki: you have to unescape it where you want to use it
[14:06:44] prateekp: actually i did URI.encode(url,"&")
[14:06:59] prateekp: which returned https://community.topcoder.com/tc?module=Static%26d1=tutorials%26d2=hungarianAlgorithm
[14:07:06] prateekp: but this page is not existing
[14:07:15] prateekp: the page works with & only
[14:07:18] pontiki: and then did you unescape it when you want to use it??
[14:07:21] workmad3: prateekp: as pontiki said, you'd need to unescape before you can use it
[14:07:34] pontiki: URI.unescape(URI.escape(myurl)) == myurl
[14:07:45] workmad3: prateekp: & and %26 are *not* the same thing in a URL (which is kinda the point)
[14:08:53] pontiki: ciao, all \o
[14:10:05] prateekp: hey would this what u want to say
[14:10:07] prateekp: URI.unescape(URI.escape(url,%r{[[:punct:]]}))
[14:10:46] helpa: prateekp: Why don't you try it and find out for yourself?
[14:10:46] workmad3: prateekp: !try
[14:11:39] prateekp: hmm i am trying ... this encode decode is taking my mind a lot
[14:12:13] workmad3: prateekp: it's not particularly difficult... you encode the URL in order to use the URL as a URL parameter in another URL
[14:12:20] workmad3: prateekp: and then you need to decode it before you use it again
[14:12:50] prateekp: can i ask a basic doubt
[14:12:51] workmad3: prateekp: the encoded URL cannot be treated as a URL (all the meaningful characters have been encoded into a non-meaningful form so as to allow you to transfer it)
[14:13:14] workmad3: prateekp: ask away
[14:13:23] prateekp: so why do we do encoding and then decoding to come back to same thing
[14:14:06] workmad3: prateekp: because you don't do it at the same time
[14:14:16] workmad3: prateekp: you encode, then put it into a URL as a param
[14:14:26] workmad3: prateekp: then on the other side, you get the param and decode to get back the original URL
[14:15:22] prateekp: ok ... so u mean ... i will encode the parameter url and then add to URL as a param and the apply decode on the whole
[14:15:23] prateekp: am i correct
[14:16:11] workmad3: prateekp: no
[14:16:18] workmad3: prateekp: you only decode the parameter
[14:16:29] workmad3: prateekp: but on the 'other side' of the call
[14:16:47] prateekp: ohh .. whats the 'other side'
[14:16:57] prateekp: sorry to ask such basic ones
[14:17:08] workmad3: prateekp: well, you're creating another URL, right, which points somewhere
[14:17:24] workmad3: prateekp: the 'other side' is where making a request to that constructed URL ends up
[14:17:34] workmad3: prateekp: you don't decode locally
[14:18:24] prateekp: hmm ... this is my url that fails localhost:3000/read?ad=https://community.topcoder.com/tc?module=Static&d1=tutorials&d2=hungarianAlgorithm
[14:18:37] prateekp: because of end character
[14:19:42] prateekp: ok i am getting it
[14:19:49] prateekp: i was taking the things totally wrong
[14:25:27] alienaut: i built custom authentication system. i want to build edit user page. i want to ask user their current password. i have some ideas but not sure it is best practice. do you know any good example to reference my status
[14:26:00] _aeris_: ohai everybody
[14:26:10] AntelopeSalad: alienaut: it's usually a good idea to ask for their password, especially if they are changing their password or email
[14:26:31] Lloyd: also unless its totally required, don't build your own auth system
[14:27:03] _aeris_: where i have to store and require files to extend class (like Object, String???) with new method, without having to restart the server on each modification of those files ?
[14:27:51] _aeris_: currently, i only put the code in config/application.rb, but it's not a good place :(
[14:32:14] alienaut: uhmm, i built my own authentication because there is 2 different model to authenticate
[14:33:28] alienaut: one is Admin and other one is User models
[14:35:17] prateekp: in this url http://localhost:3000/read?ad=https://community.topcoder.com/tc?module=Static&d1=tutorials&d2=hungarianAlgorith, broswer consider it having 3 parameters but instead it has actually 1 parameter
[14:35:33] prateekp: how can this be avoided
[14:36:21] prateekp: i want to have whole url as parameter under ad
[14:36:37] yuko7: can we use iterative block in a rspec it
[14:36:59] catphish: does anyone know if it's possible to send text+html messages using actionmailer but without a template? the documentation describes a method of doing it, but i still get missing template errors
[14:37:49] Lloyd: alienaut: why not use a flag on the user model?
[14:37:55] workmad3: prateekp: you've been told that
[14:38:18] workmad3: prateekp: you encode the URL https://community.topcoder.com/tc?module=Static&d1=tutorials&d2=hungarianAlgorith before putting it into the full URL
[14:39:03] workmad3: alienaut: it's best practice
[14:39:05] CorySimmons: In versioning (Gemfile) what do all the version symbols represent? Particularly, ~> ?
[14:39:11] oznik_: i see two gems that facilitate autocomplete in a form, rails4-autocomplete, and select2. can anyone recommend either?
[14:39:26] workmad3: alienaut: in fact, letting a user change a password without confirming their identity is a security breach
[14:39:56] ddd: BIG time
[14:39:59] workmad3: alienaut: same goes for letting a user change their email address (unless you have a secure forgotten password workflow that doesn't involve sending an email address)
[14:40:18] workmad3: *sending an email to their address
[14:41:05] workmad3: alienaut: btw, devise is really easy to set up with two different models to authenticate against (it's even got a wiki article purely about that)
[14:41:24] ddd: alienaut and you only need a *SINGLE* authentication. Not 2. You authenticate the *USER*. You set a flag on the user wrt whether they are an admin or not.
[14:41:48] workmad3: ddd: there can be some sense to having completely separate authentication flows for user and admin ;)
[14:42:09] ddd: workmad3 I don't see it, but ok
[14:42:43] workmad3: ddd: for starters, it makes it a lot easier to do 'view as user X' style features for admins in social networks
[14:42:48] workmad3: ddd: because the sessions are separate
[14:43:24] workmad3: ddd: it also means that you can more easily do things like have a normal UN/PW combo for users, but require admins to do UN/PW/TOTP
[14:44:12] ddd: TOTP? (mind's not pulling up the abbr)
[14:44:26] CorySimmons: How can I import .less and .scss from the same assets/stylesheets folder?
[14:44:26] workmad3: ddd: timed one-time-password
[14:45:40] workmad3: ddd: also, if you separate out the admin and user login pages (not necessarily the models), you can require different subdomains for logging in, with the admin one only available on a local intranet or VPN, or similar
[14:45:55] ddd: workmad3 OK, thats unique to social networks, and I can see your point itr. I sort of see your point for the 2nd choice, however, unless you require heavier security (like admins have access to billig or PI) I hold a different position. (Don't necessarily disagree, it just depends on the needed level of security)
[14:46:11] ddd: workmad3 ahh, that last one makes the most sense to me
[14:46:25] workmad3: ddd: oh, I didn't say these were universal things that meant you should always do it that way
[14:46:32] workmad3: ddd: just that you can get some benefits from it ;)
[14:46:59] ddd: the last one though, couldn't you do a single model authentication but use the subdom as part of the authentication mode?
[14:47:09] DaniG2k: I've put the passenger gem in group :production but the rails server asks for it even in development mode
[14:47:12] DaniG2k: what gives?
[14:47:16] ddd: yeah i can see where you could derive value.
[14:47:23] workmad3: ddd: if you note, I said that you didn't need to separate out the models in that one ;)
[14:47:24] ddd: didn't look at it from that pov. makes sense
[14:47:42] ddd: tis true, you did
[14:48:14] workmad3: ddd: of course, if you needed some of that increased security, you'd probably go for a more multi-layed model where you track how well authenticated a session is
[14:48:48] ddd: workmad3 multiple points, or multiple layers?
[14:48:59] workmad3: ddd: so you could provide someone with an admin account just user access if they used UN/PW, then escalate their privileges if they were on a VPN connection and had provided a TOTP at point of escalation
[14:50:01] workmad3: iirc, that's the sort of layered approach to authentication that kerberos provides
[14:50:06] ddd: i'm thinking with the multi-layer it'd convolute the process a bit. what are you seeing as a multi-layer? (fast generic example, maybe i'm thinking of something a bit different)
[14:50:15] ddd: ahhh. i got you now
[14:50:33] workmad3: ddd: I'm thinking layers in terms of privilege escalation ;)
[14:50:38] ddd: i got you
[14:50:44] ddd: in-app sudo
[14:50:50] lexi87: Can someone help me brainstorm? I am trying to show the original message that started the conversation. So I have `scope :inbox, -> {where('conversation_id IS NULL')}`. The original message conversation_id will be NULL, and all replies will have a conversation_id that matches the original message_id. This code works perfect if you're the recipient. But if you're the sender you will never get the responses (conversation thread) in y
[14:50:50] lexi87: inbox. Any have any ideas of how I should go about his as I can't seem to think of any good scenarios.
[14:51:18] workmad3: ddd: yeah, that sort of thing :)
[14:51:21] DaniG2k: why are gems in the production group being asked for when i startup the rails server
[14:51:27] DaniG2k: i shouldnt have to gem install them
[14:51:34] ddd: `what was that cgi authentication that provided that?
[14:51:46] ddd: provided a suid or something for a cgi script
[14:52:06] Scient: DaniG2k: stop doing it wrong then :)
[14:52:10] workmad3: ddd: hard-core CGI scripting is before my time :P
[14:52:24] Cork: is there a way to have a rails controller generate a cache .js file (with a specific name)?
[14:52:58] ddd: think fastcgi had a seteuid option or something that people tied into .htaccess or in-app authentication systems.
[14:53:29] swombat: doesn't Rails include all the scss files in assets/javascripts by default? If so, how come a mixin I defined in one file is not visible in application.css.scss?
[14:53:39] ddd: cork if you require a specifically named cache file, you're doing something wrong
[14:54:04] ddd: swombat iirc, you have to add it to the manifest which i thought rails did by default from 3.x and up
[14:54:04] Cork: ddd: i want to generate translations files for the js part of the page
[14:54:10] Cork: but not generate them every request
[14:54:15] workmad3: swombat: the *= require directives that are in the manifests do not share .scss state
[14:54:17] Cork: so they need to have separating names
[14:54:24] Cork: translate-eng.js and so on
[14:54:40] swombat: workmad3: so I can't use mixins from one file in another?
[14:54:53] workmad3: swombat: sass-rails does set up @import so that it works correctly with asset pipeline paths though
[14:55:06] ddd: cork hrmm. thinking.
[14:55:15] workmad3: swombat: sure you can... you just need to @import it, like you would normally with a .sass or .scss file outside the asset pipeline
[14:55:29] swombat: ok, so I just import it manually in the application.css. Ok, got it
[14:55:48] workmad3: swombat: if you do it in the manifest, you need to change it to application.css.scss
[14:55:54] workmad3: swombat: and I do not advise doing that...
[14:56:11] Cork: ddd: what i want to do is basically :text => "var translation = #{ I18n.t(:js) };"
[14:56:17] swombat: when you say "manifest", what do you mean? I thought you meant application.css.scss
[14:56:20] Cork: and then have the cache stay for that language
[14:56:35] workmad3: swombat: you're not restricted to just application.css.scss as a manifest ;)
[14:57:12] workmad3: swombat: a manifest is a 'top-level' file that gets compiled down and can be included in a view in my usage... so you start with application.css and application.js as manifests
[14:57:50] swombat: I see. And you're saying I should *not* include stuff in there, just include it in other files?
[14:57:52] workmad3: swombat: I recommend that when you want to pull in mixins that you do so by @importing the file(s) containing them into the file using them
[14:58:29] swombat: most of the css files will likely use this mixin, it's the at2x mixin for retina images
[14:58:50] workmad3: swombat: I recommend that for many reasons, mostly to do with explicit dependencies being much easier to track
[14:58:54] Cork: opps missed an .to_json in htere
[15:00:05] swombat: workmad3: so what do you do when you need to use a bootstrap mixin? Surely you don't want that imported in multiple files that are then pulled in by application.css?
[15:00:18] workmad3: Cork: http://www.html5rocks.com/en/tutorials/security/content-security-policy/ may be of some interest to you regarding that approach ;)
[15:00:24] workmad3: swombat: yes I do
[15:00:34] workmad3: swombat: mixins compile down to nothing
[15:00:45] swombat: yeah but bootstrap doesn't
[15:00:52] workmad3: swombat: no, but I don't pull in bootstrap
[15:00:56] yuko7: workmad3: how to loop with an it block in rspec...i wanna do something like User.each do end but the test error
[15:00:57] workmad3: swombat: I only pull in the mixins I want ;)
[15:01:06] swombat: ok... I think I'm starting to see what I'm doing wrong
[15:01:07] Cork: workmad3: not sure what you mean
[15:01:11] swombat: thanks for your patience!
[15:01:21] Cork: workmad3: what does csp have to do with this?
[15:02:04] workmad3: Cork: unless you're adding URLs to the controller action as <script src="url-here"></script> tags on your page, then your JS there would need to be evalled
[15:02:15] Cork: workmad3: ya, i am
[15:02:25] Cork: csp doesn't allow inline scripting on my site
[15:02:31] workmad3: Cork: ok then :)
[15:02:48] workmad3: Cork: that means that your 'var translation' is scoped to just the file you declared it in btw
[15:03:54] workmad3: Cork: most people returning JS from a controller like that do it with the expectation that it'll be evalled by $.ajax and 'just run' btw
[15:04:11] workmad3: Cork: hence the link ;)
[15:04:15] Cork: workmad3: no, js isn't scoped per resource
[15:04:37] Cork: but ya var translate should be window.translate
[15:05:34] workmad3: Cork: ah, again, I'm used to coffeescript compilation where 'translation = Foo' would end up as '(function() {var translation = Foo;})();' ;)
[15:06:12] workmad3: Cork: so I got used to the idea that top-level vars don't get shared between JS files (and need to be exported onto window) :)
[15:06:12] alienaut: ddd, workmad3, Lloyd thank you guys
[15:06:43] Cork: workmad3: i really don't like coffiescript
[15:07:04] Cork: though i run with strict mode on the site it helps with most of those things
[15:07:09] workmad3: Cork: some of the things it enforces make sense though :)
[15:07:21] Cork: ya, and most of them are in harmony :)
[15:07:42] Cork: (ecmscript-next)
[15:08:57] brahmana: Hi all.. I have an User model and an Event model and they can be associated in many-to-many fashion. In such a scenario, will has_many :through or has_and_belongs_to_many provide any additional benefit over just specifying has_many separately on both the models?
[15:09:01] machindo: is this the right place to ask about an rvm install issue?
[15:09:13] workmad3: machindo: #rvm would be better
[15:10:18] Amishe: go ahead and ask mach
[15:11:30] machindo: thanks workmad3
[15:12:13] brahmana: Ok, here are the three possibilities : http://pastie.org/8719089
[15:12:41] brahmana: Does the second or third have any advantage over the first approach there?
[15:13:53] brahmana: I see several blog posts and write ups about how one should prefer has_many :through over habtm. But is there any downside to just using has_many and belongs_to separately on each model?
[15:15:24] Amishe: brah I think it depends on what else you plan on doing with the two models
[15:16:20] Amishe: do you need a third model associated with users and events?
[15:17:38] Amishe: the example i looked at had a similar setup but was using a third model to save metadata about the first two
[15:18:25] Amishe: in that case, its probably pretty helpful to use through as it would simplify your code
[15:18:57] workmad3: brahmana: the has_many and belongs_to as separate things won't do what you want, I suspect
[15:19:18] brahmana: workmad3: The drawback being?
[15:19:51] workmad3: brahmana: e.g. if you wanted a user to appear in the users list for multiple events, then you would need to have multiple copies of that user
[15:20:24] stringoO: the as_json method seems to be including all methods by default for me. Is there any place I can set the defaults for this method?
[15:20:29] stringoO: This is for Rails 3.x
[15:20:52] brahmana: ACTION draws up a couple of tables to visualize the problem workmad3 is talking about
[15:21:20] workmad3: brahmana: a user has a single event_id that they 'belong to'
[15:21:53] workmad3: brahmana: so in order to have multiple events that a user is attending(?) then the user record needs to be replicated multiple times
[15:21:54] brahmana: workmad3: aah yeah... indeed..
[15:22:05] workmad3: brahmana: which is why you need the join table ;)
[15:23:15] brahmana: workmad3: makes sense. Thank you. :)
[15:25:40] pontiki: hallo again
[15:25:57] brahmana: workmad3: So moral of the story would be : You cannot achieve a many-to-many with two 1-to-many of opposite directions... right?
[15:27:54] soahccc: There a so many todo managing applications and none of them really get the thing :(
[15:31:28] oznik_: is there a lovely lightweight autocomplete anyone can recommend ?
[15:32:24] workmad3: brahmana: not in a relational db, no
[15:33:05] brahmana: workmad3: Indeed in RDBMS
[15:33:19] workmad3: brahmana: you could do things like serialise a list of ids into a column for the two directions, but that gets messy and means you really aren't using a RDBMS anymore ;)
[15:33:57] workmad3: brahmana: incidentally, if you are even considering doing something like that... stop... step away from the keyboard and take a good long look in a mirror... :P
[15:34:14] brahmana: workmad3: That's precisely what I did with MongoDB in a previous project and that is why I kept thinking why this wouldn't work in RDBMS
[15:34:30] brahmana: workmad3: hahaha... I think I will.. :)
[15:35:14] workmad3: oddly enough, with postgres 9.2+, you could probably do that fairly efficiently with a JSON column, a GIN index and json >> queries... but still, don't do it :)
[15:35:56] workmad3: or hell, just an array column of integers!
[15:35:57] brahmana: I don't think I will even attempt that. Not really a postgres geek.. !!
[15:36:22] workmad3: brahmana: good plan :)
[15:46:51] jlebrech: is there a way to run 'rails s' only showing errors? will --quiet do that? let me try
[15:48:46] tbuehlmann: jlebrech, you can set the logger level to :error using config.log_level = :error in an environment initializer
[15:50:12] jlebrech: tbuehlmann: thanks man
[16:03:12] jlebrech: tbuehlmann: in my development.rb file that should work?
[16:03:54] jlebrech: i'm only seeing WARNs
[16:09:02] minion-: anyone recommend a good ruby on rails book?
[16:09:36] jlebrech: can you at least shut it up about assets
[16:11:21] brahmana: minion-: http://ruby.railstutorial.org/ http://pragprog.com/book/rails4/agile-web-development-with-rails-4
[16:15:34] minion-: brahmana, out of those too which do you like most?
[16:16:22] brahmana: minion-: First one. railstutorial.org
[16:16:32] minion-: alright thanks
[16:20:39] |PiP|: what is the go-to ruby on rails reference book? im looking at Agile Web Development with Rails 4, and it seems to have been changed to more of a tutorial than a reference guide.
[16:20:43] helpa: minion-: http://guides.rubyonrails.org/getting_started.html - Getting started with Ruby on Rails guide written by Mike Gunderloy
[16:20:43] pipecloud: minion-: !gettingstarted
[16:20:58] pipecloud: |PiP|: It was always a tutorial.
[16:21:06] helpa: |PiP|: http://guides.rubyonrails.org/ - Ruby on Rails guides. Recommended reading.
[16:21:06] pipecloud: |PiP|: !guides
[16:21:19] pipecloud: And the docs are probably the best reference.
[16:21:52] |PiP|: ive read those. im comparing the second edition vs the newest edition, and the guide portion has increased substantially in size with the reference section becoming much smaller
[16:22:26] pipecloud: I guess if you like books that lose their value pretty quickly, a rails reference would be the best manifestation of that!
[16:23:36] |PiP|: is there a pickaxe-like book for rails?
[16:24:03] snkcld: }/join #neo4j
[16:25:20] pipecloud: |PiP|: I don't know if anyone is printing off anything like that, no.
[16:25:35] pipecloud: It changes a lot though. Seems silly to want a physical copy of something so monstrous that changes so much.
[16:26:05] jds: In order for a publicly-visible page to be cachable upstream without Must-Revalidate, it's going to have to be completely independent on cookies & logged-in state, right? So I'm starting to consider including ?logged_in=1 in my all my query strings, or prepending all my url paths with /l/. And so I'm considering monkey patching url_for to auto-include
[16:26:05] jds: this. And at this point I'm a bit troubled because I can't seem to find anyone else who's run into the same problem. What am I missing?
[16:26:14] |PiP|: i guess. i still reference K&R \
[16:26:30] pipecloud: |PiP|: K&R is the bible.
[16:29:35] maxim0s: Any one knows how to check resque job status through console?
[16:30:42] tubbo: |PiP|: K&R's concepts are still in use :) rails goes through concepts a little faster, and is more..."hands-on" i would say
[16:31:12] pipecloud: Plus, I don't believe Rails core has achieved the same level of enlightenment K&R has.
[16:31:18] tubbo: the K&R book is really more of a philosophical/theoretical work masquerading as a programming textbook. to me, it simply lays the groundwork for how to build a good programming language.
[16:31:27] tubbo: (rather than give you tangible, useful information for a job)
[16:31:43] tubbo: pipecloud: "enlightenment" lol
[16:32:27] pipecloud: I usually prefer the more theoretical books when I want paper to sniff.
[16:37:29] jsilver_: anyone ever notice that Fungal is simply a portmanteu of "Fun" and "gal" ???
[16:37:36] jsilver_: she's a fungal
[16:43:43] yuko7: how to test a customized sessioncontroller in devise ....http://pastebin.com/VBmZhSmP
[16:44:54] yuko7: http://pastie.org/private/nm1elnn9v7udjfvx8ucolw
[16:52:31] jsilver_: god DAMN it. why cannot JIRA just tell me which sprint a ticket is on
[16:54:35] lagweezle: Jira hates you.
[16:54:43] lagweezle: Jira hates everyone. It's equal opportunity that way.
[16:56:02] jsilver_: )*$#@&(#$*$#&*@#
[17:13:56] Fire-Dragon-DoL: when you fail hard doing maths for paging...
[17:13:59] Fire-Dragon-DoL: is time to write more tests
[17:16:06] rhizome: yuko7: it's going to depend on the customization, right?
[17:17:55] greenarrow: Anyone here who's used pdfkit know why my images do not appear inside my PDFs
[17:18:18] greenarrow: I've used request to generate a full URL which works when i paste into the browser
[17:19:21] yuko7: rhizome: right, here is my session controller http://pastie.org/private/ajh30ldkucjccmqaju8e5q
[17:34:55] loc22: hi guys! Im new to rails and I am having a weird problem. I can see my html template perfect if I go to localhost:3000/task ... but when I go to localhost:3000/task/1/edit I see my template broken
[17:35:37] loc22: Any suggestion?
[17:35:48] helpa: loc22: Here's a question: If you were a great old one, who's brain would you eat first?
[17:35:48] momomomomo: loc22: !question
[17:35:51] Hates_: loc22: can you elobrate on "broken"?
[17:35:57] helpa: loc22: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[17:36:41] helpa: "If anyone loudly blesses their neighbor early in the morning, it will be taken as a curse." - Proverbs 27:14
[17:37:05] Hates_: philcrissman: I admit, that was unexpected :P
[17:37:16] workmad3: momomomomo: follow-up question... if you were a great old one, which great old one would you be?
[17:37:23] agent_white: Hates_ : Hahah
[17:37:32] helpa: Hates_: good morning IRCers, I hope that this day finds you hale and hearty
[17:37:32] workmad3: Hates_: !gm
[17:37:37] momomomomo: workmad3: I'd be the one mashing all of the wrong bang commands into a bot
[17:37:56] finges: loc22: My guess is you don't have a template for edit?
[17:38:48] bePolite: Any one know where I could get a ruby on rails wall paper?
[17:39:05] Hates_: here you go http://4.bp.blogspot.com/-aLryA2Bey-w/TY6usViKtAI/AAAAAAAACiE/B2qQeW_ags0/s1600/heinemeier.article.jpg
[17:39:15] loc22: Hates_: The only thing I do inside edit.html.erb is to render a form, the same I do in index.html.erb. In the index I see the the whole template with the style, and In edit I dont have the stylesheets
[17:39:39] Jasinai: Hates_: :D
[17:40:37] bePolite: Hates_: was that for me?
[17:40:43] Hates_: bePolite: yeah :P
[17:41:19] bePolite: Hates_: Please bee serious
[17:41:28] Hates_: bePolite: what do you want your wallpaper to show?
[17:41:50] bePolite: something like http://nodejs.org/images/logos/nodejs-2560x1440.png
[17:42:15] Hates_: !lmgtfy ruby on rails wallpaper
[17:42:34] bePolite: Hates_: I would have googled before comming here
[17:42:49] bePolite: If you don't have anything +ve then
[17:42:50] kwerle: I'm looking for a CMS engine to be used inside a rails app. It looks like refinery really wants to own the page. This CMS would be used for sidebar information relating to the page contents. Suggestions?
[17:42:51] loc22: finges: I do have a template for edit. It is wraped in the application.html.erb.
[17:43:10] Hates_: bePolite: lol
[17:43:19] rhizome: yuko7: current_user is nil there
[17:43:57] Hates_: loc22: So the template renders, it just has no styles or assets?
[17:45:50] loc22: Hates_: Yes, when I call 'task/1/edit' it render without style. But if I am in '/task' it works ok. The links for the stylesheets are in aplication.html.erb.
[17:46:38] Hates_: loc22: and how are you linking to your stylesheets in application.html.erb? with stylesheet_link_tag?
[17:46:38] Danielpk: Hello guys, im new using rails and i want know if there is any "rails way" to display records grouped by relationshipp model, i have User, Roles, User belongs_to Role, at use page, i want to display the users grouped by role.
[17:47:20] Fire-Dragon-DoL: Danielpk: there isn't a rails way but you can loop over all roles and for each role loop over all users
[17:47:40] Jasinai: bePolite: http://imgur.com/CUiHwyQ ;)
[17:47:48] Hates_: Jasinai: :P
[17:47:49] Danielpk: Fire-Dragon-DoL: i usually do it, then o test if role_id changed and print html markup to "close" element..
[17:48:03] Danielpk: Fire-Dragon-DoL: just wanted to know if there is a better way than that.
[17:48:42] loc22: Hates_: No, with the public path "assets/css/style.css". But works in one case and in the other dosent.
[17:49:07] Hates_: loc22: it probably doesn't work as the path is relative
[17:49:53] Hates_: Fire-Dragon-DoL: you can use User.all.group_by(&:role) probably
[17:49:55] jsilver_: hey guys how do I get Rails running on this? http://upload.wikimedia.org/wikipedia/commons/e/e9/Radio_Shack_TRS-80_Model_100.jpg cant find the terminal application
[17:50:18] Danielpk: Hates_: i will find more about it.
[17:50:25] Hates_: Fire-Dragon-DoL: but that's not a good solution if you have lots of users/roles. but that's a simple solution for a few
[17:50:29] pipecloud: Hates_: Does that make an SQL query that groups or does it pull them all out into ruby first?
[17:50:35] Hates_: oops should have been for Danielpk
[17:50:51] Hates_: pipecloud: It's in memory ruby group by, not a proper SQL grouping
[17:51:02] pipecloud: Hates_: Seems sad.
[17:51:15] pipecloud: jsilver_: Does it have an MMU?
[17:51:27] jsilver_: whats an MMU
[17:51:37] Hates_: pipecloud: Depends on the situation, it's handy in small instances
[17:51:42] jsilver_: Mom's Math Unit?
[17:53:31] pipecloud: Hates_: IDK bruv.
[17:53:53] pipecloud: You could probably slide by with shitty code for a while, but it certainly wouldn't make it past any pull request I review. :)
[17:54:19] Hates_: pipecloud: well that's good to know :)
[17:56:34] Hates_: pipecloud: you should probably provide the SQL solution then :)
[17:58:05] Guest30557: pipecloud: what do you manage?
[17:58:05] pipecloud: Hates_: I don't SQL. I can hobble together activerecord tho
[17:58:20] pipecloud: Guest30557: Mostly readjusting my junk in meetings, why?
[18:02:55] reconbot: Are there any good resources on domains and routing with regards to generating paths? (eg, whatever_path == domain+"path")
[18:09:52] rhizome: reconbot: use more words
[18:11:44] reconbot: rhizome: I want to link to things that have routes that are constrained by a host by using their path helper
[18:16:54] tubbo: reconbot: so you want something like "http://host.ext/your/path", right? not just "/your/path"?
[18:17:22] helpa: reconbot: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[18:17:22] tubbo: reconbot: !routing guide might help, btw. you should read that before asking us any more questions, if you haven't already.
[18:18:01] reconbot: tubbo: yepp - except since the routes have a constraint in them, I'd love the path helpers to automatcally pick that up - I understand if I have to make my own helpers or something
[18:21:37] reconbot: tubbo: I've read that over a bunch, it's got good advise on constraining the routes, but not linking to them
[18:22:02] reconbot: tubbo: here's an example https://gist.github.com/reconbot/8921331 the link src in the view is just "/"
[18:22:27] tubbo: reconbot: did you try doing my_app_two_url()?
[18:22:36] tubbo: reconbot: the _url sometimes forces it to be fully-qualified
[18:24:08] joevandyk: people are copy/pasting text like irb(main):015:0> "PS???3002S???BK".encode('ascii')
[18:24:10] reconbot: tubbo: that's awesome, it works!
[18:24:19] tubbo: reconbot: boom :)
[18:24:34] tubbo: reconbot: yeah all routes define _path and _url helpers. the main difference is that _url is prefixed with the host.
[18:24:52] reconbot: tubbo: to finish my question off - where can I read the source for the helpers its generates? (or the meta source as it may be)
[18:25:01] reconbot: tubbo: that's good to know
[18:25:03] joevandyk: people are copy/pasting text like "PS???3002S???BK" into form fields. there's a unicode hyphen in there. so if someone types in that name into a search box, it won't match. what's the best way to fix these sorts of problems?
[18:25:57] reconbot: tubbo: I've looked for the action:routing stuff, it's.. hard to find what I'm looking for
[18:26:03] tubbo: reconbot: http://github.com/rails/rails is the source, and the docs are at https://api.rubyonrails.org
[18:26:17] tubbo: reconbot: yeah, rails is very modular and abstracted so it might be hard to get into
[18:27:55] reconbot: tubbo: what about an api doc of what params the _path and _url methods take?
[18:28:24] tubbo: reconbot: i guess you'd find that @ api.rubyonrails.org...basically they take a hash of attributes that are passed in as params
[18:29:29] tubbo: reconbot: so if your route was get "/whatever/:id" => 'whatever#show', you could do whatever_path(id: 1) and it will be passed in as :id. alternatively, you can do whatever_path(id: 1, hello: true), and it will generate something like "/whatever/1/?hello=true". one "magic" param is :format, which will alter how the route looks like so: whatever_path(id: 1, format: :json) => "/whatever/1.json"
[18:30:58] reconbot: tubbo: thanks!
[18:41:02] Danielpk: i created a file under lib/track/checkins.rb, Module Track, class Checkins.. when i try to use at controller i get error : uninitialized constant ReportsController::Track
[18:41:23] Danielpk: I need to do anything else to rails auto load it?
[18:42:14] Danielpk: btw, I called like it: Track::Checkins.new
[18:47:34] pipecloud: Danielpk: Why are you using a plural model name?
[18:49:14] joelbrewer: architecture question: I've got a project model that I want to run validations on before it is marked "published" -- is it possible to run validations on a certain method call?
[18:49:14] osdc_bot: "published" lost a level. (Karma: -1)
[18:50:31] ravionrails: joelbrewer, @project.valid?
[18:50:36] amh345: err. rails keeps making my ALLCAPS words in the db lowercase. i can't use the .upcase method since it's not the whole value that's uppercase. just a couple of words. what's the trick for this?
[18:51:11] amh345: err. it stores uppercase. just returns lowercase and capitalized in my view.
[18:51:38] ravionrails: amh345, db is mysql?
[18:51:45] michael_mbp: anyone recall if cookies are domain-signed?
[18:51:49] joelbrewer: ravionrails: don't validations automatically call on save/create though? I want the user to be able to work on their profile, it just can't be marked published until they fulfil certain validation criteria
[18:51:53] amh345: ugh. even the label_for shows the uppercase copy. hah.
[18:51:58] amh345: come on rails!
[18:52:06] bricker: amh345: could be CSS
[18:52:53] rtwomey: joelbrewer: use a before_save that checks the criteria and marks published if it's fulfilled?
[18:53:54] smathy: amh345, gist your model, view and the `SHOW CREATE TABLE` output for the table where this is happening.
[18:54:10] joelbrewer: rtwomey: I want the model to save even if the "published" criteria are not fulfilled.
[18:54:34] joelbrewer: rtwomey: I am only concerned about the published criteria when the user goes to "publish" their profile and make it publicly available
[18:55:29] ravionrails: custom validation or :if/:unless with validation may be works for you
[18:56:14] amh345: smathy: i don't think it's the table. the data is stored the way i want it in the Table.
[18:56:21] DarkGhost: Hello, so <%= javascript_include_tag "application", "data-turbolinks-track" => true %> this line of code is causing me problems because I have a lot of javascript files that only need to be included on certain pages and that application.js is including all of them.. any help or link to help?
[18:56:26] amh345: unless I'm missing something?
[18:59:31] amh345: oh boy. i may have to create an inflection.
[19:00:22] gabebug: What's the best way to get a list of files that `rake assets:precompile` will produce? I'm trying to put them all into an html app cache manifest. There's obviously Rails.application.config.assets.precompile, but the first entry is a Proc -- https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb#L39-L41 -- and i'm not sure the ideal way to merge that in against all the files present
[19:00:22] osdc_bot: proc lost a level. (Karma: -1)
[19:01:02] ddd: ooo, someone's gonna get a ban running a bot in here
[19:01:17] DarkGhost: on the javascriot_include_tag what does cache do ?
[19:01:22] DarkGhost: caches the js ?
[19:01:46] DarkGhost: or is that outdated
[19:14:53] joelbrewer: is it bad practice to bypass validations using "new" if I want to allow unvalidated models to be created? My reasoning is that I will check for validity when a user goes to "publish" the model.
[19:15:15] jsilver_: is anyone else glad that nobody sends them JibJab videos anymore
[19:15:23] s2013: if i have 2 time variables like "01:20" and "02:15" for example, how would i add them?
[19:15:28] s2013: is there a helper to do that?
[19:18:31] centrx: s2013, "time variables" ?
[19:19:14] s2013: variables that represents hour and minutes in this case
[19:19:17] s2013: not sure how else to put it
[19:19:25] centrx: What is the class name?
[19:19:28] s2013: they arent exactly time, more like duration
[19:19:30] s2013: they are just strings
[19:19:37] s2013: "01:20" for example is hour and 20 minutes
[19:19:45] s2013: i want to add that to lets say 2 hours and 15 minutes or "02:15"
[19:19:54] ddd: thats what it means to *you*, to ruby its just a string
[19:20:05] s2013: obviously
[19:20:08] s2013: which is why im asking
[19:20:11] centrx: s2013, http://api.rubyonrails.org/classes/ActiveSupport/Duration.html
[19:20:16] ddd: you need to use either a Time, Date, or DateTime object to have the capabilities you ware describing
[19:20:17] s2013: thanks let me check that out
[19:20:22] s2013: i tried doing time.parse but it gives me datetime
[19:21:26] ddd: and saying obviously comes across as snitty rather than you trying to understand the significant difference and the lack of tool methods to do what you want.
[19:21:59] ddd: i was trying to point out that difference which explains the difficulty you're having. my bad, for trying to help
[19:22:53] s2013: dude. i am not a newbie. i know difference between time and string. i appreciate your help.
[19:23:10] ddd: i can determine that from... ?
[19:23:47] ddd: (not to mention its easy even for experienced developers to forget something or think they have something they really don't.) thats all i was saying'
[19:23:47] centrx: I think we can all agree that you are both great knowledgeable and wise people
[19:23:52] RubyTitmouse: joelbrewer: .\save(validate: false)
[19:24:41] RubyTitmouse: s2013: don't vamp dude
[19:25:35] RubyTitmouse: if you're seasoned enough not to be newb, you should be seasoned enough to ask questions from a position of... seeking help
[19:25:36] s2013: anyways centrx i dont thikn the duration thing would help, id need to do something custom. thanks
[19:25:50] amh345: dt = DateTime.parse("2:10", '%I:%M %p %Z'); dt + 135.minutes
[19:26:37] s2013: amh345, nah that wont work.
[19:26:54] RubyTitmouse: take out your frustrations on your rubber ducky, or the people asking for help who obviously don't know shit or they'd have looked it up
[19:27:08] s2013: RubyTitmouse, ?
[19:27:25] amh345: well, you're a pro. figure it out.
[19:27:48] amh345: add to time strings :/
[19:27:49] centrx: He has turned the channel against him :(
[19:27:52] RubyTitmouse: s2013: you have to either be a newb or a vamp to ask questions
[19:28:07] certainty: all he said is that he was not a newbie
[19:28:07] RubyTitmouse: newbs need their hand held, vamps need to be staked
[19:28:14] s2013: all i asked if there was some helper. thats all
[19:28:27] amh345: yes. there are helpers to add times
[19:28:30] joelbrewer: RubyTitmouse: ahh thanks
[19:28:30] s2013: you guys have some anxiety issues. and i already thanked people for helping me.
[19:28:36] centrx: I LIKE UNICORNS AND RAINBOWS
[19:28:41] amh345: I LOVE LAMP
[19:28:44] jsilver_: OH GOD IM GOING FUCKING INSANE
[19:28:52] jsilver_: ACTION popsa valium
[19:28:54] certainty: i like lower case
[19:29:12] jsilver_: caps or nothin breh
[19:29:14] wmoxam: s2013: Use an ICR client that supports /ignore ;)
[19:29:17] certainty: ACTION case-folds all input
[19:29:21] joelbrewer: RubyTitmouse: is that terrible practice though?
[19:29:23] jsilver_: I love how NOBODY SCREEN LOOKS ME EVER HERE
[19:29:29] RubyTitmouse: centrx: your unicorn farts rainbows
[19:29:49] certainty: s2013: i don't know of a helper. I'd roll my own
[19:29:56] _rooster_: so i upgraded my app from 3.2 to 4.0 and all of my jquery stuff is now failing. i have done a ton of searching and found no help
[19:29:57] s2013: i made a mistake when i initially said time, i meant duration amh345. like i said if i did time.parse it would give me datetime, anyways i am just going to do something custom and ill paste it and then anyone wants to criticize me, feel free
[19:30:01] _rooster_: anybody have any suggestions to try?
[19:30:08] amh345: guys, speaking of lower_ccase. does rail "automagically" downcast any all capitals words when pulled from active record into the view?
[19:30:10] certainty: or library, that does just this
[19:30:11] centrx: s2013, You could look at Chronic::Span in the chronic gem
[19:30:29] jsilver_: I was gonna say CHronic
[19:30:29] RubyTitmouse: joelbrewer: Yes, IMO you should write your own .ready_to_publish? method and test against that instead of using validations for that. The validations are generally for sanity checks
[19:30:31] jsilver_: you beat me
[19:30:34] s2013: ok let me check it centrx thanks
[19:30:41] centrx: ACTION beats jsilver
[19:30:55] jsilver_: .downcase to downcase
[19:31:02] amh345: ok. so this problem is from somewhere else.
[19:31:24] joelbrewer: RubyTitmouse: ahh okay. maybe I'll go ahead and do that then.
[19:31:28] amh345: i have a sentence "it LOOKS like this" and in my view. it's all. lowercase, well with cap at the beginning.
[19:31:36] joelbrewer: RubyTitmouse: I'd rather not introduce bad practices
[19:31:47] jsilver_: amh345: sounds like it's being hit with .capitalize! or something
[19:32:06] amh345: yeah. it's driving me a bit nuts.
[19:32:07] jsilver_: i'd say yes, check everything that filters the string
[19:32:08] RubyTitmouse: joelbrewer: lol make sure not to use any gems, howtos, tutorials, or borrowed code then
[19:32:10] jsilver_: if not, check the database
[19:32:18] amh345: ill deal. i just wanted to confirm there wasn't something obvious i missed.
[19:32:20] jsilver_: if not, blow away the field and remake it
[19:32:36] joelbrewer: RubyTitmouse: lol.
[19:33:13] jsilver_: I actually once had Ruby poop me a plate of Lucky Charms once
[19:33:21] jsilver_: yes, of course I ate it
[19:33:38] jsilver_: well I gave half to my Unicorn
[19:33:50] jsilver_: we both farted rainbows
[19:34:29] jsilver_: how do I change the Rails 4 log file? file name?
[19:34:44] jsilver_: config.logger trash is doing nothing
[19:34:53] jsilver_: but I have about 5 apps that need to do it
[19:35:02] jsilver_: and they will all write "development.log" etc
[19:35:05] jsilver_: i want it to say
[19:35:10] jsilver_: "appname-environment.log"
[19:35:24] jsilver_: with those things being replaced by the actual stuph
[19:35:56] RubyTitmouse: jsilver_: "config.logger accepts a logger conforming to the interface of Log4r or the default Ruby Logger class. Defaults to an instance of ActiveSupport::Logger, with auto flushing off in production mode."
[19:36:04] RubyTitmouse: so you probably want to instantiate one of those
[19:36:18] jsilver_: I tried it before once and no worky, but I'll give it another shot
[19:36:49] RubyTitmouse: I just use ln -s # though :P
[19:38:34] jsilver_: right, which is parta what i'm doin
[19:38:41] jsilver_: only reason i need to change the actual names of logs
[19:38:46] jsilver_: because there's many apps
[19:41:44] s2013: centrx, ddd, amh345 https://gist.github.com/ss2k/e432a64c523171371911
[19:42:05] s2013: this is what i was talking about. i am sure i can refactor that to make it a bit more readable but essentially thats the gist of what i was looking for
[19:42:06] certainty: jsilver_: if setting the directory where logs are written to is fine too, you can set config.paths['log'] to that directory. If not you'd have to assign your own logger
[19:42:25] jsilver_: does that set the file name too
[19:42:27] jsilver_: I will try dis
[19:43:26] RubyTitmouse: jsilver_: that is the use case for l too, ln -s sites/example.com/current/log/error_log logs/example_com_error_log
[19:43:47] jsilver_: thanks, I'm a ln -s n00b
[19:44:04] RubyTitmouse: like each of my apps has config/apache.conf and then the other end of the link is domain.conf etc
[19:45:07] jsilver_: SICK UNIX MAGIC, thanks
[19:45:29] jsilver_: I was about to start headdesking and never full stop again
[19:48:04] RubyTitmouse: unixcorns and railsbows
[19:50:56] macpool: is it possible to redirect "products/new" to "products/latest" in routes.rb
[19:53:08] jsilver_: why not make an action "
[19:53:16] lxsameer: hey guys, how can i produce erb tags inside my generator templates ?
[19:53:22] jsilver_: "products#new" and then redirect_to "products#latest" in there
[19:55:30] joelbrewer: RubyTitmouse: I'm trying to write the ready_to_publish? method: https://gist.github.com/JahBrewski/8922982
[19:55:51] joelbrewer: RubyTitmouse: Is there a way to loop through methods?
[19:55:54] macpool: jsilver_: should I create a controller?
[19:56:09] joelbrewer: RubyTitmouse: What I am trying to do in line 6 is not working
[19:57:34] jsilver_: macpool: only if you don't already have it. also, you could use mod_rewrite I think
[19:57:48] jsilver_: that'd be a little harder I guess
[19:57:59] _rooster_: upgrading from rails 3.2 to rails 4 and my jquery all fails. any suggestions?
[19:58:12] jsilver_: _rooster_: upgrade your jquery and jquery code
[19:58:24] jsilver_: _rooster_: jquery itself is bundled in Rails now.. updating rails updated JQ
[19:59:09] _rooster_: jsilver_ do you have a reference you would suggest that says what changed?
[20:00:38] _rooster_: jsilver_ i tried forcing jquery 2.0 and that did no good.
[20:00:48] jsilver_: cherck your version of jquery-rails and look here https://github.com/rails/jquery-rails/blob/master/VERSIONS.md
[20:01:01] jsilver_: then review changelogs inbetween version X and version Y and make changes
[20:01:13] jsilver_: try slowly upgrading it from the old jq-rails
[20:01:23] jsilver_: I doubt rails will break much but your code could slowly get upgraded that way
[20:02:05] amh345: s2013: have you looked at .advance?
[20:02:12] amh345: woah. scroll back!
[20:02:49] centrx: WATCH OUT BELOW!
[20:02:56] amh345: how do you get these two time frames?
[20:03:02] amh345: bah. I'm getting coffee and a blowie
[20:03:06] amh345: ok. no blowie.
[20:03:10] amh345: but coffee for sure.
[20:03:11] rsl: that's a lot of web irc users there
[20:03:23] amh345: irc? on the web?!
[20:03:55] s2013: no amh345
[20:04:14] _rooster_: jsilver_ interesting, so my gem version is 2.2.2. the latest is 3.1 so bundler is obviously failing to update the gem
[20:04:43] _rooster_: but what i don't understand is i wrong my qjuery code back with jquery-rails 2.2.2 and it worked fine with rails 3
[20:04:44] amh345: s2013: ok
[20:04:47] jsilver_: yes.. it may be locked as well if you see something like , "~> 2.2.2.2" next to it
[20:05:00] jsilver_: if you dont see that, try locking to 3.1 and bundle installing
[20:05:16] _rooster_: jsilver_ i will give it a try, thanks.
[20:05:34] jsilver_: other code could have updated which is breaking it. may not be JQ's fault
[20:09:00] dopie: anyone have experice with twitter and rails??
[20:09:03] dopie: with this gem??
[20:09:04] dopie: https://github.com/sferik/twitter
[20:10:24] starfox21: hey guys, I am using postgres and I am having some issues because the users email are getting stored in the db in lowercase, but when it tries to search for an email where the user typed an uppercase letter in the middle of the email it cannot find it in the db. Is there anyway to create some index to always search for emails in lowercase?
[20:10:32] rhizome: dopie: just ask your question
[20:10:43] dopie: https://github.com/sferik/twitter
[20:10:49] dopie: rhizome, where do i put the configuration??
[20:10:52] dopie: int application.rb?!
[20:11:04] rhizome: starfox21: how/when are you searching?
[20:11:30] starfox21: rhizome: in a bunch of places, some times using find sometimes using where
[20:11:58] rhizome: starfox21: get used to typing .downcase maybe
[20:12:43] dopie: starfox21, .downcase is correct to use
[20:12:56] dopie: they can enter eErRErerEReReR and all of them will be downcase
[20:14:50] starfox21: I'm looking to create a case insensitive index
[20:15:32] weaksauce: if they are stored as lowercase and you index the column wouldn't it be a lowercase index?
[20:15:54] amh345: dopie: i used it awhile ago. config sat in initializers.
[20:15:59] macpool: jsilver_: get "products/new" => redirect("products/latest") works
[20:16:11] macpool: is it fine or is theer a better way?
[20:16:12] jsilver_: didnt know about that one
[20:16:13] weaksauce: unless you are using index in not the sql way
[20:16:21] jsilver_: if it works, it's fine, also it looks very readable
[20:16:23] jsilver_: i'd say its fine
[20:17:02] jsilver_: that is actually better than the way i suggested because its shorter
[20:17:11] jsilver_: and mmore redable
[20:17:33] dukedave: Is there a channel for FactoryGirl?
[20:18:11] jsilver_: /list FactoryGirl
[20:18:15] rhizome: it's relatively rare for specific gems to have a channel
[20:18:16] bricker: dukedave: just ask here
[20:18:37] jsilver_: but.. but.. rails is a gem...
[20:18:41] jsilver_: *trollface*
[20:20:10] joelbrewer: hey, I've written a method that checks if certain fields have been filled out before a user is allowed to publish their profile: https://gist.github.com/JahBrewski/8922982
[20:20:35] joelbrewer: now I want to pass an error message back to the controller if there are missing fields
[20:22:35] joelbrewer: I want the method to return "true" if all required fields are present and "false + error message" if all required fields are not present
[20:23:27] tetraktys: hey guys, what is the best practice to do the following: Find article by ID, if none exists (because the id is not an int but a string) : find the first article with that title?
[20:23:53] tetraktys: I stopped using friendly_id, because it didn't take kindly to what i was trying in my project
[20:24:17] dopie: amh345, thank ye
[20:24:24] tubbo: tetraktys: well, find_or_create_by_title would look for an article with a given title, and if none is found, creates it.
[20:24:30] tubbo: tetraktys: that doesn't seem to be what you want
[20:24:35] tetraktys: so my blog articles are using the url with format: 123-title-here
[20:25:04] tetraktys: but i want my statig page routes to use just a parameterized title
[20:25:18] tetraktys: tubbo, you're right. it isn't :)
[20:25:55] tetraktys: i think i'm looking for something like "try"
[20:26:19] RubyTitmouse: joelbrewer: should should be setting the errors on the model the same way as a validator would, and then just returning false
[20:27:33] joelbrewer: RubyTitmouse: with errors.add(:base, "my error") ?
[20:28:23] RubyTitmouse: joelbrewer: I'm not sure but that looks plausible
[20:33:27] Dreamer3: man does ruby on rails really have issues with sending email with "." on the last line?
[20:33:45] Dreamer3: looks like all mail does is call Net:SMTP.sendmail
[20:34:36] macpool: if someone familiar wit js, here is my create.js.erb file https://gist.github.com/macpool/23f6bcf5cd5791d2158a
[20:35:06] macpool: when I submit the form, there is no visible activity until success notice
[20:35:37] macpool: how could I change it?
[20:37:57] diegoviola: this company is a piece of shit: http://integragrp.com.br/ -- they hired me for 2 weeks, then fired saying they don't have money and blaming me that i couldn't do shit fast
[20:37:57] osdc_bot: http://integragrp.com.br/ lost a life. (Karma: -1)
[20:37:59] diegoviola: never work for them
[20:37:59] didge: I'm trying to format my timestamps using an overriden method (to_s) of ActiveSupport::TimeWithZone but it's not working as expected. Any thoughts ?
[20:39:03] bricker: didge: why not
[20:39:24] didge: bricker: why isn't it working ? I'm not quite sure.
[20:39:35] didge: bricker: does haml use .to_s ?
[20:40:12] bricker: didge: maybe if you explained the problem, someone might be able to help you.
[20:41:07] didge: Well, I have a multi-tenant application. I have successfully implimented a time zone setting for the tenant. I now wish to impliment a setting for 12/24 hour time representation
[20:41:50] didge: So I'm looking for a way to switch all formatted datetime output to a particular method that will check the 12/24 hour setting and format accordingly.
[20:43:24] didge: We're usually just outputting timestamps
[20:43:53] tubbo: ACTION thought that was something you could pass into DateTime or Time...
[20:44:06] tubbo: didge: have you perused the docs for Time on ruby-doc, or DateTime on api.rubyonrails.org?
[20:44:33] jsilver_: lol, despite my resume saying RUBY RUBY RUBY LINUX LINUX LINUX everywhere, this recruiter tried to hit me up for a .NET position. LOL!!! I Guess so few people want to do .NET they have started going after the Unix guys
[20:44:38] didge: tubbo: I'l look again
[20:45:37] didge: tubbo: the only mention I see of this is strftime
[20:47:21] tubbo: didge: so what's the issue with that? :)
[20:47:27] helpa: didge: For a good reference to Ruby's strftime method.. http://strfti.me/ and http://foragoodstrftime.com/
[20:47:27] tubbo: didge: !strftime
[20:47:52] tubbo: jsilver_: absolutely. i'm always getting hit up for java or .net positions over linkedin or whatever.
[20:48:02] tubbo: jsilver_: you know they're using automated systems, right?
[20:48:39] didge: tubbo: well, I guess I was looking to apply the change in one fell swoop. Like, make a quick monkey patch to the appropriate class and have the change appear in the html system wide.
[20:48:44] tubbo: the major advantage that the web has over .NET or practically any other platform is you can learn how to code without going to class. so that enables a huge amount of amateurs/hobbyists to progress to being pros eventually.
[20:49:21] didge: tubbo: but there are few deterrent fees to prevent crumby websites from bubbling up
[20:49:26] tubbo: didge: i believe rails has a "default strftime" that things will just appear as, that you can configure. not sure.
[20:49:46] didge: tubbo: would that be application wide or could I make that specific to my tenant ?
[20:49:47] tubbo: deterrent fees?
[20:49:53] tubbo: didge: yeah, that would be app-wide.
[20:49:58] didge: yeah, I found DATE_FORMATS[]
[20:49:58] tubbo: so you'd probably want something else ehre
[20:50:16] Guest30557: so...I'm inside of a gem directory and I'd like to require that gem. is that possible to do?
[20:50:25] didge: Ok. I'll quit being lazy and actually write the code.
[20:50:40] didge: Nevermind. I was looking for some sugarful solution and I should have just spent the time typing.
[20:50:58] hurrrtin: Hey guys! I have a form with multiple submit buttons. I'm trying to determine which button was clicked by name using a :name => "foo" option in the submit tag, but it doesn't show as a parameter in rails 4.0.0. Any ideas?
[20:51:57] rhizome: hurrrtin: i bet it does
[20:52:14] rhizome: or your syntax is wrong
[20:54:55] jsilver_: tubbo: yes I know and it's annoying
[20:55:11] jsilver_: atleast READ my resume and see that I don't fucking do .NET and haven't in over a decade
[20:55:39] tubbo: jsilver_: get used to it. i don't even answer msgs on LinkedIn anymore. if you're a human being my contact info is easy to find.
[20:55:53] tubbo: jsilver_: basically a recruiter has to PERSONALLY hit me up
[20:55:59] jsilver_: my info has seemed to descend deeply into the 9th circles of recruiter hell... for better of for worse.. the actual LEGIT ruby ones DO seem to find me.. but so do the jokers
[20:56:08] jsilver_: oh yeah LinkedIn got way out of control
[20:56:12] jsilver_: no way to answer all those directmails
[20:56:24] jsilver_: they call my phones tho
[20:56:32] jsilver_: it has gotten me jobs
[20:56:36] jsilver_: but also annoyance
[20:57:34] Fire-Dragon-DoL: okay just found something bad
[20:57:34] Fire-Dragon-DoL: {}.class.instance_methods.include?(:empty?) # => true | {}.respond_to?(:empty?) # => true | ENV.respond_to?(:emtpy?) # => true | ENV.class.instance_methods.include?(:empty?) # => false
[21:00:17] jsilver_: ??\(??_o)/??
[21:00:19] bricker: Fire-Dragon-DoL: http://www.ruby-doc.org/core-2.1.0/ENV.html
[21:01:56] bricker: Fire-Dragon-DoL: does that clear it up?
[21:02:21] Fire-Dragon-DoL: bricker I know the doc but I don't get what you mean
[21:02:33] Fire-Dragon-DoL: ENV.class # => Object
[21:02:48] bricker: Fire-Dragon-DoL: yes, but Ruby defines those special method as *singleton* methods
[21:03:07] bricker: [], []=, etc, are all defined as singleton methods on the ENV object
[21:03:50] Fire-Dragon-DoL: doesn't sound good ????
[21:04:15] bricker: Same way you could do: `str = "Hello"; def str.backwards; self.reverse; end;`
[21:04:27] bricker: Only that string will have that method
[21:04:33] bricker: make sense?
[21:04:52] banister: bricker why did u put the self there bb
[21:05:16] bricker: banister: because I prefer it
[21:05:37] bricker: banister: easier to read and understand
[21:05:48] banister: bricker just curious, you always use self when invoking methods with implicit receivers?
[21:06:11] bricker: banister: unless the method is private
[21:06:29] banister: bricker except in the case of setters, ofc ;)
[21:06:51] bricker: banister: well you wouldn't have a private setter now would you?
[21:09:37] banister: bricker i do sometimes
[21:10:24] bricker: banister: uh-huh.
[21:13:30] tubbo: banister: you kinda don't need one, if you have attr_reader :foo, you can just do @foo = 'whatever' to set it.
[21:13:41] tubbo: banister: having a private writer doesn't make much sense since you can just do that.
[21:13:54] banister: tubbo depends on how sophisticated teh setter is
[21:14:00] banister: tubbo setters dont have to be a simple ivar assignment
[21:14:10] dopie: amh345, hey about the twitter
[21:14:20] tubbo: banister: definitely. in that case, private writers make more sense.
[21:14:20] dopie: i setup twitter.rb in the initializer
[21:14:28] dopie: client = Twitter::REST::Client.new do |config|
[21:14:39] dopie: i tried calling it in the view
[21:14:46] dopie: <%= client.user("gem") %>
[21:14:50] dopie: and get a no method eror
[21:15:08] tubbo: dopie: client is a local var in your initializer, you need to set it to a constant like TwitterClient
[21:15:32] tubbo: dopie: alternatively, if the controller is the only place you need it, why not just make `def client` a method of the controller, and put your code there? like, why does it need to be in an initializer?
[21:15:58] amh345: dopie: i didn't do anything with it in the view. it was all done in the model.
[21:15:59] dopie: tubbo, i am not sure... :) everyone puts it on initializer
[21:17:14] amh345: Twitter.update_with_media(twitter_message(twitter_handle)
[21:17:28] amh345: also. make sure you restart your server.
[21:17:33] tubbo: dopie: try making client a method on the controller, and accessing Twitter::REST::Client that way. also, check back to where you heard about this method of putting twitter credentials in the initializer, because you might notice that they set the instance to a Constant, which would be available everywhere.
[21:18:08] dopie: tubbo, ok amh345 ok
[21:20:44] amh345: if it's in your initializer and you have your credentials setup correctly you should be able to Twitter.update_with_media("imma a tripod"("@dongman")
[21:21:14] amh345: actually, if you don't need other peoples nicks you don't need to deal with twitter_handle
[21:22:01] dopie: all i want to do is list my tweets
[21:22:14] dopie: i have consumer and acces tokens and keys correct
[21:22:28] phat4life: running rake test eats up all my system memory and causes my computer to crash
[21:22:34] rhizome: you don't need tokens to show your tweets
[21:22:46] phat4life: is rake test supposed to call db:test:prepare internally?
[21:23:00] tubbo: phat4life: yes.
[21:23:02] dopie: rhizome, hmmmm im looking at the config and sferik but i cant find it
[21:23:14] tubbo: phat4life: no rake task should be eating up all your RAM...
[21:23:14] phat4life: yeah, everytime i run rake test my system runs of of memory
[21:23:22] tubbo: phat4life: are you on a Commodore 64? :)
[21:23:31] phat4life: the only thing that changed was i added migrations
[21:23:41] phat4life: and boom, 8 gigs of memory used, system crashes
[21:23:57] tubbo: phat4life: so when you run `htop` or `top`, you don't see anything else that could be causing this?
[21:24:20] phat4life: what does htop do
[21:24:32] tubbo: phat4life: it's a more colorful version of `top`.
[21:24:35] phat4life: what is top
[21:24:37] dopie: undefined local variable or method `client' for #<#<Class:0x00000002dfa2f8>:0x00000003e817e8>
[21:24:42] tubbo: phat4life: shows your currently running processes.
[21:24:42] dopie: <%= client.home_timeline %>
[21:25:02] diegoviola: there's this company who fired me at week 2 for no good reason, now i'm trying to get them to pay me for that time and they are taking way too long to reply a single email, are they just a bad company? not sure i'll bother myself with them anymore
[21:25:03] tubbo: phat4life: also shows memory/cpu/etc. usage.
[21:25:21] phat4life: it shows its using hella gigs of memory used by ruby in activity monitor
[21:25:22] tubbo: phat4life: 99% sure you have some other rogue proc eating up all your memory. rake doesn't do that.
[21:25:36] phat4life: the only thing that changed, was i added migrations
[21:25:37] tubbo: phat4life: kill that process
[21:25:45] phat4life: reverting the migrations makes the tests run fine
[21:26:06] tubbo: if you have things hanging it's probably because another uncleared process is still running on your machine
[21:26:11] timmi_qt: I found one reason why fancybox2-rails didn't run properly, it seems its interfering with turbolinks gem, although on their webpage they say, that fancybox2 shouldn't have problems. So I exclude turbolinks and I am fine so far.
[21:26:13] phat4life: is it possible, that because the migrations are irreversible. that the rollback fails?
[21:26:17] tubbo: and your kernel scheduler is prioritizing
[21:26:30] tubbo: phat4life: irreversible migrations throw an error when you try to rollback
[21:26:44] phat4life: it gets suck in the rollback, then the memory usage spikes
[21:31:10] batasrki: phat4life: what do the new migrations do? Are they adding data, removing data, modifying column types/names?
[21:31:26] phat4life: batasrki: adding, removing columns
[21:31:34] phat4life: and adding a table
[21:31:42] phat4life: and I didn't add any new tests
[21:31:50] batasrki: phat4life: are you loading data from somewhere?
[21:32:24] phat4life: no, though the models logic changed, but not for the tests that already exist
[21:32:50] batasrki: is the new logic susceptible to infinite loops?
[21:32:51] phat4life: I guess the models for the migrations are probably borken, but that shouldn't kill everything, as have no tests for those models
[21:33:10] phat4life: I don't think so, I am able to instantiate the models in console without issue
[21:33:45] batasrki: do the existing tests hit the new logic codepath in some shape or form?
[21:34:10] phat4life: the only tests that exists are for models that are untouched by the new migrations
[21:34:18] batasrki: ok, have you ran the migrations by themselves?
[21:34:45] phat4life: trying that now actually
[21:35:12] tubbo: phat4life: suppose those models were making connections to outbound services, like redis or an external web api?
[21:35:24] tubbo: phat4life: in that case, you might get a proc hanging around forever b/c the connection never closed.
[21:35:26] Amishe: i'm developing a very simple product order system. I have a product model and I'm planning on making a Order model. My thought is use an hstore to store product model id's and quantity. Then, iterate through the hstore to access order information. Does this sound like a acceptable approach?
[21:35:46] phat4life: tubbo: its possible, it wouldn't make sense, as those models shouldn't even be invoked in unrelated tests no?
[21:36:39] batasrki: Amishe: why not use an intermediate model like LineItem or something? Why hstore?
[21:37:17] dopie: Now im getting
[21:37:18] dopie: https://gist.github.com/staycreativedesign/8924656
[21:37:27] dopie: undefined method `home_timeline' for nil:NilClass
[21:37:30] batasrki: phat4life: another possibility is that you've accumulated data somehow and these migrations are hitting some byzantine condition in the database system
[21:37:30] timmi_qt: I have created a form which is able to create multiple records at once (in my case: buildings that belong to a project). Here is the controller (new, create): http://pastebin.com/raw.php?i=tJbktjiv and here is the view: http://pastebin.com/raw.php?i=f6jGUSMB . It iis working, but I am bit unsure if it is maybe dirty in some way. Can somebody please take a look, it shouldnt take long. Especially I would be interested, how I could use st
[21:38:35] Amishe: batasrki: I'm not clear on how to store an order of multiple products with multipe quantites in a db
[21:39:05] Amishe: batasrki: i pictured the hstore able to manage both of those within 1 database
[21:39:23] batasrki: Amishe: you mean 1 table
[21:39:26] tubbo: phat4life: i have no idea, it's your project :) i'm saying these are POSSIBILITIES.
[21:39:40] Amishe: batasrki: yes
[21:40:04] batasrki: Amishe: Order has many LineItems which has a Product ID and a quantity
[21:40:30] batasrki: Amishe: that's the simplest, off-the-top-of-my-head data model
[21:40:36] phat4life: shit is just fucked and i don't know how to debug it
[21:40:43] phat4life: because stuff works in console
[21:41:08] batasrki: phat4life: rake <task name here> --trace
[21:41:25] batasrki: phat4life: also, post whatever errors you see
[21:42:20] phat4life: build = Build.new(:log => "1"*1000000000000) that is what did it
[21:42:38] dopie: tubbo, what am i doing wrogn?#@!
[21:43:08] Amishe: batasrki: i imagined it as: id:int(1) ordername:string("order 1") customer_id:int(140) order:hstore:[product_id=>quantity]({6=>3, 5=4})
[21:43:12] phat4life: is there a way to validate byte length for text types in rails
[21:43:19] phat4life: like medium text for example
[21:43:49] batasrki: dopie: that gist tells me nothing. Can you post the full source (or as much as possible) plus the stack trace
[21:43:59] dopie: batasrki, ok
[21:44:11] batasrki: phat4life: why?
[21:44:53] phat4life: t.text :example_text_field :limit => 64.kilobytes + 1
[21:45:05] slash_nick: _HolyCow it's a talking _rooster_
[21:45:11] centrx: A rooster and a holy cow walk into #rubyonrails
[21:45:11] batasrki: Amishe: sure, you can do that. I'm just saying that Order/Product stuff is relational, so why not use the relational database to do its thing?
[21:45:13] phat4life: need a store a log in database, need to limit it to MEDIUMTEXT
[21:46:11] momomomomo: curses, every time i try to use rubinius or jruby i end up in a tiny world of pain
[21:46:14] _rooster_: still having jquery issues. upgraded to rails 4 and now my jquery doesn't work. i have tried downgrading my jquery-rails back to 2.0 but i keep getting "$('.best_in_place').best_in_place()
[21:47:04] _rooster_: er i mean TypeError $(...).best_in_place is not a funciton
[21:47:45] phat4life: is there a way to validate the byte size of an attribute
[21:49:19] batasrki: phat4life: http://www.ruby-doc.org/core-2.1.0/String.html#method-i-bytes, although, I don't know if that's the right approach
[21:49:55] terrellt: _rooster_: You're sure that's a jQuery issue and not a best in place issue?
[21:50:07] phat4life: batarski: yeah that is what i am thinking
[21:50:22] _rooster_: terrellt yeah. i tried pulling best_in_place and then it just has the same problem with datatables
[21:50:49] terrellt: _rooster_: Does $("body").height(); work in the console?
[21:51:04] _rooster_: terrellt: let me check
[21:51:28] phat4life: The http://www.htmlite.com/mysql003.php:
[21:51:28] phat4life: A string with a maximum length of 16,777,215 characters.
[21:51:48] _rooster_: terrellt: it doesn't error
[21:52:20] _rooster_: terrellt:wait, i should have asked, do you mean the rails console?
[21:52:23] EminenceHC: I can use belongs_to_many in rails 4 still correct?
[21:52:34] Amishe: batarski: thank you, i'm going to look into this further
[21:52:40] dopie: https://gist.github.com/staycreativedesign/8924656
[21:53:02] terrellt: _rooster_: No, the javascript console in a browser.
[21:53:09] _rooster_: terrellt: interesting. i just did it in the javascript console
[21:53:10] _rooster_: and it worked
[21:53:20] batasrki: dopie: why is @client on the outside of any action in a controller?
[21:53:23] terrellt: _rooster_: Right. So you're not including your library JS right.
[21:53:34] _rooster_: it worked great before the upgrade
[21:53:41] _rooster_: so is something different between rails 3.2 and 4?
[21:54:02] phat4life: build = Build.new(:log => "1"*1000000000000) <?????? don't so something like that it will brake stuff
[21:54:04] terrellt: _rooster_: I assume your app is in development mode?
[21:54:17] _rooster_: terrellt yeah, but it happens in production mode as well
[21:54:26] _rooster_: maybe i should just shut off the asset pipeline
[21:54:40] terrellt: Not sure bud. Check your HTML, see if the javascript's getting included for that gem.
[21:54:43] _rooster_: however, when i check the browser, it says i have the jquery.js library as well as best_in_place
[21:54:44] _rooster_: the js is there
[21:55:04] terrellt: When you refresh does the console show any JS errors?
[21:55:13] dopie: i put it in
[21:55:19] dopie: and now i get
[21:55:24] terrellt: And if you're running in development, make sure you don't have a public/assets folder.
[21:55:25] dopie: undefined method `home_timeline' for #<Twitter::Streaming::Client:0x00000004375218>
[21:55:48] _rooster_: terrellt: just the one from before from best_in_place
[21:56:21] terrellt: _rooster_: Out of curiosity, can you run that function from the JS console?
[21:56:22] _rooster_: there is no public assets folder
[21:56:50] _rooster_: terrellt: gives me the same error
[21:57:00] terrellt: _rooster_: Also, turbolinks is turned off?
[21:57:15] _rooster_: so, i checked for that. but since it was an upgrade i dont THINK turbolinks is here
[21:57:19] _rooster_: i don't see teh gem
[21:57:35] terrellt: ACTION shrugs.
[21:57:45] _rooster_: it's so weird!
[21:57:50] terrellt: Out of ideas. Need code.
[21:58:16] _rooster_: terrellt https://github.com/rforbes/ArtistPortal
[21:58:41] _rooster_: terrellt if you want to see it running you can go to submissions.seattleerotic.org
[21:58:52] EminenceHC: belongs_to_many does not seem to be a valid association. What should I be using? Can I just use belongs_to ?
[21:59:14] batasrki: dopie: is home_timeline a method on an instance of Twitter::Streaming::Client?
[21:59:36] momomomomo: EminenceHC: From that question, I'd suggest you need to go through this entire page, carefully: http://guides.rubyonrails.org/association_basics.html
[21:59:42] dopie: batasrki, no its not hold on imgetting throug hthis somewhow :)
[22:05:08] terrellt: _rooster_: I dunno. My only thought is your version of jQuery probably changed.
[22:09:41] dopie: batasrki, ok awesome i got that part working
[22:10:49] batasrki: dopie: user_timeline instead of home_timeline?
[22:11:36] defsdoor: my rails 4 app doesnt seem to think my fonts exists - though they are being compiled into assets etc..
[22:17:14] rhizome: defsdoor: you don't say
[22:17:37] jsilver_: ITS HORRIFIC WHAT THEY DONE TO STINKY PETE
[22:17:56] defsdoor: they are in assets with a digest etc.. but 404
[22:19:24] momomomomo: Does anyone currently have a production app running Puma (over socket) with Rubinius?
[22:21:11] defsdoor: hmm assets cannot have a - in their name
[22:22:28] tubbo: momomomomo: not with rbx, but i do use puma on all my MRI sites
[22:22:46] momomomomo: tubbo: same, just running into issues with rbx and sockets
[22:26:50] dopie: batasrki,
[22:26:50] mrstocks_: hey i used to use railsbrain for a manual
[22:26:51] dopie: https://gist.github.com/staycreativedesign/8924656
[22:26:58] mrstocks_: i think its closed
[22:27:11] mrstocks_: whats the next manual to look aT?
[22:27:40] dopie: should i be using Twitter::Tweet
[22:27:48] tubbo: mrstocks_: what?
[22:27:58] helpa: mrstocks_: http://guides.rubyonrails.org/ - Ruby on Rails guides. Recommended reading.
[22:27:58] tubbo: mrstocks_: !guides
[22:28:05] tubbo: mrstocks_: that's the official one :)
[22:28:25] mrstocks_: but i can't look up functions tubbo
[22:28:57] phoenixSunset: Hey guys, we've got an app running over SSL and was just noticing that inspecting ajax requests in chrome's debugger shows spend a considerable amount of time in the 'Blocking'
[22:29:10] tubbo: mrstocks_: http://api.rubyonrails.org
[22:29:20] tubbo: mrstocks_: i use Dash.app for that btw, it's a mac app for documentation. p. cool!
[22:29:33] phoenixSunset: and also in 'SSL'. I am wondering if there is any way to shorten the time making requests.. Is there some kind of connection pool that can be used to speed up future requests for an SSL session?
[22:29:34] mrstocks_: i have a mac
[22:29:51] mrstocks_: where can i get it tubbo
[22:29:53] tubbo: mrstocks_: it's in the app store
[22:30:19] tubbo: mrstocks_: nope
[22:30:29] tubbo: mrstocks_: i think it's like $2
[22:30:38] mrstocks_: well i can spend 2
[22:30:43] tubbo: mrstocks_: considering you're mister stocks i'm sure you can afford it
[22:30:57] mrstocks_: ;) im sir stocks
[22:31:43] mrstocks_: tubbo: i only get a free one
[22:32:06] tubbo: mrstocks_: oh well then it must be free. :)
[22:32:20] tubbo: mrstocks_: it's the one with the purple helmet icon
[22:32:45] mrstocks_: well a dark purple
[22:33:00] tubbo: mrstocks_: let's not split hairs here..
[22:33:33] mrstocks_: heheee seams ok
[22:33:48] zeknox: i have an endless scroll page that is working fine, but once I add this repond_to block it wont load additional comments anymore: http://pastie.org/private/wl3yyqcsddt6ggswipsq
[22:33:51] EminenceHC: momomomomo: I still am trying to wrap my brain around it. If Schools has_many Users and User belongs_to school, then a user can only belong to one school. Has_and_belongs_to doesn't seem to work either because User shouldn't "have" any schools. User should just be associated with many schools.. is that the same thing?
[22:34:30] momomomomo: EminenceHC: there is only one 'belongs_to'
[22:34:33] momomomomo: ie: belongs_to
[22:34:38] mrstocks_: tubbo: its great, thanks a lot
[22:34:45] momomomomo: if you put this on a user, then the user would have an attribute of school_id
[22:34:47] tubbo: mrstocks_: np
[22:35:17] tubbo: EminenceHC: instead of getting caught up in the nomenclature, try to think of it from the database's point of view.
[22:35:21] EminenceHC: momomomomo: So using belongs_to wouldn't allow the User to be associated with multiple schools, just one id. I get that.
[22:35:36] tubbo: EminenceHC: what you want here is really School has_many :users, :through => :admissions
[22:35:45] tubbo: and an Admission class that belongs_to :school and belongs_to :user
[22:35:47] batasrki: dopie: I gotta go, but people here should be able to help
[22:35:56] tubbo: so you keep track of the "admission to a school" as a data point in itself.
[22:36:53] dopie: so close ....
[22:37:22] dopie: can it be that im testing it locally and its not displaying it locally?
[22:37:52] EminenceHC: tubbo: Hmm, where I get confused is creating an Associations model. Does this model just contain the user_id and all the school_ids that the user is associated to?
[22:38:41] timmi_qt: My params hash looks like this: http://pastebin.com/raw.php?i=rCymgckv . It is an array of multiple records. Does anyone know, how I can use strong params here? sth like params.require(:buildings).permit( {:name, :description, :hot} ) or sth ? Cannot find anything in the docs :/
[22:38:57] EminenceHC: tubbo: I mean Admissions model not associations.. sorry
[22:41:37] tubbo: EminenceHC: no, it contains 1 user_id and 1 school_id. the Admission record is used to build the users collection on school, as it finds the user "through" the admission. make sense?
[22:41:55] tubbo: EminenceHC: school.users == [ admission.user ], basically :)
[22:43:02] zeknox: i have an endless scroll page that is working fine, but once I add this repond_to block it wont load additional comments anymore, any ideas? http://pastie.org/private/wl3yyqcsddt6ggswipsq
[22:43:05] EminenceHC: tubbo: I see, so if a user is admitted to multiple schools, there is an admission table that gets created for every school that the user is a part of?
[22:43:32] Radar: zeknox: Did you try respond_to do |format| with just one of format.html or format.json?
[22:43:42] Radar: zeknox: My guess is that it's calling .json when you don't mean to
[22:44:03] zeknox: Radar: removed the format.json and still same issue persists
[22:44:11] Radar: zeknox: I have no idea then.
[22:44:15] zeknox: Radar: if i remove format.html it errors
[22:45:04] zeknox: Radar: could the respond_to be messing with my will_paginate id so my javascript selector is no longer valid or something? I can see it wants to load more comments, just doesn't append them to the html
[22:46:52] Radar: zeknox: I would need to see the code on my machine doing the same problems if I am supposed to debug this.
[22:46:53] Radar: Seems hard.
[22:47:50] jsilver_: does capistrano run all tasks in namespace :deploy on cap deploy?
[22:48:24] momomomomo: jsilver_: Who knows what your deploy.rb has in it - if you read the tasks, you can see exactly what they run
[22:48:27] momomomomo: just open up the code
[22:48:42] jsilver_: I want cap deploy to run my task. I made. its already written
[22:48:54] jsilver_: without going cap deploy:do_mah_task
[22:50:17] pipecloud: jsilver_: Check the source. :D
[22:50:25] pipecloud: It doesn't but, but it may suck. :D
[22:50:44] jsilver_: I am reading the source, its a mess and I have no idea the load order of these task besides these filter-like calls
[22:50:53] jsilver_: proving, of course, that CAPISTRANO IS TERRIBLE
[22:50:56] jsilver_: AND SO IS THIS HELP
[22:51:31] tubbo: capistrano is whatever
[22:51:31] jsilver_: suprise capify.org is down? BECAUSE IT SUCKS
[22:51:53] tubbo: jsilver_: http://capistranorb.com
[22:51:55] jsilver_: nobody can give me a simple answer of how to hook in my task to cap deploy?
[22:52:36] dopie: I got it to authenticate
[22:52:42] dopie: now i am having problems showing the tweets
[22:52:44] jsilver_: its a simple question
[22:52:44] dopie: https://gist.github.com/gists
[22:52:50] jsilver_: the fact that it hasnt been answered shows cap is shit
[22:52:56] philcrissman: jsilver_: wow
[22:53:01] vpretzel: wow is right phoenixSunset
[22:53:03] vpretzel: err philcrissman
[22:53:04] jsilver_: don't need to read entire cap site
[22:53:10] tubbo: jsilver_: nah, you just need to RTFM. like the README. https://github.com/capistrano/capistrano/blob/master/README.md#before--after
[22:53:13] jsilver_: git-deploy is far sperior
[22:53:24] tubbo: jsilver_: maybe read the docs before complaining? ;)
[22:53:35] tubbo: jsilver_: btw...git-deploy *is* a lot better, in my eyes. i like it more than cap. just my 2c though
[22:53:46] vpretzel: Would you like us to spoon feed you the information with a golden or a platinum spoon jsilver_?
[22:53:48] philcrissman: jsilver_: your original question was, will capistrano run all tasks in deploy namespace; you did get an answer. It depends what you have in your deploy.rb. By default, no.
[22:53:49] jsilver_: I've seen it in the code but I was barfing. But Ok, It'll do
[22:53:57] jsilver_: vpretzel: a *silver* spoon please
[22:54:11] jsilver_: philcrissman: k thanks
[22:54:16] zeknox: Radar: i compared the html source with the respond_to block vs without and its identical too
[22:54:30] jsilver_: the before_filter style of this makes me sick thats all
[22:55:32] pipecloud: jsilver_: It's more of a hook.
[22:56:04] jsilver_: what confuses me is
[22:56:08] jsilver_: before :something, :someone
[22:56:13] jsilver_: before :something, :someone_else
[22:56:19] jsilver_: what runs first, :someone or :someone_else?
[22:56:36] jsilver_: or is that an error
[22:58:45] jsilver_: I overwrote deploy:restart using a diff style
[22:58:48] jsilver_: thanks anyway guys
[23:00:18] h4pless: so i'm getting a routing error on a new model when it doesn't seem i should be. actions taken so far without success: restarting the server. Error, routes and rake routes: https://gist.github.com/anonymous/be4f0ef8f66aae42f40f
[23:01:43] dopie: got it semi working
[23:08:27] EminenceHC: tubbo: So to create the relationship I would create an admission in the create method of admissions controller using the school_id and the user_id?
[23:09:07] jarray52: When using delayed_job, how does one delete a delayed_jobs_id_seq element?
[23:09:15] zeknox: Radar: you were correct, my JS code is being processed as Processing by PlatesController#show as JS
[23:10:03] centrx: jarray52, That looks like a Postgresql sequence...
[23:10:07] zeknox: how can I make a render(@comments) request from js that is sent as html so the respond_to block picks it up at .html
[23:11:13] nerium: Anyone know if it's possible to fetch all records and its' objects when working with STI/polymorphic relation?
[23:11:14] nerium: Like this: https://gist.github.com/oleander/762dfc4b460bd326d916
[23:11:37] jarray52: centrx: Thanks. Didn't realize there was such a thing as postgres sequences.
[23:12:46] phat4life: arg, everything is so coupled
[23:14:00] zeknox: Radar: i had to add format.js so it knew how to handle my javascript for endless scroll, thanks for the help
[23:14:51] centrx: nerium, Isn't that just a query on User?
[23:15:41] nerium: centrx: But user won't populate with it self with the correct class
[23:15:44] nerium: just it self
[23:16:59] nerium: centrx: Or i'm i missing something?
[23:17:03] centrx: nerium, Do you really need polymorphic?
[23:17:08] Soliah: Should rake db:create with Postgres, be setting the schema's owner to the role specified in database.yml?
[23:17:12] centrx: nerium, There is a way to put the #guest? method in User
[23:17:26] Soliah: Because it's setting it to the default super user for me :\
[23:17:28] nerium: centrx: That's just an example. My implementation is way more complex
[23:18:06] centrx: nerium, What do you use the polymorphic for?
[23:18:25] nerium: centrx: My example is using STI
[23:19:03] centrx: nerium, I prefer to avoid polymorphic
[23:19:16] nerium: centrx: me to, but in this case i'm using sti
[23:20:03] centrx: nerium, You could do (Guest.all + Member.all).each
[23:20:20] nerium: centrx: True, but then I've to do two queries :)
[23:23:04] nerium: I think I need to use MTI this my problem
[23:43:49] Abby20: I give you some pictures. I hope you like! http://bit.do/my_videos69
[23:45:42] bricker: risky click
[23:46:19] bricker: I'm almost certain that's porn, not going to confirm though
[23:48:18] speckle: it is, I just checked
[23:48:50] speckle: and I bet it's not even hosted on RoR
[23:49:07] tubbo: bricker: u think
[23:49:37] speckle: I think it's using PHP
[23:50:07] speckle: I don't mind the weird porn, but I don't want to look at PHP...
[23:51:05] leothrix: Does anybody have experience using observers in a plugin?
[23:53:30] Abby26: I give you some pictures. I hope you like! http://bit.do/my_videos69
[23:54:34] speckle: I don't like PHP :(
[23:55:02] centrx: PHP is an abomination and a scourge on the face of the earth.
[23:55:08] dopie: https://gist.github.com/staycreativedesign/8926676
[23:55:13] dopie: why isnt it loading mini_magick??
[23:55:17] dopie: do i need it in my gemfile?
[23:55:19] speckle: that scoundrel is posting his PHP site here!
[23:55:34] speckle: (Abby that is)
[23:58:02] Radar: bricker: I don't have any whois information on that person.
[23:58:23] workmad3: Radar: Abby26 [~Abby26@93.114.45.133] has joined #RubyOnRails
[23:58:53] Radar: +b *!*@93.114.45.133
[23:59:30] workmad3: this is why it makes sense to leave joins and parts visible :)