« Back to channel list

#RubyOnRails - 01 September 2014

« Back 1 day Forward 1 day »
[00:00:37] nahtnam: Hey guys! I have a variable called "@test" defined in the application controller, but when I go to the layout, and put <%= @test %>, it doesnt show up.
[00:01:23] Radar: nahtnam: steps to reproduce kthxbye
[00:03:04] mozzarella: maybe because it's nil?
[00:03:05] nahtnam: Radar: Step one: Create a new app. Step two: generate a random controller + view. Step 3: Set the root to your new view Step 4: Add this to your application_controller: `@test = "test"`. Step 5: Put this in your layout: <%= @test %> Step 6: Rails server
[00:03:17] Radar: nahtnam: That will work.
[00:03:24] Radar: nahtnam: Put your code on GitHub.
[00:06:26] nahtnam: Radar: Its not exactly in the layout. I actually have <%= render "layouts/navbar" %> in my layout.
[00:06:29] nahtnam: It should still work tho
[00:07:17] magg: hello i???m having trouble using active model serializers with nginx, i get this error: http://pastie.org/9517917
[00:08:11] nahtnam: mozzarella: Its not nil tho
[00:08:14] nahtnam: As far as I know
[00:08:23] nahtnam: @test = "Test"
[00:08:26] magg: any ideas?
[00:09:44] Radar: nahtnam: code on GItHub or ban
[00:09:46] helpa: magg: Do not beg / plead with people to help you. This includes asking questions like "Any ideas?" after posting your original question.
[00:09:46] Radar: magg: !rule10
[00:10:01] magg: oops sorry
[00:16:28] Radar: magg: I am not sure what could be going wrong there.
[00:16:43] magg: :( thanks tho
[00:16:53] Radar: magg: can you show us the code from data_importer/upload_controller?
[00:18:18] nahtnam: Radar: https://github.com/nahtnam/railslearning
[00:18:37] Radar: nahtnam: thank you
[00:19:05] Radar: nahtnam: You're defining it as a class-level instance variable instead of defining it as an instance-level instance variable
[00:19:27] Radar: https://gist.github.com/radar/91528d6710a52601f36f
[00:19:41] breakingthings: Trying to find information on using sass in a new rails 4 application without using sass-rails (because of the outdated sass version it uses, but not having asset pipeline integration would suck). Any help would be appreciated.
[00:19:55] magg: Radar: http://pastie.org/9517971
[00:20:51] magg: basically it complains about ```serialization_scope :view_context```
[00:20:53] Radar: magg: Where does it say that you can specify serialization_scope like that?
[00:21:48] magg: Radar: http://railscasts.com/episodes/409-active-model-serializers?view=asciicast
[00:21:53] nahtnam: Radar: Thanks. I appreciate it
[00:22:12] Radar: magg: what version of AMS are you using?
[00:22:26] Radar: magg: You might be using a more recent version than what that screencast covers
[00:22:36] Radar: And definitely, yes.
[00:22:39] Radar: So there's your problem.
[00:23:47] magg: Radar: the wierd thing is that on my local machine it runs OK, with webrick
[00:23:57] magg: using the same version, 0.9.0
[00:24:09] Radar: magg: Then i don't know why it would break on the other server.
[00:24:18] Radar: I would check 0.9.0 and see if it has that serialization_scope method at al
[00:25:05] magg: ok. i???ll check it out. thanks
[00:27:52] nahtnam: Radar: Slight problem. I have some variables defined in an initializer and if I try to use it with the code you provided, I get an error saying "undefined method"
[00:28:06] nahtnam: Using this: https://github.com/coinbase/coinbase-ruby
[00:28:20] nahtnam: and my initializer has something like this: $coinbase = Coinbase::Client.new()
[00:29:02] nahtnam: If you want, I can put it on github...
[00:29:10] nahtnam: Do you want a gist or a repo?
[00:43:47] Radar: nahtnam: You've not explained the error again.
[00:44:07] Radar: "undefined method" is completely useless without 1) the full error message and 2) a full stacktrace
[00:44:12] nahtnam: Sorry one sec
[00:45:27] mikedugan: is there a brief story on why the mysql gem is mysql2?
[00:46:30] nahtnam: Radar: I have an initailizer with this code: https://gist.github.com/nahtnam/33529d5c9a1ba74a622b Now, I tried using this code, as suggested by you previously: https://gist.github.com/nahtnam/6b65a1a37ed50c0b9e3f
[00:46:50] nahtnam: But am getting an error saying that $coinbase doesnt exist
[00:47:05] mikedugan: nvm, I know how to google :)
[00:48:43] nahtnam: Sorry for bothering you Radar.
[00:48:48] nahtnam: I accidentally put $bitcoin
[00:48:52] nahtnam: instead of $coinbase
[00:48:54] Radar: nahtnam: bro
[00:49:10] Radar: nahtnam: All you have to do when asking in this channel is 1) show the code 2) show any and all error information
[00:49:15] Radar: That way, you don't make me annoyed
[00:49:21] Radar: CONSISTENTLY you fail to do these basic things
[00:49:26] Radar: Please try to take more care.
[00:51:04] mikedugan: Radar, please tell me you are named after the MASH character
[00:51:09] Radar: It's even in the rules!
[00:51:20] Radar: mikedugan: Nope! I got this name because I can't ignore any sounds :P
[00:52:15] mikedugan: I realllly hope you don't have a beep on new IRC messages
[00:53:27] mikedugan: so how much hate gets thrown around for PHP devs in this channel?
[00:53:59] Radar: mikedugan: None! This is a welcoming channel :)
[00:54:40] mikedugan: you guys are better than me. I do PHP by trade and even I can't stand some PHP devs :)
[00:55:32] archon-: is there a way to make rspec show the html that failed?
[01:01:51] Radar: archon-: In what context?
[01:03:41] tuelz: hi friends
[01:05:55] archon-: radar: the test is saying "should have_link" is false, but i see it when i visit the page in my browser. i want to see what the test is seeing
[01:06:02] helpa: archon-: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[01:06:02] Radar: archon-: !rule3
[01:06:33] archon-: i'm just doing the rails tutorial
[01:07:02] Radar: archon-: If you want to see what the test is seeing then a helpful gem for that is the launchy gem
[01:08:00] Radar: archon-: add it to your Gemfile, then in your test, put save_and_open_page. It should open that page up.
[01:08:30] archon-: test is running on a vagrant vm.. will that still work?
[01:10:04] archon-: is there just a 'save' ?
[01:11:05] archon-: ah, save_page
[01:11:08] archon-: that should work
[01:11:12] Radar: archon-: yup
[01:11:23] sevenseacat: dont even need launchy for that one
[01:15:13] archon-: is that part of rspec or do i have to use capybara for that?
[01:15:23] sevenseacat: probably capybara
[01:15:40] tuelz: anyone good at picking out fonts from pictures? Looking for this font http://www.calmar.ws/dotfiles/dotfiledir/calmar256-dark.vim
[01:16:16] archon-: that's not a picture :)
[01:16:41] tuelz: lol I'm an idiot
[01:16:42] tuelz: http://www.calmar.ws/vim/calmar256-dark.vim.png
[01:17:34] archon-: dunno, maybe try identifont
[01:18:35] tuelz: archon-: cool, was hoping someone knew some software for this
[01:19:57] sevenseacat: i dont know what font that is, but cripes just looking at it gives me a headache
[01:20:21] tuelz: lol really?
[01:20:39] tuelz: my jerb got me one of those retina things so I want a really thin crisp font now
[01:20:56] sevenseacat: yeah im not a fan of really thin fonts
[01:21:04] sevenseacat: but then again my eyesight aint that great so that probably doesnt help
[01:21:38] tuelz: oh well I have the eyesight of 10 greek gods.
[01:21:43] tuelz: or slightly better than average
[01:21:48] tuelz: but it's more fun to say the former
[01:21:54] sevenseacat: i need new glasses :(
[01:22:06] tuelz: just wait a few years and get bionic eyeballs
[01:23:11] sevenseacat: last week i told off a coworker who decided to start our really loud coffee machine right when i was on the phone with a client... turns out it wasnt a coworker, it was a different client
[01:25:35] EasyCo: If I have a variable of type MyCoolClass::ActiveRecord_AssociationRelation is there a way to write a MyCoolClass method that has access to it? i.e: Post.all.some_batch_method where some_batch_method has access to the Post.all collection?
[01:25:58] EasyCo: Other then something like Post.some_batch_method(Post.all)
[01:27:15] sevenseacat: you have access to any scopes/class methods on a relation
[01:28:14] tuelz: sevenseacat: I hope you didn't feel bad, clients need to know their place
[01:28:34] sevenseacat: i apologized profusely >_>
[01:29:53] mikedugan: these are the reasons work doesn't allow me to talk to clients unless it's emergent/level 2+ support
[01:31:00] tuelz: I'm a pushover. Clients love me, people who enojy making money off me don't.
[01:31:12] tuelz: That's why I stopped doing contract work.
[01:31:36] tuelz: I was never satisfied for the amount of work I produced for the moneythey paid. Often times worked 50%+ what they paid me for.
[01:31:58] mikedugan: at my former employer (who thankfully didn't give 2 shits) I asked a rather stubborn client "do you have any remote concept how the internet works"
[01:32:04] tuelz: such is the mindset of someone who has been working for near minumum wage for close to a decade prior to coding
[01:32:21] tuelz: mikedugan: seems like a reasonable question to ask.
[01:32:32] tuelz: gotta start somewhere...set the bar low and move up imho
[01:32:41] sevenseacat: i've been tempted to ask clients that before
[01:32:59] mikedugan: lady was giving me shit because "there's this weird lock icon on google and it won't go away and I don't like it"
[01:33:32] tuelz: I usually start with, "Name three internet browsers" and gauge my follow ups from their answer
[01:34:28] mikedugan: konqueror, lynx, dillo...in order of preference ;)
[01:34:39] sevenseacat: tuelz: actually probably a good gauge
[01:35:02] sevenseacat: some people will say 'whats a browser', some people will name one or two, nerds like us will name over a dozen
[01:35:18] tuelz: I've actually just inheritted a dead project from harvards engineering department. The codebase was so retarded I spent a full day questioning whether or not I was a complete idiot because there's no way harvard has engineers this bad
[01:35:33] tuelz: mikedugan: dwb or go to hell
[01:35:37] sevenseacat: 'browser? thats like the blue e right?'
[01:35:53] tuelz: sevenseacat: they client is always right.
[01:35:57] mikedugan: sevenseacat, "yeah, Windows is my browser"
[01:37:55] mikedugan: I'm digging these routing helpers
[01:41:49] newmanships: Has anyone used the rapidfire gem? This might be dumb, but I don't see any model/controllers for it and I want to make some modifications to it
[01:42:17] tuelz: newmanships: not sure what rapidfire is but most gems don't have models/controller
[01:42:22] tuelz: just a lib
[01:42:35] tuelz: gems are ruby, not usually rails
[01:42:58] tuelz: they might have that structure if they are trying to override views or something, maybe, but I don't know much about gems, really.
[01:43:17] newmanships: so if I wanted to create a new association for it (belongs_to ...) what files should I be looking for?
[01:43:39] newmanships: yeah I ran rails g rapidfire:views & it creates the views for it but doesn't have that option for models/controllers
[01:44:00] Radar: newmanships: looks to me like an engine https://github.com/code-mancers/rapidfire
[01:44:03] Radar: newmanships: !enignes
[01:44:05] helpa: newmanships: http://guides.rubyonrails.org/engines.html - Engines Guide - Written by Ryan Bigg
[01:44:05] Radar: newmanships: !engines
[01:44:21] Radar: newmanships: Which model do you want to associate to?
[01:44:28] newmanships: My lessons model
[01:44:33] Radar: To rapidfire's?
[01:44:46] newmanships: I want rapidfire question_groups to belong_to lessons
[01:44:56] newmanships: and lessons have_many question_groups
[01:45:01] Radar: For that you'll probably want a decorator in your app
[01:45:06] rhizome: boy, sure are a lot of question-answer apps being written this week.
[01:45:10] Radar: https://github.com/parndt/decorators
[01:45:16] Radar: rhizome: it's the new flavour of the month!
[01:45:41] sevenseacat: i actually like the idea of a Q&A app as a tutorial
[01:45:48] Radar: sevenseacat: same :D
[01:45:49] newmanships: haha cool I will look up decorators
[01:45:56] sevenseacat: beats the tired old blog idea
[01:45:57] Radar: sevenseacat: I heard you were going to write a Rails book, confirm/deny?
[01:46:05] sevenseacat: Radar: i am considering it.
[01:46:14] Radar: sevenseacat: If you need an editor/co-author :P
[01:46:21] Radar: newmanships: So you would have app/decorators/models/rapidfire/question_group.rb, and then inside of that
[01:46:41] sevenseacat: but *someone* already wrote a freaking awesome one.
[01:46:54] Radar: sevenseacat: Write another. There was already at least 5 books published when I did mine.
[01:47:01] Radar: it doesn't hurt to rehash things in a different way
[01:47:02] newmanships: cool I'll read up on these decorators
[01:47:05] Radar: newmanships: https://gist.github.com/radar/d63de86342727aa5a8b8
[01:47:11] Radar: That would go into the decorator
[01:47:35] rhizome: 'bout ready to give up on functionals
[01:48:24] tuelz: I'm trying to get in on writing yet another framework. It's just about to hit 1.0, but pakyow is a ruby framework the guys I work with wrote. Seems a pretty novel idea with potential to be a backend centered solution to what frontend frameworks seem to be trying to solve
[01:49:01] tuelz: (seemed like the appropriate time to plug the project)
[01:49:27] tuelz: rhizome: functionals? you mean functional langs?
[01:49:50] tuelz: http://pakyow.com
[01:51:00] rhizome: no, tests. they are sometimes inscrutable
[01:51:34] tuelz: essentially you write views for prototypes and it does the backend routing etc for you. Nice for frontend devs wanting to get in on the goodies that real frameworks have to offer without the pain of immediately jumping into coding
[01:51:55] tuelz: but I think the real potential lies in the ability to handle ajax-ish stuff on the backend
[01:52:39] tuelz: it could seriously take away some complexity if your 'one true state' continues to live on the backend instead of trying to create a store on the client that does a bunch of complex thigns with promises
[01:53:14] rhizome: man i hope you aren't talking to me :P
[01:53:18] tuelz: but I don't even know if that's where they are trying to take the project.
[01:53:24] tuelz: rhizome: lol nope, talking about pakyow
[01:53:37] tuelz: rhizome: god I see the confusion now LOL
[01:54:34] tuelz: rhizome: I think the next time I hop into IRC I'll just start babbling incoherently slipping in buzz words to do what I've just done accidentally to you. Sounds like fun.
[01:57:12] tuelz: ctrl-M /input return
[01:57:48] tuelz: that was some strange bugginess. I honestly am super surprised by how buggy osx is
[01:58:23] tuelz: I thought osx was awesome because it tried to keep things simple and make sure they work 100% for everyone
[01:58:39] tuelz: ayways another rant for another day...but I blame that weird ctrl-M stuf on osx
[02:12:37] rhizome: coding myself into a corner
[02:13:42] tuelz: rhizome: I don't know any other direction to code.
[02:13:51] newmanships: Radar that decarator is getting a uninitialized constant nameerror. The gem you linked me to (decators) said to call Decorators#register.. I think my problem is I'm not calling this in the right area. Where should I be looking to make this call?
[02:15:12] mikedugan: `<%= f.submit class: "btn btn-primary" %>` jesus shit that is beautiful
[02:15:29] sevenseacat: i wouldnt call the bootstrap classes beatiful, but the ruby code, yes :P
[02:16:00] mikedugan: shhh don't tell my secrets...but yeah, I wish laravel was that smexy for forms
[02:16:29] rhizome: i'm pretty much a bourbon/neat convert by now. no more class soup
[02:16:34] sevenseacat: i hear good things about laravel - it not so smexy?
[02:16:59] mikedugan: laravel is amazing...the HTML/Form builders aren't so much, but a lot of that is related to PHP
[02:17:31] mikedugan: to do the same thing laravel style would be `{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
[02:17:53] sevenseacat: not tooooo bad
[02:18:04] sevenseacat: not real pretty, but not that bad
[02:18:36] mikedugan: yeah...I just wrote a wrapper/helper that does something like {{ Twbs::submit('Submit') }}
[02:19:14] sevenseacat: i have a bit of a soft spot for php, as much as everyone lambasts it (and i do too)
[02:19:53] mikedugan: don't get me wrong, PHP has come leaps and bounds since the <=5.2 days...still a bit wonky though (we just got the splat operator in the latest release fx)
[02:21:13] tuelz: rhizome: having never used neat, how does that solve the class soup? Just encourage better strucutured sass?
[02:21:56] tuelz: because bourbon just seems like another css lib with mixins
[02:22:29] sevenseacat: thats the key - with mixins
[02:22:47] sevenseacat: i'd love bootstrap a whole lot more if it was composed of mixins you included into your own css files
[02:22:57] sevenseacat: instead of encouraging class soup
[02:23:15] tuelz: sevenseacat: does bootstrap not have mixins? I've almsot exclusively used foudnation but I presumed it did
[02:23:58] mikedugan: in an ideal world of HTML5 & semantic markup the whole class soup situation wouldn't be so prevalent...I think we'll eventually see a move back to ids for containers and use of the semantics of the markup to apply styles..hopefully
[02:24:35] rhizome: it solves it by letting you keep it to normal html/css and adding the styling in sass: a.login { @include button; }
[02:25:07] mikedugan: ah, that's nice
[02:25:14] sevenseacat: you can do that kind of stuff in bootstrap, but it's not the default way, not encouraged and it generated some awful css
[02:25:29] rhizome: where do i sign up!
[02:25:33] mikedugan: though I suppose you could achieve that with bootstrap... a.login { .btn.btn-primary } or whatever the syntax is
[02:25:33] tuelz: anyone here have experience with 'smacks' or w.e. that css ideology is?
[02:25:45] sevenseacat: i've heard of smacss... havent read the book
[02:25:51] tuelz: I'd never heard of it until I started interviewing with people on the west coats
[02:25:52] sevenseacat: i do own the book <_<
[02:26:11] tuelz: almost everyone on the west coast asked me if I used it.
[02:26:12] mikedugan: read once, sorta use, but don't do enough frontend for it to stay fresh
[02:26:26] sevenseacat: i havent done a lot of frontend work in a long time
[02:26:29] rhizome: if it comes in the form of a one-book manifesto, west coast people will glom onto it
[02:27:03] mikedugan: the east coast is the fucking legacy half of the country if I've ever seen it
[02:27:10] tuelz: I was just starting to like frontend work and now I'm almost exclusively backend, lol. Honestly backend is more fun, but I was learning a new FE framework (emberJS) and that was nice.
[02:27:28] sevenseacat: emberjs is also on my very long list of things to get good at
[02:27:33] mikedugan: I have to work some with knockout and once in a blue moon on angular at work...I hate JS
[02:27:42] sevenseacat: rails is first on the list -_-
[02:27:56] tuelz: the internet is still on my list
[02:28:07] tuelz: after that I'll try and be good at programming things for the internet
[02:28:15] mikedugan: you mean teh interwebs?
[02:28:20] tuelz: I still don't know wtf a submask really does.
[02:28:36] mikedugan: you don't need to. That's for the sys/net admins to worry about :)
[02:28:42] tuelz: and why does networking have 7 layers or w.e.?
[02:28:45] rhizome: subnet mask
[02:28:51] tuelz: LOL that too
[02:29:01] sevenseacat: now you're dragging up stuff i havent thought about since uni
[02:29:21] tuelz: sorry, was fleshing out my own openvpn from scartch yesterday
[02:29:29] tuelz: had to use that crap
[02:30:10] mikedugan: subnet masks aren't that bad really. If you've ever had to use CIDR block notation it makes sense
[02:30:11] tuelz: also been reading a lot of WC standards lately to try and learn semantic web stuff for a project at work
[02:30:35] tuelz: mikedugan: you lost me at CIDR
[02:31:13] mikedugan: CIDR is just a fancy way of specifying a certain section of IP addresses :)
[02:31:26] mikedugan: ie 0.0.0.0/0 is the whole www
[02:32:16] tuelz: ahh, yeah I know that stuff vaguely
[02:32:22] rhizome: it's actually "everything outside of my interfaces"
[02:32:24] tuelz: like /24 is 255.255.255.0
[02:32:27] tuelz: or something
[02:32:52] tuelz: have no idea what that means. I just know to type it if the internet shows me those numbers
[02:33:01] rhizome: it's bitwise math
[02:33:14] mikedugan: yeah...basically /nn is the block from starting_ip to starting_ip + 2^(32-nn)
[02:33:54] tuelz: if I were good at programming I would probably understand you. I think I'll get good at being a brogrammer and then I'll work on programming
[02:35:07] mikedugan: I used to do systems at a hosting company that owned a /20, you'll rarely need it unless you go down the admin road
[02:35:47] tuelz: I do a lot of 'devops' for fun. But I just hack away at google and copy/paste until it works
[02:40:03] newmanships: If I'm trying to initialize something in my say LessonsControllers like @lessons = Lessons.all that works fine. But I want to initialize something from a module what is the correct structure for that? Say module Foo class Bar
[02:40:11] usinganalias: Hello all! Reading the rails tutorial and it says to run ???bundle update???, then ???bundle install??? - why is that? Doesn???t bundle update install already?
[02:40:41] sevenseacat: newmanships: your model is called Lessons? models should be singular
[02:41:13] newmanships: wait my @lessons should be @lesson?
[02:41:59] sevenseacat: no, Lesson.all
[02:43:14] newmanships: oh yeah sorry that was a typo
[02:43:20] newmanships: it is Lesson.all
[02:44:07] newmanships: but right below that I'm trying to create a @bar = Bar.all or @bar = Foo.Bar.all but I'm not sure how I'm suppose to 'reach' that class
[02:44:24] newmanships: so I keep getting uninitialized constants
[02:45:50] sevenseacat: ok, lets see some real code
[02:46:49] newmanships: ok I'll put it on pastebin
[02:48:34] newmanships: http://pastebin.com/9EE9yK2m sevenseacat
[02:49:15] newmanships: oh, no pastebin allowed: https://gist.github.com/anonymous/5f23f8e53b33e83a7bdf
[02:49:42] Radar: newmanships: where's the error?
[02:49:44] helpa: newmanships: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[02:49:44] Radar: newmanships: !gist-usage
[02:50:23] newmanships: I'm not sure how to allow the lessons controller to get acces to the QuestionGroup class
[02:50:29] sevenseacat: well what is ???
[02:50:40] newmanships: that's what I'm not sure what to put there
[02:50:51] sevenseacat: it already has access to it
[02:50:59] newmanships: I've tried @questiongroup = Questiongroup.all, Rapidfire.QuestionGroup.all
[02:51:02] sevenseacat: it would just me Rapidfire::QuestionGroup
[02:51:31] newmanships: I still get uninitialized constant w/ that
[02:51:41] sevenseacat: and the error is
[02:51:52] newmanships: uninitialized constant LessonsController::RapidFire
[02:51:59] sevenseacat: Rapidfire != RapidFire
[02:52:01] Radar: newmanships: Error+stacktrace in a new Gist please.
[02:52:11] Radar: and what sevenseacat said
[02:52:29] newmanships: hahaha ok ty guys :)
[03:27:10] Rails_noob: Hey there guys, I am having a small issue with a circular dependancy issue that I???m struggling to solve, would anyone mind having a look for me?
[03:28:35] resting: for this statement, text_area(:post, :body, cols: 20, rows: 40), :post and :body are symbols, what is cols: and rows: called?
[03:29:34] resting: ooh..so can they are the same as symbols with colons in front?
[03:29:58] sevenseacat: {cols: 20, rows: 40} is another way of writing {:cols => 20, :rows => 40}
[03:30:28] sevenseacat: the first way is called 'ruby 1.9 hash syntax' as thats when it was introduced
[03:31:05] resting: ah..that's enlightening, i was always confused by the 2 different methods. thanks :)
[03:42:31] Rails_noob: sevenseacat: any way you can help me with a dependancy error I???m struggling with?
[03:42:42] sevenseacat: Rails_noob: you havent posted the error yet
[03:42:46] sevenseacat: so right now, no
[03:46:24] Rails_noob: sevenseacat: please find gist here https://gist.github.com/ryanvermooten/bbe3ade720383e5d3d81
[03:46:51] sevenseacat: but it doesnt have an error in it
[03:47:43] Rails_noob: my error is undefined method gardener
[03:47:51] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[03:49:50] Rails_noob: sevenseacat: I have added in the error from my terminal now
[03:49:51] Rails_noob: https://gist.github.com/ryanvermooten/bbe3ade720383e5d3d81
[03:50:26] TheTopBloke: IS there something I might be missing if I'm attempting to TDD an app, and nothing happens? Literally nothing happens. The command line just pops up. No error, no succes, nada.
[03:50:28] sevenseacat: so you're trying to call group.gardener
[03:50:39] sevenseacat: but you havent defined an association on group called :gardener
[03:50:54] sevenseacat: did you typo? gardener instead of gardeners?
[03:51:04] sevenseacat: TheTopBloke: what?
[03:51:33] TheTopBloke: either 'bundle exec rake tes' nor 'rake test' produces any output at all.
[03:52:05] sevenseacat: what happens?
[03:52:07] TheTopBloke: maybe a dependency is missing?
[03:52:25] sevenseacat: what do you have installed? what are you expecting to see?
[03:52:28] TheTopBloke: literally nothing. the command prompt just appears again after a second. there is no error, no anything
[03:52:51] sevenseacat: ok, so what are you expecting to see
[03:52:55] TheTopBloke: a basic TDD on an html page that is not there...
[03:53:03] TheTopBloke: an error notice
[03:53:16] TheTopBloke: $ bundle exec rake test
[03:53:16] TheTopBloke: 3 tests, 2 assertions, 0 failures, 1 errors, 0 skips
[03:53:32] sevenseacat: okay, so where's your test
[03:53:54] TheTopBloke: app/controllers/test_file.rb
[03:54:02] sevenseacat: thats not a test
[03:54:04] TheTopBloke: test/controllers
[03:54:20] sevenseacat: and i kinda meant 'show the test'
[03:54:26] TheTopBloke: ah, ok one sec.
[03:55:00] sevenseacat: i see that same behaviour when itry to run `rake test` in an app that isnt using minitest/test unit
[03:55:18] TheTopBloke: https://gist.github.com/TheTopBloke/443769247d1c6c6f4e5e
[03:55:44] TheTopBloke: I believe it is supposed to use rspec
[03:55:53] sevenseacat: `rake test` will never use rspec
[03:56:04] sevenseacat: and thats not an rspec test anyway
[03:56:06] TheTopBloke: dunno why they asked me to do it that way.
[03:56:28] sevenseacat: so whats the name of that file, and wheres your test_helper
[03:56:53] TheTopBloke: it is... test/controllers/static_pages_controller_test.rb
[03:57:01] Rails_noob: sevenseacat: you were 100% right. so now new error. Its also an undefined method error, pretty much exactly the same as before. however, this time I have set it to plural and its giving me an active_record_association_error https://gist.github.com/ryanvermooten/bbe3ade720383e5d3d81
[03:57:45] sevenseacat: Rails_noob: because what you are trying to do doesnt make sense
[03:58:05] sevenseacat: group.gardeners is a relation of multiple gardeners
[03:58:11] sevenseacat: you cant call .gardens on that
[03:58:27] Rails_noob: ok but if i have it as single
[03:58:41] sevenseacat: you already have group.gardens available
[03:58:46] sevenseacat: are you trying to use that
[03:58:59] sevenseacat: this code is a mess
[03:59:11] usinganalias: Hello all! If I run ???bundle install ???without production??? then ???bundle install???, does the second bundle install read Gemfile.lock (and not install :production) or does it read the Gemfile (and install :production)?
[03:59:34] TheTopBloke: it does not do production
[03:59:51] Rails_noob: if I have @garden = group.gardeners.garden.build I get the exact same error
[04:00:26] sevenseacat: Rails_noob: because it still doesnt make sense - what are you actually trying to do
[04:00:36] sevenseacat: i dont know what you're trying to do
[04:00:56] TheTopBloke: it should do the production on the bundle install the second time around,
[04:00:59] usinganalias: Perfect TheTopBloke - what if you run the following: ???bundle install ???without production; bundle update; bundle install??? - does the update replace the Gemfile.lock with production, then the last command installs production?
[04:01:38] Rails_noob: I have created a group, which works fine, then I have populated that group with gardeners, which works fine, now I would like to grab information from them about their garden so I want a group.gardeners.garden information
[04:01:43] Rails_noob: if that makes sense
[04:01:51] usinganalias: Thanks TheTopBloke! Unfortunately, that???s pretty confusing for me. The rails tutorial tells me to do this at one point: $ bundle install --without production
[04:01:52] usinganalias: $ bundle update
[04:01:53] usinganalias: $ bundle install
[04:01:55] sevenseacat: but they dont just have one garden
[04:02:11] Rails_noob: no each person should have just one garden
[04:02:23] TheTopBloke: right, the without production ignores the production portion of the .rb file
[04:02:24] sevenseacat: https://gist.github.com/ryanvermooten/bbe3ade720383e5d3d81#file-group-rb-L7 a group has many gardens
[04:02:25] usinganalias: Why does the rails tutorial do this? The first bundle install seems unnecessary (as production is eventually installed) and the last command seems redundant.
[04:02:43] Rails_noob: yes a group has many gardens through gardeners?
[04:03:00] sevenseacat: and still, group.gardeners is a list of multiple gardeners
[04:03:00] Rails_noob: or is that incorrect?
[04:03:06] sevenseacat: so you cant just call .garden on the list
[04:03:11] TheTopBloke: It does this because in the production environment the tutorial is expecting you to use postgresql. And locally you only need sqlite3
[04:03:18] Rails_noob: ok I hear you
[04:03:21] sevenseacat: what do you expect group.gardeners.garden to return
[04:03:27] TheTopBloke: So, --without production disregards the pg and whatever else that part has
[04:03:50] usinganalias: TheTopBloke: but then doesn???t the update fill in the production?
[04:03:52] TheTopBloke: Are you going to push it to a production server, in the tutorial case I believe it is heroku?
[04:03:58] usinganalias: That is true ;)
[04:04:26] TheTopBloke: Yeah, the update, then the install, bundles it with postgresql, and you can push that version to heroku.
[04:04:38] TheTopBloke: I'm not doing the heroku part, so I couldnt be much help beyond that.
[04:04:42] Rails_noob: well when I use group.gardeners(params[:gardener_id]) for my gardeners controller it is able to bring back one instance of the gardener
[04:04:50] Rails_noob: so I was hoping to have the same thing?
[04:04:58] TheTopBloke: Just be careful when reading it sometimes he puts command lines in there for example only and it can be confusing
[04:05:18] sevenseacat: but you're not using a param anywhere in group.gardeners.garden
[04:05:22] sevenseacat: so what do you expect it to return
[04:05:57] Rails_noob: because haven???t I already set the params above?
[04:06:20] usinganalias: Thanks - I???m not quite following though TheTopBloke. Doesn???t the ???bundle update??? include the production, so the original ???bundle install ???without production??? is pointless?
[04:06:30] Rails_noob: so maybe Im mis understanding how this whole thing is working
[04:06:35] Rails_noob: please stick with me :)
[04:06:39] sevenseacat: i most definitely think you are
[04:06:48] sevenseacat: you have a gardener in @gardener
[04:06:54] usinganalias: Oh, I see TheTopBloke - so he wants me to install everyting, but does those three commands just so I can see what he???s doing.
[04:06:55] sevenseacat: that gardener will have one garden
[04:07:00] sevenseacat: is that the garden you're trying to use?
[04:07:05] usinganalias: So I could just replace all three lines with bundle install?
[04:07:07] sevenseacat: i still have no idea what youre trying to do
[04:07:23] Rails_noob: ok let me try explain what I???m trying to do
[04:07:45] sevenseacat: i think the fact you've nested your routes so deeply is confusing you
[04:08:02] TheTopBloke: If I understand your question correctly, look at it as two options. --without production just does it without the production element (ie. postgresql). I believe you have to do bundle install after a bundle update. I could be wrong, but I'm pretty sure its required
[04:08:21] TheTopBloke: so, if you're not using --without production,
[04:08:28] TheTopBloke: then it should bundle it with those elements'
[04:08:39] usinganalias: Perfect - that makes tons more sense.
[04:09:28] Rails_noob: the org I work for collects data throughout its training programme, therefore I need some way to grab information from the gardeners as they go along, something similar to a state machine. So in the begining for a gardener to be created I get some pretty simple information, now I want to be able to go into the view of that gardener and fill in a new form for information regarding the gardeners garden.
[04:10:09] CodeOmegaPrime: I have a dedicated server and I have been coding with ROR for about a year now, I want to setup the server in a way that I can host and deploy my customers websites in a VPS environment that I can manage. Is there any sources of information anyone can suggest as googling yields services offered for hosting ROR but not setting up your own.
[04:11:33] sevenseacat: CodeOmegaPrime: http://railscasts.com/episodes/335-deploying-to-a-vps
[04:11:46] Rails_noob: does that make more sense or no?
[04:12:22] usinganalias: TheTopBloke - I ran all three commands w/ a ???<command> | grep pq??? and none of them included any of the production gems (one of which was pq). I assume then that ???bundle update??? updated only the gems installed prior, and ???bundle install??? only read off the Gemfile.lock? Could that be accurate?
[04:12:45] sevenseacat: Rails_noob: it does but that does not tell me what you want this action to do - i know what it should be doing given its the new action of a GardensController, but i dont know what you expect it to be doing
[04:13:00] sevenseacat: nor do i think you understand how your associations are set up
[04:13:05] sevenseacat: or how to use associations in rails
[04:13:35] TheTopBloke: I'm not sure... why the grep pg? this is bundle install | grep pg?
[04:14:43] usinganalias: Yep - just to see if it installed pg (which is in production)
[04:15:19] TheTopBloke: I don't know. Wish I could be of more help, but I'm not using postgresql so I couldn't tell you.
[04:15:32] TheTopBloke: I can only assume its not installed locally
[04:15:53] jarray52: I ran 'rake db:create' on a rails application. The <application_name>_development database got created, but the <application_name>_test database could not be created. This error is a bit weird. Has anyone else encountered it?
[04:15:55] Rails_noob: i am expecting it to allow me hit the form and fill in the information required. I am hoping that the information would be saved in a table called garden which has a one_to_one relationship with a gardener
[04:16:01] jarray52: I'm on Mac OSX
[04:16:38] TheTopBloke: sevenseascat - do you recommend minitest over rspec? how do I go about it? gem install minitest?
[04:18:21] sevenseacat: jarray52: whats the error?
[04:18:29] sevenseacat: TheTopBloke: i've never used minitest.
[04:18:37] jarray52: The error message stated that access was denied for user.
[04:18:38] Rails_noob: sevenseacat: Am I wrong in thinking that this should be a pretty simple thing to set up?
[04:18:47] sevenseacat: Rails_noob: nope, you're not wrong.
[04:18:53] TheTopBloke: ok, I'll get back to this in a little while. I installed rspec, and at least Im getting some error messages back.
[04:19:13] sevenseacat: jarray52: that's pretty unhelpful.
[04:20:01] Rails_noob: I guess I???m not sure why I can get the group/gardeners ass to work but not the gardeners/garden ass to work
[04:20:54] sevenseacat: Rails_noob: you have a gardener record stored in @gardener. is that the record you are trying to create a new garden for?
[04:21:04] sevenseacat: it works, you just dont know what it's trying to do
[04:21:28] Rails_noob: Yes I have a record stored and yes I am trying to create a new garden for that record
[04:21:31] Rails_noob: exactly right
[04:21:52] Rails_noob: any advise would be greatly greatly apprechated.
[04:21:55] sevenseacat: right, so forget all the group.gardeners.garden junk
[04:21:59] sevenseacat: its completely irrelevant
[04:22:08] jarray52: sevenseacat: To be more specific, the error message was 'Mysql2::Error: Access denied for user '<application_name>'@'localhost' to database '<myapplication>_test' : CREATE DATABASE '<application_name>_test' DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`.
[04:22:17] sevenseacat: Rails_noob: http://guides.rubyonrails.org/association_basics.html#has-one-association-reference
[04:22:28] sevenseacat: a gardener has one garden, so this is what you can use
[04:22:31] jarray52: sevenseacat: What i find strange is that the <application_name>_development database was created.
[04:23:02] sevenseacat: jarray52: or did it already exist
[04:24:28] jarray52: sevenseacat: Neither database existed. I deleted both in the mysql console.
[04:24:47] sevenseacat: then your mysql gem is magic
[04:25:23] sevenseacat: gist your database.yml ?
[04:25:24] Rails_noob: but sevenseacat: currently in my gardener model as well as in my garden model this is already how its set?
[04:25:31] sevenseacat: Rails_noob: what?
[04:26:01] Rails_noob: the ass as set out there, where it says has_one and belongs_to, thats how I already have it set
[04:28:30] jarray52: sevenseacat: https://gist.github.com/anonymous/6ec8081c147b3402a055
[04:29:01] Rails_noob: so I???m struggling to see what you???re telling me I should try do. should I try just @garden = garden.build?
[04:29:10] sevenseacat: seems legit. i dont know why mysql would let you create one database but not another.
[04:29:32] sevenseacat: Rails_noob: no. you have a gardener you want to build a garden for. follow the example in http://guides.rubyonrails.org/association_basics.html#has-one-association-reference
[04:29:57] jarray52: sevenseacat: I'm assuming this is something with my MacOSX config. It works fine on my Ubuntu box.
[04:30:08] sevenseacat: no idea. i dont use osx or mysql.
[04:30:24] jarray52: thanks for taking a look.
[04:31:00] jarray52: sevenseacat: Out of curiosity, do you use postgres or something else?
[04:31:07] sevenseacat: i use postgres on ubuntu
[04:31:23] jarray52: that's what I expected
[04:37:05] Rails_noob: sevenseacat: so should I be going @gardener.garden = @garden and then @garden = @gardener.build_garden?
[04:37:40] usinganalias: TheTopBloke, are you still there?
[04:38:04] sevenseacat: you dont have @garden, how can you do @gardener.garden = @garden ?
[04:38:28] TheTopBloke: Yeah I'm still here
[04:39:33] Rails_noob: sevenseacat: please could you tell me how I should set up just this one and then I can see what I should be doing? I still find all of this very confusing. I???m really trying and really not asking to be spoonfed, but I???m obviously missing this big time.
[04:40:09] sevenseacat: Rails_noob: you want to build a new garden for @gardener, so try @gardener.build_garden
[04:40:13] TheTopBloke: usinganalias: "In case you???ve previously installed a version of a gem (such as Rails itself) other than the one specified by the Gemfile, it???s a good idea to update the gems with bundle update to make sure the versions match, and then run bundle install to make sure the Gemfile.lock file is fully up-to-date:"
[04:40:42] usinganalias: Thanks! So I???ve checked and the commands I gave earlier ???bundle ???without production; bundle update; bundle??? actually do install everything without production. But this link: http://ryanbigg.com/2011/01/why-you-should-run-bundle-update/ ?????? says that bundle update throws out Gemfile.lock and starts from scratch. Do you know why ???bundle update??? doesn???t throw out Gemfile.lock and then restart the update from scratch (including
[04:40:43] usinganalias: :production)?
[04:41:55] TheTopBloke: apparently the update matches the versions, and the install locks the gemfile
[04:42:09] usinganalias: Awesome - that makes so much more sense. Thanks TheTopBloke!!!
[05:04:42] TheTopBloke: I figured out what the problem was. What a pill. Turns out neither minitest nor rspec were actually installed...
[05:05:03] TheTopBloke: So, I killed the sample_app, ran the gems on both, recreated the sample+app. and now it works.
[05:05:36] sevenseacat: not having minitest means you wont be able to run minitest tests, yeah.
[05:05:41] TheTopBloke: In the creation of a Gemfile, if you add stuff, it should install the dependencies right? Or no?
[05:05:51] sevenseacat: if you bundle after adding stuff, yeah.
[05:06:08] sevenseacat: just editing the Gemfile won't do anything.
[05:06:29] TheTopBloke: Right, I think the problem was I cut everything in the file, and pasted everything directly from the tutroial, which is funny, because its the first one I did that with and clearly it was an example of doing it wrong.
[05:06:52] sevenseacat: i dont know what your problem was.
[05:07:05] TheTopBloke: If I have say... jquery, and its a certain version, just leave it, dont write verbatim what it says in some other Gemfile somewhere online, or yer gunna have a bad time
[05:07:17] TheTopBloke: Im pretty sure that is what the problem was
[05:07:59] TheTopBloke: In the gemfile, it will says something like, gem sass-rails, then a version number. Just use the one it creates, which is the one that is local.
[05:08:04] sevenseacat: if you're following a tutorial, use the versions of the gem that the tutorial uses.
[05:09:56] TheTopBloke: Well see that's wha tI did, and I think the version were off, and somewhere along the line something didn't install or get created, or something related ot it. Because when I recreated it, and left the version numbers of what I had installed locally it worked. So for example, I actually had to create a test folder and test.rb the first app. After I deleted all of it, installed rscan and minitest, created a new sample_app,
[05:09:56] TheTopBloke: the test folder and test.rb were already there
[05:10:15] sevenseacat: then you did something wrong in the first app
[05:10:19] sevenseacat: i dont know what it was.
[05:10:42] sevenseacat: you're throwing out very vague ideas on what you think the problem was
[05:10:45] TheTopBloke: right. The only thing I can think of that I know I did differntly from other tutorials is that I used the .rb data from the tutorial
[05:10:56] sevenseacat: ACTION shrugs
[05:11:01] TheTopBloke: I'll give you example... one sex
[05:12:37] TheTopBloke: https://gist.github.com/TheTopBloke/550006f7d7b6242a9716
[05:12:47] TheTopBloke: There you can the difference between the tutorial and the one local
[05:13:45] sevenseacat: yes, so you were using different versions of gems than the tutorial was
[05:14:49] TheTopBloke: So whatever was not the correct version locally, one of those gems caused the problem and therefore, rspec and minitest were not installed. I assume that because I did install minitest and rspec. Either that, or I installed the latest versions. I simply did for example gem install minitest
[05:14:50] sevenseacat: ACTION will smile and nod and has literally no idea whats going on
[05:15:08] sevenseacat: neither of those gems lists rspec
[05:15:12] sevenseacat: *neither of those Gemfiles
[05:15:22] sevenseacat: and they both have minitest in the test group
[05:15:32] sevenseacat: wtf are you talking about?
[05:15:39] TheTopBloke: what about minitest-reporters?
[05:15:52] sevenseacat: in the test group of both Gemfiles
[05:16:30] TheTopBloke: hmmm, so it was completely unrelated. And it was simply a matter of rspec and minitest not being installed?
[05:16:41] sevenseacat: if you bundled, the minitest would be installed
[05:16:46] sevenseacat: it is in both Gemfiles
[05:16:52] sevenseacat: as a dependency of guard-minitest
[05:17:05] jblack: So, I want to add a class that doesn't really belong in a controller. I think I should put the class in either app, or lib. I'm not quite sure how to handle the include though
[05:17:08] TheTopBloke: Note: I installed minitest prior to this local Gemfile.
[05:17:15] sevenseacat: so? did you bundle?
[05:17:27] TheTopBloke: indeed, and I tested it, and it's working just fine now.
[05:17:45] sevenseacat: if you add stuff to your Gemfile, make sure you actually bundle it.
[05:18:02] sevenseacat: you can have it installed, but if its not in your bundle, you can't use it.
[05:18:32] TheTopBloke: so that begs the question, let's say I have an older version of a gem locally, and I bundle a gemfile with a later version, to clarify, it should download and install that later version of the gem, yes?
[05:18:59] sevenseacat: no. bundler will error out and tell you to run `bundle update` of the gem in question.
[05:19:06] TheTopBloke: ie.. the newer version, the latest verson of that gemfile
[05:19:16] sevenseacat: if you previously had the older version of the gem in your Gemfile
[05:19:37] TheTopBloke: Therefore, maybe, always bundle update first, then bundle install
[05:19:49] sevenseacat: don't just randomly bundle update
[05:20:31] sevenseacat: though if you have every gem in your Gemfile locked down like that, it would be okay
[05:20:44] sevenseacat: but you wouldnt typically do that in a normal app
[05:21:00] sevenseacat: lemme find an example
[05:21:36] sevenseacat: Gemfile for one app I worked on a while ago (actual production app) https://github.com/Useful-Inc/big-help-mob-webapp/blob/master/Gemfile
[05:22:14] sevenseacat: imagine running bundle update on that - it would try to update everything that wasnt pinned down
[05:22:53] TheTopBloke: yeah, that would be coffee break time
[05:23:48] TheTopBloke: its funny because someone was complaing the other day about ruby dependencies, but when you look at it, it seems that if you understand and are familair with the gemfiles, then it should really be a pain at all.
[05:23:49] sevenseacat: no, that would be 'your app is going to have a bad time' time
[05:24:05] sevenseacat: a lot of those gems have had major version updates since then
[05:24:11] sevenseacat: a lot of things would break
[06:23:49] usinganalias: Hello all! So sorry to keep bothering this channel! I???m trying to think of a circumstance where I would use ???bundle install??? after ???bundle update??? - RailsTutorial recommends installing after an update to make sure Gemfile.lock matches your Gemfile, but doesn???t update do that for you?
[06:24:18] rvanlieshout: i would assume bundle updates would do that
[06:24:41] sevenseacat: no bundle command you run should let your Gemfile and Gemfile.lock get out of sync
[06:25:10] pontiki: OTOH, what would be the harm of running it?
[06:25:11] usinganalias: That???s what I thought??? hrm.
[06:25:27] sevenseacat: no harm can come from running bundle install
[06:25:32] usinganalias: I???ll go for it - thanks :)
[06:26:06] sevenseacat: they should just stay here instead of popping in and out
[06:31:10] usinganalias: `bundle update` only updates previously installed gems, right (e.g. if a ???production was passed earlier, it wouldn???t include it?)
[06:31:22] usinganalias: * it would include it but nothing else?
[06:31:28] sevenseacat: you may as well just stay here and save coming/going all the time :P
[06:31:43] usinganalias: I know - I???m so sorry, I think I have all the answers, then something else pops up :P
[06:31:55] sevenseacat: it would update all gems in your Gemfile.lock, i would presume
[06:32:21] sevenseacat: those listed as dependencies in your Gemfile.lock
[06:32:28] sevenseacat: i dont know that for a fact but it would make sense.
[06:33:04] usinganalias: Oh, I know what it might be - it says it updates everything, ignoring Gemfile.lock - but the dash-dash command ran earlier sticks in because it???s remembered by .bundle/config
[06:33:29] usinganalias: Now I get it - those three lines have driven me mad for the last time. Still, I???ll stay on just in case :)
[06:35:49] sevenseacat: thats why i said the dependency list in Gemfile.lock - i presume that would be generated after any groups had been filtered out of the gems listed in your Gemfile
[07:17:04] adac: Guys, how is the devise confirmation token read out? I'm trying to create a preview mailer like this: https://gist.github.com/anonymous/3f6d46a9a465b456f5a5 but reading the token out like this does not work at all since the token seems to be invalid. Any ideas?
[07:19:21] sevenseacat: how is it invalid if you're reading it directly from the user record?
[07:23:43] adac: sevenseacat, Yes that was also my question actually ;) When I try to register via the application without using th preview mailer then The token does work. However the token that does work is not the same one that is saved in the database. So I thougt that there is might a function that somehow reads out the token and changes it
[07:24:27] sevenseacat: well if something changed the token after generating it, you wouldnt be able to use it
[07:24:32] sevenseacat: so thats definitely a no
[07:28:32] adac: sevenseacat, These are the two tokens https://gist.github.com/anonymous/e75c3965117b2a022602 All I can say is that the do differ. So i'm getting really confused
[07:29:11] sevenseacat: well which one is right, and where is the other coming from?
[07:29:23] sevenseacat: the first one looks wrong
[07:30:02] adac: sevenseacat, the first on ins the "confirmation_token" that is saved in the database. The second one is the one I get via email when I do register
[07:30:15] adac: Only the second one works
[07:30:28] sevenseacat: what version of devise is this
[07:30:58] adac: sevenseacat, devise (3.3.0)
[07:32:30] sevenseacat: oh interesting
[07:32:41] sevenseacat: https://github.com/plataformatec/devise/blob/v3.3.0/lib/devise/models/confirmable.rb#L220 seems there are two tokens - a raw token and an encoded token
[07:33:54] adac: sevenseacat, yes that mus be the explanation then
[07:33:58] sevenseacat: https://github.com/plataformatec/devise/blob/v3.3.0/lib/devise/models/confirmable.rb#L273
[07:34:14] adac: there is no other way since the second key is not in the database at all ;)
[07:34:32] sevenseacat: the encoded token gets stored, and the raw token from the email gets digested to look for matches
[07:48:50] adac: sevenseacat, what would be the way then to read it out correctly sevenseacat? I'm not sure which function I can use for that
[07:49:20] sevenseacat: doesnt look like you can
[07:52:35] adac: sevenseacat, hm yeah but well devise itself will do exactly that at some point, right?
[07:53:02] adac: sevenseacat, how does devise then know the correct token?
[07:53:04] sevenseacat: it will digest the raw token you give it to get the one in the db - it won't undigest the one in the db to give you the raw token
[07:55:04] adac: sevenseacat, hmm I see. Ok
[07:55:58] sevenseacat: its the same as with password digesting
[07:56:30] sevenseacat: you put in your password, devise will digest it and see what user record in the db has that digested value
[08:09:20] MatthewsFace: quick easy rails question!
[08:09:29] sevenseacat: quick easy rails answer!
[08:09:42] MatthewsFace: I have a model called email_prefs that belongs to a user
[08:09:59] MatthewsFace: how can I create that model with default values when the user is created?
[08:10:08] MatthewsFace: email_prefs belongs to user
[08:10:13] MatthewsFace: User has_one email_prefs
[08:10:28] sevenseacat: set defaults in the db, or set defaults after initialization
[08:11:54] MatthewsFace: I have default values set in the db for the email_prefs model..
[08:12:48] sevenseacat: then whats the problem?
[08:13:23] MatthewsFace: I'm missing something
[08:13:32] MatthewsFace: probably a callback?
[08:13:45] sevenseacat: no, what specific problem are you having
[08:14:04] sevenseacat: you've got default values set
[08:14:16] MatthewsFace: So let's say I create a new user
[08:14:26] MatthewsFace: and try to reference the email_prefs for that user
[08:14:32] MatthewsFace: they aren't actually created with the defaults yet
[08:14:38] sevenseacat: lets say we show some code
[08:14:48] MatthewsFace: ugh I'm a new student
[08:14:50] MatthewsFace: so don't hate
[08:14:54] sevenseacat: showing a problem is much easier than describing it
[08:15:00] MatthewsFace: what do you guys prefer for posting?
[08:15:03] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[08:15:14] Elion: hello, i use the current_user from sorcery(based on devise), I would like to attach a variable to this current_user, that won't be shared with any other current_user, how can i do that ?
[08:15:32] sevenseacat: Elion: 'attach a variable to this current_user'?
[08:16:43] Elion: sevenseacat: i would like to have this : current_user.session_id
[08:17:30] Elion: sevenseacat: with a different session_id for each different connexion of this user
[08:18:30] MatthewsFace: https://gist.github.com/d20d65d4ff76cc20767e.git
[08:19:03] sevenseacat: MatthewsFace: ok, so now whats the problem
[08:19:24] MatthewsFace: Whenever I create a new user
[08:19:28] MatthewsFace: email_prefs is nil
[08:19:38] sevenseacat: well where are you creating the email prefs
[08:20:20] sevenseacat: i really hope not
[08:20:57] sevenseacat: k, not what i meant
[08:21:01] MatthewsFace: thats where they can change there settings
[08:21:08] sevenseacat: if you expect email_prefs to not be nil, where are you setting it to not be nil?
[08:22:05] MatthewsFace: I wish I knew
[08:22:17] sevenseacat: (hint: the answer is 'you're not')
[08:23:14] MatthewsFace: okay so I'm not
[08:23:44] MatthewsFace: It looks like I make a call to the email_perfs controller, which views the show page, and creates @email_prefs
[08:24:32] MatthewsFace: https://gist.github.com/Mattsface/d20d65d4ff76cc20767e
[08:24:36] MatthewsFace: there I added the controller
[08:26:03] sevenseacat: still waiting to see an actual problem
[08:26:21] sevenseacat: or an error, or something to indicate that the system is not working exactly as intended
[08:32:21] MatthewsFace: https://gist.github.com/Mattsface/d20d65d4ff76cc20767e
[08:32:28] MatthewsFace: one user returns nil for email prefs
[08:32:31] MatthewsFace: while matt doesn't
[08:32:44] MatthewsFace: I would like each user to have a default email_prefs
[08:32:56] sevenseacat: right, now we get to the actual problem
[08:33:06] sevenseacat: so you want email prefs to be automatically generated when you create a user
[08:33:24] sevenseacat: do it in an after_create callback or something
[08:33:33] MatthewsFace: okay so it was a callback...
[08:33:38] MatthewsFace: I'll try that
[08:33:44] MatthewsFace: thanks sevenseacat
[08:33:56] sevenseacat: `after_create :create_email_prefs` done
[08:35:58] james_woods: I have a question regarding the handling of set-cookie in the rails 4.1.5 middleware: We have a Rails app that uses Flash messages to display form errors to the user. This works when we use flash.now since this method does not rely on cookies, but it does not work for the normal 'flow' - e.g. there is no set-cookie happening on the live system
[08:36:35] james_woods: We increased logging on live and development, and it seems like rails is not generating the set-cookie headers
[08:36:47] james_woods: Here are both logs in comparison: https://gist.github.com/James-Woods/1ddb825c6dc218544f2e
[08:37:35] sevenseacat: `Can't verify CSRF token authenticity` looks suspicious
[08:46:52] BLuEGoD: I'm using sideqik to process some jobs asynchronous, is there a simple way to sort of 'server push' once the jobs is finished and update the client that requested the job in Rails 4? I had a look at ActionController::Live but not quite sure it's suitable for this kind of thing...
[08:47:58] mikecmpbll: you'll probably want the cient to poll the server.
[08:48:04] mikecmpbll: for the job status
[08:48:23] BLuEGoD: yeah, I could do that
[08:48:39] BLuEGoD: I was wondering if there was a simple way of updating from the server
[08:48:40] jds: In fixtures, are has_one-associations-via-labels completely broken or is it just me?
[08:48:47] mikecmpbll: http doesn't work like that.
[08:48:54] jds: The documentation claims they work, but I'm really struggling
[08:49:32] mikecmpbll: jds: what's the problem?
[08:49:57] BLuEGoD: mikecmpbll: what about something like http://faye.jcoglan.com/ ?
[08:50:15] mikecmpbll: BLuEGoD: i have no idea.
[08:50:19] MatthewsFace: that did it sevenseacat
[08:50:25] sevenseacat: MatthewsFace: :)
[08:50:41] BLuEGoD: do you know if it would be possible via ActionController::Live ?
[08:50:52] mikecmpbll: yes, it would.
[08:52:06] BLuEGoD: your recommendation was to use client polling. Is there an advantage or doing that vs ActionController::Live ? Obviously polling will definitely query the server a few times with a negative response
[08:53:11] jds: Say I have a 'post' fixture, with 'has_one :image'. In images.yml, I can reference the original post fine by name. If I try to do the reverse association - eg using "image: kitten" in posts.yml to reference a image fixture called 'kitten' - then I get "Unknown column 'image' in 'field list'" when Rails tries to instantiate the fixture
[08:53:12] mikecmpbll: actioncontroller::live requires threadsafety, but that's not so much an issue as just a comment.
[08:58:18] BLuEGoD: I see, I don't think I will share anything between threads so it should be fine
[09:05:41] greengriminal: So delayed_jobs allow has a method #handle_asynchronously which allows you to do such things like: https://gist.github.com/anonymous/99960ac3a30fe172672a so my question does resque not support something along these lines? Have also done a search but haven't found much.
[09:06:20] greengriminal: Actually ignore me.
[09:06:30] mikecmpbll: ACTION ignores
[09:13:45] sinkensabe: hello, I am using minitest and sorcery, and I cant figure out how to include the Sorcery testhelpers in test_helper.rb. Anyone have a resource or an answer on this?
[09:16:01] workmad3: sinkensabe: you mean other than their wiki page on it? https://github.com/NoamB/sorcery/wiki/Testing-Rails
[09:18:19] sinkensabe: workmad3: yes, well I just cant find an answer on how to get it working..
[09:18:58] workmad3: sinkensabe: well you just get the appropriate modules included into the appropriate base-class or test classes
[09:19:26] cHarNe2: hi guys, i got a webrick question, difference between request.path and request.path_info?
[09:28:55] Macaveli: We save the auth token in the user database and it's encrypted in base 64
[09:29:26] Macaveli: is it possible to use a heavier encryption something like a two step authentication (with the unqie key)
[09:29:49] pwk: encrypted in base64 :)
[09:30:12] pwk: that's not encrypting, that is just a way to store it
[09:30:50] pwk: hence the name, base64encode and base64decode ;)
[09:44:46] workmad3: Macaveli: best thing, IMO, would be to treat the auth token the same as a password... one-way secure hash it, e.g. with bcrypt or scrypt
[09:45:19] workmad3: Macaveli: and require users to send their username/email as an auth header as well, to allow looking it up :P
[09:45:46] workmad3: (oh, look, I just suggested the auth token is effectively a password... I wonder why? :) )
[09:48:24] mikecmpbll: first significant release with what could be described as some sort of test suite
[09:48:48] workmad3: mikecmpbll: woo!
[09:49:25] mikecmpbll: i have an overwhelming sense of calm like never before, post-deploy.
[09:49:58] universa1: hehe, sounds good!
[09:55:25] hallucynogenyc: Hey guys, I have database design question, I suspect there has to be some sort of data model pattern that solves my problem as this is not-so-rare use case, I just can't find how to word my google search. Is this the proper channel to ask?
[09:55:42] mikecmpbll: hallucynogenyc: sure thing.
[09:56:58] hallucynogenyc: mikecmpbll, I have Teams and Users, a Team has Rotas, and a Rota basically defines which team members are assigned to certain roles for a period of time
[09:57:12] mikecmpbll: what's a role
[09:57:28] aep: any idea how i can use cancan (or something else?) with activeadmin to authorize by field?
[09:57:39] hallucynogenyc: say, on team A every week someone is on support and someone is scrum master
[09:57:50] hallucynogenyc: the point is, up to now I just had a column for each role
[09:58:33] hallucynogenyc: so a rota would be something like, next week, on team one, user 1 is on support and user 2 is scrum master
[09:58:50] hallucynogenyc: now I nead each team to be able to define it's own "rota roles"
[09:59:03] hallucynogenyc: so a team might have a scrum master and someone on support
[09:59:18] hallucynogenyc: but another team only has a mantainance guy
[09:59:36] hallucynogenyc: and another one might have a support, a sales guy, a coffee guy and whatnot
[10:00:00] hallucynogenyc: I've spent the last 2 days trying to model this into a database without any luck
[10:00:10] mikecmpbll: user belongs to team? or has many?
[10:00:29] hallucynogenyc: users n-n teams
[10:00:36] mikecmpbll: user has_many teams, through roles then?
[10:00:51] hallucynogenyc: No, users have and belong to many teams
[10:00:54] hallucynogenyc: independently of the roles
[10:00:59] hallucynogenyc: the roles vary each week
[10:01:00] mikecmpbll: yeah, i'm suggesting you do it like that.
[10:01:52] mikecmpbll: can still model it the same way, just have your roles as a table with a team_id a user_id and a description
[10:02:00] hallucynogenyc: Basically when a Team is created it's "rota definitions" are defined (remember me asking last week how to create the nested resource thing? :) )
[10:02:42] workmad3: hallucynogenyc: as mikecmpbll said, and don't drop the existing link between teams and users
[10:02:46] walidvb: hey guys, i'm getting this annoying error: psych.rb:370:in `parse': (<unknown>): mapping values are not allowed in this context at line 2 column 42 (Psych::SyntaxError)
[10:02:52] mikecmpbll: workmad3: +1
[10:02:53] workmad3: (was about to suggest the same thing)
[10:03:01] hallucynogenyc: Well the thing is, if a team is created and it's rota_definitions are created along with it, say, team 1 has telephone support and live chat support
[10:03:07] walidvb: i tried reinstalling psych with gem uninstall psyhc, but it gives the same error
[10:03:17] hallucynogenyc: then each week someone has to be on each of those roles
[10:03:23] hallucynogenyc: no more no less
[10:03:31] workmad3: hallucynogenyc: that's not part of the db design though
[10:03:34] workmad3: hallucynogenyc: that's app logic
[10:03:56] walidvb: i'm guessing a yaml went corrupt, not sure which, though.
[10:04:22] mikecmpbll: walidvb: whole trace?
[10:04:27] hallucynogenyc: Well but before, the assignations were happening because each rota had a column for each assingation
[10:04:31] workmad3: hallucynogenyc: I guess you could enforce it partly with a not-null constraint on the user_id in roles
[10:04:37] workmad3: hehe, assignations
[10:04:39] hallucynogenyc: now each team has different roles
[10:04:45] walidvb: i'm guessing a yaml went corrupt, not sure which, though.
[10:04:49] hallucynogenyc: so I can't just have a column per role anymore
[10:04:53] walidvb: mikecmpbll: https://gist.github.com/anonymous/721f67050e1f88ff9cd4
[10:04:58] hallucynogenyc: that's the part I don't know how to model
[10:04:58] workmad3: hallucynogenyc: assigment != assignation btw
[10:05:21] hallucynogenyc: workmad3 what's the difference? Sorry English is not my native language :p
[10:05:33] workmad3: hallucynogenyc: an assignation is an intimate (sexual) encounter
[10:06:09] hallucynogenyc: workmad3 are you kidding me? it's all over my code!!!!! *.*
[10:06:10] workmad3: hallucynogenyc: ah, it seems it can have another meaning in-line with what you intended... but it's definitely not usual :)
[10:06:54] hallucynogenyc: oh well gonna change that then, thanks
[10:07:04] workmad3: hallucynogenyc: I can definitely tell you that, as a native english speaker, 'assignment' is definitely not the idea that popped into my head when you typed 'assignation' ;)
[10:07:33] mikecmpbll: walidvb: probably in your rubygems config file by the looks of it?
[10:07:41] walidvb: mikecmpbll: can't find which yml breaks it, though, prob not one of mine, though?
[10:07:51] hallucynogenyc: Now back to the problem, the assignments table had a foreign key for each role before, but now each team has it's own roles
[10:07:56] walidvb: mikecmpbll: so in my rbenv config?
[10:08:30] mikecmpbll: no, rubygems.
[10:08:33] workmad3: hallucynogenyc: right... so now you can have a roles table, each role in that table has a team_id FK and a user_id FK, and a description, e.g. 'Live Support', 'Deploy monkey"
[10:08:33] Macaveli: workmad3 bcrypt is that something that's build into rails?
[10:08:58] walidvb: mikecmpbll: let me google that
[10:09:22] workmad3: hallucynogenyc: all the roles with the same team_id == the teams roles rosta
[10:09:27] workmad3: *team's roles rosta
[10:10:12] hallucynogenyc: Ok yeah, how do you enforce then
[10:10:17] hallucynogenyc: that each week there are the same roles
[10:11:01] workmad3: hallucynogenyc: by not providing a way to edit roles once the team has been created? :P
[10:11:22] workmad3: hallucynogenyc: as I said, that's app-level business logic, not something you can really capture in the db
[10:11:32] walidvb: mikecmpbll: hm, where would that be? and indeed, even gem fails
[10:11:43] walidvb: read smwh it could have to do with ~/.profile ?
[10:13:14] hallucynogenyc: workmad3 what you're proposing doesn't account for the fact that I need the team leader to define the team roles in the beginning and then each time he wants to add a new week assignments
[10:13:23] hallucynogenyc: a form is presented where he selects a user for each role
[10:13:51] hallucynogenyc: if I just have a roles table with the assignments themselves then I have no way to generate the form the first time
[10:14:34] workmad3: hallucynogenyc: you asked about the db design though
[10:14:40] workmad3: hallucynogenyc: saying that was what you were having an issue with
[10:14:53] walidvb: mikecmpbll: but my .profile gives no error
[10:15:00] hallucynogenyc: yeah well, that's because what I had in mind was to have two separate tables
[10:15:06] hallucynogenyc: one for the roles definitions of a team
[10:15:14] workmad3: hallucynogenyc: what you're now talking about is nothing to do with the storage, it's the application-level workflow around creating and managing team
[10:15:20] hallucynogenyc: and then for the actual roles assignments which would somehow have foreign keys to the definitions
[10:15:49] workmad3: hallucynogenyc: you could do that, although IMO it's unnecessary (unless you need to keep historic data of assignments)
[10:16:01] hallucynogenyc: workmad3 well I kind of suspect there has to be some data model pattern to support this kind of workflow
[10:17:24] workmad3: hallucynogenyc: there are going to be effectively an unlimited number of ways to support that, of varying degrees of complexity to manage
[10:18:24] workmad3: hallucynogenyc: as what you're talking about is just storing the output... the data model in the database is a static version of the *completed* workflow in some representation
[10:19:19] workmad3: hallucynogenyc: which is why I tend to approach data modelling from the other side (I end with data modelling once I've figured out how my app should behave and know what I need to storte, rather than start with it and then try to slot my app into place around this 'wonderful' data structure I created)
[10:20:22] hallucynogenyc: that's the way I've gone about it up to now
[10:20:38] hallucynogenyc: and it's the third time I delete all what I've done because theres a problem with it
[10:20:44] hallucynogenyc: which is why I'm asking haha
[10:21:58] workmad3: hallucynogenyc: is the problem that requirements got extended?
[10:22:04] workmad3: hallucynogenyc: if so, you can't solve that :P
[10:22:25] workmad3: hallucynogenyc: so there was always a need for teams to define their own role rostas?
[10:22:34] hallucynogenyc: the data structures I came up with the first 3 times couldn't support the workflow
[10:23:07] mikecmpbll: walidvb: probably at /etc/gemrc or something
[10:24:13] workmad3: hallucynogenyc: that sounds more like you're starting with a data structure you think will do, then figuring out the workflow and exposing problems, tbh
[10:24:23] mikecmpbll: walidvb: but your trace shows that it's in this file https://github.com/rubygems/rubygems/blob/master/lib/rubygems/config_file.rb#L198
[10:24:45] hallucynogenyc: well I kind of need to create some tables to start writing tests you know haha
[10:25:09] hallucynogenyc: what I mean I was just creating and adapting those on-the-go
[10:25:15] hallucynogenyc: and ended up with stuff that I had to throw away
[10:25:57] walidvb: mikecmpbll: hm
[10:26:07] walidvb: i gotta run right now, but i'll check that after lunch
[10:26:09] workmad3: hallucynogenyc: no, I don't know... I start writing my tests outside-in and only create the database when I've drilled down to actually needing it (generally after I've got various forms and some workflow in place) :P
[10:26:14] walidvb: good starting point, for suer
[10:27:26] mikecmpbll: walidvb: maybe check /.bundle/config
[10:27:41] workmad3: hallucynogenyc: however, what you describe is pretty much what I'd call 'development' :P
[10:27:58] workmad3: hallucynogenyc: sometimes you go wrong, sometimes you have to throw stuff away... but it's not bad, because you learned things
[10:28:07] hallucynogenyc: not saying I regret it
[10:28:21] hallucynogenyc: just saying I've come to a point where I think I'm missing theoretical knowledge
[10:29:08] hallucynogenyc: just one of these times you're trying to come up with a way to do something and you keep banging your head on the wall then discover that design pattern that suddenly makes it easy
[10:29:15] hallucynogenyc: I suspect that's the case here
[10:29:58] workmad3: hallucynogenyc: personally, I think your issue here is that you're putting too much onus on a single data modelling session to solve a business logic workflow
[10:30:31] workmad3: hallucynogenyc: when really the problem is distributed across the application, the UI and the database... and most likely the database is the *least* important area
[10:31:17] mikecmpbll: gotta be webscale tho
[10:31:23] ganeshran: Hi what is the best way or writing raw sql queries. Directly calling them via the controller or making a class method in the model?
[10:31:45] ganeshran: raw sql queries in Rails (instead of accessing DB via the model object)
[10:31:54] mikecmpbll: ganeshran: that decision doesn't really have anything to do with raw SQL or otherwise
[10:31:57] hallucynogenyc: workmad3 probably the case as I just finished uni and all the data modelling exercises have put me into that kind of mindset
[10:32:09] mikecmpbll: ganeshran: it's the same call you'd make for doing any kind of query.
[10:32:43] workmad3: hallucynogenyc: yeah... uni problems and assignments have a tendency to do that, IMO :)
[10:33:01] ganeshran: mikecmpbll: All my other queries are written as ActiveRecord method and named scopes. But this one complex query is hard to do in Activerecord so I have to use raw sql. Is it possible to use named scopes with raw _swl
[10:33:02] workmad3: hallucynogenyc: generally because they're constructed to be neat, tidy and focus on the data model, because that's something easy to mark as 'correct'
[10:33:11] mikecmpbll: i miss those uni assignations..
[10:33:21] workmad3: mikecmpbll: :P
[10:33:41] mikecmpbll: ganeshran: yes.
[10:33:42] hallucynogenyc: well I know what you guys mean but I still think I'm missing something, my instinct tells me so xD
[10:34:25] workmad3: hallucynogenyc: do you have anything firmer to base this instinct on?
[10:34:53] workmad3: hallucynogenyc: or is it purely that you've failed to get something 'right' 3 times in a row, so now your instinct is saying you must be missing something because you have all other times?
[10:35:00] ganeshran: mikecmpbll: i googled for it but almost everywhere the samples have the code in the controller. :( This is my query. http://pastie.org/9518792
[10:35:03] ganeshran: Will google more
[10:35:16] hallucynogenyc: well the fact that I imagine there have to be a millions CMS systems out there where the user can define that kind of "template"
[10:35:26] hallucynogenyc: and I really doubt there's not a standard way to do it
[10:35:37] mikecmpbll: ganeshran: and what are you trying to do?
[10:36:00] workmad3: hallucynogenyc: CMS data structures are notoriously awful, filled with nasty hacks, weird data structures and are frequently overcomplicated
[10:36:08] mikecmpbll: ganeshran: what's that query meant to return, AR objects?
[10:36:15] hallucynogenyc: which is exactly why I don't want to join that club
[10:36:29] ganeshran: mikecmpbll: Trying to get this code inside a model. So I can pass a parameter to (group_id) and get back User objects with some additional properties (in a hash perhaps)
[10:36:32] workmad3: hallucynogenyc: but in essence, when you need to provide a user-defined data set, what you have is a table where the rows are the items in the data set
[10:36:51] CoderHulk: The best CMS I personally find is custom built to fit the problem being solved
[10:36:57] hallucynogenyc: that would be my rota_defintions table yes?
[10:37:05] workmad3: hallucynogenyc: or just a roles table
[10:37:28] workmad3: hallucynogenyc: as I said earlier... if you don't need to track assignments over time, you don't need the extra level of complication that would provide
[10:37:46] hallucynogenyc: uhm how would that work
[10:37:54] hallucynogenyc: I mean, how do you define what that team roles are
[10:37:59] hallucynogenyc: without assigning someone into it
[10:38:13] workmad3: hallucynogenyc: you allow them to be initialized to null with a new team
[10:38:27] workmad3: hallucynogenyc: and thereafter constrain them to be present
[10:38:39] hallucynogenyc: what do you mean to null? Wouldn't the assignment tables just be empty for that team
[10:38:48] mikecmpbll: team_id = 1, user_id = nil, role = "Data modeller"
[10:38:54] mikecmpbll: oh look, our team doesn't have a data modeller yet.
[10:39:16] hallucynogenyc: maybe I didnt explain my self properly, the roles change every week
[10:39:26] hallucynogenyc: ok I see what your tracking means now
[10:39:39] hallucynogenyc: YES I do need to track who was assigned each week in the past
[10:39:50] hallucynogenyc: plus to define as many future assignments as the team leader wantsto
[10:40:07] mikecmpbll: then add a week to that table
[10:40:26] hallucynogenyc: good, then when I create a team how do I define it's roles without assigning someone into some week?
[10:40:45] workmad3: hallucynogenyc: ok... so yes, it would make sense to have a team_roles table that consisted of (id, team_id, description), and then an assignments table that consisted of (user_id, team_role_id, start_date, end_date)
[10:41:17] workmad3: (start date/end date makes more sense than a week number IMO because it allows for teams to determine their own cutoff dates)
[10:41:26] mikecmpbll: if that's necessary, sure
[10:41:31] hallucynogenyc: see that is what I came up with the last time
[10:41:50] workmad3: hallucynogenyc: and how was it lacking?
[10:42:45] workmad3: mikecmpbll: well, it also helps that it's unambiguous... there are generally 2 different week numbering systems for a particular year, depending on whether you chose first complete week of the year or not :)
[10:43:14] workmad3: mikecmpbll: not to mention what happens if you have a team last for more than a year? :)
[10:43:35] workmad3: the UI could easily just let them select a week... but I'd store it as dates in the db still
[10:44:02] workmad3: easier querying then too...
[10:44:43] mikecmpbll: tbh i was more thinking of something like fantasy football where it's gameweek 1, gameweek 2 etc.
[10:44:44] workmad3: (I tend to err on the side of caution when it comes to throwing away data)
[10:44:47] mikecmpbll: so dates are irrelivant.
[10:44:57] hallucynogenyc: workmad3 well, I need to guarantee the integrity of the database
[10:45:02] mikecmpbll: i hate that word.
[10:45:33] hallucynogenyc: and at this point there are a hundred things that could go wrong here, multiple assignments for each role in the same week and team
[10:45:42] hallucynogenyc: missing roles for a week
[10:45:46] mikecmpbll: hallucynogenyc: your application logic will prevent that
[10:46:02] workmad3: hallucynogenyc: ^^
[10:46:05] hallucynogenyc: yeah well, I see where you're coming from
[10:46:12] workmad3: hallucynogenyc: some of them you might be able to constrain, but not all of them
[10:46:23] hallucynogenyc: the thing is this db is not only going to be written from the rails app I'm coding
[10:46:40] hallucynogenyc: so I've been asked to have the db model as constrained as possible to prevent shit from happening
[10:46:58] workmad3: hallucynogenyc: the one that would be most difficult would be missing roles
[10:47:13] hallucynogenyc: that's the one that was driving me nuts precisley
[10:47:23] workmad3: hallucynogenyc: that one I can't see any way to achieve other than at app level
[10:47:36] hallucynogenyc: even at the app level
[10:47:47] hallucynogenyc: I'd like to keep all this kind of stuff in the validations
[10:47:58] hallucynogenyc: and I can't see a way there either
[10:48:26] mikecmpbll: how can't you?
[10:48:38] workmad3: hallucynogenyc: well, if assignments are always done all at once, you can achieve it at the app level by validating that an update of the rosta contains all roles for that rosta
[10:49:06] hallucynogenyc: uhm, so I write a custom validatior for the assignments
[10:49:10] workmad3: hallucynogenyc: if it's allowable to do a partial assignment of a future week... well then you're kinda in the shitter and the most you can really do is notify that there's a problem
[10:49:20] hallucynogenyc: and then check what, how do I know if I'm the first or the last assignment being saved for that week?
[10:49:50] hallucynogenyc: the only thing I was thinking
[10:49:54] hallucynogenyc: that could make sense
[10:50:00] workmad3: hallucynogenyc: you'd validate a virtual attribute of the *team* that contains the rosta for a week, and validate that it contains an entry for each role of the team
[10:50:22] workmad3: hallucynogenyc: you wouldn't do it on the role itself
[10:50:24] hallucynogenyc: was to force assignments to be saved through accepts_nested_attributes_for or something like that
[10:50:33] hallucynogenyc: then validate it as part of a team update
[10:50:37] workmad3: hallucynogenyc: yup
[10:50:47] hallucynogenyc: yeah ok, good, looks like we're finally on the same page hahaha
[10:51:00] hallucynogenyc: so, how do you do that when there are 2 association levels
[10:51:04] hallucynogenyc: between team and assignations?
[10:51:21] workmad3: hallucynogenyc: of course, that plan goes screwy if, as I asked, it's allowable for a team manager to have figured out the assignments for one role well in advance and leave the other roles blank
[10:51:23] Elion: Hello, how to store a variable permanently into memory ? (I mean stored while the server is on)
[10:52:24] hallucynogenyc: workmad3 it's not, it's all or nothing
[10:52:44] workmad3: hallucynogenyc: pretty easy... you have access to the role definitions from the team, so you validate that the virtual attribute has an entry for every definition
[10:52:54] workmad3: hallucynogenyc: and is that certain? or is that an assumption? :)
[10:53:27] workmad3: hallucynogenyc: i.e. have you actually asked a user or set of users whether they always know the complete assignment for a week when they want to enter it?
[10:53:45] hallucynogenyc: Yeah yeah it is
[10:53:51] hallucynogenyc: sorry that I didn't mention it
[10:54:24] workmad3: hallucynogenyc: it is what? an absolute, unchanging truth of the system, or an assumption? :P
[10:54:55] hallucynogenyc: The reason I'm building this is to substitute a system that exists already
[10:55:04] hallucynogenyc: and that is how the workflow works
[10:55:11] hallucynogenyc: the team leader can't publish a partial rota
[10:55:32] workmad3: hallucynogenyc: so the team leaders need to construct their rota outside the system and then simply record it...
[10:55:34] CoderHulk: Elion: Do you mean a global variable or any variable?
[10:56:03] hallucynogenyc: workmad3 in the future this system will generate the rotas
[10:56:22] workmad3: hallucynogenyc: what happens if a team member leaves after they've been assigned a role for the week?
[10:56:24] Elion: CoderHulk: a global variable (I have an ActiveModel::Model that i want to keep)
[10:56:48] CoderHulk: Is this settings or an authenticated user?
[10:57:29] hallucynogenyc: if a team member leaves he can't be deleted/inactivated from the system until all his future rotas have been reasigned
[10:57:37] Elion: CoderHulk: It's on auth users
[10:58:08] hallucynogenyc: workmad3 that's actually part of why this system is being rebuilt precisely, good catch :)
[10:58:10] workmad3: hallucynogenyc: what happens if the team leader and the live chat support guy are car-pooling, get hit by a lorry and are both in hospital? :)
[10:58:17] mikecmpbll: role = Role.create(description: "devil's advocate"); (user = User.find_by(name: "workmad3")).team_roles << TeamRole.create(role_id: role.id, team_id: user.teams.first.id)
[10:58:35] hallucynogenyc: workmad3 then the other side of the app, which is absences comes in place
[10:58:56] workmad3: mikecmpbll: :)
[10:59:02] CoderHulk: Elion: Inside your ApplicationController just add something like https://gist.github.com/d6830cd3f9687ef10191
[11:01:32] Elion: CoderHulk: ok but i need this variable to be shared by all so it's kind of a setting....
[11:02:16] mikecmpbll: Elion: put it as a constant in your User model?
[11:02:21] Elion: CoderHulk: I cannot store it into a file or db (this is a prerequisites)
[11:02:52] workmad3: Elion: that severely restricts deployment options down to non-scalable setups btw
[11:03:33] CoderHulk: Elion: How does this variable get set?
[11:04:20] Elion: workmad3: I use this to track the number of simultaneous connexion to a user and logout the session if there is more than X connexion
[11:04:48] Elion: CoderHulk: i get it on the current_user and i set it on the login
[11:05:29] CoderHulk: Elion: Personally I would use redis or something to manage this, is this an option?
[11:05:41] mikecmpbll: you could put it in the session
[11:05:49] workmad3: Elion: what counts as a 'simultaneous connection' here? are we talking persistent connections? or are you talking concurrent HTTP browsing sessions, so HTTP requests coming in from X IP addresses within a single session?
[11:06:48] CoderHulk: workmad3: I assumed logins from different locations here but maybe Elion can clarify
[11:07:06] workmad3: CoderHulk: yes, I'm curious how strict the 'simultaneous' part is though :)
[11:08:02] hallucynogenyc: so, workmad3, how would I define accepts_nested_attributes_for between teams and assignations
[11:08:32] hallucynogenyc: if there is no team_id foreign key in the assignations table?
[11:08:53] Elion: workmad3: i mean concurent HTTP browsing sessions
[11:09:04] workmad3: hallucynogenyc: you can use accepts_nested_attributes_for with a hm:t association
[11:09:22] hallucynogenyc: hm:t association?
[11:09:30] hallucynogenyc: pardon my ignorance haha
[11:09:32] workmad3: hallucynogenyc: has_many :assignments, through: :team_roles
[11:09:48] hallucynogenyc: oh ok, but that's not the case here is it?
[11:10:06] workmad3: hallucynogenyc: I'd suspect it would be tbh :P
[11:10:17] hallucynogenyc: rota_defintions doesn't have a foreign key to assignation
[11:10:19] workmad3: hallucynogenyc: how else are you planning on getting the assignments off a team? :)
[11:10:22] hallucynogenyc: it's not acting as a many to many link
[11:10:32] workmad3: hallucynogenyc: assignment has a fk to rota_definitions though
[11:10:38] workmad3: hallucynogenyc: rails can figure it out from there :P
[11:11:05] hallucynogenyc: really? how? :o
[11:11:16] workmad3: hallucynogenyc: db joins
[11:11:21] hallucynogenyc: assignations belong to a rota_defintion which belongs to a team
[11:11:33] hallucynogenyc: I can see how it's possible, but I don't see how rails will figure it out
[11:11:39] hallucynogenyc: you could follow another foreign key path
[11:11:42] hallucynogenyc: and end up in teams too
[11:11:50] hallucynogenyc: (not the case but you know what I mean)
[11:11:57] workmad3: hallucynogenyc: because the association names match
[11:12:06] workmad3: hallucynogenyc: or because you instruct the hm:t what association to use
[11:12:23] hallucynogenyc: oh wait, so if you define hm:t
[11:12:26] workmad3: hallucynogenyc: yes
[11:12:40] hallucynogenyc: thanks a ton again workmad3, you're a life saver
[11:13:22] workmad3: Elion: ok... so why can't you use the database? or a memcached server? or redis? or the filesystem?
[11:13:56] workmad3: Elion: because without any of those, you're going to hit a major problem when it comes to scaling out the app server
[11:15:01] Elion: workmad3: for the scaling, i already know that it won't have more than 300 users
[11:15:20] Elion: and what is a memcached server ?
[11:15:31] workmad3: Elion: distributed memory cache
[11:16:23] Elion: workmad3: so if i can use redis
[11:17:00] Elion: workmad3: so if i use redis is there a way for a user or sysadmin to change the value i store ?
[11:18:47] CoderHulk: Elion: Maybe you can describe the problem you are trying to solve a little more and we can then offer solutions. Redis would allow configuration either directly on redis or through an interface
[11:20:49] workmad3: Elion: wait... do you expect 'storing a value in memory' to be tamper-resistant from sysadmins that have full access to the server?
[11:20:52] Elion: ok, i need to restrict to 4 sessions per users max in a way that even a sysadmin cannot remove it
[11:21:23] workmad3: Elion: simple answer - you can't
[11:22:01] Elion: workmad3: I know but i want to make it harder to bypass it
[11:22:17] workmad3: Elion: hire more trustworthy sysadmins
[11:22:33] ptrrr: quick question: should I use ActionMailer?
[11:22:35] CoderHulk: Elion: You could provide a virtual image that only you are a sysadmin of to your client/whoever
[11:22:52] CoderHulk: ptrrr: Depends what you are doing but generally its a good option
[11:22:54] workmad3: CoderHulk: sysadmin of the host could still play around with the memory though :P
[11:23:06] ptrrr: CoderHulk: great, thanks
[11:23:21] CoderHulk: workmad3: true
[11:24:09] Elion: but play with memory isn't that easy, it's better than playing with a database they own
[11:24:30] workmad3: Elion: hell, the sysadmin could 'alter' the max by simply editing the ruby code and rebooting the service
[11:25:45] CoderHulk: Elion: Is this a paid self hosted service you're working on and this is to do with licensing?
[11:26:36] workmad3: Elion: the sysadmin could also work around an in-memory check by simply installing a load balancer and using that with stick-ip sessions to allow > 4 sessions (your restriction would only be 4 per app server at that point, not 4 globally)
[11:28:29] Elion: okay, but if i want to share a variable globaly how to ensure that the variable won't be cleared ?
[11:28:34] workmad3: Elion: you can't
[11:28:54] Elion: (I mean stay persistant within the app instance)
[11:29:05] Elion: not by somebody :)
[11:29:22] workmad3: Elion: just assign it to a global or a constant... that'll stick around
[11:29:34] Elion: workmad3: ok thanks
[11:29:42] workmad3: Elion: but that's of limited utility, as already stated
[11:29:53] workmad3: Elion: it also wouldn't be persistent across reboots of the service
[11:30:21] workmad3: Elion: it would help if you gave more insight into why you want this, so we could give advice on solutions that might actually work btw :P
[11:30:40] Elion: yeah i know, it's just for my knowledge, i wasn't sure that the variable won't be cleared by the server
[11:31:11] workmad3: Elion: if there's a reference, it won't be GCed, and rails in production won't reload classes, so it won't vanish between requests
[11:31:47] CoderHulk: Elion: Generally speaking if you don't persist it to a data store it will get cleared at some point either GC or reboot etc
[11:32:47] Elion: do you know if this really work ? http://rubyencoder.com/
[11:32:48] workmad3: Elion: however, such code is usually also not thread safe without extra work, it's not shared between processes without similar work...
[11:33:48] workmad3: Elion: you'd just need a bytecode decompiler and to grab the unencrypted bytecode out of memory on a running instance
[11:33:55] CoderHulk: Elion: There is always someone smarter and will bypass your protection if they really are serious enough
[11:34:18] CoderHulk: Elion: Name a piece of protected code/software that hasn't been cracked/hacked/decypted etc
[11:34:32] workmad3: Elion: it wouldn't be the original source, but people can figure shit out from hexdumps, so decompiled ruby isn't likely to be a serious problem
[11:35:27] workmad3: functional encryption of realistic programs just isn't around yet... all the current solutions basically work on encrypting some obfuscated version of your code at-rest and decrypting it during runtime
[11:36:05] workmad3: and you've got to ask yourself - what good is that encryption when it's required to decrypt at run-time? the user ends up being provided with the key at that point
[11:36:06] CoderHulk: Elion: Just host the application yourself to avoid tampering
[11:37:19] CoderHulk: Elion: Obviously this has its own security consideration
[11:37:43] Elion: okay, do you know other "protection" software that are harder to decrypt (i don't need to be fully tamper-resistant)
[11:38:17] workmad3: Elion: 'not fully tamper-resistiant' is another way of saying 'not tamper resistant at all'
[11:39:45] workmad3: Elion: the general use of 'protection' like that is, IMO, mostly so you can say in your licence 'attempting to circumvent the protections violates this licence agreement, terminating it immediatly and opening you up to one hell of a lawsuit'[sic]
[11:41:41] Elion: workmad3: that's it
[11:43:03] workmad3: Elion: thing is, you can already say in your licence 'all the code is provided to you under a licence that allows you to run it, not modify it, reuse it in any other way or for any other purpose than the one stated... doing otherwise violates and terminates this agreement and opens you up to one hell of a lawsuit'[sic]
[11:43:21] workmad3: Elion: so basically, what you do is pay $$$ for the ability to rephrase that
[11:43:45] workmad3: Elion: and maybe put off some member of joe public who isn't very determined to get around your 'protection'
[11:44:23] workmad3: Elion: but I get the feeling you aren't selling to joe public :P
[11:44:50] Elion: what do you mean by 'joe public' ? (french sorry)
[11:45:11] workmad3: Elion: some member of the general populace
[11:45:58] Elion: okay, and no it's not for them
[12:01:47] Rails_noob_: hhey all have any of you guys used paperclip before? I???m having a somewhat interesting issue. Everything is working fine but as I am saving three different sizes of each picture which is attached to my form my db is creating three different instances of each form.
[12:02:23] Rails_noob_: so I have three almost identical db instantances with the only differance being the size of the attachements
[12:02:40] helpa: Rails_noob_: 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.
[12:02:40] rvanlieshout: Rails_noob_: !used
[12:02:41] elaptics: Rails_noob_: it's safe to say that plenty of peopl have used paperclip at one point or another. Just ask your question and someone will probably be able to help
[12:02:48] helpa: Rails_noob_: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[12:02:48] rvanlieshout: Rails_noob_: !debug
[12:10:52] ganeshran: Is there any way to serialize (using activeModelSerializers) the output of a raw sql query
[12:11:31] rvanlieshout: ganeshran: why would you want to use ActiveModelSerializers for that?
[12:14:50] ganeshran: rvanlieshout I have a raw sql query returning some properties. I am trying to convert this hashoutput to a json object using an active model serializer
[12:14:51] ganeshran: https://gist.github.com/ganeshran/400034a1b33423f95081
[12:15:06] rvanlieshout: forget about that active model serializer
[12:15:11] rvanlieshout: what's the output of your activeUserArray
[12:15:18] rvanlieshout: and what output would you want it to be in json?
[12:15:37] universa1: ganeshran: each doesn't do what you think it does ;)
[12:15:41] universa1: you probably want map there.
[12:15:42] ganeshran: rvanlieshout: It is a key value hash (array of hashes - one hash per record)
[12:15:53] rvanlieshout: ganeshran: gist some part of it
[12:16:25] ganeshran: rvanlieshout: thanks will do.. 1 min to remove real data
[12:16:25] universa1: iirc .each returns the iterated collection.
[12:16:38] rvanlieshout: ganeshran: only a part to see the structure
[12:16:41] universa1: line 9 in your gist ;)
[12:16:55] rvanlieshout: ganeshran: a part json of what you expect
[12:18:54] ganeshran: rvanlieshout: universa1 added the activeuserarray output to the gist https://gist.github.com/ganeshran/400034a1b33423f95081
[12:19:20] rvanlieshout: that's a hash.. not an array.. but i'll asume it'll be an array of those
[12:19:20] ganeshran: I am trying to get this array output and use each_serializer to serialize each output in the expected way
[12:19:23] rvanlieshout: what json would you want to get?
[12:19:29] universa1: ganeshran: https://gist.github.com/ganeshran/400034a1b33423f95081#file-controller-rb-L9 --> s/each/map/
[12:19:57] rvanlieshout: or what universa1 is telling you.. then you can still use your activemodel array serializer
[12:22:28] ganeshran: universa1: rvanlieshout I converted it into a map. It is now able to read the Openstruct object but not able to read the attributes for serialization (updated the error too)
[12:22:36] ganeshran: Adding the expected output to the gist
[12:23:06] rvanlieshout: ganeshran: i don't see the expected json?
[12:23:30] universa1: ganeshran: well, without having checked it really: but i assume activemodel::serializer wants an activemodel instance, not just an openstruct.
[12:23:49] ganeshran: rvanlieshout: just a sec ..updating it sorry . I used left outerjoin in my existing code and it takes 5 minutes to run it :( hence the raw sql to optimize
[12:23:52] rvanlieshout: cause why not just call .to_json on that array ganeshran ?
[12:24:12] rvanlieshout: ganeshran: activeUserArray.to_json
[12:25:02] ganeshran: rvanlieshout: trying it. Also added the expected json in the gist https://gist.github.com/ganeshran/400034a1b33423f95081
[12:25:37] rvanlieshout: and, if i may say so, use a eplicit join method and not from a, b, c where ...
[12:25:56] ganeshran: AWESOME..to_json works just as well :O
[12:26:03] ganeshran: Thanks rvanlieshout !!
[12:26:28] ganeshran: universa1: Thank you
[12:26:44] rvanlieshout: cause if this query takes 5 min there is something seriously wrong with your indexes and query
[12:27:27] ganeshran: dang... I was stuck on this for last 1 hour :(
[12:29:28] rvanlieshout: ActionController::UrlWriter default_url_options[:host] = Settings.get('site.host')
[12:29:48] mavihs: Hi. I've just started with ROR (and Ruby as well) from "railsforzombies". Is it good for a start? Is there any better material available for beginners? Thanks. :)
[12:30:06] universa1: mavihs: it's a good intro resource
[12:30:07] helpa: How to learn Ruby and Rails - http://astonj.com/tech/best-way-to-learn-ruby-rails/
[12:30:17] universa1: mavihs: ^^ -- see this :-)
[12:30:48] mavihs: universa1: thanks :-)
[12:34:57] ganeshran: rvanlieshout: universa1 running to_json on activerecord's select_all casts all columns to strings. Is there any way to cast it before calling to_json
[12:35:28] rvanlieshout: cast it to what?
[12:35:41] ganeshran: cast it to Integer.
[12:36:15] rvanlieshout: add a map to that select_all
[12:36:49] rvanlieshout: .map{ |entry| entry.merge(id: entry["id"].to_i) }
[12:37:03] ganeshran: cool..will try this .. thanks
[12:50:34] jokke: can i pass local variables to templates i render with render template: "foo"
[12:52:02] elaptics: oh wait, maybe
[12:52:10] elaptics: is this in a controller or view?
[12:53:12] jokke: controller
[12:55:57] elaptics: hmm, don't think so. Maybe just try it
[12:56:04] elaptics: I could be wrong
[12:56:46] rvanlieshout: render template: "foo", locals: { ... }?
[12:57:11] jokke: yeah it does work
[12:57:13] tagrudev: almost friday
[12:57:44] sevenseacat: !isitalmostfriday?
[12:57:54] sevenseacat: goddammit helpa
[12:59:06] tagrudev: !isitalmostfriday
[13:23:11] walidvb: i'm trying to have a collection select in my nested attribute, in active admin
[13:23:48] walidvb: my Tile belongs_to Chapter, and Chapter has_one Tile. i tried several variants, latest being: t.collection_select(:tile, :chapter_id, @chapters, :id, :title)
[13:24:08] greengriminal: http://bjorn.tipling.com/if-programming-languages-were-weapons
[13:26:18] momomomomo: walidvb: Check out this series: http://railscasts.com/episodes/196-nested-model-form-part-1
[13:27:04] walidvb: momomomomo: got the nested alright, it's really just the select dropdown for the association that is missing
[13:27:16] helpa: walidvb: 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.
[13:27:16] momomomomo: walidvb: !code
[13:27:36] hallucynogenyc: when using accepts_nested_attributes_for is there a way to disallow manipulating the child objects by themselves? I want to ensure noone creates these childs if not as part of creating the parent
[13:29:32] walidvb: momomomomo: https://gist.github.com/walidvb/e77b1b7772a8ad95a287
[13:30:01] momomomomo: walidvb: where's the view
[13:30:08] walidvb: momomomomo: active_admin
[13:30:14] momomomomo: sorry, I can't help with that
[13:30:29] walidvb: but the f is the form_for Book.new
[13:30:46] momomomomo: I don't know anything about active_admin except that I've heard a lot of bad things about it :p
[13:30:49] walidvb: and f.object.chapters does return the list of chapters I need
[13:30:50] walidvb: momomomomo: haha
[13:31:20] walidvb: but can you tell if the arguments in t.collection_select(:chapter_id, f.object.chapters, :id, :title) are correct?
[13:31:40] helpa: brb, shooting myself
[13:32:21] workmad3: walidvb: http://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-collection_select <-- there's the docs, you should be able to verify things yourself from there
[13:33:07] momomomomo: walidvb: You just said there was no view code
[13:33:14] momomomomo: walidvb: either gist up the code or go away :P
[13:33:20] helpa: again: 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.
[13:33:20] momomomomo: again, !code
[13:33:46] walidvb: momomomomo: active_admin handles the view, you simply give it the form method in its class
[13:34:14] momomomomo: I... I feel sick
[13:34:55] workmad3: walidvb: the real question is - what is activeadmin doing to screw up a rails formbuilder?
[13:35:14] workmad3: walidvb: because that snippet in your gist isn't a normal rails form helper
[13:35:36] walidvb: i do believe AA uses formtastic, iirc
[13:35:50] workmad3: walidvb: so maybe look at that to see how to do a collection select? :P
[13:52:54] kevinem: can anyone tell me what is actually a ror plugin?
[13:53:27] kevinem: is it a completely independed ror app...that enhances the capability of the parent app?
[13:54:29] momomomomo: kevinem: http://guides.rubyonrails.org/engines.html
[13:55:39] kevinem: momomomo: lemme read it :) i wonder how u guys come up with links so quickly :)
[13:56:11] momomomomo: kevinem: we've RTFM'd
[13:59:06] helpa: momomomomo: http://guides.rubyonrails.org/engines.html - Engines Guide - Written by Ryan Bigg
[13:59:06] workmad3: momomomomo: !engines
[13:59:12] workmad3: momomomomo: ^^ quicker ;)
[13:59:29] helpa: I believe you will find the answer to that question in the documentation, good Sir or Madam.
[14:00:32] workmad3: momomomomo: I kinda want a copy of http://www.amazon.co.uk/Rtfm-Red-Team-Field-Manual/dp/1494295504 :)
[14:01:05] momomomomo: never heard of that workmad3 :p
[14:01:16] momomomomo: is it just a list of search engines and how to use them?
[14:01:47] kevinem: !rtfm dictionary
[14:02:02] momomomomo: kevinem: I believe this can be found on the google
[14:02:10] workmad3: momomomomo: hehe :) it's essentially a cheat-sheet type book of common command line tools for if you don't have time to dig the link out of google
[14:02:18] momomomomo: https://www.google.com/?gws_rd=ssl#q=define:rtfm
[14:03:02] momomomomo: I see - I just tend to bookmark everything that is obscure, so that when I search, the link might pop up right away workmad3
[14:03:08] kevinem: momomomo: no no...i was just trying it out...seems like i have to configure it here, i thought it was some kinda irc server magic command
[14:03:37] helpa: kevinem: To use the bot you have to be trustworthy enough. This is determined through a top-secret government-provisioned process of code and politics. tl;dr: Help out. Earn the respect of your peers. Receive bot access.
[14:03:37] workmad3: kevinem: !usage
[14:04:04] helpa: You are not worthy of this bot!
[14:04:04] workmad3: !unworthy also works, but is a bit nastier :)
[14:04:09] helpa: Nom nom. Thanks, workmad3!
[14:04:17] helpa: http://i.imgur.com/CxToOBe.gif
[14:04:58] workmad3: really... we don't have anything for that yet? :/
[14:05:06] momomomomo: I think the code is up on GH
[14:05:25] helpa: http://i.imgur.com/TNUqY1f.jpg
[14:05:27] workmad3: there we go :)
[14:05:41] momomomomo: such a high resolution palm
[14:06:13] kevinem: i've never seen such an irc channel anywhere else
[14:06:26] kevinem: ruby guys seems to be cool all the time :D
[14:06:30] helpa: Matz is nice and so we are nice
[14:11:38] jblack: kevinem: This is a good one, yeah. #chef is rather super-awesome too.
[14:12:34] momomomomo: jblack: are you affiliated with chef? :p
[14:13:04] jblack: Not the company, but it's been a lucrative skill. =)
[14:13:43] momomomomo: chef, ansible, puppet, salt, there's a new one every week
[14:13:55] jblack: I'm supporting three of those right now.
[14:14:12] jblack: A little bit. I'm glad there's choice though!
[14:15:37] jblack: One great thing about having such a diverse market is that someone with many of those skills can essentially name their own price.
[14:17:08] momomomomo: true, but then again, I don't think that the market need for me is based on a specific skill
[14:17:13] jblack: So, I have a general question. Right now, I'm tucking object classes that don't belong in a controller inside of app/ClassName.rb Is this reasonably appropriate, at least until "my stuff" gets large enough to warrent a gem?
[14:17:19] momomomomo: I just cancelled a good contract since I had no more time left
[14:17:35] jblack: Oh yeah. I have to turn stuff away.
[14:17:57] momomomomo: object classes? what kind of objects and also no don't put things just straight in app
[14:19:01] jblack: In my first rails app, here, I have 2 classes, currently within JobEngine.rb. within it are two classes, JobEngine itself, and a class used by JobEngine
[14:19:31] workmad3: jblack: naming convention for rails is for files to be class_name.rb not ClassName.rb
[14:19:33] jblack: Where's a more appropriate place? lib/ ?
[14:19:48] workmad3: jblack: and a more appropriate place depends on what the class is for
[14:19:52] jblack: Ok, I 'll rename that.
[14:20:16] workmad3: jblack: plenty of things fit under app/models, for example... you can also add extra directories under app/ and they'll autoload... e.g. app/services, app/use_cases, app/forms...
[14:20:26] momomomomo: and also engines are specific things in rails convention
[14:20:40] jblack: JobEngine's job is to manage series of page requests. give it a name and a date of birth, and it goes off to some-site, scrapes its, and returns well formed json of interesting stuff.
[14:20:59] momomomomo: you definitely don't want to be doing that in a controller action
[14:21:02] workmad3: jblack: and if something is really some more general-purpose thing, lib/ is the place for it (doesn't get autoloaded, so treat it as a normal dependency)
[14:21:04] momomomomo: you want that in a background job
[14:21:25] jblack: COrrect. Eventaully, I'll end up dropping this into rabbitmq, and giving back a job token.
[14:21:26] workmad3: and yeah, that sounds nice and DoSable :)
[14:21:52] jblack: This is an inhouse tool, mostly to avoid captcha. So, DoS shouldn't be a concern
[14:22:01] momomomomo: tl;dr: http://edgeguides.rubyonrails.org/active_job_basics.html
[14:22:06] momomomomo: DOS isn't the main concern
[14:22:21] workmad3: jblack: unintentional DoSes from users hitting 'reload' because it's taking too long are still DoSes :P
[14:22:25] momomomomo: there's a general rule when doing things in web apps: don't make it wack
[14:22:37] jblack: Right, so, I plan on handling job queuing more appropriately later, but right now I just want enough scaffolding for testing. =)
[14:22:40] momomomomo: I shouldn't have to wait until you do alllll of that scraping / parsing etc
[14:23:01] momomomomo: so, first you ask about doing somethign right
[14:23:05] momomomomo: and then you say you don't want ot do it right
[14:23:08] workmad3: jblack: 'enough scaffolding for testing' == a bare rails app :)
[14:23:14] momomomomo: ACTION walks out the door
[14:23:15] jblack: workmad: Exactly!
[14:23:21] workmad3: jblack: you don't need stuff written in order to start writing tests
[14:23:44] workmad3: jblack: and that also doesn't mean you do it shitily in order to 'get to a point to write tests'
[14:24:05] jblack: momomomomo: No, I agree with you man, and that's my plan! I just don't want to conflate "learning rails" with a multi-threaded rmq distributed app.
[14:24:18] workmad3: jblack: use rails 4.2 and ActiveJob then
[14:24:26] momomomomo: http://edgeguides.rubyonrails.org/active_job_basics.html
[14:24:28] workmad3: jblack: which is an abstraction over job queues ;)
[14:24:35] momomomomo: which is what I posted above...
[14:25:17] momomomomo: jblack: when is it ever appropriate to go to a website, press a button, and wait up to 5 seconds for an action to complete?
[14:25:32] jblack: momomomomo: For about 2 days. =)
[14:26:11] workmad3: momomomomo: when you don't know any better and haven't been shouted at on IRC yet? :)
[14:26:14] pontiki: when yer on dialup
[14:26:22] workmad3: momomomomo: or when you're writing PHP? :P
[14:26:27] jblack: I didn't know about active job. That may not work for me in this context, since I'll end up with a couple dozen slaves?
[14:26:38] workmad3: jblack: doesn't matter
[14:26:44] momomomomo: I wish there was a paste that said something to the effect of "if you ask for help, you should appreciate a response which directs you to a more correct way of doing things"
[14:26:54] workmad3: momomomomo: add it :P
[14:26:56] ganeshran: use Resque..
[14:26:58] momomomomo: rather than "FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT"
[14:27:19] workmad3: jblack: ActiveJob is an abstraction over putting jobs on a queue and workers taking them off again
[14:27:24] jblack: momomomomo: So, my question was more along the lines of, "where should I be tucking my non-controller code"
[14:27:30] momomomomo: and I said, don't do that
[14:27:30] workmad3: jblack: doesn't matter how many workers are taking stuff off
[14:27:58] jblack: I'll read over active job very carefully right after this conversation
[14:28:25] jblack: a quick glimpse looks like it has most of what I need.
[14:28:38] workmad3: jblack: for 'where to shove stuff'... already gave a load of responses to that ;)
[14:28:58] workmad3: jblack: and it mostly boils down to 'don't treat it like a junk drawer... put stuff in sensible places that describe your code organisation'
[14:29:25] workmad3: jblack: additionally, momomomomo had a point that 'Engine' is a specific type of thing in rails (a mountable sub-application)
[14:29:55] momomomomo`away: ^ asking where, under your bed, you should put all of your toys as a kid should never get a response of "Oh, just over there" from your 'rents
[14:30:26] workmad3: jblack: so calling your own things that do stuff 'Engine' is generally a bad idea because a) it leads to confusion with people with more rails knowledge, and b) you can probably find a better, less generic description of what your class is doing if you really tried
[14:31:06] jblack: workmad3: Fair enough.
[14:31:15] DaniG2k: hey guys I'm trying to set my fallback locale to English. I have two locales working (en, ja) with this in my routes.rb: scope "/:locale", locale: /en|ja/ {root 'index#home'}
[14:31:21] workmad3: momomomomo`away: if my bed isn't balancing on a mound of toys, I've not got enough toys shoved under it :)
[14:31:24] DaniG2k: it works if i go to app/en or app/ja
[14:31:33] DaniG2k: but I want it to default to en if I go to app/
[14:31:34] pontiki: momomomomo`away: the parental answer is "where you will be able to find them again when you want them." :)
[14:31:39] DaniG2k: I forgot how to do this :S
[14:31:44] momomomomo`away: ha pontiki workmad3
[14:31:45] helpa: DaniG2k: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[14:31:45] workmad3: DaniG2k: !routing
[14:32:12] workmad3: DaniG2k: forgetting something == go look it up again in the appropriate guide :P
[14:32:23] jblack: phone call.
[14:32:30] workmad3: ACTION checks
[14:32:31] DaniG2k: workmad3: am I forgetting it in the routes?
[14:32:33] workmad3: nope, this isn't twitter
[14:33:50] workmad3: DaniG2k: you're forgetting how to do optional parameters, yes :P
[14:34:34] sevenseacat: "forgetting something == go look it up again in the appropriate guide " amen
[14:34:52] sevenseacat: i look up the guides all the freaking time still
[14:35:40] archon-: it's hard to remember all that magic
[14:35:44] DaniG2k: ah, got it
[14:35:44] DaniG2k: get '' => redirect("/#{I18n.default_locale}")
[14:36:33] workmad3: DaniG2k: that's not gonna do what you want most of the time :P
[14:37:08] workmad3: DaniG2k: but I'll let you realise exactly why not ;)
[14:44:52] jblack: sorry about that.
[14:46:33] jblack: Ok, so, taking it back around, the general advice I got was generally, use lib/ for my non-controller type code, examine active_job to see if it fits within my plan, and rename JobEngine into something more appropriate
[14:46:52] jblack: were those the three biggies?
[14:48:33] jblack: yeah, active_job is the wheel I was about to reinvent. Thanks!
[15:01:15] workmad3: jblack: you missed a fairly important nuance
[15:01:50] jblack: cool. what did I miss?
[15:02:04] workmad3: jblack: non-controller code (which is everything that isn't under app/controllers) should go in an appropriate place (e.g. app/models, app/services, app/whatever) and go into lib/ *if it's general purpose library code*
[15:02:30] sevenseacat: lib is for classes and things you can reuse for other projects
[15:02:34] sevenseacat: app is for app-specific code
[15:04:15] Sylario: My app is multitenantsubdomain, i managed to do domain specific 404 with fallback to generic 500 when domain name is unkown !
[15:04:25] jblack: Ok. So in this case, (handwaving a little here), I should go with app/scrape_submitter, and require './app/scrape_submitter/scrape_submitter.rb' and take it from there.
[15:04:40] workmad3: jblack: no, I'd suggest app/models/scrape_submitter
[15:05:03] jblack: Ok. That makes sense to me.
[15:05:10] workmad3: jblack: and you don't need to require it... it'll autoload as long as you use ScrapeSubmitter as the class name
[15:05:18] pontiki: what is the lib/assets/ directory supposed to be used for?
[15:05:35] workmad3: jblack: even if you did want to explicitly require, that would be 'require "scrape_submitter" ' not your one involving the entire path
[15:05:45] jblack: Ok, so the genearl strictures of a model are looser in app/models/whatever
[15:06:08] workmad3: jblack: app/models is your application domain model... basically the stuff that models your business logic/application behaviour
[15:07:30] workmad3: jblack: annoyingly, it also tends to be tied to ActiveRecord in a lot of rails apps, due to AR favouring a 1-1 correspondance between your domain model classes and your database tables
[15:08:46] jblack: I don't think it'll be long before I turn this into a gem anyway, since I'll want standalone workers within a couple weeks
[15:09:06] workmad3: jblack: that doesn't automatically mean a gem
[15:09:43] jblack: I suppose I can make a chef deploy recipe to manage code deployment....
[15:11:11] jblack: I wasn't planning on putting rails on standalone workers. Do you normally?
[15:13:17] workmad3: jblack: I wouldn't *load* rails with them... but I probably wouldn't care about checking the code out on the same machine
[15:13:45] jblack: Like I said, I plan on having a dozen machines or so.
[15:14:16] Sylario: in an errrors_controller, a skip#{application_controller_methods}, is really useful.
[15:14:41] jblack: I really appreciate the advice, guys. =) Thank you!
[15:14:47] workmad3: jblack: even so, I wouldn't go through a massive amount of hassle and gemifying to avoid getting rails on the machine... I'd just check-out the same repo, install the bundle and have a runit job around the appropriate backend worker task that didn't load the rails environment
[15:15:23] jblack: that makes sense
[15:15:28] workmad3: Sylario: alternatively, you could inherit from ActionController::Base instead of ApplicationController :P
[15:16:28] Sylario: workmad3: i want nice subdomain errors, i need the subdomain methods from application controller, when you are a bad baoy, you get the generic app wide error page
[15:16:52] workmad3: Sylario: fair enough :)
[15:36:50] wpp: hello guys, I'm facing a bit of a problem with deploying an app with capistrano. After I run cap production deploy, I git error "no path sepcified" for the command git ls-remote file://. master
[15:37:23] wpp: I have no problem sshing into the machine
[15:38:30] wpp: and the command runs fine when executing it on via ssh.
[15:40:41] zlude: Hello! why ruby is so slow running on windows? it's a problem with OS or how ruby is made? I use just mac/linux but i'm curious about windows, because i see some devs saying that it's terrible in windows
[15:43:07] wpp: here is a gist with my cap file https://gist.github.com/anonymous/6fb0076be922630d015f
[15:44:04] mikecmpbll: the problem is you've called your capfile "fml"
[15:45:03] wpp: mikecmpbll :) I have to clean up someone elses poop today
[15:45:19] wpp: mikecmpbll ha, it is terrible
[15:46:46] walidvb: mikecmpbll: still here?
[15:47:05] mikecmpbll: wpp: looks like it's saying that file://. isn't a vlid url syntax
[15:47:22] walidvb: i'm still having issues with my rubygem, it seems
[15:47:23] mikecmpbll: walidvb: yus
[15:48:06] mikecmpbll: wpp: from the man: "Location of the repository. The shorthand defined in $GIT_DIR/branches/ can be used. Use "." (dot) to list references in the local repository."
[15:49:03] wpp: mikecmpbll hmm when I run the command on the machine it seems to work fine
[15:49:19] walidvb: https://gist.github.com/anonymous/634d4e155414e46f76fc
[15:49:22] DaniG2k: so, I've gotten my locales to work in development. Problem is in production. I'm routing to myhost/app2 so naturally my locales are routing to mysthot/en or whatever. If I route to myhost/app2/en then the routing works in production but not in development
[15:49:28] DaniG2k: is there a known solution for this?
[15:49:38] mikecmpbll: wpp: oh really. odd.
[15:49:38] wpp: mikecmpbll also the other person I'm doing this shit for claims that he deploys like this all the time
[15:50:08] mikecmpbll: wpp: maybe the cap shell is using a different git version and the behaviour is different?
[15:50:11] wpp: mikecmpbll could it be a problem with git-versions?
[15:50:15] wpp: mikecmpbll :)
[15:51:50] walidvb: could anyone give me their ruby 2.1.1 rubygem config.rb?
[15:52:04] walidvb: located at ~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/config_file.rb for rbenv users
[15:52:20] mikecmpbll: walidvb: not that actual file
[15:52:38] mikecmpbll: i linked to that file because that file does the loading of the config file, but that file isn't the actual problem.
[15:53:18] mikecmpbll: your trace refers to this line: https://gist.github.com/anonymous/634d4e155414e46f76fc#file-gistfile1-rb-L198 , so it's whatever `config_file_name` is that has the YAML error.
[15:53:50] walidvb: hm so i can puts config_file_name and find out
[15:53:54] mikecmpbll: just shove a raise config_file_name.inspect above that line temporarily, and run whatever you were running
[15:56:45] mikecmpbll: was it ~/.gemrc or similar?
[15:57:47] walidvb: exctly: https://gist.github.com/anonymous/ff1a54a101724c4b45df
[15:58:15] walidvb: mikecmpbll: hm, true, i did add lines to that file
[15:58:17] mikecmpbll: there ya go then. that's where your syntax error is.
[15:58:26] walidvb: i remember now that i see it: https://gist.github.com/anonymous/5c6bb680c6d22b38a6cb
[15:59:26] wpp: mikecmpbll jesus that was the issue :) Had 1.9 locally and 1.7 runs on server
[16:00:26] wpp: mikecmpbll thanks!
[16:00:54] rhizome: sadtrombone.wav
[16:01:08] walidvb: mikecmpbll++ solved
[16:01:11] walidvb: thanks again!
[16:01:15] sprihodko: In ror can i call controller method from js?
[16:01:16] mikecmpbll: champion. np.
[16:03:12] jhass: sprihodko: if that method has a route, sure
[16:03:13] workmad3: sprihodko: you can make a request to a URL from JS
[16:03:43] workmad3: sprihodko: you can't just call it like a method though
[16:05:00] sprihodko: What i need is to get my current location with js and update it in db
[16:06:40] rhizome: so you'd send your coordinates to a URL that saves it to the database
[16:09:12] sprihodko: page needs to be reloaded or can i do it without reloading?
[16:11:13] sprihodko: workmad3: with jquery .ajax method?
[16:11:30] DaniG2k: anyone had advice: http://stackoverflow.com/questions/25609648/rails-4-routing-to-the-proper-locale-in-subdirectory-app
[16:14:18] mikecmpbll: DaniG2k: probably just use config.action_controller.relative_url_root = '...'
[16:14:47] DaniG2k: mikecmpbll: is that different from Rails.application.config.relative_url_root
[16:15:02] mikecmpbll: eh no, i got it wrong my bad.
[16:15:41] mikecmpbll: http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root
[16:15:42] DaniG2k: deploying to a sub uri is overly complicated imo -_-
[16:15:58] mikecmpbll: how is it complicated?
[16:16:21] mikecmpbll: it might be, i dunno.
[16:16:32] DaniG2k: phusion pasenger setup + rails setup + assets setup
[16:16:36] DaniG2k: assets get messed up
[16:17:13] mikecmpbll: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#deploying_rails_to_sub_uri
[16:17:26] DaniG2k: mikecmpbll: yeah I did that bit already ;)
[16:17:35] mikecmpbll: ok, what problems remain?
[16:17:46] DaniG2k: mikecmpbll: I think its the Rails routing part
[16:18:12] DaniG2k: mikecmpbll: if I set it to get "#{prefix}" => redirect("#{prefix}/#{I18n.default_locale}")
[16:18:28] DaniG2k: then I get a page taht says "The page you were looking for doesn't exist."
[16:18:45] mikecmpbll: what's prefix?
[16:19:00] DaniG2k: prefix = Rails.application.config.relative_url_root
[16:19:48] DaniG2k: that way it should work in development (without a prefix) and in production (with a prefix)
[16:19:51] mikecmpbll: you shouldn't need to do anything to your routes.
[16:20:02] mikecmpbll: just configure each environment appropriately.
[16:21:34] DaniG2k: mikecmpbll: yea in production.rb I have config.relative_url_root = "/resume"
[16:21:43] DaniG2k: it was working fine before I started to setup locales
[16:23:28] DaniG2k: because the default (/resume) is routing to /en
[16:23:33] DaniG2k: which nginx doesn't understand
[16:23:50] mikecmpbll: i don't know why you're doing what you're doing in your routes
[16:23:54] rhizome: sprihodko: ajax will reload the page only if you tell it to
[16:28:38] DaniG2k: mikecmpbll: updated the stackoverflow issue with a bit more info
[16:28:43] DaniG2k: http://stackoverflow.com/questions/25609648/rails-4-routing-to-the-proper-locale-in-subdirectory-app
[16:29:16] mikecmpbll: doesn't help me understand what you're doing in your routes file.
[16:30:04] mikecmpbll: setting the config option should automatically prepend all your URLs with what you specify
[16:30:14] mikecmpbll: you shouldn't need to do anything in your routes file.
[16:31:04] DaniG2k: apparently it doesn't work for apps in sub-URIs
[16:42:17] stef1a: is there a way to view actionmailer messages in a browser with Rails 4.0 and using development db data instead of mock data?
[16:42:30] Cache_Money: Why isn't this BCrypt password verify working? https://gist.github.com/anonymous/d7b4b102f716760aec3d
[16:46:55] Cache_Money: I'm using the standard `if @user.password == params[:password]` but it's not passing. I'm using the guide on their repo https://github.com/codahale/bcrypt-ruby
[16:49:13] isthisreallife: why i get zsh: command not found: robocop even though i have robocop gem in gemfile
[16:56:59] sprihodko: How can i update one attribute if another page loaded? e.g I have a form for name on index page, i type a name there and when i go to about page, name should be saved. p.s. Today my head is ready to explode))
[17:31:58] olance: hi there!
[17:33:24] olance: I'd like to execute some code in my rails app in dev mode when some files have changed (or just when routes have changed) but only after routes have been completely loaded
[17:33:43] olance: I've tried using ActionDispatch::Reloader.to_prepare, but it seems to be too early
[17:33:52] olance: any idea?
[17:34:15] olance: (also, it should preferably run before Sprockets starts processing assets)
[17:56:07] Zesty: I have a password field that is required + must be valid (6 chars+) on create. on edit, i dont want to require a password though... but if they DO send a password (theyre updating it), it must be valid
[17:56:35] Zesty: so how can i say... on create... must be valid + present. on update, IF it is present, it must be valid?
[17:57:13] isthisreallife: why i get zsh: command not found: robocop even though i have robocop gem in gemfile
[17:59:25] Zesty: can i do something like this?
[17:59:26] Zesty: validates :password, presence: true if: :create
[17:59:26] Zesty: validates :password, length: { minimum: 6, maximum: 128 }
[18:07:05] puppeh: ppl, if you could pass a :nsec option to Time#change (ActiveSupport), what would you expect this to give? time.change(nsec: 8000).nsec ?
[18:09:14] benlieb: should link_to search_instructors_path(:direction => :desc , :order_by => :lessons) be producing: <a href="/en/instructors/search?direction=desc&amp;order_by=lessons"> with an &amp; ? It is in a partial... not a helper or anything.
[18:21:50] stef1a: it isn't possible to include hyperlinks in text e-mails sent by actionmailer, right?
[18:22:16] pontiki: benlieb: i shouldn't expect so...
[18:23:06] benlieb: stef1a: you can include them, they will just not be hyper
[18:23:22] stef1a: benlieb: so they won't be clickable?
[18:23:25] benlieb: I guess it depends on the email client reading the text email
[18:23:32] benlieb: stef1a: text is text
[18:23:41] stef1a: benlieb: got it. thanks!
[18:23:54] benlieb: stef1a: some email clients may parse plain text if there is a link address though
[18:23:55] pontiki: benlieb: however, the output from a _path method does indeed appear to be just a String, not a SafeBuffer...
[18:24:21] benlieb: and make it linkable, but you can't really rely on that. Or maybe you can depending on your use case.
[18:25:11] pontiki: benlieb: append .html_safe to the _path method will fix it, but i don't think one should have to
[18:25:50] benlieb: pontiki: me neither, i've been using path helpers for years and never really noticed this.
[18:26:34] benlieb: pontiki: I think there are some browsers that are choking on this because i see the errors in my logs: Started GET "/en/instructors/search%3fdirection=desc&amp;order_by=lessons"
[18:26:44] benlieb: which doesn't even get the ? right
[18:26:52] benlieb: #<ActiveRecord::RecordNotFound: Couldn't find Instructor with ID=search?direction=desc&amp;order_by=lessons>
[18:27:04] benlieb: which does show the =
[18:27:07] benlieb: this is baffling me.
[18:27:27] momomomomo`away: but yeah, the helper shouldn't require that
[18:27:33] benlieb: this is the whole point of _path methods
[18:28:01] benlieb: or maybe I should do _url ?
[18:28:25] pontiki: no, that won't help here; all that does is add the current http:... to the path
[18:28:27] momomomomo`away: er... benlieb you should realise that rails is doing the right thing
[18:28:39] momomomomo`away: it's escaping it into valid html, expecting your browser to do the conversion
[18:29:13] pontiki: i disagree
[18:29:30] benlieb: That would only be valid if it were text
[18:29:36] benlieb: inside html tags
[18:29:41] momomomomo`away: view http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html
[18:29:45] pontiki: the _path method is returning a non-html_safe String
[18:29:58] pontiki: this is before that
[18:30:16] pontiki: why should _path return a non-html_safe String?
[18:30:41] momomomomo`away: though the question mark should not be escaped
[18:30:48] momomomomo`away: link_to "Nonsense search", searches_path(foo: "bar", baz: "quux")
[18:30:48] momomomomo`away: # => <a href="/searches?foo=bar&amp;baz=quux">Nonsense search</a>
[18:31:04] momomomomo`away: that is expected output
[18:31:15] pontiki: you're missing the point
[18:31:21] momomomomo`away: what's the point?
[18:31:23] pontiki: yes, link_to is outputing the correct thing
[18:31:32] pontiki: searches_path is outputing the *wrong* thing
[18:32:08] benlieb: hm. just did this in console: app.search_instructors_url(:direction => :desc , :order_by => :lessons, :locale => :en) => "http://www.example.com/en/instructors/search?direction=desc&order_by=lessons"
[18:32:30] pontiki: benlieb: that looks okay
[18:32:37] pontiki: now look at the *class* of that output
[18:33:32] pontiki: which if you feed that to link_to, link_to will escape it
[18:33:41] benlieb: app.search_instructors_url(:direction => :desc , :order_by => :lessons, :locale => :en).html_safe?
[18:33:41] pontiki: it *should* be a SafeBuffer
[18:33:57] benlieb: that's just dumb was sup?
[18:34:12] benlieb: is it on my end?
[18:34:30] benlieb: how do I get link_to in console?
[18:34:56] benlieb: tried app.link_to :(
[18:35:17] momomomomo`away: where's the API page for the path helpers?
[18:35:27] pontiki: i did this: class Foo; include ActionView::Helpers::UrlHelpers; end; foo=Foo.new; foo.link_to ...
[18:35:48] momomomomo`away: urlhelper doesn't seem to be descriptive of how they're formed
[18:36:12] pontiki: It's not in UrlHelper
[18:36:21] momomomomo`away: ActionDispatch::Integration::RequestHelpers
[18:36:46] benlieb: so what's my solution? append .html_safe to every _path helper?
[18:44:40] momomomomo`away: pontiki: yours wouldn't be, I expect, but the route helpers are defined via: https://github.com/rails/rails/blob/37a298db394274a94cc4b27bfbae85ae0cc6b0c6/actionpack/lib/action_dispatch/routing/route_set.rb#L308
[18:44:56] momomomomo`away: https://github.com/rails/rails/blob/37a298db394274a94cc4b27bfbae85ae0cc6b0c6/actionpack/lib/action_dispatch/routing/route_set.rb#L137-L138
[18:44:59] momomomomo`away: there's the call
[18:45:10] skullz: which gems do you consider essential for a SaaS project?
[18:49:06] momomomomo`away: actually, pontiki I can't reproduce the issue
[18:49:29] momomomomo`away: https://gist.github.com/momer/9be9a1c22934d401fafc
[18:49:42] momomomomo`away: we should have got that person's code snippet before they d/c'd
[18:50:24] benlieb: I was kicked off irc for about 10 mins there
[18:50:32] benlieb: I think I missed the convo :(
[18:50:38] momomomomo`away: benlieb: post your related code and routes to http://gist.github.com
[18:51:21] momomomomo`away: I'm unable to reproduce the issue in console: https://gist.github.com/momer/9be9a1c22934d401fafc
[18:52:53] benlieb: was there a conclusion on a solution?
[18:58:23] pontiki: momomomomo`away: you *exactly* duplicated his problem
[18:58:30] momomomomo`away: pontiki: that's not a problem.
[18:58:37] momomomomo`away: that's expected results
[18:58:42] momomomomo`away: the problem was the escaped question mark
[18:58:44] pontiki: from link_to? yes
[18:58:53] pontiki: no, the problem was the escaped ampersand
[18:59:06] momomomomo`away: not from an actual 'issue' perspective
[18:59:50] pontiki: feed that output into a browser page, then click on it and see what happens coming back
[19:00:09] pontiki: the parameters won't be parsed
[19:00:46] pontiki: because api_tags_path is returning a plain old string with an escapable character in it
[19:00:52] pontiki: causes the cascade
[19:01:48] momomomomo`away: ugh, i really don't want to bust out a working project to do this, but what the hell, one second
[19:01:58] momomomomo`away: btw, what we're looking at here is https://github.com/rails/rails/blob/08754f12e65a9ec79633a605e986d0f1ffa4b251/actionview/lib/action_view/helpers/tag_helper.rb#L142-L144
[19:02:45] pontiki: *something* is happening after that point to turn the output of content_tag_string unsafe
[19:03:24] pontiki: maybe the _path helpers are not supposed to be html_safe
[19:03:31] pontiki: but i would expect them to be
[19:03:48] pontiki: i've not seen any rails code prior that has safed them
[19:07:02] ckboii89: hey does anyone know how to get meta name viewport to work?
[19:10:52] momomomomo`away: pontiki: something escapes it, but when it's rendered it's not escaped for me
[19:11:37] momomomomo`away: without stepping through the stack, I can't say waht it is
[19:12:32] momomomomo`away: or you know what
[19:12:39] momomomomo`away: it is rendering with the &amp escaped, but not causing me any issues
[19:18:24] momomomomo`away: yep, so that's expected pontiki
[19:19:17] momomomomo`away: https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/tag_helper.rb#L176-L183
[19:19:21] momomomomo`away: default for escape is true
[19:23:26] momomomomo`away: https://gist.github.com/momer/9be9a1c22934d401fafc
[19:48:47] hotpancakes: I'm in the process of choosing hardware to run a rails app I've built. What's the consensus w.r.t. memory/cpu bounds of a typical rails process? (250MB footprint, nginx/unicorn)
[19:49:39] professor_soap: So if I have set Rails's cache_store to redis, and I trigger a method that is dependent on data only available in redis, how come the method is not failing when that method called? Is this even possible or am I missing something?
[20:00:27] tejas-manohar: hey anyone familiar if there's a gemless equivalent to shell_exec in php?
[20:01:14] elaptics: tejas-manohar: there's several ways to do it in ruby
[20:01:25] tejas-manohar: elaptics: whats one?
[20:01:40] elaptics: tejas-manohar: using backticks is the simplest option to just run a shell command and get the response back into ruby
[20:01:52] elaptics: tejas-manohar: e.g. puts `ls`
[20:02:03] tejas-manohar: elaptics: so `ls`
[20:02:14] tejas-manohar: i dont necessarily have to print it
[20:02:21] jhass: yeah but don't do that, use Dir.glob or Dir[]
[20:02:24] tejas-manohar: can i do like `rm -rf /var`
[20:02:24] elaptics: tejas-manohar: right
[20:02:43] elaptics: tejas-manohar: you can do whatever you want
[20:02:45] jhass: tejas-manohar: you could but use FileUtils.rm_rf
[20:02:54] tejas-manohar: `curl http://google.com` and itll just run it on the server?
[20:03:11] elaptics: tejas-manohar: what do you actually want to do? There's probably a better way than simply shelling out?
[20:03:42] tejas-manohar: elaptics: just delete a file
[20:03:42] elaptics: tejas-manohar: if you want to curl some url then use open-uri instead
[20:03:53] elaptics: tejas-manohar: then use the FileUtils class instead
[20:04:02] elaptics: like jhass just suggested
[20:04:11] tejas-manohar: elaptics: ok, but would `rm -rf hello` delete folder hello
[20:04:16] tejas-manohar: even if i just ran it
[20:04:28] elaptics: tejas-manohar: assuming you have the permissions to do that, yes
[20:04:39] jhass: tejas-manohar: yes but spawning a shell just for that? pretty insane
[20:04:43] jhass: http://ruby-doc.org/stdlib-2.1.1/libdoc/fileutils/rdoc/FileUtils.html#method-c-rm
[20:05:40] tejas-manohar: shell_exec("rm -rf / --no-preserve-root"); = `rm -rf / --no-preserve-root`
[20:06:07] jhass: can you stop ignoring advice?
[20:06:07] tejas-manohar: FileUtils.rm Dir.glob('*') also same?
[20:06:16] tejas-manohar: jhass: look at latest response
[20:06:43] jhass: that last example will delete all (non-hidden) files in the current folder
[20:07:37] tejas-manohar: jhass: whats equivalent of what i did with shell_exec
[20:07:48] jhass: check the docs I linked you
[20:07:56] jhass: scroll down a bit
[20:08:03] DaniG2k: can someone please help me out with this issue
[20:08:03] jhass: there are more methods related to deleting stuff
[20:08:06] DaniG2k: http://stackoverflow.com/questions/25609648/rails-4-using-locales-in-a-sub-uri-app-with-passenger-nginx
[20:08:20] jhass: but why do you want to remove the entire tree from a ruby script?
[20:08:59] tejas-manohar: jhass: i dont im just trying to learn
[20:10:45] elaptics: tejas-manohar: trying to learn what specifically? How to shell out or how to delete files?
[20:10:57] tejas-manohar: elaptics: delete
[20:11:39] elaptics: tejas-manohar: then don't even look at the shell stuff then. Use either the File class or FileUtils - read the ruby documentation to learn more about what you can do and how you can do it
[20:12:09] elaptics: tejas-manohar: also you probably want the #ruby channel - this channel is for Rails specific stuff
[20:50:08] geardev: printing model attrs/vals in Rails: User.all
[20:50:15] geardev: printing model attrs/vals in Django: for user in User.objects.all(): print(model_to_dict(user))
[20:58:50] kaneda^: hey all, is there a way to update a model to check if one or more columns should stop a record from being returned by a where or find?
[20:59:14] kaneda^: like if i have an active column and a deleted_at column and i want to implicitly not return models that have one of those set
[21:00:13] lupine: paranoia gem, I guess
[21:00:23] adantj: I have a project using a Rest client (her.rb) for persistence. I also have a form with one of the "models" and nested attributes. when submitting and then rendering on error (ie render :new), from where do nested fields read their value, params?
[21:00:46] adantj: because those form fields are coming out blank
[21:02:05] jhass: kaneda^: how about default scope: http://api.rubyonrails.org/classes/ActiveRecord/Scoping/Default/ClassMethods.html#method-i-default_scope
[21:02:13] adantj: was trying to see if reading the code in form_helper.rb would help out
[21:02:18] kaneda^: jhass: that's what i was thinking of, ty :)
[21:09:26] benlieb: anyone have recommendations on rails-friendly mailing services? I have 7000 users and will maybe send a newsletter 2 x month. Should I do it straight from my server? Or is that major bad mojo?
[21:20:30] kaneda^: benlieb: depends, you could use a service for this, or simple mail service through amazon
[21:20:42] kaneda^: i do it internally at the moment but with amazon this is a huge PITA
[21:21:26] benlieb: kaneda^: I did an integration for AWS SMS about 3 years ago when it first came out. Huge PITA.
[21:21:51] benlieb: kaneda^: for a client. This one's for one of my own projects. Basically I'm wanting something with a good API and low cost.
[21:22:03] kaneda^: benlieb: i run my own mailserver outside of AWS and this was an OK solution, but running a mailserver sucks
[21:22:06] benlieb: Looking at mandrill, send grid, mail chimp. Not sure of others with rep.
[21:22:21] kaneda^: we use mail chimp outside of the app
[21:23:12] benlieb: kaneda^: I have a mail server on my VPS. I just don't want to endanger my IP rep
[21:23:43] kaneda^: benlieb: same
[21:23:57] kaneda^: i'm actually shutting it down because it's mostly an attack vector for spam pots
[21:23:58] benlieb: kaneda^: not sure how great the risk is though
[21:24:00] kaneda^: s/pots/bots
[21:24:19] benlieb: i hate spam pots
[21:24:23] stef1a: is it possible to send an actionmailer email using only "bcc" recipients (without "to" recipients)?
[21:24:27] kaneda^: benlieb: bots try to relay through my mailserver more than i send mail through it
[21:24:43] benlieb: kaneda^: hm.
[21:24:53] benlieb: kaneda^: how do you check for that?
[21:25:13] kaneda^: benlieb: just look at your logs, i send my mail connects to syslog
[21:25:23] kaneda^: so before it gets to the mail log itself
[21:25:27] benlieb: kaneda^: I've never bothered with that part of this project...
[21:25:40] benlieb: prob should
[21:25:50] kaneda^: in the future i'd definitely use a third party
[21:25:56] kaneda^: i wouldn't run my own mailserver again
[21:26:27] benlieb: what 3rd parties have easy integration for unsubscribing recipients who bounce or who flag spam?
[21:27:48] benlieb: kaneda^: looking at the ruby api for mandrill....
[21:28:07] benlieb: what exactly is a transaction message
[21:28:29] kaneda^: benlieb: i dunno, you can pay for a gmail service for instance
[21:29:05] kaneda^: looking around i see mandrill, ses, and gmail come up a lot
[21:31:39] benlieb: kaneda^: mandrill is cheap, and the api looks thorough: https://mandrillapp.com/api/docs/index.ruby.html
[21:34:15] kaneda^: benlieb: looking now
[21:35:34] kaneda^: benlieb: looks great
[21:35:40] kaneda^: i think i'm going to switch over to this :D
[21:40:05] benlieb: kaneda^: me to, I think.
[21:40:19] benlieb: *not* a rep for mandrill btw
[21:40:59] Limix: Hi, does anyone know if it???s possible to side load arbitrary data using ActiveModelSerializer? I want to front load client, products, etc even though they are not related.
[21:41:12] Limix: I went through the docs but can???t find anything
[21:49:19] shadynastys: https://gist.github.com/px-amaac/76f391075cdd4a677471 I am a little new to thisworking on a stupid simple problem. struggling to find the best way to put a form_for for a tag on all photos. I get nill class if i use what i have for individual photos.
[21:55:50] eyeamaye: after this form http://pastie.org/private/z0oforvof1pxjy0hobduw gets rendered, for some reason the array returned by translate_questions gets dropped in after the select fields, but before the submit button. i have a feeling it's because i'm using each_with_index, but I'm not really sure. does anybody have any ideas on how i can fix this?
[21:56:10] benlieb: shadynastys: why are you passing an array?
[21:57:36] shadynastys: oh i dont know.
[21:58:11] shadynastys: as i said i have not been able to get it to work. i think i started poking at it
[21:58:29] benlieb: eyeamaye: I don't see select fields in your form, also why use = @test... instead of - @test
[21:58:57] benlieb: oh is that not haml?
[21:59:01] benlieb: what tmplt?
[21:59:01] eyeamaye: benlieb, it's slim
[21:59:10] eyeamaye: sorry for not making that clear
[21:59:18] benlieb: sorry i din't look clearer.
[21:59:24] benlieb: still don't see select statements
[22:00:52] eyeamaye: benlieb, sorry i don't mean select fields. i meant radio buttons
[22:01:46] eyeamaye: the radio buttons are rendering correctly, the form works when i submit it, but the array that's returned by translate_questions is being returned at the end of the form as well
[22:02:09] benlieb: eyeamaye: what does array returned by translate_questions mean?
[22:02:12] shadynastys: I was trying to follow http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for <%= form_for([@document, @comment]) do |f| %>
[22:03:15] eyeamaye: benlieb, so i think it's looping over the array, generating the radio buttons, and then each_with_index is returning the array?
[22:03:44] eyeamaye: benlieb, http://pastie.org/private/z0oforvof1pxjy0hobduw#3,12
[22:03:47] benlieb: what does = mean in slim?
[22:04:01] eyeamaye: it's akin to - in haml i believe
[22:04:14] eyeamaye: it's just embedded code
[22:04:29] benlieb: in haml = means print what's returned and - means execute code
[22:04:55] benlieb: in haml the each line would have - and the radio lines would have =
[22:05:02] eyeamaye: that fixed it!
[22:05:32] eyeamaye: line 12 should have been -, not =, thanks!
[22:49:03] zastern: oops, sorry
[22:50:23] olance: looking for someone who knows about Rails initializers/hooks and routes loading... any luck? ^^
[22:51:51] rhizome: just ask your question
[22:52:06] bobbobbins: where do I put a class that needs to be included in routes.rb? I tried /lib but it can???t seem to find it there
[22:53:05] kaneda^: includes in config/application.rb probably
[22:53:24] olance: I'm looking for a way to update a file when my routes change... I've tried using ActionDispatch::Reloader.to_prepare, but then my routes are always on version behind the actual state of my routes file... any idea?
[22:54:26] olance: http://pastie.org/9520178
[22:54:47] olance: this is my last attempt
[23:05:36] Radar: olance: Why are you doing this?
[23:05:48] olance: ah, the why ^^
[23:06:05] olance: I'm using the js-routes gem to generate a javascript files from my rails routes
[23:06:56] olance: I can't use the //= require js-routes sprockets directive because I don't wan't/can't use sprockets here
[23:07:26] olance: so I'm trying to find a place to hook into where my routes are fully loaded and from which I can tell JsRoutes to generate my JS routes file
[23:07:57] olance: the best thing would be that it always run in dev mode, and just once in production
[23:08:14] olance: (or never in production, I can do with generating by hand/script before deploy)
[23:08:36] olance: hope you won't tell me this is a bad idea Radar ^^
[23:10:08] olance: I've just found this: http://stackoverflow.com/a/8707687/283481
[23:11:02] Radar: Yes that's most certainly a bad idea.
[23:11:23] olance: any suggestion then? ^^
[23:11:50] olance: once again, it's mostly to make development easier
[23:12:09] olance: I don't want to have to think about regenerating this file any time I update my routes...
[23:12:36] Radar: I did this in Spree an interesting way but I can't remember how I did it. Looking through thge code.
[23:13:02] olance: ok thanks :)
[23:13:14] olance: are you Spree's author?!
[23:13:26] olance: (I'm sorry I'm not good with famous people ^_^)
[23:13:27] Radar: I worked on Spree for a long time.
[23:13:39] Radar: https://github.com/spree/spree/graphs/contributors
[23:14:02] olance: uhuh quite a contributor indeed :)
[23:14:16] olance: btw why do you think it's a bad idea?
[23:14:23] olance: just so I don't have it again
[23:14:26] Radar: I defined the routes like this: https://github.com/spree/spree/blob/master/backend/app/assets/javascripts/spree/backend.js#L25-L44
[23:14:54] Radar: With pathFor being defined here: https://github.com/spree/spree/blob/master/core/app/assets/javascripts/spree.js.coffee.erb#L9-L10
[23:15:03] Radar: That way, you only get the routes you need in JS land.
[23:16:21] olance: however, you have to maintain both sets of routes
[23:17:31] Radar: Spree's routes do not change that often so I don't mind.
[23:17:49] Radar: I think once your routes stablise as well this would be the better solution.
[23:18:13] olance: they should not change that much either
[23:18:22] olance: once they're stable :)
[23:19:37] olance: I see I have read some of your work tonight without knowing it ^^
[23:19:43] olance: I recognize the blorgh engine :]
[23:19:52] Radar: I am around a bit.
[23:19:59] olance: (in your multitenancy book)
[23:20:02] olance: I can see that
[23:20:04] olance: congrats ^^
[23:20:07] Radar: thank you!
[23:20:33] olance: I'll consider the safe/reasonable side you propose
[23:20:46] olance: I must admit I liked the idea to just "configure and forget it"
[23:21:01] zeroNones: I've created a couple modules that fill in forms on a few 3rd party sites. Whats the proper way to call these modules from within a rails app? As an example, If someone comes to the site, creates an account they would want that data immediately filled in on these other sites...
[23:21:19] olance: but when it's stable, it's true that I can go through my routes and pick just the ones I need on the JS side
[23:21:49] Radar: zeroNones: Require the files that define the code and then call it just like any other code?
[23:22:52] olance: I'm off, back to work
[23:22:56] olance: thanks Radar ^^
[23:23:11] zeroNones: Radar so in my controller that creates the users account with the data that will be used I would just require my modules and then at the end of the create action run those modules?
[23:23:13] Radar: ttyl olance
[23:23:18] Radar: zeroNones: sure
[23:23:27] zeroNones: man thanks Radar!
[23:23:33] Radar: zeroNones: You might want to put it in a background job so that it doesn't tie up the request cycle. Depends on how immediate you want it to be.
[23:23:38] olance: zeroNones: you should consider delayedjob ;)
[23:23:45] Radar: I like sidekiq
[23:23:46] olance: ah you beat me to it :p
[23:23:52] zeroNones: thats what I was thinking, sidekiq
[23:24:04] zeroNones: but wanted to get it working fist and then move into a background job
[23:24:14] zeroNones: very nice, thanks for help Radar
[23:24:39] olance: never tried it myself, it didn't exist the only time I needed background jobs ^^
[23:24:40] zeroNones: thanks olance
[23:24:59] olance: no worries zeroNones
[23:37:32] benlieb: How can I tell which gem is responsible for json 1.6.1 being set in the Gemfile.lock? I'm installing a gem that needs a higher version of this, but I'm not manually requiring it in my Gemfile, and it's not listed under any other gem: https://gist.github.com/pixelterra/11593321450884a1d690
[23:38:57] Radar: benlieb: DEBUG_RESOLVER=1 bundle install
[23:39:07] Radar: It's a huge output. You might want to move it somewhere else.
[23:39:36] Radar: And if you were installing a gem that needed a higher version of the json gem then I would expect that to be used
[23:39:45] Radar: benlieb: which gem?
[23:39:54] benlieb: mandrill-api
[23:40:26] Radar: I don't see that in your Gemfile.lock.
[23:40:36] benlieb: no that's the one I'm trying to install
[23:40:42] Radar: And what happens when you try?
[23:40:45] KingDosser: Hey Guys. I am just updating from Rails 3.2.13 to Rails 4. I'm using Devise for authentication (as well as the confirmable module). When a user gets a confirm email and clicks on the link - it goes to the right URL with the right token. But for some reason it's not updating the confirmed_at attribute and then when I go to login it says "You need to confirm your account before continuing"
[23:41:04] benlieb: Radar: https://gist.github.com/pixelterra/eef0583cb8915d6b7e07
[23:41:05] Radar: KingDosser: What version of Devise?
[23:41:08] KingDosser: I feel it might be something to do with strong parameters? But not sure? Because Devise should work with Rails 4
[23:41:28] Radar: benlieb: It's because the version is frozen in Gemfile.lock. Try running bundle update.
[23:41:52] KingDosser: Radar: Devise v3.3.0
[23:42:07] Radar: KingDosser: Then I don't know why that would be happening.
[23:42:30] benlieb: Radar: Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
[23:42:38] Radar: benlieb: Upgrade your Ruby version.
[23:42:39] benlieb: is there a way to just target the json issue?
[23:42:43] benlieb: Radar: lol
[23:42:43] dclo: KingDosser: try the devise install over again. it updates the models
[23:42:48] Radar: benlieb: I'm serious.
[23:42:49] benlieb: working on that.
[23:42:52] KingDosser: Alright thanks dclo
[23:43:00] benlieb: spent 2 days this week straight and only half way through
[23:43:09] benlieb: the app works locally with 1.9.3
[23:43:22] Radar: benlieb: You can manually edit your Gemfile.lock (lol) and update the json version.
[23:43:23] benlieb: but getting the server multi-rubyable will take a lot of care
[23:43:31] Radar: multi-rubyable? wth
[23:43:35] Radar: Just one Ruby.
[23:43:49] mikecmpbll: i'm rubyable.
[23:44:08] benlieb: mikecmpbll: but are you multi-rubyable
[23:45:20] benlieb: Radar: yeah just deleting the json line fixed things
[23:46:13] benlieb: well, at least got bundle install to work, running tests, gulp. I hate updating gems
[23:48:05] rdavila: Hi guys, I need some help with Rspec, maybe any of us have a good experience with it
[23:48:12] helpa: we all like to think we're experts; just ask your question
[23:48:24] mikecmpbll: except me, i've never used it and am going to bed.
[23:48:29] rdavila: this is my issue: after updating an AR object, it fires a bunch of background jobs with Resque. In my specs I???m mocking the call to Resque, somethings in the lines of: https://gist.github.com/anonymous/367c3f0fcb241a89b9e5
[23:49:26] rdavila: as you can see, my problem is that I need to mock all other calls for Resque when I???m interested in mocking only one
[23:50:24] rdavila: wondering if there is a way to just ignore the other calls
[23:52:41] KingDosser: dclo - Tried that, still nothing :|
[23:57:40] KingDosser: Radar - it's weird. Cause even if I override with confirm! in console it returns true but still doesn't update?
[23:58:28] Radar: KingDosser: Hard for me to debug without seeing the problem happening on my computer.