« Back to channel list

#RubyOnRails - 14 September 2013

« Back 1 day Forward 1 day »
[00:24:26] boxfactory: hi all, i want to accept about 8 about 8 fields in a form and save them as a json array in my sqlite db. how would i go about doing this?
[00:24:35] boxfactory: i already have a form_for helper set up for my model
[00:24:49] boxfactory: which is handling other data fields
[00:30:43] pontiki: boxfactory: can i ask why? is this json-ified data string going to be used by something else?
[00:31:02] pontiki: boxfactory: or is this random, unpredictable set of key-value pairs?
[00:31:25] platzhirsch: I don't get it. When I have a nested resource routes: resources :magazines { resource :ad } then what's the name of the controller for the ad methods?
[00:31:46] boxfactory: pontiki: well, my model needs about 8 numbers stored and i figured i would just store them all in one column
[00:32:17] pontiki: doing so is relatively easy, i'd think: if your form values are in, say a subset params[:data], you can just do params[:data].to_json and save that in a field of your actual model
[00:33:43] pontiki: @my_model = Model.new; @my_model.numbers = params[:numbers].to_json
[00:34:00] pontiki: boxfactory: basically like that
[00:34:22] pontiki: but that will slow things down
[00:34:34] pontiki: 8 numbers is nothing for a db record
[00:34:36] boxfactory: pontiki, ive been using the rails generated form to populate my model's fields so far so i dont really know how forms pass params
[00:35:13] boxfactory: pontiki how do i map a form component to be passed in a param as opposed to being immediately mapped to an attribute?
[00:35:14] pontiki: well, it might take some sussing out
[00:35:31] pontiki: boxfactory: but you're really putting yourself and your model and application to a *lot* of unnecessary work
[00:35:58] pontiki: like i said. 8 numbers in a record is *nothing* for a dbms to manage
[00:36:25] pontiki: depending, you might even be taking up a lot more space with a json string of 8 numbers than the 8 numbers themselves would take
[00:36:26] boxfactory: i guess im just thinking about readability
[00:36:33] pontiki: for the database???
[00:36:42] boxfactory: like, it would make more sense to see a "numbers" column as opposed to num1, num2, num3 etc
[00:37:09] boxfactory: anyone who looks at the schema maybe? idk hah maybe i should just do it your way
[00:37:09] fryguy: or make a relation in another table
[00:37:30] boxfactory: oh thats not a bad idea, fryguy
[00:37:32] pontiki: i think it would be a lot more readable to have actual real names for those numbers and what they mean
[00:37:57] boxfactory: alright, ill just make some more columns, thanks pontiki :)
[00:39:22] boxfactory: hm wait, i lied
[00:39:26] boxfactory: it will actually be 27
[00:40:39] boxfactory: how would i go about managing two tables for one model?
[00:41:24] DylanJ: why two tables?
[00:41:56] boxfactory: one for the model, one for auxiliary data for that model?
[00:42:40] boxfactory: i need to store 27 numbers that will account for some attributes of the model
[00:42:56] boxfactory: and i feel like having each number occupy a column will be a little janky
[00:43:14] boxfactory: especially when the model's base attributes number to only about 5
[00:54:28] t27duck: ACTION yawns
[00:54:44] hellow0rld1: register hellow0rld1
[00:55:50] hellow0rld1: Can you hear me now?
[00:56:12] t27duck: did you register your nick?
[00:56:27] hellow0rld1: I'm a rails beginner and I've been trying to get it working for so long but everything is messed up
[00:56:32] hellow0rld1: yes, just did thank you
[00:56:45] t27duck: we were all beginners at one point
[00:56:47] hellow0rld1: I tried using RailsInstaller
[00:56:55] t27duck: oh... Windows?
[00:56:58] hellow0rld1: but that gave an error and messed things up
[00:57:08] hellow0rld1: I have brew installed
[00:57:11] t27duck: ACTION wasn't aware there was a rails installer on mac
[00:57:28] t27duck: hmm... well I'm a linux guy so i'll defer to any mac people in here
[00:57:43] hellow0rld1: I tried gem install rails
[00:57:45] fryguy: ACTION still hasn't seen an error message
[00:57:58] hellow0rld1: sorry, I quit it all trying to run it now
[00:58:14] hellow0rld1: there were a bunch of error messages I solved one by one, but it was neverending
[00:58:38] hellow0rld1: running gem install rails again now
[00:59:02] hellow0rld1: I wish the installation weren't so hard
[00:59:12] fryguy: it's not hard, you are just doing stuff wrong
[00:59:22] t27duck: be nice, fryguy
[00:59:29] jonr22: if you're not using rvm, i think you need to run 'sudo gem install rails'
[00:59:39] fryguy: and/or you don't understand posix basics
[00:59:55] jonr22: i've never had any issues getting rails installed on OS X
[00:59:58] hellow0rld1: Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension. /Users/Ajay/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb *** extconf.rb failed ***
[01:00:19] t27duck: well, you're using RVM, that's apparent
[01:00:19] hellow0rld1: Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
[01:00:37] fryguy: hellow0rld1: and did you check mkmf.log?
[01:00:38] jonr22: do you have xcode installed?
[01:00:53] hellow0rld1: yes, I have the command line tools installed as well
[01:01:01] hellow0rld1: how do I check mkmf.log?
[01:01:22] hellow0rld1: I don't even know where most of these files live
[01:03:43] hellow0rld1: where would mkmf.log be?
[01:04:13] fryguy: use the find command to find it
[01:04:27] fryguy: or locate, or whatever else osx uses to index your filesystem
[01:04:57] hellow0rld1: Ajays-MacBook-Air:~ Ajay$ locate mkmf.log WARNING: The locate database (/var/db/locate.database) does not exist. To create the database, run the following command: sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist Please be aware that the database can take some time to generate; once the database has been created, this message will no longer appear.
[01:05:30] hellow0rld1: Ajays-MacBook-Air:~ Ajay$ find mkmf.log find: mkmf.log: No such file or directory
[01:05:49] fryguy: hellow0rld1: find . -name mkmf.log
[01:06:01] fryguy: you should read the manpage for find when you get a chance, it's a basic posix tool
[01:06:34] hellow0rld1: which ones of these would it be? ./.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.14/ext/mkmf.log ./.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.14/ext/mkmf.log ./.rvm/gems/ruby-2.0.0-p247/gems/linecache19-0.5.12/ext/trace_nums/mkmf.log
[01:07:03] hellow0rld1: and what is posix?
[01:07:24] fryguy: http://en.wikipedia.org/wiki/POSIX
[01:07:41] platzhirsch: What if I want to combine two HTML create forms? For instance if I want to combine /magazines/new and /magazines/ads/new on to one HTML form, what route should I use?
[01:07:42] fryguy: hellow0rld1: take a look at the file timestamps for them and see which one was recently updated, and look at that one
[01:07:50] fryguy: realistically it's probably all three
[01:08:43] hellow0rld1: "xcrun cc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -arch i386 -arch x86_64 -g -Os -pipe -fno-comm
[01:09:54] hellow0rld1: oh this is more recent
[01:09:56] hellow0rld1: " -o conftest -I/Users/Ajay/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-darwin12.3.0 -I/Users/Ajay/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/Users/Ajay/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -I/Users/mpapis/.sm/pkg/active/include -fPIC -pipe conftest.c -L. -L/Users/Ajay/.rvm/rubies/ruby-2.0.0-p247/lib
[01:10:12] hellow0rld1: I don't really know what any of that means
[01:10:38] fryguy: you should pastebin the whole files
[01:11:19] hellow0rld1: http://pastebin.com/UYhLHrxh
[01:11:36] hellow0rld1: <helpa> Hi hellow0rld1. We in #rubyonrails would really appreciate it if you did not use pastebin during your time with us.
[01:12:45] hellow0rld1: http://pastie.org/8324392
[01:13:13] hellow0rld1: did that link go through?
[01:13:42] fryguy: looks like you don't have ruby headers installed, so not really sure how you installed ruby to miss that
[01:14:24] hellow0rld1: how can you tell that? and how can I fix it?
[01:14:44] hellow0rld1: I installed through RailsInstaller and then I uninstalled RailsInstaller. I'm pretty sure something broke.
[01:14:53] hellow0rld1: fryguy, thanks so much for your help btw
[01:19:40] fryguy: no, i don't willingly use osx, so i don't have any other advice
[01:20:14] pontiki: RailsInstaller is for windows
[01:20:19] hellow0rld1: so I'm stuck without ruby headers? is it possible to uninstall all rubies and try it again?
[01:20:38] hellow0rld1: they have a mac version @pontiki
[01:20:52] hellow0rld1: http://railsinstaller.org/en
[01:20:57] pontiki: drop the freaking training wheels
[01:21:11] pontiki: there are many good ways to install ruby
[01:21:13] hellow0rld1: well, I'm pretty sure it's what got me in the mess haha
[01:21:49] hellow0rld1: @pontiki when I do gem install rails, I get this error: ERROR: Error installing rails: ERROR: Failed to build gem native extension. /Users/Ajay/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
[01:22:03] pontiki: do you have x code command line tools installe?
[01:22:21] hellow0rld1: but how would check the version and such?
[01:22:31] pontiki: what is the mkmf.log complaining about?
[01:22:43] hellow0rld1: http://pastie.org/8324392
[01:22:50] hellow0rld1: fryguy says it's the headers
[01:22:56] hellow0rld1: but I have no idea
[01:23:02] hellow0rld1: I'm a total newb
[01:23:09] hellow0rld1: new mac owner
[01:23:19] pontiki: is that the entirety of mkmf.log?
[01:24:06] pontiki: well, sadly, i don't know what RailsInstaller did on install and then uninstall
[01:24:19] pontiki: have you tried installing rvm directly?
[01:24:36] hellow0rld1: I did after uninstalling railsintaller removed it
[01:24:50] pontiki: what happened then?
[01:24:51] hellow0rld1: I did \curl -L https://get.rvm.io | bash -s stable --rails
[01:25:10] hellow0rld1: I think it installed rvm but gave an error about ssl
[01:25:20] hellow0rld1: so I installed that openssl gem
[01:25:25] hellow0rld1: and then tried gem install rails
[01:26:12] hellow0rld1: should I try that curl command again?
[01:26:27] pontiki: you still have an exiting ~/.rvm directory?
[01:26:57] pontiki: and when you type rvm at the terminal, what do you get?
[01:27:01] boytoy_: hellow0rld1: please ask in #rvm
[01:27:31] hellow0rld1: = rvm * https://rvm.io/ * https://github.com/wayneeseguin/rvm/ == DESCRIPTION:
[01:27:43] hellow0rld1: and then a bunch of description stuff
[01:27:46] pontiki: wake you from your nap, boytoy_ ?
[01:28:10] boytoy_: pontiki: no sleep for me
[01:28:18] pontiki: hellow0rld1: please join #rvm so we don't bother the natives
[01:28:37] boytoy_: hellow0rld1: every time i have an openssl error it's a bug
[01:28:47] boytoy_: hellow0rld1: and the rvm authors usually fix it immediately
[01:29:00] hellow0rld1: how can I join rvm?
[01:29:07] pontiki: /join #rvm
[01:29:29] hellow0rld1: I don't think it worked
[01:29:41] pontiki: hellow0rld1: how are you on IRC?
[01:29:50] hellow0rld1: webchat.freenode.net
[01:29:57] pontiki: should work...
[01:30:06] platzhirsch: #RVM, the IRC channel to end all Ruby versions, meta meta meta meta
[01:30:29] hellow0rld1: /join #rvm doesn't do anything
[01:30:46] existensil: i know. its a quiet room
[01:30:53] pontiki: well, i haven't ever used the webchat interface
[01:30:54] hellow0rld1: oh I looked at status
[01:30:56] hellow0rld1: [21:28] == #rvm Cannot join channel (+r) - you need to be identified with services
[01:31:09] existensil: talk to NickServ
[01:31:17] pontiki: wonder why they did that
[01:31:24] hellow0rld1: what do I say to NickServ?
[01:31:32] existensil: i don't remember
[01:31:50] pontiki: /msg nickserv register <password> <email>
[01:31:56] pontiki: without the <> brackets of course
[01:32:11] hellow0rld1: is there any way I can just start over with rails and try again to install?
[01:32:32] pontiki: hellow0rld1: this is what i'm attempting to help you with
[01:33:08] pontiki: but perhaps i shouldn't
[01:33:11] platzhirsch: plug out, plug in
[01:33:43] hellow0rld1: it won't let me go to #rvm
[01:33:47] hellow0rld1: I'm really sorry
[01:39:00] hellow0rld1: how do I remove all from rvm?
[01:39:10] hellow0rld1: $ rvm remove --all didn't work
[01:41:00] madnificent: hellow0rld1: i'd check rvm.io and use that. never dived in the source.
[01:41:40] madnificent: I'm trying to run cucumber together with guard and zeus, however I keep getting a Could not find command "cucumber" when I try to run zeus cucumber. any ideas on what else I need to get this running, I must be overlooking something.
[01:44:28] sephus: hey guys i have a huge problem. ruby on rails is not rendering anything at all
[01:44:51] madnificent: sephus: have you checked the logs?
[01:45:04] sephus: yes, no errors. everything goes fine
[01:45:15] madnificent: if you wget the page, do you get any content?
[01:45:35] sephus: nope, nothing
[01:45:37] sephus: here's the log
[01:45:38] sephus: Processing LegislatorsController#what (for at 2013-09-13 20:30:16) [GET] Completed in 20ms (View: 18, DB: 0) | 200 OK [http://www.quienesmilegislador.com/legislators/what]
[01:46:18] ner0x: Is it possible to render handlebars in app/views/* ?
[01:46:29] ner0x: Or am I thinking about this incorrectly?
[01:47:31] madnificent: sephus: it returns a 404 here
[01:47:44] sephus: on what url?
[01:48:18] sephus: try this: http://www.quienesmilegislador.com/legislators/what
[01:48:19] pontiki: the one you just pasted?
[01:48:37] sephus: hmmm over here i get empty content
[01:48:47] pontiki: yup, zero content
[01:49:02] pontiki: is that a production system?
[01:49:18] sephus: no, development
[01:49:27] sephus: let me paste the log, brb
[01:49:55] sephus: http://pastebin.ca/2450096
[01:50:51] sephus: even if i put render :text => "hello world!" i get absolutely nothing
[02:00:54] jrobeson: hello pontiki :)
[02:01:20] butblack: hi, why is my username returning blank?
[02:01:20] butblack: https://gist.github.com/ebbflowgo/6558214
[02:01:53] dwahyudi: holla everyone
[02:01:59] dwahyudi: anybody here?
[02:02:03] jrobeson: butblack, i think you want downcase!
[02:02:27] dwahyudi: have you all heard the latest news? google is migrating from MySQL to MariaDB
[02:02:42] jrobeson: i didn't .. but why wouldn't they..
[02:02:44] sephus: no idea why they use mysql
[02:02:46] sephus: instead of postgre
[02:02:55] butblack: jrobeson: doesn't change the result, it still returns blank, as in no value at all for the params
[02:03:10] bratsche: Why is this MariaDB migration so interesting of news?
[02:03:28] sephus: cuz it's a kick in the balls to Oracle
[02:03:38] bratsche: I don't work at Oracle, I couldn't care less.
[02:03:58] bratsche: I wish instead of pointless changes like this that they would add Postgres support.
[02:04:39] dwahyudi: dunno, but i heard that Google has sent their engineer straight to mariadb head office
[02:04:55] jrobeson: butblack, setters don't return values with that anyways
[02:05:12] bratsche: For app developers this doesn't really change much of anything, which is why it seems like non-news to me.
[02:05:14] dwahyudi: head manager of mariadb said that google will move everything every single mysql data to mariadb ...
[02:05:43] bratsche: Seems like pointless PR.
[02:05:43] jrobeson: although that's a different problem than you're having..
[02:06:01] dwahyudi: i don't know, but at least Google choose an open source product ...
[02:06:13] dwahyudi: for its daily operational
[02:06:13] butblack: jrobeson: i'm not sure why it's not showing up, if I take out the setter it works fine..
[02:06:15] bratsche: MySQL was already open source.
[02:06:34] dwahyudi: then owned by Oracle
[02:07:01] butblack: jrobeson: except when I have a capital letter in my username, then it breaks as my routing doesn't recognize the capital letter, I would prefer to save all usernames as downcase
[02:07:09] bratsche: I just want Postgres support. Everything else is just noise. :)
[02:08:31] boytoy_: wow postgresql ranks 4 vs mariadb at 34 at db-engines.com
[02:08:42] dwahyudi: is there anything i should do when migrating from mysql to mariadb in my rails app?
[02:09:05] boytoy_: also.. initial release 1989 vs 2009, you gotta be kidding me :p
[02:10:02] bratsche: boytoy_: 2009 is kind of deceptive, since it's a fork of MySQL which is from like 1995.
[02:10:18] bratsche: It's almost the same thing as MySQL.
[02:10:59] boytoy_: bratsche: Am looking at http://db-engines.com/en/system/MariaDB%3BPostgreSQL
[02:11:26] boytoy_: rejoicing in the fact that i went with postgresql from the getgo :p
[02:11:47] bratsche: I started with MySQL because I didn't know any better, then I converted to Postgres.
[02:12:06] butblack: jrobeson: fixed it up with a before_save callback
[02:12:45] boytoy_: bratsche: cool
[02:13:20] boytoy_: bratsche: mysql ranks one spot ahead of postgresql at db-engines though :/
[02:13:58] bratsche: boytoy_: That doesn't really mean anything though. From actual working experience I know that postgres is far better. :)
[02:14:20] bratsche: boytoy_: I think db-engines must just rank them by what's used most, or what's most popular. Not by what's better.
[02:14:41] dwahyudi: as for me, i'm starting to use postgre with redis ...
[02:15:00] fryguy: i wonder how many people here have actually used both mysql and postgres at reasonable scale (terrabytes of data)
[02:15:15] dwahyudi: there is RDBMS war and there is NOSQL war ... i'm quite confused anyway
[02:15:38] bratsche: fryguy: I don't know. I haven't worked with either at that large of scale.
[02:15:45] bratsche: And I hope I never have to. :)
[02:15:54] fryguy: bratsche: why not lol
[02:15:59] fryguy: working with lots of data is fun
[02:17:07] dwahyudi: my biggest data set is only 80 GB
[02:17:19] dwahyudi: never reached into terabytes.. :D
[02:18:22] boytoy_: big dbs and d3.js :P
[02:18:34] boytoy_: oh god please make it happen !!
[02:19:10] dwahyudi: and since ruby 2.0 my rails app is getting faster and faster ...
[02:19:30] dwahyudi: dunno about this turbolinks stuff whatever ...
[02:19:46] bratsche: Yeah, I'm unconvinced by turbolinks.
[02:19:58] bratsche: But I'm not really doing Rails stuff anymore.
[02:21:34] dwahyudi: so what are you doing now bratsche?
[02:21:56] bratsche: Working for a company that makes mobile dev tools.
[02:22:42] dwahyudi: me too.. android is getting higher, with this kitkat name
[02:22:59] bratsche: What a horrible name for next release. :(
[02:23:10] dwahyudi: i think it is a very great marketing
[02:23:29] bratsche: It just seems like they're partnering with candy companies now. In another couple releases it'll be M&M. :/
[02:26:29] dwahyudi: what about the L ?
[02:26:34] dwahyudi: L is after K
[02:27:17] bratsche: Life Savers
[02:29:51] bratsche: That would be fine. I just don't like KitKat because it's not a generic name, it's some specific brand.
[02:31:20] dwahyudi: and then Nutella for the N ? :D
[02:42:41] existensil: if i could get my hands on thoes android shaped kitkats i would buy
[03:05:16] godd2: Where would I look to find what the mose used authentication gem is?
[03:07:14] justinseiter: godd2: https://www.ruby-toolbox.com/categories/rails_authentication
[03:08:13] godd2: cool , thanks justinseiter
[03:25:17] spyzer: hey guys, the method deliver in actionmailer is blocking right?
[03:25:35] spyzer: I should use message queues to send mails i believe?
[03:26:39] nate_: I have 3 models User Item Course, what sort of flag/association would i need to set to make sure an item ALWAYS belongs to a User but may or may not belong to a course as well
[03:27:33] BrianJ: I'm using paperclip and i have a user model that has a has many through relationship with my asset model which is used to upload images. I need to set a "profile" pic from the uploaded assets that are tied to the user.. What is the best way to do this?
[03:30:38] gestahlt: Is it possible to call a js function from controller? I tried this in my respond_to block: format.js { render js: "test_function();" } but the function does not get executed. Is it even possible that way?
[03:35:07] fryguy: gestahlt: that seems like a really weird way to do things
[03:36:36] gestahlt: Well, i am not sure if this is right what i do
[03:37:13] jrobeson: no you can't do that
[03:37:35] jrobeson: well technically you could.. if you called a js interpreter
[03:37:51] gestahlt: I try to render a partial in a string (render_to_string) and i need JS for the rendering
[03:38:18] jrobeson: then you likely wrote your partial wrong
[03:38:35] gestahlt: Well, the partial itself works
[03:38:37] pontiki: isn't that returning js to the client? your client needs to receive it and evaluate it
[03:39:04] fryguy: it's the ollllllllld rjs way of doing things
[03:39:53] gestahlt: The reason why i render it through a string is, its a very generic thing i use through my application. I dont want to repeat it over and over
[03:41:00] jrobeson: well that is a reason to use partials generally yes
[03:41:01] pontiki: you have the same string in several locations in your app?
[03:41:05] gestahlt: Ah i am bad explaining
[03:41:26] pontiki: and you *don't* want to repeat it over and over? what am i missing here?
[03:41:35] gestahlt: I use an array of hashes for an model and its relation. I create a process map with it
[03:41:50] gestahlt: I use this for multiple models
[03:41:58] gestahlt: output is as expected
[03:42:14] gestahlt: I have like 3 partials
[03:42:25] gestahlt: one to create a tree from the output
[03:42:31] gestahlt: one to create a form from the output
[03:42:40] gestahlt: one to create a table from the output
[03:42:53] nate_: /j #spree
[03:43:14] gestahlt: They also work as expected
[03:43:23] gestahlt: now i like to ajaxify them
[03:43:48] Ericx2x: If I simply do <!DOCTYPE html> that will be html5 ?
[03:43:51] jrobeson: so.. just send the result back
[03:44:06] gestahlt: The thing is, since this is an engine, i do not want to put... html classes or ids around the html tags
[03:44:16] jrobeson: Ericx2x, yes
[03:44:22] gestahlt: I want to do that in the primary application
[03:44:47] Ericx2x: ok so i changed my doctype but i still have the z-index working wrong
[03:45:08] jrobeson: Ericx2x, so? seems more like a css problem than anything related to html5
[03:45:15] Ericx2x: the overlay index is 18 and the popup index is 99999
[03:45:17] jrobeson: also of course.. check in different browsers
[03:45:37] gestahlt: i want to call a js function when the controller action is executed
[03:46:18] gestahlt: Maybe i do it wrong
[03:46:25] gestahlt: i just need something to trigger my js
[03:46:32] jrobeson: you should call the js function from your view that pulls in the partials
[03:47:19] Ericx2x: i'm so angry i dont know what is going on here the z-index works fine on JS fiddle but for some reason on my machine a z-index of 18 is beating a z-index of 999999
[03:47:21] jrobeson: using somlike like jQuery.load and pointing it at a route that returns only the partial in a custom layout would do it
[03:47:26] gestahlt: cant i fire custom ajax events or somethign like that?
[03:47:55] jrobeson: i think you might wnat to read up a bit more
[03:48:14] gestahlt: jrobeson: Do you have an example?
[03:48:24] gestahlt: im reading now for like 2-3 hours and im stuck
[03:48:27] fryguy: gestahlt: you are thinking about things in a reall wrong way i think
[03:48:32] jrobeson: 2-3 hours is nothing
[03:48:37] gestahlt: fryguy: that might be
[03:48:48] jrobeson: i spent an entire night reading about freakin hstore last night :(
[03:49:01] jrobeson: turned out not to be useful for what i wanted afterall
[03:49:13] jrobeson: not until pg 9.4
[03:49:18] scyllinice: It's fine if you don't want to read nested keys
[03:49:24] scyllinice: Then it gets to be a pain
[03:49:28] scyllinice: At least from what I've seen
[03:49:29] fryguy: scyllinice: and if you don't care about the datatype of the value
[03:49:54] fryguy: jrobeson: related, you should see the json datatype, which has basically full support in 9.3
[03:51:17] jrobeson: well.. i'm not sure if that would do it for me either
[03:51:34] jrobeson: i was just trying to define what i could do and couldn't
[03:51:48] jrobeson: i guess i should write out what i'm looking for
[03:52:40] jrobeson: i'm having trouble modeling it
[03:53:14] scyllinice: Trouble modeling it? Use MongoDB :trollface:
[03:53:36] fryguy: scyllinice: postgres + json does most things mongo can do, plus you get acid compliance
[03:53:55] scyllinice: Hence the trollface
[03:54:53] scyllinice: A client I was considering working with wanted a project done, but demanded it be in NoSQL
[03:55:47] scyllinice: The original description was all relational data, but you know.. NoSQL is the answer to everything
[03:58:11] jrobeson: part of it could legimately be a hash (in a hash) of the global site settings
[04:02:45] nate_: I have 3 models User Item Course, what sort of flag/association would i need to set to make sure an item ALWAYS belongs to a User but may or may not belong to a course as well
[04:03:32] macmartine: what's an 'item' ?
[04:05:17] macmartine: Item belongs_to :user -- and user habtm :courses
[04:05:34] nate_: thanks macmartine
[04:05:37] s2013: what is an observer?
[04:05:51] s2013: didnt think about that. thanks
[04:06:07] scyllinice: That doesn't guarantee that the item has a user attached
[04:06:36] macmartine: scyllinice: he didn't say that was a requirement
[04:06:47] scyllinice: "i need to set to make sure an item ALWAYS belongs to a User"
[04:07:03] s2013: you can make sure user_id presence is true
[04:07:15] macmartine: i read that as, if there's an item, it must belong to a user. maybe he meant if there's a user, it must have an item
[04:08:02] macmartine: i would think if a user may or may not belong to a course that she may or may not have a book
[04:09:10] Senjai: Is there an equivilant to "should have_many(:association)" from shoulda in rspec?
[04:09:44] nate_: I mean that a book MUST belong to a User
[04:09:52] nate_: but in some situations it will also belong to a Course
[04:10:04] nate_: can't have any books floating around without owners
[04:10:10] macmartine: Senjai: http://stackoverflow.com/questions/2673041/checking-activerecord-associations-in-rspec
[04:10:19] scyllinice: nate_: What s2013 said will take care of it
[04:10:52] nate_: scyllinice: do you mean what macmartine said ?
[04:11:03] scyllinice: nate_: No, that only sets up the association
[04:11:11] nate_: but enforcing the rule
[04:11:15] nate_: is making sure user_id exists
[04:11:21] scyllinice: nate_: Setting a presence validation on user_id will do it though
[04:11:38] nate_: i suppose i could just restrict people from 'creating' a book unless they are logged in
[04:12:18] Senjai: macmartine: Sorry, I really should have googled. I did look through the docs though..
[04:13:23] macmartine: that's cool. yeah, those docs aren't the greatest for finding that kind of thing
[04:16:39] jrobeson: scyllinice, it's just that i feel bad about having fields like zone_1, zone_2...zone_6
[04:16:56] jrobeson: but.. that is how many there are.. and it won't change anytime soon
[04:17:11] scyllinice: jrobeson: You could throw them in another table and join on it
[04:17:12] jrobeson: the hardware limitation is 100
[04:17:52] jrobeson: i could.. but that'd be no better than just having a key => value settings table generally for my site
[04:18:04] jrobeson: i'm just trying to figure out what i really want out of it :)
[04:18:22] jrobeson: i wish there was an automagic gem that would build me a key value site configuration page
[04:18:28] scyllinice: Well, don't overengineer it
[04:19:33] jrobeson: scyllinice, exatly..
[04:19:43] jrobeson: initially i only need these 6 values :)
[04:19:55] jrobeson: but i feel dumb for creating a table for 6 entries only :) hehe
[04:20:34] jrobeson: oh.. wait.. there are other entries..
[04:20:40] scyllinice: Well, if you're only going to need 6 settings, total, would setting environment variables work for you?
[04:20:42] jrobeson: i forgot i need a /path/to image too
[04:20:53] pontiki: jrobeson: are these zone_* things well understood to mean something specific?
[04:20:55] jrobeson: needs to be configurable in the gui
[04:21:13] jrobeson: pontiki, not without a description
[04:21:31] pontiki: well, okay, but they aren't arbitrary in that the meaning could change from record to record?
[04:21:41] jrobeson: ah no these are global settings
[04:21:48] pontiki: so that people using your application will know what they mean?
[04:21:52] pontiki: or administering
[04:21:55] scyllinice: You could go as far as serializing a hash into a text field if you wanted
[04:21:57] jrobeson: oh .. ou mean other ones other than zone_* .. there will be a banner image
[04:22:07] jrobeson: scyllinice, but i would like them validated for integer values
[04:22:13] jrobeson: they will be used for scoring
[04:22:21] pontiki: no, i mean the ones labeled in the fashion: zone_1, zone_2...
[04:22:41] jrobeson: not if i were just to use them without context no
[04:22:53] pontiki: does your application have any context?
[04:23:02] jrobeson: yes.. a game
[04:23:10] jrobeson: and those are scores for the zones of the game
[04:23:12] pontiki: then wouldn't that be enough?
[04:23:31] jrobeson: enough for? jsut running humanize on them ? :)
[04:23:44] pontiki: never mind, this is going nowhere
[04:23:49] jrobeson: pontiki, i don't understand the question
[04:24:17] pontiki: source of question is this question: why does it matter if they're named zone_1..6 or not?
[04:24:35] jrobeson: because i'll need to use them to match up to the zones as they come in
[04:24:36] pontiki: for *this* application you are writing?
[04:24:44] jrobeson: to calculate the score for each hit
[04:25:11] pontiki: so then why do you care if that's what they're called in the model?
[04:25:22] jrobeson: so i'll have to reference them .. and ultimately it'd be best if it as an array of zones without the prefix like zones : { 1 : 100, 2: 100.. }
[04:26:10] pontiki: and then why not just an actual array: [100,200,...]
[04:26:25] pontiki: positioni in array corresponding to zone
[04:26:33] jrobeson: i can do that.. as long as i plus one it when i'm matching
[04:26:51] jrobeson: i have to map them against the values that come in .. so just doing it there in a constant would be fine really
[04:27:09] jrobeson: the values that come in don't match the zones directly
[04:27:21] jrobeson: it's crap.. the numbering scheme makes no sense
[04:27:28] jrobeson: but nothing i can do about that
[04:27:40] pontiki: but somehow you can map the hits to the zone
[04:27:59] jrobeson: 10 is zone 1, 20 is zone 2 , 30 is zone 3, 50 is zone 4
[04:28:05] jrobeson: yes 50.. not 40..
[04:28:46] pontiki: is that 1..10 -> zone 1, 11..20 -> zone 2, .. and so on?
[04:29:16] jrobeson: no.. it's just 10 is zone 1.. there are no inbetween
[04:29:26] jrobeson: it's a total of 3 zones on each side .. so zones 1-6
[04:29:32] scyllinice: Magic numbers
[04:29:37] jrobeson: front_1, front_2, etc
[04:29:45] t27duck: got another nub db question. For Polymorphic associations, is it better to add a multicolumn index on the two columns of the table that make up the association?
[04:29:47] pontiki: then it's another array [10,20,30,50...]
[04:30:06] scyllinice: t27duck: Yes. They are always queried together
[04:30:29] t27duck: I'm not THAT big of a nub, but i like getting verification on that stuff
[04:31:19] scyllinice: t27duck: If you run the rails_best_practices gem, it tells you that as well, I believe
[04:31:20] t27duck: by "nub" i'm referring to db optimization, not ruby
[04:32:54] t27duck: noted, thanks scyllinice
[04:35:09] scyllinice: t27duck: It's a pretty decent tool. It gives you a list of things it thinks are wrong in your code. One of them is missing indexes, but it does more. It's a good starting point, but it's not the gospel :)
[04:35:29] t27duck: oh totally
[04:35:50] t27duck: i chuckle a little every time I see a code climate badge. It's nice to have, but it's very subjective
[04:36:19] t27duck: sometimes "best practices" aren't the best way to tackle a solution
[04:37:00] BrianJ: I'm using paperclip and i have a user model that has a has many through relationship with my asset model which is used to upload images. I need to set a "profile" pic from the uploaded assets that are tied to the user.. What is the best way to do this?
[04:37:02] scyllinice: Yes. I know a guy who prided himself in having a 3.7 or 8 code climate number
[04:37:31] scyllinice: So, I generated a new Rails app and ran it through. Came out 4.0
[04:37:51] t27duck: we had a co-worker at my work who drank the Uncle Bob kool-aid
[04:38:03] t27duck: actually, more like stuck an IV into his arm
[04:38:07] t27duck: drove us insane
[04:38:31] t27duck: treat Clean Coders as a guide, not as law
[04:39:57] scyllinice: BrianJ: The easiest thing I can think of is to add a profile_pic_id to your user and set it to the chosen asset id. Then build an association off of that
[04:40:01] t27duck: BrianJ: well, does the asset model have any specific identifying attributes on it that would make it stand out as an avator?
[04:40:06] krz: looking for some insights. what are yall using for storing (long term, 1year ++) analytics data?
[04:40:13] t27duck: or... what scyllinice just said
[04:40:18] t27duck: ACTION was thinking in the oposite direction
[04:40:50] hmmmm: Hi guys, I'm a girl programmer
[04:40:56] hmmmm: that's right, I'm a programmer and a girl.
[04:41:03] hmmmm: Bet you weren't expecting that, huh?
[04:41:07] t27duck: guys? what guys?
[04:41:10] scyllinice: Where's Radar?
[04:41:10] t27duck: we're all chicks here
[04:41:12] hmmmm: How does it feel, knowing that girls can be programmers too?
[04:41:17] pontiki: i guess i'll have to leave now, since there can be only one
[04:41:20] hmmmm: XD lelelelel i'm such a nerd :P
[04:41:29] hmmmm: #code #grrrrl #nerd #geek #gamergurl
[04:42:10] BrianJ: scyllinice: Ok so I need to create a profile_pic_id attribute i assume?
[04:42:25] hmmmm: BTW you guys fix those memory leaks yet?
[04:42:30] scyllinice: BrianJ: You can call it whatever you want, but that's the idea
[04:42:38] hmmmm: maybe if a grrl programmer coded RoR it wouldn't suck
[04:43:05] t27duck: hmmmm: no, i'm sure it would still have trouble spots...
[04:43:08] BrianJ: t27duck: no, a user can upload as many pics as you want and I want them to be able to pick the one they want to be their profile pic. I hope that answers your question
[04:43:35] t27duck: BrianJ: then i would go with the profile_pic_id attribute
[04:43:47] BrianJ: ok great, thanks
[04:44:01] t27duck: User has one profile_pic class name "upload" </psudo_code>
[04:44:11] scyllinice: Alright. It's midnight here. Good night everyone :)
[04:46:10] t27duck: why do i always feel dirty typing ":polymorphic => true" when it comes to active record?
[04:46:52] pontiki: go with that thought
[04:51:00] davidcelis: polymorphism is fine
[04:53:07] BrianJ: Ok so I added a profile_pic attribute to my user model, but how do I let my user pick the image?
[04:53:33] BrianJ: do I add a checkbox to each image and if its checked, thats what the profile pic is set to?
[04:53:43] davidcelis: sounds like a bad user experience
[04:55:41] davidcelis: you could take the checkbox idea and make each checkbox hidden
[04:55:45] davidcelis: clicking the image checks the hidden box
[04:55:58] davidcelis: or you could have clicking the image submit an AJAX post to just update the image imdediately
[04:58:04] BrianJ: that seems like a better solution
[04:58:08] BrianJ: i'll do that for now
[05:33:58] brianpWins: I am trying to run bundle install within a gem directory but keep getting: 'block in search_by_dependency': undefined method `prerelease?'. The Gemfile only has 'gemspec' in it. and the gem spec only defines the most basic attributes. http://pastie.org/8324730
[05:41:08] jrobeson: brian-mann, it's possible that that one attribute isn't enough? :)
[05:41:50] brianpWins: jrobeson: Then I'd think it would say so =) I've tried it with a full proper gem spec it make no difference.
[05:42:03] brianpWins: at least the error never changes
[05:42:13] jrobeson: perhaps it's coming from the other gems?
[05:43:21] brianpWins: but the gem file is empty. There are no other gems.
[05:55:33] brianpWins: i don't know what i changed but i think i got it working
[05:57:24] brianpWins: jrobeson: I'm just going to go ahead and say you fixed it. thanks mate
[05:58:41] aism: What's the best tagging gem?
[06:00:32] Senjai: aism: I've used acts_as_taggable
[06:01:11] Senjai: So I'm encountering a weird routing error, obviously It's something I've done. UrlGenerationError which is one I haven't seen before. The controller, test, errors and routes are here: https://gist.github.com/Senjai/6559182
[06:01:16] Senjai: any input?
[06:01:51] Senjai: other contexts in the spec pass, e.g. post :create etc.
[06:06:52] Senjai: use_route: accounts_path worked. But I don't know why
[06:15:16] kurt21: If I have a route:
[06:15:17] kurt21: get '/issue_export/:id', to: 'issue_export#get', as: 'issue_export'
[06:15:17] kurt21: how to a link to that route like:
[06:15:17] kurt21: link_to("Issue Export", "http://www.testurl.com")
[06:15:51] Senjai: kurt21: issue_export_path
[06:17:07] kurt21: ActionController::RoutingError (No route matches {:controller=>"issue_export", :action=>"get"}):
[06:19:07] Senjai: kurt21: you have a controller named issue_export?
[06:20:00] kurt21: I manually created one. I'm trying to regenerate with the "rails generate controller" command. But I'm working in a plugin, not the root application.
[06:24:13] kurt21: Should manually creating a IssueExportController class named issue_export_controller.rb work?
[06:25:28] Senjai: I dno, I'm struggling with a lot of weird errors atm
[06:34:50] kurt21: how about this one. should be easy. route is: get 'great/:id' => 'great#std', as: :great_get
[06:35:00] kurt21: error is: NoMethodError (undefined method `action' for GreatController:Class):
[06:35:19] kurt21: the action is std, why is it looking for 'action'
[08:09:57] jrobeson: actioncontroller::live eats better_errors for breakfast :(
[08:55:13] fixnum: I want to use Haml outside of Rails, how can I embed markdown code inside a Haml document?
[08:56:02] fixnum: I know there is some way to do it with javascript, but it looks complicated.
[08:57:52] jankees: Hi fellow rails developers, i have a routes question. I have some nested resources. (Invoice is within team) but i don't want the paths that gets generated to be nested… So I don't want invoices_team_path but just invoices_path
[08:58:04] jankees: is that possible? I can't find an option to do that
[09:06:54] jrobeson: fixnum, read the haml docs it's there
[09:07:03] jrobeson: it has a filter for markdown in contribs
[09:07:09] jrobeson: not sure which markdown gem it can work with
[09:07:12] jrobeson: but i'm sure you can figure that out
[09:11:32] fixnum: jrobeson: alright, I just didn't want to accidentally learn Haml if it weren't possible. Thank you.
[09:25:35] coderhs: hey how to make your rails log store in JSON files, instead of plain text?
[09:31:43] toretore: by using a completely different logger that stores as json
[09:32:11] coderhs: toretore: any suggestion of such loggers?
[09:32:30] toretore: i doubt storing everything in one big json file is efficient though, as i don't think you can just append to the file like a normal log file
[09:32:43] toretore: you should try using a proper datastore instead
[09:33:11] toretore: i don't know of any loggers that do that for you, i wrote my own
[09:33:22] coderhs: or how about this.. instead of writing into a JSON file.. but in JSON Format
[09:33:51] coderhs: the same production.log, but the text is written in JSON format, so that i can parse it and search better
[09:34:11] toretore: what would that json contain?
[09:34:54] coderhs: same thing as the present logs: where it came from, which page it went, what all query happened there, and what was the response (render or redirect)
[09:35:01] toretore: you can't just shove the log output into a json string, that defeats the purpose
[09:35:26] toretore: what you're suggesting is quite involved and difficult
[09:35:27] coderhs: but apachae can do that
[09:35:38] toretore: rails can't, out of the box
[09:36:02] toretore: it's possible, but it's a bit of work
[09:36:40] toretore: it's not just "swap this logger out for this one"
[09:36:41] coderhs: can u just point in me in the direction i should follow?
[09:37:11] toretore: http://toreto.re/rails-logging/ is what i've done, but as i say, it's a bit of work
[09:37:11] coderhs: how about, can i change the way text, is entered into log
[09:37:33] coderhs: can i make it like instead of writing "url timestamp link etc"
[09:37:52] coderhs: i can make it into format "{url: url timestamp:timestap}
[09:37:52] toretore: you could possibly change that, but i don't know how
[09:38:12] toretore: the log output comes from a lot of different places inside rails
[09:38:35] coderhs: but it should be written by one class right?
[09:38:49] toretore: yes, but it's just a string, there's no structure
[09:39:46] coderhs: hmm, let me try working in that angle.. maybe i can format the string before it write it..
[09:40:02] coderhs: but that will put one operation extra..
[09:41:00] toretore: it's not going to be easy.. if you look at the link i posted, you'll see how many hoops you have to jump through to get to the data
[09:42:27] coderhs: I am looking at the article now
[09:51:33] learner_: how to give the reply to comments using js
[10:34:33] DaniG2k: hey guys im having a problem with some code that I've mostly taken verbatim from the railscast dynamic forms episode
[10:34:36] DaniG2k: https://gist.github.com/DaniG2k/6554001
[10:34:48] DaniG2k: basically it all works except for removing the nested attributes
[10:34:51] DaniG2k: they don't get destroyed
[10:34:54] DaniG2k: for some reason
[10:35:07] DaniG2k: any ideas why?
[10:38:00] IlyaLevin: Hey everyone.
[10:40:38] oliver__: DaniG2k: I think it should be builder.text_field
[10:40:45] oliver__: and builder. ... etc
[10:40:51] oliver__: in edit.html.erb
[10:41:16] oliver__: but if that is correct, then also saving educational experiences shouldn't work
[10:43:14] DaniG2k: oliver__: the saving is working
[10:43:29] DaniG2k: oliver__: it's just not destroying when i click on [remove]
[10:44:40] DaniG2k: oliver__: do I need a destroy method in my controller for this?
[10:44:49] jammanbo: he's right, you should be using builder inside your fields for.
[10:44:51] DaniG2k: although he doesnt use one in the railscasts
[10:44:52] oliver__: nope, it should see the _destroy attribute passed in
[10:44:58] jammanbo: mights fix your problem.
[10:45:04] oliver__: and you have allow_destroy in your accepts_nested_attributes
[10:45:17] oliver__: so thats the model/controller part seems ok
[10:45:30] oliver__: you could inspect the DOM after you click remove
[10:45:40] oliver__: find the hidden destroy input and check if its value is really getting set to 1
[10:45:55] DaniG2k: oliver__: where do i need to put builder.text_field exactly/
[10:46:06] oliver__: pretty much everywhere where its like "f."
[10:46:08] jammanbo: he's posting it under the wrong param name … you were right first time oliver__
[10:46:09] oliver__: inside the fields_for block
[10:46:22] oliver__: jammanbo: yeah but weird that saving is working right?
[10:46:28] jammanbo: bet it isnt
[10:46:39] DaniG2k: yeah saving seems to work
[10:46:44] DaniG2k: I'll try with builder
[10:47:08] DaniG2k: sorry my bad let me update the gist
[10:47:57] jammanbo: is it too early to start drinking?
[10:48:12] oliver__: its 5'oclock somewhere right?
[10:48:17] DaniG2k: https://gist.github.com/DaniG2k/6554001
[10:48:24] jammanbo: I wonder if there's a website for that ...
[10:48:25] DaniG2k: sorry I had it within a partial
[10:48:33] DaniG2k: thats why its saving properly
[10:48:41] oliver__: DaniG2k: yeah that looks better
[10:48:44] oliver__: lemme see what could be wrong
[10:49:03] DaniG2k: so it has <%= render 'educational_experience_fields', f: builder %>
[10:49:15] DaniG2k: which renders stuff like <%= f.text_field :university, placeholder: 'University of XYZ' %>
[10:49:25] oliver__: yeah that seems to be correct
[10:49:28] DaniG2k: then the remove part has <%= f.hidden_field :_destroy %>
[10:49:46] DaniG2k: and the hook <%= link_to "[remove]", "#", class: "remove_fields" %>
[10:50:13] jammanbo: Why would you snag the domain isittooearlytostartdrinking.com and then put that on it??
[10:51:01] oliver__: DaniG2k: try to convince yourself now its not the JS
[10:51:17] oliver__: add like alert inside the $(document).on 'click', 'form .remove_fields', (event) ->
[10:51:21] oliver__: make sure its getting fired
[10:51:31] oliver__: maybe jquery isn't loading for some reason
[10:51:56] oliver__: check the post that rails is receiving, make sure _destroy is really set to 1 in the params
[10:52:09] jammanbo: is the problem that you are removing the _destroy field from the dom at the same time you remove the other fields?
[10:52:50] oliver__: that could be it... but i think 'hidden' elements will still post
[10:52:56] DaniG2k: oliver__: what should i pass to the alert?
[10:52:56] jammanbo: move the hidden field outsude of the fieldset
[10:53:06] jammanbo: because you are removing the fieldset
[10:53:24] DaniG2k: oliver__: yea alert gets triggered
[10:53:58] oliver__: jammanbo might have a point
[10:54:05] oliver__: worth a try
[10:54:17] oliver__: but then the link will have to be moved as well in order for it to still work with the JS
[10:54:21] DaniG2k: so in the partial
[10:54:28] jammanbo: about the wine?
[10:54:41] oliver__: can you paste the result of a post from that form?
[10:54:53] oliver__: where you have tried to remove a element?
[10:55:12] jammanbo: oh sorry, he's only hiding it, not removing it … hmm
[10:55:18] oliver__: I want to see something like {... _destroy => 1} in it
[10:55:32] DaniG2k: oliver__: like the log file?
[10:55:44] oliver__: started POST for ...
[10:55:48] oliver__: something along those lines
[10:56:04] oliver__: and there will be a line with the params that rails is receiving
[10:56:34] DaniG2k: oooooh i see
[10:56:36] DaniG2k: oliver__: good call
[10:56:50] DaniG2k: im getting a bunch of Unpermitted parameters: _destroy, id
[10:56:57] oliver__: interesting
[10:56:58] DaniG2k: I probably need to add it to the permit
[10:57:04] DaniG2k: im on rails 4
[10:57:06] DaniG2k: strong params
[10:57:22] oliver__: i havent messed around with rails 4 yet
[10:57:39] DaniG2k: its like attr_accessible or something....but better
[10:57:45] DaniG2k: it whitelists the params that can be mass assigned
[10:58:17] DaniG2k: let me see if it works
[11:00:05] DaniG2k: right there are two params
[11:00:16] DaniG2k: I wonder if I need to pass both or just destroy
[11:01:07] oliver__: probably both
[11:01:22] jammanbo: my bet is id is allowed by default
[11:01:33] learner_: give me an idea on how to give reply to comments both reply and comments are belongs to same model
[11:04:24] oliver__: Do a migration to add comment_id:integer on comments
[11:04:42] oliver__: And then has_many :replies, class_name: "Comments", foreign_key: "comment_id"
[11:04:59] oliver__: and belongs_to :comment, class_name: "Comment", foreign_key: "comment_id"
[11:05:06] oliver__: might be some typos there
[11:05:17] DaniG2k: jammanbo oliver__: thanks for the help :) it was storng params that was messing me up
[11:05:30] oliver__: DaniG2k: cool cool :) good luck
[11:06:43] jammanbo: Is a reply really a different thing to a comment?
[11:16:47] jammanbo: I need a weekend project … can't find anything that interests me :/ Long shot but does anyone have a killer idea they want to give away for nuthin?
[11:18:21] oliver__: inline translation editing by injecting ajax forms into the t() method when in some kind of administrator mode
[11:18:42] oliver__: maybe already exists
[11:19:00] jammanbo: interesting
[11:19:06] oliver__: maybe i already have it in a tangled up form and i wish there was a nice gem for it
[11:32:23] Senjai: jammanbo: Spree needs a good deal of help. www.github.com/spree/spree
[11:37:34] jammanbo: dont we all
[11:42:14] ZirconCode: Spree looks amazing
[11:53:04] platzhirsch: What route would I use to display a nested form for magazines { ads } ? just /magazines/new?
[11:55:01] jammanbo: a form to create ads for a given magazine?
[11:55:48] platzhirsch: jammanbo: no, a form that let's you create both
[11:56:04] platzhirsch: add magazines and ads at the same time
[11:56:29] jammanbo: If you are creating the magazine, then yes, magazines/new which accepts_nested_attributes_for ads.
[11:56:58] jammanbo: But would ads not be created after the fact [too?] and then associated with an existing magazine?
[11:57:34] jammanbo: By too, I mean primarily … first the mag is created, and then people decide they want to advertise on it.
[11:59:17] platzhirsch: jammanbo: do you mean, association vs. composition?
[11:59:29] platzhirsch: this was just an example, I wanted to avoid using foo and bar
[12:00:06] platzhirsch: Actually I have repositories and metadata. Both are not backed by ActiveRecord, but I import these through files that get parsed. Metadata belongs to repository and I wanted to put both on the same HTML GET create page
[12:00:17] IlyaLevin: Guys, I have a bit of a problem with the javascript part of the asset pipeline.
[12:00:43] jammanbo: no. nothing technical, just in reality. It seems like youd be more likely to create a magazine (without any ads) and have it exists for a while, before you would want to start associating ads with it. I.e. it seems odd that you'd want to create ads at the same time as a magazine.
[12:01:08] jammanbo: but that's specific to the nouns you happened to choose, so by all means ignore me.
[12:01:14] IlyaLevin: I have a base.js.coffee containing some functions that I want to use further in the app: https://gist.github.com/Almaron/6560919 but when I try to use them, Javascript throws an error saying function not defined.
[12:01:31] IlyaLevin: What am I doing wrong?
[12:01:36] _aeris_: hello everybody
[12:01:58] _aeris_: how i can access route helper from coffeescript asset ?
[12:02:06] _aeris_: for example for ajax request ?
[12:03:51] jammanbo: IlyaLevin: coffeescript is a bit of a dick. If you put that into trycoffeescript, you will see that it is wrapped in a closure and as such not accessible outside of said closure. If you want global functions you must be explicit about assigning them to a global [window] object.
[12:04:21] platzhirsch: jammanbo: yeah, but that's a good comment anyway ;)
[12:04:39] jammanbo: A common solution is to define a global app object in your application.js and then add your global methods to it.
[12:05:35] IlyaLevin: jammanbo so how do I change it? I can convert base.js.coffee to pure js, but is there any other way around?
[12:06:50] jammanbo: window.text_resize = …, window.OverShow = …, etc. Think you can use @ rather than window to be more idiomatic. By the way, sort out your function names! Be consistent. JS is by convention camelcase, starting with a lowercase letter,
[12:07:32] jammanbo: needle, haystack … :)
[12:08:27] jammanbo: of course its recreating the functionality of array.indexOf(thing) ...
[12:09:35] jammanbo: You can also assign defaults in coffeescript params I think … OverShow = (type = 'content', big = 0) -> … or something
[12:11:42] IlyaLevin: jammanbo thanks alot for the tips
[12:14:30] IlyaLevin: I'll go try them on right now
[12:15:36] workmad3: jammanbo: there is one nice thing though... that closure gets the global object as 'self'
[12:15:38] DaniG2k: jammanbo: remember that jquery i was asking quesitons about before? for the add/remove field
[12:16:00] workmad3: jammanbo: so if you want to expose something, you just go '@foo = "global, exposed stuff" '
[12:16:25] jammanbo: workmad3: Had such an inkling that @ was window.
[12:16:43] workmad3: jammanbo: @ is just 'this'
[12:17:18] jammanbo: I mean outside any function in a cs file @ is window
[12:17:28] workmad3: pretty much
[12:18:24] workmad3: jammanbo: btw, that feature of coffeescript is actually really useful
[12:18:33] jammanbo: I am so bored I'm inclined to take up smoking again … I have worked so many weekends I don't know what to do with them anymore ...
[12:18:59] workmad3: jammanbo: it maintains more consistent behaviour between separate files in dev and all your files in a single large file in production
[12:19:00] jammanbo: workmad3: Oh it is of course, but I maintain a general hostility to coffeescript.
[12:19:12] jammanbo: and I shall take it to my grave
[12:19:26] workmad3: jammanbo: so I'd be doing it manually if I was writing JS itself rather than CS ;)
[12:20:51] jammanbo: I forget the exact example I found, but there is some seriously messed up semantics in coffeescript. Like using a variable set to a number rather than the number directly can change a statement from a result to incomputable.
[12:21:23] jammanbo: And the maintainers acknowledge but defend it.
[12:22:16] jammanbo: admittedly it is a lovely syntax, a few obscure problems aside
[12:22:51] creature: I am... ambivalent towards Coffeescript.
[12:23:04] jammanbo: pick a side man … war is coming
[12:23:15] jammanbo: you'll be first again the wall otherwise
[12:23:15] creature: It has taught me a *lot* about the internal finnicky bits of JavaScript.
[12:23:29] DaniG2k: talking about coffeescript
[12:23:30] creature: Which is probably not what you want in a simplifying language...
[12:23:43] DaniG2k: can someone help me make this code so that there are at least 1, at most 5 fields plz
[12:23:48] DaniG2k: https://gist.github.com/DaniG2k/6561578
[12:24:17] DaniG2k: i guess its just a simple if else conditional with a size function stuck in there somewhere but
[12:24:25] DaniG2k: I cant seem to figure out where it should be :\
[12:24:40] jammanbo: wrap it in something like unless $(@).siblings('fieldset').length > x
[12:24:51] jammanbo: returning false otherwise
[12:25:09] DaniG2k: jammanbo: whats that @?
[12:25:34] jammanbo: only chumps write "this" these days … God OO
[12:25:44] jammanbo: (whats the rolling eyes emoticon?)
[12:27:02] jammanbo: Make sure you validate in rails for that restriction of course?
[12:27:18] DaniG2k: right need to figure that bit out as well
[12:27:19] creature: jammanbo: Maybe i!i!
[12:27:30] creature: (Rolling Is)
[12:28:23] DaniG2k: jammanbo: by rolli it up you mean stick taht inside of $(document).on 'click'
[12:28:26] DaniG2k: or outside of that
[12:28:33] jammanbo: no, that's octopus ...
[12:30:16] jammanbo: DaniG2k: this maybe? http://pastie.org/8325255
[12:30:34] jammanbo: maybe add some logic to show/hide the link too?
[12:38:06] antoine: how can I install gems locally to rails vendor directory instead of installing them to gems global directory ?
[12:38:42] jammanbo: use a gemset
[12:39:00] antoine: really sorry, i'm new, can you describe more ?
[12:39:25] jammanbo: are you using rbenv or rvm maybe?
[12:39:28] DaniG2k: jammanbo: I put that both in the add and remove (length > 1 and length <= 5)
[12:39:58] DaniG2k: jammanbo: odd thing is, when it reaches 5 and I click the add field link (I need to remove it in the rails view but I was just testing) it actually goes back to just 1 fieldset
[12:40:23] DaniG2k: jammanbo: its like they all disappear
[12:40:51] jammanbo: DaniG2k: the link to remove wont be there unless there is > 1 … i.e.the code you added to remove is unnecessary
[12:41:59] jammanbo: that sounds odd … any chance you've messed up the indentation?
[12:42:00] DaniG2k: jammanbo: no im talking about adding. if i add a 6th field, it just goes back to 1 for some reason
[12:42:26] DaniG2k: jammanbo: https://gist.github.com/DaniG2k/6561578
[12:42:53] DaniG2k: oh does the prevent default need to be unindented?
[12:43:33] DaniG2k: jammanbo: ok that was it
[12:43:39] DaniG2k: works like a charm :D :D thanks
[12:45:21] Kaylors: msg nickserv REGISTER
[12:46:28] Kaylors: Wanna make an entire table row into a link. How do I do it?
[12:46:43] Kaylors: Tried putting the whole row between anchor tags, but no dice....
[12:47:05] DaniG2k: Kaylors: http://stackoverflow.com/questions/1460958/html-table-row-like-a-link
[12:48:05] Kaylors: That sets individual cells as links...
[12:48:11] Kaylors: I want the whole row to act as a link...
[12:48:55] antoine: jammanbo, sorry, i'm using rvm , but I don't think it matters, at the end both are under rails ?
[12:49:18] DaniG2k: Kaylors: http://jsfiddle.net/userdude/V9kj5/1/
[12:54:30] DaniG2k: jammanbo: for counting the number of fields that are displayed, shoudl i put that logic in the view? like set a counter variable and increment it on the view? or is it better to do in a helper?
[13:02:49] jammanbo: antoine: Yes, but if you are using RVM (or rbenv) you have the option of creating gemsets, which isolate sets of gems, meaning you can have whatever version you like installed for you Rails app, without effecting the version installed (if any is) globally. http://rvm.io/gemsets/basics You can create a file in your Rails app which will ensure that any terminal you open up in that directory uses the desired gemset. It's called .rvm-gemset I think ...
[13:03:18] jammanbo: But whatever you do, dont vendor gems … that's so 2007.
[13:12:13] linusoleander: I*ve a problem with after_commit not being called, but after_commit is.
[13:12:14] linusoleander: Is that normal?
[13:12:56] platzhirsch: There are no brakes on the Rails train, chooo ~ chooo
[13:16:20] t27duck: I have reached an architectural impasse and would like advice. I have three objects A, B, and C. They all have near identical attributes. Each one of them can have many D's (which is currently polymorphic). I was thinking about restructuring this so that A, B, and C are STI with D being just a normal belongs_to relation.
[13:21:41] greengriminal: Pretty straightforward but basically I am running karma e2e using grunt and I have I am using Karma coverage. For some reason I seem to be getting the html file but no report of files
[13:32:08] jammanbo: t27duck: Personally I find polymorphic relations the bane of my life in any complex data model, so if they can be avoided I think it is good to, even if the result feels less elegant than it might otherwise.
[13:32:43] jammanbo: People rag on STI … I've never really encountered any problem with it.
[13:32:55] t27duck: was thinking similar. the trade off with this setup is I'd have one very large table containing A, B, and C instead of 3 separate medium-sized tables
[13:33:14] jammanbo: Large as in rows rather than columns though?
[13:33:41] t27duck: yes, i'd say more on the rows
[13:33:47] t27duck: then again postgres can handle it
[13:33:58] jammanbo: well thats what dbs are designed for.
[13:35:17] jammanbo: I think refactoring the commonality into a concern and using polymorphism would be much prettier, but if you're the practical sort I'd seriously consider the STI.
[13:37:35] Mattx: where should I add a "_id" suffix in an index and where it's not necessary?
[13:37:56] Mattx: I was reading activerecord's guide in railstutorials, and it doesn't say anything about that, I think
[13:38:00] creature: How large is large?
[13:38:05] Mattx: http://guides.rubyonrails.org/association_basics.html
[13:38:40] Mattx: I think in some cases you should do something like: add_index :foo, :part_id, unique: true
[13:38:44] Mattx: instead of ":part"
[13:39:04] t27duck: Mattx: add the index if you know you're going to be filtering results on it or you're going to use it to join two models
[13:39:54] Mattx: t27duck, I know I need the index. the question is why I need to add "_id" after the name of the model
[13:40:10] Mattx: if you take the example in the guide I mentioned, it says:
[13:40:12] Mattx: add_index :person_posts, :post, :unique => true
[13:40:20] Mattx: :post, not :post_id
[13:40:27] jammanbo: add indexes to the column names. If the column is post_id, index post_id, if it is post, index post.
[13:40:32] t27duck: because post_id is the name of the column in the table
[13:40:33] Mattx: but in my case it seems it needs post_id, it's crashing..
[13:41:03] Mattx: it's always post_id the name of the column
[13:41:20] Mattx: (where the relation is has_many :posts)
[13:41:44] Mattx: but my point is that in some cases :post (instead of :post_id) works
[13:41:48] Mattx: and in some other cases it doesn't
[13:41:51] Mattx: or so it seems
[13:42:08] t27duck: i would always use the name of the column regardless
[13:42:12] sevenseacat: got an example?
[13:42:15] Mattx: check the guide, it uses :post, not :post_id
[13:42:22] Mattx: http://guides.rubyonrails.org/association_basics.html#bi-directional-associations
[13:42:39] Mattx: wait, not that section
[13:42:47] Mattx: search for this text: add_index :person_posts, :post, :unique => true
[13:43:13] Mattx: you see? has_many :post, add_index :post
[13:43:19] jammanbo: answer is to look at the index in your db and see what it says
[13:43:28] sevenseacat: has_many :post is incorrect also
[13:43:46] Mattx: I meant posts*
[13:43:51] sevenseacat: of course you did.
[13:44:01] Mattx: alright, you got what I mean
[13:44:27] Mattx: I'm going to check the DB but I don't have any example at hand. let me see..
[13:45:30] Mattx: alright, have a look at this:
[13:45:33] Mattx: PG::Error: ERROR: column "user" does not exist
[13:45:37] Mattx: it was trying to add this index:
[13:45:48] Kaylors: I have an url something.com...I want to use it as it is in a link. Can't seem to do it.
[13:45:51] Mattx: add_index :foo, [:user, :article], unique: true
[13:46:02] Kaylors: Even the url_for methods seems to require http://
[13:46:16] Mattx: in :foo I have t.belongs_to :user \n t.belongs_to :article
[13:46:26] Mattx: pretty much the same example
[13:46:27] sevenseacat: Mattx: you dont have a user column on your foo table.
[13:46:36] sevenseacat: Mattx: your model has nothing to do with your migration.
[13:47:05] Mattx: I do know, you see why I found the example in rubyonrails weird?
[13:47:14] sevenseacat: yes, we already said it was a typo.
[13:47:39] Mattx: alright, good :)
[14:19:51] Mattx: is there a way to have two associations to a single model using a condition?
[14:20:11] Mattx: how is that called so I can look for an example?
[14:20:26] sevenseacat: its called 'defining associations'
[14:20:43] sevenseacat: it doesnt have a fancy name because there isnt anything special about it
[14:20:50] sevenseacat: give the association a name and add a condition.
[14:20:58] Mattx: hmn, let's see
[14:21:43] Mattx: like in: has_one :account, -> { where active: true }
[14:21:59] Mattx: weird syntax. what is this "->" ?
[14:22:02] sevenseacat: have you tried it?
[14:22:07] sevenseacat: stabby lambda syntax
[14:22:23] Mattx: no, I'm going to try it now, I copy&pasted it
[14:24:41] oconn: would someone help clarify some questions I have on routes for nested resources? Heres what i'm working on: https://gist.github.com/oconn/341a4e2bf5ae762e0349 Im trying to render the post_image page.
[14:26:09] tbuehlmann: oconn, what's the problem/error?
[14:26:10] oconn: correction edit_post_image
[14:26:49] oconn: tbuehlmann, im not sure what i have to use in the view to render the edit_post_image
[14:27:45] oconn: tbuehlmann, line 25
[14:27:50] tbuehlmann: you might want edit_post_image_path(@post, post_image)
[14:28:24] tbuehlmann: but I'm just guessing since you didn't provide the exact error
[14:28:44] sevenseacat: did you check at what `rake routes` tells you the route is?
[14:30:12] oconn: ok so rake says ' edit_post_post_image GET /posts/:post_id/post_images/:id/edit(.:format) post_images#edit '
[14:30:25] sevenseacat: so thats what the route is
[14:33:18] oconn: now i get a undefined local variable or method `edit_post_post_image'
[14:33:30] t27duck: you have to add _path to the end of it
[14:33:41] t27duck: rake routes doesn't list _path because you can also use _url as well
[14:34:20] helpa: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[14:34:20] oconn: ok thanks guys I think that worked, im new if you cant tell
[14:34:32] oconn: yeah I read through that
[14:36:23] oconn: Just having a little trouble with routes and instance variables
[14:37:30] t27duck: routes are hard for everyone at first
[14:41:02] Mattx: alright, a condition is not exactly what I need. this is an example: a user has many posts, and I want to specify the association <unread>, which is "all posts that are not in the association <read>"
[14:41:16] oconn: sorry one more question on the routes instance variables, is there a way to specify the :id of the post_image in the link_to
[14:41:36] Mattx: I can write a query but I suppose there's something built in to do that
[14:41:59] sevenseacat: oconn: thats why you pass post_image into the route
[14:42:20] sevenseacat: Mattx: what defines the association 'read'?
[14:42:31] t27duck: oconn: you should be able to pass in the post_image object and it'll reference its id. But if you must... edit_post_post_image_path(@post, :id => whatever)
[14:42:39] t27duck: I think that'll do it for you
[14:43:13] Mattx: sevenseacat, I defined it, it's a n-to-n association between users and posts
[14:43:14] oconn: this is the error No route matches {:action=>"edit", :controller=>"post_images", :id=>"13"} missing required keys: [:post_id]
[14:43:32] sevenseacat: oconn: you need to provide both the post and the post_image.
[14:43:42] sevenseacat: Mattx: i was asking for the code.
[14:43:44] oconn: i tried edit_post_post_image_path(@post)
[14:43:59] t27duck: oconn: do you have a post_image variable?
[14:44:03] t27duck: if so, make that the second argument
[14:44:53] oconn: that did it
[14:45:39] Mattx: in User, has_many :read, through: :read_posts, class_name: 'Post'
[14:50:06] krz: anyone tried fluentd before? what kind of stuff are you logging/tracking?
[14:57:26] Mattx: sevenseacat, here is the code: http://apaste.info/oJuR
[15:00:44] pishposh: Hi, I'm trying to run a test with erg-generated fixtures but after rake db:test:load my database appears to be empty. when i go into the rails console in the test environment there's nothing there. any ideas?
[15:02:13] pishposh: *erb-generated
[15:03:09] pishposh: also, when I remove the erb it doesn't fix the problem so I must be missing some configuration options
[15:05:08] Mattx: so any idea? can I define an association <unread> as "all elements that are not in the association <read>"?
[15:05:25] Hates__: pishposh: I'd dump fixtures and use factory_girl instead
[15:05:57] pishposh: Hates_: alright might as well
[15:06:13] Hates__: Mattx: yes you can put conditions on your association
[15:06:38] Hates__: Mattx: but it's easier to just to have a scope on posts for unread and read them in with user.posts.unread
[15:07:56] scyllinice: I don't use db:test:load directly, but I don't think it does anything with loading fixtures
[15:09:13] Mattx: Hates_, what would be the condition for "all X not in <read>"?
[15:10:08] Hates_: Mattx: ahh you have a separate association for read/unread posts?
[15:10:22] Mattx: I don't have a unread association at all
[15:10:26] Mattx: all I have is read
[15:10:57] Hates_: Mattx: Then you fetch the IDs for read posts and do an NOT IN (?), read_post_ids
[15:10:59] Mattx: and I want to define unread as Posts - {x / x not in <read>}
[15:11:03] pishposh: scyllinice: how do you load your fixtures?
[15:11:18] Mattx: well, yeah, I can do a query but I thought there was a way using conditons or something else
[15:11:18] Hates_: Mattx: or you can do it more fancy in a single query
[15:11:49] Mattx: Hates_, what would this single query look like?
[15:12:22] apeiros: Mattx: count with a group by on read status?
[15:13:02] scyllinice: pishposh: Testing guide states: "Rails by default automatically loads all fixtures from the test/fixtures folder for your unit and functional test."
[15:13:10] apeiros: sql has a count aggregation function
[15:13:14] Mattx: how is count related? :P
[15:13:31] apeiros: I understood `{x / x not in <read>}` you want to display how many are read/not read?
[15:13:31] Mattx: I know but I don't want a number, I need all the unread posts
[15:13:57] Mattx: no no, I meant in fact "All posts" - "read posts"
[15:14:25] Mattx: so for example I can iterate over the set of unread posts
[15:14:32] Mattx: user.unread.each do ...
[15:14:47] workmad3: Mattx: how are you tracking whether a user has read an article or not?
[15:15:09] apeiros: Mattx: `join` or `where not exists`-subquery
[15:15:34] workmad3: Mattx: is it time-based? or are you adding a 'read' entry to a db table when a user opens an article?
[15:15:56] Mattx: I'm adding a read entry
[15:15:59] apeiros: for unread, you'd need an outer join and a where checking for NULLs on the joined table
[15:16:07] apeiros: (with the join solution, that is)
[15:16:39] Mattx: ok, so I have to write the query... I know how to do that but I was looking for a condition or something just in case
[15:16:40] scyllinice: The app I work on at my job goes the "NOT IN" route
[15:17:24] workmad3: apeiros: or you do something like 'user.posts.where("posts.id NOT IN (?)", user.posts.read.to_sql)'
[15:17:34] apeiros: workmad3: yeah
[15:17:42] apeiros: I think in rails4 you don't even need to_sql
[15:17:44] Hates_: workmad3: omg
[15:17:50] workmad3: Hates_: yeah, it's ugly :P
[15:18:01] Hates_: workmad3: no, I never knew you could do the to_sql in there
[15:18:06] workmad3: Hates_: hehe :)
[15:18:08] Hates_: workmad3: mind-blown
[15:18:21] Mattx: maybe it's a better idea if I do it time-based
[15:18:26] workmad3: Hates_: oh, I should have done a 'posts.select("id").read.to_sql'
[15:18:46] workmad3: Hates_: sub-select ftw? ;)
[15:18:54] Mattx: the behavior is not going to be the same but it'll be cheaper
[15:19:11] workmad3: Mattx: yeah, it'll be 'new since last visit'
[15:19:17] scyllinice: Worry about it when it becomes a problem
[15:19:19] scyllinice: That's what I say
[15:19:33] workmad3: Mattx: and you can get reasonable behaviour on top of that if you also track the posts visited within a session
[15:19:55] workmad3: Mattx: so you can also show things they've just read as read, along with things that were there in the previous vist
[15:20:01] workmad3: Mattx: afaik, that's what most forums do
[15:20:04] Mattx: you can do both thing if you track the last post you visited
[15:20:45] workmad3: Mattx: dunno if you're doing a forum or an rss reader... but either way :)
[15:21:03] Mattx: yeah, you convinced me :P
[15:24:09] Mattx: ok so in this case I suppose you define a method in User which executes a query
[15:24:46] Mattx: or maybe has_many :articles, -> {something here...}
[15:30:30] Mattx: hmn, I don't think you can define a condition for that
[15:31:28] krz: mongodb: if user references many dates. and dates has embedded documents each with different count fields. can i use the aggregation framework with one or more date referenced documents?
[15:31:44] krz: or is the aggregation framework only meant to work on a single doc?
[15:32:12] workmad3: Mattx: I'd probably do a scope on the articles
[15:33:37] workmad3: Mattx: something like 'scope :unread_since, ->(date, read_ids){where("date >= ?").where.not(:id => read_ids) } ' (assuming rails 4 there)
[15:34:12] Mattx: hmn, rails 3 here
[15:34:13] LeafMan: how do I update my Django routes to custom ones?
[15:34:38] workmad3: Mattx: .where("id NOT IN (?)", read_ids) instead then
[15:34:57] workmad3: LeafMan: err, wrong channel I'm afraid
[15:35:05] LeafMan: workmad3: ,,|,,
[15:35:23] workmad3: how pleasant
[15:37:08] scyllinice: workmad3: You made him ask that in the wrong channel, you bastard!
[15:38:37] LeafMan: workmad3: don't treat me like I am a freak ⨀_Ꙩ
[15:39:38] LeafMan: wagha wagha ¯\(ºдಠ)/¯
[15:41:37] workmad3: LeafMan: it's ok, I won't
[15:41:41] workmad3: LeafMan: I'll just ignore you instead
[15:41:56] LeafMan: ACTION poops into workmad3's mouth
[15:56:31] byprdct: Can anyone point me to a tutorial on taking ruby code and initiating that code based on users privileges .e.g member type or by users selection within the app? I know this are basic principles of programming but I've failed to understand how I link these essential parts to make my code interactive
[15:58:36] digitalcake: Good morning everyone. :)
[15:59:41] digitalcake: I'm trying to learn how to get postgresql's hstore to work with simple_form where simple form is making two fields one for the key and then the value. any ideas about how to get this to work.
[16:00:36] digitalcake: I was thinking about cocoon for making the key/value fields.
[16:49:49] Syrit: Guys, i am rendering a Bootstrap modal, with the JS response , it works, but i am getting an error in the browser console "Uncaught Error: Syntax error, unrecognized expression: /sales_reps/new " , any ideas why is that ? here is a gist of my code : https://gist.github.com/anonymous/0b93b3f3eb0b6f1ee8f0
[16:51:38] Trudko: Guys i have problem running migration where i add two columns and delete one: http://pastie.org/8325752
[17:02:53] willbradley: i've got an interesting question: if i have two models, weight and body_fat, and they're ordered by date but the dates don't usually match each other, how to generate a graph based on weight*body_fat for each time period?
[17:03:47] willbradley: body_fat.last doesn't work as a technique anymore, grouping by time period doesn't always work either if there aren't both models per period
[17:05:54] willbradley: body_fat.most_recent_before(date)?
[17:06:30] willbradley: i feel like this is what i missed in calculus
[17:09:59] dasibre: can anyone assist with an issue i'm having. I have three different objects....User, Player, Board...a user can pin a player to a board...I'm trying to set the pinning action from the players index page, When a user clicks a Pin player button, it should user should get a form to select which board to pin the player
[17:13:03] quazimodo: is there a nicer way to do this
[17:13:05] quazimodo: https://gist.github.com/anonymous/832ffd1ed6d736c0022e
[17:13:08] quazimodo: it looks uggers to me
[17:15:02] digitalcake: in active record how can I valid that a field is blank?
[17:15:32] digitalcake: I have a hidden field in a contact form that if filled I want it to fail. It acts as a nice robot catcher.
[17:15:45] quazimodo: digitalcake: make a method and put it as a validator :)
[17:16:00] quazimodo: validates :your_method
[17:16:22] quazimodo: def your_method; the_field == nil; end
[17:16:33] quazimodo: and stick it in the private area
[17:17:11] willbradley: dasibre: can you elaborate or share your code?
[17:18:16] Giddeon: Question: I'm trying to find a record through an objects association. For example, I have @student.enrollments.where... This is returning nil for a query, because the enrollments list has already been loaded and a new record I'm trying to find was never added to the list. Is there a way to get rails to refresh the enrollments list when the query fails?
[17:18:23] willbradley: quazimodo: i'm not sure what you're trying to do but if it works like you want it to then i'll bet that's the best way to do it
[17:22:42] Giddeon: just found a partial answer to my question, going @student.enrollments(true).where.... will invalidate the cache
[17:24:11] willbradley: Giddeon: can you do enrollments.reload?
[17:25:10] Wixy: I've a model called Person and they're associated to other persons through the relation friend, is there a way to do something like my_person.friends.likes.each {...} ?
[17:25:40] Wixy: the problem I have is that .friends is an array, so I should do something like this instead: my_person.friends.each do |f| f.likes.each do |l| ...
[17:25:55] Wixy: which requires more queries
[17:27:32] willbradley: Wixy: i'm sure there's a "right way" but I tend to make a method in Person called friends_like and construct a single query to get everything at once
[17:28:20] Trudko_: Guys i have problem running migration where i add two columns and delete one: http://pastie.org/8325752
[17:28:26] Giddeon: willbradley: not sure. I don't see any docs on that
[17:28:28] Wixy: I doubt it's the best approach too
[17:28:42] Wixy: any other idea?
[17:29:05] willbradley: Wixy: good news is SQL is meant for those crazy joins, it can knock it out quite rapidly
[17:30:05] Wixy: yeah, but onen of the point of using an ORM is to not write SQL yourself so your database can be anything
[17:30:20] bastilian: Trudko_: what kind of problem?
[17:30:22] Wixy: unless you write the query using activerecords' methods like .where, etc
[17:30:37] Trudko_: bastilian: check pastie, there is log
[17:30:40] willbradley: hmm, not at the moment. i know twitter scaled by preloading tweets into followers' timelines; your timeline is an object built from others' streams, it's faster than querying every stream when reading
[17:31:11] willbradley: Wixy: i mean if there's some crazy .join methods then yay, but it's not unthinkable to write some SQL in Rails
[17:31:14] jammanbo: Trudko_: hy any chance are the statut and contact columns not in the db at that point?
[17:31:28] jammanbo: Is it a typo? status?
[17:31:33] Wixy: I think there's a .join method indeed
[17:31:38] AntelopeSalad: does anyone know how i can use assert_select to make sure a certain meta tag's name's content is not empty? i'm not sure how to combine attributes like that
[17:32:20] willbradley: AntelopeSalad: example? what do you have so far
[17:32:30] bastilian: Trudko_: you also have a typo in the class name, but this can't be the problem....
[17:32:49] AntelopeSalad: willbradley: i'm trying to make sure that a meta tag's name: "title" always has a content value (ie. not empty)
[17:33:13] AntelopeSalad: willbradley: something like assert_not_empty assert_select "meta", { :name => "title" }
[17:33:17] jammanbo: Wixy: Yeah, for that you have to do custom queries. Best to create a scope like willbradley suggests. Consiser using Arel if you want something more programmatic than SQL strings.
[17:33:19] AntelopeSalad: but i don't know how to tie in the content attribute
[17:33:20] Trudko_: jammanbo: bastilian yeah i actually have missing columns in db
[17:33:27] Trudko_: what should I do to fix it?
[17:34:11] bastilian: Trudko_: ahm... how did you loose them? ... simply add them...
[17:34:35] jammanbo: Trudko_: If this hasnt been committed yet, comment out the problematic remove_columns, rollback ,fix the migration, and migrate, then uncomment and rollback again to verify it works.
[17:34:47] Trudko_: bastilian: not sure i was messing a bit with migration.
[17:35:04] Wixy: hmn, ok. I never created a scope, I'm trying to figure out how to write it in this case
[17:35:56] jammanbo: scope ->(user) { Like.where(user: user.friends) }
[17:36:28] jammanbo: scope :likes_of_users_friends, ->(user) { Like.where(user: user.friends) }
[17:37:56] willbradley: AntelopeSalad: I tend to write css selectors. jquery example: $("meta[name=author]").attr("content")
[17:38:17] Wixy: wait, no.. it shouldn't receive a param
[17:38:29] jammanbo: yes it should
[17:38:43] Wixy: you want to call it like this: jonh.likes_of_friends
[17:38:45] AntelopeSalad: willbradley: but i can't do this with testunit right?
[17:38:47] Wixy: .each etc
[17:38:47] Trudko_: Guys and one other questions i have filter with two fields date_from and date_to which i want to use to filter items. both of them are optional . what is best way how to write it/
[17:39:16] AntelopeSalad: willbradley: this is also a half way implementation assert_not_empty assert_select "meta[name=title]" -- i don't know how to tie in the content attribute tho
[17:39:30] willbradley: AntelopeSalad: I don't know, I don't use test-unit
[17:40:01] AntelopeSalad: i'm surprised this isn't documented anywhere, i've been googling for like an hour
[17:40:34] jammanbo: Wixy: You have two places you can put it. In Like class, in which case it needs a param (and you can omit the Like in the query) or in the User class. Because it returns a scope of Likes I argue it should be in the Like class. You can then add an instance method to your user class: def friend_likes; Like.likes_of_users_friends(self); end
[17:41:41] Wixy: ok, that makes sense. I'm going to try that in the original problem
[17:42:04] AntelopeSalad: guess i'll try SO
[17:42:51] willbradley: AntelopeSalad: look here http://api.rubyonrails.org/classes/ActionDispatch/Assertions.html
[17:43:04] willbradley: maybe tag_assertions and attributes is more what you need
[17:43:28] willbradley: since nothing in SelectorAssertions seems right
[17:43:54] willbradley: once you get the element you just need to test the "content" attribute
[17:43:56] AntelopeSalad: thanks, that looks promising
[17:45:32] Trudko_: jammanbo: can i just connect to db and add columns manualy?
[17:47:23] jammanbo: Trudko_: I guess so … Remember to rake db:schema:dump if you do that.
[17:49:20] AntelopeSalad: willbradley: still getting hung up -- thoughts on this? assert_tag :meta, :attributes => {:name => "title" }, :content => assert_not_empty
[17:50:36] willbradley: :tag => "meta"
[17:50:41] willbradley: http://apidock.com/rails/ActionDispatch/Assertions/TagAssertions/assert_tag
[17:51:10] AntelopeSalad: that's what i've been looking at
[17:51:32] AntelopeSalad: the examples only show how to pickout 1 attribute assuming you know the name
[17:53:39] Wixy: hum, it was easy in your example, jammanbo, because you made Likes a 1-to-1 relation with users, which is not true (it's n-to-n so there's no "user" in Like) :P
[17:54:12] Wixy: I meant 1-n, not 1-1
[17:56:11] willbradley: AntelopeSalad: ah. maybe regex. check http://api.rubyonrails.org/classes/ActionDispatch/Assertions/SelectorAssertions.html
[17:56:23] willbradley: search for All input fields in the form have a name
[17:56:40] willbradley: i got to that page via http://guides.rubyonrails.org/testing.html#integration-testing-examples
[17:56:45] willbradley: good guide btw
[17:59:11] AntelopeSalad: willbradley: that's half the solution tho
[17:59:49] jammanbo: Wixy: What? A like is owned by more than one user?
[18:00:32] Wixy: welllll, now I think the example I choose to abstract the real one was silly hehe
[18:01:02] Wixy: s/choose/chose/
[18:02:20] AntelopeSalad: willbradley: seems like it wasn't too bad to get it to work using that example though - thanks, it's all fine now
[18:03:05] AntelopeSalad: willbradley: this ended up working, http://pastie.org/8325898
[18:05:36] Trudko: Guys i have filter with two fields date_from and date_to which i want to use to filter items. both of them are optional . what is best way how to write it?
[18:05:38] Wixy: it is like this: there are users and there are reviews about things. these reviews have categories like movie, music, etc (n-to-n).. so, the users are <interested> in some reviews (n-to-n), and I want to iterate over the list of categories of the reviews a user is interested in: users.reviews.categories.each do ... end <-- something like this
[18:06:17] Wixy: jammanbo: I thought the user,friend,like example was close to that and easier to explain but I was wrong, the relationships are different
[18:10:34] Trudko: jammanbo: bastilian ok I checked the db and statut and contact columns are there.
[18:25:29] jammanbo: Wixy: this work? http://pastie.org/8325944
[18:26:40] jammanbo: dunno if it does … genuine question
[18:45:14] Wixy: jammanbo: yeah, it works as I expected. thank you!
[18:45:49] jammanbo: aren't I great?
[18:48:36] BrianJ: Been working with this for a while, but not having much luck. I have a Dog model and a has many association with my asset model which uses paperclip for uploading images to AWS s3. My user has several images attached to it. I want my user to be able to choose the an image as the profile picture.
[18:49:02] BrianJ: I added an attribute to my dog model called profile_pic
[18:49:56] pontiki: your users are dogs? thus fulfilling the old meme "on the 'net, no one knows you're a dog" ?
[18:50:49] BrianJ: lol -.- i meant my dog has several images attached to it
[18:51:18] BrianJ: just replace dog with user in my description
[18:51:28] pontiki: no worries, it just struck me as funny
[18:51:49] pontiki: can't you just have a field on the Dog model for profile_pic_id?
[18:51:57] pontiki: that links into the asset table?
[18:52:26] pontiki: or maybe i should ask, what's the issue?
[18:53:51] BrianJ: ya i guess i was vague now that i think about it. The problem is that I can have a collection (drop down) of my assets that are connected to my dog, but i want to be able to show the image and the user to choose that
[18:54:01] BrianJ: or more so… maybe they just select a check box
[18:54:10] livelaughlearn: does params[:q] mean all attributes that exists for the data table?
[18:54:11] BrianJ: next to an image thats already attached
[18:54:18] livelaughlearn: looking at a search helper
[18:54:24] pontiki: radio button would be more apropos for selecting only one
[18:57:24] awsmsce: anyone have a good suggestion for awesome auto docs on rails controllers?
[18:57:33] awsmsce: for an API ?
[18:58:59] BrianJ: hm. the only problem is im not sure how to tie that back. I show all of the images, but those are for an upload section.
[18:59:03] BrianJ: here's the code https://gist.github.com/BrianJakovich/b20c9e52d9e172acdac9
[18:59:15] jonathanwilliams: Hi there, anybody up for a newbie question regarding installation location for ruby/rails?
[19:00:55] jonathanwilliams: pontiki: I've installed ruby via Brew on Mac 10.8, and now looking to install rails. However, ruby installed to /usr/local/bin where rails installs via the system ruby to /usr/bin.
[19:01:19] jonathanwilliams: When running "gem install rails" I get a permission denied on the README.md
[19:01:31] pontiki: yeah, that's a problem
[19:01:48] pontiki: most people install ruby with rvm, which installs it locally
[19:02:07] jonathanwilliams: any reason I can't just uninstall and then install again with rvm?
[19:02:44] jonathanwilliams: k will try that, thanks
[19:18:27] jonathanwilliams: thanks for the help pontiki, that worked perfectly.
[19:20:38] awsmsce: any one have a recommendation for a documentation gem?
[19:28:57] jammanbo: thats what I was thinking
[19:29:16] pontiki: annotate is kinda nice
[19:29:27] pontiki: but what sort of thing are you thinking of?
[19:31:23] awsmsce: pontiki: sorry, were you asking me?
[19:31:38] awsmsce: pontiki: you've been helping a bunch of people
[19:31:49] awsmsce: pontiki: didn't want to assume
[19:35:06] awsmsce: pontiki: I was looking at Rdoc, yard, and a couple other documentation gems, but wondering if anyone else had a more… "attractive" suggestion. Something that was more visually friendly. That's all
[19:57:17] crunch-choco: guys, i'm beginning with rails, following agile web development with rails' book
[19:57:39] crunch-choco: but i have a problem with the "destroy" (using scaffold)
[19:58:06] crunch-choco: when i try to destroy an item, i'm redirected to the "show" page
[19:59:15] crunch-choco: good lord, it was because i blocked js =__=
[20:04:30] atal421: what do you guys use to deploy your rails app? (not to heroku)?
[20:04:50] willbradley: AntelopeSalad: nice
[20:05:43] creature: atal421: I'm deploying onto a shared hosting package with Capistrano.
[20:06:36] atal421: creature: nice. is there anything new? like, what's the new hotness?
[20:06:50] creature: Docker is probably the new hotness.
[20:07:53] atal421: googling :-)
[20:11:11] creature: docker.io, I think.
[20:11:18] creature: If it doesn't have a .io domain, it's probably not all that hot.
[20:14:02] atal421: ha, yup. it's cool. although recommends not being used in production… so… gonna wait a litle
[20:18:37] platzhirsch: What is a typical folder used in a Rails project to store data files?
[20:28:36] willbradley: platzhirsch: what kind of data files
[20:28:57] platzhirsch: willbradley: import files, that can be imported by the Rails app through the interface
[20:29:01] platzhirsch: for instance on an admin control panel
[20:30:07] willbradley: what kind of import file? the kind of file that you're going to commit to your codebase and rarely change, or the kind that gets uploaded temporarily and deleted, or the kind that gets uploaded and saved somewhere?
[20:30:36] platzhirsch: willbradley: the second
[20:30:54] platzhirsch: temporariliy add it for import reasons and then delete them somewhen, because there are for instance in the database
[20:32:08] drewwyatt: Does anyone have any tips on sending a JSON POST request from an external application? My app does not seem to be recognizing the JSON
[20:32:27] willbradley: drewwyatt: wireshark
[20:32:45] platzhirsch: willbradley: I would just have thought for /data ^^
[20:33:17] willbradley: platzhirsch: my rails project doesn't have a /data folder
[20:33:36] platzhirsch: willbradley: $ mkdir data
[20:33:47] drewwyatt: willbradley: Can you go into a little more detail? What exactly is WireShark?
[20:33:49] willbradley: you answered your own question :)
[20:34:11] willbradley: drewwyatt: wireshark / tcpdump lets you sniff the packets on the network to see what's really being sent/received
[20:35:01] willbradley: that's my tip :)
[20:36:03] drewwyatt: willbradley: ah - I'm downloading it now. My issue may be an obvious one though, so maybe you can tell me this. https://gist.github.com/anwyatt/d8bbdf6153c698e283ce - that is the JSON I am sending, but my app keeps giving me the error "param not found: player"
[20:36:26] willbradley: if that doesn't help / isn't possible, then writing debug lines into your app to see how the data is being interpreted
[20:36:42] willbradley: drewwyatt: gonna need to see more than that
[20:36:57] willbradley: like the code that tries to access player
[20:37:08] drewwyatt: willbradley: http://stackoverflow.com/questions/18690196/how-should-i-format-a-json-post-request-to-my-rails-app?noredirect=1#comment27535383_18690196
[20:37:19] drewwyatt: willbradley: Does that help?
[20:40:09] willbradley: drewwyatt: on the first line of player_params, write Rails.logger.info params.inspect
[20:40:34] willbradley: save/refresh and update your gist with the inspected params
[20:41:34] drewwyatt: willbradley: so, after refreshing - send the request again and then paste the logs into gist?
[20:43:16] willbradley: well just the relevant log line
[20:43:21] willbradley: want to see what params is
[20:45:07] drewwyatt: willbradley: Check the gist again
[20:45:41] zeromodulus: yay, I'm using the irssis.
[20:53:37] drewwyatt: willbradley: Do I maybe need to specify something in the headers?
[20:54:11] livelaughlearn: hey guys... = t('search_results_count', :count => @search_results_count) . . . what does t do?
[20:58:29] _aeris_: i have an Activity model with « belongs_to :agency, belongs_to :year »
[20:58:53] _aeris_: « Activity.find 1 » display « agency_id: 1, year_id: 1 »
[20:59:12] _aeris_: Activity.find(1).agency is good
[20:59:25] _aeris_: but Activity.find(1).year => uninitialized constant Activity::Year
[20:59:30] _aeris_: what's the problem ?
[21:00:22] foucist: _aeris_: well, agency model would have has_many :activities i assume, so does the year model have that too?
[21:00:50] _aeris_: foucist > yep
[21:01:26] _aeris_: it's working now ><
[21:01:59] _aeris_: IT is magic :D
[21:02:10] _aeris_: cosmic ray i guess…
[21:03:02] foucist: _aeris_: or perhaps you had to restart the console etc
[21:03:18] foucist: rails console doesn't track changes in model till you reload it
[21:03:33] _aeris_: yep, perhaps
[21:03:36] _aeris_: strange :)
[21:03:40] _aeris_: but working
[21:17:38] crunch-choco: when i fill a form generate with scaffold, where are the form's information stored?
[21:46:54] lessless: hey, folks, how to overcome Encoding::UndefinedConversionError:U+0422 from UTF-8 to US-ASCII error in my tests?
[21:47:14] lessless: ruby 2.0.0p0 and rails 4
[21:51:51] gestahlt: im a bit confused on helpers in engines
[21:52:05] gestahlt: i need a helper that is available accross my parent app
[21:52:43] gestahlt: Now im confused from reading. Do i always have to initialize helpers specifically in the parent app or can i tell the engine: "Here, provide all the helpers you got"?
[21:54:04] foucist: gestahlt: i imagine that what's in the engine is available in the parent app, but might involve namespace
[22:19:17] Senjai: Just hit the one week mark
[22:19:47] foucist: Senjai: for what?
[22:19:57] Senjai: foucist: One week without internet
[22:20:06] Senjai: I'm at my parents place because there is an internet outage in my area
[22:20:27] foucist: ah.. must be nice to break the ole addiction ;)
[22:21:04] workmad3: Senjai: sorry to hear about your recent relapse :()
[22:21:19] Senjai: Yeah, It's rough
[22:21:27] foucist: that's just withdrawal man!
[22:21:34] foucist: give it another couple weeks
[22:21:56] Senjai: Not gonna happen
[22:21:58] foucist: before you know it the air will be fresher, the grass will be greener, you'll be more muscular, sexier
[22:21:59] Senjai: Must, commit..
[22:22:16] workmad3: foucist: or he'll be twitching in a corner, spouting 'must tweet... soon' while drooling
[22:22:17] Senjai: Yeah, I find once you have a partner you care less and less about that lol
[22:22:54] Senjai: That makes things worse
[22:22:58] Senjai: They ask you to come home lol
[22:24:08] workmad3: Senjai: that's why having internet at home is good ;)
[22:25:40] Senjai: It's why I do
[22:25:54] Senjai: The price of having my man cave is the living room, bedroom, kitchen, and spare room
[22:26:04] Senjai: Like, I give up that much jurisdiction
[22:27:04] foucist: hmm, reclaim the living room!
[22:27:16] foucist: couch & big tv is critical for working too!
[22:28:06] Senjai: foucist: you haven't seen my office ;)
[22:28:18] Senjai: Is there any way I can store a rescue exception in a lambda?
[22:28:40] Senjai: E.g. to DRY up the rescue AR:RecNotFound's in my Show edit update destroy methods?
[22:29:31] Senjai: http://stackoverflow.com/questions/8644577/how-to-rescue-exception-central-and-dry
[22:29:33] Senjai: google is too awesome
[22:35:00] haukur: What's the best way to add the authenticity token to jQuery calls?
[22:35:42] gwillen: haukur: I can't tell you if this is the best way, but I replaced $.ajax with a wrapper that does it for me
[22:35:45] gwillen: there may be some cleaner way
[22:35:56] gwillen: (I was wrapping $.ajax for other reasons anyway, so this was easy to add to it.)
[22:36:12] haukur: gwillen: I see
[22:36:24] haukur: I thought jquery-rails did it for you, but it doesn't seem to
[22:36:40] Senjai: haukur: The CSRF token?
[22:36:49] Senjai: haukur: or an access token
[22:37:04] Senjai: haukur: I dont use the CSRF token for the API
[22:37:32] Senjai: haukur: skip_before_filter :verify_authenticity_token
[22:37:40] Senjai: haukur: instead I secure the api using APIKeys
[22:38:22] haukur: this is not for a public API, so I don't have API keys
[22:38:26] haukur: I'd prefer to leave it on
[22:38:42] Senjai: for an API why?
[22:39:59] haukur: I'm not really sure it constitutes an API, it's just a simple post for a button on the site
[22:40:28] haukur: perhaps I don't need the CSRF protection?
[22:40:42] Senjai: haukur: For a post button on YOUR website?
[22:40:55] Senjai: haukur: Json POST requests dont use CSRF by default
[22:40:58] Senjai: It's get that does
[22:41:07] Senjai: other way around
[22:41:08] haukur: wait a second
[22:41:24] Senjai: haukur: http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails/
[22:42:32] workmad3: haukur: you probably want to keep the CSRF protection on as long as you're not adding a different way to ensure a different site can't hijack your users session to do unwanted stuff
[22:43:14] gwillen: oh, I also set handle_unverified_request to go back to throwing an exception, rather than resetting the session
[22:43:22] gwillen: the latter behavior is really hard to debug
[22:43:31] gwillen: my CSRF handling was totally broken for weeks and I didn't know it because of that
[22:43:46] haukur: this seems like it would do the trick: http://weblog.rubyonrails.org/assets/2011/2/8/jquery-snippet.js
[22:44:33] gwillen: haukur: yeah, I did somethig very much like that
[22:44:42] haukur: yeah, it works
[22:44:47] haukur: thanks, guys :)
[22:51:51] Senjai: Is fatfreecrm still being actively maintained?
[22:52:02] Senjai: Doesn't really look like it.
[22:55:49] AntelopeSalad: random question, to dry up testing code with testunit is it a good idea to just throw methods inside of the file that's running the test?
[22:56:31] AntelopeSalad: it seemed like /test/helpers/controller_name_helper.rb had a different purpose?
[23:07:04] blackmesa: Hi all. anyone can tell me how the URL params look like for order: 'name asc' ?order_by=name... ?
[23:07:33] vwoo: what does that even mean
[23:08:48] blackmesa: for example when I use a scope with { order: 'name asc' } what would it show in the URL
[23:08:57] vwoo: scopes have nothing to do
[23:08:58] vwoo: with urls
[23:09:00] foucist: blackmesa: that's model level
[23:10:48] foucist: blackmesa: coming from PHP? y
[23:11:08] blackmesa: I wanted to create a URL with the params order_by=name but I dont know where to put asc/desc
[23:12:22] blackmesa: guess I would have to make a :sort param to tell the controller?
[23:15:13] bastilian: blackmesa: yes, you need to make order_by and the order two different parameters. you can however also put them into one.
[23:15:56] bastilian: there is nothing wrong with doing something like "?order=name asc"
[23:15:58] foucist: blackmesa: perhaps what you want is something like.. text_field :order_by , and then a separate check_box :asc then params[:whatever][:order_by] would be "name" or anything else that you inputted, plus params[:whatever][:asc] would be nil for "desc" or not-nil for "asc"
[23:17:26] blackmesa: thx for your quick help. I will check it out
[23:18:24] foucist: blackmesa: hopefully it was clear that i was talking about a form in the view, then talking about how it would appear in the controller
[23:19:30] blackmesa: ya thx. I am somehow missing the point about params sometimes. I need a table column link that alternates asc/desc order and I am having trouble with this
[23:22:06] bastilian: blackmesa: may i ask what you are building?
[23:23:39] blackmesa: just a table with rows from the db. and I wanted to the column to order asc, and when I click again it should be desc
[23:24:50] bastilian: blackmesa: take a look at this: http://railscasts.com/episodes/228-sortable-table-columns
[23:25:21] blackmesa: bastilian: thx
[23:25:31] bastilian: you are welcome.
[23:26:44] zeromodulus: I need a good password management thingy.
[23:26:55] foucist: zeromodulus: 1password is awesome if you use a mac
[23:27:01] foucist: well worth the cost
[23:27:19] zeromodulus: I do use 1password actually, I'm on the trial period still though.
[23:27:43] zeromodulus: I was thinking about letting chrome store my passwords.
[23:28:25] gwillen: zeromodulus: I use keepassx
[23:28:27] foucist: zeromodulus: NSA backrdoored it!
[23:28:52] zeromodulus: Well, if you think about it, there's probably very little the NSA can't wiretap.
[23:29:22] zeromodulus: I read they've cracked a lot of internet encryption.
[23:29:23] foucist: NSA wins because people are lazy
[23:29:36] foucist: zeromodulus: nah, the math is fine, but they backdoor a bunch of stuff
[23:30:37] scyllinice: Most encryption can be beaten with a gun
[23:31:34] blackmesa: bastilian: is a param like this legit? ?order_by=type desc&name=foo (with the space)
[23:31:48] foucist: scyllinice: well there's the encryption that makes it look like something else when decrypted with the wrong key
[23:32:36] foucist: blackmesa: yeah prolly
[23:32:43] bastilian: blackmesa: yes it is legit, as long as you url-escape. rails should take care of that when reading/receiving params.
[23:32:49] foucist: params[:order_by] = "type desc"
[23:33:17] scyllinice: Your browser would stick a %20 in for the space anyway
[23:33:27] zeromodulus: I have so many passwords, and they're all long random strings of symbols, numbers, and characters.
[23:34:07] zeromodulus: I'm considering storing them in Chrome because if I lost them all... that would suck.
[23:35:36] zeromodulus: And it would be a lot more convenient.
[23:36:14] scyllinice: I don't know what the status of Lastpass is these days, but it could be an option
[23:36:25] zeromodulus: I think I'll use it actually, but only store passwords for things that don't really matter if they become compromised.
[23:36:55] zeromodulus: like, if my twitter became compromised... that wouldn't derail my life.
[23:37:15] zeromodulus: or my facebook.
[23:37:30] zeromodulus: worst that could happen is someone posts "I'm gay" or something in my feed.
[23:37:59] scyllinice: Well, they could say something that was bad
[23:38:19] zeromodulus: Yeah, but I would find out and change my password.
[23:38:45] zeromodulus: Plus, everything I would store in chrome... would eventually go over the wire at some point.
[23:39:33] tjr9898: I'm trying to test a rails engine that uses session methods. Right now I have a simple controller in my spec but what do I need to include for the session contexts
[23:41:19] bastilian: tjr9898: be more specific. with this info, i would say stub the methods.
[23:44:05] tjr9898: bastilian: Part of my problem is my low familarity with Rails. But when I'm testing a Rails controller or even a Combustion controller, the session[foo] = 'bar' or 'reset_session' is available
[23:45:19] tjr9898: within a spec for a lib I create a Controller that extends ActionController::Base, those methods are not available
[23:46:19] tjr9898: I can go stub the session and reset_session methods, but I'm try to learn more as well
[23:47:27] bastilian: tjr9898: ok, let's tackel this together. what more do you want to know?
[23:48:10] tjr9898: how does session's become available in a controller, I guess.
[23:49:41] tjr9898: I'll try including ActionController::Metal
[23:50:27] bastilian: tjr9898: really, really basic. Sessions in rails are just a hash. in the background rails is taking care of storing in different "storages"
[23:50:43] spiderface: You generally don't make full websites with java as it is just a language for making applications or web apps. It is very good for doing that but you don't really makes websites with it.
[23:50:50] spiderface: You need java installed on the computer to use it and it won't work at all on an iPhone / iPad.
[23:51:03] bastilian: can i kick spiderface?
[23:51:17] spiderface: PHP is a very good and common language (facebook uses it) to use, C++ is also a very good language to learn but if you need to learn PHP then just master that as it can do pretty much everything you need.
[23:52:19] spiderface: but yeah zerg is all bugs and goop and shit (aka the best) protoss is all high and mighty and stupid... and yellow... oh and robots and lasers - terran is the other dumb one
[23:52:43] tjr9898: bastilian: I know that a session is just a hash, but I know just don't understand why those methods aren't available with just an extension of ActionController::Base
[23:54:02] bastilian: tjr9898: this might be because sessions are lazy loaded. have you tried including "include SessionsHelper"