« Back to channel list

#RubyOnRails - 16 September 2013

« Back 1 day Forward 1 day »
[00:08:26] Senjai: How wise is it to set a database level constraint that a belongs_to association can not be null?
[00:08:32] Senjai: From a design perspective
[00:08:51] Senjai: Is it best to encapsulate it in a validation on the model, or at the database level?
[00:10:05] bricker`LA: Senjai: If your data will only ever be written by the Rails app, then app-level validation is fine. I don't like to have two places where the data is validated, and I would rather handle errors gracefully.
[00:11:28] Senjai: bricker`LA: Ahh, I guess it's easier to handle validation errors than SQL errors :) Thanks for the input.
[00:11:45] Senjai: bricker`LA: Oh, and I also got an email back :)
[00:11:55] bricker`LA: Excellent! Glad to hear it.
[00:12:49] bricker`LA: Senjai: I just (today) open-sourced our massive flagship application: http://github.com/scpr/SCPRv4 and one of our other sites: https://github.com/SCPR/AudioVision
[00:13:28] Senjai: bricker`LA: Nice! I can start plugging away!
[00:14:04] Senjai: bricker`LA: I made my first major open source contribution not long ago to spree ^^ and I found a lot more I could do. Just working on an API app for a mini contract I got for an existing codebase atm though.
[00:14:39] Senjai: Just curious, what made you want to open source it? What made management want to do it?
[00:15:21] bricker`LA: Management doesn't care about that kind of stuff - I just didn't like working on hidden code all day long
[00:30:11] creature: Is there example code for a scaffolded model available anywhere?
[00:30:21] creature: I'd like to crib from it, and I'd like to not have to generate something only to destroy it later.
[00:30:54] bastilian: a scaffolded model is empty.
[00:31:09] creature: Sorry, I meant a scaffolded view.
[00:31:21] bastilian: creature: which one?
[00:32:26] creature: Well, right now I'm bothered about the index page, but I'll want the new/edit pages in short order.
[00:32:39] creature: I figured this *must* be up on Github or in a tutorial or something, but I've not been able to find it yet.
[00:34:18] creature: Ah ha! Got it.
[00:34:42] creature: https://github.com/rails/rails/tree/master/railties/lib/rails/generators/erb/scaffold/templates
[01:09:24] nate_: can someone help me parse this json: https://www.googleapis.com/books/v1/volumes?q=isbn:9780132153225
[01:09:41] Radar: nate_: having a problem with anything in particular?
[01:09:51] nate_: yeah how do i get to title
[01:10:18] nate_: i can get the result / response into a varaible
[01:10:24] nate_: variable *
[01:10:43] Radar: nate_: JSON.parse(<the response>)
[01:10:51] Radar: then it's just a hash, so read the keys as you need them
[01:12:39] nate_: yeah i can get result['items'] to return everything in there
[01:13:28] nate_: but i seem to be getting an error when i try to get results['items']['anything']
[01:14:09] optobear: nate_: results['items'] is an array
[01:14:47] butblack: active record question, I'm looking to pull the posts that have user_id 1 and 2… how can I do that? https://gist.github.com/ebbflowgo/6575710
[01:15:35] optobear: butblack: Post.where user_id: [1,2]
[01:16:07] nate_: results['items'][0][dat']
[01:16:16] nate_: results['items'][0]['data']
[01:16:32] butblack: optobear: simple, thanks
[01:16:41] optobear: butblack: np
[01:18:48] optobear: nate_: yeah, where 'data' is an actual key in the object, e.g. 'publisher'
[01:21:48] nate_: hmm optobear any idea why 'p result['items'][0]['publisher']' returns nil ?
[01:22:00] Radar: nate_: What does result['items'][0] return?
[01:23:54] nate_: https://gist.github.com/n8fischer/6575771
[01:24:58] nate_: it looks like a hash to me
[01:25:15] nate_: but result['items'][0][:publisher] returns nil as well
[01:25:16] Radar: The information you seek is nested
[01:25:19] optobear: nate_: it's a hash, but maybe not a flat hash
[01:25:36] Radar: nate_: what browser are you using?
[01:25:54] Radar: nate_: I have the JSONView extension for Chrome which is really helpful. I'd recommend getting something like that so you can easily visualize the JSON
[01:27:00] nate_: ok i'll try that
[01:27:47] optobear: nate_: sorry about the bum steer on 'publisher'. using a JSON visualiser would make it easier to see the structure ^
[01:30:22] nate_: no prob optobear, it looks like it's actually inside the volume info hash
[01:31:26] optobear: ACTION installs JSONView
[01:32:20] nate_: thanks again radar
[01:32:37] jrobeson: Radar, did you answer me earlier. i got pulled out and missed it if you did
[01:32:45] Radar: jrobeson: What did you ask?
[01:32:46] jrobeson: about the spree config/preferences sysstem
[01:33:06] Radar: jrobeson: Oh right. We don't have that pulled out of Spree into any gem right now.
[01:33:15] Radar: There's nothing Spree-specific about it other than the class names.
[01:33:26] jrobeson: well i might give it a shot then
[01:33:28] Radar: to my knowledge
[01:34:12] jrobeson: it'd be the most well maintained out of all similiar systems
[01:34:32] jrobeson: it is feasible to make a gem out of various directory paths i see, but is it a good idea. or should stuff be moved around
[01:36:30] Radar: I think keeping it as close to how it's done now would be most sensible.
[01:36:49] Radar: I don't know about it existing in app/models though… if it were moved to a gem I would expect all the code to live in lib.
[01:37:57] jrobeson: yeah i noticed that part of it was there in core
[01:38:08] jrobeson: i just did a cursory browse of the code to see how it was setup
[01:40:59] Radar: ACTION sees that someone else is getting too familiar with the core, does another release
[01:46:28] jrobeson: howdy sevenseacat
[01:47:20] jrobeson: Radar, who's learning your secrets?
[01:47:26] Radar: jrobeson: you :P
[01:48:08] jrobeson: i hope your peeps are better than that :)
[01:48:53] jrobeson: i hate fields like something_(1..6) :(
[01:49:02] jrobeson: but it does make sense here..
[02:04:15] butblack: quick routing question
[02:04:16] butblack: https://gist.github.com/ebbflowgo/6575968
[02:04:30] butblack: I have a dynamic route, it renders a string as opposed to an array, wondering why
[02:10:24] sevenseacat: well how are you calling it?
[02:10:44] sevenseacat: i dont think you're going to get the behaviour you want
[02:11:31] butblack: sevenseacat: I was originally looking at this: http://railscasts.com/episodes/46-catch-all-route
[02:11:49] sevenseacat: great. now answer the question i actually asked
[02:11:52] butblack: I was calling as localhost:3000/posts/ok/cool/neat
[02:11:55] Bumptious: I'm developing an API in RoR. It's a very simple API but I would like to keep error messages all together and refer to them by a an error code in the API controller
[02:12:05] Bumptious: where is a good place to put that?
[02:12:50] sevenseacat: butblack: right, so you're calling it with title = ok/cool/neat
[02:13:37] butblack: sevenseacat: precisely.. of course I can split it, however, I'm wondering why Ryan's route produced an array while mine produced the string
[02:14:49] sevenseacat: maybe because its a six-year-old railscast using rails 2?
[02:16:39] butblack: sevenseacat: fair, so my real question is… is there a rails 4 equivalent?
[02:17:17] optobear: butblack: you're seeing the prescribed behaviour according to http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
[02:17:27] sevenseacat: (10:10:44) sevenseacat: i dont think you're going to get the behaviour you want
[02:18:16] butblack: optobear: yeah, saw that thanks for the link (Y)
[02:18:52] butblack: sevenseacat: I don't see how that was very clear.. but it's fine I'll just split it
[03:03:49] sdwrage: Hey all. Having a bit of an issue with one of my unit test cases. It should be failing as I don't have a validator for the model yet but its still passing https://gist.github.com/anonymous/b6f4f3ba0b3b2eb97485
[03:03:53] sdwrage: its the bottom test
[03:04:04] sdwrage: I added the model file in as well
[03:07:17] ryanw: Hi. I'm encountering a bug in webmock and getting the error "can't add a new key into hash during iteration". Is there any way to find where the interation starts?
[03:12:21] jrobeson: ryanw, all i can saw is grep the webmock error for that code and work backwards, or use a debugger
[03:21:20] dsrx: kind of wish git had a way to add arbitrary structured metadata to a commit, putting [skipci] or whatever in commit messages feels gross and overloaded
[03:21:33] dsrx: should be able to add a 'skipci' attribute or something to a commit
[03:22:12] dsrx: oh wait, git notes
[03:22:39] Radar: GOOD AFTERNOON PEOPLE
[03:22:47] Radar: ACTION surveys (imaginary) kingdom
[03:23:20] Radar: ryanw: Got some code that reproduces the problem?
[03:23:22] bratsche: How's it going?
[03:23:54] Radar: Released Spree 2.0.5 and 2.1.0 today, so get on that if that's what you want (hint: it is). Other than that, a little disappointed that GTAV did not arrive in the post today.
[03:24:08] Radar: But pressing onwards and upwards with Spree work in the mean time.
[03:24:20] bratsche: Yeah I'm looking forward to that one too.
[03:24:22] sevenseacat: thats not what I want Radar, you dont know me at all D:
[03:24:35] ryanw: Radar: It's a complicated setup. But I monkey patched webmock and it's all good now.
[03:24:49] bratsche: Normally I never buy gta games until they come out on PC, but this time I went ahead and bought the ps3 version.
[03:24:50] Radar: ryanw: rightio
[03:24:58] scyllinice: Radar: Don't read reddit for the next month then
[03:25:02] Radar: scyllinice: pretty much
[03:25:14] dsrx: always good advice :D
[03:25:26] bratsche: reddit is fine, just avoid the comments.
[03:25:35] Radar: Apply https://twitter.com/AvoidComments liberally to Reddit
[03:25:38] bratsche: Which is good advice for anything online: don't read the comments.
[03:25:59] dsrx: maybe there should be something added to teh hippocratic oath for programmers, "do not add a comments section to anything"
[03:26:02] scyllinice: That's great except for the people who like to post spoilers as the submission title
[03:28:16] scyllinice: Radar: Do they normally get you the game before the US street date?
[03:30:03] Radar: scyllinice: nope. I just bought it from a retailer like all the normal people do.
[03:30:29] Radar: scyllinice: they've shipped it out but it's using the normal postal system rather than something with a tracking number… therefore I have nfi when it will arrive
[03:30:39] scyllinice: US street date is the 17th I think
[03:30:47] sevenseacat: 5-7 days most likely. australia post is hopeless.
[03:31:21] scyllinice: You guys need to feed your kangaroos better then
[03:31:24] sevenseacat: i've had fedex packages arrive from singapore faster than sending a parcel across the city with australia post
[03:31:46] bratsche: Where do you order gta5 from in .au? I thought they wouldn't sell games like that there.
[03:32:01] sevenseacat: we have R ratings for games now!
[03:32:15] sevenseacat: we joined the 21st century yeeeeeah
[03:32:44] scyllinice: Germany is the place where they make them change all the blood to green, right?
[03:33:14] bratsche: Oh that sucks. Because I really want to move to Germany. :)
[03:43:00] bricker`LA: scyllinice: Nintendo still won't show blood in any of their games. I remember the first time I played Tony Hawk's Pro Skater on a Playstation, after having played it on N64 for years - my 16-year-old mind was blown.
[03:43:06] christopherbull: I'm having an issue where I have `resources :subscriptions` defined twice in my routes (within two different namespaces) and rspec is not using the correct controller in controller specs, event though everything in the controller is scoped correctly, has anyone had this before?
[03:43:55] bricker`LA: christopherbull: Are you referring to the correct module in the spec? describe Namespace::YourController do ...
[03:44:03] Radar: christopherbull: code or ban
[03:44:28] christopherbull: bricker`LA: yep
[03:45:07] bricker`LA: christopherbull: I believe that you think it's using the wrong controller.
[03:45:18] bricker`LA: christopherbull: however, I don't believe that it's actually using the wrong controller.
[03:45:42] christopherbull: bricker`LA: no, it actually is. sorry i'm putting some stuff into a gist
[03:48:09] Radar: thank you christopherbull
[03:50:07] christopherbull: sorry, here's the code with some redacting https://gist.github.com/te-chris/f6223bab5952729baaea
[03:50:59] Radar: christopherbull: What's Routes::Web?
[03:51:25] christopherbull: Radar: ryan bates style subdomain constraint
[03:51:50] Radar: christopherbull: can you please show us the code for that?
[03:52:45] christopherbull: Radar: gist updated
[03:53:16] Radar: Are you sure that your request is matching that constraint? You can figure that out with a 'binding.pry' as the first line in self.matches? there
[03:53:32] christopherbull: yeah that definitely works
[03:53:52] Radar: Absolutely positive?
[03:54:12] christopherbull: yep, this is quite a complex app, the actual routes file is ~200 lines
[03:54:18] christopherbull: everything else works
[03:54:30] Radar: What does controller return in the binding.pry inside the spec?
[03:54:59] christopherbull: #<SubscriptionsController:0x007f84a2bb4c1 …> the base level controller
[03:55:42] Radar: What path is the Api::Web::V1 controller at relative to app/controllers?
[03:56:38] christopherbull: "api/v1/web/subscriptions/:id" - you mean like that?
[03:56:57] christopherbull: vs "app/:app_id/subscription"
[03:57:08] Radar: christopherbull: no, I mean in the directory structure of the application. Where does this controller liv?
[03:57:48] christopherbull: api: "app/controllers/api/web/v1/" vs app/controllers
[03:58:35] Radar: Everything is checking out so far. I don't know why it's loading the controller at the root first.
[03:58:47] Radar: I'm thinking it may have something to do with autoloading but I can't prove it right now
[03:59:13] christopherbull: ah true, yeah that's what's buzzing us all out here. everything *should* work, but somehow isn't
[04:03:46] Radar: christopherbull: I don't know sorry
[04:04:05] christopherbull: Radar: that's ok, thanks for taking the time to go through it with me
[04:49:34] engineerbell: Hi Everyone, I'm having trouble with rails
[04:50:43] engineerbell: I'm trying to run a simple line " rails generate scaffold User name:string email:string" and i get a wierd response
[04:51:19] engineerbell: it responds like i simply typed in "rails" and puts out default usage information
[04:52:03] engineerbell: when i try to run the rake command i get a big fk you "rake aborted! undefined method `migration_error=' for ActiveRecord::Base:Class"
[04:52:23] engineerbell: How in the hell do i fix this?
[04:52:59] sevenseacat: are you in the folder of a rails application?
[05:04:33] engineerbell: hi Sevenseacaat
[05:05:11] engineerbell: thanks for asking me about folder location. Looks like i have an "app" folder inside of an app folder that's why i messed things up
[05:11:04] pipework: sevenseacat: hi.
[05:16:30] kazim59: Would coffee-rails-source-maps work for a rails project that's not using coffee, but plain JS?
[05:17:10] existensil: why would you need source maps if you aren't using coffee script?
[05:17:41] existensil: i assume it would work in the sense that having support for coffeescript source mapping shouldn't affect your plain JS at all, so it will work like normal
[05:19:22] kazim59: existensil: I've an JS error tracking installed in my production, and it sends me errors like this http://pastie.org/8329324
[05:19:47] kazim59: existensil: doesn't tell me backtrace either.
[05:20:37] kazim59: So how do I know which among the so many files, where's the error? And that service says it needs source maps to do that.
[05:20:55] kazim59: using musculahq.appspot.com to be exact
[05:21:21] Radar: engineerbell: Uh, that looks to be more due to you attempting to use a configuration file that is designed for Rails 4 in a Rails 3 app.
[05:21:22] Radar: At a guess..
[05:22:40] existensil: kazim59: sorry, not sure how to use source maps for that. i'm sure its possible but haven't done it. i've only read about source maps :-P
[05:23:23] linkon: i am getting this error when uploading image ActionController::RoutingError (No route matches [GET] "/jquery-file-upload/jquery.fileupload.js"):
[05:24:27] existensil: kazim59: at least at first glance, though it looks like that gem only generates source maps for coffee script
[05:24:52] Radar: linkon: you are missing that file. Where is it?
[05:25:22] kazim59: so how do people track browser js errors in production, in a single page app (mine uses ember.js)
[05:26:13] pipework: sevenseacat: I don't know what I want to do with my server. D:
[05:26:15] existensil: when you find an awesome way let me know. i always have to reproduce the error locally
[05:28:32] linkon: <Radar> here is my gist at 13 line https://gist.github.com/anonymous/6576958
[05:29:23] Radar: linkon: Yeah, you're linking to the file… but where is the file within your application? Your browser says it cannot find it.
[05:29:49] kazim59: existensil: we got this http://errorception.com/
[05:31:11] gamov: hello guys. I'm facing a problem: i have a belongs_to :source, polymorphic: true association and I would like to show a form where user can select one source among a few (via a radio button) but the problem is that I can radio select the :source_id but I also need to do it for the :source_type in parallel… JS is my only option here?
[05:32:07] gamov: there is a stack overflow question: http://stackoverflow.com/questions/6653109/ but I think the answer is wrong
[05:32:14] engineerbell: Radar i think you're right. I unstilled Rails 4 and I'm trying to run 3.2.14 but i get the same error
[05:41:01] linkon: <Radar> i added at public folder, now i am getting this error ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
[05:41:11] Radar: linkon: that error is something entirely unrelated.
[05:42:20] linkon: <Radar> in rails 3 working fine but in 4 shows this error
[05:42:27] Radar: linkon: cool story
[05:42:34] Radar: linkon: I cannot fix this problem because it is not my app. You are on your won.
[05:46:59] krz: Radar: they said it was gonna be sunny, but it isnt
[05:47:09] Radar: krz: confirm
[05:47:20] Radar: today is only rain and tears (due to lack of GTAV)
[05:47:48] krz: yea tomorrow is the release date, no?
[05:47:52] Radar: supposed to be
[05:48:05] Radar: seems like a couple of people have got it earlier than that though
[05:48:10] Radar: or they are TIME TRAVELLERS
[05:48:12] krz: too bad they arent coming out with a PC release till next year!
[06:17:45] Radar: tagrudev: 45 mins late
[06:17:48] Radar: ACTION docs tagrudev's pay
[06:18:43] tagrudev: Radar, :D and I am first at the office
[06:19:09] Radar: I was first (and last) at my office today
[06:19:14] tagrudev: send the report to my boss
[06:19:16] Radar: we're so alike :D
[06:19:31] Radar: To: tagrudev. Re: tagrudev
[06:22:50] tagrudev: certainty, yo
[06:57:53] maoko: What's the best way to re-initialize js scripts after rendering new content via ajax? I'm currently adding calls into js.erb and rendering them through controller's with js response, but this isn't the right way to do things
[07:00:13] optobear: maoko: what do you mean "reinitialize js scripts"? if you loaded the scripts once, they are already present after an ajax call
[07:01:45] maoko: optobear, https://gist.github.com/maokomioko/df50b764ce5bf7994d1c something like this. I need to call these scripts explicitly when rendering the content via ajax within modal window.
[07:02:30] rvanlieshout: maoko: if you need to call something yourself you could listen to ajax:success
[07:03:38] jan1337z: the foreign key to CamelCase would be camel_case_id or camelcase_id?
[07:03:46] sevenseacat: jan1337z: first one
[07:03:54] maoko: rvanlieshout, like creating a global function with a call ajax:success and placing all my callings within it?
[07:04:33] rvanlieshout: maoko: ? it's just adding an event listener to either your element or to a parent element
[07:07:39] optobear: maoko: rails ujs creates an event called ajax:success that you can listen for on the element that made the call. e.g. button.bind('ajax:success', function(event, data...) { do stuff; })
[07:07:51] optobear: maoko: see https://github.com/rails/jquery-ujs/wiki/ajax
[07:08:57] jrobeson: thanks for reminding me to finally read the docs for that thing
[07:09:43] maoko: Great. So it's just a normal binding for the element with a function inside. Will give it a try
[07:10:18] sevenseacat: rails' ujs is actually pretty powerful.
[07:11:24] optobear: it's ... unobtrusive
[07:19:13] maoko: In the end it helped me to remove a lot of redundant code. That's just great
[07:19:35] Radar: Rails hug
[07:20:13] sevenseacat: rails needs more hugs
[07:21:17] jrobeson: ACTION hugs Radar 
[07:21:37] jrobeson: thx for the dox
[07:22:15] optobear: ACTION beckons jrobeson to join the group hug
[07:22:23] jrobeson: for some reason i felt the need to write it in that fashion
[07:22:31] jrobeson: ACTION joins
[07:22:43] jrobeson: i haven't had a real good hug in awhile
[07:22:47] jrobeson: stuck in cave
[07:24:44] jan1337z: Is pluralization important while creating models?
[07:25:05] sevenseacat: its important that you dont do it.
[07:25:09] optobear: jan1337z: model should be named in singular
[07:25:15] jan1337z: Okay thanks :)
[07:25:29] jan1337z: so rails does this magic for me - thanks rails
[07:30:16] TvL2386: hi guys, I'm having issues with activesupport/concern. I'm trying to use it in a normal ruby app in the same way as I do in rails (got this one: https://github.com/alex-klepa/rails4-bootstrap-devise-cancan-omniauth/tree/master/app/models). In rails the model is a class (User) and the concern is a module (User::Roles). When trying to do this myself, I either get User is not a module or User is not a class depending on which is required fir
[07:30:58] bricker`LA: TvL2386: I would recommend against nesting modules inside of classes
[07:31:35] bricker`LA: especially when you're including it back into the same class
[07:32:18] TvL2386: thanks bricker`LA : does that mean you're against using concerns like in the git repo i mentioned (User::Roles)?
[07:33:00] bricker`LA: TvL2386: No, I use the bloody shit out of concerns, but I suck at naming them so I just nest them all under a Concern module. https://github.com/SCPR/SCPRv4/blob/master/app/models/news_story.rb
[07:34:03] jrobeson: that's intense
[07:34:50] sevenseacat: i wouldnt call that intense, i'd call it bizarre
[07:35:06] jrobeson: sevenseacat, i was referring to what he said , not the code
[07:35:32] bricker`LA: The problem is that we have like 4 models that are exactly the same - it was that way long before I showed up - and consolidation at this point is impossible, so we just throw modules at the problem.
[07:36:22] TvL2386: It would not work for me, because I have classes HP, Dell, Cisco. I want to create a concern HP::Interfaces, Dell::Interfaces, Cisco::Interfaces which are all different, if I say "module Cisco::Interfaces" then I get the error saying Cisco is not a module
[07:37:03] TvL2386: or Cisco is not a class, depending on which file i require first
[07:37:13] jrobeson: wouldn't it be better to name it Interfaces::HP ?
[07:37:17] optobear: TvL2386: try nesting the definitions? class HP; module Interfaces
[07:37:18] bricker`LA: TvL2386: what about just module CiscoInterfaces ?
[07:37:19] jrobeson: or whatever
[07:37:49] TvL2386: bricker`LA, don't ask me why, but it looks ugly to me :)
[07:38:24] optobear: TvL2386: don't fear nesting a module inside a class, it's fine
[07:38:26] TvL2386: optobear, that was what I was thinking, but nesting a module in a class... is that something you can do? Or would you be kicked?
[07:38:37] optobear: TvL2386: totally fine
[07:38:49] TvL2386: bricker`LA, was strongly against it :)
[07:39:15] TvL2386: but it really does look appropriate in this situation
[07:39:33] bricker`LA: optobear: nothing wrong with nesting a module inside of a class, but if you're then going to include it right back into that class, that's where it gets a little iffy to me
[07:48:03] optobear: TvL2386: bricker`LA: i've used that idiom to modularize big models. i don't find it too iffy under those circumstances
[07:49:41] optobear: TvL2386: bricker`LA: if you intend to make a concern that's shareable between many classes, i wouldn't necessarily namespace it to one class, of course
[07:50:11] bricker`LA: optobear: why use a concern at all if you're not going to share it?
[07:51:59] TvL2386: optobear, bricker`LA: I decided that my "concern" will just redefine the HP class and add methods instead of putting them in a module and then including them
[07:52:15] optobear: bricker`LA: well, from the implementation POV, a concern is just a module in drag, but, yes, I wouldn't call something a concern that wasn't intended to be shared
[07:52:15] TvL2386: optobear, bricker`LA now I don't need activesupport at all
[07:54:50] optobear: TvL2386: you have that option :)
[08:08:29] b3hnam: I want to link scss file in my view I used <%=stylesheet_link_tag("registration") %> but it link to registration.css that non exist and I want to link to registration.css.scss
[08:08:37] b3hnam: how can I change it ?
[08:10:36] rvanlieshout: b3hnam: you don't link to .css.scss
[08:10:52] rvanlieshout: your link is correct and that file should be served by the asset pipeline
[08:29:21] BrazenBraden: good morning all
[08:51:21] Gaby_: hi everybody
[08:56:18] adac: How to add a role (cancan + devise)with FactoryGirl
[08:58:37] workmad3: adac: basic cancan with devise doesn't have a built-in roles system...
[08:59:52] adac: workmad3, using role_model gem. Forgot to mention
[09:00:28] rvanlieshout: so the queestion is "How to add a role (cancan + devise + roles_gem) with FactoryGirl
[09:00:57] Cork: font-url is linking me to /fonts/<file>.<ext> instead of /assets/fonts/<file>.<ext> in rails 4; anyone know what's going on there?
[09:01:13] adac: rvanlieshout, right!
[09:01:33] workmad3: adac: see, that's useful information to get help :P
[09:02:50] jan1337z: Question: I have a Section that can have many (sub)sections. So I need a self reference. The first thing I thought of is Class Section: has_many :sections, belongs_to :section; Is that right?
[09:03:39] jan1337z: wouldn't that mess with with section_id ?
[09:03:42] sevenseacat: i'd name the associations better
[09:04:06] sevenseacat: eg. parent_section, child_sections
[09:04:15] sevenseacat: or subsections
[09:04:34] jan1337z: so parent_section would be a model?
[09:04:42] workmad3: jan1337z: no
[09:04:55] jan1337z: I wouldn't like that
[09:05:01] workmad3: jan1337z: belongs_to :parent_section, class_name: "Section"
[09:05:25] workmad3: jan1337z: and then the parent_section's id would be stored in parent_section_id on the Section model
[09:05:57] workmad3: jan1337z: so, as sevenseacat said... name your associations more appropriately ;)
[09:06:02] jan1337z: workmad3, I like that
[09:06:10] jan1337z: thanks workmad3 and sevenseacat
[09:14:38] msimkins: Greetings All
[09:14:44] gamov: repeat question (since sevenseacat and workmad3 are here :) ): I have a belongs_to :origin, polymorphic: true association and I want to have a radio button selection with different origins to select from. The problem is that the radio button will only handle the origin_id attribute, not the origin_type. I current implemented the trick in JS but it feels dirty and I wonder if somebody has a better idea.
[09:21:03] maoko: Mmm. How can I translate {%= o.name %} from this https://gist.github.com/maokomioko/e422f4757066ed9c627c gist into haml?
[09:21:24] maoko: This line is inside the script tag
[09:28:07] henn1nk: maoko: line 1?
[09:28:51] maoko: henn1nk, yes and the third line
[09:29:49] henn1nk: maoko: wait
[09:29:51] ljarvis: this basic stuff is on the haml homepage
[09:30:38] workmad3: maoko: is it translating it into haml that's a problem, or the fact that you don't have something capable of running that haml in js on the client-side for a client-side template?
[09:30:52] henn1nk: maoko: https://gist.github.com/henn1nk/6578465
[09:31:00] maoko: wokrmad3, the translation itself is a problem
[09:31:17] ljarvis: then you should learn haml
[09:31:47] maoko: henn1nk, hmm. Looks pretty basic. I had the problem with this {%= o.name %} part. Will try it then
[09:32:07] henn1nk: maoko: haml is "basic" :P
[09:32:29] jrobeson: i just saw a haml client side implementation
[09:32:34] henn1nk: maoko: one error
[09:33:00] henn1nk: maoko: https://gist.github.com/henn1nk/6578465
[09:33:06] henn1nk: should now be right
[09:33:07] maoko: henn1nk, indeed, but that line was giving me chills)
[09:39:57] Jonah11_: question about session fixation described here: http://guides.rubyonrails.org/security.html. after the vicitim gets his session set to the attackers fixed session, "As the new trap session is unused, the web application will require the user to authenticate." My question: Isn't the trapped session already used by the attacker? Hence why doesn't the victim get logged in as the attacker?
[09:42:36] workmad3: Jonah11_: they mean the session is unauthenticated
[09:43:32] MickeySoFine: I want to make a link that calls update and updates only one attribute how can I get link_to to do that?
[09:44:19] Jonah11_: workmad3, but in the description step 1 and 2 suggest that the attacker has logged in and is maintaining the session. Or do they simply mean he is maintaining an unauthenticated session id? i guess that would make sense...
[09:44:51] workmad3: Jonah11_: they've accessed the site, gotten a fresh session id
[09:45:18] workmad3: Jonah11_: and then they exploit the target's machine to get it to use that session ID
[09:45:47] Jonah11_: workmad3, but the attacker himself has never logged in under that session id, correct?
[09:46:00] workmad3: Jonah11_: however, the way most authentication and session-use is done in rails, that's not really an exploitable attack vector
[09:46:03] workmad3: Jonah11_: yes
[09:46:17] Jonah11_: workmad3, ok ty. makes sense now
[09:46:44] workmad3: Jonah11_: session fixation is avoided simply by storing the user_id in the session (but that does then require some way of preventing session tampering... such as rail's built in HMAC session signing ;) )
[09:47:21] Jonah11_: workmad3, right. got it. i was just trying to understand how it worked in theory.
[09:47:27] workmad3: Jonah11_: you'd need to worry about that if you were using the active-record session store though :)
[09:48:21] MickeySoFine: i want to make a link that I can click that calls update to set a records status to done, how do I create a link for that?
[09:48:40] jrobeson: read the docs for jquery-ujs
[10:13:43] DouweM: hi folding chair!
[10:17:52] bweh: Hello, I'm writing tests for my OAuthClient controller. The OAuth authentication process are ordered steps. Is there a way to force rspec into ordering the tests so contexts are valids?
[10:28:19] msimkins: bweh: ?? - each test should be selfcontained
[10:29:02] msimkins: bweh: so they should work without reference to any other test data that may or maynot be present
[10:29:13] bweh: yes of course
[10:29:20] bweh: but oauth is a context operation in é steps
[10:29:30] bweh: so something has to be referenced somewhere
[10:30:34] msimkins: bweh: The only way to force RSpect to run tests in a particular order is to use a fixed --seed value
[10:32:53] timhansen: good morning, all
[10:35:24] workmad3: bweh: write a single test to verify the oauth interaction in its entirety
[10:35:57] timhansen: i'm trying to get this rails 3.2 app working with constant contact, but none of the methods i've tried thus far are working. i thought this would be pretty simple to integrate, but it's proving to be a much bigger problem
[10:46:17] mklappstuhl: I want to use Rails' url helpers in a mailer but everytime I call them it tells me that the default_url_options[:host] option is not set. If I stop the execution before I use the path helper and inspect the configuration it seems to be set though — any ideas?
[10:47:54] mklappstuhl: Rails.application.config.action_mailer.default_url_options — is this the thing that should be set?
[10:48:20] mklappstuhl: (There are so many different places where on can find .config...)
[10:48:27] elaptics: mklappstuhl: yes, you primarily just need to add the host name
[10:48:49] elaptics: mklappstuhl: you should add ones in each environment for that because usually you'll have different hosts for each
[10:49:09] elaptics: unless you just don't care how the links come out in anything but production
[10:52:16] mklappstuhl: elaptics: http://i.imgur.com/7kxlMRj.png — that doesn't make any sense does it?
[10:52:21] cek: hey. how do I use factorygirl sequences factory-wide?
[10:52:36] cek: i'd like to use the same sequencial number in different attributes
[10:53:06] mklappstuhl: elaptics: I set the default_url_options in production, staging, ... but didn't have them in development. Now after setting it to 'localhost' in development I get this..
[10:54:27] elaptics: mklappstuhl: use the _url helpers not _path
[10:55:02] mklappstuhl: elaptics: doesnt change anything
[10:55:04] elaptics: mklappstuhl: personally I'd just use the helpers in the view directly rather than doing that in the method itself
[10:55:33] elaptics: mklappstuhl:gist your development.rb file and the mailer and view code you currently have
[10:55:38] mklappstuhl: oh. actually thats probably a lot cleverer
[11:04:26] afrodiziak: anyone managed to get libv8 gem work on windows?
[11:04:46] defswork: what is windows ?
[11:09:03] rvanlieshout: isn't that where you throw your same-named machines through?
[11:15:23] msimkins: afrodiziak: Extremely unlikely it will work in Windows
[11:15:38] afrodiziak: msimkins why?
[11:16:09] afrodiziak: msimkins it is a very important gem, it will seems very unlikely nobody made something for windows
[11:16:48] msimkins: afrodiziak: I assume you are trying to install therubyracer ?
[11:17:23] afrodiziak: msimkins yes i need to make it work with this dependancy gem 'therubyracer', :require => 'v8'
[11:17:36] workmad3: afrodiziak: you don't need therubyracer on windows
[11:18:37] msimkins: afrodiziak: someone did do an (older version)
[11:18:51] afrodiziak: workmad3 what do you mean?
[11:19:16] workmad3: afrodiziak: windows comes with a supported javascript runtime environment out-the-box
[11:19:28] workmad3: afrodiziak: so you don't need to install therubyracer for rails on windows
[11:20:02] wartech0: workmad3, I thought so too
[11:20:04] workmad3: afrodiziak: which is just as well, because in order to install it, you need to set up a gnu-style build toolchain (typically using something like cygwin or mingw) which can be a real PITA
[11:20:10] wartech0: but that wasn't the case for me
[11:20:23] wartech0: I just installed nodejs and stuff started working
[11:20:28] workmad3: afrodiziak: and you need to install python, and make sure it works fine
[11:20:32] workmad3: wartech0: that's another option ;)
[11:20:42] wartech0: I am on Windows 8 though so
[11:20:56] workmad3: wartech0: I prefer node to therubyracer anyway... it gives better errors when something goes wrong :)
[11:21:13] wartech0: yea node is pretty awesome
[11:21:24] afrodiziak: workmad3 are you sure everything and the gems would work without it, many gems are dependant on it... so if i just move it to production only it should work http://pastebin.com/btsLc0p5 ?
[11:21:44] wartech0: what about hastebin?
[11:21:56] workmad3: wartech0: gist and pastie are preferred
[11:22:25] wartech0: I like hastebin it is by far the cleanest paste site I have seen
[11:22:56] workmad3: wartech0: I've yet to see a multi-file hastebin paste
[11:23:04] afrodiziak: ok a correction, using pastie :) http://pastie.org/8329887
[11:23:06] workmad3: wartech0: at least, not one that doesn't look like ass ;)
[11:23:10] wartech0: awwh yea it doesn't do that
[11:23:47] wartech0: I could see the need for it for RoR
[11:23:54] workmad3: wartech0: multi-file code dumps are pretty common... and gist makes them really easy and nice :)
[11:24:07] universa1: i personally like gists very much nowadays, especially for helping others, since it allows you to easily fork it and make modifications, but still keep the connection :-)
[11:24:16] workmad3: ^^ that too
[11:24:20] wartech0: meh not so much in C++
[11:24:31] wartech0: I do a lot of C++ and the problem is normally in a single file
[11:25:12] workmad3: wartech0: how about a .h & .cpp paste? ;)
[11:25:24] wartech0: .h isn't normally needed
[11:25:42] afrodiziak: workmad3 after just removing the dependancy on windows now this doesnt work? -> ## uglifying javascript... ### compiling Sass...
[11:27:43] workmad3: wartech0: fair enough :) although for a single-file paste, gist is still pretty nice if you install the command-line helper
[11:27:49] workmad3: wartech0: gist foo.cpp ;)
[11:28:11] wartech0: if I am just doing standard lib stuff ideone is the way to go
[11:28:19] wartech0: because it actually runs it and produces output
[11:31:03] defswork: what happens when github go evil though?
[11:32:20] universa1: defswork: people will move on and choose the next best thing? ;)
[11:33:44] arkiver_: Hello. What does Model.find(0) mean in Rails 2 ? I am trying to migrate an app to rails 3
[11:33:46] defswork: I guess the main owners arent desperate for cash yet
[11:34:07] defswork: arkiver_, it means find a model with id of 0
[11:34:10] elaptics: arkiver_: the same as it does now, find a record with id 0
[11:34:22] elaptics: not that you're likely to have one with zero
[11:34:24] universa1: arkiver_: give me the model instance with id 0, if it can't find that one, raise an error
[11:35:54] arkiver_: hmm. Thanks. Just felt it looked a bit weird to find an object with id 0.
[11:36:12] defswork: arkiver_, sounds like some stupid hardwire hack
[11:36:27] defswork: maybe a single row table - settings perhaps ?
[11:36:31] arkiver_: tell me about it :-/
[11:41:31] Syrit: guys, inside my _from, i am trying to use bootstrap modal that has a form to create another model, is that a problem ? and is that the reason why my modal is submitting the containing from instead of it's form ?
[11:42:10] workmad3: Syrit: most likely
[11:42:25] workmad3: Syrit: nested forms are completly undefined in the HTML standard, afair
[11:42:40] Syrit: what can i do to get around this workmad3 ?
[11:42:55] workmad3: Syrit: don't nest forms
[11:43:45] Syrit: okay, so what would you do, if you wanted to have some way, the user can use to create another model using ajax ?
[11:44:43] workmad3: Syrit: what I would do is probably nothing like what you want to do ;)
[11:44:51] toretore: put the modal form outside the other form
[11:45:24] Syrit: toretore, i did, i put it in a partial, and i called render
[11:45:27] toretore: MyApp.modal.show(formHTML) or MyApp.modal.load(formURL)
[11:45:40] toretore: it's not difficult if you understand what you're doing
[11:46:14] toretore: then if you need the id of the created object, you can add a callback or event mechanism
[11:47:42] Syrit: thank you toretore
[11:48:42] toretore: "but i'm just going to keep looking for some easy pre-packaged solution that i don't understand and which will be mediocre and i won't be able to make work the way i want"
[11:48:49] henn1nk: any idea why i receive an undefined method each in my user_spec using factory_girl? https://gist.github.com/henn1nk/6579660
[11:49:53] rvanlieshout: hmm... i'm searching for an English term for the parts of a day, such as morning, afternoon and night
[11:50:28] Syrit: toretore, actually, i used myModal.show inside the new.js.haml..
[11:50:44] rvanlieshout: In dutch that would be a dagdeel
[11:51:34] elaptics: rvanlieshout: period?
[11:52:02] rvanlieshout: couldn't a period also extend to several days?
[11:52:23] elaptics: yes, what's the context for using it?
[11:52:31] toretore: i think you're going to have to come up with your own term
[11:52:52] rvanlieshout: variable prices for a pricelist
[11:53:04] rvanlieshout: toretore: so it seems.. though there is a dutch word for it
[11:53:18] rvanlieshout: that would translate to part of the day-ish
[11:53:35] toretore: rvanlieshout: but are you going to restrict it to predefined definitions of morning, afternoon, etc?
[11:53:36] Syrit: happy hours :D
[11:53:42] rvanlieshout: a price-list has a default rate
[11:53:56] rvanlieshout: toretore: no, there is no restriction. it's a different price for a weekday between two times
[11:54:03] toretore: seems like it would be better to have a from hour and a to hour with a name attribute
[11:54:06] rvanlieshout: so a has_many :something somethings
[11:54:26] toretore: so just a TimeOfDay or something then
[11:54:34] rvanlieshout: i'm just searching for something something so that somebody else would understand it without reading further
[11:54:48] toretore: doesn't it have a name within the domain where it's applied?
[11:54:59] rvanlieshout: it's an addition to price_list.rate
[11:55:03] elaptics: rvanlieshout: session, interval?
[11:55:29] toretore: PricingPeriod
[11:55:43] rvanlieshout: something like that
[11:56:22] Syrit: toretore, may be i can use simple_nested_form_for ?
[11:56:44] toretore: is it an overriding property, i.e. do you have regular prices, then if the time falls within a pricing period it overrides the price?
[11:57:04] toretore: Syrit: you need to learn how html and js works
[11:57:06] rvanlieshout: toretore: exactly
[11:57:16] rvanlieshout: e.g. weekends or nights
[11:57:25] elaptics: rvanlieshout: I have an app with a similar sort of requirement and I used pricing_periods
[11:57:29] toretore: so, like happy hour :)
[11:57:38] rvanlieshout: if the price would be lower :)
[11:57:44] toretore: sad hour :(
[11:57:48] rvanlieshout: i like pricing_periods
[11:58:11] rvanlieshout: i would like to give the user the ability to define pricing classes like A) 5 and B) 6
[11:58:21] rvanlieshout: then apply these on periods
[12:00:56] elaptics: henn1nk: what are you trying to do in the user factory - line 99? That's the cause of your problem
[12:01:10] henn1nk: elaptics: yeah. i have an habtm there
[12:01:23] elaptics: henn1nk: what do you want the factory to do for you there?
[12:01:24] henn1nk: elaptics: user has_and_belongs_to_many :manufacturers
[12:01:41] henn1nk: elaptics: to generate associations/generate manufacturers for this user
[12:04:07] elaptics: henn1nk: have you read https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md ? Check out the section for has_many data generation - that's what you need to do
[12:05:01] henn1nk: elaptics: you mean i need to trigger the after create method? (like mentioned there)
[12:06:08] elaptics: henn1nk: you can specify in the factory what to do, so the example it gives there is creating several post records after the user has been created
[12:06:16] MickeySoFine: anyone have experience with stripe subscriptions?
[12:07:19] wartech0: windows powershell isn't too bad
[12:07:26] wartech0: its a big step up from normal cmd
[12:07:39] henn1nk: elaptics: thanks solved my problem
[12:17:29] Syrit: toretore, workmad3 here is a gist of my modal and what i am facing https://gist.github.com/anonymous/687b74fa08833e8f4415
[12:19:58] universa1: Syrit: why are you specifying url and controller?
[12:20:23] Syrit: universa1, because the modal, is submiting to /meetings instead of clients/new
[12:20:45] Syrit: and it's still actually,
[12:21:05] universa1: Syrit: you only need url for the form.
[12:21:26] timhansen: does anyone have experience working with Constant Contact? i'm trying to implement a simple email newsletter sign up, but keep getting a 400 Bad Request error when using their gem
[12:21:34] universa1: Syrit: and then it does not belong in the html hash.
[12:21:35] Syrit: mind you that this is inside another from
[12:21:39] wartech0: isn't it model?
[12:21:47] universa1: Syrit: YOU CAN NOT NEST FORMS IN HTML.
[12:21:56] Syrit: yes, yes, i get the idea :D
[12:22:01] Syrit: i wanted to get over it
[12:22:17] Syrit: i thought that i was doing it the write way by calling the format.js in the clients controller
[12:22:52] universa1: Syrit: but then, if you're displaying the form in a modal, the html code does not need to be in another form.
[12:23:00] Trudko: Guys I have project with sports league. When I save match for some league there is some additional computing. For example each player have some handicap which an affect the result. Problem is that user set handicap badly and he noticed it only after all results were saved in Database. I am looking for easiest way how to rerun all computation. For example I could run Update method(which contains computing code) in my Match Control
[12:23:37] Syrit: i don't get what you mean universa1
[12:23:42] Trudko: Is is there other way how to fix this(user can do it manually but this can take long time)?
[12:23:59] universa1: Syrit: <form>...<form>...</form></form> is invalid html.
[12:24:08] Syrit: i see, i get the idea
[12:24:18] Syrit: i want a solution now :P
[12:24:41] universa1: Syrit: already gave you one...
[12:24:47] Trudko: and if no how can i run easily method update in my MatchController for each Match object?
[12:24:55] universa1: Syrit: the solution is to write proper and valid html.
[12:25:18] universa1: Trudko: look at the touch method
[12:25:52] Syrit: oh, so <form></form> <form></form> is considered valid universa1 ? is that the solution ?
[12:27:16] universa1: Syrit: looks ok.
[12:27:31] Syrit: :) thanks, i will try that
[12:27:49] Syrit: thanks for not ignoring my noob questions universa1
[12:28:39] elaptics: Syrit: are you a noob to web development in general?
[12:28:56] Syrit: yes elaptics
[12:29:18] elaptics: Syrit: then it would be worth your while making sure you understand a little more about html itself
[12:29:42] Syrit: thanks for the advice elaptics , i will work on that.
[12:30:11] Syrit: i thought taht the basic knowledge of html that i already have will be enough , seems not
[12:30:53] Trudko: universa1: I am checking but I am not sure how does that help
[12:31:05] mklappstuhl: elaptics: thanks again for that hint before, refactored it all now and it works so much better - manchmal sieht man den wald vor lauter bäumen nicht...
[12:32:10] universa1: Trudko: Result.where(user_id: some_user_id).each{|m| m.touch} <-- iirc this should run the callbacks/your calculations
[12:32:39] elaptics: mklappstuhl: my german's pretty rusty - is that something about can't see the wood for the trees?
[12:32:49] mklappstuhl: elaptics: yes
[12:33:18] Syrit: it works universa1 !! now i need to handle the ajax success to close the dialoge ! thank a ton amigo !
[12:33:51] Trudko: universa1: so when I run m.touch is update method run in my MatchController ?
[12:35:20] pontiki: universa1: from api: Saves the record with the updated_at/on attributes set to the current time. Please note that no validation is performed and no callbacks are executed. If an attribute name is passed, that attribute is updated along with updated_at/on attributes.
[12:35:47] universa1: Trudko: it does not run any methods in your controller. the update logic should be in your model.
[12:35:53] Trudko: universa1: i am asking because I call my computation method from update(and create) function and thats where all computing happens
[12:35:55] universa1: pontiki: ok, then i remember incorrectly ;)
[12:36:04] helpa: Trudko: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[12:36:04] universa1: Trudko: !code
[12:36:08] pontiki: would be a pretty cool method if it did
[12:37:06] lieon: i am uploading images using js some times it is required refresh the page
[12:38:05] Trudko: universa1: i dont have code with me now, maybe this pseudo code could help http://pastie.org/8330053
[12:38:19] DaniG2k: guys where's the right place in my locales to put error messages like "1 error prevented this model from being saved"
[12:38:42] universa1: Trudko: that store_results method should be in the model, so you can call it easily...
[12:39:06] universa1: DaniG2k: look at the rails-i18n project on github, there should be some default translations for that iirc.
[12:39:22] DaniG2k: universa1: yeah i already have that
[12:39:36] Trudko: universa1: yeah that does make sense , that way i can even use rails console to simply iterate over matches and update each of them can't i?
[12:39:38] helpa: lieon: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[12:39:38] universa1: lieon: !code
[12:39:44] universa1: Trudko: yes.
[12:39:55] Trudko: universa1: ok great thank you
[12:39:56] universa1: Trudko: and having it in your model, makes it also way more easy to test it.
[12:40:13] Trudko: universa1: definitely
[12:40:52] universa1: DaniG2k: so? put it in errors.en.yml? is that your question?
[12:42:43] DaniG2k: universa1: hmm no actually i dont know what my question is since im a bit confused myself. I have rails-i18n installed, and it alrady includes translations for errors like "1 error prevented this model from being saved"
[12:42:54] DaniG2k: i just cant seem to understand why its not displaying for this particular model
[12:43:27] lieon: <universa1> https://gist.github.com/anonymous/6580217
[12:44:02] DaniG2k: all my other locales seem to be ok here
[12:44:16] msimkins: DaniG2k: Check the form definition, if its scaffolded it does not use the translation IIRC
[12:44:24] DaniG2k: I'll take a look
[12:44:54] elaptics: DaniG2k: http://guides.rubyonrails.org/i18n.html There's a section on the errors in it
[12:45:07] afrodiziak: how can i have gitignore but private only for me?
[12:45:11] elaptics: DaniG2k: section 5.1
[12:45:21] DaniG2k: I had it hardcoded
[12:45:46] msimkins: afrodiziak: ??
[12:46:19] afrodiziak: msimkins i mean i want to only make changes on some files locally and not track changes, but if i change gitignore everyone else get the same gitignore
[12:46:41] pontiki: afrodiziak: just keep a private branch
[12:46:49] pontiki: and never merge or push it
[12:46:54] msimkins: afrodiziak: Use a global gitignore on your box
[12:49:32] pontiki: if you go with the global ignore option, just make sure to don't put in patterns that might mask important files to track in any other project
[12:51:09] workmad3: afrodiziak: if the file is already in the git repo, a .gitignore does nothing btw
[12:51:20] universa1: lieon: i personally can't help, you probably should restate your question and include the gist and mention what you have in your browsers development console etc.. ...anyways why are you loading jquery inside your form?!
[12:54:24] afrodiziak: workmad3 i want to have my own gemfile for the time being (as i am on windows), what should i use to have this change private, .gitignore or something else?
[12:54:38] workmad3: afrodiziak: just don't commit changes to it
[12:54:46] elaptics: afrodiziak: your gemfile can have windows specific stuff in it
[12:55:04] workmad3: ^^ that too
[12:55:11] afrodiziak: workmad3 but its to dirty to pull and push with uncommitted file
[12:55:23] workmad3: afrodiziak: stash the file in order to push and pull
[12:55:27] elaptics: you can just stash it beforehand
[12:55:52] afrodiziak: workmad3 but its repetitive work, i need not for a short time but too make many changes adn keep this file
[12:56:19] workmad3: afrodiziak: sorry, those are your options I'm afraid
[12:56:38] elaptics: afrodiziak: what specifically do you want to do with the file? It's trivial to have a windows specific section in the gemfile as it's just a ruby file
[12:56:51] workmad3: afrodiziak: either rewrite the gemfile so it can be put into the git repo happily (with a windows specific section)
[12:57:11] workmad3: afrodiziak: or have a repetitive 'stash gemfile, git pull; unstash gemfile' workflow
[12:57:14] afrodiziak: workmad3 ok what is the windows specific section
[12:57:24] afrodiziak: i want to not use rubyracer on windows
[12:57:24] workmad3: afrodiziak: see elaptics
[12:57:35] workmad3: afrodiziak: also read the bundler manual
[12:58:01] workmad3: afrodiziak: we're here to point you in the right direction, not to do your googling for you :P
[12:58:14] DaniG2k: universa1: ok sorry so here's my question revisited: if I have all the translations provided by rails-18n for error messages, how can I display those errors without having to specify the exact problem? the messages can be either errors:template:body, errors:template:header:one or errors:template:header:other
[12:58:28] DaniG2k: this is when I display @object.errors.any?
[12:59:16] DaniG2k: devise seems to do this automatically
[12:59:17] msimkins: afrodiziak: You need to match the RUBY_PLATFORM against 'win32'
[12:59:30] DaniG2k: maybe i can steal devise's errors code :P
[12:59:34] universa1: DaniG2k: ? for the one / other it might be: t('errors.template.header', count: @object.errors.count)
[13:00:00] universa1: DaniG2k: since it's plain ruby you can ;)
[13:00:03] DaniG2k: universa1: the count will return one or other?
[13:00:14] workmad3: DaniG2k: yes
[13:00:23] universa1: DaniG2k: yeah, if you have one error it will use the one, in all other cases the other translation
[13:00:28] afrodiziak: msimkins this works as to match when it is not windows if RUBY_PLATFORM!=~ /win32/ ?
[13:00:45] universa1: DaniG2k: iirc it is fairly flexible, since different languages have weird pluralization rules ;)
[13:01:04] DaniG2k: aaah i see what devise is doing
[13:01:11] DaniG2k: universa1: https://github.com/plataformatec/devise/blob/master/app/helpers/devise_helper.rb
[13:01:23] DaniG2k: i might steal that
[13:01:47] afrodiziak: msimkins or it maybe even works like gem "therubyracer", :platforms => :ruby
[13:01:51] DaniG2k: alright lunch time :D
[13:01:53] DaniG2k: thanks guys
[13:01:55] universa1: DaniG2k: yeah, it's quite similar to what i proposed ;)
[13:02:03] universa1: DaniG2k: bon appetite :-)
[13:02:10] DaniG2k: universa1: merci
[13:02:41] msimkins: afrodiziak: do it like if RUBY_PLATFORM =~ /win32/ (then) Windows Specific Gems (else) non-windows gems
[13:03:21] afrodiziak: msimkins but i dont want to repeat all the gems, i just want to do if its on windows dont use this gem
[13:04:00] msimkins: afrodiziak: platfors => ruby does not always work, and if you have a dev environment,(cant remember if it is cygwin or mingw) it treats it as mri IIRC, and will try and install it
[13:08:38] msimkins: afrodiziak: :platforms => :ruby should be the closest not to install on Windows, but as I said above, its not guarenteed
[13:08:59] afrodiziak: msimkins this is not working, if RUBY_PLATFORM=~ /win32/ # does not need therubyracerelse gem 'therubyracer', :require => 'v8'end
[13:09:29] lieon: is there any gem to read the pdf file fields into form
[13:10:15] msimkins: afrodiziak: what happens if you type ruby -e 'puts RUBY_PLATFORM'
[13:10:34] afrodiziak: i386-mingw32
[13:11:26] msimkins: afrodiziak: so its a mingw ruby, which means it considers it 'mri' not 'mswin', so that hack will not work
[13:12:52] msimkins: afrodiziak: So it thinks its is a 'unix'-y ruby, not a windows ruby
[13:20:35] skroon: when I send XML to a controller, will it automatically get converted to a params hash?
[13:21:49] helpa: skroon: Why don't you try it and find out for yourself?
[13:21:49] universa1: skroon: !try
[13:24:54] gavit: is there a way to have changes to a form saved "on_edit" rather than waiting for the user to click on "save"/submit
[13:28:58] jan1337z: Question: I created models and set up the relations … how can I test if everything is set up right :)
[13:30:16] sevenseacat: test it in the console?
[13:30:39] jan1337z: everything separately?
[13:32:12] jan1337z: sevenseacat, I think writing tests is the right directions thanks
[13:32:19] msimkins: jan1337z: what is the definition of 'set up right'
[13:32:31] pipework: msimkins: None too unlike 'set up left'.
[13:32:40] msimkins: pipework: :)
[13:33:12] jan1337z: msimkins, maybe I misspelled something and so on
[13:33:13] sevenseacat: pipework: !!!!!!!!!!!!
[13:33:27] pipework: sevenseacat: Hello nautical feline.
[13:34:35] msimkins: jan1337z: so as sevenseacat said, right tests, check that all your validations work, RoR wont protect you from a field name typo :)
[13:34:46] msimkins: write tests even.... :(
[13:34:56] pipework: left tests. Left is better, as in being left-handed is better.
[13:35:06] universa1: gavit: iirc there was a railscast on that topic
[13:35:23] gavit: universa1: ryan bates railscast?
[13:35:33] universa1: pipework: no right tests is better, because it sounds like write tests!
[13:35:39] jan1337z: "the left hand is the hand of the devil" my mother
[13:35:42] universa1: gavit: yes, in place editing iirc
[13:35:55] pipework: universa1: Nobody wants to write tests. Fact.
[13:36:40] universa1: pipework: hmm, i actually do. because whenever i don't, it kills me later when i've to manually test stuff through again, and again
[13:36:48] gavit: universa1: cheers, found it
[13:37:44] pipework: universa1: I'd rather not write tests. I'd rather have tests that are so neat that they're happily left alone and always up to date.
[13:37:52] msimkins: universa1: pipework We are not allowed to release code unless it has a test suite :)
[13:37:56] pipework: Nobody wants to right or write tests.
[13:38:26] pipework: msimkins: We're joking around, sir. I, too, have a test suite for my code.
[13:39:20] pipework: It's a joke about lefties being cooler than righties.
[13:39:53] msimkins: pipework: Humpf :) (Im a rightie)
[13:40:02] pipework: My condolences!
[13:40:44] msimkins: (but I will happily lift a beer glass with both)
[13:45:24] BrazenBraden: little question regarding strong parameters and custom data.. http://hastebin.com/cerenereci.rb
[13:47:17] sevenseacat: wheres the question
[13:47:25] BrazenBraden: in the pastebin
[13:47:29] BrazenBraden: as a comment at teh top
[13:47:34] sevenseacat: none of that code is right
[13:47:39] sevenseacat: and there is no question there
[13:48:23] BrazenBraden: "Trying to add a new record where some information is provided by the form but there is some extra default information I want to add manually when creating the user. In this example, the manual (non-form related) data is 'is_active'"
[13:48:35] sevenseacat: yes, i read that.
[13:48:39] sevenseacat: so whats your question?
[13:49:02] BrazenBraden: how can i add custom data into a strong params (is it even possible)?
[13:50:16] sevenseacat: just merge it into the result you get from calling user_params (or user_params2 or whatever you want to call it)
[13:51:25] BrazenBraden: well, user_params1 and user_params2 are different
[13:51:49] BrazenBraden: one has the 'is_active' being manually set (attempting) while the other does not have it included in the strong params but tries in the action instead
[13:52:04] sevenseacat: *or whatever you want to call your method that permits params
[13:52:39] BrazenBraden: oh right.. well, user_params suits me just fine.. but how would i go about merging the params to my custom stuff i define in the controller?
[13:52:50] msimkins: mr_pause: Hello
[13:52:55] sevenseacat: you know strong parameters just returns you a wrapper around a hash ,right?
[13:53:24] mr_pause: I'm trying to debug a Rails application with a 'debugger' statement, but everytime it breaks inside some obscure ActiveRecord method, any ideas ?
[13:53:52] mr_pause: And there's no backtrace available everytime
[13:54:11] sevenseacat: BrazenBraden: well params have a hash format, and you're creating a 'sanitized' params that are filtered out of that hash
[13:54:59] BrazenBraden: ok... i know the params hash is full of all sorts of stuff. so the strong params just filters out what i want and discards the rest.
[13:56:35] BrazenBraden: so "User.create(user_params.merge!({pass: 'blah', age: '3'})) sorta thing?
[13:56:47] sevenseacat: merge, not merge!, but yeah
[13:57:10] BrazenBraden: doesnt merge make a copy while merge! replace the original variable?
[13:57:48] pipework: It doesn't replace a variable, it modifies the object rather than returning a new one.
[13:58:02] msimkins: mr_pause: Sorry, no, I have not used the debugger in a while
[13:58:08] sevenseacat: merge! will modify the original hash and return nil.
[13:58:32] mr_pause: Anyone else ? It's very hard/slow to debug stuff without a stinkin' debugger
[13:58:53] sevenseacat: mr_pause: is the debugger the last thing in your method/block/whatnot?
[13:58:59] sevenseacat: if so, stick something after it
[13:59:33] pipework: mr_pause: So use a debugger.
[14:00:06] mr_pause: sevenseacat: Nope
[14:00:32] mr_pause: pipework: Does not work as excepted, i put a breakpoint in toto.rb, it breaks in lib/activerecord/very/long/path/randomstuff.rb
[14:00:50] pipework: That means absolutely nothing to me.
[14:00:53] helpa: 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.
[14:03:38] mr_pause: http://pastebin.com/VXCjEVEz
[14:04:31] mr_pause: Here is enough data to see the problem
[14:04:36] BrazenBraden: thanks sevenseacat, works great.
[14:05:09] BrazenBraden: I wish I could just plug myself into the matrix and upload all this stuff straight into my head
[14:06:00] mr_pause: pipework: Any thoughts on this ?
[14:06:28] pipework: mr_pause: I have moral objections to looking at pastebins.
[14:07:07] mr_pause: http://pastie.org/8330254
[14:15:16] mr_pause: pipework: I linked a pastie =)
[14:15:47] pipework: mr_pause: Did you read the debugging guide?
[14:15:55] mr_pause: Which one ?
[14:16:13] pipework: http://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debugger-gem
[14:16:20] pipework: Did you notice how the prompt starts inside the User class?
[14:18:34] allaire: I need to show user data in the <title> of the page. By default it shows html entities if there's character like ' or <. Is sanitize() the best way to handle this case and secure enough?
[14:18:40] mr_pause: pipework: Sure, i got it it's debugging the next instruction
[14:18:45] mr_pause: How to avoid that ?
[14:18:55] pipework: mr_pause: Don't use the debugger?
[14:19:22] mr_pause: What if i want to ?
[14:19:27] mr_pause: What kind of answer is that
[14:19:47] pipework: mr_pause: A free one.
[14:19:53] mr_pause: A _dumb_ one
[14:20:08] pipework: You can write your own debugger or pull request a 'fix' to the current one.
[14:20:34] pipework: But the debugger currently works by dropping you into the next call.
[14:20:56] pipework: Use a different tool/debugger if you want something different.
[14:20:58] mr_pause: Wrong. I tried to use dummy instructions/calls, does not work
[14:21:08] mr_pause: All is see is a pile of shit worse than gdb
[14:21:11] mikecmpbll: allaire: .html_safe
[14:21:20] mr_pause: At least gdb works
[14:21:21] helpa: TROLL DETECTED!
[14:21:34] pipework: sevenseacat: Get the trollmat suits!
[14:22:01] sevenseacat: ACTION equips troll-retardant headband
[14:22:08] allaire: mikecmpbll:is not html_safe used in .raw, thus insecure?
[14:22:13] mr_pause: Not really a troll, using gdb you can add breakpoints where you want (not before a call or whatever), you can see the stack trace, etc
[14:22:36] mikecmpbll: allaire: then I didn't understand your question. what are you trying to output
[14:22:42] pipework: mr_pause: Lots of people use things like pry.
[14:22:52] pipework: Pry has lots of plugins.
[14:23:16] sevenseacat: mr_pause: you know how the first thing i said when you said you were having problems was to stick something after the 'debugger' line, like a 'true' or whatnot?
[14:23:32] mr_pause: sevenseacat: Already tried many times
[14:23:50] allaire: mikecmpbll: Something that wont html entities common character but won't let a big chunk if javascript execute ;)
[14:23:51] sevenseacat: so having a debugger land on the statement 'true' throws you deep into activerecord?
[14:23:59] mr_pause: Added dummy stuff like 'foo = 'bar'', does not work ,added a call, does not work
[14:24:09] mikecmpbll: allaire: escape_javascript()
[14:24:14] mr_pause: sevenseacat: It does not land on the statement but skips it somehow
[14:24:24] sevenseacat: 'does not work' is quite possibly the most useless error message ever
[14:24:28] pipework: mr_pause: The debugger drops into the next call, that's how it behaves. `debugger; true`
[14:24:34] clocKwize: guys, I've got a weird problem -- I'm using image_url("path") and locally its fine, but on my staging environment, which has a different asset host, its returning: http://myappherokuapp.comhttp://d3krnq7zmhkx8l.cloudfront.net/assets/aisle_placeholders/result/bakery-88beb3a7cc6b39fee7fc6a27b2d7c8ce.jpg
[14:24:41] mikecmpbll: allaire: oops ignore me
[14:24:54] clocKwize: e.g. its putting the main url in, as well as the asset host url
[14:25:01] senayar: image_path work better
[14:25:12] allaire: mikecmpbll: I think sanitize() can do what I want, just cant find the default whitelist
[14:25:32] mikecmpbll: allaire: you want to allow all html?
[14:25:40] jammanbo: What the hell is the path of that page in your app that shows your routes and config and stuff. Have been googling for 10 minutes and am in near blind rage at being unable to find it.
[14:25:53] allaire: mikecmpbll: not all
[14:25:58] clocKwize: senayar: yes but I need a full url
[14:26:06] helpa: jammanbo: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[14:26:06] pipework: jammanbo: !routing
[14:26:24] pipework: jammanbo: Oh you mean the default root page on a new project?
[14:26:26] mr_pause: sevenseacat: Well there's no error message, it's just debugging some ActiveRecord stuff
[14:26:28] mikecmpbll: allaire: you can pass tags and attributes to the sanitise helper
[14:26:29] senayar: image_tag so ?
[14:26:29] afrodiziak: is anyone using this https://github.com/amaia/rails-starter-box ?
[14:26:33] mikecmpbll: for whitelist
[14:26:38] mr_pause: Just look at this : http://pastie.org/8330283
[14:26:39] sevenseacat: mr_pause: so having a debugger land on the statement 'true' throws you deep into activerecord?
[14:26:44] allaire: mikecmpbll: Yeah, I'll go that route I think
[14:26:47] mikecmpbll: allaire: or set it application wide with config
[14:26:54] pontiki: afrodiziak: i use rails-app-composer, mostly
[14:27:07] allaire: mikecmpbll: do you know the default application wide config? couldnt find it
[14:27:07] jammanbo: the one that being with an _ or something, I think.
[14:27:24] pontiki: oh sorry, different application
[14:27:39] pontiki: i have my own startup rails dev box for vagrant use
[14:28:05] mikecmpbll: allaire: the default is none
[14:28:10] afrodiziak: i tried using this and ran vagrant up but it seems the installation didnt go through or something
[14:28:15] afrodiziak: rails -v doesnt do nothing
[14:28:20] afrodiziak: while ruby -v does
[14:28:32] senayar: or you can use url(#{asset_path('image.jpg')}) clocKwize ?
[14:29:21] clocKwize: surely that'll have the same effect? asset_path will return the full cloud front url, then url() will prepend the host..
[14:31:28] jammanbo: /rails/info/routes !!!!!
[14:31:35] jammanbo: omfg so angry
[14:32:37] jlebrech: i'm building an engine and i'm loading font-awesome into which is also an engine, is there something I should know? i'm including it in gemspec and in application.css in the gem. I've deleted the application.css in the dummy app.
[14:32:47] senayar: so all your assets are external clocKwize ?
[14:32:59] pontiki: jammanbo: how does that work?
[14:33:15] clocKwize: senayar: all assets are in cloud front, using asset_host
[14:33:43] jammanbo: pontiki: huh? <your development app>/rails/info/routes
[14:33:53] pontiki: doesn't work on mine...
[14:33:55] senayar: check your production.rb clocKwize
[14:33:59] senayar: http://stackoverflow.com/questions/11833488/rails-3-2-asset-host-setting-ignored
[14:34:57] jammanbo: pontiki: http://edgeguides.rubyonrails.org/routing.html#inspecting-and-testing-routes
[14:35:11] clocKwize: senayar: its not ignoring it, its returning 2 urls
[14:35:37] clocKwize: http://normalurl.comhttp://asset_host_url/#{image_path}
[14:35:45] clocKwize: which obviously are broken
[14:39:27] xeon: is using the DELETE HTTP verb a good idea? Some browsers(e.g. lynx) send GET request instead..
[14:40:54] clocKwize: senayar: see https://gist.github.com/brightbits/6581588
[14:42:43] jlebrech: so it loading an engine inside an engine possbile?
[14:44:34] mklappst_: anyone an explanation why links generated with url helpers in an email template could contain the http twice?
[14:44:55] senayar: clocKwize:
[14:44:57] senayar: https://devcenter.heroku.com/articles/cdn-asset-host-rails31
[14:45:37] senayar: url(<%= asset_path 'image.png' %> ?
[14:45:45] pipework: Forgot a paren.
[14:46:26] senayar: but it's strange that it's return both url :(
[14:47:38] Syrit: is there any way to use bootstrap 3 with simple_form ?
[14:49:04] Syrit: or at least make a select looks like bootstrap one :D
[14:50:17] senayar: http://stackoverflow.com/questions/18403372/using-simple-form-with-bootstrap-3
[14:51:41] gavit: http://www.w3schools.com/jquery/event_change.asp <-> http://pastie.org/private/zbltmd0zrhop2ruevqkww <- Can anyone explain SyntaxError: reserved word "function" on line 9?
[14:51:51] pipework: Ew w3 schools.
[14:51:56] Syrit: well , senayar , i know that this config.input_class = "form-control" should go into the bootstrap initializer, but i did not know where to stick it :D
[14:52:24] pipework: w3schools is bad, mkay. Use real documentation, not that crappy resource.
[14:53:27] gavit: pipework: http://api.jquery.com/change/ <- better? 2nd codeblock
[14:53:51] senayar: you write coffee or js ?
[14:54:16] pipework: gavit: Your tabs are fucked up
[14:54:40] pipework: gavit: js2coffee.org
[14:54:58] gavit: pipework: bah, didnt know coffeescript is whitespace sensitive
[14:55:13] senayar: https://gist.github.com/senayar/1b7e221e402ba7d8afbe
[14:55:22] pipework: gavit: You should probably read some gettingstarted docs on coffeescript,
[14:55:27] clocKwize: just had 2 hot girls come to my door to talk about switching broadband >.<
[14:55:42] Syrit: there is a great railscast about coffeescript
[14:55:47] pipework: clocKwize: Did you make a joke about panty/bra bands and wide and the such?
[14:56:48] clocKwize: when she told me my neighbours were complaining of slow speeds, I was tempted to agree and say my porn always keeps buffering and slowing me down
[14:58:06] gavit: senayar: aah, I noticed the -> thanks.
[15:05:13] crunch-choco: guys, are "tests" necessary? why do we not only test our application by refreshing the browser?
[15:05:47] pipework: crunch-choco: Do you value your time very highly?
[15:05:47] msimkins: crunch-choco: Yes they are
[15:06:12] pipework: If you have lots of time to burn and a penchant for repeating things manually, tests are not necessary at all.
[15:06:56] pipework: If you never change any code related to code you've already written in any way, shape, or form, then tests are not needed.
[15:07:21] workmad3: pipework: all my code is write-once!
[15:07:29] crunch-choco: oh yes i think i understand now :o
[15:07:44] omarqureshi: OHAI EVERYONE!
[15:07:46] pipework: omarqureshi: It's probably because you need jesus.
[15:07:53] msimkins: workmad3: Yuk - Java :)
[15:07:57] omarqureshi: what would jesus do?
[15:08:06] jstew: There are some "un-necessary" tests, IMHO. Like it { should belong_to() } and that sort of thing. That's just testing for testint's sake. I see a lot of it...
[15:08:12] workmad3: msimkins: more perl than java ;)
[15:08:14] mklappst_: anyone an explanation why links generated with url helpers in an email template could contain the http twice?
[15:08:14] epochwolf: omarqureshi: kick your ass.
[15:08:15] workmad3: msimkins: or erlang
[15:08:31] msimkins: workmad3: You are excused :)
[15:08:35] pipework: erlang is nice. :(
[15:09:04] pipework: It's so pretty and simple. :(
[15:09:07] jstew: Sleaping of erlang...Anyone have an opinion of Elixir?
[15:09:14] workmad3: pipework: it is :) it does lend itself to the 'write exactly what you need first time, install it on a server and then never touch it for 20 years' style though
[15:09:17] jstew: speaking of... :)
[15:09:45] pipework: workmad3: So it's enterprise style.
[15:09:55] pipework: The language was born in an enterprise environment.
[15:10:20] workmad3: pipework: it's probably more the ideal that enterprise 'architectures' have been trying (and failing) to reach for years
[15:10:31] workmad3: pipework: similar to language development and lisp
[15:10:56] jstew: clojure is nice. When it doesn't drive me mad.
[15:11:05] pipework: clojure is cool.
[15:12:52] jstew: It's hard to get your head around when you've been working with OOP for years. Really hard.
[15:14:35] bwwrd: hey guys, having problems trying to do a :price field, i keep getting a form error "invalid value".
[15:14:37] bwwrd: in the schema: t.decimal "price", :precision => 8, :scale => 2
[15:15:06] bwwrd: in the form: .field
[15:15:06] bwwrd: = f.label :price
[15:15:06] bwwrd: = f.number_field :price, placeholder: '123.00', step: 2
[15:15:14] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:15:43] bwwrd: shoot, sorry
[15:15:43] bwwrd: been a while
[15:16:57] msimkins: bwwrd: Why step:2 - You only want Integer Even Values :)
[15:17:23] bwwrd: i've just removed that, i wasn't sure what it did exactly
[15:18:57] jstew: bwwrd: Have you considered using the Money gem? It represents money in terms of currency and integer units rather than using floating point numbers.
[15:19:48] liquid-silence: anyone here know of a decent hash generation gem?
[15:19:51] bwwrd: gist: https://gist.github.com/benwoodward/d37580a6763bea3c5fc6
[15:19:54] liquid-silence: need to pass in a salt
[15:19:58] bwwrd: error http://cl.ly/image/0C2O0X2q0P1g
[15:19:58] liquid-silence: and randomize it
[15:20:36] mklappst_: argh there, is no way I'm going to solve this problem using google: https://www.google.de/search?q=duplicate+http+in+generated+links+rails&ie=utf-8&oe=utf-8&rls=org.mozilla:de:official&client=firefox-a&channel=fflb&gws_rd=cr&ei=byE3Uvq-EaeJ4gTwnYHYCQ#channel=fflb&q=duplicate+%22http:%2F%2F%22+within+generated+links+rails&rls=org.mozilla:de%3Aofficial
[15:20:39] bwwrd: jstew wasn't aware of that, i'll take a look. although seems like overkill for a simple column to display price
[15:21:03] liquid-silence: mklappst_ whats the issue
[15:22:39] mklappst_: liquid-silence: I generate a url in a plaintext mail using a model_url() link helper and it always has two leading "http://"
[15:22:42] jstew: bwwrd: It is overkill until you need to do math on the price. Then it's worth it.
[15:23:07] mikecmpbll: bwwrd: what's producing the invalid value popup?
[15:23:16] bwwrd: that is my question!
[15:23:20] bwwrd: can't make sense of it
[15:23:45] mikecmpbll: what browser you using? i've not seen that before.
[15:23:54] bwwrd: latest chrome
[15:23:59] bwwrd: lemme check in firefox
[15:24:03] msimkins: bwwrd: Try placeholder: 123.00 - It may be because you are tring a string placeholder
[15:24:17] bwwrd: ahh good call, 1s
[15:24:24] liquid-silence: mklappst_ pastebin your code
[15:24:43] mikecmpbll: bwwrd: stick the HTML in your gist, too
[15:24:58] mklappst_: liquid-silence: <%= spark_permalink_path(@recipient.profile_slug, @spark_item.id, :only_path => false) %>
[15:25:09] workmad3: msimkins: the attribute in HTML will be text, no matter what the ruby type is ;)
[15:25:10] mklappst_: liquid-silence: thats in a .text.erb file
[15:25:18] liquid-silence: whats the profile_slug code?
[15:25:44] mklappst_: liquid-silence: it's a route parameter. a string
[15:26:22] liquid-silence: mklappst_ without you gistin'g anything
[15:26:27] liquid-silence: I am not going to help
[15:26:29] workmad3: bwwrd: add 'step: "any" ' to your number_field options
[15:26:44] bwwrd: udpated https://gist.github.com/benwoodward/d37580a6763bea3c5fc6
[15:26:52] mklappst_: liquid-silence: what exactly do you want to see?
[15:27:16] workmad3: bwwrd: or 'step: 0.01'
[15:27:22] bwwrd: workmad3 that did it!!
[15:27:24] liquid-silence: what is that in the db
[15:27:25] bwwrd: thank yous
[15:27:39] liquid-silence: what is only_path do ?
[15:27:48] bwwrd: what will step: '0.01' do?
[15:27:51] liquid-silence: I cannot debug code without seeing it :)
[15:27:52] workmad3: bwwrd: nice little edges-case of the 'number' input-field type
[15:28:08] workmad3: bwwrd: the step value also determines valid values for the element
[15:28:18] msimkins: workmad3: edge cases are always the best :(
[15:28:31] pipework: Eigenbugs are annoying too!
[15:28:48] workmad3: bwwrd: step: '0.01' will make 12.01, 12.02, etc valid, but not 12.0003 ;)
[15:29:07] bwwrd: perfect. many thanks
[15:32:12] workmad3: liquid-silence: hi
[15:34:34] mklappst_: liquid-silence: :only_path is a documented option to route helpers that forces the helper to also add the env's host to the url
[15:34:56] liquid-silence: does that not add the http://?
[15:35:11] mklappst_: liquid-silence: it should add it but not twice
[15:35:41] mklappst_: liquid-silence: "http://http://so..." this is wrong
[15:36:04] liquid-silence: what happens if you set that to falce?
[15:37:05] mklappst_: set what to false?
[15:37:50] pipework: everything!
[15:38:06] mklappst_: pipework: oh, right. will try :o)
[15:38:13] liquid-silence: set this to true :only_path => false
[15:38:31] liquid-silence: I have not used the lib you are using, so I am shooting in the dark
[15:38:49] mklappst_: what lib are you talking about? this is all default rails..
[15:39:03] mklappst_: I cannot set that to true as I need the host in the email to allow people to click it...
[15:46:05] workmad3: mklappst_: what did you set your default url host to?
[15:46:26] mklappst_: workmad3: the domain without http like 'example.com'
[15:46:56] liquid-silence: spark_permalink_path != default rails
[15:47:30] workmad3: liquid-silence: it is if you have a spark_permalink route in your routes.rb
[15:47:47] liquid-silence: still not "default"
[15:48:08] workmad3: liquid-silence: 'default' rails does kinda include autogenerated path helpers
[15:48:15] workmad3: liquid-silence: it counts as out-the-box stuff
[15:48:48] workmad3: mklappst_: that said, why are you using spark_permalink_path with only_path: false, rather than spark_permalink_url ?
[15:49:32] mklappst_: workmad3: I tried both already, had the _url one first but that didn't work any better
[15:50:05] workmad3: mklappst_: the only time I've ever seen this behaviour is when the 'http://' is in the default host options :/
[15:50:24] mklappst_: workmad3: yeah, that was also my first thought but that's not the case unfortunately
[15:51:59] workmad3: mklappst_: care to gist your config, routes.rb and the template that's giving weird behaviour?
[15:52:20] cpruitt: Lets say I have a few regexs that I use for validations, say an email address or phone # regex. If I reuse them across models I don't want to repeat them. Where's the best place to put them in a rails app? Throw a module into /lib/ ? Add it to application.rb? (seems messy). Is this personal preference or is there a spot intended for this stuff?
[15:52:22] mklappst_: workmad3: oh, damnit. there was another place where someone overrid it with the http:// - urgh :D
[15:52:35] workmad3: mklappst_: aha :)
[15:52:41] mklappst_: just found that ack'ing the codebase ...
[15:53:25] workmad3: mklappst_: where was it hiding?
[15:53:30] mklappst_: workmad3: stuff like this just annoys the shit out of one
[15:54:15] mklappst_: some module included in the basemailer
[15:57:17] ShinySides: hey guys just wondering if there's a way to add an ID to the main stylesheet in rails when it goes in production
[15:58:14] mklappst_: ShinySides: what do you mean by id?
[15:58:22] mklappst_: like an additional selector?
[15:58:38] ShinySides: yes like this would be the css
[15:58:38] ShinySides: <link href="/assets/gallery_app.fb.css?body=1" id="main-css" media="screen" rel="stylesheet" type="text/css" />
[15:59:07] ShinySides: I'm just having issues showing a font on IE8 and they say that if you reload the stylesheet when the page has finished loading it should work
[15:59:11] ShinySides: so I just need to be able to do that
[16:00:42] mklappst_: ShinySides: why can't you add the id to always be there?
[16:01:09] ShinySides: I have tried but it shows up in dev enviroment, just when I set it in prod it's not there anymore
[16:01:50] mklappst_: ShinySides: we are talking about the html element that loads the stylesheed & that you want to add an ID to that element right?
[16:02:19] Guest80086: I have a user's location, and I want to show the 4 nearest 'venues'. I have a venues table with longitude/latitudes...suggestions/tips?
[16:03:49] mklappst_: ShinySides: doing something like this: <%= stylesheet_link_tag 'application', :id => 'test' %>
[16:03:52] mklappst_: works well for me
[16:04:21] ShinySides: ya that's what I have, but it's not showing when I set the enviroment to production
[16:05:45] mklappst_: ShinySides: can't imagine that this is caused by different envs but did you try plain html without the helper as a workaround?
[16:06:25] ShinySides: I just inherithed a rails project that I have to work on, let's say that things arent where they should be
[16:06:48] mklappst_: ShinySides: I'd try to ship around the link helper
[16:07:27] mklappst_: ShinySides: maybe it's overridden in ApplicationHelper or whatever that class is called...
[16:08:14] ShinySides: ya need to try some stuff :P
[16:10:22] whitsan: Trying to deploy with capistrano, getting "Gem::InstallError: activesupport requires Ruby version >= 1.9.3"
[16:10:38] whitsan: RVM is running both on local and remote, 1.9.3
[16:10:56] whitsan: Even set set :rvm_ruby_string, "ruby-1.9.3-p448" in deploy
[16:11:32] whitsan: Not sure what version is running when I deploy, but I can't figure it out
[16:11:39] whitsan: Any thoughts?
[16:15:12] honestly: can anyone point me to the specification of attributes_for?
[16:15:28] honestly: all google finds me is people having specific issues with it...
[16:15:39] jstew: honestly: api.rubyonrails.com
[16:16:23] jstew: Whoops, that should be .org. But you'll find everything about the Rails API there.
[16:18:57] bastilian: honestly: do you have a specific issue or just digging information?
[16:19:57] honestly: bastilian: I don't have a specific issue, I just want to know how it works and where it's defined
[16:20:13] honestly: I actually haven't found it in either the ror api now the ruby core docs
[16:22:57] bastilian: honestly: well, you will have to dig into rails source coude.
[16:22:59] honestly: hmm, it might be coming from rspec
[16:25:03] elux: has anyone else had issues with wrap_parameters on rails 3.2? for whatever reason, i can see for my json api, its setting the wrapped param to an empty hash .. but in my quick rails 4.0 example it works just fine
[16:31:42] jan1337z: Question: is it valid to have has_one relationship referencing nothing ?
[16:36:00] jan1337z: s answered my questions
[16:43:53] mello_: hi! so im using postgres and iv created a database and some tables but when trying to run the app i get the following error "Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue." when running the command in the error i get another error http://pastebay.net/1296490
[16:45:05] bastilian: mello_: did you create the tables in postgres rather then via migrations?
[16:45:29] mello_: bastilian: yes
[16:45:44] elaptics: mello_: why?
[16:46:15] bastilian: exactly. drop the tables in postgres and run the migrations instead.
[16:46:39] mello_: bastilian: but why cant you create it in postgres?
[16:46:52] elaptics: mello_: you can, but then you can't use migrations
[16:46:57] bastilian: it is not the "rails"-way
[16:47:31] mello_: bastilian: ok weird.. , thanx for the help will try it and see what happens
[16:47:40] elaptics: mello_: migrations are to help you manage database schema changes. You're not required to use them but you can't just mix and match
[16:48:08] mello_: the thing is i didnt run any migration so why is it asking me to do so?
[16:48:28] elaptics: mello_: because you apparently have migrations in your project
[16:48:39] elaptics: mello_: delete them if you're not actually using them
[16:56:24] s2013: mello_: can you paste your schema.rb ?
[16:56:39] s2013: mello_: go into rails console and type in ActiveRecord::Base.connection.tables
[16:56:42] s2013: paste what you see there
[16:57:17] mello_: s2013: command not found ?
[16:57:25] s2013: are you on rails console?
[16:57:34] s2013: for your project?
[17:01:39] youngman15: Hey, how do I return the value that occur the most in a column in my mysql database?
[17:02:12] youngman15: How do I do that in my models file?
[17:02:22] s2013: you mean like the mode?
[17:02:53] youngman15: s2013: u talking to me?
[17:03:05] s2013: not sure how to do it in rails but you can do a raw sql command
[17:03:22] youngman15: s2013: ok, what is the raw sql command?
[17:03:42] s2013: one sec let me google it to make sure i have it right
[17:03:56] s2013: SELECT value, COUNT(value) AS mode FROM table
[17:03:56] s2013: GROUP BY value ORDER BY mode DESC LIMIT 1;
[17:04:27] youngman15: I need to someway incorporate that into my models file.... and make a method out of it. thanks s2013
[17:05:18] elaptics: youngman15: just convert that into a set of AR calls in a class method
[17:05:40] youngman15: hmm ok let me try that s2013... and ok elaptics..hold on let me try that first!
[17:06:53] elaptics: youngman15: something like def foo; Model.select("foo, count(foo) as mode").group("value").order("mode desc").limit(1).first; end
[17:07:25] youngman15: s2013: is "value" my column name?
[17:07:54] youngman15: elaptics: thanks i'm going to try that! then i'll get back to you :)
[17:09:39] mello_: elaptics: so if i wanna create a table and some colums and use scaffolding then i need to create this in rails with migration?
[17:09:56] elaptics: mello_: it's a lot easier if you do
[17:10:07] elaptics: and quicker
[17:10:39] Guest80086: Does anyone have experience using the geocode gem?
[17:10:42] elaptics: especially if you're just scaffolding - though I don't recommend scaffolding as a new user, it helps if you understand what it's doing for you
[17:10:49] elaptics: Guest80086: some
[17:11:00] mello_: elaptics: would you mind showing me how to create a table and a few colums using migratiosn?
[17:11:11] Guest80086: elaptics, it is not very clear. I have a bunch of places with static locations that don't need to be changed
[17:11:19] Guest80086: would I after_create geocode it?
[17:11:30] Guest80086: I mean..I am seeding my database with these locations
[17:11:34] elaptics: mello_: http://guides.rubyonrails.org/migrations.html
[17:12:40] elaptics: Guest80086: does it matter, seeding the db is a one time thing so it's only going to do it once. Unless you don't want it to override the values you've already set in your seed data?
[17:14:00] Guest80086: elaptics, the seed data never changes. these are static locations that never need new data(bus stops)
[17:14:20] Guest80086: I want to be able to do Busstop.near(user's lat/long)
[17:14:34] neo7: hi, does anybody know that which code is called when we call manifest.compile(assets)
[17:14:37] elaptics: Guest80086: right. But have you already geocoded their locations?
[17:14:46] neo7: when calling from
[17:14:46] neo7: https://github.com/sstephenson/sprockets/blob/master/lib/rake/sprocketstask.rb
[17:14:49] elaptics: Guest80086: is that what you're seeding the lat/long?
[17:15:24] elaptics: Guest80086: I mean, are you asking how to avoid the seed data being geocoded because you've already done it?
[17:15:42] Guest80086: elaptics, pretty much. the lat/long yeah
[17:15:44] youngman15_: s2013: so my column name is "player_1_id", and has id's like (30, 24, 55, 2, 3, 43,......etc.) ... so to find the value that occurs the most I would do -> "SELECT player_1_id, COUNT(player_1_id) AS mode FROM StartingXi" ?
[17:15:51] s2013: sorry was on the phone
[17:15:58] s2013: did you try what elaptics said? that might work better
[17:16:15] Guest80086: elaptics, I think I need to look up what geocoding is exactly..because I already have the lat/long..does ruby-geocoder need the address or something?
[17:16:19] s2013: value is your column
[17:16:21] Guest80086: i don't think bus-stops have addresses
[17:16:25] neo7: If anyone, please help me navigate thought source code.
[17:16:26] youngman15_: ahh not yet..i was gonna try yours first.
[17:16:27] Guest80086: I want to compare by lat/long
[17:16:30] s2013: okay try it
[17:16:34] s2013: theoretically it should work
[17:16:40] youngman15_: ok..hold on :)
[17:16:46] liquid-silence: hmmm mac keyboards suck
[17:16:53] liquid-silence: I have not broken my " key :P
[17:17:08] elaptics: Guest80086: so if you're not adding new data you don't need the geocode gem to do geocoding for you, sounds like you just want the search part so you can just add geocoder to your model but don't have it geocode on create or anything
[17:17:22] elaptics: Guest80086: then you can use the Model.near, etc
[17:17:32] digital-ghost: Hey, does anyone know of a good info graphic representation of the Rails/ruby stack?
[17:17:36] Guest80086: elaptics, trying it out. thanks
[17:18:21] digital-ghost: I am trying to understand what Rails loads, in order from start to finish. Not sure what to search on it though.
[17:18:43] Guest80086: elaptics, Doesn't look like geocode has support for that though?
[17:18:45] digital-ghost: (i.e. config files, rails itself, gems, bundler?) Very new to it.
[17:19:41] Guest80086: elaptics, Nevermind! cheers.
[17:19:52] slash_nick: digital-ghost: http://guides.rubyonrails.org/initialization.html might be helpful
[17:20:32] digital-ghost: slash_nick: Yeah, that's a start for sure. I wish I could find a graphical representation >:(
[17:20:33] elaptics: Guest80086: sure it does. You just tell it which fields it should use to get the latitude and longitude if that's what you have
[17:21:06] elaptics: Guest80086: if it's lat/long then just use reverse_geocoded_by… don't specify anything to do the geocode (because you've already done it, effectively)
[17:21:48] elaptics: Guest80086: that's all you need to have the #near method, etc available in the model
[17:23:01] Guest80086: elaptics, thanks going to play around with it ^^
[17:33:16] youngman15: s2013: not sure if you saw this..my internet is bad.. but after I make this method: "StartingXi.select("foo, count(foo) as mode").group("player_1_id").order("mode desc").limit(1).first" how do I show that in my view file? Do i need to make changes in the controller as well?
[17:33:55] s2013: you declare it as a custom method in your model
[17:34:00] s2013: then you can just call it in the controller
[17:34:38] henn1nk: is there a way to use render_to_string in a model? need this for pdf generation..
[17:36:57] terrellt: henn1nk: Why is generating a PDF not a controller action? Seems like a PDF is a representation of a model, not something having to do with the model itself.
[17:37:24] henn1nk: terrellt: after saving a object, i would like to generate a pdf of its data and save this file
[17:38:48] youngman15_: s2013: what do you mean by that..? isnt "def foo" my custom model?
[17:39:09] codesoda: morning all
[17:39:44] s2013: youngman15: def foo is just an example
[17:39:57] s2013: in your model.rb you can have def getmode then paste that in
[17:41:25] youngman15_: ohhh i think i get it.
[17:50:31] s2013: ok let me know if it works
[17:52:07] youngman15: s2013: ok I have my custom model; def most_used; StartingXi.select("player_1_id, count(player_1_id) as mode").group("player_1_id").order("mode desc").limit(1).first; end
[17:52:54] youngman15: s2013:Now, in my view how do I get that result to show?
[17:53:11] s2013: you dont need StartingXi.select
[17:53:27] s2013: cause you are already in that model
[17:53:42] s2013: in your controller you do @players = StartingXi.most_used
[17:53:53] s2013: then in your views you can just output that <%= @players %> or whatever
[17:54:35] terrellt: I'm behind, but why is that not just a scope?
[17:54:56] terrellt: Ah, it's complicated.
[17:55:17] doug: a year ago, a rails guy was telling me that "getting into a state of flow during coding can actually be counter-productive"
[17:55:21] doug: where'd he get that from?
[17:56:20] terrellt: "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan
[17:56:39] youngman15: s2013: oh so where it says "StartingXi.select".. just erase that and keep the rest of the command?
[17:56:56] s2013: you can just remove StartingXi
[17:57:05] youngman15: gotcha...!! :)
[17:58:48] terrellt: (Make sure it's a class method.)
[17:59:07] s2013: yeah it is terrellt
[17:59:14] s2013: if you are talking to youngman15
[17:59:19] terrellt: I am indeed.
[18:00:39] youngman15: terrellt: yea?
[18:00:56] s2013: terrellt: by class method you mean a method in the mdoel class right?
[18:01:20] youngman15: Make sure its a class method?
[18:01:24] terrellt: I mean def self.most_used
[18:02:11] youngman15_: idk why my internet keeps going out!
[18:02:17] youngman15_: terrellt: what were you saying?
[18:02:59] terrellt: youngman15_: Just said make sure it's def self.most_used, so you can do StartingXi.most_used
[18:03:22] youngman15_: i didnt know that
[18:03:27] youngman15_: why does it have to be self?
[18:03:44] s2013: terrellt: i never use self.something if its in the model, it still works
[18:04:35] s2013: i got a question for professional rails developer. in an 8 hour day how many hours of work do yall actually do and how much of it is spend googling for methods and other rails stuff?
[18:04:59] terrellt: s2013: Um. Maybe 30 minutes?
[18:05:05] darrik: s2013: what is this 8 hour day thing?
[18:05:07] terrellt: Unless I need a new gem or something.
[18:05:30] s2013: and do you work 8 hours of the 8?
[18:07:14] terrellt: Of course? It's not always rails work - there are meetings and such.
[18:07:37] pskrz: youngman15_: http://www.railstips.org/blog/archives/2009/05/11/class-and-instance-methods-in-ruby/
[18:07:52] s2013: maybe cause i have seen way too many startups with more money than they know what to do with but hardly anyone works more than half of the time
[18:08:02] dbcclarke: s2013 and terrellt..its youngman15
[18:08:09] dbcclarke: i changed my nickname
[18:08:17] terrellt: [11:07] <pskrz> youngman15_: http://www.railstips.org/blog/archives/2009/05/11/class-and-instance-methods-in-ruby
[18:08:36] terrellt: s2013: I wouldn't know, I don't work for a startup.
[18:09:17] s2013: im thinking of looking for a job cause i figured id learn more on the job than by myself. i put up a resume last night and got calls from 30 recruiters, half of them arent even related to what im looking for
[18:09:58] Criten: s2013, where do you live?
[18:10:23] s2013: speak of the devil just another contacted me
[18:10:42] terrellt: That seems fishy.
[18:10:44] terrellt: Where'd you post?
[18:10:46] dbcclarke: hey I put my def self.most_used method in the model file...then in my controller file under the show action i put @players = StartingXi.most_used...and in the view I put %span 1. = @players...but its still blank when I reload my rails page
[18:10:49] ivanskie: hey guys.. i have a pretty dumb question i think
[18:10:57] ivanskie: i have this issue right now: https://github.com/volmer/bootsy/issues/7
[18:11:36] terrellt: ivanskie: That ticket has a solution. o.o
[18:11:36] ivanskie: and the question I have is how do I overwrite the css for that textfield of the bootsy, without affecting all the rest of textfields ?
[18:11:38] ryannielson: I have a model with two image fields using carrierwave. Is there a way to use carrierwave_direct to add the two image upload fields right in the model form so I can use it on a normal new/edit action? I can't find many resources on this.
[18:11:51] terrellt: ivanskie: Oh. CSS selectors - it should have a unique ID you can attach to.
[18:12:26] s2013: dice terrellt
[18:13:04] terrellt: Huh, haven't heard of that one.
[18:13:17] ivanskie: in that issue, author mentions that it inherits the css from the textfield css..,and the only unique identified i can see here is the wysihtml5-sandbox but its a class..
[18:13:26] Criten: Dice is pretty popular
[18:13:33] ivanskie: im not even sure where to find this code to just throw in a id..
[18:13:34] terrellt: ivanskie: Isn't it -your- textarea? Can't you give it an ID?
[18:14:16] ivanskie: in my _form.html.erb i have this : <%= f.input :description, as: :bootsy %>
[18:14:36] ivanskie: so bootsy, takes over the whole thing to include the wysiwyg editor, and then the iframe with the actual textfield..
[18:14:48] ivanskie: so i can't really just add the id field in the _form at least..
[18:15:07] terrellt: ivanskie: <%= f.input :description, as: :bootsy, id: "superawesometextarea" %>
[18:15:18] s2013: you never heard of dice terrellt ?
[18:15:23] terrellt: s2013: Nope.
[18:15:32] s2013: its like the biggest job site in tech
[18:15:34] s2013: or one of the atleast
[18:15:45] terrellt: Clearly out of the loop.
[18:15:47] s2013: terrellt: are you at OSU?
[18:15:52] s2013: do you go to school thre or work?
[18:17:10] terrellt: ACTION hates 1.9 hash syntax.
[18:18:08] dbcclarke: terrellt: if you wrote me something i didnt get it!!
[18:18:44] terrellt: [dbcclarke: 11:08] <terrellt> [11:07] <pskrz> youngman15_: http://www.railstips.org/blog/archives/2009/05/11/class-and-instance-methods-in-ruby
[18:18:49] ivanskie: yah no that doesnt work..
[18:18:50] terrellt: Let's see how deep we can go.
[18:18:54] sandstrom: I'm getting an error when minifying javascript assets [uglifyjs], `Unexpected token punc, expected punc`. The line/col is in application.js (i.e. after concatenation). Is there a way to access this intermediary concatenation file (since I can't look at my source).
[18:18:56] ivanskie: the id just kills bootsy
[18:19:15] terrellt: ivanskie: That's terrible. Can you set a class instead?
[18:21:38] neo7: Hi if anyone up can someone guide me through the rails code?
[18:21:41] ryannielson: I have a model with two image fields using carrierwave. Is there a way to use carrierwave_direct to add the two image upload fields right in the model form so I can use it on a normal new/edit action? I can't find many resources on this.
[18:21:57] ivanskie: im doing something wrong now..
[18:22:14] ivanskie: im adding textfield { height: 350px; width: 650px; } to the bootstrap_and_overrides
[18:22:20] ivanskie: and its not doing anything
[18:23:43] [MAN]: hey guys how to detect is it ruby site http://torrent-scan.org or not ?
[18:23:51] ivanskie: ok i fixed it
[18:25:50] sandstrom: [MAN]: buildwith.com
[18:26:02] sandstrom: [MAN]: builtwith.com (or a similar name)
[18:26:10] [MAN]: The domain buildwith.com is listed for sale.
[18:26:37] [MAN]: second one seems work
[18:27:29] s2013: what do you guys use to generate sitemap?
[18:27:49] [MAN]: sandstorm, awesome tool
[18:28:13] [MAN]: but I don't see ROR in results :(
[18:30:00] wmoxam: neo7: what do you want to know?
[18:31:44] ivanskie: damn i cant get resize:both to work
[18:33:06] neo7: wmoxam: I am trying to find the flow of code in https://github.com/rails/sprockets-rails/blob/ce61f70669e105d56b65d180cfdc9338b1757577/lib/sprockets/rails/task.rb What happens in manifest.compile(asset) where can I find the source code. )
[18:35:42] neo7: wmoxam: I am trying to dig deeper into how the the Asset pipelining happens.
[18:35:46] banas: I have been doing some rails work for a while, and now want to spend some time on JS related stuff. All those small animations, UI enhancements etc. I know nothing about JS. What resources/technology do you recommend I look at to be able to build decent UI for web apps?
[18:36:15] s2013: banas: learn basic javascript first then move into jquery
[18:36:24] s2013: a good book is js & jquery: the missing manual
[18:36:31] s2013: if you want more indepth then get JS the definitive guide
[18:37:17] banas: s2013: Do you recommend I read the full book, or just specific concepts? Does doing just codecademy javascript help?
[18:37:49] s2013: codeacademy js is just basic stuff as far as i know. i havent done that but obviously the more you read the better it is. that book is pretty good you can probably get most of it done in a week
[18:37:54] boytoy_: banas: you could always skip all that and immediately start building your dream app
[18:38:04] boytoy_: learn while doing or whatever they call it
[18:38:28] banas: s2013: cool, advice taken! thanks :)
[18:38:56] banas: boytoy_: I actually have built a good part of the app with rails, but I want to enhance the look and feel :)
[18:39:04] s2013: js is easy to get started with imo cause you see the effects far quicker
[18:39:07] boytoy_: banas: sweet :p
[18:39:09] s2013: but js is also a very intricate language
[18:39:35] s2013: ive done js for many years although im rusty now but yeah. back when i started js was looked at as like the devils language cause it was associated with spam and alert boxes and stuff
[18:39:41] boytoy_: why would one wanna learn js first and then jquery? when jquery is so much simpler than js?
[18:39:55] s2013: because jquery is based on js
[18:40:00] boytoy_: thats like learning quantum physics before learning algebra c'mon!
[18:40:04] s2013: same reason you need to have a foundation in ruby before moving into rails
[18:40:43] s2013: you dont need to be an expert in js to go into jquery but having a foundation in js definitely helps
[18:41:05] s2013: banas: also look into angularjs after js/jquery
[18:41:40] banas: how does angular js figure in the scheme of things? where exactly do i make use of it?
[18:41:47] banas: just curios
[18:41:58] s2013: angular can be best used for single page applications
[18:42:01] s2013: same with backbone.js
[18:42:07] Criten: and ember.js
[18:42:13] s2013: ember too but i have no experience with ember
[18:42:17] s2013: and knockout i guess
[18:42:22] Criten: There are a bunch
[18:42:44] s2013: i did backbone for a bit i liked it and then angular for a bit more and i loved it
[18:42:49] s2013: but i havent been able to use them too much
[18:42:56] Criten: backbone -> angular -> ember in terms of how much they do for you
[18:44:43] neo7: wmoxam: I have found it. Please don't spend more time on that.
[18:44:51] neo7: its in manifest.rb file.
[18:45:04] neo7: https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/manifest.rb
[18:46:05] banas: hmm, looks like i should start with js next weekend :) could you tell me some examples of popular single page web apps? i mean why single page web apps?
[18:47:01] s2013: single page apps like http://onepagelove.com/gallery/application
[18:47:04] s2013: some examples
[18:48:45] banas: thanks, lemme research about js for a while! :)
[18:48:51] s2013: np. good luck
[18:50:51] whitsan: Capistrano deployment is giving me Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
[18:51:39] whitsan: When I log on to the server, and run: rvm list, I get => ruby-1.9.3-p448
[18:51:56] terrellt: cap shell and then try ruby --version?
[18:52:29] whitsan: Well I'll be. ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
[18:52:50] whitsan: So that version doesn't appear in in my rvm list when I log onto the server directly
[18:53:00] whitsan: Same username and pass for the SSH
[18:54:07] terrellt: whitsan: Capistrano's not using RVM - which ruby probably returns /usr something.
[18:54:41] whitsan: How do I fix that? deploy.rb has require 'rvm/capistrano'
[18:55:53] terrellt: whitsan: Did you add rvm_ruby_string and rvm_type?
[18:56:01] whitsan: set :rvm_ruby_string, "ruby-1.9.3-p448"
[18:56:18] terrellt: before 'deploy:setup', 'deploy:set_rvm_version' <-- That maybe?
[18:57:47] whitsan: and set :rvm_type, :user
[18:58:03] terrellt: If you did all that, I dunno.
[18:59:25] terrellt: The deploy where I use RVM I use system RVM, so I dunno if there's something weird about that.
[19:00:06] whitsan: I'm deploying to ubuntu, so I follow the directions to reinstall RVM
[19:00:30] whitsan: Where is 1.8.7 coming from?
[19:00:39] terrellt: System ruby.
[19:03:14] whitsan: Alright, let's back up.
[19:03:26] whitsan: If you were installing this from scratch on a fresh ubuntu install
[19:03:44] whitsan: Would you reinstall the RVM?
[19:03:59] terrellt: I'd probably use rbenv, but just because I've found it easier to deal with.
[19:04:04] terrellt: For production machines*
[19:04:21] terrellt: On production RVM machines I usually use system RVM.
[19:04:25] ryannielson: I have a model with two image fields using carrierwave. Is there a way to use carrierwave_direct to add the two image upload fields right in the model form so I can use it on a normal new/edit action? I can't find many resources on this.
[19:06:11] codesoda: What do you guys (maybe girls?) prefer to do for default values on models, default values on database tables or setting values in before_create?
[19:06:25] terrellt: codesoda: I usually do default values in the database.
[19:06:46] Zesty: I have a folder in /assets called 'semantic-ui'. It contains an awful lot of css/js/images, so instead of breaking them out separately, i want to just put 'semantic-ui' in 'assets', and leave it at that. From inside my application.css.scss I'm trying to do @import 'semantic-ui/forms' but it cannot find it in the root path there. what would I have to do?
[19:08:04] codesoda: okay, i like to use the model, as its clear then when I'm in the model, that this is what happens. I just like my code to remain in control, as opposed to having things at the database level, almost like the whole stored procedure debate, anyone else?
[19:08:24] dbcclarke: terrellt: can you help me out? I can't seem to get my view file to display anything. here is my gist
[19:08:27] dbcclarke: https://gist.github.com/dbcclarke/c8be09bc86d6c19b4057
[19:14:14] platzhirsch: If I have an administration path for scheduling computation jobs, is there a restful path for it
[19:21:56] yaymukund: using mongoid, is there a way to see how a field is serialized in a db once I've `.save`d it?
[19:22:09] yaymukund: from rails console, I mean. I realize I could connect to mongo directly
[19:28:59] liquid-silence: anyone here know why send_file, will not allow me to scrub on a html 5 video tag?
[19:34:32] blob4000: hey all. in Rails 4, any controller that i create from scaffolding has a before_action filter at the top, and even though it seems to only be configured to call before these four actions (show, edit, update, destory), it seems to get called for all other controller actions that i define below. Code is: before_action :set_visitor, only: [:show, :edit, :update, :destroy]
[19:40:25] blob4000: figured it out, just had the wrong order of things in routes.rb
[19:40:58] nikeita: hello have a question for you. I'm still studing rails by porting a complete legacy app from desktop to web. i'm making progress but i'm stuck to implement such classic feature of a desktop app. Fill a form where one field need to be lookup from a big collection. Html select/option seems a no-go solution because of huge collection of elements. What is best practices to solve this simple(?) type of feature in Rails. Any help or documentation, link etc
[19:40:58] nikeita: is greatly appreciated.
[19:44:27] jstew: nikeita: I would look into jquery ui autocomplete. I think it would be a nice fit for your problem.
[19:44:49] jstew: nikeita: It's not that easy to use for a bgeinner but there are lots of tutorials about how to use it
[19:47:22] elaptics: nikeita: or there is select2
[19:47:56] elaptics: nikeita: http://ivaynberg.github.io/select2/
[19:48:21] elaptics: nikeita: haven't watched this myself but may be helpful http://blog.teamtreehouse.com/using-select2-with-ruby-on-rails-treehouse-quick-tip
[19:48:37] gavit: https://gist.github.com/gavit/4c93e30bf8a1f85a190d <- how do I pass the employee instance variable to my method/class
[19:48:48] nikeita: thanks jstew, this solution is for an inline search during form filling. This is better and easy of a two pages approach like a popop for search and browsing elements?
[19:49:17] nikeita: i meant easy implementation
[19:49:43] elaptics: nikeita: here's another alternative using jquery tokeninput http://railscasts.com/episodes/258-token-fields-revised
[19:50:50] antoineroquentin: hello, i am new to RoR and want to practice using Google Maps. I've done some searching and came upon 'gmaps4rails', but wanted some other suggestions. thank you.
[19:51:02] elaptics: gavit: simplest way is to define a setter method in that class that takes the employee and then use it within the class however you like
[19:51:02] nikeita: thx elaptics, a two page solution in doable? or it is more hard to implement.
[19:51:57] liquid-silence: why is rails not allowing me to fast forward and rewind video's with send_file?
[19:52:07] elaptics: nikeita: it's certainly do-able, probably more work to implement - depends on your javascript skills probably. I'd go with one of these autocomplete things. Personally I think it's a better ui too
[19:52:21] elaptics: liquid-silence: ??
[19:52:55] liquid-silence: I have the source of my video tag pointing to my stream method, it does send_file .....
[19:53:01] liquid-silence: but the controls don't mean anything
[19:53:06] liquid-silence: the video plays atleast
[19:53:41] ryanf: does anyone know if there's a way to use scopes to define an association in rails 3.2?
[19:53:57] liquid-silence: I think its a development environment issue
[19:54:14] nikeita: elaptics, in the case of two page approach how to pass selected item back and forth from the page/popup and the form itself? only with JS?
[19:54:20] bratsche: ryanf: That doesn't really make much sense.
[19:54:30] ryanf: I know, I was trying to find a better way of wording it concisely
[19:54:48] ryannielson: I have a model with two image fields using carrierwave. Is there a way to use carrierwave_direct to add the two image upload fields right in the model form so I can use it on a normal new/edit action? I can't find many resources on this.
[19:54:57] ryanf: in rails 3.2 there's a :conditions option for associations that lets you pass in sql to filter the associated records by
[19:55:25] ryanf: and afaict in rails 4 you can pass a proc and call arbitrary query/scope methods in the proc to filter the associated records
[19:55:27] elaptics: nikeita: as far as I know that would be the way - not something I've tried personally
[19:55:50] nikeita: elaptics, great thanks.
[19:55:52] ryanf: but I'm not sure if there's a workaround to achieve rails 4-like behavior in rails 3.2 w/r/t being able to use arbitrary arel methods to filter the association query
[19:55:57] ryanf: does that make more sense?
[19:56:32] elaptics: ryanf: have you just tried using a scope in rails 3.2 in the association?
[19:57:05] ryanf: there's no :scope option, you can't pass a proc after the options hash, and the association guide for 3.2 doesn't mention scopes or procs anywhere
[19:57:11] ryanf: whereas the guide for 4 does
[19:57:14] ryanf: so I'm pretty sure that's not a thing
[19:57:59] ryanf: passing a relation into :conditions also doesn't work
[19:58:16] ryanf: calling to_sql on a relation doesn't work because it returns the whole query instead of just the where part
[19:58:16] elaptics: ryanf: you're probably right, but I've never tried…I guess it's too naive to just try called to_sql on it in the conditions?
[19:58:47] elaptics: ryanf: sounds like the answer's no for rails 3.2 then :)
[19:59:36] ryanf: yeah, I guess so. it might not be that hard to write an extension for relation that generates just the where part as sql, but I'm not sure I want to go there :(
[20:02:07] digital-ghost: skip_before_filter :authenticate_user! <-- what is this bang doing here?
[20:02:31] darrik: digital-ghost: that is part of the method name
[20:02:51] ryannielson: digital-ghost: It's just the method name, you can have characters like ? and ! in ruby method names
[20:02:55] digital-ghost: darrik, so I've seen the ! operator used as "not some_var"
[20:03:22] digital-ghost: ryannielson: No functional capacity to it?
[20:03:25] darrik: digital-ghost: that use of the not operator is correct, but in this context that is just another character in the method name and not an operator
[20:03:27] ryannielson: digital-ghost: Ya, it's unrelated to that. That's the negation operator, the other is just a character in a method.
[20:03:44] digital-ghost: I remember seeing something in Ruby where if a "!" was used in some context, it modified the root array or hash it was being called on.
[20:03:50] digital-ghost: I can't ever seem to commit that to memory however.
[20:04:01] ryannielson: digital-ghost: There are some standards people like to follow like with a ! it modifies the calling object and without doesn't, but that's not set in stone and depends on the author or context.
[20:04:57] digital-ghost: What would an instance of that be? Like how do you tell the difference between when that context occurs and it being used in a method name?
[20:05:51] elaptics: digital-ghost: generally by reading the documentation
[20:06:03] digital-ghost: If I had set alphabet = ['a','b','c'], then called alphabet.capitalize! -- I expect that to then make alphabet capitalize all of it's contents that are strings.
[20:07:02] darrik: digital-ghost: understand that in that context the ! is just another character in the method name (it could just as easily be capitalizeD), and the implementation depends entirely on the method source with no relation to the name of the method
[20:07:06] elaptics: digital-ghost: well in this case capitalize! isn't a method on arrays
[20:07:18] sarmiena_: how can i achieve transactional rspec tests for multiple databases? i have 2 databases, but transactions only work on one.
[20:07:49] digital-ghost: elaptics, what if it were alphabet.to_s.capitalize! ?
[20:08:04] digital-ghost: Was just a tossed out example, I understand it's meant for a string class.
[20:08:39] pskrz: alphabet.map! { |letter| letter.capitalize }
[20:08:50] sarmiena_: i got second connection by using this mixing: http://hastebin.com/vosifegoji.rb
[20:09:25] elaptics: digital-ghost: well if you did "foo".capitalize! it would capitalize the string you called it on, "foo".capitalize would return a different string object that has been capitalized, the original "foo" string would be untouched
[20:09:48] digital-ghost: elaptics: right.
[20:09:56] darrik: digital-ghost: you're focusing on the ! and it is irrelevant to your question. typical convention is that a method ending with ! either modifies the object it is called on or raises an exception on failure, but this is not forcibly guaranteed by the language
[20:09:58] elaptics: digital-ghost: either way, you'd need to read the (ruby docs) in this case to know what was going to happen
[20:11:00] digital-ghost: darrik: knowing how to identify that is really what I was looking for. it becomes unclear each time I run into it.
[20:11:18] digital-ghost: not that the code itself is unclear, but seeing different uses of the operator
[20:11:39] darrik: digital-ghost: in the case of it coming at the end of a method name, it is not an operator, just a character
[20:12:01] digital-ghost: darrik: got it.
[20:12:15] elaptics: digital-ghost: just think of it as ruby being more expressive in your method names
[20:12:36] darrik: or adding confusion, depending on your perspective :)
[20:15:30] s2013_: anyone uses sitemap_generator gem? if so, did you get it to work with heroku and how do you extract the gzip file?
[20:20:36] whitsan: When I deploy with capistrano, I get ruby-1.9.3-p448 is not installed
[20:20:43] whitsan: To install do: 'rvm install ruby-1.9.3-p448'
[20:21:20] whitsan: So then I do: cap shell, and then rvm install ruby-1.9.3-p448
[20:21:32] whitsan: Same exact error
[20:21:38] whitsan: ruby-1.9.3-p448 is not installed
[20:21:49] whitsan: To install do: 'rvm install ruby-1.9.3-p448'
[20:22:17] whitsan: How do I install rvm globally?
[20:22:30] elaptics: whitsan: follow the instructions on rvm.io
[20:30:35] rdev5: anyone here have experience with dealing with sql smuggling? prevention or otherwise
[20:31:20] omarqureshi: sql smuggling?
[20:31:34] rdev5: http://www.comsecglobal.com/FrameWork/Upload/SQL_Smuggling.pdf
[20:33:33] whitsan: my deployed application is getting "Could not find rake-10.1.0"
[20:33:34] cek: i'd like to capture a bit of haml and then insert that into following :javascript filter. how do i do that? is there any actionview helper?
[20:33:38] s2013_: whats the best way to setup fog environment variables?
[20:34:00] whitsan: but when I cap shell > gem list, there it is: rake (10.1.0)
[20:34:29] rdev5: omarqureshi: relevant?
[20:34:46] elaptics: cek: check the haml docs ..iirc it's called capture_haml_tag or similar
[20:35:09] gwillen: rdev5: this seems like the sort of thing that has to be solved at the database / framework level
[20:35:33] gwillen: rdev5: as long as you're using the appropriate tools in the framework, i.e. Rails, you're probably covered
[20:35:43] elaptics: that paper is like 5 years old and I've never even heard the term before now
[20:35:50] rdev5: which is scary ^
[20:35:52] omarqureshi: err no, hes not covered
[20:36:07] gwillen: elaptics: I hadn't either, but I think the term 'smuggling' makes sense for the analogous HTTP attack they mention
[20:36:20] rdev5: I dug up the article researching cookie based sql injection attacks
[20:36:22] gwillen: elaptics: the opportunities to perform it against SQL are very limited, though
[20:36:28] omarqureshi: he's covered if the database doesnt support character translation, for example
[20:36:28] gwillen: I suspect they won't last long, if they still even exist
[20:36:53] gwillen: omarqureshi: there's no way to solve this at the application, level, though. I'd say it's the responsibility of Rails to solve it at the framework level.
[20:37:03] omarqureshi: its not Rails' responsibility
[20:37:10] gwillen: omarqureshi: so either Rails is already covered, or else there will be an attack and it will make Slashdot, and then it will be covered.
[20:37:11] omarqureshi: its the databases responsiblity
[20:37:18] rdev5: well the part about database engines doing more than just text parsing, but also additional internal logic I would think is characteristic of any db engine that could be susceptible
[20:37:39] rdev5: so there would be nothing that could be done at an app level?
[20:37:43] gwillen: I agree it would be good if databases didn't do that
[20:37:49] omarqureshi: infact, this is the problem - Rails doesnt know what is valid or not
[20:37:50] gwillen: hopefully after this paper they stopped
[20:38:31] gwillen: rdev5: if you were paranoid (i.e. you're writing a banking app, or nuclear plant management, or something) you could do paranoid things (you could filter unicode out of user input before feeding it to the database)
[20:38:41] gwillen: rdev5: but you probably don't need to be that paranoid
[20:39:04] rdev5: I'm getting fairly close to enterprise, so I at least want to concern myself with these possibilities
[20:39:04] omarqureshi: or just make your database support unicode
[20:39:22] omarqureshi: if you are using MySQL this may be tricky
[20:39:25] gwillen: rdev5: I think the main thing I'd do in your position is check that your database doesn't do any of these things
[20:39:28] rdev5: Microsoft SQL Server
[20:39:31] rdev5: and Oracle
[20:39:33] omarqureshi: since for some stupid bullshit reason it defaults to Latin-1
[20:40:22] kara_sweets: thinking about open sourcing boilerplate rails server / iOS client for people who want to build iOS apps w/ a Rails API. Anybody interested?
[20:41:43] rdev5: and the room goes dead as we all gaze at this ginormous elephant in the room..."that is one big elephant"
[20:42:12] omarqureshi: yeah, i cant comment on Microsoft SQL server or Oracle
[20:42:20] omarqureshi: this is why you pay them for support, i guess?
[20:42:30] omarqureshi: Rails cannot and will not help you here.
[20:42:45] rdev5: for them to tell me what I already know? :P which is little so far
[20:43:06] gwillen: well, the other attack (exploiting database specific quote characters) is something rails can mitigate with appropriate escaping
[20:43:13] gwillen: the unicode one, well, databases shouldn't really be doing that
[20:43:21] omarqureshi: really shouldnt
[20:44:47] omarqureshi: anyway why the fuck do you pay for BOTH MSSQL and Oracle?
[20:44:51] omarqureshi: that sounds batshit insane
[20:45:21] omarqureshi: i think we got trolled.
[20:47:23] jstew: Or he has a crazy ass IT team. I've seen it happen. They create ridiculous requirements based upon false assumptions.
[20:48:13] omarqureshi: a crazy ass IT team would never agree to MSSQL and Oracle
[20:48:22] omarqureshi: the key word is "and"
[20:48:41] omarqureshi: you stick to one ridiculously expensive database at a time
[20:49:23] jstew: You have a point. Who could afford both? That's insane.
[20:49:49] omarqureshi: its not so much who could afford both, you just dont have DBAs trained up on both
[20:50:53] jtperreault: you gotta pay for those certs after all :p
[20:55:03] marcanuy: anyone can help me with this error when executing bundle update? (nokogiri) http://paste.org/67365
[20:55:46] marcanuy: using Ubuntu 12.10
[20:55:52] omarqureshi: marcanuy: how did you install ruby?
[20:56:23] omarqureshi: i assume it was "apt-get install ruby" right?
[20:56:39] omarqureshi: you have two options ...
[20:56:56] omarqureshi: http://blog.brightbox.co.uk/posts/next-generation-ruby-packages-for-ubuntu or something like rvm/rbenv
[20:57:05] marcanuy: omarqureshi: yes, and sudo apt-get install rails3
[20:57:13] omarqureshi: noooooooooooo
[20:57:31] omarqureshi: http://www.youtube.com/watch?v=WWaLxFIVX1s
[20:57:55] omarqureshi: unfortunately, we do a really shit job of telling you how to install ruby
[20:57:57] helpa: Ruby, don't take your love to town!
[20:58:02] omarqureshi: fuck you helpa
[20:58:12] no0p: if you are going to have multiple layouts with different root application.css files, does that mean you drop the require_tree . directory in the pipeline?
[20:58:34] marcanuy: didn't get it..
[20:58:38] helpa: Ubuntu Ruby, Rails and RVM setup guide: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/ - Guaranteed to work 100% of the time or your money back!
[20:58:39] helpa: marcanuy: Ubuntu Ruby, Rails and RVM setup guide: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/ - Guaranteed to work 100% of the time or your money back!
[20:58:39] waseem_: marcanuy: !ubuntu
[20:58:51] helpa: omarqureshi: ヘᶘ ᵒᴥᵒᶅノ\ᶘᵒᴥᵒ ᶅ
[20:58:51] waseem_: omarqureshi: !highfive
[20:59:24] omarqureshi: seriously though
[20:59:29] omarqureshi: why is installing ruby so shit?
[21:00:21] omarqureshi: i mean python doesnt have this problem
[21:00:23] waseem_: Is it only me or RVM seems too bloated than chruby?
[21:00:25] omarqureshi: it has other problems, sure
[21:00:35] omarqureshi: yeah ... i dont use either waseem_
[21:00:36] brownies: rbenv install <version> ?
[21:00:44] brownies: doesn't seem that hard.
[21:00:52] waseem_: omarqureshi: Don't you work with multiple versions?
[21:00:54] omarqureshi: brownies: you have to know about rbenv
[21:01:01] omarqureshi: waseem_: ruby-switch handles that for me
[21:01:02] brownies: yes, it helps to know things.
[21:01:07] brownies: this is true.
[21:01:27] omarqureshi: ruby-switch 1.9.1 gets 1.9.3 going
[21:01:34] omarqureshi: because that makes sense.
[21:01:35] waseem_: omarqureshi: I've never heard about it. Google does not return sensible results.
[21:01:58] omarqureshi: http://packages.debian.org/sid/ruby-switch
[21:01:58] jstew: i use rbenv. Works great for me.
[21:02:10] omarqureshi: part of the brightbox stuff waseem_
[21:02:45] marcanuy: thanks omarqureshi waseem_ , will follow the guide
[21:02:47] waseem_: omarqureshi: That sounds good for server deployments.
[21:02:53] omarqureshi: its very good waseem_
[21:02:54] jstew: What does python do differently? I've had the same issues with versions of packages and had to install virtualenv.
[21:03:00] omarqureshi: on my mac, unfortunately im using rvm
[21:03:22] omarqureshi: jstew: a lot of stuff still runs on 2.7
[21:03:32] omarqureshi: and people still dont really give a shit about 3.0
[21:04:17] omarqureshi: maybe im just an old fucker, but, shit should just work sometimes
[21:05:00] omarqureshi: anyway, back to something i know nothing about
[21:05:40] jstew: Python dev seems to move a LOT slower than Ruby dev. Perhaps it's because they care more about not breaking things.
[21:08:24] fuzzyhorns: state_machine or classy_enum?
[21:12:10] fuzzyhorns: http://www.seejohncode.com/2011/02/18/enums-with-rails/
[21:16:39] fuzzyhorns: classy_enum vs state_machine?
[21:36:23] bricker: Okay, am I forgetting something, or should `extend ActiveSupport::Concern` in a module be enough to get the ClassMethods module automatically extended into any base module?
[21:37:58] tubbo: really stupid feature idea #8493 - logger.error_message_for_exception(exception)
[21:38:13] tubbo: it basically does logger.error exception.message; logger.error exception.backtrace.join("\n")
[21:38:32] tubbo: i find myself doing this *all* the time in rescue blocks where i don't want exceptions to block the flow of the app, but i'd still like to see errors when they do occur.
[21:46:20] slash_nick: tubbo: here, here
[21:55:24] DaniG2k: guys i have this code that is using some coffeescript/jquery: https://gist.github.com/DaniG2k/6587123
[21:55:53] DaniG2k: I'd like for the fields in educational experiences to be pre-populated if the user has already filled them out
[21:56:55] DaniG2k: but i dont know how to tell the coffeescript to prepopulate with the already-available input if there is any
[21:57:53] jrobeson: that's more of a js question than directly coffeescript
[21:58:37] DaniG2k: i only want the fields to be prepopulated if they've already been input
[21:58:44] DaniG2k: should i be adding that into the controller
[21:58:48] DaniG2k: and passing it into the partial?
[21:59:06] DaniG2k: so that if there are already values there it will use those?
[21:59:12] jrobeson: that's the best way to start
[21:59:19] jrobeson: unless the value list is too long
[21:59:25] tubbo: DaniG2k: why can't you just preload the data into the tags when the page is loaded?
[21:59:27] DaniG2k: no its never more than 5
[21:59:38] ivanskie: has anyone done tagcloud with Simple_Form ?
[21:59:45] DaniG2k: tubbo: yeah im thinking something like that would be good
[21:59:55] tubbo: DaniG2k: you shouldn't need JS for that.
[22:00:09] tubbo: especially if you're not in a long-lived app
[22:00:33] ivanskie: how do you guys do tagcloud with simple_form?
[22:00:46] DaniG2k: so in the edit method I'd put like @my_form_objects = Objects.all
[22:01:10] DaniG2k: and then in the nested attribute I'd refer to that by...
[22:01:34] DaniG2k: <% f.fields_for @my_form_objects do |builder| %>
[22:01:52] tubbo: DaniG2k: i usually do this https://gist.github.com/tubbo/6587191#file-_educational_experiences_fields-html-erb-L3
[22:02:04] helpa: ivanskie: 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.
[22:02:04] tubbo: ivanskie: !used
[22:02:06] helpa: ivanskie: Your question has just been deemed vague; please consider rewording it. It may also help to give us any relevant code or errors so that we may better assist you.
[22:02:06] tubbo: ivanskie: !vague
[22:02:14] AntelopeSalad: to output a font awesome icon as part of a link_to's output text is this the standard way to do it? it seems a little messy but works -- <li><%= link_to '<i class="icon-home icon-large"></i>Home'.html_safe, home_path %></li>
[22:02:25] ivanskie: stupid question yes.
[22:02:26] tubbo: AntelopeSalad: make a helper method
[22:02:48] ivanskie: I'm trying to figure out how to use acts_as_taggeble_on with simple_form
[22:02:58] AntelopeSalad: tubbo: yep, that's where i was heading
[22:03:11] tubbo: AntelopeSalad: https://gist.github.com/tubbo/15d8b8e1725a82b0127c
[22:03:23] DaniG2k: tubbo: oh i see
[22:03:34] DaniG2k: tubbo: but then how can i refer to each element
[22:03:39] tubbo: link_to "#{icon_tag(:remove)} Remove", posts_path, method: :delete
[22:03:55] tubbo: DaniG2k: i don't understand what you're asking
[22:04:00] AntelopeSalad: tubbo: thanks, that'll work
[22:04:10] DaniG2k: tubbo: say there are 5 objects in @my_random_objects
[22:04:21] DaniG2k: and I have a nested attribute
[22:04:35] DaniG2k: the way youre suggesting would just output one of those objects
[22:04:40] DaniG2k: f.object.major
[22:06:38] DaniG2k: basically, how do i pre-populate a nested attribute form with objects held in an instance variable
[22:06:42] DaniG2k: thats my question :P
[22:07:38] ivanskie: i'll just watch the screencast
[22:08:01] tubbo: DaniG2k: no it won't, because you re-set `f` to `builder`. https://gist.github.com/tubbo/6587191#file-edit-html-erb-L7
[22:08:11] tubbo: DaniG2k: so `f.object` points to an EducationalExperience, not a Tutor.
[22:08:58] tubbo: f: builder means you now have a form builder for educational_experiences.
[22:09:10] DaniG2k: tubbo: ok i'll try
[22:14:29] DaniG2k: tubbo: ok i see what you're saying
[22:14:34] DaniG2k: but it doesnt seem to work
[22:14:48] DaniG2k: tubbo: and i think its because the javascript is overriding it
[22:14:59] DaniG2k: i hate javascript/coffeescript/jquery -_-
[22:20:36] tubbo: DaniG2k: what is the JS supposed to do?
[22:21:21] DaniG2k: tubbo: the js simply gives users the ability to add/remove fields with a cool fadein when adding
[22:21:24] ivanskie: is there a rails helper for <button> tag? without doing button_to (form element)
[22:21:30] DaniG2k: but no more than 5 fields
[22:21:41] DaniG2k: tubbo: because i dont give a shit if they've attended more than 5 universities
[22:21:50] DaniG2k: tubbo: so nothing special
[22:22:04] tubbo: DaniG2k: seems like that constraint of having only 5 is a bit of complexity that you don't need.
[22:22:12] tubbo: there's no real business reason why universities MUST be < 5 per person
[22:22:27] DaniG2k: tubbo: indeed
[22:22:41] DaniG2k: tubbo: but i can easily change that by removing the if condition
[22:22:52] ivanskie: im trying to do this > <button class="btn btn-primary">New User</button> in the html, i can do it with link_to, but it keeps styling it as visited, and thats messy.. so is there a way for me to do this as <button> ?
[22:22:58] DaniG2k: tubbo: the question is how to prepopulate the fields if they have been input, and to use the placeholder otherwise
[22:23:28] DaniG2k: without the javascript taking over @_@
[22:23:43] tubbo: DaniG2k: so there's good news and bad news...the good news is that it's already been solved. the bad news is, you'll have to do it again since the only implementation i know if is proprietary.
[22:23:46] jrobeson: ivanskie, perhaps instead.. style the link as a button..
[22:24:08] jrobeson: that's what something like twitter bootstrap does
[22:24:37] jrobeson: OR.. use url_for instead of link_to
[22:24:57] DaniG2k: tubbo: its that hard?
[22:24:59] tubbo: ivanskie: api.rubyonrails.org, search the docs. yes, it's button_tag iirc.
[22:25:10] tubbo: DaniG2k: not *really* but it's certainly harder than it should be :P
[22:25:32] tubbo: DaniG2k: what we did was basically rendered an extra bit of HTML and hid that, then cloned that bit of HTML every time someone clicked "Add Fields", and placed it in a visible pane on the page.
[22:25:54] DaniG2k: tubbo: oh my god...
[22:26:09] tubbo: DaniG2k: we had to edit all the names with the current timestamp. as long as the nested attrs form has sequential fieldsets, rails is fine with it.
[22:26:27] tubbo: DaniG2k: err, not sequential...but each new fields_for has to have a number larger than the number befor eit
[22:26:35] tubbo: so you can just use a UNIX timestamp for that
[22:26:42] DaniG2k: tubbo: im already doing that
[22:26:56] DaniG2k: tubbo: https://gist.github.com/tubbo/6587191#file-tutor-js-coffee
[22:27:07] DaniG2k: time = new Date().getTime()
[22:27:18] tubbo: oh right there it is
[22:27:36] DaniG2k: tubbo: i see what you're saying but it seems overly complex...
[22:28:08] tubbo: DaniG2k: well actually, the way we did it allowed our JS to target a specific ID, so we always cloned the same bit of HTML.
[22:28:25] tubbo: DaniG2k: btw what i'm suggesting here is not a great idea.
[22:28:55] tubbo: in this particular company we SHOULD have been using a JS framework but we weren't, and nobody wanted to change. i pushed that up until i got fired.
[22:29:04] tubbo: s/that/ruthlessly using a JS framework
[22:29:23] hell_lord: hello. i am using rails 4 and i have an issue with rake assets:precompile. i have an external js library with a css file that references images. initially i thought it would not find them in prod mode because the assets:precompile now ignores image files in vendor/assets, but after reconfiguring the filters it still does not work. the problem appears to be that the PNG files are fingerprinted when they are copied over to the public/assets directory, howe
[22:29:42] DaniG2k: tubbo: ill watch a railscast cause i think he's done it somehow
[22:30:22] tubbo: it's quittin time over here. later!
[22:31:38] Radar: That's a fun button.
[22:33:11] ajustrun: hey guys, kind of a newbie seeing a weird error that ive never encountered before, http://cl.ly/image/2c1z0z0o3v3Z
[22:33:19] ajustrun: could anyone point me in the right direction?
[22:33:30] ajustrun: heres my github for reference https://github.com/ArunGupta25/sartorialis/tree/master/app
[22:33:38] ajustrun: it has to do with a form selector
[22:34:14] hell_lord: ajustrun: did you declare a field called "type" on your model?
[22:34:22] ajustrun: hell_lord: i believe i did
[22:34:27] ajustrun: i did a migration to add it
[22:34:36] ajustrun: and then migreated the db
[22:34:37] hell_lord: ajustrun: well, like the error message says, that's not legal
[22:34:48] ajustrun: i get it, sorry!
[22:34:52] hell_lord: ajustrun: type is reserved as a discriminator field for ORM inheritance implementatin
[22:35:16] ajustrun: right right that makes sense, sorry i got confused haha
[22:37:20] hell_lord: Radar: lol you the same radar with the blog?
[22:37:36] ARMIGER1: Assuming I have a file in my app's lib directory, where would I place the Rspec test? Should I just create spec/lib and put it in there?
[22:38:23] Radar: hell_lord: probably
[22:38:29] helpa: hell_lord: Did you know Radar hasn't read any rails books? He learned everything by answering questions in #rubyonrails and googling for the answer
[22:38:29] Radar: hell_lord: !radar
[22:38:31] hell_lord: Radar: lol just read your blog. the tech writer, right?
[22:38:42] Radar: hell_lord: Yeah, ryanbigg.com is my blog
[22:38:51] Radar: What were you reading on my blog?
[22:42:28] hell_lord: Radar: i was reading about problems with the assets pipeline image paths for jquery ui. unfortunately it's for rails 3, so it doesn't help with my specific problem
[22:43:36] hell_lord: Radar: it was well written though :-)
[22:46:10] hell_lord: does anyone know what the proper approach is for serving vendor images referenced in vendor css with the precompile step?
[23:20:30] Salve: I'm running rails 4 and can't for the life of me figure out how to do a javascript lib include when my library is in /lib/assets/javascripts. My assumption was to just do this <script src="/lib/assets/javascripts/mylib.js"></script> It doesn't work. Any help is greatly appreciated.
[23:21:44] helpa: Salve: http://guides.rubyonrails.org/asset_pipeline.html - The Asset Pipeline Guide by Ryan Bigg, Richard Hulse & Mohammad Typaldos
[23:21:44] Radar: Salve: !assets
[23:21:57] Radar: Salve: <%= javascript_include_tag "mylib" %> should work.
[23:22:25] Salve: Radar, It will know the js library is in my /lib folder?
[23:23:27] Salve: Yeah it does. Thanks Radar!!
[23:23:54] Sc0rp10n: wassup my homie
[23:23:55] Radar: Sc0rp10n: hi
[23:24:05] Sc0rp10n: how's it going
[23:25:46] Sc0rp10n: what's up with the ripped jeans dude
[23:28:42] Radar: Sc0rp10n: not here to chat, sorry.
[23:28:47] Radar: I have work to do
[23:28:49] terrellt: Radar: Before I make an issue - Paranoia, any reason you don't have it updating updated_at? I added a touch to my before_destroy, but it seems like something that should happen.
[23:29:06] terrellt: Ah, no hurry.
[23:29:06] Radar: terrellt: the record is not being updated, why would I update updated_at?
[23:29:23] terrellt: Then mayhaps update cache_key to include deleted_at?
[23:29:28] whitsan: I'm trying to generate scaffolding with haml, so I followed this tutorial: http://thehungrycoder.com/ruby-on-rails/rails-scaffold-create-haml-rather-than-erb-views.html
[23:29:38] Radar: Oh, it's a caching thing
[23:30:02] Radar: terrellt: Would calling touch after the "destroy" cause updated_at to be updated?
[23:30:04] whitsan: But when it tries to generate it gives this: (erb):19:in `template': undefined method `key_value`
[23:30:12] tonz: I have a client who wants to send a form encrypted via email, was wondering if anyone had any resources that could guide me through this
[23:30:14] Radar: whitsan: "This domain name expired on Sep 16 2013 03:32PM "
[23:30:19] terrellt: Radar: Yeah, but it's a second query.
[23:30:21] Radar: whitsan: code or ban
[23:30:49] whitsan: Sorry, which domain name expired?
[23:31:09] Radar: whitsan: the domain that you linked to
[23:31:36] whitsan: You're not seeing it?
[23:31:48] Radar: whitsan: That's right.
[23:32:04] whitsan: Well that's odd.
[23:32:25] Radar: whitsan: sooooo
[23:32:34] Radar: whitsan: upload your code somewhere else, like GitHub?
[23:33:14] terrellt: Lol, it expired an hour ago. Cached response likely.
[23:34:13] whitsan: Radar: https://gist.github.com/whitnelson/6588102
[23:34:45] tetraktys: hey guys, this is my first time here and i'm stuck on one of ryan bates' railscasts. I had #147 (sortable lists revised) working until i updated to rails 4 and added child nodes which also need to be ordered by position. I think I included all relevant code and comments in this gist: https://gist.github.com/joostvanrijn/6588056 but the bottom line is: the params are either empty or I get an error message like the last comment
[23:34:47] Radar: whitsan: so if I put just that code into a brand new application it will error exactly as you have said it will?
[23:34:47] tetraktys: in the gist
[23:35:13] Radar: tetraktys: "results in a param not found error" which is not shown in the gist becuase?
[23:35:42] whitsan: It's taken a fair amount of jimmying to get this this to run properly.
[23:35:59] EminenceHC: I am using a polymorphic relationship to have multiple user profiles. Student has a polymorphic relationship to user. I use a nested form to create a student with user parameters along with student parameters. My create function works just fine. My question is how to return a list of users with data from both models? I am trying to use the index method in the students controller. Anyone know a goo
[23:35:59] EminenceHC: d way to go about doing this?
[23:36:07] Radar: omg what is with the tl;dr questions this morning?
[23:36:22] Radar: whitsan: Then put it in a new application on GitHub that we can clone and poke at.
[23:36:29] Radar: whitsan: all we've seen so far is 4 LOC and one line of error
[23:36:48] Radar: Lines of code
[23:37:09] whitsan: Sorry, I'm a bit new to IRC
[23:37:17] Radar: LOC is a programming concept :P
[23:37:22] Radar: EminenceHC: What do you mean data from both models? Student and User models?
[23:37:27] Radar: EminenceHC: What have you tried so far?
[23:37:55] whitsan: It's also an acronym. :)
[23:38:00] Radar: terrellt: could you please look into a patch for paranoia that would either a) update updated_at or b) re-define cache_key to include deleted_at?
[23:38:06] tetraktys: Radar, i thought it was a fairly common error, but i've updated the gist https://gist.github.com/joostvanrijn/6588056 with the complete stack trace
[23:38:40] terrellt: Radar: I'll work on a PR, no promises on a timeframe though. =)
[23:38:42] Radar: tetraktys: Do you know how to use pry?
[23:38:46] Radar: terrellt: that's ok
[23:39:11] EminenceHC: Radar: I am trying to retrieve data stored in the user model and also data stored in the student model. User.all only returns fields from the user model.
[23:39:37] Radar: EminenceHC: Show me how the models are defined please. Create a new Gist.
[23:39:39] helpa: EminenceHC: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[23:39:39] Radar: EminenceHC: !gist
[23:40:04] EminenceHC: Radar: Thanks Ill do that right now..
[23:40:18] tetraktys: Radar, no i've never heard of pry. google tells me it's 'an alternative to irb, but i'm not sure how that can help me?
[23:40:32] Radar: tetraktys: It's a good debugging gem. Add it to your gemfile with "gem 'pry'"
[23:40:48] tonz: I have a client who wants to send a form encrypted via email, was wondering if anyone had any resources that could guide me through this
[23:40:53] Radar: tetraktys: then directly above where you have "params.require(:player_tracking_category)" put 'binding.pry' and do the request again
[23:40:57] helpa: tonz: If you're not getting an answer here perhaps try asking on http://stackoverflow.com Use the tag "ruby-on-rails"
[23:40:57] Radar: tonz: !so
[23:41:06] Radar: tonz: "encrypted form" is a bit vague imo
[23:42:02] tonz: It just data that needs to be sent securely via email
[23:42:33] tonz: from a form submit maybe it being vague is why I can't find anything on google
[23:43:02] Radar: I don't think you can have forms inside of emails?
[23:43:12] disgrntld: I think this is more a general web dev question, but what the heck are these "data-*" attributes and how do they permit rails and javascript to interact? Is there a railscast that can teach me the basics?
[23:43:21] Radar: Why not just link them to a new page on your website with a secure token link provided in the email and deal with that way?
[23:43:27] Radar: disgrntld: which data-* attributes in particular?
[23:43:58] disgrntld: well I'm working with code that pops up a bootstrap modal window (I think that's what it's called)
[23:43:59] Radar: tetraktys: Oh, I forgot to mention that it'll bring up a console where you're running "rails s", then in that console, tell me what calling params method does.
[23:44:03] Radar: disgrntld: Code.
[23:44:07] Radar: codecodecodecode
[23:44:09] Radar: show us the code
[23:44:38] disgrntld: the attribute in question is data-toggle="modal" on an anchor tag
[23:44:40] tonz: That can work radar
[23:45:07] Radar: disgrntld: that's probably read by some bootstrap javascript code. That's nothing at all to do with Rails.
[23:45:20] disgrntld: ok, that helps, thanks
[23:46:45] tonz: radar what you mentioned is kind of over my head, if you don't mind listing the steps involved to do that would be much appreciated
[23:46:52] tonz: do not have to go in detail i can do the research
[23:47:17] EminenceHC: Radar: I have put my code up at https://gist.github.com/charlesnutter/6588229
[23:47:26] Radar: tonz: Make a link in the email. The user clicks the link and goes back to the app. The route to where they go, goes to a form. They fill in the form.
[23:48:04] tetraktys: Radar, this is what gets returned: https://gist.github.com/joostvanrijn/6588242
[23:48:44] Radar: tetraktys: Right. What happens if you call " params.require(:player_tracking_category)" ?
[23:48:52] tonz: The form needs to be on the site, the data just needs to get to the admin safely and securely
[23:49:14] tetraktys: i get the same hash
[23:49:16] Radar: tonz: Why would it not get there "safely and securely"? What legitimate concerns do you have?
[23:49:21] Radar: tetraktys: ok.
[23:49:30] Radar: tetraktys: and typing "exit" and letting it carry on past that point doesn't show any errors?
[23:49:43] tonz: so if I just use actionmailer it will get there securely?
[23:50:00] tetraktys: calling exit just gives me Unpermitted parameters: 0, 1, 2, 3
[23:50:12] Radar: tetraktys: right, so that's a different problem now.
[23:50:26] tetraktys: calling it again though… ActionController::ParameterMissing - param not found: player_tracking_category:
[23:51:10] Radar: tetraktys: so was the parameter missing that time?
[23:51:41] tetraktys: i don't think so… params.require(:player_tracking_category) returned the complete hash
[23:52:18] Radar: ok, I have no idea.
[23:52:24] Radar: Hard to reproduce from this end
[23:52:37] tetraktys: that's too bad
[23:52:47] tetraktys: thanks for your effort anyway
[23:53:14] tetraktys: i'll review it in the morning :)
[23:58:07] EminenceHC: Radar: Does that code look correct? The create and new methods work just fine. I am just having trouble calling what I want on the index page.
[23:58:31] helpa: EminenceHC: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[23:58:31] Radar: EminenceHC: !gist-usage
[23:59:05] EminenceHC: Radar: Sorry my bad I'll go fix it.
[23:59:07] Radar: EminenceHC: Why are these separate models?