« Back to channel list

#RubyOnRails - 05 May 2014

« Back 1 day Forward 1 day »
[00:01:52] brian___: is the proper way to use slugs with resource routing to define to_params? if so, is it possible to have two different to_params depending on which controller is called? for example public routes/controllers vs admin scoped routes/controllers
[00:12:29] BAMbanda: I'm trying to rum "gem install rails" and keep getting an error message of: "ERROR: Error installing rails: ctivesupport requires Ruby version >= 1.9.3."
[00:12:49] BAMbanda: also ruby --version tells me that I'm using 2.1.1p76
[00:21:43] pontiki: BAMbanda: pls paste the output of `gem env` ?
[00:22:48] BAMbanda: pontiki: http://pastebin.com/ZQeLsCEL
[00:23:41] BAMbanda: pontiki: http://pastie.org/9140836
[00:29:33] pontiki: that all looks quite good, BAMbanda
[00:30:00] pontiki: paste the entire output of the command `gem install rails` pls?
[00:31:11] BAMbanda: pontiki, I think its all working now thanks, for some reason it was angry with me earlier
[00:31:26] pontiki: it got scared when you started asking questions
[00:31:49] BAMbanda: yeah, self confidence issues
[00:40:08] shippy: would someone mind reviewing this pastie? I have a jbuilder file that doesn???t seem to be very efficient???curious if anyone has any optimization tips: http://pastie.org/9140859
[01:23:21] ReD-BoY: someone online i have a quick question
[01:23:55] centrx: Ask your question. Do not ask to ask.
[01:24:59] ReD-BoY: i installed Vagrant with debian on my win, i just wanna know about testing i should run 2 virtual machines 1 for Rails and 1 for testing right ?
[01:25:22] ReD-BoY: because whe i run Rails
[01:25:28] ReD-BoY: i cannot write anymore in console
[01:25:44] sevenseacat: open another console?
[01:26:04] centrx: Vagrant with debian on my win <- what does this mean
[01:26:26] ReD-BoY: to run the Vagrant i am typing to my CMD Vagrant up
[01:26:33] ReD-BoY: and then it brings me to Vagrant
[01:27:00] sevenseacat: erm, from memory, no it doesnt
[01:27:30] sevenseacat: you then need to ssh into it
[01:27:32] ReD-BoY: in windows before i used 2 cmd's 1 for rails and 1 to run tests
[01:27:44] ReD-BoY: and database updates
[01:27:55] ReD-BoY: yes then i start ssh
[01:28:10] sevenseacat: so open another console and ssh into it again
[01:28:16] ReD-BoY: ok thank you
[01:28:34] ReD-BoY: i am not familiar with this so i did it by examples in 1 post
[01:28:50] ReD-BoY: just wanna make sure before i start with the book i am going to reed
[01:30:01] Scient: you should not run vagrant in your debian at all
[01:30:03] Scient: just run debian
[01:30:11] Scient: and install ruby and rails there
[01:30:15] Scient: wtf are you doing...
[01:30:23] Scient: you run a VM inside a VM on your OS?
[01:30:34] Scient: *head explodes*
[01:31:01] sevenseacat: i think he meant windows -> vagrant -> debian
[01:31:34] ReD-BoY: sorry, but maybe i am told you the wrong way
[01:31:47] ReD-BoY: maybe i told you the wrong way*
[01:32:05] Scient: i sure hope so :P
[01:32:10] Scient: i would still dualboot debian tbh
[01:32:22] ReD-BoY: i just followed the post i read and i am not sure how i am running it and what means exactly to run VM
[01:32:27] marahin: Hey guys. What's the best option to validate if a string is an email?
[01:32:34] sevenseacat: marahin: you don't
[01:32:47] marahin: sevenseacat: i think you made a tab mistake.
[01:32:57] sevenseacat: marahin: i did not.
[01:32:59] ReD-BoY: html has a e-mail
[01:33:02] ReD-BoY: validation
[01:33:10] sevenseacat: marahin: send a confirmation email if you must.
[01:33:34] marahin: Well, the problem is, that I do not want to do anything with the passed email.
[01:33:43] sevenseacat: then why do you care if its valid or not?
[01:33:45] marahin: Just want to check if it actually can be a mail address.
[01:34:06] Scient: marahin: http://rubygems.org/gems/validates_email_format_of
[01:34:09] marahin: sevenseacat: why do you care if I care? D:
[01:34:19] marahin: I am just asking a simple question, what's the best option to validate a string inside rails
[01:34:20] rsl: so we can try to solve the REAL issue
[01:34:26] marahin: Scient: thank you!
[01:34:40] ReD-BoY: Scient: dualboot debian tbh ? can i get more info about this
[01:34:45] marahin: rsl: there is no issue!
[01:34:45] rsl: not the issue you think it is. because often those with experience can see a bigger issue than novices.
[01:34:50] sevenseacat: because email validation is virtually impossible to do without false positives and negatives
[01:35:07] rsl: i wish i knew everything
[01:35:18] rsl: seems like so many people do [and still need help] ;)
[01:38:21] raj___: I am new to rails. I have been reading up on ActiveRecord. Does AR really do a schema look up to determine the database structure (and thereby the fields to define for the corresponding models) at the start of each request?
[01:39:02] sevenseacat: in development, probably
[01:39:04] sevenseacat: in production, no
[01:39:42] raj___: when does it happen in production?
[01:39:51] sevenseacat: when you start the server
[01:40:12] sevenseacat: god i love being able to see deleted posts on SO
[01:40:33] sevenseacat: *person posts stupid answer* *comments call them out on it* *person deletes answer*
[01:41:53] raj___: thank you!
[02:06:00] ReD-BoY: please help when i try to install gem via VM i am getting premission error
[02:14:26] Symbiosisz: Hey all, I was hoping to get some input as someone new to web programming. I'm trying to figure out waht I should learn first: rails or php. I know rails has a lot of advantages, a big one being all the magic it does in the background. My concern is that given that I'm completely new to web development, if I start by learning rails I may not understand what's going on under the hood, so I was considering doing php first, then
[02:14:26] Symbiosisz: learning rails after I make one ap p in php. I figure php is going to have a lot less magic, so I'll have a better understanding of what's going on.
[02:14:35] Symbiosisz: Does anyone have any advice eithjr way?
[02:15:32] sevenseacat: step 1 - dont compare a framework and a language
[02:16:16] sevenseacat: compare like with like - your question would make a lot more sense if it was like 'should i make a rails app or a laravel app'
[02:16:33] Symbiosisz: sevenseacat: Fair enough!
[02:17:27] sevenseacat: if you're completely new to web development, jumping into rails is going to break your brain in many ways
[02:17:55] Symbiosisz: sevenseacat:I was worried about trhat. I'm about 9 chapters into the Ruby on Rails tutorial so far. I've got most of it working, but I have no clue what's going on under the hood.
[02:17:58] Symbiosisz: Which concerns me
[02:18:38] sevenseacat: by 'under the hood' do you mean what rails is doing, or what ruby is doing, or what the whole web-request part of it is doing?
[02:19:03] Symbiosisz: I suppose all of it: I don't really understand the really low level stuff about how requests work, how rails is doing routing, etc
[02:19:11] Symbiosisz: I mean, I put a route in my routes.rb and poof, it routes... but I have no clue how.
[02:19:50] Symbiosisz: That seems like it would be really great once I know what I'm doing, but I worry I may be avoiding learning the important parts about web apps as a result
[02:20:02] Symbiosisz: similar to how one should learn SQL by writing queries and DDL themselves before using a ORM
[02:20:20] Symbiosisz: I suppose my question is whether you feel my concern is warranted?
[02:20:40] sevenseacat: it is, but it's something that will also get better over time
[02:21:02] Symbiosisz: alright, that's fair :)
[02:21:30] sevenseacat: as you get more experience with things - i mean no-one expects you to know how every line of code in rails works
[02:22:09] sevenseacat: but over time you might learn that rais builds up a RouteSet from the routes you specify in routes.rb, using a library called journey
[02:22:36] Symbiosisz: Interesting, so that's stuff you could learn iin the normal course of being a rails developer?
[02:22:44] sevenseacat: and when a request comes in, it will look through that RouteSet for one that matches and then run the controller action it points to, using a rack middleware
[02:22:45] Symbiosisz: I suppose if I dig in I can probably figure some of the magic as I go
[02:23:33] sevenseacat: exactly - when you get specific questions, then you can start looking under the hood, or ask for help
[02:23:45] Symbiosisz: Awesome, that sounds like a decent approach.
[02:23:51] Symbiosisz: Appreciate the feedback :)
[02:25:07] sevenseacat: you seem like a decent enough sort, we like decent sorts :)
[02:25:33] Symbiosisz: Let me fix that...
[02:25:39] Symbiosisz: MY CODE DOESNT WORK... CAN NE1 FIX IT?
[02:26:19] zkay11: sevenseacat: I wish I'd gotten the 'jumping into rails as a complete noob' advice when I started. It was only maybe 2 months ago (started 5 months ago as a complete newcomer) that I realized I really should have tried sinatra or padrino first.
[02:26:47] sevenseacat: there's a lot less magic in sinatra for sure, and i think padrino is a bit in the middle between sinatra and rails
[02:28:12] zkay11: Yes, definitely so. I've been playing with sinatra and middleman recently and I think as a brand new person to development those two are great for a starting area. I just liked your 'break your brain' bit. :)
[02:32:59] sevenseacat: tbh rails still breaks my brain sometimes and I've been looking at it for a long time - and in terms of what it can do, i've barely scratched the surface
[02:36:36] Radar: sevenseacat: join the club
[02:43:29] mozzarella: even you, Radar?
[02:43:35] Radar: mozzarella yes
[02:44:07] Radar: I've looked deep into the Rails framework, and the abyss stared right back.
[02:44:42] Radar: I can tell you how view lookup is done, the respond_to mojo that goes on in controllers, the initialization and config process (because I wrote two guides for them)... and more.
[02:45:00] Radar: But there's still a lot I do not know.
[02:46:42] sevenseacat: and Radar knows a lot more than me and has been doing this a lot longer than me
[02:50:51] GeekOnCoffee: sevenseacat: nah??? Radar == noob
[02:51:09] Radar: quiet you
[02:51:09] diggitydane: hey guys, I'm trying to get a basic namespaced controller test working that is behind a simple authentication. With Capybara, I have a helper that signs the user in, but can't get it to work without it
[02:51:14] diggitydane: https://gist.github.com/anonymous/5b857cfa7031ff51ddb5
[02:51:41] Radar: diggitydane: what happens?
[02:51:50] diggitydane: obviously trying to avoid capybara for a controller test. I've tried just setting session variables as well
[02:51:57] Radar: https://gist.github.com/anonymous/5b857cfa7031ff51ddb5#file-application_controller-rb-L5-L8
[02:51:58] Radar: What is this.
[02:52:05] diggitydane: it hits the authenticate_user filter
[02:52:20] Radar: https://gist.github.com/anonymous/5b857cfa7031ff51ddb5#file-helpers-rb-L8
[02:52:24] Radar: Are you sure that your sign in works?
[02:52:39] diggitydane: yeah, all of my integration tests work with it
[02:53:41] diggitydane: so, it hits the authenticate_user and redirects to login. Not sure how I should auth the user
[02:54:08] Radar: You're already auth'ing the user with that helper though.
[02:54:14] Radar: So why is your sign in failing?
[02:54:41] diggitydane: no, the sign it works. but when I call 'get :dashboard' it redirects back to login screen
[02:54:52] Radar: which would indicate that the sign in didn't work
[02:54:56] Radar: so when are you going to fix the sign in?
[02:55:31] Radar: https://gist.github.com/anonymous/5b857cfa7031ff51ddb5#file-advertiser_controller_spec-rb-L3
[02:55:36] ReD-BoY: Symbiosisz i personally suggest you to read Learn to program second edition by Chris Pane
[02:55:48] Radar: ^ Doesn't actually sign in the user because controller tests don't (or really, shouldn't) have access to the capybara helpers
[02:56:13] Radar: diggitydane: So you should be probably setting the user using something like controller.stub :advertiser_current_user => user
[02:56:23] diggitydane: yeah, that's what I'm asking is how can I authenticate the user?
[02:56:46] Radar: It's not the controller's responsibility to authenticate the user. It's only job is to display the dashboard.
[02:57:05] diggitydane: do i put that in the same describe block?
[02:57:09] diggitydane: or does it matter
[02:57:31] Radar: It would go in a before block inside the describe block
[02:57:35] Etriaph: I hadn't looked at the Rails code until now, and wow
[03:09:50] diggitydane: Radar: awesome, thanks man
[03:09:57] diggitydane: any red flags with this? https://gist.github.com/anonymous/523123b04276b6d20423
[03:11:07] helpa: ReD-BoY: Do not PM members of the channel without first asking if that is OK.
[03:11:07] Radar: ReD-BoY: !rule12
[03:11:20] Radar: ReD-BoY: I charge $150/hr for private consultation.
[03:12:56] ReD-BoY: and thanks
[03:14:16] GeekOnCoffee: Radar: cheapskate
[03:26:09] dmz: Good evening y'all; i'm getting ready to deploy my first production rails app (yeah!) and have a quick question; when I set nginx rails_env to production it adds "?secure=true" to all links; what is this from (all my pages are already https and it didn't do that in development). Thanks in advance!
[03:27:18] helpa: dmz: This kind of issue is hard to debug remotely. You should hire someone who can look at your code and figure it out. We are most likely unable to help you in this situation.
[03:27:18] Radar: dmz: !debug-proxy
[03:28:04] dmz: that's not helpful
[03:28:11] helpa: dmz: http://i.imgur.com/sEinL.gif
[03:28:11] Radar: dmz: !dealwithit
[03:28:26] dmz: i'm guessing this hasn't happened to anyone else then
[03:28:32] Radar: dmz: Not in recorded history.
[03:28:37] dmz: interesting
[03:28:44] GeekOnCoffee: dmz: I???ve never seen it
[03:28:52] Radar: You are a beautiful and unique snowflake.
[03:28:52] dmz: that's a long time and you have such great knowledge of the world other than yourself :)
[03:29:06] Radar: dmz: http://logs.ryanbigg.com and an SQL console connected to the database does wonders.
[03:29:11] dmz: it's not breaking things, just annoying
[03:29:36] dmz: just one of those things that changes between dev/prod i guess
[03:29:38] Radar: dmz: Your sarcastic attitude is not earning you any favours.
[03:30:16] dmz: and by saying not in recorded history didn't have any sarcasm in it? or i guess you were being serious about all of time & space that is recorded history :)
[03:31:03] dmz: i'm ok if noone here has knowledge or experience with this; that's why i asked; if someone had it would have helped; if not i can figure it out, i'm a big boy :)
[03:31:25] Radar: have you looked for "secure" in your nginx config?
[03:31:45] dmz: it's not nginx doing it; it only changes when i change rails_env from development to production
[03:31:53] dmz: it's not there in development
[03:32:21] sevenseacat: if you dont know what is causing it, seems premature to rule out nginx
[03:32:24] dmz: confirmed on development system and newly deployed production (where i had seen it for the first time since i hadn't set rails_env to production until just today)
[03:33:00] dmz: it could be nginx, but if only changing rails_env was making me lean toward passenger/rails; but i can go search nginx settings for rails_env and what it effects
[03:36:58] GeekOnCoffee: try running it in production mode on your development system
[03:38:04] dmz: GeekOnCoffee i did and it did the same thing
[03:38:49] sevenseacat: have you tried grepping your code for `secure`? :)
[03:38:53] dmz: and the nginx config files are identical; i'm guessing it's something i did in my rails app :) i did a lot of various things for security
[03:39:04] dmz: still weird it's not in development
[03:40:37] dmz: i'll probably dig into it once the rest of the production deployment is done; got a few partners to get setup properly and finish firewalls :)
[03:40:42] dmz: thanks y'all
[03:41:11] sevenseacat: guess thats a no
[03:42:02] Senjai: sevenseacat: Come now, yo dont actually expect people to take your advice when they ask for it right? :P
[03:42:04] dmz: sevenseacat i did yes; and it only finds the secure options for devise in my user model
[03:42:28] dmz: ./app/models/user.rb: :password_expirable, :secure_validatable, :password_archivable, :session_limitable
[03:42:49] sevenseacat: that sounds like a lot of custom devise modules
[03:43:03] dmz: nothing else; i'll search the nginx passenger module code & gems later :)
[03:43:33] dmz: i am a firm believer in expiring passwords, strong passwords & not reusing passwords :) just standard modules in devise; nothing custom about them
[03:43:58] dmz: although i did find a few issues i posted to the devise issues last year i think :)
[03:44:34] sevenseacat: i mean custom as in 'they dont come with devise'
[03:44:53] dmz: https://github.com/phatworx/devise_security_extension
[03:45:16] sevenseacat: i'm glad you are in agreement with me
[03:45:26] dmz: yes they don't come with devise
[03:45:36] dmz: but i figure i can't be the only one use them
[03:45:53] dmz: and if others are in production i don't think it would be that code causing it otherwise there would be someone asking about it (maybe) :)
[03:46:17] dmz: i saw no reason to extend devise myself when there is a maintained gem for what i need
[03:47:03] dmz: still it's just an annoyance; and how bad would it be for customers to see "secure=true" on the line :)
[03:47:10] dmz: url i mean
[03:47:22] dmz: maybe it'll make them trust the site more :)
[03:48:05] sevenseacat: lots of random chatter, no actual debugging to fix the problem
[03:49:04] RubyPanther: dmz: you could probably find it in 30 seconds using grep
[03:49:41] helpa: http://i.imgur.com/tyViD.gif
[03:49:43] dmz: it took longer than 30 sec to use grep to search my app code :) but again it's not a huge priority; but i will search the passenger module for nginx as well as all installed gems
[03:50:17] dmz: once i have all other production stuff done; i thought i'd just bounce it off the group here in case someone had seen it and save me the grep time
[03:50:19] RubyPanther: dmz: Your code is really, really awful then, AND your computer is over 15 years old.
[03:50:43] dmz: i didn't tell it to not search the binary files in the file system, there are several multi-gig files so grep took long time
[03:50:48] dmz: system is on ssd disk
[03:51:20] dmz: it took 60 sec to search and would have taken longer to exclude all the binary files in command line so i figure my time was worth the extra 50 sec of grep time
[03:51:34] Radar: fascinating
[03:51:42] Radar: Senjai: pass that popcorn please
[03:51:50] RubyPanther: if grep is too hard, what the heck are you worrying about minor details like extra params for??! you'll have a giant stack of real bugs to deal with as soon as you have a user...
[03:52:11] Radar: ?secure=true just means its 2x more secure anyway so I am not sure what the big deal is
[03:52:19] helpa: Radar: http://i.imgur.com/m9m3wr9.gif
[03:52:19] Senjai: Radar: !popcorn2
[03:52:19] dmz: i never said grep was hard, but excluding 500 different files on command line would have taken a lot of typing (UUID file names)
[03:52:26] Radar: Senjai: ta
[03:52:27] dmz: i said it's not a big deal
[03:52:31] dmz: just was curious
[03:53:09] RubyPanther: if it isn't too hard... why did you do it wrong, getting results you find insufficient?
[03:53:20] RubyPanther: I mean it is either too hard, or it isn't.
[03:53:45] RubyPanther: if it isn't too hard but you still can't do it, that is getting into brain-scan territory
[03:53:49] dmz: i did a greap on all files on my app; your the one who inferred it was difficult
[03:54:02] Radar: Can this conversation be over yet?
[03:54:11] dmz: i already said thanks
[03:54:24] sevenseacat: so how about that local sports team
[03:54:25] dmz: others want to keep sending jabs to make themselves feel good or something
[03:54:27] RubyPanther: No, I inferred it might be too difficult _for_you_. Not "too" difficult in the abstract; nor would "too" have an objective abstract.
[03:54:40] Radar: I'll ask again: can this conversation be over yet?
[03:55:08] Senjai: Dun dun dun
[03:55:11] Senjai: The plot thickens
[03:55:26] Radar: Thanks everyone.
[03:55:27] RubyPanther: Radar: There was a time in the past when you used that op status responsibly, but op-ing to just threaten people is not very constructive, responsible, or mature.
[03:55:38] Radar: RubyPanther: The conversation is disruptive to the channel.
[03:55:42] Senjai: RubyPanther: I disagree, it was derailing the channel too much
[03:55:44] Radar: RubyPanther: You are being overly pedantic.
[03:55:58] dmz: Nice word
[03:56:55] sevenseacat: let's just all have a bowl of strawberry icecream or something
[03:57:05] RubyPanther: Looking at the scrollback, there was no other conversation for it to have disrupted, so that is provably not true. It is pretty obviously just a conversation that you personally didn't enjoy, which is a whole different type of thing, and probably not even a "problem" that needs solving.
[03:57:12] dmz: rum here, makes for better deploying than whiskey
[03:57:22] sevenseacat: rum icecream?
[03:57:31] dmz: rum & coke :)
[03:58:35] Radar: +q RubyPanther!*@*
[03:59:00] Radar: RubyPanther: Go ahead and call this immature all you like. I called you out on your pedanticness and was very, very close to calling you out on your general unhelpfulness.
[03:59:04] Radar: And now I am doing that.
[03:59:14] Radar: "Just grep for it" is absolutely terrible advice.
[03:59:58] Radar: Absolutely no indication whatsoever about what to grep for or where to grep for it.
[04:00:13] Radar: RubyPanther: And abusing me in PM will just land you another hour extension to your +q.
[04:00:25] dmz: one last question; as this is my first production rails deployment anything y'all have learned about prod rails deployments I should keep in mind?
[04:00:59] dmz: i've already learned to not run burp suite against my nginx deploy with thresholding enabled :)
[04:01:00] Radar: dmz: 1) Redundancy is not a terrible thing to have. 2) Backup everything as if the server could catch fire at any moment 3) build an automated deploy script and test it.
[04:02:49] dmz: Radar, other than systems stuff; i've got 20+ years w/system work, development is just a hobby (i own a bi-coastal secure data-center business) :) but thanks great advise for #3, that's actually what i'm working on right now; using capastrano & git with a back-office ssh tunneled git repo (code isn't in public git server)
[04:03:24] Senjai: dmz: Check out mina
[04:03:40] Senjai: It's a capistrano alternative
[04:03:42] Senjai: I quite like it
[04:03:56] dmz: Senjai interesting, looks quicker to setup/use
[04:05:42] Senjai: You lose out on some prebuilt scripts because capistrano for the longest time has been the default go to. But I dont support cap too much after v3
[04:06:43] krz: PendingRegistration::Manager.where("properties -> 'email' NOT IN (#{['foo@bar.com']})") whats up with that?
[04:06:56] Radar: dmz: I've been using Ansible for my server setup and I'm really enjoying it. I've heard good things about Mina too.
[04:07:10] krz: ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: syntax error at or near "["
[04:07:12] krz: LINE 1: ...ion::Manager') AND (properties -> 'email' NOT IN (["foo@bar....
[04:08:18] dmz: probaly own't go with ansible, we hope to have to need > 10 servers and i'm a cheap bastard :)
[04:09:35] Senjai: krz: PendingRegistration::Manager.where.not(properties: ['foo@bar.com'])
[04:09:50] sevenseacat: anyone got any good references about what rspec feature specs should and should not cover? my opinion is that they should only cover what you can see in a browser but now i need to back that up (or have my opinion corrected if thats the case)
[04:10:18] Senjai: krz: If you want to do it your way, you'll have to join the array with commas. not in([.......].join(","))
[04:11:03] Senjai: sevenseacat: I typically am a supporter of tight controller/unit testing. Then use features specs to test a positive case, and a negative case
[04:11:20] Senjai: But I dont believe in just making a ton of feature tests to skip controller tests.
[04:11:30] sevenseacat: Senjai: so would you test a model's attributes in a feature?
[04:12:06] sevenseacat: eg. press submit to update attributes, then fetch the model and make sure theyre updated
[04:12:21] Senjai: sevenseacat: I would not, unless there is no visible representation of the model changing. In the case of spree, I may have a visual failure of going from state address to state delivery in the checkout, I would assert the model is still in the state address so that it failed for the reason i expected it too
[04:13:06] Senjai: Other than that, i would just assert a positive (model updat succes) and a negative case (model update failure). And have controller specs tests the nitty gritty
[04:13:08] sevenseacat: thats pretty much the case i was discussing here, when there is no visual indication other than a success/error message
[04:13:40] Senjai: sevenseacat: The example I described was to make sure an error that was happening isn't happening anymore. Like for a fix
[04:13:47] sevenseacat: Senjai: know any good resources on this issue that i can point coworkers to?
[04:14:40] sevenseacat: feature specs dont really seem to the the right place to test a 'fix' >_>
[04:14:57] Senjai: sevenseacat: Its a good place for a regression test.
[04:15:10] Senjai: sevenseacat: https://github.com/Senjai/spree_tax_cloud/blob/5d9fb6a481dbd535b268093ed8eb60e16e6f8c5c/spec/features/cart_spec.rb
[04:15:30] Senjai: We had an issue where a user after failing to move past the address state could not add or remove line items from their cart
[04:15:38] Senjai: This test should fail before the fix is implimented
[04:15:53] Senjai: *if the ship address is invalid*
[04:15:57] sevenseacat: see lines 28 and 29 there i have an issue with
[04:16:25] Senjai: I thought you might
[04:16:57] Senjai: 28 and 29 could be removed, I did this partly as a make sure this doesnt happen again as we develop.
[04:17:12] Senjai: All we needed was the address to be saved, without the order advancing its state, which is what line 8 does.
[04:18:37] Senjai: But besides any regression, I believe one postive feature spec and one negative feature spec for every identifiable "feature" would be pretty good. Though we dont always do that in practice
[04:18:58] Senjai: This spec is also on top of the controller and model specs for it too.
[04:19:33] sevenseacat: yeah i cant find any good blog posts or resources or anything detailing the issue
[04:19:55] sevenseacat: i see it as a pointless duplication of controller specs
[04:20:00] Radar: dmz: I wasn't aware Ansible cost anything?
[04:20:40] Senjai: sevenseacat: I thought so too, but I've since found out that just having one feature spec over something like a checkout can help you immensely
[04:20:51] Senjai: even when all the model and controller specs are thoroughly coded.
[04:21:02] sevenseacat: i'm not saying dont write feature specs
[04:21:15] sevenseacat: i'm saying dont do controller-level checks in a feature spec
[04:21:22] Senjai: I would agree with you
[04:21:24] sevenseacat: or low-level model checks
[04:21:38] Senjai: Yes, I agree
[04:25:04] Radar: RaptorJesus: How did you get back here.
[04:25:13] dmz: radar http://www.ansible.com/pricing unless i'm looking at the wrong one; 10 machines is free, 50 2k, 100 3k, etc
[04:25:14] s2013: he is RaptorJesus after all
[04:25:17] Senjai: Radar: lol
[04:25:39] s2013: oh man.. bunch of news/magazine outlets wrote about us but messed up my name :\
[04:25:54] Radar: dmz: Oh. I'm not using that all. I'm using https://github.com/ansible/ansible.
[04:26:05] Radar: dmz: As far as I know, it's all open source.
[04:26:12] dmz: look at the link in the description
[04:26:28] dmz: i'm guessing they have a central server tied into the scripts vs using your own server
[04:26:28] s2013: im going to change my name to John Smith or something
[04:26:40] Radar: dmz: I think the cost is for the Tower server.
[04:26:40] dmz: which is where the costs come in
[04:26:41] Senjai: dmz: Are you deploying to aws?
[04:26:42] s2013: dmz, isnt chef / puppet good for automating
[04:26:43] sevenseacat: "Ansible Tower subscriptions include??software, maintenance, upgrades and online technical support.
[04:26:44] sevenseacat: Technical support covers installation, set-up, integration and usage of Ansible Tower."
[04:26:52] dmz: Senjai no aws
[04:27:27] dmz: Senjai i've got my own data-centers, although they are mainly for pci/hipaa/glba customers but who not use my own servers when i have 2 data-centers :)
[04:27:42] sevenseacat: https://www.relishapp.com/rspec/rspec-rails/docs/feature-specs/feature-spec seems to back up my opinions by not doing model level checks to make sure it was actually created and had the attributes set correctly, but its not exactly verbose
[04:27:55] Senjai: dmz: You should mine bitcoins, and sell them to people who believe in bitcoins. :P
[04:28:12] Senjai: dmz: I'd be interested in your solution when you find it
[04:29:10] s2013: dmz, are you paying a lot for hipaa compliant servers?
[04:29:16] Senjai: sevenseacat: I agree, it should be based on page content alone
[04:29:17] dmz: Senjai :)
[04:29:20] s2013: i feel people overcharges just to be hipaa compliant
[04:29:47] dmz: s2013 i own the servers :) so depends on what you mean by cost; the servers are cheap; it's the services (layers of controls) that cost $$
[04:29:51] s2013: yeah i know
[04:30:02] s2013: i guess do you charge people a huge premium just to be hipaa compliant?
[04:30:19] dmz: s2013 dm me if you want to know my company and I'm happy to see if we can help find a good price for a compliance based solution
[04:30:48] s2013: you can tell me more about the company sure, im not looking for any hipaa compliant solutions but i know quite a few startups in that space
[04:30:55] s2013: its gaining more tractions
[04:30:59] dmz: we have a basic system that starts at < 200/mo and goes up from there to whatever you need; we have some customers with dedicated crossconnect / private networks (mpls/etc) / multi-data-center and their costs go > 20k/mo
[04:31:21] Senjai: I'm a cloud fanboy. I really like AWS.
[04:31:23] dmz: s2013 the push toward electronic records is forcing it a lot
[04:31:27] s2013: yeah i know
[04:31:42] s2013: one of our potential investors are in that space too. i think they charge around $500/mo starting
[04:31:52] dmz: there are some things you can't do in aws; much you can but it comes down to do you have the team to run it or do you need to hire someone; hiring 1 person ends up costing > outsourcing to us :)
[04:32:16] s2013: has the aca affected your business dmz?
[04:32:24] s2013: i feel that might give it a boost
[04:33:03] dmz: s2013 no, we're a service provider; we offer security/management/documentation/forensics/pentest/... so other than more customres to sell to aca hasn't effected us :)
[04:33:56] dmz: what i'm deploying has _nothing_ to do with my hosting company; it's a side project a friend & I came up with years ago and I decided to learn rails & program it in my copious spare time (it took almost 3 years of part time coding to get it ready to deploy) :)
[04:34:40] s2013: thats awesome. nah i was just curious about hipaa compliance... i was in that space for a bit but its way too much red tapes
[04:37:19] dmz: yeah we take the tech side of the red tape out of the picture for our customers; ok it's one of my 2 weekends off / month; back to my project deployment :)
[04:37:31] s2013: have fun. good luck
[04:42:27] digitalknight: whats the best way to generate twitter bootstrap pages?
[04:42:37] digitalknight: using the boostrap rails generators?
[04:46:58] sevenseacat: what fancy stuff do you need for a 'twitter bootstrap page'?
[04:50:00] frank_o: twitter bootstrap :^)
[04:50:08] frank_o: misguided youth smh
[04:55:29] s2013: ok stupid question but im having brain fart. when you call .build on something lets say "user.images" it will return false on .empty? but how do i check if user.images is actually empty if that make sense
[04:55:46] s2013: blank was it?
[04:55:54] s2013: nope that reutrns false too
[04:58:32] sevenseacat: if you call build, then the association isnt empty - it has the object you just built in it
[04:58:38] sevenseacat: im not sure what you're trying to test there
[04:59:28] s2013: well i havent saved anything to it, so it temporarily has an object right?
[04:59:38] sevenseacat: yes, so it is not empty. or blank.
[04:59:52] Radar: s2013: user.images.select(&:persisted?).empty?
[04:59:55] s2013: yes but how do i check if there are any actual permanent records associated it
[05:00:00] s2013: ok Radar let me try that. thanks
[05:00:09] Radar: s2013: Oh shit I answered that 5 seconds early
[05:00:14] Radar: please don't find out about my time machine please don't find out about my time machine please don't find out about my time machine
[05:00:16] sevenseacat: that would work, but why would you need that?
[05:00:25] Radar: sevenseacat: for instance not displaying an empty record
[05:00:44] Radar: I thought the GS guide used that but I guess not
[05:00:47] s2013: its mainly in my edit form
[05:01:05] s2013: because if there arent any images then it throws an error. le tme paste what i have, maybe there is an alt solution
[05:01:21] sevenseacat: so why do you have unpersisted objects on an edit form?
[05:01:35] Radar: Because he's building a new one in the edit form to present some fields (I guess)
[05:01:51] sevenseacat: then thats valid and you wouldnt want to filter out the unpersisted ones
[05:02:26] s2013: https://gist.github.com/ss2k/d3458ca5856de02250da
[05:02:29] sevenseacat: damn... i lost the argument on the feature specs
[05:03:24] digitalknight: sevenseacat: frank_o sorry,was away
[05:03:29] s2013: Radar, does that gist make sense?
[05:03:45] digitalknight: umm, i am supposed to generate default layout using bootstrap and then modify it to introduce something
[05:03:57] digitalknight: (thats all I know. Nothing on the lines on how to do it)
[05:03:59] Radar: s2013: yeah it makes sense as in as much that it's good code
[05:04:20] sevenseacat: digitalknight: how are you including bootstrap in your app?
[05:04:32] sevenseacat: what gem are you using?
[05:04:35] s2013: basically you can upload assets for a theme.. but if there arent any assets already uploaded, if you go to the edit form it throws an error (on the form i show the assets that were previously uploaded)
[05:04:53] s2013: but thats a good trick to know. never saw it before
[05:06:04] digitalknight_: sevenseacat: sorry got disconnected
[05:06:09] digitalknight_: twitter-bootstrap gem
[05:06:11] s2013: @theme.assets.select(&:persisted).empty? <-- undefined method `persisted' for #<Asset:0xe98b01c>
[05:06:19] s2013: on the console it does return true though
[05:06:44] sevenseacat: digitalknight_: you should probably pick a gem that isnt three and a half years old
[05:06:57] sevenseacat: s2013: you missed the ?
[05:07:28] digitalknight_: sevenseacat: i know that sounds ridiculous, but thats whats been mandated @ office
[05:07:30] sevenseacat: digitalknight_: that gem also wont work in your nice shiny rails 3.2/rails 4 app
[05:07:44] sevenseacat: so.... you're using a really old version of rails?
[05:07:47] digitalknight_: i ahvent configured the app,just extending it
[05:07:54] digitalknight_: sevenseacat: no,they upgraded that to 4
[05:08:03] Radar: digitalknight_: ...
[05:08:06] sevenseacat: that gem doesnt supportrails 4
[05:08:13] Radar: digitalknight_: Use the bootstrap-sass gem, not the twitter-bootstrap gem.
[05:08:33] digitalknight_: Radar: sevenseacat ok,will do, but AIUI, bootstrap-sass doesnt have generators,does it?
[05:08:39] helpa: Why don't you try it and find out for yourself?
[05:08:45] sevenseacat: i have no idea, i dont use generators
[05:08:50] digitalknight_: Radar: thanks :)
[05:08:57] sevenseacat: when i can avoid them
[05:08:58] Radar: digitalknight_: I don't know why you would need generators at all. Include the assets into your asset pipeline and then use the stuff they provide?
[05:09:10] digitalknight_: Radar: ok,i see it.let me try it
[05:09:12] sevenseacat: and bootstrap doesnt seem like something that needs generators
[05:10:07] digitalknight_: sevenseacat: i actually have no idea how to use it or use JS,hence was looking for something that gets me running,then debug
[05:10:42] sevenseacat: i am worried for your app.
[05:11:24] Radar: digitalknight_: Could you try explaining again what it is you're trying to do?
[05:12:07] digitalknight_: sevenseacat: Radar so I have to make some new pages using bootstrap, then add some functionalities for fetching some data from our DB and showing it on the page,read from session etc
[05:12:13] digitalknight_: its the first step thats eating my head
[05:12:17] Radar: digitalknight_: It sounds just like a simple matter of adding in the styles to the right page.
[05:12:34] Radar: digitalknight_: Sooooo what's stopping you from adding the boostrap-sass gem to your Gemfile and then adding the assets?
[05:12:45] digitalknight_: Radar: i have added the gem and bundle installed it
[05:12:51] Radar: digitalknight_: Good.
[05:13:02] digitalknight_: i need to see what it meand by adding the assets. Naive me, really sorry
[05:13:04] sevenseacat: https://github.com/thomas-mcdonald/bootstrap-sass has quite good docs
[05:13:08] sevenseacat: on how to use the gem
[05:13:19] sevenseacat: https://github.com/twbs/bootstrap-sass#usage
[05:13:37] sevenseacat: oh thats right its an official port now
[05:13:39] Radar: @import "bootstrap"; goes into application.css.scss
[05:13:42] Radar: sevenseacat: yes
[05:13:54] sevenseacat: i looked at the two urls i pasted and went 'wtf...'
[05:14:30] digitalknight_: Radar: sevenseacat thanks,let me read some so that I can ask more intelligent questions
[05:14:44] sevenseacat: i like intelligent questions.
[05:15:06] s2013: sevenseacat, how much woodchuck can a woodchuck chuck if a woodchuck could chuck wood
[05:15:16] sevenseacat: that is not an intelligent question. also, 42.
[05:16:36] Radar: http://www.wolframalpha.com/input/?i=how+much+woodchuck+can+a+woodchuck+chuck+if+a+woodchuck+could+chuck+wood
[05:16:39] s2013: ok now im having an issue.. so on my edit i have @assets = @theme.assets.build https://gist.github.com/ss2k/d3458ca5856de02250da i am guessing i should not do that
[05:17:03] sevenseacat: depends on if you want it or not.
[05:17:33] s2013: so what happens is that if there is already existing assets, assets become just an empty object
[05:17:51] sevenseacat: thats not what would happen
[05:19:04] kies: a question on security, if i have a section thats only for admins, is it enough to only check for admin or would it be best practice to write out a pundit policy as well?
[05:19:28] s2013: so line 2 at form.haml it includes all assets including the new one thats being built. how can i only include assets that already exists
[05:21:22] sevenseacat: have you just decided to completely ignore what Radar suggested earlier?
[05:21:33] s2013: no.. i have that check too
[05:21:45] s2013: one sec let me repaste it
[05:22:18] s2013: - @theme.assets.each do |asset| <-- should that be @theme.assets.select(&:persisted?)
[05:22:35] helpa: Why don't you try it and find out for yourself?
[05:22:46] sevenseacat: you know what both lines of code do
[05:23:35] s2013: it does work but im wondering if there is an alternate way of doing it.. i just havent seen it like this before.
[05:24:16] sevenseacat: 'i want to show only persisted objects, but i dont want to select the persisted objects and iterate over them'?
[05:24:49] s2013: yeah pretty much. anyways its fine. it works. good enough. thanks
[05:28:13] s2013: k that solves one problem.. ok now i have one more weird problem (it does make sense as to why but not sure how to go about fixing it).. instead of one browse file button i have multiple ones (# of assets + 1 for the new one).
[05:28:54] sevenseacat: because you're outputting a separate file field for each asset
[05:28:58] sevenseacat: each one comes with its own button
[05:30:36] s2013: yeah i understand that.. how do i have just one file upload button?
[05:31:52] sevenseacat: dont output multiple file fields
[05:32:27] sevenseacat: how are you supposed to change the existing assets with the interface you're proposing?
[05:33:08] s2013: basically they can upload multiple assets at the same time. but when they edit whenever they upload new assets the old ones are deleted
[05:33:28] sevenseacat: then why are you iterating over the old ones at all
[05:33:33] sevenseacat: if theyre all just going to be deleted
[05:33:57] sevenseacat: just show a single field
[05:34:50] s2013: thats the thing, im not sure how to show a single field.. f.simple_fields_for :assets iterates over all of it
[05:37:46] s2013: they can edit the form without editing the assets too.. thats 99% of the case. whenever they do upload new assets, old assets will be removed. thats the usecase
[05:49:56] s2013: any clue sevenseacat ?
[05:50:42] s2013: okay can you give me one of them please? ive been trying to search around but cant find anything
[05:51:21] s2013: actually let me try something see if that works
[05:52:02] s2013: = f.simple_fields_for :assets, @assets do |a| changed it to that
[05:52:17] s2013: that seems to work.. is that what you were thinking
[05:52:43] sevenseacat: completely, 100% not.
[05:52:53] s2013: so how would you do it?
[05:53:11] sevenseacat: i wouldnt iterate over the existing assets, because doing so is irrelevant
[05:53:17] sevenseacat: you dont want people to edit them
[05:53:42] s2013: i iterated over existing assets to display them.. its not in the form. in the form i changed it so now only a single instance is being editable
[05:53:51] sevenseacat: https://gist.github.com/ss2k/d3458ca5856de02250da#file-_form-haml-L5
[05:53:52] s2013: instead of multiple file upload button i get only one now
[05:54:08] s2013: yeah i changed it to = f.simple_fields_for :assets, @assets do |a|
[05:55:11] sevenseacat: i'm surprised that even works to be honest, because you're replacing an enumerable object with a single asset
[05:55:50] s2013: well how would you do that? thats what im asking becase i want to do it the right way
[05:56:08] s2013: http://apidock.com/rails/ActionView/Helpers/FormHelper/fields_for in the section that says "It?s also possible to specify the instance to be used:" it shows an example
[05:56:50] sevenseacat: i would just do f.file_field :assets
[05:56:59] sevenseacat: and not bother with fields_for
[05:57:15] sevenseacat: actually that might not work
[05:57:18] s2013: yeah its nested
[05:57:22] s2013: so i think you need fields_for
[05:57:35] sevenseacat: well duh its nested else you wouldnt be using fields_for
[05:57:55] s2013: yeah but i mean f.file_field :assets wouldnt work if it was nested though thats what im saying
[05:58:00] s2013: unless it does. then well :\
[06:11:46] s2013: okay that stuff is finally fixed. yay
[06:19:04] s2013: oh my god.. for some f'n reason i have a start date and end date.. and it saves one in -0400 timezone and the other at -0500 timezone.. even if i explicitly enter the timezone
[06:20:43] s2013: no its not. any clue why it would do that? https://gist.github.com/ss2k/4f86a67d0ecdfc300fae
[06:20:55] s2013: is it cause of the default value?
[06:22:24] s2013: it is.. if i put Date.tomorrow instead of "2099-01-01" or whatever it saves in the same one. thats so weird
[06:22:52] sevenseacat: that has nothing to do with how the data gets saved
[06:23:36] s2013: thats what i was thinking but as soon as i put Date.tomorrow for the value: it saves both in the same timezone. weird
[06:23:57] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[06:24:26] s2013: i pasted the code.. of what i have in the form and what i changed
[06:24:47] sevenseacat: you posted two lines of a view and complained that your data was saved in the wrong timezone
[06:25:06] sevenseacat: you have not provided enough information to debug the problem
[06:26:47] Radar: s2013: Can you reproduce this problem in a new app?
[06:28:24] s2013: not sure. one second. but basically if i change "2099-12-31" to Date.tomorrow it saves both in the same timezone
[06:30:24] s2013: https://gist.github.com/ss2k/4f86a67d0ecdfc300fae this seems ot have solved the problem
[06:30:35] s2013: im still curious as to why it even matters.. oh well.
[06:32:15] funburn: anyone use strano for deployment?
[06:32:45] s2013: ok thank you guys for your help. have a great night.
[06:51:39] Spockz: When I have two CSS files, is there an automated way to check whether the second file has directives that affect the styles from the first file?
[06:52:06] sevenseacat: im not sure what you mean by that
[07:03:33] pduersteler: hi all. can someone assist me in some way? I'm trying to get formtastic, formtastic-bootstrap and bootstrap-sass for bootstrap 2.x to work, however the formtastic forms won't look properly (formbuilder is registered). I assume it's about selecting the right branches/tags, that's where I'm lost.
[07:06:04] sevenseacat: define 'wont look properly'
[07:16:09] pduersteler: sevenseacat: the form wrappers won't have the proper style, they have the bootstrap3 style
[07:17:23] sevenseacat: you likely need the right versions of the gems for bootstrap v2
[07:17:30] sevenseacat: formtastic-bootstrap should be v2,0
[07:19:04] pduersteler: tried that, but afaik formtastic-bootstrap v2 also inludes the wrong styles. but maybe it was too late when I tried, let's try that again.
[07:19:07] sevenseacat: bootstrap-sass should match whatever version of bootstrap you're using
[07:20:16] crzrcn: I want write the same model to two different databases. Which gems could help with managing multiple DB connections?
[07:23:30] pduersteler: aaah, darn. including formtastic before formtastic-bootstrap isn't a good choice apparently.
[07:23:42] pduersteler: dropping formtastic and just using formtastic-bootstrap works
[07:37:49] Macaveli: What's the cleanest way of hiding stuff? 2 options, option 1 do jQuery .hide(); / option 2 do <% if current_user %> in rails
[07:37:55] Macaveli: Hiding stuff in view*
[07:39:30] sevenseacat: well the first isnt hiding it
[07:43:24] sevenseacat: its still there on the page - what would be the point of doing that
[07:47:47] macscam1: i am looking at using publify to make a blog but the site doesnt make clear if it works with rails 4
[07:50:55] sevenseacat: macscam1: https://github.com/publify/publify#install-publify--locally looks like a no
[07:51:26] macscam1: sevenseacat any recommendations
[07:51:47] sevenseacat: for blogging software? wordpress
[07:52:59] macscam1: sevenseacat im gonna stick with rails for now
[07:54:48] macscam1: well i will try embedding it with iframes
[07:55:21] sevenseacat: believe it or not, rails isnt the perfect answer to every question
[08:01:01] Macaveli: sevenseacat, when the user is not logged in some partials does not need to be showed. When the user is logged in all the partials must be showed
[08:07:19] sevenseacat: then actually don't show them, instead of showing them and then hiding them
[08:09:24] Macaveli: but how to show them when the user is logged in
[08:09:28] Macaveli: it's the same page
[08:09:40] sevenseacat: with a conditional depending on if the user is logged in or not
[08:20:43] drager: I'm having some trouble doing login with strong parameters. Error and code; https://gist.github.com/drager/be49169fffeddd101e06
[08:23:10] sevenseacat: drager: user_param_emails is a hash of {email: 'something'}
[08:23:27] sevenseacat: so you're actually trying to find_by(email: {email: 'something'})
[08:23:45] drager: sevenseacat: Ah
[08:23:47] sevenseacat: strong params is really not necessary there
[08:25:13] drager: sevenseacat: Alright, do you have any idea why the error message "Invalid email..." always is visable?
[08:25:56] sevenseacat: because you're trying to authenticate with a hash instead of a password?
[08:26:08] sevenseacat: no idea, not enough info to say
[08:26:38] drager: ah, it worked now
[08:27:00] drager: Will remove the strong parameters, thanks sir!
[08:35:45] drager: Now the login doesn't work at all, getting "Invalid email or password"... https://gist.github.com/drager/be49169fffeddd101e06
[08:36:44] sevenseacat: because you've removed the user key from the params
[08:36:55] sevenseacat: its params[:user][:email] and same for password
[08:37:01] sevenseacat: cmon, debug it here, dont make me do it for you
[08:38:52] dopie: Good morning all
[08:39:19] sevenseacat: afternoon dopie
[08:39:50] dopie: got a devise question which stack overflow answered but just wondering what im doing wrong here
[08:39:52] dopie: http://stackoverflow.com/questions/5113248/devise-update-user-without-password/11676957#11676957
[08:40:00] dopie: https://gist.github.com/staycreativedesign/b8e0bbc12fc89b22fd11
[08:40:35] sevenseacat: and the error is?
[08:40:51] dopie: 1 error prohibited this user from being saved:
[08:40:51] dopie: Current password can't be blank
[08:41:12] drager: hm, will give me nil
[08:41:35] sevenseacat: dopie: did you debug your controller to see what your code is actually doing?
[08:42:13] sevenseacat: did you gist the logs of the error so we actually have a hope of helping you?
[08:43:17] dopie: there isnt an error per se but its just trying to get current password
[08:43:24] dopie: which i dont want it to
[08:44:48] sevenseacat: well you have a controller that is dealing with params submitted in a request and we have no idea what they are
[08:46:08] sevenseacat: ahh i forgot that rails logs will filter out password stuff
[08:46:44] sevenseacat: were those fields actually blank when you submitted the form?
[08:47:05] sevenseacat: okay, so what do your validations look like in your model?
[08:47:37] dopie: i should allow_blank
[08:48:12] sevenseacat: you likely just need to use update_without_password instead of update_attributes
[08:51:05] dopie: im using rails 3.2
[09:08:27] emka: Hi, anyone using compass-rails and sprite generation? Trying to get it to work with Heroku hosting
[09:17:51] joy4u: in a situation where owner has many projects and each project has many clarification where the freelacer can request for clarification and owner can clarify their doubts, how to model the clarification part using activerecord
[09:18:38] joy4u: i come up with Clarification - belongs_to project but getting confused in other details
[09:18:39] milmih: Hi, how can I filter out the attributes of an entity in order to prepare it for render
[09:19:53] rvanlieshout: milmih: it depends on how you render your data
[09:20:02] milmih: with render
[09:20:11] rvanlieshout: joy4u: what part is confusing you?
[09:20:21] milmih: rvanlieshout, format.json { render json: vehicle }
[09:20:22] rvanlieshout: milmih: then don't include it in the json
[09:20:37] joy4u: rvanlieshout: how to relate to either own or freelancer
[09:20:49] rvanlieshout: milmih: http://api.rubyonrails.org/classes/ActiveModel/Serializers/JSON.html#method-i-as_json
[09:20:56] rvanlieshout: joy4u: use a polymorphic association
[09:21:17] joy4u: rvanlieshout: is this is the correct for this situation?
[09:23:11] joy4u: rvanlieshout: sorry for the typo is this is correct for this situation?
[09:23:34] rvanlieshout: dunno. try it
[09:23:38] rvanlieshout: there are many solutions possible
[09:24:14] joy4u: rvanlieshout: will it be Clarification - belongs_to request, belongs_to :clarify, polymorphic: true
[09:24:32] shock_one: I have an STI table. How would I make a certain attribute - a database column - accessible only to one subclass.
[09:25:40] milmih: rvanlieshout, thanks! :)
[09:26:01] rvanlieshout: joy4u: a request belongs to a clarification and is requested_by polymorphic i guess
[09:26:23] rvanlieshout: shock_one: don't use STI for something that has different attributes
[09:27:07] shock_one: rvanlieshout, we discussed a lot of options, and STI fits the best to our business logic.
[09:27:11] joy4u: rvanlieshout: no a clarification belongs to a request
[09:27:30] Varun_krishna: Hi all when I run rake routes I am seeing something like this /posts/new (.:format) posts#index {:type => "Post"} what does this type mean here?
[09:27:47] rvanlieshout: joy4u: so what's the problem then?
[09:28:05] bePolite: I have this model file http://goo.gl/q7ZYzv and when i try to use this it on the console to update a user, I get the error "User Exists"
[09:28:13] bePolite: anyone konws what might be wrong?
[09:28:49] joy4u: Varun_krishna: post#new means post controller and new action
[09:28:58] rvanlieshout: bePolite: that your user exists
[09:29:17] rvanlieshout: bePolite: what code are you executing in the console?
[09:29:22] bePolite: rvanlieshout: I want to update the user
[09:29:37] rvanlieshout: bePolite: what code are you executing in the console?
[09:29:41] Varun_krishna: joy4u: {:type => "Posts"} I am also getting this at my console.
[09:30:16] rvanlieshout: bePolite: cause 'I want to update the user' returns a syntax error
[09:32:23] bePolite: rvanlieshout: Console output https://gist.github.com/najela/10d32d71f404b1d2fa03
[09:32:44] rvanlieshout: that User exists is just a query
[09:32:48] rvanlieshout: user.errors.to_a
[09:33:17] bePolite: rvanlieshout: => ["Email has already been taken"]
[09:33:42] rvanlieshout: bePolite: could it be that you already have two or more users in the db with that address?
[09:33:55] bePolite: rvanlieshout: I am trying to update the usr
[09:34:16] rvanlieshout: bePolite: i didn't ask that
[09:34:21] bePolite: ahh thats true
[09:34:41] rvanlieshout: User.where(email: 'arnold@archlinux.info').size
[09:34:47] rvanlieshout: it most likely returns a numer higher then 1
[09:35:03] rvanlieshout: making any of these objects invalid due to the uniqueness restriction in the model
[09:35:22] bePolite: rvanlieshout: Yes I just noticed that
[09:38:44] bePolite: Is there something I can do to automatically display validation errors in the terminal?
[09:39:42] dopie: anyone here have experience with modals and rails?
[09:40:37] rvanlieshout: bePolite: false isn't enough output? :)
[09:40:41] helpa: dopie: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[09:41:31] dopie: I need help with setting up a jquery modal with rails ive been through SO and the rails-jquery-modal ... and for some reason it is not working
[09:41:36] dopie: I wil lpst the code
[09:41:42] RaptorJesus: Radar: I <3 U
[09:42:18] K0nserv-: With Paperclip do you know if it's possible to ignore missing and still interpolate the image urls as if the image existed?
[09:45:01] dopie: https://gist.github.com/staycreativedesign/2d2f9a9bfdf388f058fb
[09:46:34] rvanlieshout: dopie: and the problem?
[09:47:48] dopie: when i click on it
[09:47:51] dopie: nothing happens
[09:48:02] rvanlieshout: and what's 'it'?
[09:49:52] dopie: no js error
[09:50:27] rvanlieshout: why would you expect something to happen?
[09:53:36] dopie: because i have the modal.js in the js folder
[09:53:41] dopie: assets folder
[09:53:48] rvanlieshout: and that's enough for your link to work?
[09:55:42] dopie: http://kylefox.ca/jquery-modal/examples/index.html
[09:55:47] Varun_krishna: guys could someone please help me understatding this, when I do rails route I am getting something similar to this line posts /posts/new posts#index{:type = > "Posts"} what is the type thing here?
[09:55:50] dopie: Isnt it supposed t??
[09:57:21] dopie: I included the js in the header
[09:57:29] rvanlieshout: dopie: not if something triggers your modal:open action
[09:57:39] rvanlieshout: a normal click won't do that
[09:58:50] dopie: Example 1: Open & Close with links
[09:58:50] dopie: Embed modal HTML in document (and hide it)
[09:58:50] dopie: Create a link with rel="modal:open" and set the href attribute to the modal's DOM id.
[10:00:21] rvanlieshout: dopie: $(document).on('click.modal', 'a[rel="modal:open"]' will be triggered on click.modal on those links
[10:00:26] rvanlieshout: but who tiggers click.modal?
[10:00:51] dopie: what do you mean who???
[10:01:15] rvanlieshout: with your click you trigger a click
[10:01:17] rvanlieshout: not a click.modal
[10:01:19] rvanlieshout: that's an event
[10:01:45] rvanlieshout: time for some lunch. back in around 30 min. You could try changing that click.modal to just click
[10:02:24] Varun_krishna: dopie: I need somw help, could you help me?
[10:02:32] dopie: Varun_krishna, i can ry
[10:03:01] Varun_krishna: could you see my previous message?
[10:03:17] dopie: rvanlieshout, it worked!
[10:03:41] Varun_krishna: dopie: this one <Varun_krishna> guys could someone please help me understatding this, when I do rails route I am getting something similar to this line posts /posts/new posts#index{:type = > "Posts"} what is the type thing here?
[10:03:59] dopie: Varun_krishna, dunno
[10:09:46] digitalknight: how can I know if the environment is development or production in my rails script?
[10:10:33] ryansfl: hello people how are you today?
[10:10:36] kies: digitalknight, Rails.env, you can also specify with Rails.env.development? or Rails.env.production? etc
[10:11:13] ryansfl: I am trying to figure out how one goes about querying a pg database within my rails app
[10:11:31] ryansfl: can someone point me in the right direction>?
[10:12:53] digitalknight: ryansfl: use Activerecord models?
[10:22:54] vasilakisFiL: hello! Shouldn't Model.all.include? Model.all work? I want to check if an array returned from a model has any equal match to an array returned from another query
[10:25:52] helpa: vasilakisFiL: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[10:25:52] toretore: vasilakisFiL: !fake
[10:28:42] adammcarth: charliesome: does racer still work properly?
[10:28:51] charliesome: adammcarth: it's only a toy don't use it
[10:28:54] vasilakisFiL: never mind I found it
[10:29:14] vasilakisFiL: Model.all & AnotherModel.query
[10:29:57] adammcarth: charliesome: i'm just looking to move away from my beloved webrick
[10:30:05] charliesome: puma is a good bet
[10:30:08] jammanbo: mikecmpbll! mikecmpbll! mikecmpbll! I did it!!!
[10:30:40] adammcarth: charliesome: cool, thanks
[10:30:52] adammcarth: mikecmpbll I did it too
[10:33:26] randomnick_: http://pastie.org/9142092 why i get Can't mass-assign protected attributes: contractor_addresses?
[10:37:38] rvanlieshout: randomnick_: and?
[10:38:07] elaptics: randomnick_: please gist your full code for each of the files, not bits of snippets
[10:38:10] rvanlieshout: randomnick_: ah.. it started with a question
[10:38:21] rvanlieshout: randomnick_: started = 'why i get' :)
[10:38:26] elaptics: there is nothing that you've shown us that even shows contractor_addresses being submitted
[10:38:39] rvanlieshout: randomnick_: because you're mass assigning that attribute while not allowing that
[10:38:54] elaptics: show the full view/form and also the request in the logs
[10:41:36] randomnick_: http://pastie.org/9142111 elaptics logs
[10:41:42] techsethi: Need help from experts on troubleshooting a "stack level too deep (SystemStackError)" issue
[10:41:48] techsethi: thanks in advance
[10:41:56] rvanlieshout: randomnick_: did you allow mass assignment of that attribute?
[10:42:45] elaptics: rvanlieshout: I think you already know the answer to that :)
[10:42:46] techsethi: I am getting this error while doing an ajax post of JSON data to an action on a controller. The action isn't doing anything at all, just returning a test string.
[10:42:48] randomnick_: attr asscssible :addresses_attributes does it right?
[10:43:16] elaptics: randomnick_: yes, but that's not what's being submitted
[10:43:19] rvanlieshout: randomnick_: not if you want to allow contractor_addresses
[10:43:32] elaptics: randomnick_: gist your full form code - I think that's where you're going wrong
[10:43:41] helpa: techsethi: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[10:43:41] elaptics: techsethi: !code
[10:43:45] mikecmpbll: jammanbo: do share?
[10:43:55] mikecmpbll: jammanbo: btw i had a play around briefly and got the same behaviour you did.
[10:44:05] mikecmpbll: then i thought, DM is borked :< i give up.
[10:44:38] dopie: when i i add $(document).on('click.modal', 'a[rel="modal:open"]'
[10:44:45] dopie: to my application.js
[10:44:51] dopie: i get this weird error
[10:44:59] randomnick_: http://pastie.org/9142118 elaptics
[10:45:00] rvanlieshout: dopie: you did try on 'click'?
[10:45:24] elaptics: randomnick_: line 13
[10:45:25] dopie: rvanlieshout, i added that to my application.js
[10:45:35] dopie: then capistrano spit out an error
[10:45:47] elaptics: randomnick_: that should be the relation you've actually defined
[10:45:49] techsethi: sure helpa. I am putting the code there.
[10:45:53] rvanlieshout: dopie: added? change the .on('click.modal', to .on('click',
[10:46:07] elaptics: techsethi: !auto
[10:47:14] cheeti: HI, how display google google analytics in my website?
[10:47:40] dopie: rvanlieshout, where do i change that?!
[10:47:42] rvanlieshout: cheeti: using documentation by google if they described that
[10:47:59] rvanlieshout: dopie: could you gist your js file again?
[10:48:17] dopie: hold on i think i got it
[10:48:44] metus_violarium: Hello, I have an application, which stores dates, also I need to schedule some things in future. Users, probably, could be from different time zones. What type is better to use: date or timestamp?
[10:48:48] randomnick_: elaptics so i need to chaange attr_accessible to :contractor_addresses_attributes?
[10:49:02] rvanlieshout: metus_violarium: UTC
[10:49:30] metus_violarium: rvanlieshout: why?
[10:49:35] dopie: https://gist.github.com/staycreativedesign/ad3f4f37fb0ad6c1d3e3
[10:49:52] rvanlieshout: metus_violarium: so you know the exact time... unrelated to time zones
[10:50:00] elaptics: randomnick_: or use the addresses relation you defined, according to your first pastie
[10:50:15] rvanlieshout: dopie: https://gist.github.com/staycreativedesign/ad3f4f37fb0ad6c1d3e3#file-gistfile1-txt-L221
[10:50:32] metus_violarium: rvanlieshout: yes, but this dates are related to users. It's their calendars.
[10:50:44] RoryHughes: Is there any easy way to check if a request was one using Turbolinks? request.xhr? isn't any different
[10:50:44] cheeti: rvanlieshout https://developers.google.com/search-appliance/documentation/614/
[10:50:52] rvanlieshout: metus_violarium: you should display them using their timezone
[10:51:03] randomnick_: elaptics but when i change to :contractor_addresses_attributes i get the same error
[10:51:06] cheeti: rvanlieshout based on the above url?
[10:51:14] rvanlieshout: cheeti: i guess
[10:51:17] rvanlieshout: if that's what you want
[10:52:28] metus_violarium: rvanlieshout: thank you.
[10:52:35] styrmis: Hi all; I have a rake task that I run once a day via the Heroku scheduler. No problems there except the other day it segfaulted (unclear why) and so the task didn???t run for that day, as there is no mechanism to retry failed tasks built in. Does anyone have any suggestions for a good way to increase the robustness of this in Rails? For reference the task???s purpose is to send out a set of daily summary emails every
[10:52:36] techsethi: Hi, here is my code. pls help https://gist.github.com/techsethi/f12d6295a8d765d69fdf
[10:52:48] elaptics: randomnick_: the name of your association, the accepts_nested_attributes line and the name in your fields_for should all be the same name...
[10:53:57] elaptics: techsethi: do you get the same problem in development?
[10:54:08] randomnick_: elaptics now it doesnt render fields for addresses
[10:54:09] elaptics: RoryHughes: afaik there's no way to tell
[10:54:27] helpa: randomnick_: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[10:54:27] elaptics: randomnick_: !gist
[10:54:28] techsethi: actually not. it works fine in dev environment.
[10:54:37] RoryHughes: elaptics: Are you sure? doesn't seem to be very logical
[10:54:37] techsethi: only is breaking on heroku
[10:55:01] elaptics: RoryHughes: dunno, I never use turbolinks myself - it's the first thing I turn off :)
[10:55:37] elaptics: RoryHughes: but I'm pretty sure that there's nothing in the request object that you can check. That's easy to find out in the api docs though
[10:55:38] RoryHughes: elaptics: well then....
[10:56:31] RoryHughes: elaptics: There is X-XHR-Referer: http://address, but i don't know how consistent that would be
[10:56:48] randomnick_: http://pastie.org/9142159 elaptics hope pastie is okay
[10:57:21] dopie: rvanlieshout,
[10:57:26] dopie: i did and it didnt working
[10:57:33] dopie: i put this in my application.js
[10:57:35] dopie: and it worked
[10:57:35] dopie: https://gist.github.com/staycreativedesign/3dab6b1930176a4f2cbf
[10:57:50] dopie: except when i to push it to production it gives me an error
[10:57:57] rvanlieshout: dopie: what error?
[10:58:03] elaptics: RoryHughes: no idea. http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-xhr-3F shows request object and there's nothing obvious there for finding out if the request was via turbolinks
[10:58:19] rvanlieshout: dopie: that js seems to be invalid cause of line 3. Maybe it'll also just work if you remove this js?
[10:58:42] elaptics: randomnick_: line 14, should be using address block variable not f
[10:59:44] RoryHughes: elaptics: i tried checking xhr? and it was nil with both normal and turbolinks requests, but the x-xhr-referer header is being set on turbolinks requests, i'm going to have a look at the js
[11:00:45] metus_violarium: rvanlieshout: so, does it mean, that if I don't want to send notification to user at 00:00 with other users, I could just set proper timezone and his events won't be selected?
[11:01:22] randomnick_: elaptics how does it look like?
[11:01:33] rvanlieshout: metus_violarium: i don't know what you're exactly trying to do, but you should store everything in UTC and care about time zones only for display and input purposes
[11:03:26] elaptics: randomnick_: oh, I didn't read your code properly...that actually looks right. If you have nothing it's because it's now working properly and you don't actually have any associated object so nothing is rendered. You need to build an empty object, e.g. in your controller do an contractor.addresses.build or something
[11:04:34] dopie: rvanlieshout,
[11:04:35] dopie: http://gwhite.staycreativedesign.com/users/sign_up
[11:04:39] dopie: not working in production
[11:04:56] rvanlieshout: dopie: where to click?
[11:05:13] dopie: accept terms
[11:06:41] rvanlieshout: you still have a $(document).on("click.modal", 'a[rel="modal:open"]' in your css
[11:08:30] drager: I'm getting; "Couldn't find Topic without an ID" and I have no idea why... https://gist.github.com/drager/7a68ae00e62f724dcb57
[11:09:15] RoryHughes: elaptics https://github.com/rails/turbolinks/blob/master/lib/assets/javascripts/turbolinks.js.coffee#L41
[11:09:32] elaptics: drager: neither do we unless you provide enough info :)
[11:09:45] elaptics: drager: what request are you actually doing?
[11:09:46] drager: elaptics: Isn't that gist enought? :<
[11:09:50] rvanlieshout: drager: like a trace
[11:09:59] rvanlieshout: and the provided params for that request
[11:10:38] styrmis: Any suggestions for a simple way (perhaps a gem) for recording events and looking up when the last even of a particular type happened? Not finding anything quite fitting this yet
[11:10:45] elaptics: RoryHughes: ah, looks like you can use that - wonder why there's no nice method added in the request object for that then?
[11:11:33] RoryHughes: elaptics: In the ruby part of turbolinks, there is references to is, but for doing things like redirect_to :back
[11:11:34] drager: elaptics, rvanlieshout: Trace; https://gist.github.com/drager/7a68ae00e62f724dcb57#file-traceback params; https://gist.github.com/drager/7a68ae00e62f724dcb57#file-parameters
[11:12:10] drager: ah, solved it passing topic_id instead...
[11:12:11] elaptics: RoryHughes: probably to make turbolinks try and act like normal page requests...
[11:12:15] rvanlieshout: https://gist.github.com/drager/7a68ae00e62f724dcb57#file-topics_controller-rb-L54
[11:12:36] drager: rvanlieshout: Yeah, passed topic_id there instead now
[11:12:40] drager: so thanks guys
[11:12:48] RoryHughes: elaptics: exactly, and it does it really well :)
[11:13:18] rvanlieshout: drager: you should fix your request so that it uses id and not topic_id
[11:13:50] lukekhamilton: Newbie question: How do I find a subset of ActiveRecord object all with simlar name: ?
[11:14:43] drager: rvanlieshout: Hm
[11:14:49] digitalknight: anyone here familiar with AWS Ruby SDK?
[11:15:33] digitalknight: i suddenly am getting lines like Undefined method '[]' for #<AWS::S3::Bucket::a9>
[11:16:00] randomnick_: elaptics but it doesnt render me any address fields in form
[11:16:26] randomnick_: i successfully created address associated to contractor in console though
[11:16:30] drager: rvanlieshout: Why and how exactly?
[11:17:13] rvanlieshout: drager: what's the name of the controller?
[11:17:24] drager: topics_controller
[11:17:33] helpa: randomnick_: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[11:17:33] elaptics: randomnick_: !gist controller
[11:17:44] drager: and the route is nested in topics
[11:17:46] rvanlieshout: then one should pas a id if talking about a topic_id drager
[11:18:06] rvanlieshout: is this a collection action ?
[11:18:20] rvanlieshout: hang on.. away for a while. you can just leave it when it works. something to think about later.
[11:18:23] drager: rvanlieshout: https://gist.github.com/drager/7a68ae00e62f724dcb57#file-routes-rb-L14
[11:18:41] rvanlieshout: in that case a topic_id is correct for the nested topic
[11:18:47] randomnick_: http://pastie.org/9142207 elaptics
[11:18:50] drager: Yeah, thanks for the help rvanlieshout
[11:19:52] randomnick_: this is contractor controller
[11:20:41] elaptics: randomnick_: there is nothing there where you're doing the build like I said
[11:32:22] jammanbo: mikecmpbll: Yes, that is the correct analysis. The thing is abandonware and should not be used
[11:33:07] jammanbo: I hacked around it, relatively neatly, by adding a scope method which adds my scope to both the class and the DataMapper::Collection, thus avoiding the issue
[11:33:19] jammanbo: not proud but still pleased
[11:34:58] joy4u: when creating link <%= link_to {:controller=>'requests', :action=>'accept_toggle', :id=>@request.id}, :method=>:post, :data=>{:toggle=>"tooltip", :placement=>"right"}, :title=>"Click on the link to pause/start accepting proposals.", :class => 'button white' do %>
[11:34:59] joy4u: <i class="fa fa-ban">Start accepting proposal</i>
[11:34:59] joy4u: <% end %> getting error
[11:37:04] rvanlieshout: joy4u: that's nice
[11:37:42] joy4u: rvanlieshout: but getting error
[11:37:54] rvanlieshout: and should we now guess what error?
[11:39:14] joy4u: rvanlieshout: SyntaxError
[11:39:53] rvanlieshout: there is no } before do
[11:42:49] joy4u: rvanlieshout: after link_to {...} do
[11:45:50] rvanlieshout: joy4u: :class => 'button white' do %>
[11:45:54] rvanlieshout: joy4u: :class => 'button white' } do %>
[12:10:13] nettoweb: guys, Im creating a job board, but creating the user at the ame time that job itself, Im doing this in controller. Im wondering if have some better way to achieve this. my action is here: https://gist.github.com/osnysantos/67a5dd4e527454529b2a
[12:10:24] greengriminal: This is going to sound dumb really dumb but here it goes. Using rails 4.0.4 and when you generate a scaffold its supposed to generate the controller actions right?
[12:11:10] greengriminal: so say if you do something simple like rails g scaffold User first_name:string last_name:string location:string about_me:string this would generate the controller, migrations and views correct?
[12:11:45] greengriminal: I mean the views are generated but its just the controller actions that are not being generated.
[12:12:18] mikecmpbll: it will generate the CRUD actions, yeah.
[12:12:53] mikecmpbll: jammanbo: good stuff! why are you using it, exactly? heh
[12:14:56] elaptics: nettoweb: is the user actually associated with a job?
[12:16:08] elaptics: nettoweb: then using nested attributes is probably more idiomatic rails
[12:17:13] elaptics: nettoweb: or with the code you have - there's no need to re-find the user on line 10
[12:17:57] elaptics: nettoweb: the other thing here is that can users create more than 1 job?
[12:18:26] nettoweb: elaptics: yes
[12:18:31] elaptics: nettoweb: because what will happen here then the user already exists and how do logins affect this?
[12:18:41] elaptics: cos if the user doesn't exist then they won't be logged in
[12:19:05] nettoweb: elaptics: yes, I???ll try use nested attributes
[12:19:28] elaptics: nettoweb: if it were me and this job + user creation is a one off thing then I'd make a specific controller and maybe service object for this use case
[12:19:49] elaptics: i.e. treat this like a registration form
[12:20:00] nettoweb: elaptics: right
[12:20:01] elaptics: a one-time thing a user has to do
[12:20:43] elaptics: not least because I presume you'll want a different form for this than the normal job creation
[12:20:56] jammanbo: mikecmpbll: Why do any of us do stupid things? Management
[12:21:05] mikecmpbll: jammanbo: oh boy.
[12:21:22] greengriminal: mikecmpbll: Okay so for some dumb unknown reason i generate my scaffold and rails wants to generate my controller with class UserController < InheritedResources::Bae
[12:21:32] greengriminal: never even seen such thing
[12:21:59] jammanbo: To be fair, there are some sort of legacy database things involved so their decision was guided by that, but it would have been easier and quicker to use AR
[12:22:01] elaptics: greengriminal: are you using inherited resources?
[12:22:09] mikecmpbll: looks like it.
[12:22:28] greengriminal: well maybe my rvm env has inherited resources thats what it probably is
[12:22:35] elaptics: greengriminal: ok, better question. Do you have it in your gems?
[12:22:53] mikecmpbll: jammanbo: not sure why/how that would constrain you to datamapper?:)
[12:23:01] elaptics: because I'd bet it's got some hooks into scaffolding and that's what's doing this
[12:23:26] greengriminal: elaptics: found it. Am using RubyMine and looked in my Ruby SDK for Ruby-2.1.1 and it does have inherited_resources
[12:23:32] mikecmpbll: activeadmin uses it too, i think.
[12:24:49] greengriminal: Never used inherited_resources but apparently it speed up dev by making your controllers inherit all RESTful actions so you just focus on whats important
[12:25:06] mikecmpbll: that's the idea.
[12:25:07] greengriminal: maybe i should actually look into this, but i just find it extremely weird not seeing my actions in my controller.
[12:26:06] elaptics: I've thought about it too, but I've found that most of my actions are pretty minimal anyway and I'd prefer to stick to that more standard rails convention there to make it a bit easier for any later devs that come along
[12:26:12] mikecmpbll: i don't find it particularly irksome to write about 20 lines to get CRUD actions, but i dunno maybe it does more than i imagine.
[12:26:21] mikecmpbll: what elaptics said ????
[12:28:28] greengriminal: also for those who want to stick with the standard rails generated controller add the following to your application.rb "config.app_generators.scaffold_controller = :scaffold_controller"
[12:34:27] greengriminal: Here's another question so I am building a Rails + Angular app and theres some features like votable, commentable that I want to implement. I am fully aware of the gems out there. My question is would it better to use the gems considering their easy to drop in place or to roll out these features by yourself.
[12:35:25] greengriminal: Also just to put it out there I have used these gems before. But personal opinions, with regards to development and the amount of time spent would it not just be wise to use the gems out there?
[12:37:42] rvanlieshout: greengriminal: it depends
[12:37:58] rvanlieshout: greengriminal: a) does the gem do what you exactly want
[12:38:05] greengriminal: rvanlieshout: Yes
[12:38:09] rvanlieshout: greengriminal: b) is it bloated with things you're not going to use
[12:38:15] rvanlieshout: greengriminal: c) is it maintained properly
[12:38:21] mikecmpbll: c) is it easy to do what you want to do yourself
[12:38:24] rvanlieshout: greengriminal: d) do you feel happy with how it's made
[12:38:34] randomnick_: http://pastie.org/9142449 how can i shorten this?
[12:38:36] greengriminal: rvanlieshout: I like your last point.
[12:38:54] rvanlieshout: randomnick_: .controls.row= f.input_feeld :street
[12:39:00] mikecmpbll: if it's easy to do it yourself there's so much benefit to be had from not using the gem, even if the gem does /exactly/ what you want.
[12:39:01] rvanlieshout: remove the br and give your label a display: block
[12:39:27] mikecmpbll: that's why i always roll my own auth
[12:39:28] rvanlieshout: mikecmpbll: also true
[12:39:42] greengriminal: so you'd never use devise?
[12:39:52] rvanlieshout: mikecmpbll: but that includes in can i make sure what i create is safe or do we have the benefit of others also looking at this code
[12:40:16] rvanlieshout: greengriminal: f) are you willing to spend time to create this over maybe some non-used features
[12:40:30] rvanlieshout: i do use devise
[12:41:16] mikecmpbll: devise does a lot of advanced stuff, if i wanted todo any of that stuff i'd probably use it too.
[12:42:18] rvanlieshout: greengriminal: f) don't ever use a black box
[12:42:22] rvanlieshout: always make sure you know what it does
[12:42:38] greengriminal: I think i will just roll these out myself
[12:42:48] greengriminal: at least i know fully well what it is doing
[12:43:12] rvanlieshout: or invest a bit of time in knowing about what the gem does
[12:43:16] rvanlieshout: what gem are you considering?
[12:44:01] tubbo: greengriminal: tbh i've had better luck just implementing those things myself rather than using a gem
[12:44:01] greengriminal: i was going to use acts_as_commentable_with_threading and acts_as_votable.
[12:44:31] tubbo: indeed, both of those are pretty easy to build backend-wise with a basic knowledge of polymorphic associations and self-referential joins
[12:44:42] greengriminal: tubbo: I agree, I think i will just do it myself.
[12:44:54] tubbo: the hard part has always been the UI, for me...but if you're using Angular that might not be so hard after all.
[12:45:42] greengriminal: Yeah, well another thing I was also consdiering regarding the api is either A) use rails-api or B) use grape.
[12:45:57] greengriminal: The UI part will be very straight forward.
[12:46:01] tubbo: greengriminal: well, you probably can't/won't want to use Grape if you're building this whole thing with Rails...
[12:46:23] tubbo: and i would steer clear from RailsAPI until you absolutely need it. it's basically just a stripped-down ActionController.
[12:46:48] greengriminal: tubbo: The client-side is Angular and the backend is going to be RoR.
[12:47:47] tubbo: greengriminal: right. grape is more suited to tasks that you wouldn't use rails for
[12:48:21] alex88: greengriminal: need to create api for angular?
[12:48:39] greengriminal: alex88: Yeah i do, I think i will go with grape because its something that I use at work.
[12:49:09] alex88: greengriminal: why not just rails?
[12:49:17] tubbo: greengriminal: so you're saying you're gonna bring in a whole gem + sinatra...just to build something you can do with rails?
[12:49:18] alex88: use it plain with jbuilder
[12:49:27] tubbo: or active_model_serializers
[12:50:05] alex88: tubbo: I don't remember why but I've found some limitations using it, jbuilder with partials are awesome to me
[12:50:27] greengriminal: alex88: I could with just using rails. But thought to give grape a go because I've only started using it at work and thought it be a challenge. However on the contary I agree it wouldn't be wise to introduce a dsl into the app.
[12:50:32] tubbo: alex88: i use ember, which has a whole AMS adapter built into it, so i haven't noticed any problems. but it is very opinionated, i know that.
[12:50:54] greengriminal: active_model serializer are pretty awesome i have to say.
[12:51:52] tubbo: greengriminal: yeah using Grape is just unnecessary complexity. whoever has to deal with this app after you're gone is going to constantly make fun of you;
[12:52:00] tubbo: greengriminal: you don't want other developers to make fun of you, right? :)
[12:52:23] tubbo: OTOH, Grape is *really* good for when you have a regular HTML/server-side template app that you need to build a little API on top of
[12:53:33] c0d3_k1ra: Thanks apeiros :)
[12:53:34] Tzeejay: Hey guys, is there a rake command to change a column from a string into an integer? I tried doing it myself with an empty migration but rake is aborted all the time
[12:54:03] alex88: Tzeejay: change a column type with an empty migration?
[12:54:03] elaptics: Tzeejay: not a rake command. You just need to create an appropriate migration
[12:54:45] Tzeejay: alex88: That is what I tried but rake is aborted all the time...
[12:55:06] greengriminal: Tzeejay: you need to create a migration with change_column :table, :column_name, :integer
[12:55:10] alex88: just use "change_column :table_name, :column_name, :integer" into the migration, be sure to use on a test database to check it's converting the values correctly
[12:55:12] elaptics: Tzeejay: I imagine that it's aborting because you have an empty migration...
[12:55:23] alex88: Tzeejay: paste the migration and the rake command output
[12:57:20] Tzeejay: alex88: I created an empty migration with 'rails g migration ChangeColumnsToIntegers' then opened that empty migration and used this code 'change_column :user, :is_Admin, :integer'
[12:57:21] Tzeejay: def change
[12:57:21] Tzeejay: change_column :user, :is_Admin, :integer
[12:57:21] Tzeejay: change_column :user, :permition, :integer
[12:57:54] alex88: and the rake output? btw use gist.github.com for pasting
[12:57:55] alex88: not channel
[12:59:07] Tzeejay: alex88: sorry. here https://gist.github.com/DonEichi/5183192a2d17e6343b0b
[12:59:43] alex88: you're missing an end after the last change_column
[13:01:41] Tzeejay: alex88: okay I get a different error now. haha. Thanks. I think I can figure this out myself though ;)
[13:02:03] alex88: kk good ;)
[13:09:21] Criten: Hello Ainieco
[13:10:22] Ainieco: is there any function for non overwriting model update ? i.e. if model field's value is nil then this field should be updated with supplied attribute otherwise ignore such field
[13:11:29] tubbo: bah, i wish there was a cleaner way to expose certain attributes as different types
[13:11:57] Ainieco: e.g dog = Dog.new(name:nil, age:3); dog.magic(name 'Bobert', age: 10) => <Dog name: 'Bobert', age: 3>
[13:12:01] tubbo: like say i have an HSTORE...and i want to be able to reference keys using symbols. i can do read_attribute(:my_hstore).with_indifferent_access...but only if :my_hstore isn't `nil`, otherwise it blows up :(
[13:12:30] tubbo: Ainieco: nothing that exists currently, iirc
[13:12:37] Ainieco: okay, thanks
[13:13:19] tubbo: Ainieco: i'm pretty sure you can take care of that in validations...
[13:13:25] tubbo: s/in/with
[13:15:02] Ainieco: ugh, i'd rather not, this should be a function which i could i apply freely whenever i please, such validations will make work with that model a nightmare because not 100% of the time such bvehaviour is needed
[13:17:09] tubbo: Ainieco: well, you could use a module and AS::Concern to reuse those validations all over the place
[13:17:32] tubbo: Ainieco: but what exactly are you trying to do here? try to explain in real terminology, not what you're implementing
[13:17:42] elaptics: Ainieco: sounds like you should be creating a decorator object to wrap your AR model and make it act how you want it, and to use that when you need to have this specific behaviour
[13:18:26] tubbo: btw, there's no such thing as "functions" in ruby :) they're all methods of some object somewhere.
[13:18:28] Tzeejay: alex88: okay I don't get it. It just wont work :/ https://gist.github.com/Tzeejay/25ad4387f43bc3ad4bd6
[13:20:07] tubbo: Tzeejay: would be really awesome if you added 'db/migrate/20140505124439_change_admin_and_permition.rb' to that gist...
[13:20:29] tubbo: Tzeejay: the error is meaningless
[13:20:52] tubbo: you probably have a syntax error judging by the error text but there's no point in speculating until you show us the code
[13:21:39] Ainieco: elaptics: oh, that's way too complex for such easy task, i'll just define function wrapper around ror "update" method.
[13:21:40] Tzeejay: tubbo: Should I post the migration code then?
[13:21:58] elaptics: as an aside I'm curious what permition is?
[13:22:16] tubbo: Tzeejay: no, i didn't just spend about 3 messages instructing you to do that. :P </sarcasm> </obvious>
[13:22:27] tubbo: elaptics: a mis-spelling of "permission" i'd assume
[13:22:51] elaptics: Ainieco: actually it's the simplest OO thing I can think of. But define "easy task", bearing in mind that what you want to do is not how AR was designed to work...
[13:24:11] Tzeejay: https://gist.github.com/Tzeejay/6e9cf5b53a97cacb1390
[13:24:14] tubbo: elaptics: i still think mixing a module into a couple AR classes is way easier than what you described.
[13:24:41] Tzeejay: elaptics: oh fuck. That's embarassing. I shouldn't do stuff like that in the middle of the night -.-
[13:24:47] Ainieco: elaptics: 5 lines of code, generic function which will work with every model ever made -- simple; OO, >5 lines of code, decoration. method name clashes -- complex
[13:25:27] tubbo: Tzeejay: an interesting surprise.. http://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
[13:25:29] elaptics: tubbo: maybe, depends how much other checking needs to be done, and why this behaviour is needed in some cases or not others
[13:26:14] elaptics: tubbo, Ainieco: maybe the app is simple enough to just bung more responsibilities into the same class
[13:27:23] tubbo: Tzeejay: no wonder you were having trouble! my suggestion is to stop using sqlite immediately for development. instead, go through the trouble of installing postgres locally. postgres comes with secure defaults and has some really nice CLI tools for managing users and DBs.
[13:27:32] elaptics: Tzeejay: I guess you don't want me to point out the is_Admin bit too then? :)
[13:27:35] tubbo: either that or mysql, whatever you're running this on in prod
[13:27:39] Tzeejay: tubbo: Nice so no changing huh....
[13:27:56] Ainieco: thanks for feedback!
[13:28:45] Tzeejay: tubbo: I will change in the future. But since SQLite is lightweight and I'm still new I thought I just stick to it to learn basics. Oh well guess I have to got the long way now
[13:28:52] Tzeejay: tubbo: Thank you!
[13:29:01] tubbo: Tzeejay: nah, if you're just learning my suggestion is to just rm the database lol
[13:29:19] tubbo: Tzeejay: go back, edit the create_* migration instead of adding this change_column migration, get on with your life. ;)
[13:29:41] Tzeejay: tubbo: yup will do that....
[13:29:59] tubbo: migrations are *really* useful when you need to make schema changes to a database that's already filled with production data
[13:30:50] Tzeejay: there should really be a guide for databases and servers to explain up and downsides and so on
[13:37:31] emka: Having troubles with minitest, bdd and Devise. getting undefined method ???env??? Anyone got ideas? https://gist.github.com/emilkarl/0446a0e96a8dbf47a337
[13:41:23] i42n: Hey, does anyone know what this error means? https://gist.github.com/i42n/cd60fd03f695b673cbcb I just migrated from sqlite to postresql.
[13:43:23] gavit: in rails there is a form_for with a collection_select. How would you fill multiple fields based on the select?
[13:47:50] dEPy: if I have single page app, do I need to escape html/js on server side (api) also? or only on client (browser) side?
[13:49:28] emka: How do I run devise tests i rails 4.1 with minitest? getting undefined method `env' for nil:NilClass https://gist.github.com/emilkarl/0446a0e96a8dbf47a337
[13:56:00] c0d3_k1ra: I am a beginner in ruby on rails ... I have installed rails 4.1.0 in my system... I just need to know some study guides or tutorial that can prove to be beneficial for a beginner.
[13:58:55] ryansfl: hey guys, I just moved to a different mac and now when I try run bundle install or specifically gem install pg it continually crashes
[13:59:00] ryansfl: I???m not really sure why
[13:59:48] jammanbo: Does CanCan offer any protection on updates if you model accepts_nested_attributes_for an associated model?
[13:59:53] kies: c0d3_k1ra, see http://guides.rubyonrails.org/getting_started.html and http://www.railstutorial.org/book . if you don't know ruby i recommend reading learn to program by chris pine 2nd edition
[14:00:17] ryansfl: gist: https://gist.github.com/soilforlifeforms/5de0bc7b1ac0af161010
[14:00:25] randomnick_: http://pastie.org/9142646 its bad code right? how would an example decorator look like it this case?
[14:00:40] c0d3_k1ra: @kies I know ruby fairly :) n thanks for the links :)
[14:01:31] kies: ryansfl, do you have postgres installed locally?
[14:02:12] ryansfl: Kies: I have pgadmin installed localy
[14:04:56] kies: you should prob install postgres via homebrew
[14:06:48] ryansfl: ok I???ll try that Kies. thanks
[14:07:47] c0d3_k1ra: @keis what would you suggest ? should I start learning on rails 4.0.4 or 4.1.0 ?
[14:08:29] kies: c0d3_k1ra, the difference is pretty insignificant but you might as well start with the latest and greatest
[14:08:31] Cork: anyone know if there is a way to get the model name from an ActiveResource::Collection?
[14:09:43] c0d3_k1ra: ok thanks kies :)
[14:12:45] stan_br: Hi all. Is there an easy way to show the current rails server uptime? Is there a way to get (or where is the best place to set) what time the server started?
[14:16:22] Cork: stan_br: http://stackoverflow.com/questions/18465962/is-there-a-way-to-get-the-elapsed-time-that-a-rails-server-has-been-running-for
[14:17:33] stan_br: Cork: thanks =)
[14:17:37] joelbrew1r: good morning folks! I'm still new to ruby/rails and I'm wondering if there is a better way to write this code: https://gist.github.com/JahBrewski/2f1493f9c9917565f3d0
[14:17:51] joelbrew1r: the file seems and bit messy and in need of a refactor
[14:18:01] randomnick_: http://pastie.org/9142646 its bad code right? how would an example decorator look like it this case? :)
[14:21:21] chrislerum: joelbrew1r: could assign css classes to string instead of repeating it
[14:22:33] spikensbror: joelbrew1r: should also try and refactor that so you don't have that much logic in the view.
[14:22:37] chrislerum: joelbrew1r: but main thing maybe is the logic in the view. could move the decision of what form to render to the controller
[14:23:18] spikensbror: I mean, the buttons only differ in caption so you could dry it up a lot.
[14:25:02] joelbrewer: spikensbror: chrislerum: how would I go about moving the logic to the controller?
[14:25:54] spikensbror: well, step one would obviously to move those if statements to the controller and then take it from there.
[14:26:00] chrislerum: joelbrew1r: hmm, short question with long answer - recommend you give it a try, if it doesn't work, gist your attempt
[14:26:19] spikensbror: you could probably even push that up into model validations
[14:26:28] joelbrew1r: chrislerum: sounds good :) I'll be back..
[14:26:38] chrislerum: is that a threat?
[14:27:53] frank_o: With this setup to display some products from the Amazon API: https://gist.github.com/frankie-loves-jesus/89d24dd88579c7f912f3 -- should line 3-15 of main_controller.rb be moved to a model or a helper?
[14:28:41] frank_o: Or should it stay
[14:28:46] frank_o: ACTION looking for the most Railsy way
[14:28:59] frank_o: mic. dropped.
[14:30:05] chrislerum: pic yo mic up, son, this ain't over yet
[14:30:56] chrislerum: frank_o: my impression is it's fine where it is, fwiw
[14:31:12] frank_o: chrislerum: yeah u wanna battle? lol
[14:31:12] spikensbror: frank_o: Best practice would probably to separate the AWS-related logic to a model.
[14:31:20] sevenseacat: i feel like we've written more of this api thing for frank_o than he has
[14:32:51] frank_o: chrislerum: cool thanks
[14:33:00] frank_o: spikensbror: cheers will look into it
[14:33:14] frank_o: sevenseacat: and you
[14:33:22] frank_o: well you're just adorable :)
[14:33:53] spikensbror: since the controller shouldn't be responsible for actually grabbing data after all ^^
[14:33:53] sevenseacat: thanks... i think.
[14:33:54] chrislerum: frank_o: no need for var raw_products, but you prob know that
[14:34:47] frank_o: yeah i see that now
[14:38:39] dean_fields: Does anyone know of any resources, books etc for using elasticsearch's new gems with rails?
[14:41:27] joelbrewer: chrislerum: alright, I moved the logic to the controller: https://gist.github.com/JahBrewski/2f1493f9c9917565f3d0
[14:41:45] joelbrewer: chrislerum: but now I feel like the controller needs to be dryed up..
[14:42:32] chrislerum: sevenseacat: be nice, we're learning here
[14:42:50] joelbrew1r: chrislerum: sevenseacat haha :) I'm new :)
[14:44:29] joelbrewer: chrislerum: sevenseacat so how can I make this less gross?
[14:45:06] sevenseacat: first off, explain to me what you're attempting to do
[14:46:09] joelbrewer: sevenseacat: Alright, each user has a profile and the profiles have a number of state values they can be in.
[14:46:37] joelbrewer: sevenseacat: This logic is for displaying the correct button on the user's profile page.
[14:47:18] joelbrewer: sevenseacat: First, the user clicks the button to submit their profile for approval.
[14:47:27] joelbrewer: sevenseacat: Then an admin either accepts/rejects the profile
[14:47:37] joelbrewer: sevenseacat: Then, the user has the ability to publish their profile to make it public
[14:47:50] joelbrewer: sevenseacat: (if it has been approved)
[14:48:05] sevenseacat: okay im with you
[14:48:13] joelbrewer: sevenseacat: cool :)
[14:48:31] elaptics: joelbrewer: the best thing is that all this logic and view related stuff should be in some kind of presenter or decorator object for the profile object
[14:48:36] sevenseacat: so really, the controller doesnt give two hoots that the view is going to pick a button to display
[14:48:46] elaptics: it's definitely not the controllers responsibility
[14:49:02] sevenseacat: and i would just make it a button, i wouldnt make hidden fields and all that jax
[14:49:11] Fire-Dragon-DoL: it's safe to use ruby 2.1 now? I've read there were a few issues lately
[14:49:25] sevenseacat: hidden fields invite people to tamper with them
[14:49:27] elaptics: joelbrewer: at the very least it should be in the view, using helpers and/or partials to keep the view files simpler
[14:49:32] Fire-Dragon-DoL: sevenseacat: ajazz? :P
[14:49:45] elaptics: Fire-Dragon-DoL: lol
[14:50:30] seanstickle: I have a model (exams) that has_many :questions, through: :answers, and I'm trying to figure out if there's a standard, semi-elegant way to validate that the exam has an answer for each question... quick ERD here: http://i.imgur.com/xfgnEtF.jpg
[14:50:31] elaptics: joelbrewer: is the hidden field stuff just for managing the state?
[14:50:40] joelbrew1r: elaptics: yeah.
[14:50:47] sevenseacat: if it were my code i'd have separate actions to deal with submitting for approval, pulling from approval, publishing, and unpublishing, and then have the button in the view to the right action depending on the current state
[14:51:23] elaptics: joelbrew1r: well I'd use a state machine for managing and controlling that at least - then the user can't mess with the correct order of things - you can also query the current state to figure out the correct button to show
[14:51:27] sevenseacat: eg. link_to 'Submit for approval', submit_user_profile_path if @profile.not_submitted?
[14:51:52] joelbrew1r: sevenseacat: arghhhhhh. that's what I had yesterday but everyone told me that was a terrible way to do it!
[14:51:55] seanstickle: I'm set to loop through all the questions and check for an answer, but that seems ... inelegant.
[14:51:56] elaptics: joelbrew1r: and I'd do what sevenseacat just suggested - I typically just add extra member actions to the resource as, e.g. PUT, requests
[14:52:12] joelbrew1r: elaptics: .... that's exactly what I had yesterday
[14:52:31] elaptics: joelbrew1r: give us everyone's names so me and sevenseacat can go round and give them a beating then :)
[14:52:38] chrislerum: joelbrewer: i'm with them - who told you it was bad yesterday? names
[14:52:41] joelbrew1r: joelbrewer: people told me I shouldn't mess with the default controller actions and dirty up my code like that
[14:52:56] chrislerum: joelbrewer: that's nonsense
[14:53:13] sevenseacat: you are not limited to the default seven actions in a controller
[14:53:15] chrislerum: your controller is your bitch
[14:53:27] joelbrew1r: haha. alright then.
[14:53:42] elaptics: joelbrew1r: git revert...
[14:53:49] joelbrew1r: That's the problem with being new. I never know when I actually AM right
[14:54:08] sevenseacat: unfortunately thats true, and its hard to know if the advice you're getting is good
[14:56:18] sevenseacat: believe me, im much in the same boat right now when it comes to ember stuff, everyone tells you something different >_<
[14:56:33] tubbo: ^ that's because shit changes from week to week
[14:56:42] tubbo: at least rails' API is a bit more stable right now
[14:56:46] chrislerum: sevenseacat: at least they can't tell you to put logic in your view
[14:56:48] tubbo: ember-data is still a mess :(
[14:56:52] joelbrew1r: sevenseacat: yeahh. how are you liking ember? I went to an awesome ember talk at RailsConf!
[14:57:21] tubbo: joelbrew1r: the idea is that you shouldn't mix concerns in your controller. so your PostsController shouldn't have a create_comment action, for example. it's all about what you're doing and what context you're in.
[14:57:32] sevenseacat: still trying to wrap my head around it - seems there's 100 ways to do anything, but anyway, thats kinda off-topic, just wanted to empathize :)
[14:57:43] tubbo: joelbrew1r: but no, there's no hard rule like your controllers HAVE to have certain methods in them, it's just that there are certain methods that map automatically to REST verbs.
[14:58:24] tubbo: sevenseacat: have you watched any of Tom Dale's talks on it?
[14:58:26] joelbrew1r: tubbo: gotcha. so you agree that in this case it's fine to have multiple controller methods?
[14:58:28] tubbo: talks/screencasts*
[14:58:45] gavit: I want to have a model "Customer" where if country isn't filled in, it automatically placed a default value. How do I edit params[:customer] for @customer = Customer.new(params[:customer])?
[14:58:50] spikensbror: joelbrew1r: also, you can omit the @hidden_field_value and make the action determine that.
[14:59:14] spikensbror: joelbrew1r: like the action that the form is submitted to
[14:59:18] tubbo: joelbrew1r: yeah. what you're doing there is basically reinventing the model validation/callback wheel :)
[14:59:21] tubbo: also the state machine
[14:59:24] sevenseacat: hidden fields for the same of passing data around make me antsy
[14:59:54] joelbrew1r: tubbo: what do you mean by the "state machine" ?
[14:59:56] tubbo: sevenseacat: i pretty much didn't get Ember at all until i watched those talks. in a few of them, you can actually watch him build a full ember app from scratch.
[15:00:00] kies: i liked this talk, tom dale seems like a cool dude http://vimeo.com/68215606
[15:00:11] elaptics: joelbrew1r: do you know what a state machine is?
[15:00:25] tubbo: joelbrew1r: you're reinventing "the state machine wheel", is what i meant. in other words, you're basically implementing a state machine here.
[15:00:57] joelbrew1r: elaptics: not exactly?
[15:01:08] sevenseacat: tubbo: any you'd recommend?
[15:01:14] joelbrew1r: elaptics: (do I know what a state machine is)
[15:01:17] chrislerum: gavit: @customer.country.nil? && @customer.country = "USA!" or something like that
[15:01:45] elaptics: joelbrew1r: what is your current understanding?
[15:02:04] seanstickle: @customer.country ||= "USA"
[15:02:28] joelbrew1r: elaptics: Well, I suppose a state machine would simply be a way to manage the state of an object.
[15:03:03] chrislerum: gavit: what seanstickle said is bettre ^^
[15:03:37] seanstickle: Any good examples of an exam written in Rails? Trying to figure out how to validate that all questions have been answered... Probably applies to a survey as well.
[15:03:52] tubbo: sevenseacat: i liked this one http://www.youtube.com/watch?v=1QHrlFlaXdI
[15:04:09] chrislerum: joelbrew1r: check out http://weblog.rubyonrails.org/ search for 'state machine'
[15:04:22] tubbo: sevenseacat: yehuda's peepcode play by play was also *really* informative, and i still think is a great watch if you're interested in why ember is constructed in such a way.
[15:04:45] sevenseacat: i watched one peepcode video, and it was horribly out of date even when i watched it months ago
[15:04:49] tubbo: sevenseacat: but it's become outdated now with the new ember routing API, as well as the umpteen changes to ember-data since that point. he's still manipulating the StateManager, for example..
[15:06:14] elaptics: joelbrew1r: well, that's the essence of it. I like the description in the readme of the state_machine gem https://github.com/pluginaweek/state_machine (which is what I usually use in my apps)
[15:06:20] joelbrew1r: elaptics: ahh, alright. So I was using a number of booleans to manage my state.
[15:06:25] joelbrew1r: elaptics: I was just reading that!
[15:06:25] EminenceHC: seanstickle: I created an exam based on this: http://railscasts.com/episodes/196-nested-model-form-revised
[15:06:49] joelbrew1r: elaptics: So should I use that gem? Or is there a built-in rails way to do it?
[15:07:35] elaptics: joelbrew1r: there's nothing built in to rails, that's the gem I use but there are others, depends on what you prefer. Also take a look at http://railscasts.com/episodes/392-a-tour-of-state-machines
[15:07:43] elaptics: that provides a few options
[15:07:58] magg: i'm trying to connect to a legacy database, using the sqlserver adapter. but i'm having problems. http://pastebin.com/ucbC84d1
[15:08:31] chrislerum: magg: 'helpa' is a bot, btw
[15:08:34] randomnick_: http://pastie.org/9142848 why i get undefined method `street' for nil:NilClass ?
[15:09:03] tubbo: magg: in your gist, make sure to include the source for "app/models/pga_budget_owner.rb" as well. you can add multiple files to a gist.
[15:09:07] seanstickle: EminenceHC: interesting! I've used nested fields before for multiple phone numbers and things. How did you adapt for exam tracking?
[15:09:20] magg: chrilerum, yeah
[15:09:21] seanstickle: EminenceHC: To ensure that each question had an answer....?
[15:09:24] chrislerum: randomnick_: because 'contractor.addresses.where(address_type: "address")' returns nil
[15:09:25] magg: ok tubbo.
[15:09:45] chrislerum: randomnick_: or, sorry, empty array
[15:10:10] joelbrew1r: elaptics: cool :) Also, does state_machine allow me to decide which users are allowed to set certain states?
[15:10:39] joelbrew1r: elaptics: For example, I only want admins to have the ability to set profiles in the "approved" state
[15:11:37] magg: tubbo: https://gist.github.com/mgonzalez-msights/7bd826ec557f8fe6b375
[15:11:56] randomnick_: chrislerum, thanks
[15:12:01] EminenceHC: seanstickle: Question has_many answers so you can validate if there is an answer set for each question.
[15:12:52] elaptics: joelbrew1r: well, it's up to you how you do that, but yes it's possible. I do that all the time
[15:12:59] chrislerum: joelbrew1r: there's 'before_transition', see the readme for state_machine
[15:13:13] elaptics: joelbrew1r: iirc the readme gives some examples of how you can put validations, etc to apply in given states
[15:13:38] joelbrew1r: cool! thanks guys.
[15:16:26] magg: so basically what I did to connect to the database was: installed and configured freetds, and installed the gem for the sql-server-adapter and tinytds. after that I ran rake db:schema:dump. Then I proceeded to create the model and tested it on the console
[15:17:22] spikensbror: magg: if you're connecting to sql server, I suggest you use Sequel ORM instead of ActiveRecord since the adapter for ActiveRecord is currently pretty wonky.
[15:17:43] sevenseacat: freetds? you poor bastard
[15:17:51] seanstickle: EminenceHC: ok, it looks like it's just validating by looping over the questions and checking for an answer on each.
[15:18:10] spikensbror: yeah, sql server is not fun to work with when it comes to rails
[15:18:13] magg: spikensbror: will check it out
[15:18:13] EminenceHC: seanstickle: Yeah I think thats how I did it.
[15:18:25] seanstickle: Not so different than what I came up with. I was hoping for something more ... I dunno ... Railsy.
[15:18:31] sevenseacat: not fun to work with from any non-windows platform, period
[15:18:31] seanstickle: But if it works, good enough.
[15:18:51] seanstickle: I remember using SQL Server when I first started with Rails, back in 0.8
[15:18:57] seanstickle: It was a heck of a time.
[15:19:11] spikensbror: depends, some frameworks work really well with SQL Server, though they are a minority
[15:21:14] seanstickle: Hallo Findegil
[15:21:38] joy4u: is deploying rails app in Hostgator on shared hosting a good choice?
[15:21:53] magg: is this it, spikensbror? https://github.com/TalentBox/sequel-rails
[15:21:55] Criten: joy4u: never heard of them
[15:22:36] Findegil: They are located in the states but thats pretty much my all knowledge about the gator
[15:22:38] joy4u: Criten: Hostgator is a WebHosting Company
[15:22:42] spikensbror: magg: I never got that one to work, however they claim that it works.
[15:22:48] spikensbror: so try it out
[15:22:55] Criten: joy4u: i figured that :) are you using their VPS or their just "web hosting" plan?
[15:23:08] spikensbror: otherwise, setting up Sequel manually isn't that much of a pain
[15:23:10] magg: spikensbror: haha ok
[15:23:20] joy4u: Criten: normal shared hosting plan
[15:23:26] Criten: Hmm. It says they support ruby on rails... i wonder what that includes for gem support
[15:23:48] Criten: I'm assuming that's what they limmit
[15:23:52] spikensbror: joy4u: depends entirely on what you're looking to do. it's not generally a good idea to use shared hosting for crucial things
[15:23:58] joy4u: Criten: does it effect the performance on shared hosting?
[15:24:22] joy4u: spikensbror: ok will it effect the performance?
[15:24:30] Findegil: joy4u i guess it depends on the app you're building
[15:24:44] makerops: im having some trouble with the grape gem; everything is working as expected, but I cant make a put
[15:24:45] makerops: https://gist.github.com/makerops/55e45fa279548940e619
[15:24:53] makerops: anything I am doing wrong?
[15:24:56] sam452: Trying to understand modestly complicated ActiveRecord queries. I want the records from Score where the inspection_id is 1 AND the item_id found in a collection. It doesn't strike me as a JOIN since it's all within one table.
[15:24:56] joy4u: Findegil: so what do you mean?
[15:25:00] spikensbror: joy4u: shared hosting is generally slower than VM or instanced hosting yes.
[15:25:07] sam452: I tried Score.where("inspection_id = ? AND item_id = ?", 1, survey.items) but that failed with a postgres adapter error.
[15:25:10] spikensbror: joy4u: consider it one of the lowest tiers of hosting
[15:25:12] Criten: joy4u: http://www.hostgator.com/popup/ror.html
[15:25:19] Criten: those are the only gems they really support it seems
[15:25:54] EminenceHC: I am using cocoon for a nested form. SignInSheet has_many SignIns. Do I need to have a controller for SignIns? For some reason my sign_ins are not being saved. https://gist.github.com/EminenceHC/c8fc6d9a68969d9f5d39
[15:26:02] Criten: which is why it's nice to have a vps, you can install whatever you want
[15:26:31] joy4u: Criten: but can't i install other gems on shared hosting?
[15:26:36] spikensbror: joy4u: you'd probably be better off with an AWS instance or cheaper-end VPS
[15:26:38] Findegil: joy4u if u are running it for a simple blog or personal website or something small in general would be fine i guess
[15:26:38] Criten: I'm not sure, i doubt it
[15:26:51] Criten: I could be wrong...
[15:26:53] Findegil: joy4u i also doubt it but from the link provided they say "some of the gems"....
[15:26:56] chrislerum: sam452: what's the output of survey.items
[15:27:20] joy4u: Criten: let me checkout for all of us
[15:27:21] Criten: I've just always used a vps for hosting rails apps :)
[15:27:34] sam452: It's a collection of items with its attributes. Which includes its id.
[15:27:35] Criten: joy4u: do their little live chat thing and ask :P
[15:27:44] Findegil: joy4u if you can afford it try digitalocean there should be some promo codes on the web as well so you get a bit more cash
[15:27:53] Criten: joy4u: https://digitalocean.com/
[15:27:55] joy4u: Criten: ok
[15:28:04] Criten: Is what I use
[15:28:08] joy4u: Criten: is Amazon a good choice than Heroku?
[15:28:23] Criten: joy4u: heroku is dead simple, if you can afford it it's a wonderfull service
[15:28:24] chrislerum: sam452: you may want survey.items.pluck(:id) and change 'AND item_id = ?' to 'AND item_id IN ?'
[15:28:43] Criten: joy4u: you have to do more manual settup with your own VPS
[15:28:52] Criten: heroku takes care of all of that for you
[15:29:20] Criten: We use heroku for allot of apps at wrok because we don't front the bill our clients do :P
[15:29:28] Criten: And then we don't need to worry about server config
[15:29:40] Findegil: Criten you recon the rails droplet of DO is not set up fairly well ?
[15:29:51] joy4u: Criten: but the main probelm is that they support PostgreSQL but the app is developed with MySQL
[15:29:55] Criten: Findegil: It is, but heroku is still easier ;)
[15:30:03] Criten: I use DO allot too.
[15:31:07] Findegil: joy4u http://www.hostgator.com/popup/ror.html says they have mysql too
[15:31:22] Findegil: altho the gem you would probably be using is mysql2
[15:31:34] Criten: Findegil: if i where to guess that's the gem they have installed
[15:31:38] Criten: they just didn't specify
[15:31:46] Macaveli: rvanlieshout, ben je er?
[15:32:14] Macaveli: hi elaptics
[15:32:14] spikensbror: Hostgator are pretty bad though in my experience, for personal use it's feasable but otherwise it's not worth it.
[15:32:46] joy4u: Findegil: i am saying that Heroku doest not support MySQL
[15:32:49] gavit: http://pastie.org/private/tncuhhd8n4gjtqdowy3g <- can anyone explain why my hash is merging incorrectly?
[15:32:59] Criten: joy4u: they use postgresql
[15:33:38] joy4u: Criten: yeh thats the prob :-(
[15:33:50] Criten: It should be fine for your app...
[15:33:51] chrislerum: gavit: gist what's wrong eh (expected vs. actual)
[15:34:02] chrislerum: gavit: or pastie if you must
[15:34:06] Criten: If you go through rails migrations, it should just work
[15:34:43] Criten: also.. https://addons.heroku.com/cleardb#ignite is their mysql solution
[15:34:47] Criten: so they do support mysql apps
[15:34:56] gavit: chrislerum: I was expecting to get a params[customer][country] = USA when blank. I now get customer has "no name" which leads me to think the params[customers] got wrong.
[15:36:21] joy4u: Criten: is Amazon more expensive than Heroku and more flexible?
[15:36:34] chrislerum: gavit: i mean, puts params at beginning of method, then again after the replace, so you can actually see what you're doing.
[15:36:34] Criten: joy4u: Amazon is cheaper i'd say
[15:36:46] Criten: joy4u: but more of your time to manage it
[15:36:49] Criten: so it's a trade
[15:36:51] sam452: poring through the PG error in syntax chrislerum:
[15:37:26] Criten: a micro instance of amazon
[15:37:38] Criten: 's vps was $14/month
[15:37:46] chrislerum: sam452: uh. huh? you got a new error stack you mean? let's see
[15:37:48] Criten: that was before they dropped prices.. not sure what it is now
[15:38:06] joy4u: Criten: so you will choose which one in terms of performance?
[15:38:23] Criten: I would personally go with digital ocean or heroku
[15:38:37] Criten: if you want to go the you-manage-it solution go with digital ocean, else go with heroku
[15:38:52] Criten: DO is cheap, and the ssd hosting is a nice speed boost
[15:38:57] gavit: chrislerum: in rails console?
[15:39:07] elaptics: joy4u: or you can use cloud66 to do most of the management stuff with someone like rackspace or digital ocean
[15:39:12] elaptics: much cheaper than heroku
[15:39:27] Criten: Oh yeah.. forgot about cloud66
[15:39:37] Criten: (tons of options!)
[15:39:48] chrislerum: gavit: no, in the log of the running app
[15:40:24] Criten: My advise is to get a droplet on DO and try your hand at setting your app up on it
[15:40:33] Criten: make a heroku account and put your app on there too
[15:40:46] Criten: It's free to have as manny apps as you want on heroku till you go live with it
[15:41:00] Criten: (they go inactive after 15 minutes and take 10 seconds to boot back up)
[15:41:01] chrislerum: Criten: ++, what you'll learn will be valuable for years
[15:42:06] Criten: Also DO charges per hour.. so if you decide you don't want to use it after a day of playing around.. you get charged (1/30*$5)
[15:43:23] tubbo: Criten: you can set it up to charge per day iirc
[15:43:33] joy4u: Criten: thanks a lot
[15:43:38] sam452: The results of the query in console: https://gist.github.com/sam452/77d3840cf15fdc26e98b chrislerum:
[15:44:07] sam452: The one with :pluck errored because it was looking in [1,2,3,4]
[15:44:24] Criten: tubbo: talking about DO? why wouldn't you just want it hourly?
[15:44:42] BigBlueBacon: Is there a clean way of adding custom behaviour every time an ActiveRecord result is read? Trying to process some metadata that's stored in a MySQL field and dynamically create methods to access that data.
[15:44:56] tubbo: Criten: iirc, hourly pricing is more expensive...
[15:44:57] chrislerum: sam452: so, that error is not with 'pluck'? then show the code that produced that error, kindly.
[15:45:00] tubbo: that's the only reason
[15:45:09] tubbo: Criten: sorry not per day, per month :)
[15:45:20] Criten: tubbo: oh gotcha :)
[15:45:22] Criten: yeah that makes sense
[15:45:57] Criten: What was that service that was like $1/month? $30 and you get it forevor?
[15:46:12] Criten: I remember people talking about it on here a few weeks ago
[15:48:05] elaptics: Criten: that was cloudatcost I think
[15:48:29] elaptics: Criten: http://www.cloudatcost.com/
[15:48:35] Criten: Yupp that was it!
[15:48:53] sam452: my updated gist shows effort with 'pluck'. https://gist.github.com/sam452/77d3840cf15fdc26e98b chrislerum:
[15:48:59] elaptics: I think a few people tried it but stability wasn't too good
[15:49:07] Criten: elaptics: Oh really?
[15:49:17] elaptics: Criten: I think tubbo has one?
[15:49:25] elaptics: I was going to, but didn't bother in the end
[15:49:46] chrislerum: sam452: if it's just that it doesn't like getting handed an array, can you try survey.items.pluck(:id).join(',') instead?
[15:50:26] Criten: elaptics: well i like their website atleast haha
[15:51:00] gavit: chrislerum: I dont see anything related in the dev log
[15:51:57] chrislerum: gavit: what, you have a `puts` statement in your method, and it doesn't print anything? try `puts 'AAAAAAAAAAA'` and see if that shows up. if not, you're not hitting that method.
[15:53:27] randomnick_: contractor.addresses.where(address_type: "address").first.voivodeship if !contractor.addresses.where(address_type: "address").first.voivodeship.nil?
[15:53:31] randomnick_: how can i shorten it?
[15:54:21] chrislerum: sam452: you may need parenthesis around the array of ids
[15:57:13] Criten: randomnick_: if you do it allot you can make a method on contractor
[15:57:13] elaptics: randomnick_: what are you trying to do? Can you gist some context
[15:57:25] Criten: or on the address... might be more appropriate
[15:57:40] Criten: actually.. it's on the collection so it would have to be on contractor
[16:00:08] randomnick_: http://pastie.org/9142992 elaptics this is my helper
[16:01:08] chrislerum: randomnick_: you're going to start with a comma if there's no street.
[16:01:37] BigBlueBacon: Is there a clean way of adding custom behaviour every time an ActiveRecord result is read? Trying to process some metadata that's stored in a MySQL field and dynamically create methods to access that data.
[16:02:14] chrislerum: randomnick_: start by setting a var to `contractor.addresses.where(address_type: "address").first and then deal with that throughout the method; no need to repeat it everywhere.
[16:03:12] Doophus: Hello, I'm trying to do something really basic with requiring a gem in the beginning of my controller, but just not getting anywhere.
[16:03:52] Doophus: I tried to install nas-yahoo_stock (1.0.8), can do require 'yahoo_stock' on rails console just fine, but when it came to requiring it in my controller it just couldn't find the file.
[16:03:55] Doophus: Anybody have any clues?
[16:04:39] chrislerum: randomnick_: then lines like my_var.street.present? && address << my_var.street + ','
[16:05:39] jthurman: Hi everyone. Is there a way to define an "artificial" field in a model as a DB function so that it can be used with queries? For example, suppose I have a "name" field, which is always in the form "Firstname Lastname." I'd like to be able to have a firstName field, defined as SUBSTRING_INDEX(name,
[16:06:01] jthurman: ' ', 1), such that I could do Model.where(:firstname => "Bob")
[16:06:51] Doophus: Ahh having the most basic, of basic issues lol.
[16:07:14] sam452: I'm sure putting the array in a string was wrong, but unsure how else to enclose that in parens, chrislerum: https://gist.github.com/sam452/77d3840cf15fdc26e98b
[16:09:49] banisterfiend: i have a column with a default value, i want to do another migration to chagne that deafult value to something else (that's all iw atn to change) how do i do that?
[16:09:59] Doophus: OH my god.... ... I just had to stop the server and restart ... *slaps forehead*
[16:10:32] randomnick_: http://pastie.org/9143029 chrislerum, please take a look
[16:10:56] randomnick_: what what you meant?
[16:11:11] chrislerum: sam452: no, won't work like that. try Score.where("inspection_id = ? AND item_id IN (?)"
[16:11:22] randomnick_: thats what you meant*
[16:11:52] chrislerum: randomnick_: pretty close - does that work for you?
[16:13:08] kebomix: how to force rspec test to fail n times and pass later?
[16:13:16] ericx2x: hey i am learning rails and i just made a scaffold of projects
[16:13:27] ericx2x: how do i assign each project to a user?
[16:13:48] ericx2x: as in if a user creates a project they get under that project that they've created it
[16:13:50] chrislerum: ericx2x: User.first.projects << Project.first
[16:14:05] ericx2x: chrislerum what?
[16:14:11] chrislerum: ericx2x: or @project.user = current_user or something
[16:14:33] elaptics: randomnick_: there's a much more ruby-ish way to do that :)
[16:14:43] ericx2x: hm so in the projects controller under create I write that?
[16:15:16] ericx2x: oh dang i didnt make a table for projects that has both the project name and a user field
[16:15:24] ericx2x: any easy way to revert a scaffold?
[16:15:29] ericx2x: besides deleting
[16:15:32] chrislerum: ericx2x: i'm assuming you have a current_user method; if you don't you'll have to make adjustments of course
[16:15:44] ericx2x: chrislerum i'm using devise
[16:16:06] tfittsy: I have a module called CommonNamedScopes that uses squeel to do something like scope :in_last_week, lambda { where{created_at > 1.week.ago}} I'm trying to get rid of squeel in my project so I can move to rails 4.1. Is there a way to get the variable for the table name so in my query it will be [model_tables].[created_at] instead of just created_at?
[16:16:10] chrislerum: ericx2x: don't revert, just generate a migration, add user_id to projects table
[16:16:27] elaptics: randomnick_: [ca.street, ca.zip_code, ca.city].compact.reject(&:blank?).join(", ")
[16:16:36] elaptics: randomnick_: ca = your check_address var
[16:17:06] elaptics: randomnick_: [ca.street, ca.zip_code, ca.city].compact.reject(&:blank?).join(", ") if ca.present?
[16:17:40] elaptics: I usually do something like that in my helper or decorator for address objects
[16:17:53] doubleemms: i'm really not sure how to debug this. why would a scope give me some records when i call it in the console, but zero when called via an actual request? any debug techniques?
[16:17:53] elaptics: sometimes just in the model itself if the app is pretty small and simple
[16:18:21] randomnick_: reject(&:blank?) removes empty strings?
[16:20:23] ericx2x: chrislerum i can simply edit my current create_projects.rb file and add a new column for user_id?
[16:20:27] ericx2x: then just run rake db:migrate?
[16:20:42] sam452: Yes, it still comes in as a string, it seems, chrislerum: https://gist.github.com/sam452/77d3840cf15fdc26e98b
[16:20:43] chrislerum: ericx2x: you have to generate a migration
[16:21:12] ericx2x: sorry im a bit confused. those action don't generate a migration?
[16:21:53] chrislerum: ericx2x: you'd type something like `bin/rails g migration add_user_id_to_projects user_id:integer`
[16:22:04] chrislerum: ericx2x: then run bin/rake db:migrate
[16:22:19] ericx2x: oh i see thanks
[16:22:45] helpa: doubleemms: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[16:22:45] elaptics: doubleemms: !code
[16:25:19] chrislerum: sam452: now that you have the parenthesis, remove the .join(',') bit - just tried it here, works with postgresql for me
[16:25:36] chrislerum: sam452: i see: WHERE (inspection_id = 1 AND item_id IN ('1,2')) for my app
[16:26:05] elaptics: chrislerum, sam452: what's the problem you're trying to resolve?
[16:28:13] chrislerum: elaptics: he started with 'query.rb' and result 'console output.txt' from this gist https://gist.github.com/sam452/77d3840cf15fdc26e98b
[16:28:37] chrislerum: elaptics: i'm trying to help him get those pesky ids in there
[16:29:30] elaptics: what version of rails?
[16:29:32] mcantor: I want to specify some really dumb serialization for an attribute. It's saved to the database as text. However, when I access it, it's split on "\n\n" into an array.
[16:29:57] mcantor: If I set the attribute to "['foo', 'bar', 'baz']", then it will be saved to the database as "foo\n\nbar\n\nbaz".
[16:30:22] drager: I'm having some trouble with a test getting "No route matches..." error and code; https://gist.github.com/drager/3246fcb05d9ae5eb75a3
[16:31:22] elaptics: chrislerum, sam452: should be as simple as Score.where(inspection_id: 1, item_id: survey.items.pluck(:id))
[16:33:13] sam452: YES, that's it! chrislerum:
[16:33:33] chrislerum: sam452: cool, also look at what elaptics said
[16:34:15] jthurman: http://stackoverflow.com/questions/23477111/queryable-artificial-fields-in-ror-models
[16:37:15] sam452: thx, elaptics:
[16:39:31] doubleemms: okay, here's the code i was referencing...
[16:39:32] doubleemms: https://gist.github.com/matt-morris/51b71e6540b595fc483b
[16:40:02] chrislerum: jthurman: first, you should simply have two fields, :first_name and :last_name. failing that, there's no need to use a db function, just user_name.split(" ") in ruby.
[16:41:09] savish: Can some one help me out? I think I am doing something wrong here http://stackoverflow.com/questions/23477324/cannot-access-my-api-in-the-browser
[16:41:09] chrislerum: jthurman: you could accomplish literally what you ask by constructing your sql manually, calling the db function, but very unconventional, therefore bad
[16:41:31] savish: I should be able to use access_token in the browser to access the api
[16:41:38] savish: but I seem to only be able to do it through cur;
[16:42:15] ericx2x: chrislerum okay i've got a user_id column in my projects table but when i do @project.user_id = current_user in my projects controller under the create action it is spitting out null as the value for the @project.user_id
[16:42:25] jthurman: chrislerum: Yeah, but then every time I want to involve the artificial field in a query, I have to do it manually, and if I later change something (different RDBMS, find a better way to do it, etc....) I'm changing a lot of things. Not very DRY.
[16:42:36] drager: I'm having some trouble with a test getting "No route matches..." error and code; https://gist.github.com/drager/3246fcb05d9ae5eb75a3
[16:42:37] chrislerum: ericx2x: @project.user = current_user
[16:43:11] ericx2x: that gives me an error
[16:43:18] chrislerum: jthurman: virtual attributes
[16:43:23] ericx2x: the column i have in my projects table is called user_id
[16:43:51] chrislerum: ericx2x: what error
[16:44:04] ericx2x: ACTION undefined method `user=' for #<Project:0x00000104addd10>
[16:44:07] chrislerum: ericx2x: gist your Project model
[16:45:10] ericx2x: my project model is essentially blank..
[16:45:25] chrislerum: jthurman: think you've got something backwards. by having it db function dependent, you're going to have trouble changing to different db.
[16:45:28] ericx2x: it simply extends from activerecordbase
[16:45:47] drager: ericx2x: It shouldn't belong_to user?
[16:46:01] elaptics: drager: you need to specify an id in your put call in your spec
[16:46:21] drager: elaptics: Ah
[16:46:22] chrislerum: ericx2x: you'd need something that gives Product a user method, ie 'belongs_to :user'
[16:46:51] ericx2x: ok yeah i forgot to do this step thanks
[16:48:15] savish: can some one help, I should be able to pass in the access token through the url, instea di tonly lets me do it via curl
[16:48:35] drager: elaptics: thanks
[16:49:25] ericx2x: perfect thanks chrislerum
[16:49:30] ericx2x: seems to work correctly
[16:49:35] ericx2x: question though
[16:49:54] ericx2x: i dont think it is correct to make a user_id field under the projects table
[16:49:57] ericx2x: isn't that repetative?
[16:50:01] chrislerum: ericx2x: how so?
[16:50:02] ericx2x: shouldnt i have used a join table?
[16:50:24] savish: only is projects can have many users and user can have many projects
[16:50:25] ericx2x: i dont really understand database structures well
[16:50:34] ericx2x: but simply wanted to ask the quesiton
[16:50:39] chrislerum: ericx2x: depends how you want things to work: can a project have more than one user? can a user have more than one project?
[16:51:05] ericx2x: a project cant have more than one user for this case but a user can have more than one project
[16:51:26] chrislerum: ericx2x: k, then it's correct to have user_id on projects table
[16:51:59] ericx2x: ok but if it was a many to many relationship
[16:52:06] ericx2x: is that the case where you would want to make a join table?
[16:52:35] ericx2x: any one to many relationships simply need a id column of the 'one' table ?
[16:52:37] chrislerum: ericx2x: then yes, you'd either use has_and_belongs_to_many, or has_many :through
[16:53:00] ericx2x: chrislerum activerecord makes the join tables automatically?
[16:53:17] chrislerum: ericx2x: no, you have to make a migration for that yourself
[16:53:40] ericx2x: savish were you replying to me?
[16:54:11] ericx2x: so my statement where i said if you have a many to many relationship that is where you need a join table is incorrect?
[16:54:16] chrislerum: ericx2x: one to many, like one user to many projects, has the user_id column on the 'many' table, i.e. 'projects', not the 'one' table
[16:54:45] savish: ericx2x, if you have a user has many projects, but project belongs to user you DON'T need a join table
[16:54:54] savish: join tables are for many to many relationships
[16:55:03] savish: you would add user_id to project table
[16:55:16] savish: Can some one help me out? I think I am doing something wrong here http://stackoverflow.com/questions/23477324/cannot-access-my-api-in-the-browser
[16:55:30] savish: I should be able to use access_token in the browser to access the api
[16:56:17] ericx2x: thanks for the help
[16:59:05] chrislerum: savish: you don't say what's going wrong. are you expecting 'access_token' to be available in that 'restrict_api_access' method?
[17:03:09] savish: chrislerum, the issue is I can access the api via the curl method, as outlined, but when I try and acess it in the browser I am not sure how. it seems the only way I can access the api is through curl
[17:03:18] savish: I am not usre if my restrict method is incorrect or no
[17:03:35] savish: as it works if I try to just access the api through curl with no or the wrong api key
[17:03:44] savish: it will spit back 401
[17:03:47] chrislerum: savish: is this a typo, you have 'toke' in the curl line
[17:04:16] savish: chrislerum, Yes I updated the stack question
[17:04:40] savish: so with the curl method the restict api method works perfectly. it spits back 401 on incorrect or missing access tokens
[17:04:46] savish: it spits out api on correct ones
[17:04:51] savish: or json sorry
[17:04:53] chrislerum: savish: so, without seeing more code, i want to ask, why does one have 'token' and the other have 'access_token'?
[17:05:06] toretore: savish: why do you need to be able to authenticate through the params?
[17:05:15] savish: toretore, how else would you?
[17:05:39] toretore: the way you just showed on so?
[17:05:44] savish: I mean if you were devloiping a js app to interact with this
[17:05:51] toretore: define js app
[17:05:55] savish: ember app
[17:06:01] toretore: i don't know what that is
[17:06:09] savish: You dont know what emberjs is?
[17:06:16] toretore: can you not send headers with it?
[17:06:23] savish: I dont know
[17:07:00] chrislerum: well, at least you know what ember is :)
[17:07:19] toretore: you can send headers with xmlhttprequest
[17:07:26] toretore: so that shouldn't be a problem
[17:07:41] toretore: you don't need to use query params, which is less secure
[17:08:11] savish: So I am reading: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest and I dont get how one would use it.
[17:08:38] toretore: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
[17:08:40] savish: nevermind
[17:08:44] savish: I didnt see that
[17:09:01] toretore: but you would probably use something like jquery
[17:09:30] savish: No I am using Emberjs. So ill see if they have some kind of access to this
[17:09:47] savish: I almost wish I went with query params >..>
[17:23:04] pkircher: morning .. did someone try to use grape-swagger-ui with oauth ?
[17:23:34] chrislerum: about to delve into geocoding, recommendations from experience? geocoder, geokit, other?
[17:24:37] lethjakman: chrislerum: geokit is nice
[17:24:43] lethjakman: I think that's the one I used. I'll double check.
[17:25:01] lethjakman: chrislerum: nope. geocoder
[17:25:05] lethjakman: geokit looked nicer
[17:25:07] lethjakman: but geocoder worked better
[17:25:09] lethjakman: so I switched
[17:25:22] lethjakman: and it had a nice ability to search within a radius
[17:25:30] chrislerum: lethjakman: saved me hours there probably. bill me.
[17:26:09] lethjakman: chrislerum: :)
[17:28:22] pkircher: geocoder ftw !
[17:28:52] pkircher: anyone exp with grape / (oauth2+swagger-ui) ?
[17:29:14] pkircher: the docs work fine .. its just the oauth2 .. definition part which bothers me
[17:39:11] chrislerum: re geocoder, thanks, that was indecently easy to set up.
[17:42:45] tubbo: pkircher: lol wtf is swagger-ui
[17:42:57] pkircher: http://swagger.wordnik.com
[17:43:27] pkircher: interative documentation basicaly
[17:43:31] pkircher: doc works fine
[17:43:41] pkircher: but the oauth part which is support .. gives me a hard time
[17:43:53] tubbo: pkircher: oauth2 isn't necessarily restful, is it? might be hard to model with grape and swagger.
[17:44:08] pkircher: nah oauth2 and rest works fine
[17:44:12] pkircher: if you use refresh tokens
[17:44:34] pkircher: used that since quite some time now .. its just the swagger part for the doc
[17:44:37] pkircher: which kills me
[17:44:48] pkircher: basicaly i need to get my token ???manualy??? to use the doc
[17:45:05] pkircher: swagger got the JS part for it .. but the doc json .. need to specify it ..
[17:45:32] tubbo: pkircher: yeah i still don't even know what your problem is :P
[17:45:58] pkircher: well i do oauth2 via doorkeeper works like a charm .. its just the doc part ..
[17:46:04] pkircher: swagger writes a documentation json
[17:46:06] pkircher: https://github.com/tim-vandecasteele/grape-swagger/blob/master/lib/grape-swagger.rb
[17:46:19] pkircher: as you see it obv. takes a authorizations params in
[17:46:38] tubbo: obv, because i can read 400 lines of code in 20 seconds ;)
[17:46:49] tubbo: but i'll take your word for it
[17:47:18] tubbo: so why do you need to pass swagger your OAuth credentials?
[17:47:43] tubbo: is this a private API?
[17:47:48] pkircher: not the credientials .. swagger let you actualy try the api without having a ???endpoint???
[17:48:02] pkircher: means you can play with the objects
[17:48:08] pkircher: in the ???doc???
[17:48:14] pkircher: interative .. as i sayed
[17:48:44] pkircher: but be able to interact with the endpoints since its scoped on the user .. > authorization via oauth2 ..
[17:48:55] pkircher: it needs to support the oauth flow
[17:48:59] pkircher: which it does ..
[17:49:10] pkircher: i cant just figure out how to pass the params in correctly
[17:49:27] pkircher: theoreticaly its nice
[17:49:31] tubbo: strange that it doesn't store your oauth access token in the session
[17:49:54] pkircher: well different functions in your controller require different scopes right ?
[17:50:05] pkircher: so you need to reauthorize again if you need a other scope
[17:50:16] pkircher: means get > read scope / post write .. and so on
[17:50:26] tubbo: pkircher: first of all, they're methods. second of all, when you say "scope" i think you may mean "http request".
[17:50:35] pkircher: nope oauth2 scopes
[17:50:44] tubbo: pkircher: oh right, oauth2
[17:51:39] tubbo: pkircher: well i don't know much about oauth2, but i do know that if you use devise for example, your app will store the current user's id in the session. i would assume that somewhere, your client needs to save off its access token and produce it each time it makes a request.
[17:51:50] tubbo: just like a browser woud
[17:52:01] pkircher: but oauth2 is actualy 3 legged
[17:52:05] pkircher: there is a bit back and forth
[17:52:06] tubbo: so i'm not sure what the problem is here
[17:52:16] tubbo: yeah there's the client, server, and centralized trust right?
[17:52:26] pkircher: .. its the whole flow should be initalized by swagger
[17:52:35] pkircher: and the gem just gives me a sour head ..
[17:52:50] pkircher: if it comes to pass the authorization methods in
[17:53:08] pkircher: it would work globaly but not for the http methods endpoints ..
[17:53:20] tubbo: pkircher: seems like swagger is a little too opinionated for your workflow, here.
[17:53:22] pkircher: might need to dump grape for that reasion
[17:53:26] tubbo: might be better to just bite the bullet and write rdoc
[17:53:29] pkircher: nah swagger works with oauth2 ..
[17:53:35] tubbo: lol i'm not sure why this grape thing is so popular
[17:53:39] tubbo: what exactly does it do that rails can't?
[17:53:50] pkircher: its thinner .. rack based
[17:53:56] pkircher: beeing honest
[17:54:09] tubbo: pkircher: rails is rack based, and i bet i can make my rails app thinner than grape ;)
[17:54:26] pkircher: well if you actualy use rails .. yep
[17:54:37] pkircher: you be better of if you use something like eventmashine
[17:54:48] pkircher: but ya .. i know you can kick alot parts out of rails
[17:54:54] tubbo: my point was that rails is very modular
[17:55:36] pkircher: shh .. it would be to nice if it just works
[17:56:05] pkircher: seems im asking to much .. :/
[17:56:33] greengriminal: So okay yes the gem is not avalaible on my machine or should i say for this particular version of rvm i am using (Ruby 2.1.1 & Rails 4.0.4) 
[17:57:12] pkircher: nah for the guy behind you
[17:57:22] pkircher: so what gem ?
[17:57:53] greengriminal: sorted my answer anyways
[17:59:08] pkircher: tubbo: http://swagger.wordnik.com/#!/words/searchWords
[17:59:31] pkircher: thats the nice part about swagger
[17:59:32] AntelopeSalad: have anyone of you guys ever found yourself in a situation where you wanted to run a db migration on a production machine without first pushing a new build of your app to the server?
[18:00:07] bricker: AntelopeSalad:
[18:00:28] AntelopeSalad: bricker: me neither but i'm wondering if i'm missing any edge cases where that might be useful
[18:00:31] bricker: AntelopeSalad: if you need to change the database outside of the context of your rails application, just log in to the database and make the changes
[18:00:35] lethjakman: bricker: psst. bricker. check out the new spotify android update. they made it even prettier.
[18:00:48] pkircher: if you use capistrano .. you could do that
[18:01:04] bricker: lethjakman: let's see hmyah
[18:01:06] pkircher: cap deploy:migrate # Run the migrate rake task.
[18:01:25] pkircher: without deploying a new version
[18:02:24] AntelopeSalad: pkircher: yep, i'm not using cap but i also wanted to have 2 types of deploying -- one with a migration and one without
[18:02:43] AntelopeSalad: but the way i have it setup now is the migration process gets skipped entirely if the repo didn't change
[18:02:59] pkircher: cap deploy - no migrations are called
[18:03:08] pkircher: cap deploy:migrate # Run the migrate rake task.
[18:03:18] pkircher: so thats already what cap supplies
[18:03:38] AntelopeSalad: yeah i've used it before, i just wondered how many people ever migrated without an app change
[18:03:57] bricker: AntelopeSalad: you mean, like, a data migration?
[18:03:58] pkircher: never .. since changes should be in git anyway
[18:04:04] lethjakman: AntelopeSalad: you could do that with an ENV variable pretty easily
[18:04:18] AntelopeSalad: pkircher: that's what i'm thinking too
[18:04:18] bricker: AntelopeSalad: you can also login to the rails console on the server and run the commands ther
[18:04:30] pkircher: which is very very bad !
[18:04:35] spamotuve: Hello, I have a has_many / belongs_to relationship between a Sportists and Trainer, but when I try to access sportists trainer in my view with @sportists.each do |s| -> <%= s.trainer.name %> I get an error that there is no such method as "name" even though there is, what am I doing wrong?
[18:04:38] bricker: pkircher: what's bad?
[18:04:42] bricker: pkircher: logging into the console?
[18:04:46] spamotuve: if I output s.trainer then it shows that the thing exists
[18:05:28] bricker: spamotuve: read the full error, notice "NilClass", realize that `s.trainer` is nil for at least one Sportist instance
[18:05:28] AntelopeSalad: bricker: i'd say so, maybe if you had an emergency and were in a pinch on a very small deploy
[18:05:29] pkircher: try attach an s behind ..
[18:05:30] spamotuve: pkircher: then I get an error that there's not method trainers
[18:07:53] pkircher: bricker .. as long as its a singleserver enviroment that might be viable
[18:08:05] pkircher: but as soon as you scale .. .. i would not do it manualy at all
[18:08:18] pkircher: should be part of the deployment process
[18:08:20] pkircher: just my 2 cents
[18:08:32] spamotuve: anyhow that s.trainer returns #<Trainer:0x0000000363c448>
[18:08:47] pkircher: or def to_s self.name
[18:08:49] spamotuve: and s.trainer.name returns that there's no method name
[18:08:54] spamotuve: ok, I'll try that
[18:09:02] pkircher: well is there a field called name ?
[18:09:18] spamotuve: it sais that for every field there is
[18:09:27] bricker: pkircher: I'm talking about data updates, like `Post.where(status: "draft").destroy_all` or something like that
[18:09:30] pkircher: tryed to debug with pry ?
[18:09:46] bricker: pkircher: hopefully if you have multiple servers they either all share the same DB server, or you have replication setup... I mean you'd have to.
[18:10:12] pkircher: debugging in the console is might be easyer ..
[18:10:17] pkircher: probably a releation problem
[18:10:24] pkircher: or try to get a erd ..
[18:10:31] pkircher: to see if the relations are correct
[18:10:48] pkircher: and bricker of course there needs to be some sort of rep or master/server
[18:11:02] bricker: lethjakman: lol, it just immediately crashed when I opened it. I prefer the lighter look, but I guess they're trying to brand it more consistently
[18:11:14] spamotuve: well damn it, in console it works fine
[18:11:32] pkircher: gem ???pry???
[18:11:39] pkircher: binding.pry in the each call
[18:11:42] pkircher: and see for your self
[18:12:39] pkircher: somebody used grape with oauth2 and swagger ?
[18:13:26] bricker: lethjakman: this darker, rounder design doesn't feel as "android-native" to me
[18:13:36] horsecowdog: I have a Rails model "Courses" which has_many "Lessons". What is the best way to get all "Courses" which have at least one "Lesson" association?
[18:13:37] workmaster2n: is there a standard way to sanitize sql fragments in rails 3.2? sanitize_sql_array is protected
[18:15:06] tubbo: horsecowdog: probably Course.not(lesson_id: nil)
[18:15:08] pkircher: lessions.where(course_id > 1)
[18:15:19] tubbo: neither of those work
[18:15:27] tubbo: pkircher: mine isn't the right object and yours isn't even valid ruby
[18:15:52] pkircher: where(???course_id > ????, ???1???)
[18:15:58] tubbo: Lesson.not(course_id: nil) i think will work, give it a shot. you might need where().not(course_id: nil)
[18:16:40] tubbo: pkircher: now that it will actually not throw an error, yes ;)
[18:16:51] pkircher: nah .. that works :P
[18:17:00] tubbo: i prefer using hash syntax most of the time, rather than query partials
[18:17:02] bricker: He wants to get courses though, it would be better to go through the Course table
[18:17:17] tubbo: bricker: that's true. perhaps a JOIN might be in order
[18:17:30] bricker: Course.joins(:lessons).where.not(lessons: { course_id: nil }) or something
[18:17:35] tubbo: ^^^^^^^^^^^^^^
[18:17:43] tubbo: bricker droppin queries
[18:17:43] horsecowdog: Right, I believe I should be going through Courses as I'll be doing this is the Course controller
[18:17:56] bricker: *pimp walk*
[18:18:54] bricker: by the way, I can't believe it took Rails almost ten years to have a ".not()" method on active record queries
[18:19:09] pkircher: i didt not even know the .not
[18:19:09] kaldrenon: In my routes file, I have member and collection blocks for a given model, including a get 'foo' in collections. Rake routes shows that '/model/foo' goes to model#foo as I'd expect. But when I actually navigate to host/model/foo, the app is trying to run model#show with and id of 'foo'. Is this based on the order of my route declarations? How do I get the
[18:19:09] kaldrenon: collection actions to supercede member actions?
[18:19:22] pkircher: in that case i usualy used ???sql???
[18:20:29] pkircher: namespacing ?
[18:21:19] pkircher: in the worst part you could always use a matcher
[18:22:52] kaldrenon: pkircher: Turns out it was just PEBKAC - was making a GET request and had the route in as a POST.
[18:24:36] atmosx: Hello, I'd need some help with CSS3. I'm using boostrap for my prototype and I'm having this problem: https://atmosx.clarify-it.com/d/wjwqv7 when I shorten the browser window text goes outside the 'white' area, which is defined as 'body' in my CSS3. Any ideas how to make this dynamic?
[18:24:38] kaldrenon: It has almost become a rule for me that just after I get confused enough to need to ask IRC, I figure out the solution in between posting my question and getting a reply.
[18:25:06] bricker: kaldrenon: that's always how it works, which is why we ask people to put together a gist or an example application
[18:27:21] atmosx: never mind, changing the height from 100% to 'auto' did the job
[18:30:29] horsecowdog: bricker: I'm trying to get all Courses that have at least one Lesson associated with it. Doing Lms::Course.joins(:lessons).where.not(lessons: { course_id: nil }) I'm expecting to get 4 Courses back, but it is only returning #<#<Class:#<ActiveRecord::Relation::ActiveRecord_Relation_Lms_Course:0x007f9766e525b8>>:0x3fcbb37292dc>
[18:34:21] GeorgesLeYeti: I have a problem. :'(
[18:34:21] bricker: horsecowdog: try calling `to_a` on your query
[18:34:34] GeorgesLeYeti: ActiveRecord::StatementInvalid (PG::NumericValueOutOfRange: ERROR: value "5332909694" is out of range for type integer
[18:34:58] bricker: GeorgesLeYeti: http://www.postgresql.org/docs/9.1/static/datatype-numeric.html
[18:35:07] GeorgesLeYeti: Is there any bigint params for the migration ?
[18:35:12] bricker: GeorgesLeYeti: use bigint or whatever is appropriate
[18:35:41] bricker: GeorgesLeYeti: yes, you can specify bigint datatype
[18:35:49] GeorgesLeYeti: bricker: ok ty
[18:35:53] bricker: GeorgesLeYeti: change_column :your_cool_table, :your_cool_column, :bigint
[18:42:53] i42n: Hey, I just migrated to postgresql and now I get these errors on my sidekiq task database access: https://gist.github.com/i42n/cd60fd03f695b673cbcb Does anyone know whats wrong?
[18:43:44] horsecowdog: FYI Seems the best way to do the query is Course.joins(:lessons).distinct
[18:44:01] i42n: Basic access to database works. I can create entries using the rails web forms and even other sidekiq tasks work.
[18:44:25] i42n: I just do not know what the error means and I could not find something on google
[18:45:08] bricker: i42n: use `episode.save!` on line 17 to get a better error message
[18:45:31] i42n: bricker: will this be in the log or in the sidekiq output?
[18:45:47] i42n: bricker: I will try that
[18:45:48] bricker: i42n: sidekiq failures log or something like that
[18:45:56] bricker: I don't know how sidekiq works exactly
[18:46:12] bricker: i42n: anyways it looks like your sidekiq worker isn't connected to the database correctly, try restarting it
[18:46:44] mdw_: Time.zone = 'GMT' Time.zone.now
[18:46:50] mdw_: comes out an hour early
[18:46:55] mdw_: does Rails handle BST time ?
[18:47:03] mdw_: 'British Summer Time'
[18:47:24] bricker: mdw_: run `rake time:zones:all` to check
[18:47:35] i42n: bricker: Tried that several times. Did not help. Other sidekiq tasks did work also with access to the DB.
[18:47:57] i42n: bricker: however this time it worked perfectly
[18:48:25] mdw_: bricker don't see anything mentioning BST
[18:48:26] bricker: where's that gif
[18:48:30] i42n: bricker: ah there is the error again
[18:48:58] i42n: bricker: interesting: 2 workers completed fine. third one failed. same code
[18:49:05] atmosx: mdw_: http://stackoverflow.com/questions/1340037/rails-bst-timezone-implementation
[18:49:06] atmosx: Time.zone = 'UK'&& Time.now
[18:49:12] atmosx: err Time.zone.now
[18:49:22] i42n: bricker: same error with "save!" 2014-05-05T18:49:03Z 22437 TID-199tlg WARN: PG::ConnectionBad: PQconsumeInput() : BEGIN
[18:49:39] i42n: bricker: does this have something to do with too many connections?
[18:50:09] bricker: i42n: perhaps
[18:50:12] i42n: database pool is 5, also 5 sidekiq workers, however only three workers were started
[18:50:50] i42n: this can never fill max connections of postgresql
[18:51:07] mdw_: bricker, atmosx https://gist.github.com/anonymous/7889605da59057c90a02
[18:51:59] mdw_: If the user chooses GMT, how can I display the date correctly if the date moves to BST?
[18:52:17] mdw_: Time.now seem to understand I'm +1 hour in BST
[18:52:31] mikecmpbll: mdw_: so what's the problem? :)
[18:52:41] bricker: mdw_: Time.now reads your system time, so that makes sense
[18:52:52] bricker: mdw_: Time.zone.now is filtered through rails
[18:53:24] mdw_: I have users that will be in the UK and choose GMT timezone. But if I use Time.zone.now, the date will be 1 hour behind BST
[18:54:16] atmosx: mdw_: Time.zone = 'London'
[18:54:20] bricker: mdw_: you need to implement some internationalization, or client-side timezone handling, or set a preference in the user database for each user and read from that
[18:54:31] atmosx: mdw_: Time.zone.now => 19:53:28 BST +01:00
[18:55:19] mdw_: atmosx one sec, thanks!
[18:55:43] atmosx: mdw_: :-)
[18:55:50] mdw_: Thanks that works...
[18:57:09] mdw_: i hate timezones :-P
[18:57:22] bricker: mdw_: welcome to the club
[18:57:37] bricker: Est. January 1st, 1970
[18:57:48] bricker: # Members: All
[18:58:35] bricker: mdw_: here's Tom Scott explaining why you're about to have a mental breakdown: https://www.youtube.com/watch?v=-5wpm-gesOY
[18:59:27] GeorgesLeYeti: Is it possible to skip asset precompile while i didn't change the js/css ?
[18:59:38] bricker: GeorgesLeYeti: Rails 4 already does this for you
[18:59:39] GeorgesLeYeti: sorry during capistrano deployment
[18:59:43] bricker: GeorgesLeYeti: are you using rails 4?
[18:59:54] GeorgesLeYeti: I'm under rails 3
[19:00:12] bricker: GeorgesLeYeti: then you should install turbo-sprockets-rails3 (which was merged into Rails 4)
[19:00:21] mdw_: bricker watching now :-)
[19:00:27] bricker: GeorgesLeYeti: and it'll only compile the assets that were changed
[19:01:26] skinkitten: hugs and kisses
[19:01:35] bricker: skinkitten: what are your skills
[19:01:46] skinkitten: I can read and write code
[19:02:00] bricker: skinkitten: so can millions of other people
[19:02:08] bricker: hundreds of millions, really
[19:02:16] skinkitten: I do it with care rather than haste and ignorance
[19:02:23] bricker: skinkitten: prove it
[19:03:20] skinkitten: hm whats your challenge?
[19:04:58] bricker: skinkitten: write a magic 8-ball app which knows my name without me having to tell it.
[19:05:15] pkircher: in less then 10 trys
[19:06:07] pkircher: how about ???Bryan???
[19:06:20] bricker: pkircher: doesn't count! You're human!
[19:06:38] pkircher: i doubt that from time to time
[19:07:00] skinkitten: I don't know magic
[19:07:27] bricker: skinkitten: you can make some assumptions and check a few different places
[19:07:38] pkircher: github / twitter / facebook
[19:07:42] pkircher: just to start
[19:07:53] pkircher: google is a good catch to
[19:07:54] bricker: pkircher: even git config may have that info
[19:07:55] skinkitten: puts "Brian Ricker"
[19:08:04] bricker: or a simple `whoami` might reveal some valuable info
[19:08:57] bricker: skinkitten: then if you know the user is on OS X, you could narrow down where a full name might live
[19:09:16] mdw_: ActiveSupport::TimeZone['London'].utc_offset shouldn't this be 1?
[19:09:18] pkircher: stop it she dont know magic ..
[19:09:30] pkircher: ???it??? already told us
[19:09:31] bricker: skinkitten: worst case probably, you hit the github users API using the configured git username
[19:09:35] Ericx5x: i have a table that has projects which has a column for the user_id that created the project. how do i display all the projects that person has made on a single page?
[19:09:40] skinkitten: def magic_eight_ball; "Brian Ricker"; end
[19:09:50] pkircher: no controller ?
[19:10:06] mdw_: bricker Time.zone = 'London' works (moves to BST), but if I do ActiveSupport::TimeZone['London'].utc_offset I get 0, not 1?
[19:10:24] pkircher: london is gmt
[19:10:44] pkircher: so should be 0
[19:10:55] mikecmpbll: at the moment ;)
[19:10:57] mdw_: what's the right way to get the ... offset?
[19:11:13] pkircher: screw you summer time
[19:11:16] pkircher: for me its gmt
[19:11:36] pkircher: im so far north .. we dont have a summer
[19:11:39] pkircher: scotland :P
[19:15:00] Ericx5x: how do i do Project.all but for all the projects by a certain user?
[19:15:20] bricker: Ericx5x: @user.projects
[19:17:45] Ericx5x: bricker that says its undefined for projects
[19:17:57] bricker: Ericx5x: then you should define that association on the User model
[19:18:01] pkircher: no relations then
[19:18:05] bricker: has_many :projects
[19:18:47] Ericx5x: you mean has_many :project
[19:19:12] pkircher: user has_many projects
[19:19:16] bricker: Ericx5x: It's your app
[19:19:38] pkircher: project belongs_to user ..
[19:19:45] krz: anyone else applying the DCI pattern?
[19:19:46] pkircher: unless its a many to many
[19:20:04] krz: just curious
[19:20:28] mdw_: bricker mikecmpbll ahh I found the answer... You must do : ActiveSupport::TimeZone['London'].now.utc_offset to get the DST :-)
[19:20:58] mdw_: the .now gives the timezone info about the current time, obviously.... so it can do the DST
[19:21:10] bricker: mdw_: nice work
[19:22:22] lectrick: I need the help of anyone with Rails deployment experience. I'm trying to set up a Rails app with nginx/passenger on an Ubuntu 12.04 machine. I upgraded the Passenger gem and somehow broke the install. Now all requests to the app are "403 Forbidden" and it seems to be looking for public/index.html which does not exist.
[19:22:53] pkircher: use unicorn with nginx and deploy with capistrano
[19:23:02] pkircher: there are about 5000 tutorials out
[19:23:07] lethjakman: lectrick: sounds like your permissions are wrong
[19:23:23] lethjakman: is nginx/passenger being started with the wrong permissions?
[19:23:45] Ericx5x: yeah it says @user.projects is nil even though my user model has has_many :projects
[19:24:02] Ericx5x: i'm not sure why
[19:24:13] mikecmpbll: Ericx5x: have you added any projects to that particular @user? :/
[19:24:37] Ericx5x: yeah that is likely why
[19:24:38] mikecmpbll: if it's empty, then there's no associations between that User and any projects.
[19:24:50] Ericx5x: but i never specified which user is @user
[19:24:56] Ericx5x: do i do that in my controller?
[19:25:10] mikecmpbll: probably, i dunno what you're doing.
[19:25:36] Ericx5x: i have a rails app where a user can have many projects
[19:25:37] bricker: Ericx5x: yes, the error you're getting isn't saying @user.projects is nil, it's saying that @user is nil, I had hoped you wouldn't copy my line of code literally but you did
[19:26:09] bricker: lectrick: check your nginx error log
[19:27:17] skinkitten: bricker, http://pastie.org/9143550
[19:27:39] mikecmpbll: great pastie
[19:27:57] bricker: A+ would read again
[19:28:48] skinkitten: what can I change?
[19:29:14] mikecmpbll: oh, it's there now.
[19:29:23] Ericx5x: bricker yeah i'm trying to figure out how i write that line
[19:29:26] bricker: mikecmpbll: it is?
[19:29:36] bricker: Ericx5x: @user = User.first
[19:29:38] mikecmpbll: oh, not anymore
[19:30:08] mikecmpbll: back again ..
[19:30:22] bricker: mikecmpbll: don't care anymore
[19:30:49] mikecmpbll: i realised i was beginning to sound like a schizophrenic.
[19:36:31] justinas_: hello! Do any of you use passenger with rails?
[19:39:59] bricker: justinas_: lots of people do
[19:40:45] justinas_: bricker: is it possible to get some kind of console output, like "rails server" would do?
[19:42:09] bricker: justinas_: yes, but only with passenger enterprise edition
[19:42:51] chrislerum: on yer production server? just tail -f production.log
[19:43:02] justinas_: bricker: thanks
[19:43:05] bricker: oh yeah, I thought he meant rails console
[19:43:39] justinas_: well yeah, i do need some tools to use features like binding.pry
[19:43:58] tubbo: justinas_: we do ./script/server --debugger (or `rails server --debugger` if you're on rails 3)
[19:44:16] justinas_: tubbo: thanks
[19:44:40] tubbo: justinas_: though...i'm not sure you can use Pry that way. maybe, though
[19:45:09] bricker: justinas_: you can install install passenger locally and debug the problem that way, depending on what the problem is
[19:45:24] bricker: if it's a memory leak then probably not, although I found that the passenger console didn't really help much
[19:45:49] bricker: Best thing for debugging passenger in production is sending SIGQUIT to one of the processes
[19:45:59] bricker: debugging a memory leak I mean
[19:46:46] justinas_: bricker: you'd laugh at me, but its not a problem at all yet. Im just kind of person which wants to setup everything so i "WOULD HAVE ABILITY" if i needed. lol
[19:46:59] bricker: justinas_: slipperly slope
[19:47:22] skinkitten: bricker, http://pastie.org/9143604
[19:47:32] justinas_: bricker: not sure what this suppose to mean
[19:47:41] chrislerum: justinas: a hireable trait
[19:48:34] bricker: skinkitten: lol
[19:48:54] bricker: skinkitten: not a terrible idea actually, you could use Nokogiri to scrape the github profile page and get the name
[19:49:06] bricker: skinkitten: you'd just have to get the github username from git config
[19:49:18] rikkipitt: Hi guys, new here! Just wondering if anyone knew a way of doing something like what MailChimp does with their HTML merge tags? Is there a gem available for that type of thing?
[19:49:28] justinas_: chrislerum: I think i got it just now
[19:57:39] skinkitten: thanks bricker I'll look into that, gtg now
[19:57:51] jenrzzz: rikkipitt: erb?
[19:58:37] Macaveli: how can I protect my code from empty data like this? https://gist.github.com/YOUConsulting/57e89cc6627d0fd13bc4
[19:58:38] TImmaah21: Hey guys I'm trying to solve: https://stackoverflow.com/questions/17481812/dynamically-add-active-class-to-bootstrap-li-in-rails - The accepted answer works well but I have a process where I show a user's team by accessing user/{user id} . I'm struggling to find a way of passing a wildcard path to the is_active method, is there a way of doing this in Rails?
[19:58:57] rikkipitt: hi jenrzzz: I should have explained a bit better... say I give a user a textarea and want to let them "mail merge" their name dynamically later without erb...
[19:59:05] TImmaah21: I've tried '/user/*' , 'user/:all' etc. but no luck
[19:59:15] rikkipitt: e.g. *|NAME|*
[19:59:18] jenrzzz: macaveli: what do you want to do if data is nil?
[19:59:44] jenrzzz: rikkipitt: gotcha. this might be a place to start: https://github.com/ehlertij/mail_merge
[19:59:59] jenrzzz: hasn???t been touched in 3 years though
[20:00:45] rikkipitt: thanks for that jenrzzz, I couldn't think of a name for it but it must just be mail merging then really
[20:00:53] Macaveli: jenrzzz, protect it from dumping and return a message I've updated the rest of the code please take a look https://gist.github.com/YOUConsulting/57e89cc6627d0fd13bc4
[20:01:16] Macaveli: Return a d?fault message if data is null is this possible? and still the loop or something?
[20:01:34] bricker: jenrzzz: it's just a fancy "gsub", no reason it wouldn't work with the latest versions of ruby and rails
[20:02:36] jenrzzz: macaveli: if data.nil? then add message; return; else do stuff; end
[20:03:14] jenrzzz: bricker: yeah, just trying to reduce expectations :P
[20:03:42] jenrzzz: TImmaah21: 1 sec
[20:05:18] jenrzzz: TImmaah21: why are you trying to use a wildcard path there?
[20:06:46] TImmaah21: So my navbar is: Home Team . My Home path is '/', that works fine and home has the active class. The Team tab shows my team by default so '/user/1' (if 1 is my user id) but I can also view /user/2's team and it makes sense to me that the team link would still have the active class in that scenario
[20:07:53] jenrzzz: TImmaah21: ???active??? if params[:controller] == ???users???
[20:08:02] mikecmpbll: TImmaah21: not looked at the SO link you posted, but i wrote a little helper method for active tabs a while ago http://www.wordofmike.net/j/highlighting-active-tabs-in-rails
[20:08:09] mikecmpbll: might help /shrugs
[20:08:17] jenrzzz: TImmaah21: controller.controller_name in a view actually
[20:09:24] TImmaah21: mikecmpbll: thanks I'll have a look
[20:09:41] TImmaah21: jenrzzz: What do you mean by the last comment?
[20:11:32] jenrzzz: TImmaah21: you can???t access the params hash in a view context so you???d want to use controller.controller_name. but if you???re doing it a helper it doesn???t matter
[20:12:29] nobitanobi: Hi guys. If a user is trying to create a resource through my API, and he has put an attribute which my model doesn't recognize, what kind of JSON should I respond when catching the exception?
[20:13:29] mikecmpbll: nobitanobi: ordinarily you'd just ignore the bad params
[20:13:29] swillits: Does anyone have any idea why the asset pipeline is compressing my css even when I tell it not to? This is local dev, config.assets.compile is true, but compress is false, I've deleted all local asset caches etc. I can't figure it out
[20:13:56] jenrzzz: nobitanobi: depends on your API spec and business rules
[20:14:19] nobitanobi: right. That's what I am trying to figure out :) What is a good approach on this?
[20:14:27] jenrzzz: nobitanobi: this is what github does: https://developer.github.com/v3/#client-errors
[20:14:32] mikecmpbll: ignore is the default behaviour for strong parameters
[20:15:21] jenrzzz: yeah, if it???s just extra params that you don???t know how to handle, you can probably just drop them like mikecmpbll said
[20:16:12] nobitanobi: jenrzzz: so, firstly I would need to filter the JSON that the user is sending, so I can get rid of parameters not associated with my model?
[20:16:31] jenrzzz: nobitanobi: are you using strong parameters?
[20:17:55] nobitanobi: jenrzzz: nopes
[20:18:07] jenrzzz: nobitanobi: what version of rails?
[20:18:18] nobitanobi: hold on a second... I was too quick on saying nopes
[20:18:22] Macaveli: jenrzzz, fixed it. But used data.present?
[20:18:25] nobitanobi: I'm using Rails 4.
[20:19:00] nobitanobi: jenrzzz: this is what I have so far: https://gist.github.com/anonymous/8ad6963c78475b9fede6
[20:19:04] jenrzzz: Macaveli: that???s fine. #present? is part of activesupport so don???t be surprised when it doesn???t work in other contexts
[20:20:50] lethjakman: I wish #present? was in normal ruby...
[20:21:55] jenrzzz: meh, !obj.nil? works well enough. i do wish #try was in the stdlib though
[20:22:00] bricker: lethjakman: it's bad programming, probably why it's not in normal Ruby
[20:22:23] ahawkins: hey guys, you know of some name generator I can use for a gem?
[20:22:36] mikecmpbll: jenrzzz: !obj.nil? aint the same as obj.present? though.
[20:22:58] jenrzzz: mikecmpbll: right, forgot about that
[20:23:01] bricker: ahawkins: require 'securerandom'; SecureRandom.hex
[20:23:01] toretore: kneeparachute
[20:23:05] lethjakman: bricker: what makes you say that?
[20:23:09] TImmaah21: thanks jenrzzz, the params[:controller] with a bit of adapting for the user-helper method has sorted it
[20:23:23] lethjakman: hmmm, now that I think about it I usually just toss in the object.
[20:23:32] jenrzzz: mikecmpbll: idk why you would want to treat empty strings the same as nils outside of rails though
[20:23:43] mikecmpbll: it's not treating it the same as nils
[20:24:01] mikecmpbll: it's just shorthand for obj.nil? || obj == ""
[20:24:13] bricker: lethjakman: because when you're checking if something is "empty", you should know what type of object you're checking. I use `present?` all the time, only because it usually looks nicer though
[20:24:26] jenrzzz: nobitanobi: https://github.com/rails/strong_parameters will help a lot there
[20:24:35] nobitanobi: jenrzzz: thanks
[20:24:38] nobitanobi: I am gonna take a look
[20:24:44] lethjakman: bricker: fair enough.
[20:26:06] jenrzzz: nobitanobi: http://railscasts.com/episodes/371-strong-parameters
[20:26:16] nobitanobi: +1 thanks man
[20:26:22] nobitanobi: I miss Ryan Bates
[20:26:54] bricker: ohh railscasts :( starting to make me a little nervous
[20:26:55] jenrzzz: me too. i???m glad he???s doing other things though. it???d be worse if he burnt out completely
[20:27:06] bricker: I wonder if he was affected by heartbleed
[20:27:12] jenrzzz: i heard he???s just chilling like a mofo
[20:28:07] lethjakman: bricker: I think chrome turns you away now if it was.
[20:28:32] bricker: lethjakman: does it? I haven't seen that anywhere
[20:29:00] tubbo: lol i wouldn't bet on railscasts ever coming back
[20:29:10] lethjakman: bricker: neither have I. but last I checked all my sites were already fixed. I'll have to double check that.
[20:29:12] tubbo: that way, if it ever does, you'll be surprised...rather than disappointed if it never comes back
[20:29:19] lethjakman: me neither :(
[20:29:24] lethjakman: it was so good though!
[20:29:28] lethjakman: it's sad he burnt out
[20:34:14] nobitanobi: A question regarding associations - If I have Order -> has_many -> Pages and I do: Order.create({:pages => [{:url => 'test'}]}) -- I get a ActiveRecord::AssociationTypeMismatch: Page(...) expected, got Hash(...) - So, do I always need to create the associated pages and then pass them to the order?
[20:34:49] rikkipitt: jenrzz: I ended up using gsub for the mail_merge! Nice and simple!
[20:38:53] jenrzzz: nobitanobi: http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html
[20:39:02] nobitanobi: jenrzzz: yep. I just did that
[20:39:27] nobitanobi: but what if I want to change the naming? instead of {"order" : {"pages_attributes": [{"url":"test"}]}} just do {"order" : {"pages": [{"url":"test"}]}}
[20:39:42] nobitanobi: this is obviously in terms of helping the end API user
[20:39:54] TImmaah21: Quick question.. I have an if/elsif. Elsif checks the controller.action.param. Is there any reason why rails seems to always execute the code in the elsif even if the if code is being called upon? http://pastebin.com/j9rNBwsM
[20:39:59] phat4life: ahh, nothing like making data changes in production console
[20:41:03] TImmaah21: pastie link: http://pastie.org/private/8ipeueyw8ddf53hw5xqcww
[20:41:50] mikecmpbll: TImmaah21: it doesn't.
[20:43:12] nobitanobi: Is there any way to change the naming of nested attributes? From model_attributes, to just model?
[20:43:39] tubbo: phat4life: transactions ftw
[20:45:04] bricker: nobitanobi: just look at how accepts_nested_attributes_for is implemented https://github.com/rails/rails/blob/master/activerecord/lib/active_record/nested_attributes.rb
[20:45:19] phat4life: there was a bug in one version of rails where ???sandbox didn't work
[20:45:23] mikecmpbll: nobitanobi: you'd be best modifying the attributes hash
[20:45:33] bricker: nobitanobi: the *_attributes= is hard-coded, but you could overwrite some methods to do it differently
[20:45:45] nobitanobi: interesting. thanks guys
[20:45:47] nobitanobi: I really appreciate.
[20:45:47] mikecmpbll: params hash*
[20:45:59] bricker: nobitanobi: I agree with mikecmpbll, params["pages_attributes"] = params.delete("pages") would be easiest
[20:51:16] TImmaah21: mikecmpbll: When i puts information in if and elsif and go to '/' both get printed out :/
[20:51:33] mikecmpbll: TImmaah21: i don't think they do
[20:51:40] mikecmpbll: TImmaah21: prove it!
[20:51:56] TImmaah21: I think it might be because is_active is being called twice with differing parameters by the navigation erb
[20:52:04] mikecmpbll: yeah that'll do it.
[20:53:51] nobitanobi: bricker: mikecmpbll thanks :)
[20:54:01] nobitanobi: I should do that in a before_filter in the parent controller right?
[20:54:14] bricker: nobitanobi: sure
[20:55:41] lectrick: pkircher: I am not yet in full control of the infrastructure/architecture so I can't switch them over to unicorn/nginx. They already use capistrano.
[20:56:14] lectrick: lethjakman: permissions, yes, one would think, although I have no idea where or why.
[20:56:18] brendan6: I have a situation where a series of ActiveRecord associations need to be built after an object is created. I want to avoid using an after_create callback because I don't want this to happen during testing. I also feel like I should avoid putting it into the controller action. Does anyone have any design pattern suggestions for a situation like this?
[20:56:38] joy4u: in situation where Request has many Bids, the bid is created by passing the id of the Request but anyone can change the id within their browser to create the Bid for any other Request so isnt that a security rik? i may be wrong
[20:56:41] lectrick: bricker: I checked the nginx error log. Nothing really illuminating.
[20:57:19] bricker: brendan6: need more info. Look up "service objects", might be your best/cleanest bet.
[20:57:43] lethjakman: lectrick: unicorn/nginx would be slower than passenger...so I wouldn't recommend that.
[20:57:57] lethjakman: lectrick: do you know who nginx/passenger are being started as? what are the permissions of the directory?
[20:58:28] brendan6: joy4u: What about a nested route where the bid is created on the request then use an authorization library like Pundit to determine if a given user is authorized to create a bid for a given request
[20:58:29] jenrzzz: brendan6: yeah, depends on what you want to do. service objects are awesome but might be more than you need.
[20:58:39] lethjakman: brendan6: why wouldn't you want that happening during testing?
[20:58:47] bricker: lectrick: maybe it's not illuminating to you
[20:58:56] lectrick: lethjakman: the user for the nginx/passenger processes is www-data. Does that mean all directories being served out of need to be owned by that user, or only that that user needs to be in an administrator group (and the right group perms applied), or?
[20:59:26] lethjakman: lectrick: at least visible to. public and temp I believe need to be writable.
[20:59:50] lethjakman: could be wrong...maybe that's just whoever's deploying.
[21:00:03] brendan6: bricker: jenrzzz: I will look up a service object pattern. There are a bunch of associations that need to be made so its a rather complex scenario
[21:00:30] jenrzzz: brendan6: http://railscasts.com/episodes/398-service-objects is good
[21:00:42] bricker: brendan6: if you have a railscasts subscription, he talks about it here: http://railscasts.com/episodes/398-service-objects
[21:01:00] jenrzzz: cult of bates
[21:01:24] joy4u: brendan6: but in normal situation without using gem it is is a security issue, isn't that so?
[21:02:05] jenrzzz: joy4u: do you have some form of user authentication in place?
[21:02:30] joy4u: jenrzzz: yeah devise
[21:02:35] lethjakman: lectrick: don't quote me on that though, I'm tired. but I'm pretty sure your permissions are just wrong.
[21:03:21] lectrick: lethjakman: All I did was try to upgrade the Passenger gem to a newer version. If you can explain to me how that could hose permissions, I'm all ears
[21:03:44] jenrzzz: joy4u: depending on how complex your authorization rules are, you could either do it yourself in the controller or use a gem like cancan
[21:04:34] jenrzzz: joy4u: pundit is good too
[21:06:15] joy4u: jenrzzz: no i am not saying that suppose there are two Request whose ids are 1 and 2 respectively and a authenticated user is creating a bid for Request 1 but he/she can chenge the request id of the form that is passed to 2 then the bid will be created for request 2
[21:16:02] brendan6: bricker: jenrzzz Yep, this is definitely the right approach. Not to just come up with a name....
[21:18:05] brendan6: joy4u: First you check if the user is authorized to create a bid for a given request, and if so, allow them to create a bid. If they aren't, simply return a 401. No need to create a special error message because this is a situation in which someone is actually trying to hack your system
[21:18:27] brendan6: joy4u: I would recommend Pundit
[21:19:15] rikkipitt: hey channel, what's the best way to return a hash with specific info from many models?
[21:20:45] pkircher: with ???return???
[21:21:42] joy4u: brendan6: is pundit or cancan which one is better?
[21:22:00] pkircher: i like cancan better just my 2 cents
[21:22:01] brendan6: joy4u: Personal preference, but I like Pundit the best
[21:22:32] rushed: joy4u: may need cancancan for latest
[21:23:06] joy4u: rushed: which one is more powerful?
[21:23:32] rhizome: "powerful" is not a word i'd use to describe any authorization
[21:23:49] jenrzzz: rikkipitt: can haz more info?
[21:24:21] jenrzzz: joy4u: just look through the docs for each and see which one you prefer
[21:24:27] jenrzzz: both will work fine for what you???re trying to do
[21:24:55] s2013: anyone here reads/follows techcrunch
[21:24:59] mheld: hey y'all
[21:25:06] bratsche: I try to avoid it as much as possible.
[21:25:12] s2013: mheld, dude wtf you been.
[21:25:20] mheld: s2013: ha, what's up?
[21:25:21] s2013: did you get into YC mheld ?
[21:25:26] s2013: or did you apply
[21:25:46] rikkipitt: sure jenrzzz: as part of the mail merge thing we spoke about earlier, I'd like to have a sort of dictionary that can be accessed anywhere in my rails appthat takes info from several source models
[21:25:49] s2013: cause i saw a post by a company thats ycw14 and it seemed awfully like yours
[21:25:58] mheld: I did not, never papplied
[21:26:09] jenrzzz: rikkipitt: why do you want that?
[21:26:10] rikkipitt: just wondering the best "central" place to do so, maybe just a controller with a route?
[21:26:11] s2013: oh ok. maybe someone else in your space. crush em
[21:26:30] mheld: s2013: there was a logistics company in the last batch
[21:26:35] mheld: s2013: well, logistics-ish
[21:26:35] s2013: probably them
[21:26:35] rikkipitt: so I can have a predetermined list of info with symbols for the mail merge
[21:26:47] mheld: s2013: they're smart guys but totally in a different world :-)
[21:26:54] s2013: you're smarter
[21:27:08] mheld: ha, apparently not, because I'm mildly retarded
[21:27:29] rikkipitt: if that makes sense jenrzzz
[21:27:29] bratsche: What's your company?
[21:27:31] s2013: what you do?
[21:27:46] s2013: bratsche, he is going to buy walmart and amazon. mheld is not someone to mess with
[21:27:47] mheld: I'm designing an API right now and I can't figure out how to get a single resource wrapped around a collection
[21:27:57] s2013: brain farts probably
[21:28:17] s2013: give me example of what you are trying to do
[21:28:23] jenrzzz: rikkipitt: sorta. you want to map the tokens to replace with the data to replace it with?
[21:28:27] s2013: btw are you going to be at sf disrupt?
[21:28:34] mheld: I want /users/me/projects.json and /users/me/projects/1.json
[21:28:53] s2013: how does your routes look like now
[21:29:04] pkircher: easy with grape
[21:29:43] rikkipitt: jenrzzz, kinda yeah. I'm taking some text from the db (with user inputted tags - e.g. *|NAME|*) then running it through copy.gsub(/\*\|\s*(\w+)\s*\|\*/) { vals[$1.downcase.to_sym] } Where vals is a hash of data
[21:29:58] rikkipitt: but that data could come from several models
[21:30:24] mheld: s2013: http://pastie.org/private/pt3az5mepi9m5z1txtna
[21:31:10] s2013_: mheld, did you get my response
[21:31:24] mheld: s2013_: am I going to TCD? I'm not
[21:31:35] s2013_: oh alright. im at the nyc one
[21:31:37] s2013_: but i meant about the routes
[21:31:40] s2013_: your routes by default should do that
[21:31:59] s2013_: all you need to do is add defaults: { format: 'json' }
[21:32:12] mheld: s2013_: the issue is the /me scope
[21:32:29] s2013_: o.. i thought /me was just an example
[21:32:35] pkircher: just use current_user.projects
[21:32:43] pkircher: to render the response
[21:32:45] s2013_: what is /me ? i thought it was the username
[21:32:57] mheld: s2013_: I can get /users/me.json to work just fine, but /users/me/projects.json and /users/me/projects/1.json don't without manual intervention
[21:33:01] pkircher: ya i guess that supposed to be the current user scope
[21:33:12] mheld: s2013_: user id is encoded elsewhere
[21:33:15] s2013_: but if they are making an api call are they logged in somehow?
[21:33:19] pkircher: match ???wwhat/what/:id???
[21:33:20] s2013_: ar they passing some auth token
[21:33:27] pkircher: via: [:get]
[21:33:34] s2013_: you can also do that
[21:33:39] mheld: pkircher: that's effectively what I'm doing right now
[21:33:49] pkircher: for api design
[21:33:53] pkircher: i rather use grape
[21:33:54] s2013_: dont use match
[21:33:59] pkircher: and define the route directly in the resource
[21:34:00] s2013_: use get explicitly
[21:34:13] jenrzzz: rikkipitt: maybe add a #mail_merge_data method or something on each model that you need data for that returns a hash of the data, then merge all of those together?
[21:34:15] pkircher: well ya match gets via post as well if you want
[21:34:22] mheld: all I need to know is how do I get /me/ to stick there
[21:34:23] pkircher: > thats with the VIA statement
[21:34:25] bratsche: Can't you do resources :users ; scope '/me' ... ?
[21:34:31] bratsche: Or something like that?
[21:34:34] mheld: I can try scoping, but it forces /me at the beginning
[21:34:41] pkircher: or namespace
[21:34:42] mheld: I want /users/me/whatever not /me/users/whatever
[21:34:50] bratsche: Oh I see. I didn't realize it would push it in the front.
[21:35:02] rikkipitt: I could do jenrzzz, thanks for that
[21:35:57] pkircher: if you be able to consider a microframework for the api
[21:35:58] pkircher: http://pastie.org/private/lq2cnn6wsrlxmf4zo3qq
[21:35:58] jenrzzz: rikkipitt: how are you implementing your user-defined tags?
[21:36:09] bratsche: What about resources :users, module: '/users/me' ... end ?
[21:36:27] mheld: pkircher: I was using grape at one point
[21:36:37] bratsche: Not sure if module lets you do that.
[21:36:40] pkircher: just scope the call down to what you want ..
[21:36:47] rikkipitt: well jenrzzz, I'll be allowing the user to write some copy in a text area and provide them with some tags they can use of the format *|TAG|*
[21:36:56] pkircher: you used grape ? any change with oauth2 and .. swagger ?
[21:36:58] mheld: bratsche: oh, that's smart
[21:37:32] bratsche: mheld: Let me know if that works, I'm kind of curious. I've never tried to do anything like that before.
[21:38:11] s2013_: ohh. use path
[21:38:14] jenrzzz: rikkipitt: do you just store the mapping between the user tag name and your internal name?
[21:38:28] s2013_: resources :users, path: '/users/me'
[21:38:30] s2013_: try that mheld
[21:38:30] savish: Can some one take a look at http://stackoverflow.com/questions/23482249/pass-additional-params-to-a-controllerand tell me why I cannot pass additional params to the controller? I should be able too.
[21:38:33] bratsche: mheld: Alternately you could try scope '/me' ; resources :users, module: 'me' ... end :)
[21:39:04] mheld: bratsche: ha, yes that second one worked
[21:39:05] rikkipitt: jenrzzz: not sure what you're getting at...
[21:39:06] mheld: bratsche: gracias
[21:39:24] jenrzzz: rikkipitt: me neither. just wondering since your problems seem more interesting than mine today
[21:40:24] s2013_: mheld, does the path thing work
[21:40:43] mheld: s2013_: path thing?
[21:40:55] jenrzzz: savish: are you using strong parameters?
[21:40:57] s2013_: resources :users do; resources :projects, path: '/me/projects'; end;
[21:41:03] EvilEpoch: Warm Greetings to all, I am The EvilEpoch.
[21:41:11] mheld: s2013_: it worked with scope '/me'
[21:41:20] rikkipitt: jenrzzz: haha, I'm against the clock - I'm building an angular/rails app
[21:41:37] rikkipitt: trying to get as much done for a pitch on Weds
[21:41:37] mheld: s2013_: thanks :-)
[21:41:42] jenrzzz: rikkipitt: gotta pad that timecard :P
[21:42:23] rikkipitt: what are you up to? not that I'd be able to help!
[21:43:05] jenrzzz: just fuckin around with d3
[21:43:23] jenrzzz: not sure how I want to do the stats/visualization stuff i???m working on yet
[21:45:09] rikkipitt: i've used d3 on this project as it happens - probably in a different scope (requirejs, nvd3, d3 and some angular directives)
[21:45:46] jenrzzz: yeah i???m wishing i???d???ve used angular from the start. ended up needing more front-end dynamicness than I expected to
[21:46:25] tubbo: you can still use angular
[21:46:28] tubbo: if you want to that is
[21:46:35] jenrzzz: yeah but that requires extra work
[21:46:52] jenrzzz: someday though
[21:46:57] s2013: or backbone
[21:46:59] s2013: depends on what you wanna do
[21:47:05] s2013: d3 /angular are sometimes overkill..
[21:47:18] s2013: chartkick is pretty good for basic stuff
[21:47:27] tubbo: isn't d3 just for drawing vector graphics?
[21:47:40] jenrzzz: i could probably get by with a higher-level charting library
[21:47:47] rikkipitt: jenrzzz - this is my first angular app and it's so sweet so far
[21:47:48] jenrzzz: i???m using it as an excuse to get paid to learn D3 though
[21:47:57] jamto11: i am having trouble understanding rails's "self.abstract_class = true" from reading the documentation. What does STI table name of the parent class mean?
[21:48:34] tubbo: jenrzzz: maybe...most chart libs i've encountered tend to be way more complexity than i *actually* need
[21:48:41] tubbo: highcharts comes to mind
[21:48:44] rikkipitt: jenrzzz: best position to be in!
[21:49:13] tubbo: jamto11: i assume the "parent" is the class that inherits from AR::Base
[21:49:16] jenrzzz: tubbo: i feel the same. had some bad experiences with highcharts
[21:49:19] s2013: d3 has a huge learning curve that i havent gotten over yet
[21:49:21] s2013: highcharts is good
[21:49:30] jenrzzz: it touched me inappropriately
[21:49:36] jenrzzz: my data i mean
[21:49:41] jamto11: why/when would i set self.abstract_class = true?
[21:49:54] jenrzzz: ???Set this to true if this is an abstract class (see abstract_class?). If you are using inheritance with ActiveRecord and don't want child classes to utilize the implied STI table name of the parent class, this will need to be true. For example, given the following:"
[21:50:00] tubbo: s2013: have you ever worked with cairo or any drawing libs?
[21:50:03] tubbo: swing/LOGO/etc.
[21:50:05] lethjakman: ooo d3 looks cool.
[21:50:10] s2013: raphael i think
[21:51:00] jenrzzz: jamto11: are you using single-table inheritance?
[21:53:41] Tzeejay: Hey guys I'm trying to resolve this access issue. I want my users if there is no user id defined in the session to get redirected to the root url. I have added a 'before_filter' in my 'application_controller' since most of my controllers are restricted. In the controller that handles login/signup/etc I have added a 'skip_before_filter' so that everyone can access them and in
[21:53:41] Tzeejay: the other I haven't but it doesn't work. I know that the code is being called but it wont read the data in my session cookie. https://gist.github.com/Tzeejay/57b301c9a31514e3953e
[21:54:00] bratsche: I use cairo at work still. Very nice vector library.
[21:54:58] tubbo: s2013: i like how D3 is basically a more web-like, rather than pure JS, solution to the problem of "i need to draw something on the screen and oh btw can it be interactive?"
[21:55:06] tubbo: raphael is good at drawing SVG but that's about it
[21:55:15] s2013: d3 is really good and powerful
[21:55:24] s2013: but for 99% of the stuff i do i just use highcharts/chartkick
[21:55:40] tubbo: it's kinda weird, you look at it and you're not quite sure what kind of lib it's trying to be.. :P
[21:56:25] tubbo: Tzeejay: so basically, `session[:user_id]` is always nil?
[21:56:27] s2013: yeah but you know a d3 chart when you see one
[21:56:36] jenrzzz: Tzeejay: what session store are you using?
[21:57:52] Tzeejay: tubbo: No. When the user is loged in I set it to the user id (if I understand it correctly what I read)
[21:58:32] bratsche: I guess I'm just overly opinionated about graphing, but one thing that always bugs me about graphing/charting libraries is that they include pie charts. I've never run across a situation where a pie chart is the optimal way to convey information to a user.
[21:58:40] jenrzzz: Tzeejay: what does ???doesn???t work??? mean in this context?
[21:58:43] tubbo: Tzeejay: `redirect_to 'welcome/index' unless :current_user?` might be fucking you up. :)
[21:59:15] tubbo: Tzeejay: 'current_user?' is a method, not a symbol. and i think by passing it a symbol, you're ensuring that the expression will *always* be false, because :current_user? resolves to `true`. (any symbol does)
[21:59:41] lethjakman: bratsche: easy. when you're trying to show what percentage it is of something. blah percent of users.
[21:59:55] Tzeejay: jenrzzz: when I try to access a theoretically restricted site it renders everything even though I should redirect me. I deleted the cookies myself and I have an action to set the session to nil
[22:00:02] tubbo: bratsche: only in "what i do all day"-style charts for funnie
[22:00:23] jenrzzz: Tzeejay: oh yeah, tubbo is right. i read that as unless: :current_user? but that doesn???t make sense
[22:00:35] tubbo: jenrzzz: it would if he was using a before_filter :)
[22:00:47] jenrzzz: Tzeejay: either change it to before_filter :require_login, unless: :current_user?
[22:00:55] jenrzzz: or redirect_to ???welcome/index??? unless current_user?
[22:01:06] bratsche: lethjakman: But any time I want to do something like that I find that I'd rather present that type of information over time, and I can use a stack chart or something similar to convey much more information in the same amount of space.
[22:01:29] EminenceHC: Is anyone using signature pad with rails? I can't seem to get my JS to load correctly.
[22:02:17] bratsche: lethjakman: I know what a pie chart is for, it's just that it's almost never really the best way to graph that kind of data.
[22:02:29] jenrzzz: EminenceHC: what isn???t working?
[22:02:52] lethjakman: bratsche: I think it's more for just a really quick simple over view. I definitely think they're the easiest chart for someone to glance at and undertand.
[22:03:26] EminenceHC: jenrzzz: I can't get the canvas to show. I am thinking maybe it has something to do with my JS files in the assets pipeline when they shouldn't be?
[22:04:03] jenrzzz: EminenceHC: did you add the assets to your application.js or include them in your layout?
[22:04:21] lethjakman: meh. it's all opinion though
[22:04:39] EminenceHC: jenrzzz: I did not link to them in application.js. I put them in assets/javascripts.
[22:04:52] lethjakman: EminenceHC: are you requiring tree?
[22:04:55] lethjakman: or the specific file?
[22:05:06] EminenceHC: lethjakman: requiring tree
[22:05:07] tubbo: require_tree considered harmful :P
[22:05:08] Tzeejay: jenrzzz: The first solution worked. Thanks a lot!!
[22:05:22] lethjakman: Tzeejay: I don't like it. but it's a common option.
[22:05:29] lethjakman: er...tubbo not tzeejay
[22:05:30] bricker: lethjakman: One thing I'm really missing in Spotify that Rdio does is automatically start playing a "radio" station after your queue (eg. an album) is over
[22:05:44] Tzeejay: tubbo: Symbols are always true? Who had that idea?
[22:05:45] bricker: lethjakman: in Spotify the album just ends and you get silence, in Rdio it starts playing similar music
[22:05:48] lethjakman: EminenceHC: hmmm. is it in a directory?
[22:05:53] tubbo: lethjakman: it's never a good option if you have any significant level of js code
[22:06:00] tubbo: Tzeejay: when exactly would a symbol be false?
[22:06:01] jenrzzz: Tzeejay: the only false values in ruby are false and nil
[22:06:04] lethjakman: bricker: do you have the replay album enabled?
[22:06:11] bricker: Tzeejay: true-ish, not literally true
[22:06:19] EminenceHC: What is the alternative to require tree? Manually link every single js file in application.js?
[22:06:23] lethjakman: bricker: the best queing I've ever seen was on clementine. you can actually hook that into spotify if you want.
[22:06:25] tubbo: ^ they resolve to true
[22:06:32] bricker: lethjakman: replay album?
[22:06:39] lethjakman: tubbo: I agree with you. I just know that's how most people do it.
[22:07:07] tubbo: EminenceHC: yeah...some of those libs depend on other libs. for example, loading jquery_ui *before* jquery wouldn't make sense.
[22:07:15] lethjakman: bricker: yeah...it's not the proper term...it's the little circle button with arrows. it'll just keep replaying the album you're on.
[22:07:41] tubbo: EminenceHC: so it's the best practice to explicitly require every file. *however*, with frameworks like ember.js and angular, sometimes you can get around that by making dirs and require_tree'ing *those*, such as //= require_tree ./models
[22:08:10] EminenceHC: tubbo: I see.
[22:08:14] tubbo: EminenceHC: the problem is you can't tell me what order require_tree is loading files in. indeed, the order can change without warning and break your code for no reason.
[22:08:54] rushed: the order is alpha in my experiance
[22:08:59] EminenceHC: Why does some javascript need to be included after the html? Maybe that is what is throwing me.
[22:09:31] jenrzzz: it doesn???t *need* to be, but it can improve page load times to include javascripts at the bottom
[22:10:10] tubbo: yeah, that's another best practice
[22:10:39] tubbo: JS is executed as it's encountered. so if you try to bind an event handler to an element that doesn't exist, it just won't do anything
[22:10:39] bricker: lethjakman: eh, I want it to do what Rdio does
[22:10:54] bricker: lethjakman: but not bad enough to switch back to Rdio :)
[22:10:56] tubbo: therefore, if you bind the event before the element gets on the page, something breaks but doesn't throw an error.
[22:11:17] lethjakman: bricker: lol...fair. if you find a better alternative to both of these let me know! neither are really optimal. I still don't love spotify's mobile app.
[22:11:56] lethjakman: EminenceHC: some needs to be required in HTML because it's not required by your assets pipeline.
[22:12:18] lethjakman: the assets pipeline automatically src's what it can see.
[22:13:00] EminenceHC: lethjakman: So I should be fine if it is in the pipeline and gets loaded on every page right? My fear was that the js gets loaded before the html needs it and needs to be included after the html loads.
[22:13:59] tetraktys: Hey guys, in your opinion(s) when starting a new rails app: what is the best practice? i usually build something with rails-composer, but i think it was tubbo who mentioned something about rails templates
[22:14:24] _aeris_: ohai #rails
[22:14:35] _aeris_: i have some trouble with assets pipeline on production
[22:14:55] _aeris_: some of my assets generate /javascripts, some others /assets
[22:15:35] _aeris_: https://nsa.imirhil.fr/pages
[22:15:50] jenrzzz: tetraktys: i think everyone starts a little differently. not really a best practice
[22:16:04] _aeris_: application.css.scss is good (well compiled, good /assets url)
[22:16:19] tetraktys: jenrzzz, thanks. just fmy: when you create a new app: what do you do?
[22:16:32] _aeris_: pages.css.scss is bad, well compiled and well deployed, but wrong /stylesheets url :'(
[22:17:01] _aeris_: but the compiled css is really here and working (https://nsa.imirhil.fr/assets/pages-0afb13f625343117156b13240f7be64e.css)
[22:17:08] jenrzzz: tetraktys: git init, rails new, space out for a couple hours, smoke some weed
[22:17:23] tetraktys: that's bold _aeris_ , directing us to an untrusted website ;)
[22:17:36] _aeris_: tetraktys > it's trusted, it's cacert :)
[22:17:43] _aeris_: more trustable than any commercial ca :)
[22:17:45] tetraktys: jenrzzz, i'm afraid the coffee shop around the corner is closed :(
[22:17:57] lethjakman: EminenceHC: no, it'll always be loaded in the HTML. you protect it from being executed before the html is loaded with an onready
[22:18:18] tetraktys: Firefox doesn't trust your cerificate for shit... did you include the chain in the certificate?
[22:18:19] jenrzzz: tetraktys: idk, the apps that i???ve built from scratch have been different enough that i haven???t seen a need for a template
[22:18:30] jenrzzz: tetraktys: i feel like generators do enough for me already
[22:19:17] tetraktys: jenrzzz, that's exactly what i thought. Most apps are so different that i need to modify most controllers/models/views anyway
[22:19:48] _aeris_: https://paste.imirhil.fr/?98dbefbba0b0a199#71jmh10x+E8JnMLZNc3GvZVck0ClDfcU4J+E5YYemPA=
[22:19:51] _aeris_: here is my code
[22:20:04] _aeris_: tetraktys > yep, i hope
[22:20:07] _aeris_: let me check
[22:21:00] tetraktys: the problem seems to be: This website does not supply ownership information.
[22:21:17] _aeris_: oh, yep, i have no information in the cert
[22:21:35] _aeris_: only cn and issuer
[22:21:43] tetraktys: you might want to add that when going into production
[22:26:43] jenrzzz: _aeris_: why don???t you let sprockets handle that stuff for you?
[22:26:49] ericsonluciano: any idea how guard livereload work ok windows in terminal afte typing guard they stop at LiveReload is waiting for a browser to connect
[22:27:27] alantucker: when splitting up datetime via select_day select_month etc how is the information saved?
[22:27:32] _aeris_: jenrzzz > I hate managing css/js with tricks to avoid clash between rules in differents pages but with same name???
[22:28:03] _aeris_: so i split my css/js, one by controller
[22:28:17] _aeris_: but here, one is good, the other no ><
[22:29:15] jenrzzz: this is rails. weird shit happens when you do weird shit :P
[22:29:28] _aeris_: this is not weird shit
[22:29:29] jenrzzz: try doing the full path in your javascript/stylesheet_include_tags
[22:29:40] _aeris_: full path ?
[22:29:53] jenrzzz: stylesheet_link_tag ???/assets/stylesheets/#{params[:controller]}???
[22:30:04] jenrzzz: ???weird shit??? is defined as ???stuff dhh doesn???t do"
[22:30:11] _aeris_: strange, i have another app which no problem and same config ><
[22:31:11] liquid-silence: _aeris_ why would you do that?
[22:31:16] liquid-silence: so much duplication of code
[22:31:21] _aeris_: no duplication
[22:31:37] _aeris_: what i can mutualize is in application
[22:31:54] _aeris_: specific code is by controller or controller/action
[22:32:11] liquid-silence: yeah I see no use for that TBH
[22:32:14] _aeris_: avoiding css/js/html-id-class trick to apply style or js correctly
[22:33:16] jenrzzz: _aeris_: https://stackoverflow.com/questions/8760382/rails-3-1-assets-pipeline-in-production
[22:39:00] _aeris_: jenrzzz > i'm on 4.0.2
[22:39:12] jenrzzz: same thing
[22:39:18] _aeris_: and adding require 'sprockets/railtie' don't help
[22:39:26] _aeris_: and on another app, no problem ><
[22:39:56] jenrzzz: yeah, I wouldn???t expect it to
[22:41:13] jenrzzz: you kinda have to use sprockets as intended or do everything yourself, like specifying the full asset paths
[22:41:53] nobitanobi: If I have the following associations: User has_many Orders // Order has_many Pages -- How can I find all the pages that belongs to a User?
[22:43:04] Ericx2x: what does =~ mean in ruby?
[22:43:26] _aeris_: jenrzzz > i have no problem at all with same config on another project ><
[22:43:47] jenrzzz: _aeris_: cool, i???m happy for you
[22:44:00] jenrzzz: Ericx2x: regular expression match
[22:44:05] bricker: Ericx2x: it's comparison by match
[22:44:18] Ericx2x: i figured as much thanks
[22:44:21] jenrzzz: e.g. if ???foo??? =~ /[a-z]oo/
[22:45:04] jenrzzz: nobitanobi: you should do user has_many :pages through: :orders
[22:45:28] xavier23: HI guys. I need permissions system for rails4
[22:45:33] xavier23: any ideass?
[22:45:41] jenrzzz: xavier23: cancan or pundit maybe?
[22:45:58] jenrzzz: xavier23: what do you want to do with it?
[22:46:07] lethjakman: anyone have any good examples of authorize.net CIM? this documentation is pretty bad...
[22:46:26] xavier23: jenrzzz: 2 types of users with different permissions
[22:46:38] xavier23: cancan doesnt work with rails4 afaik
[22:46:39] jenrzzz: lethjakman: can you just use stripe? hehe
[22:46:54] lethjakman: jenrzzz: what's that?
[22:47:13] _aeris_: >>>><<<< working on my local computer on production env ><
[22:47:25] terrellt: How does Rails know what controller to point an object to for a show path?
[22:47:27] jenrzzz: lethjakman: not at all the answer to your question. https://stripe.com/
[22:47:37] terrellt: So that link_to "bla", object points to the right spot
[22:50:44] bricker: terrellt: it uses the class of the object to generate a route key, and then uses that to call the route helper
[22:51:07] jenrzzz: terrellt: specifically, it gets passed to url_for (http://api.rubyonrails.org/classes/ActionDispatch/Routing/UrlFor.html)
[22:51:08] terrellt: Right, where's the route generation? Digging through source now, but someone might know off the top of their head.
[22:51:17] terrellt: Yup, I'm about six levels deeper than that right now.
[22:51:27] lethjakman: jenrzzz: lol oh...
[22:51:31] lethjakman: I wish it were that easy...
[22:51:47] jenrzzz: just complain to authorize until they suck less
[22:51:50] bricker: terrellt: YourModel.singular_route_key
[22:52:19] terrellt: That doesn't make sense for me. I'm using a plugin that has a model called SolrDocument, but there's no solr_document_path.
[22:52:29] terrellt: There's some way to override it, and I'm looking for that
[22:52:36] bricker: terrellt: and basically this: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb#L181
[22:53:11] terrellt: #model_name maybe?
[22:53:29] bricker: terrellt: then either a) make a solr_document_path, or b) set the url_for options manually
[22:53:43] elaptics: terrellt: think that's what you need to override
[22:53:48] terrellt: bricker: The confusing part is it's working in this plugin. I want to know why, because I need to override.
[22:54:24] terrellt: OH, I got it
[22:54:26] terrellt: Thanks folks.
[22:54:55] lethjakman: jenrzzz: dude...there's no way. lol. have you seen the github? it has like..6 stars for their official gem.
[22:55:18] lethjakman: jenrzzz: https://github.com/AuthorizeNet/sdk-ruby
[22:55:31] lethjakman: this is the official authorize.net gem. with 6 stars. me being one of them.
[22:55:35] elaptics: terrellt: was it #model_name ?
[22:56:01] terrellt: elaptics: No, they had a route and I missed it somehow. I've overridden #model_name in the past before though.
[22:56:02] nobitanobi: jenrzzz: yep. That did the trick :)
[22:56:56] ericsonluciano: anyone willing to help me after this "livereload is waiting for a browser to connect then" my guard stop i'm using windows 8
[22:57:02] EminenceHC: lethjakman: Grrr turns out all my JS was fine. Seems to be a conflict with cocoon :(
[22:58:10] lethjakman: EminenceHC: ugh! that's super annoying.
[22:58:13] jenrzzz: ericsonluciano: #guard might be more helpful
[22:58:15] lethjakman: did you get it all sorted out?
[22:58:46] ericsonluciano: jenrzzz: yes i already follow all but still stop when i use guard at cmd
[22:58:52] EminenceHC: lethjakman: I need to figure out what exactly is causing the conflict but yes, thanks.
[22:59:08] jenrzzz: ericsonluciano: ?
[22:59:37] jenrzzz: ericsonluciano: i mean the freenode channel, #guard. not many people here use it or grok its internals
[22:59:55] ericsonluciano: jenrzzz: ahh okay thanks
[23:00:43] lethjakman: ericsonluciano: the github page is super useful if you need to file an issue too.
[23:00:58] jenrzzz: lethjakman: just be happy they have an official gem at all :P
[23:01:17] ericsonluciano: lethjakam: thanks :)
[23:01:40] lethjakman: jenrzzz: aren't they gigantic? lol...
[23:02:41] rikkipitt: can anyone help with validating this process? a user has many products. products have many websites (due to lots of users). But a user can only have one website each per product...
[23:03:12] jenrzzz: lethjakman: yes but they are an old dotcom company. i tend to have low expectations
[23:03:19] bricker: rikkipitt: then a website should belong_to :user and belong_to :product, and validate that they are unique
[23:04:19] rikkipitt: i've got those reciprocal relationships bricker, but how does the unique bit work?
[23:04:27] lethjakman: jenrzzz: I believe that. do you know of a better alternative?
[23:05:18] rikkipitt: ah index them together bricker?
[23:05:22] jenrzzz: lethjakman: depends on what you need, volume of payments, how much you want to spend on it, etc.
[23:05:48] jenrzzz: but if I were building something and needed to take people???s money, i???d probably start with stripe
[23:06:38] jenrzzz: they have a super nice API and have positioned themselves as ???payments for developers??? which makes me feel warm and fuzzy inside
[23:07:06] lethjakman: I'll have to play with it. thanks :)
[23:07:17] rikkipitt: validates_uniqueness_of :user_id, :scope => [:product_id]
[23:07:35] lethjakman: rikkipitt: add_index :table, [:column1, :column2], unique: true
[23:07:38] jenrzzz: xavier23: cancancan works with rails 4
[23:07:46] lethjakman: that's how I always end up writing it.
[23:07:55] rikkipitt: cheers lethjakman, I was thinking that might be it
[23:08:03] lethjakman: jenrzzz: is stripe pretty good with high volume?
[23:08:10] lethjakman: rikkipitt: np :)
[23:08:16] lethjakman: don't forget to do it in the model too
[23:08:17] jenrzzz: lethjakman: how high is high?
[23:08:20] lethjakman: otherwise you'll get an ugly error.
[23:08:40] lethjakman: well...for now just a couple thousand a month.
[23:08:47] lethjakman: all reoccuring.
[23:09:00] lethjakman: I'm not sure exactly what it's going to look like when we get out of beta of course.
[23:09:24] rikkipitt: lethjakman: cheers, I've figured the scope uniqueness for the 2 columns. thanks again!
[23:09:31] jenrzzz: yeah definitely. i think in its simplest form you can just include a payment widget from their CDN in an iframe
[23:09:55] jenrzzz: i think rackspace uses them and they???re probably doing a few million per month
[23:10:12] lethjakman: jenrzzz: ahhh inteersting. if they're good enough for rackspace they're good enough for me.
[23:10:17] lethjakman: I'm guessing they m ake PCI pretty easy?
[23:10:24] jenrzzz: yeah you don???t even have to worry about it
[23:10:31] jenrzzz: CC info never touches your servers
[23:10:46] lethjakman: jenrzzz: brilliant.
[23:10:47] lethjakman: thanks man :)
[23:10:59] ericsonluciano: i already slove my problem my using this guard start -p thanks guys
[23:11:04] jenrzzz: sure thing
[23:11:05] lethjakman: or woman...that's habit.
[23:11:15] jenrzzz: i have a Y chromosome
[23:11:40] jenrzzz: but i think dude/man/guys are trending towards gender-neutralness anyhow
[23:12:07] jenrzzz: ???thanks man??? sounds natural but i???ve never heard ???thanks woman"
[23:12:22] lethjakman: ahh ok. good to know. I just saw "jen" in your username and double guessed myself.
[23:12:32] lethjakman: yeah...pretty interesting.
[23:12:40] jenrzzz: my first name is jenner??? so that???s been my whole life pretty much
[23:12:50] lethjakman: jenner? interesting. what's the origin?
[23:13:36] jenrzzz: https://goo.gl/maps/kmXLp
[23:13:45] ericsonluciano: last question i have a input field f.datetime_select but instead of show this. i want to sve the time now instead of using this .datetime_select any idea?
[23:13:46] jenrzzz: my parents are kinda weird
[23:14:16] jenrzzz: alternative backstory is i was named after edward jenner, who probably singlehandedly saved us all from horrible smallpoxy deaths
[23:14:19] lethjakman: very interesting.
[23:14:28] lethjakman: go with that one
[23:14:30] lethjakman: definitely that one.
[23:14:45] jenrzzz: no one knows who that is though
[23:14:51] jenrzzz: and they never seem to care
[23:15:04] lethjakman: all you have to say is "saved the world"
[23:15:09] jenrzzz: they think of that one dude that is somehow associated with the kardashians
[23:15:11] lethjakman: they'll assume it's superman.
[23:15:17] lethjakman: that's horrid
[23:15:24] jenrzzz: my life :P
[23:16:16] lethjakman: could be worse...you could be the evil betty.
[23:19:11] jenrzzz: had to google that. don???t have much pop culture knowledge between 1995-2005
[23:19:46] lethjakman: lol...I don't think that's pop culture. I think that's just me.
[23:23:00] jenrzzz: wasn???t an enter the fist reference? hehe
[23:27:17] xavier23: jenrzzz: cancan does not work with rails4
[23:27:23] xavier23: jenrzzz: http://www.ready4rails4.net/gems/cancan
[23:27:54] xavier23: jenrzzz: http://stackoverflow.com/questions/20486316/cancan-not-fully-supported-in-rails-4
[23:28:30] jenrzzz: xavier23: https://github.com/CanCanCommunity/cancancan
[23:28:57] lethjakman: wait..how is that different from cancan?
[23:29:56] jenrzzz: it???s a fork
[23:30:32] lethjakman: is it better thouhg?
[23:30:36] lethjakman: I thought cancan was still supported.
[23:32:28] jenrzzz: lethjakman: it has issues with rails 4 and the repo hasn???t been touched for 8 months
[23:33:03] lethjakman: interesting.
[23:33:17] lethjakman: where oh were did bates go.
[23:33:42] jenrzzz: where all great rubyists go when they commit internet suicide
[23:34:13] lethjakman: noooooooooooo
[23:36:49] hephaestus_rg: are there any other good screencasts like railscasts
[23:36:56] lethjakman: hephaestus_rg: tons
[23:36:56] jenrzzz: teaching people well must burn like a mofo
[23:36:58] hephaestus_rg: to keep up w/ new stuff in rails
[23:37:09] hephaestus_rg: w/ similar format
[23:37:15] lethjakman: none purely rails t hough as far as I know...
[23:37:20] lethjakman: someone brought up a good one a while ago
[23:37:23] lethjakman: but it looked expensive.
[23:37:32] jenrzzz: garybernhardt did the same with destroy all software
[23:37:40] hephaestus_rg: man that was the awesome thing abt railscasts
[23:37:46] jenrzzz: i think you just get to that point eventually
[23:37:53] hephaestus_rg: only 9$/m at most
[23:38:26] lethjakman: hephaestus_rg: I really wana know how much he made.
[23:38:36] lethjakman: all of the videos were hosted...and I think for free since he advertised for them.
[23:38:40] lethjakman: sublime video.
[23:38:41] scolon725: I'm having issues trying to generate layout files with bootstrap...keep getting this error: Could not find generator layout:install
[23:38:44] lethjakman: he was smart.
[23:38:48] scolon725: anybody have ideas as to why?
[23:39:02] jenrzzz: i would pay an order of magnitude more than that and it would still be worth more than I pay
[23:39:06] lethjakman: scolon725: is the gem installed?
[23:39:22] scolon725: yep did bundle install and checked the gem list
[23:39:27] lethjakman: jenrzzz: I wouldn't be the developer I am today without railscasts. that's for sure.
[23:39:36] lethjakman: he was great at good practices.
[23:39:41] jenrzzz: scolon725: which gem?
[23:39:52] scolon725: gem 'bootstrap-sass', '~> 3.1.1'
[23:39:58] scolon725: it's for using devise
[23:40:00] jenrzzz: we should send him a cake or something
[23:40:19] jenrzzz: or make him a patron saint
[23:41:56] jenrzzz: lethjakman: what is the full command you are running?
[23:42:07] jenrzzz: also are you using rails_layout?
[23:42:24] lethjakman: jenrzzz: wrong person.
[23:42:39] jenrzzz: scolon725: words
[23:42:57] scolon725: rails generate layout:install bootstrap3
[23:43:13] scolon725: is rails layout a gem? sorry, pretty new to this
[23:43:33] jenrzzz: lethjakman: gonna work on your #method_missing
[23:43:46] jenrzzz: scolon725: yeah, don???t worry about it
[23:44:00] lethjakman: jenrzzz: what do you mean method_missing?
[23:44:45] jenrzzz: scolon725: are you doing the learn RoR book?
[23:44:46] lethjakman: I don't think that's me.
[23:45:03] jenrzzz: lethjakman: ruby joke. wasn???t funny :P
[23:45:21] scolon725: rails tutorial...hartl, but also just trying to work with user authentication
[23:45:24] scolon725: with devise
[23:46:44] jenrzzz: scolon725: alright. yeah I think the layout:install generator is a part of the rails_layout gem. so make sure that???s in your gemfile
[23:46:56] scolon725: ok, i will try that
[23:47:21] jenrzzz: scolon725: might want to look over the docs too: https://github.com/RailsApps/rails_layout/blob/master/README.textile
[23:47:35] scolon725: will do...thanks so much
[23:48:11] jenrzzz: lethjakman: you can just ignore most of the things i say. i???m completely insane
[23:48:55] scolon725: yep, installing the layout gem worked
[23:50:40] lethjakman: jenrzzz: it's cool, me too.