« Back to channel list

#RubyOnRails - 18 August 2014

« Back 1 day Forward 1 day »
[00:07:55] rickjamesthethir: anybody have a good guide on how to use action mailer to receive emails to your domain?
[00:08:31] imton: makerops: thanks! I???d be doing something like that i think
[00:12:28] viiralvx: rickjamesthethir: http://guides.rubyonrails.org/action_mailer_basics.html
[00:12:43] viiralvx: More specifically, rickjamesthethir --> http://guides.rubyonrails.org/action_mailer_basics.html#receiving-emails
[00:44:55] Limix: Hi, I have CORS setup but for some reason when I try to delete a record from the javascript front end, it makes an OPTION call but rails says there is no route for OPTION
[00:45:15] Limix: ActionController::RoutingError (No route matches [OPTIONS] "/api/clients/868"):
[00:45:34] Limix: I have clients setup as: resources :clients
[00:45:44] Limix: in the api namespace
[00:46:39] Limix: everything else works. Other methods call options and rails responds. Is there something different with destroy?
[00:47:02] momomomomo: use rack-cors
[00:47:53] Limix: that???s what I???m using
[00:48:02] Limix: gem 'rack-cors', :require => 'rack/cors'
[00:48:50] Limix: https://gist.github.com/brancusi/ca8e71523f21b5a347de
[00:49:08] Limix: that???s the call the emberapp makes
[00:49:10] momomomomo: I'm sorry, I don't have time to help you at the moment, thought I'd suggest the gem in case you hadn't been using it
[00:49:26] Limix: sure thank you
[00:49:51] Limix: this is what rails says in case anyone has any ideas: https://gist.github.com/brancusi/175acce58167d3c0b51b
[00:52:37] yza: could someone post me to a work around for updating a attribute with a blank array
[00:52:57] yza: err post me lol
[00:53:13] yza: trying to update to remove all values and strong params aint having it
[00:53:30] viiralvx: yza: ._. Just got through each attribute and set it to nil?
[00:53:44] viiralvx: yza: Is it strong params or is it your validations?
[00:54:18] yza: im posting json to a nested field like perception_attribute[taste_ids=[1,2,3]]
[00:54:34] yza: if i do a update with taste_ids=[] i get this in the console
[00:54:52] Limix: ok, new question, does rack-cors need additional configuration to allow DELETE options?
[00:55:03] yza: Unpermitted parameters: strain_id
[00:55:07] yza: err taste_ids
[00:55:07] Limix: when I try to use method DELETE it fails to return options
[00:55:56] shadynastys: Hey so i have not messed with ruby on rails in a while. I am just doing a simple example to get my feet wet again. I am trying to do a has_many :through relationship. This is probably a simple thing that i am missing. I am getting unpermitted params: tag when creating a new photo with a tag https://gist.github.com/px-amaac/e0e9facb6cd34b6ebdc5
[00:56:09] yza: any ideas on work around ? :-/
[00:56:52] yza: im gonna try to look for it and if not conditionally assign it to []
[00:56:57] yza: i guess..
[00:57:07] yza: per this so link im looking at brb gonna try
[00:58:40] viiralvx: What's the best practice for images? Defining a Photo model and foreign-keying it or should I be fine "has_attached_file" to the model in general?
[00:58:57] Limix: fyi, I needed to add the :delete option to the rack-cors config
[00:58:59] viiralvx: Then again . . . for code reusability purposes, I think it'd be best to define another model.
[01:00:17] shadynastys: viiralvx: check out my gist that i just posted.. it has a photo model and an image that belongs to user model
[01:01:07] viiralvx: Oh sweet, but it's just like an image thumbnail for mine
[01:02:15] shadynastys: viiralvx: depending on what you want.. users has many photos.. if you only want 1 image per user then you can just attach it te your user model
[01:02:24] viiralvx: Aight, that's what I want for now
[01:03:39] shadynastys: viiralvx: I added my user model that has an avatar for each user to that gist
[01:03:47] viiralvx: Awesome, peepin' it again
[01:04:04] viiralvx: All righty~
[01:04:12] viiralvx: I have a remote_image_url as well. ._. Is that okay?
[01:04:58] shadynastys: i am not sure on that one.. all of what i have is from docs..
[01:05:50] viiralvx: Yeah, no worries. :P
[01:05:57] shadynastys: this is for uploading an image.. are you saying that you want to be able to just put an external url in there that serves the picture
[01:06:43] viiralvx: Yep, if the user doesn't want to upload a photo, hahaha.
[01:07:03] lethjakman: like a default?
[01:07:37] shadynastys: ya i dont know about that but here is the gem and docs that i used i used https://github.com/thoughtbot/paperclip
[01:07:59] viiralvx: shadynastys: I'm using Paperclip right now, I know how to implement logic. I just needed to know whether to separate it into a new model or not, but since I'm only using one, that won't be necessary. :D
[01:08:01] viiralvx: Thanks guys.
[01:08:25] shadynastys: np glad i could help
[01:09:32] shadynastys: ok now I am still having an issue with a has_many :through relationship if anyone can assist. i am sure it is something simple that i am missing
[01:13:52] shadynastys: ACTION bangs head
[01:14:40] helpa: shadynastys: 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.
[01:14:40] Radar: shadynastys: !code
[01:19:46] shadynastys: I actually posted code above but perhaps it was too long ago https://gist.github.com/px-amaac/e0e9facb6cd34b6ebdc5
[01:21:08] shadynastys: I am getting unpermitted parameters: tag in my logs
[01:21:44] viiralvx: Radar: Good evening
[01:22:01] shadynastys: i thought i set the strong parameters right. the photo gets created but no tags
[01:22:01] Radar: What is this? https://gist.github.com/px-amaac/e0e9facb6cd34b6ebdc5#file-_form-html-erb-L10
[01:22:12] shadynastys: Ahh form for photo
[01:22:34] Radar: Why is that fields_for @tag and not fields_for :tags?
[01:22:42] Radar: Wouldn't it be better to show all the fields for all the tags?
[01:22:44] viiralvx: Shouldn't it be
[01:22:55] viiralvx: fields_for :tag_attributes?
[01:23:10] viiralvx: Or are they synonymous?
[01:23:33] shadynastys: i thought i was supposed to do @tag = @photo.tags.build in my photos new action in the controller
[01:23:53] viiralvx: YOu can still do that
[01:23:59] shadynastys: like i said i have not done this for a while
[01:24:09] viiralvx: And then say
[01:24:26] viiralvx: @tag.attributes = tag_params
[01:24:29] shadynastys: the @tag = @photo.tags.build is probably for adding a tag outside of the photo/new page
[01:26:20] Radar: viiralvx: they're the same
[01:26:41] Radar: shadynastys: @photo.tags.build is enough to create a new tag for that pohot
[01:26:57] Radar: shadynastys: When you do fields.for :tags then that will loop through all the tags in @photo.tags and display fields
[01:27:45] shadynastys: i am not able to make any tags..there are none to display
[01:28:11] Radar: https://gist.github.com/px-amaac/e0e9facb6cd34b6ebdc5#file-_form-html-erb-L10
[01:28:15] Radar: photo.fields_for :tags
[01:28:17] Radar: Fixes this problem
[01:28:35] shadynastys: when i do fields.for :tags i lose the edit text fields on the new page
[01:29:09] Radar: @photo.tags.build creates that tag instance!
[01:29:13] Radar: It will show the fields.
[01:30:03] shadynastys: ahh ok.. ill try that thankyou.
[01:34:08] shadynastys: Radar: thankyou.. i was removing the @photo.tags.build in the controller at first too. Thanks for the help makes sense now
[01:34:17] Radar: shadynastys: aha
[01:34:40] shadynastys: and works. yay
[01:38:29] geardev: I'd like to create a simple project tonight: consume a web api, store the data somewhere, and then present it on a page with datagrid
[01:39:07] geardev: would config/boot.rb be the place to put the initial fetching of data?
[01:49:12] shadynastys: Radar: is there a reason why that change to tags would prevent me from deleting a photo? I have dependant destroy on the relationship. but i cant even get destroy to throw an error
[01:49:21] helpa: shadynastys: 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.
[01:49:21] Radar: shadynastys: !code
[01:49:44] Radar: geardev: Wouldn't you want to only load that data once?
[01:49:50] Radar: geardev: typically this is done in db/seeds.rb
[01:50:12] Radar: shadynastys: show us the error
[01:50:37] shadynastys: no error.. the destroy button is just not responsive
[01:51:05] shadynastys: i wish there was on error
[01:51:38] shadynastys: i just reset my db cause i thought it was something i did
[01:53:28] Radar: Unresponsive? Nothing in the javascript console?
[01:54:59] shadynastys: nothing it just does not react
[01:55:25] geardev: Radar: that makes sense, thank you
[01:55:38] Radar: shadynastys: That is exceptionally weird.
[01:57:14] shadynastys: ... ya lets not worry about it since for some reason it just started working i removed the previous change you helped me with then tested and it worked
[01:57:31] shadynastys: then i reapplied the change and it works again
[01:58:24] shadynastys: when in doubt.. redo.
[01:59:08] shadynastys: Radar: thankyou for your help drinking time
[02:12:42] geardev: any idea why httparty would fail to load in `bundle exec rails console`, but it loads fine in `bundle exec irb` or `bundle exec pry`?
[02:13:19] geardev: `require 'httparty'` => false in rails console, true in pry or irb
[02:13:39] Rylee: geardev, did it perhaps already get required in the Rails console?
[02:14:29] geardev: Rylee: `HTTPParty` returns 'uninitialized constant`
[02:14:36] geardev: so I'm guessing no
[02:14:37] Rylee: okay then
[02:15:40] nahtnam: Hey! Has anyone made an app with rails and ember?
[02:17:06] geardev: Rylee: https://gist.github.com/fikse/a31555d129cab141f998
[02:17:12] geardev: nahtnam: not me
[02:17:30] geardev: Rylee: do you see anything wrong with that, if maybe that would cause an issue of httparty loading
[02:17:59] Rylee: I'm not an advanced Rails user though
[02:18:41] geardev: pontiki: https://gist.github.com/fikse/4ef29c029f3a098c46d1
[02:19:15] geardev: 21:13 < geardev> `require 'httparty'` => false in rails console, true in pry or irb
[02:19:28] pontiki: that means it's already loaded
[02:19:55] geardev: pontiki: but then why is `HTTPParty` returning 'uninitialized constant'?
[02:20:18] pontiki: because it's HTTParty ?
[02:20:44] geardev: thanks pontiki
[02:22:12] geardev: i read that as 'not welcome' and felt even more terrible :)
[02:22:54] pontiki: oh, man, noooo "no worries"
[02:26:24] wethu: hey, is there some good documentation on how i can use multiline ruby, I'm writing a few helper methods to render off some links, buttons this sort of thing, and have a quite lengthy class names sometimes, id prefer to keep within a 80 character long per line. Ive up until now, just tried braking up link_to's args by trail and error, sometimes the parser hates it and other i get it right
[02:27:12] wethu: basically whats the rule concerning putting args on multiple lines lol
[02:27:35] pwk: wethu: i would assume brackets help
[02:27:38] pontiki: i'm not sure it's a rule, but i end the line with a comma, then start the next line
[02:28:04] pontiki: i think the parser might be more lax
[02:28:13] wethu: yeah, I've used brackets when i start pulling my hair out just to make the line parse properly
[02:28:43] wethu: but, ruby's a nice language, its a small headache to put up with lol
[02:29:19] wethu: if i split a hash arg, i can end on commas right?
[02:30:27] wethu: thanks, sorry id usually just try these and work it out myself, but I've just been going, oh new line, oh parser hates that, and rearrange until it works, then add brackets, wondered if there was a hard and fast rule to 'know'
[02:30:45] pontiki: what do you mean by "brackets" ?
[02:32:52] wethu: like if arg signature has method(object, hash) and i want to say method(foo(1), { options => 1 }) you could write that on one line method foo 1, :options => 1
[02:33:57] pontiki: but you shouldn't
[02:34:29] pontiki: i can't tell by looking at that if :options got with 1, foo, or method
[02:34:46] wethu: yeah thats true
[02:35:00] wethu: i use brackets to keep clarity
[02:38:16] wethu: on this topic, if i may, is there any penalties for removing brackets on conditionals ? if (foo == 1 || bar == 2) better to if ((foo ==1) || (bar == 2)) ?
[02:41:01] Oog: ive got a string "for <blah@asdfasdfads.com\x0E\xC8\x14\xDD....." - trying to figure out how to decode it... that \x0E should be a > - any ideas what this is?
[02:44:26] pontiki: wethu: in that entirely made-up instance, no, no penalty
[02:44:31] pontiki: but you can't make a rule from that
[02:45:26] wethu: pontiki, I always use the latter, explicit brackets, like I'm doing a math equation and want to make sure that (this is whatever it is) && (and this is whatever it is)
[02:46:00] wethu: but its ugly lol
[02:46:03] pontiki: your statement belies your questions, wethu
[02:46:52] pontiki: it sounds as if you're asking for permission to do something that works well for you
[02:47:07] wethu: yeah, just any example where 2 logical statements are evaluated and combined with any other logical operator and or xor etc
[02:47:54] wethu: nah, don't want permission, just want to know if the parser would evaluate it without the inner brackets
[02:51:27] wethu: Oog, http://software.hixie.ch/utilities/cgi/unicode-decoder/utf8-decoder i put some of that string into there and got some sort of a result, not sure if its what you're after
[02:53:24] Oog: thanks i figured it out there is a bug in the google api ruby library
[02:53:28] Oog: i found a way around it
[02:58:51] viiralvx: -____- Screw Paperclip and file uploads.
[03:09:09] microdex: is there a method to convert the result of a pluck() back into something that behaves like the original active record result instead of array ?
[03:15:39] viiralvx: Trying to do a remote file upload from a URL with Paperclip, getting undefined method original filename= . . . what the hell is going on? https://gist.github.com/iheanyi/34099cafc48ef1812ae7
[03:19:42] christopherbull: is there a way to make collection_radio_buttons work with an array of strings, instead of objects?
[03:23:18] luckyruby: Do you guys use Proc.new or proc {}?
[03:27:44] yza: anyone have a work around for posting foo_ids[]
[03:27:49] yza: or updating
[03:27:55] yza: i should say
[03:34:50] luckyruby: yza: not sure what you mean
[03:35:09] yza: https://github.com/rails/rails/issues/8832
[03:36:04] yza: submitting a param with value of a blank array while updating will not update it will render to nill
[03:41:12] agent_white: Evenin' folks.
[03:42:56] muhammadn: Hi. I am trying to solve the problem of extracting the data from an array of values stored in a "text" type column.
[03:42:59] muhammadn: http://stackoverflow.com/questions/25355693/how-do-i-access-a-value-in-the-database-directly-which-is-in-array
[03:43:24] luckyruby: muhammadn: serialize
[03:44:01] luckyruby: http://apidock.com/rails/ActiveRecord/Base/serialize/class
[03:44:05] muhammadn: luckyruby: is it possible with serialize i can extract one value out of an array?
[03:44:37] luckyruby: http://apidock.com/rails/ActiveRecord/AttributeMethods/Serialization/ClassMethods/serialize
[03:47:12] luckyruby: muhammadn: the attribute will be serialized into an array
[03:54:05] muhammadn: luckyruby: i have searched around but i could not find a way to get one value out of the array
[03:55:14] luckyruby: muhammadn: can you give an example of what you want to do?
[03:55:35] luckyruby: do you know how to extract values out of an array in ruby?
[03:56:05] luckyruby: Array#detect if you want one. Array#select if you want multiple
[03:59:41] JokesOnYou77: I'm trying to figure out how to create a link to a dynamically created file. I.e. user clicks a link, I create a file, say a .txt file with a random number in it, and user gets a download prompt for that file.
[04:00:33] sevenseacat: you generate a link to an action that generates the file
[04:00:59] sevenseacat: you dont link to the dynamic file itself because you havent yet created it
[04:03:49] luckyruby: JokesOnYou77: create filename, generate file, use filename to generate link.
[04:05:56] JokesOnYou77: luckyruby, link_to download_controller(some_param) where the controller has a send_file return?
[04:08:04] luckyruby: go with sevenseacat's advice
[04:08:16] luckyruby: my advice is more if you want to have a link that persists beyond the session
[04:08:58] luckyruby: like dropbox link sharing
[04:10:22] JokesOnYou77: That's sort of the problem though, how do I link to a controller action that does that?
[04:11:38] luckyruby: where's the trouble? in creating the link or in writing the controller code?
[04:11:44] luckyruby: or with routing?
[04:12:28] luckyruby: link_to 'Download File', your_named_route(params)
[04:12:30] JokesOnYou77: Creating the link. I think I can create a controller that just returns the file. And If it's just a send_file I don't think I need routing?
[04:12:45] JokesOnYou77: oh, routing makes everything better
[04:13:06] luckyruby: routing determine what controller action gets hit
[04:13:10] JokesOnYou77: I do really like rails but every once and a while I just hit a wall. Thank you
[04:14:11] luckyruby: you'll get the hang of it
[04:14:19] JokesOnYou77: luckyruby, But the file doesn't have a page, so where does the route point?
[04:14:42] sevenseacat: well where are you generating it?
[04:14:53] luckyruby: are you generating a file that gets saved on the server?
[04:14:55] JokesOnYou77: In the controller.
[04:15:06] JokesOnYou77: Just generated then sent to user
[04:15:17] luckyruby: ok, so the controller code will handle streaming the file to the user via browser
[04:15:19] sevenseacat: so you have a controller action to link to
[04:15:26] sevenseacat: the action thats generating the file
[04:15:41] luckyruby: the route you use in the link will call the controller code
[04:16:10] luckyruby: when the user clicks on the link
[04:16:30] JokesOnYou77: sevenseacat, So how do I link to the controller? And should the controller just return a file?
[04:16:49] sevenseacat: you make a route that points to that action, and then you link to that route
[04:17:23] ranchodev: Anyone: What's your goto wysiwyg editor for rails 4?
[04:17:55] luckyruby: ranchodev: I'm using atom.io but it's kinda slow in comparison to sublime text
[04:18:23] luckyruby: JokesOnYou77: I think it would be helpful for you to review the routing guide
[04:18:24] sevenseacat: i dont think thats what he meant
[04:18:35] sevenseacat: ranchodev: i usually use wysihtml
[04:18:44] luckyruby: JokesOnYou77: http://guides.rubyonrails.org/routing.html
[04:19:06] JokesOnYou77: sevenseacat, Ok, I think I'm just bing thick now. In my route, I have get /some/path, to: 'somecontoller" , as: "namedroute" but if there's no separate page for the file, what is some/path?
[04:19:21] sevenseacat: its the url you want to call
[04:19:31] sevenseacat: what URL do you want to have for your action?
[04:20:08] JokesOnYou77: It shouldn't navigate anywhere. It should just prompt the user to download the file from the page they're currently on
[04:20:32] luckyruby: get /some/path, to: "controller_name#action_name"
[04:20:47] ranchodev: is wysihtml pretty dev-friendly? and is Mercury still a thing?
[04:20:53] luckyruby: get "/some/path" => "controller#action"
[04:20:57] JokesOnYou77: The page with the download link already has a route though, It's that going to f* it up?
[04:21:11] sevenseacat: make up a URL, i dont care what it is
[04:21:40] JokesOnYou77: I was being thick
[04:28:12] JokesOnYou77: Ok, so as easy as this all sounds, I managed to screw something up.
[04:28:30] JokesOnYou77: I have link_to 'report_download
[04:28:49] JokesOnYou77: then in my routes I have get 'reports/:id/download', to: 'reports#download', as: "report_download"
[04:29:18] JokesOnYou77: And the controller: def download \ send_data("4", :filename => "Annotated_Comments.txt") \ end
[04:29:35] luckyruby: link_to 'Download Report', report_download(@report.id)
[04:29:52] sevenseacat: ACTION waits to hear a problem first
[04:31:32] JokesOnYou77: Ok, the full html is: <%= link_to 'report_download' do %>
[04:31:32] JokesOnYou77: <i class="fa fa-download"></i> Download Annotated Results (CSV)
[04:32:12] JokesOnYou77: And I get Could not find report with id=report_download
[04:32:15] sevenseacat: thats not how you create a link, but im still waiting to hear the problem
[04:33:02] JokesOnYou77: Ok, so I how do I create the link
[04:33:18] sevenseacat: the named route generated by your route is report_download_path, and it needs an ID
[04:33:37] sevenseacat: so you would call it like, for example, link_to report_download_path(@id) do (stuff) end
[04:35:21] JokesOnYou77: YOU ARE THE GODS OF RAILS! ALL HAIL!
[04:36:04] luckyruby: JokesOnYou77: just curious but are you coming from another web dev platform?
[04:36:22] JokesOnYou77: Now I just need to convert a massive JSON string into a CSV :P
[04:37:36] JokesOnYou77: luckyruby, Yeah, I was PHP.Drupal :P. But I'm also a recent grad and this is my largest real project with a framework. Before this i did everything by hand from scratch with no frameworks, fine for small projects.
[04:38:07] luckyruby: what turned you on to rails?
[04:40:09] JokesOnYou77: The project manager's friend works for a Ycombinator startup and knows rails, so we used him to get started. It turns out to have been a terrible choice for our app (no offense) but I've actually enjoyed rails/ruby as ruby is closer than anything else to Lisp
[04:41:05] luckyruby: what makes rails a terrible choice for your app?
[04:44:54] JokesOnYou77: The app is essentially a spreadsheet application for annotating sentiment etc. on social media posts (like when Walmart wants to know what people are actually saying out of 20000 tweets at them). It has some cool visualizations, but at the end of the day it's basically a frontend for SQL and rails obscures a lot ot SQL functionality in the models. We just want to write stored procedures and push the results to the screen :P
[04:44:57] neruda: getting an argument out of range on a timestamp field, googling shows monkey patching for DateTime parsing, is that really the best practice?
[04:47:25] luckyruby: JokesOnYou77: Did you guys look into nodejs?
[04:48:59] JokesOnYou77: So now we should run our SQL app that needs to process 10000+ rows on a javascript server? I actually do think node is really cool and I'm trying to do some of our d3 processing server-side, but it doesn't seem like a good fit for this.
[04:50:37] JokesOnYou77: That came out a bit harsh, sorry.
[04:52:35] luckyruby: yea, I don't know anything about your app but to be fair, v8 engine is pretty fast
[04:54:16] JokesOnYou77: It is def cool. The thing is that we have tabular data, users give us excel files, and that's what SQL is for. I have been getting increasingly turned on to node though. Just seeing some of the things it can do is really incredible.
[04:56:19] JokesOnYou77: So now that I'm writing the actual controller, I'm realizing that I'm not actualyl sure how to create a file (CSV actually) in memory without writing to disk and then return it :P
[04:57:13] JokesOnYou77: CSV.generate maybe...
[04:58:02] luckyruby: then send_data in your controller
[04:58:12] JokesOnYou77: oh man I don't want to jynx it but I might actualyl get this done tonight.
[04:58:25] JokesOnYou77: I didn't actually expect that
[05:00:52] vedu: hello. Images are not being displayed using <img src="/images/logo.jpg"> . But if I place my images in public/assets/ then they are displayed
[05:03:48] agent_white: vedu: http://guides.rubyonrails.org/asset_pipeline.html#how-to-use-the-asset-pipeline
[05:06:15] luckyruby: vedu: <%= image_path('logo.jpg') %>
[05:06:23] luckyruby: make sure logo.jpg is in assets/images
[05:06:50] vedu: but why doesn't the regular HTML syntax work?
[05:07:01] luckyruby: cause you're using the asset pipeline I presume
[05:07:39] luckyruby: if you want it to work with your html, then disable asset pipeline and shove everything in public
[05:07:58] agent_white: But you shouldn't. Just figure out the asset pipeline.
[05:08:03] vedu: yes I got that
[05:08:23] vedu: I will. for now I will make this work.I will remove the hack later
[05:08:53] vedu: I have my views in basic HTML. will have to ask the designer to port them to erb/haml
[05:08:54] agent_white: vedu: Look at the link I pasted in -- if you have ~15 minutes then you'll be able to fix it.
[05:10:05] vedu: agent_white: yes. thanks :)
[05:27:08] picasso: Hi.. I'm debugging an issue where Paperclip is prefixing all of my attachment URLs with the full local file path. I'm not sure where it came up and am rather novice with ruby/rails, any pointers to help debug this would be appreciated
[05:35:59] mozzarella: picasso: what do you mean by full local file path?
[05:36:20] Oog: in a rake task there seems to be no rails.logger output to stdout - how do i fix that?
[05:38:51] picasso: mozzarella: it seems that :rails_root is being prepended to the path portion of the URL
[05:39:07] picasso: i'm clumsily debugging by adding print statements to the paperclip gem =\
[05:41:32] pyemkey: Hello, I would like to use ajax request to execute search operation, then have possibility to sort them. How to keep found elements before sorting?
[05:41:49] mozzarella: picasso: maybe you set it up that way?
[05:42:05] mozzarella: show us your model
[05:44:19] rvanlieshout: pyemkey: that's something really really generic you're asking. There are tons of way to do this
[05:45:09] JokesOnYou77: luckyruby, How do I redirect back to the page where the link was clicked?
[05:45:52] picasso: mozzarella: https://gist.github.com/pix0r/4219c5f3f92607235ca0
[05:46:12] rvanlieshout: JokesOnYou77: redirect_to :back
[05:46:20] picasso: included relevant production config and image size thing i had hacked together
[05:47:05] JokesOnYou77: rvanlieshout, in the controller or in the link_to?
[05:47:29] JokesOnYou77: It's a download link for a dynamically created file if that makes a difference
[05:47:50] rvanlieshout: JokesOnYou77: at the place where you want to redirect
[05:47:54] rvanlieshout: but you cannot send a file _and_ redirect
[05:49:00] sevenseacat: you dont need to redirect
[05:49:26] sevenseacat: if you are sending a file, you wont leave the page you were on
[05:49:38] picasso: mozzarella: it seems for some reason i need to explicitly set path when calling has_attached_file. not sure if this is from a version upgrade or some unrelated code change in my project
[05:53:38] JokesOnYou77: sevenseacat, But the address bar goes to blah/download :P
[05:58:18] rvanlieshout: JokesOnYou77: that's a browser thing.. the page is still visible if served properly
[05:59:47] wethu: anyone here use cancancan, I have a trash controller that i want to stop none admin users from deleting jobs or clients and authorize_resource :job in the TrashController doesn't seem to pick up the abilities
[06:01:00] wethu: load_and_authorize_resource throws an error because Im guessing the gem tries to determine the model name form the controller name and i get an error complaining about Trash constant not defined
[06:01:11] rvanlieshout: wethu: tell it how to load job
[06:01:12] maoko: Hi there. Can someone tell me how to include custom email styles to devise?
[06:01:17] rvanlieshout: with the load_and_authorize_resource
[06:02:05] rvanlieshout: maoko: https://github.com/plataformatec/devise#configuring-views
[06:02:12] wethu: rvanlieshout, I thought authorize_resource :model_name was telling it, that error gets thrown if i use load_and_authorize_resource
[06:02:19] wethu: theres typos in that sentence. sorry
[06:02:44] rvanlieshout: wethu: authorize_resource won't load it
[06:03:14] maoko: rvanlieshout, that only covers the views part, not the mailer stylesheets
[06:03:52] wethu: rvanlieshout, https://gist.github.com/wethu/6c39e8b9db4c75b939c8
[06:03:53] maoko: I've tried adding a custom layout for that, included styles in init/assets, but they are still aren't visible in mail preview with letter opener
[06:04:23] rvanlieshout: maoko: a mailer also has views
[06:04:37] maoko: rvanlieshout, already have them
[06:04:39] rvanlieshout: maoko: in which you decide what stylesheets to include
[06:04:52] sevenseacat: mailers dont use stylesheets
[06:05:10] rvanlieshout: maoko: if you only use authorize_resouce it does not load your @job. use load_and... and tell it how to load the job
[06:06:51] maoko: Works now. Had to add a custom copy of devise mailer as well
[06:08:48] wethu: rvanlieshout, oh ok, sorry i didn't see your last message
[06:18:07] pyemkey: rvanlieshout: yeah you are right, I described my problem in generic way. I have search form where I am using ajax request. At now it looks like this. I am searching something, then when I try to sort elements and actually it sorts, but all elements :) I do not know how to keep state of searched elements. Should I create separate action. I know that is not the prettiest class method, but I will do refactor later. https://gist.github.com/
[06:18:07] pyemkey: pyemkey/d7317f94b87a106df382
[06:21:37] Oog: how do i make a class accesesor that initializes on the first call
[06:21:47] Oog: in java you would have an ivar like _gmail hidden by gmail accessor
[06:22:08] Oog: same thing here have attr_accessor for _gmail ?
[06:35:09] rhizome: what do you mean? i only know a little java
[06:38:05] wethu: Oog like @ivar ||= init_foo ?
[06:38:22] Oog: oh yeah iforgot about @
[06:39:06] Oog: attr_accessor creates methods for accessing the ivars right?
[06:39:57] wethu: Oog, I'm not a complete ruby expert as yet, but yes i believe thats how it works, and attr_reader gives you read for free, and attr_writer returns the @ivar. thats how I've been using them
[06:40:10] Scient: fucking ridiculous how slow rubygems.org is....
[06:40:22] wethu: err, i meant to say attr_reader returns the @ivar
[06:40:36] wethu: attr_accessor gives you both
[06:40:52] Oog: yep seems to work thanks!
[06:41:12] wethu: no worries
[06:45:13] rhizome: attr_accessor creates a getter and setter
[06:47:37] pipework: well, a reader and a writer, would be more in line with ruby parlance.
[07:10:53] pyemkey: rvanlieshout: I had a problem with internet connection. Did you answer my question?
[07:11:40] joy4u: Running RSpec getting error Failure/Error: expect(flash[:notice]).not_to be_nil and Failure/Error: expect(response).to redirect_to(teacher) here is my code and error details https://gist.github.com/himadriganguly/a7b0d7dde8093971c19c
[07:11:54] rvanlieshout: pyemkey: add your filter param to your search link
[07:12:12] rvanlieshout: pyemkey: and your sorting param to you search form
[07:20:02] pyemkey: rvanlieshout: If am I not wrong at now I have sorting param in search form. Search link actually is going to the same page what search form.
[07:20:36] rvanlieshout: pyemkey: you at least don't have your search params in your sort link
[07:26:15] joy4u: Running RSpec giving error Failure/Error: expect(flash[:notice]).not_to be_nil and Failure/Error: expect(response).to redirect_to(teacher) and here is my code and error details https://gist.github.com/himadriganguly/a7b0d7dde8093971c19c
[07:30:56] joy4u: can anyone help me please
[07:32:39] JokesOnYou77: Hi all, does anyone know how fast/slow .html_safe is for a (very) large string? I'm using Oj to dump the json but it hardly seems to matter if .html_safe is going to eat up any gains I get from Oj
[07:36:17] rvanlieshout: joy4u: html_safe only sets a flag iirc
[07:37:22] JokesOnYou77: rvanlieshout, so, no speed hit?
[07:37:48] rvanlieshout: not unless you use it
[07:37:56] rvanlieshout: where i can imagine a html unsafe string would be slower
[07:37:59] rvanlieshout: cause it's sanitized first
[07:38:45] JokesOnYou77: Ahh, well I've got 30MB+ of JSON so it's going to be slow no matter what :P
[07:38:54] JokesOnYou77: But if Oj helps, I want it
[07:39:06] rvanlieshout: what are you going to do with that data?
[07:41:14] JokesOnYou77: The app is actualyl pretty much a spreadsheet application, but we have this crazy force-directed graph to vizualize the data in D3. There has been a lot of back and fourth about how idiotic it is to put that much data into the client but I was overruled the last time it came up
[07:41:28] joy4u: Running RSpec giving error Failure/Error: expect(flash[:notice]).not_to be_nil and Failure/Error: expect(response).to redirect_to(teacher) and here is my code and error details https://gist.github.com/himadriganguly/a7b0d7dde8093971c19c
[07:49:06] joy4u: can anyone help with the RSpec
[07:50:17] rvanlieshout: joy4u: https://gist.github.com/himadriganguly/a7b0d7dde8093971c19c#file-teachers_controller_spec-rb-L82
[07:50:41] rvanlieshout: why should that != nil?
[07:51:21] vasilakisfil: has anyone deployed rails + ember-cli app in heroku?
[07:58:45] exadeci: Hello, I'm having issues with cancancan. I get ActiveModel::ForbiddenAttributesError and I can't find anything wrong with my parameters https://gist.github.com/exadeci/ec92c198c3fb9fe99fb8 it worked perfeclty fine before I added load_and_authorize_resource
[08:02:03] vasilakisfil: http://stackoverflow.com/questions/25358649/deploy-ember-cli-rails-app-in-heroku
[08:11:39] mikecmpbll: nice, activejob got merged into rails master 8 hours ago. is that destined for 4.2?
[08:14:51] tbuehlmann: also, cool stuff with that GlobalID
[08:15:09] mikecmpbll: not looked in to that yet
[08:15:26] mikecmpbll: is that something to do with job deserialization or am i barking up wrong tree?
[08:15:42] mikecmpbll: notice that there's an active PR for .or() relation method too.
[08:16:22] tbuehlmann: yea, it's about identifying records/objects from an uri
[08:32:23] agent_white: I must be back on Australian time.
[08:32:29] agent_white: I need to adjust my sleep schedule.
[08:33:57] tbuehlmann: http://www.total-knowledge.com/~ilya/mips/ugt.html
[08:46:04] halik: Hi guys. Just a quick question. I'm saving a file in s3 and storing path information of it. I'm doing `escape(filename)` via JS to put the information on the HTML form so it wouldn't break the form quotes or doublequotes. I'm wondering if `before_save` of the data, should I unescape it using `CGI.unescape` or just store it with those %20's (escape)?
[08:47:21] rvanlieshout: halik: in most cases there is no need to esacpe it yourself
[08:49:22] halik: rvanlieshout: but when I write it HTML form it cuts the value attribute e.g. value='this "file" say's awesome!'. And the value only retains `this "file" say`...
[08:49:47] rvanlieshout: halik: how are you writing that html or js?
[08:50:56] halik: rvanlieshout: $container.append("<input type='hidden' name='image[file_name]' value='#{filename}'>")
[08:51:32] rvanlieshout: halik: add that input and use .attr('value', #{filename.to_json})
[08:52:05] halik: rvanlieshout: .to_json?
[08:52:25] rvanlieshout: it'll make it js safe
[08:53:07] halik: rvanlieshout: Then I would not need to escape or unescape it?
[08:53:15] halik: I'll try it out
[08:54:22] jonathan_alban: Has anyone ever used the Strava API? This is the first time I've tried working with an API and having trouble understanding how I gain an access token by Oauth. I'm stuck at the stage where you POST back to the strava api with the authoriation code. Is there a gem that can handle this process for Oauth or should I spend more time trying to understand Httparty?
[08:57:00] halik: @rvanlieshout thanks. I'll try this out
[08:57:28] rvanlieshout: you should :)
[08:58:18] yza: anyone mind helping me out with my route issue? :P
[08:58:30] yza: https://gist.github.com/christru/95bff368d56073262734
[08:58:43] yza: posted gist with controller/error/routes
[08:58:50] rvanlieshout: what's the problem?
[08:58:55] yza: NoMethodError (undefined method `api_lab_test_url'
[08:59:04] yza: respond_with :api, LabTest.create(lab_test_params)
[08:59:13] yza: gives me that error message
[08:59:13] rvanlieshout: and why would you expect there to be a papi_lab_test_url?
[08:59:35] yza: rails automagic ?
[08:59:40] rvanlieshout: there is no automagic
[09:00:13] yza: i guess because on my first controller i defined it returns a single object fine
[09:00:14] rvanlieshout: so did you define a route for api_lab_test?
[09:00:37] yza: not explicity no
[09:00:41] yza: I defined a nested resource
[09:00:57] rvanlieshout: and rake routes shows you a api_lab_test?
[09:01:11] yza: no only api/lab_tests#show
[09:01:19] halik: @rvanlieshout "some_string".to_json give's me undefined though
[09:01:37] rvanlieshout: yza: it should be on the left part of the output
[09:01:44] rvanlieshout: the right part is the controller#action where it's connected to
[09:01:59] yza: api_strain_lab_tes
[09:02:20] yza: rvanlieshout my bad i been up since since 9am and its 2am here
[09:02:30] rvanlieshout: halik: in js?
[09:02:37] yza: just trying to get this very last part done
[09:02:51] rvanlieshout: that should be executed in ruby
[09:02:56] halik: Tried it in chrome console and does the same
[09:02:59] rvanlieshout: the output can be pasted within your js
[09:03:12] halik: Sorry. That part coffeescript, not ruby interpolation.
[09:03:18] rvanlieshout: the output is safe to use like var foo = #{bar.to_json};
[09:04:09] yza: rvanlieshout I have api_strain_lab_test defined for show and looks like its looking for api_lab_test_ur hmmm
[09:04:33] halik: @rvanlieshout: this part is coffeescript `$container.append("<input type='hidden' name='image[file_name]' value='#{filename}'>")`
[09:04:44] rvanlieshout: yeah, change that
[09:04:46] yza: so that looks to be the problem i just dont know how to correct it
[09:05:06] yza: would i do it in my respond_to like how i set the api namespace
[09:05:17] rvanlieshout: yza: the respond_with redirects to the object
[09:05:34] rvanlieshout: yza: http://api.rubyonrails.org/classes/ActionController/MimeResponds.html#method-i-respond_with
[09:05:37] rvanlieshout: the nested part
[09:06:00] rvanlieshout: halik: input = $(container).append("<input type='hidden' name='image[file_name]' />")
[09:06:00] yza: thanks for hand feeding me :-/
[09:06:11] rvanlieshout: $(input).attr('value', #{filename.to_json})
[09:06:19] rvanlieshout: i don't know what .append returns thoug
[09:06:21] yza: barely got energy and just need to finish this last part gonna read doc ill be back if not im passed out on the keyboard
[09:06:31] yza: rvanlieshout :)
[09:06:46] rvanlieshout: it's a small part of the doc
[09:06:59] halik: @rvanlieshout: this is in JS though (coffeescript), `filename.to_json` returns me undefined
[09:07:13] halik: Should I just remove the .to_json?
[09:07:28] rvanlieshout: halik: where is that #{} executed?
[09:07:48] halik: in coffeescript
[09:08:03] rvanlieshout: and where does that filename come from?
[09:08:07] yza: rvanlieshout lol i read this section twice in the last hour :-/ might need to take a nap
[09:08:39] rvanlieshout: yza: respond_with [@parent_object, @nested_object]
[09:09:02] halik: @rvanlieshout returned by filepicker (www.filepicker.io)
[09:09:02] yza: didnt catch that i seriously read it 4x now
[09:09:11] yza: got it, gonna put it in my notes so i can remember tomorrow
[09:09:30] rvanlieshout: halik: aah.. but if this is in js, why the #{}?
[09:09:52] halik: @rvanlieshout Just using what coffeescript has. Hehe.
[09:10:16] rvanlieshout: what do the docs say about #{}? does it format anything?
[09:11:58] halik: I'm not sure??? Just got it here http://coffeescriptcookbook.com/chapters/strings/interpolation
[09:12:18] rvanlieshout: in that case just use .attr('value', filename)
[09:13:01] halik: Alright. Trying it out. So no need for a .to_json or something familiar to it in javascript?
[09:13:16] rvanlieshout: no, but you should not create a string of it yourself
[09:14:39] sheeny: Hi all.. I am getting a byte array for a PDF back from a web service and I need to output this as a pdf to a user but not save the file. What's the best way to do this? I've looked at wicked_pdf but there doesn't seem to be a way to pass a byte array to it
[09:14:45] bhertach: For my rails app, I have following errors displayed in the firefox console
[09:14:45] bhertach: SyntaxError: missing } in compound statement application.js:29587
[09:14:45] bhertach: ReferenceError: Ajax is not defined new:199
[09:14:45] halik: What do you mean by "create a string of it yourself"?
[09:14:45] bhertach: ReferenceError: Ajax is not defined
[09:14:59] bhertach: I've found that in my local environment, the application.js file is only loaded partially. Any ideas why?
[09:15:04] rvanlieshout: sk87: if you already have the byte array you only have to set the content type
[09:15:23] rvanlieshout: halik: to use that #{} or any other method to get it within some other string
[09:15:36] bhertach: The application.js file just stops being loaded at some random point
[09:15:58] rvanlieshout: bhertach: also in development?
[09:16:06] rvanlieshout: did you incldue anyting that defines Ajax
[09:16:11] bhertach: rvanlieshout: only in development
[09:16:16] halik: @bhertach So meaning I shouldn't use that (#{}) or only for this case (filenames)?
[09:16:38] rvanlieshout: halik: you shold almost never use that.. it's potentially unsafe
[09:16:42] bhertach: rvanlieshout
[09:16:44] bhertach: <%= text_field_with_auto_complete :job, 'postcode', {:size => '20', :class => 'textbox', :autocomplete => 'off'},
[09:16:44] bhertach: {:after_update_element =>
[09:16:44] bhertach: "function (ele, value){
[09:16:44] bhertach: new Ajax.Request('/jobs/data_loader/' + encodeURIComponent(value.innerHTML),{
[09:16:44] bhertach: asynchronous:true,
[09:16:44] bhertach: evalScripts:true,
[09:16:45] bhertach: parameters:'authenticity_token=' + auth_token
[09:16:45] rvanlieshout: set a value of an input using .attr
[09:16:46] bhertach: return false;
[09:17:40] wasamasa: bhertach: use a pastebin like http://gist.github.com next time
[09:18:07] bhertach: rvanlieshout: will use a pastebin next time. can you make an example for that .attr?
[09:18:20] rvanlieshout: bhertach: that .attr wsa not for you :)
[09:18:33] rvanlieshout: bhertach: but you're using Ajax.Request there. Included anything that provides support for that?
[09:18:48] bhertach: yes, I use the Prototyp Library
[09:19:27] bhertach: rvanlieshout: the strange thing is, on staging and production, it works
[09:19:33] rvanlieshout: and you can prove it's loaded? Cause an error where Ajax is undefined would say it's not
[09:20:39] bhertach: rvanlieshout: when i display the source, it shows <script type="text/javascript" src="/assets/application.js"></script>
[09:21:02] yza: rvanlieshout I made about 1000 errors trying to get that done
[09:21:24] yza: but i did it.. i assumed by before action set my strain but it wasnt set for strain
[09:21:33] yza: I had to load up the console and test create/build
[09:21:38] yza: was like hmmm
[09:22:02] bhertach: rvanlieshout: and theres the problem??? when I enter mylocanenv.domain/assets/application.js, it displays only a part of the whole applications.js??? which would explain the "not defined" error
[09:22:08] yza: rvanlieshout your are a gentleman and a scholar
[09:22:15] yza: your are lol :(
[09:22:17] yza: you are
[09:22:27] yza: thanks im headed to bed i can barely function
[09:22:32] rvanlieshout: yza: good night
[09:22:39] yza: goodnight
[09:22:41] rvanlieshout: bhertach: that could explain that
[09:22:58] bhertach: rvanlieshout: bt I have absolutely no idea why its only loaded partially
[09:27:52] rvanlieshout: hm.. nothing special in the end of your application.js?
[09:28:20] dvdchr: Guys, if I'm not mistaken I read an article a while ago that there's a "cheaper" alternative to `.present?` method. Is this correct, or is it just me?
[09:28:41] rvanlieshout: dunno.. would also matter on what you call it
[09:32:47] bhertach: rvanlieshout: will try to remove certain lines in the application.js, lets see...
[09:33:28] waseem_: dvdchr: What are you calling it on?
[09:34:40] dvdchr: ActiveRecord object.
[09:36:22] waseem_: dvdchr: In that case the object will be either nil or an object of the AR class. For nil it is false and for the object, it's true. I don't think there could be anything cheaper than that.
[09:36:36] bhertach: rvanlieshout: got it. in dev environment used non-compressed assets, staging and production (on which it worked fine) used compressed assets. Now I also compressed the assets on dev environment, and it works??? super strange that non-compressed js is not working correctly
[09:37:01] rvanlieshout: you should not have compressed assets in dev
[09:37:09] rvanlieshout: remove that folder that contains them
[09:44:44] joy4u: how to update Devise account without password in polymorphic association
[09:45:19] xsannyx: Hey! I am creating a news feed for my Rails app. I have Users that can post questions and tag them. You can follow specific tags, questions and users. I have created the news feed with the following code: http://pastie.org/9482621 This is not really efficient and it does not work with will_paginate, so I used the following method: http://pastie.org/9482620 The problem here is, that I cannot get all the questions that are tagged with
[09:45:19] xsannyx: tags that users follow. I am using acts_as_taggable_on. Any suggestions?
[09:45:35] rvanlieshout: joy4u: the same as with a normal association?
[09:45:49] joy4u: but not woking
[09:46:30] rvanlieshout: then you're not doing it right
[09:47:24] joy4u: ok i am psting the code please have a look
[09:49:50] dvdchr: waseem_: thanks!
[09:50:57] joy4u: rvanlieshout: https://gist.github.com/himadriganguly/92176ee62fdc1d09c7a1
[09:52:36] rvanlieshout: joy4u: so what have you tried?
[09:53:22] joy4u: i tried @teacher = User.find(current_organiser.id)
[09:53:34] joy4u: still not working
[09:54:47] rvanlieshout: joy4u: don't wine about that 'not working'.. it's not helping
[09:54:53] rvanlieshout: and define 'not working'
[09:55:45] joy4u: rvanlieshout: it is giving undefined method `update_without_password'
[09:58:18] joy4u: what will be this line @teacher = User.find(current_user.id) or @teacher = Teacher.find(current_user.meta.id)?
[09:58:58] joy4u: but if i use any one of them then the other will not update
[09:58:58] rvanlieshout: that error didn't happen on that line
[10:00:10] joy4u: then will i have to update the two seperately?
[10:06:10] joy4u: rvanlieshout: have got anything?
[10:06:53] rvanlieshout: no.. the problem is not clear
[10:06:58] rvanlieshout: so nor is the solution
[10:08:24] halik: @rvanlieshout It works so far. Tried it with random characters. Thanks!
[10:08:28] joy4u: just want to update Teacher attributes which contains fields of teacher model and also the filed of user model as it is using polymorphic association
[10:13:30] joy4u: rvanlieshout: have you understand the problem?
[10:16:38] rvanlieshout: joy4u: using accepts_nested_attributes_for?
[10:19:36] mikecmpbll: is there any gem anyone knows of that will produce a data structure of associations in an app, for instance: [ { posts: [ :user, :category, comments: [ :user ] ], categories: [ :posts ] } ]
[10:19:49] mikecmpbll: just about to implement it myself with reflection and thought i could save myself an hour or two :p
[10:38:15] tagrudev: mikecmpbll, did you find a gem ?
[10:38:36] waseem_: mikecmpbll: What do you want it for?
[10:38:38] mikecmpbll: tagrudev: nope. i started looking in the railroady gem which graphs your models
[10:38:45] mikecmpbll: but i got bored and started doing it myself.
[10:39:02] mikecmpbll: waseem_: i'm writing a gem that dups an entire app's data in memory, heh.
[10:39:25] waseem_: mikecmpbll: Hmm sounds interesting.
[10:39:43] mikecmpbll: yeah, we have a need to merge two tennant databases
[10:40:33] mikecmpbll: easiest way for me seemed to just dup everything into AR objects and change connection then save everything
[10:40:38] tagrudev: http://stackoverflow.com/a/481630/677024
[10:40:40] mikecmpbll: all associations remain in tact but everything gets new IDs
[10:40:44] tagrudev: and that rake task won't do ?
[10:41:03] pyemkey: I need your advice. How can I simplify this kind of statement conditions[:city] = company_params[:city] if company_params[:city].present? && company_params[:city] != "All locations"
[10:41:13] mikecmpbll: tagrudev: nah needs to be rails model association names
[10:42:32] tagrudev: pyemkey, I don't see a problem in that statement
[10:43:23] mikecmpbll: just improve your model code so that it'll accept nil, and improve your form code so that when all locations is selected it doesn't send a param ;)
[10:44:20] pyemkey: I have 4 more lines where difference is inside key param and "All .."
[10:44:37] pyemkey: tagrudev: and don't think so it looks cool
[10:44:42] mikecmpbll: as above ...
[10:45:01] waseem_: pyemkey: It's fine. Don't be paranoid about it. :)
[10:45:40] tagrudev: well if you can edit the models I would do as mikecmpbll said
[10:45:42] pyemkey: waseem_: But my line contains over 80 signs :)
[10:46:07] waseem_: pyemkey: It's okay. We're not living in the 80s our screens are wide enough to show more characters per line.
[10:46:44] mikecmpbll: pyemkey: is it a search or something?
[10:47:21] pyemkey: mikecmpbll: Yes, its for search filter facets.
[10:48:07] mikecmpbll: i use a simple pattern for getting rid of some of that chaff associated with optional parameters and the like, explained here ... : http://www.wordofmike.net/j/easy-active-record-search-pattern
[10:48:25] mikecmpbll: might be related, if not, ignore ;).
[10:50:43] mikecmpbll: unless you were the person who asked an almost identical question a couple of weeks ago in which case i probably already mentioned that.
[10:51:32] pyemkey: mikecmpbll: Yes, you are right but I forgot to bookmark your blog post :(
[10:52:52] mikecmpbll: TIL that you can do case foo; when String, Symbol, SomeOtherClass
[10:52:55] mikecmpbll: and it'll match on any of them.
[10:54:01] workmad3: mikecmpbll: might be worth noting somewhere that for rails 3 you'd want to do arg.present? ? send(name, arg) : scoped instead
[10:54:23] workmad3: mikecmpbll: might even be needed for rails 4.0 (but I think .all is correct in 4.1)
[10:54:54] mikecmpbll: workmad3: true! i'll add a note thanks.
[11:19:33] joy4u: expect(flash[:notice]).to have_content(msg) in rspec giving error
[11:20:53] tbuehlmann: joy4u, and you want to get rid of it?
[11:21:36] joy4u: tbuehlmann: what?
[11:22:29] tbuehlmann: you just wrote that something is raising an error
[11:23:32] joy4u: tbuehlmann: so what is wrong in the code?
[11:24:23] tbuehlmann: I neither see any corresponding code nor the exact error. do you have a link with just the stuff we need to know?
[11:26:58] joy4u: tbuehlmann: the error is undefined method `flash' for nil:NilClass
[11:27:53] tbuehlmann: looks like you don't have a flash method
[11:28:18] tbuehlmann: assuming you're in a controller test, what version of rspec are you using and how does your spec file look like?
[11:33:20] walidvb: i have users that have a referral_token, and paths that are like /referral/:token . can I use a helper to do smth such as referral_path(my_user) ?
[11:33:54] xsannyx: I have created a "newsfeed" in my rails app where users can follow other users and also they can follow differend tags (topics) and different questions. I display their newsfeed with this code: http://pastie.org/9482801 The problem is that is doesn't work without the .joins at the beginning, but that .joins adds this massive query here: http://pastie.org/9482805 is there any way to fix that?
[11:39:15] xsannyx: Oh and this is the query without the .joins http://pastie.org/9482814 (it returns PG::UndefinedTable: ERROR: missing FROM-clause entry for table "tags" because I don't select it FROM tags)
[11:41:09] Hates_: xsannyx: just as a first glance it seems terribly complicated for what should be an easy problem
[11:41:18] Hates_: xsannyx: having to drop down into arel etc
[11:41:33] xsannyx: I dropped into arel so I could use .or
[11:41:40] xsannyx: Is there a more efficient way to do it?
[11:42:30] xsannyx: The real problem is that users can also follow tags. This is a many to many relationship (questions <->taggings<->tags) and it complicates my query a little bit.. I could really use some help
[11:43:02] Hates_: xsannyx: I've used Redis for timeline stuff in the past but that probably doesn't help you
[11:43:41] Hates_: xsannyx: but I would probably have a timeline model which then just records stuff with a polymorphic association, but that might have other problems associated with it too
[11:54:03] arrowcircle: hi! i have a complex sql query in my method https://gist.github.com/arrowcircle/3ae43824ba18b88aa2bb . It works good, but it returns array, that have problems with pagination. Kaminary pagination of array works fine, but it loads all results into memory. Is it possible to convert my query to return activerecord relation?
[11:56:04] mikecmpbll: arrowcircle: pass your SQL snippets to the appropriate relation methods
[11:56:21] mikecmpbll: joins(join_sql).where(conditons)
[11:56:23] mikecmpbll: for instance.
[11:56:49] arrowcircle: mikecmpbll, can i pass raw sql to joins method?
[11:57:16] arrowcircle: mikecmpbll, thanks man!
[12:02:17] jsrn: When validating model changes, is it better to use before/after callbacks, or override the destroy (for example) methods, and call to super after validations?
[12:02:38] jsrn: Is there any convention either way?
[12:06:03] xsannyx: I dug into my problem a little deeper and found that the query from before is still nice. It added a proper inner join and it also selects the questions with tags that the user follows. The messy query is in fact an extra querys selecting all the data for a reason I do not know. (http://pastie.org/9482863 here is the proper query, and here is the query that gets executed for some unknown reason : http://pastie.org/9482805)
[12:06:21] xsannyx: Does anyone know why .joins creates this extra query?
[12:07:51] walidvb: i have users that have a referral_token, and paths that are like /referral/:token . can I use a helper to do smth such as referral_path(my_user) ?
[12:24:00] workmad3: walidvb: referral_path(token: my_user.referral_token)
[12:24:44] walidvb: workmad3: ok. i was wondering if there was a way of passing the user, but obviously this works too. duh.
[12:26:23] workmad3: walidvb: I think there are ways to get the route helpers to automatically pick things up, but once you've moved away from using :id, I always find it's easier to just be explicit :)
[12:27:19] walidvb: true, it's just 4 extra characters anyways
[12:32:15] workmad3: walidvb: errr.... 22 extra characters...
[12:32:37] workmad3: walidvb: unless you've got much shorter names than you indicated ;)
[12:32:48] walidvb: yeah, i don't have my calculator with me :P
[12:34:18] workmad3: walidvb: you can't just count by hand? :P
[12:34:33] walidvb: -.- joke..
[12:34:49] walidvb: took you a long time, too, btw..
[12:35:29] workmad3: walidvb: yeah... that's because I was looking at another IRC window ;)
[12:46:05] sheeny: Hi, anyone know how to write a byte array to a file to make a pdf? It keeps failing but I can't quite tell if its the byte array or just my code, If I open and read another pdf it works but when i try with the byte array I am passed it doesnt work. The byte array looks like this: "JVBERi0xLjMNC..."
[12:47:52] rleu: Anyone know how to test carrierwave backgrounder? I got it to increment delayed jobs by one when i save but when i start the jobs nothing actually happens so idk where the saved object is being added
[12:59:40] shlomo: Can I return html to an Ajax request? I am trying to return some html for the javascript code to put inside an element, but the response Content-Type is text/javascript. I'm using respond_to and format.js in my controller
[13:00:31] tagrudev: in your respond block render the html
[13:02:22] shlomo: tagrudev: I am: format.js { render "_status_form" } . But I get "Unexpected token <" in the Javascript console in Chrome, probably because the Content-Type of the response is set to text/javascript
[13:02:54] tagrudev: format.html
[13:04:21] shlomo: tagrudev: thanks
[13:21:40] microdex: is it possible to do has_many as: :something, through: :something ?
[13:33:20] jsrn: Is it customary to prefix helper methods with the helper name when calling them?
[13:33:35] jsrn: I.e. CustomerHelper::formatted_address rather than just formatted_address?
[13:33:56] jsrn: Seems like it makes it easier to tell where code is coming from, but I don't know what the convention is
[13:59:46] tagrudev: so it's not Friday but Monday is almost over, it's something
[14:07:00] banisterfiend: is there a more idiomatic way of writing this in rails 4? validates :bio, allow_nil: true, length: { maximum: MAX_BIO_LENGTH }, message: "must be #{MAX_BIO_LENGTH} characters or less"
[14:07:53] waseem_: banisterfiend: That looks okay.
[14:08:16] banisterfiend: waseem_ i was thinking there was a way of setting the message without an explicit call to message:
[14:09:18] waseem_: banisterfiend: There's none that I know of. Why do you want to do it that way?
[14:10:33] banisterfiend: waseem_ i just wanted to do what's idiomatic, tbh
[14:10:47] waseem_: banisterfiend: That is idiomatic enough.
[14:16:30] Macaveli: What sitemap generator do you guys use?
[14:21:31] banisterfiend: waseem_ do you have experience with hstore?
[14:21:41] waseem_: banisterfiend: Nope.
[14:23:25] workmad3: banisterfiend: the message can go into I18n translations
[14:23:58] banisterfiend: workmad3 btw; def bio: data['bio']; end and then validates :bio didn't appear to work
[14:24:18] _bart: I have a question about simple_form nesting, I need to create a checkbox that creates a connection when checked, between Profile and Keyword, see the setup here: https://gist.github.com/anonymous/c0fbf659edc377bc389b
[14:24:26] workmad3: banisterfiend: how did it fail?
[14:24:31] CorySimmons: What's the best way to make a link_to that contains an image tag AND a span with some text?
[14:24:34] banisterfiend: workmad3 just appeared to ignore the validation altogether
[14:24:37] banisterfiend: workmad3 no errors
[14:24:43] CorySimmons: Can link_to do that on it's own or do I need to make a helper?
[14:25:01] banisterfiend: workmad3 https://gist.github.com/e58b8eb63ea9188495c8
[14:25:05] _bart: I have a random set of keywords, but the connection is made with ProfileKeyword instances, so I'm kind of confused on how to make this work
[14:26:02] stef1a: i'm trying to find the easiest way to implement dynamic surveys / forms into an app. (i have evaluations whose templates (set of questions and question types) i want admins to be able to edit if they decide they want to change how the evaluations are given, and i don't want to migrate the db each time an admin wants to change a field in the evaluation form. how can i accomplish this? is there a gem that will let me do this easily?
[14:26:43] epochwolf: stef1a: So just make form fields a database table
[14:27:37] stef1a: epochwolf: right, but then i'd also need a table full of the answers to those questions, right?
[14:27:48] epochwolf: stef1a: I guess.
[14:27:57] stef1a: i guess i would only need three tables: evaluations, evaluation_questions (which acts as the template?), and evaluation_answers
[14:28:00] workmad3: banisterfiend: hmm... so it's allowing through larger than MAX_BIO_LENGTH bios?
[14:28:18] workmad3: banisterfiend: and I assume maxim.um is a typo, not in your actual code, yes?
[14:28:25] stef1a: or would i need a fourth, evaluation_template, which has the evaluation_questions?
[14:28:26] banisterfiend: workmad3 yeah, typo (not my acutal code)
[14:28:39] stef1a: or, alternatively, is there a gem that can handle that sort of stuff for me?
[14:29:07] _bart: CorrySimmons: I'd say a helper is needed, since it's no longer one tag
[14:31:32] _bart: CorrySimmons: you can also do a yield/block with link_to
[14:34:10] banisterfiend: workmad3 wait, i'm an idiot
[14:34:48] workmad3: banisterfiend: what did you do wrong? :P
[14:35:34] reynscem: workmad3 I have /q'd you
[14:35:50] stef1a: if i'm using postgresql, couldn't i also use hstore?
[14:36:15] workmad3: reynscem: and I have ignored it as I don't respond to unsolicited pms :P
[14:36:22] stef1a: i know storing hashes in database tables is generally frowned upon, but hstore seems like a decent alternative, and i wouldn't have to make three or four extra tables...
[14:36:38] stef1a: oh wait, it wouldn't work anyway, since i need to store types as well... never mind
[14:37:50] workmad3: banisterfiend: btw, your message can be done as the translation 'activerecord.errors.models.user.attributes.bio.length.too_long' with the text 'must be %{count} characters or less'
[14:37:58] wmoxam: stef1a: storing hashes is fine as long as you're aware of the limitations
[14:38:08] banisterfiend: workmad3 the limit was 250
[14:38:11] stef1a: wmoxam: how can i find out about those?
[14:38:14] banisterfiend: workmad3 i was giving it just 100 chars
[14:38:18] workmad3: banisterfiend: idiot :P
[14:38:20] banisterfiend: i mindlessly assumed the limit would be 100
[14:38:29] defswork: stef1a, I did a survey website - I serialized the answers as a hash
[14:38:30] banisterfiend: workmad3 then my second mistake was using validate instead of validates
[14:39:00] reynscem: workmad3 - that's fair (I am fairly unaware of IRC etiquette), however you do know me (charlie)
[14:39:04] wmoxam: stef1a: http://apidock.com/rails/ActiveRecord/Base/serialize/class
[14:39:11] CorySimmons: Sorry, had to run to restroom. Did anyone reply to my question earlier?
[14:39:14] workmad3: reynscem: oh, sorry, didn't recognise the handle :)
[14:39:41] stef1a: defswork: how would you include the field types, though? each key-value pair might as well be an array formatted like [:question, :field_type, :answer]... but i could see that becoming tricky... you might need to store arrays in the answer... i dunno
[14:39:55] reynscem: workmad3 no problem, it's my first time here naturally
[14:40:05] defswork: stef1a, the field types are table driven from the survery definition
[14:40:17] stef1a: defswork: what do you mean?
[14:40:35] workmad3: reynscem: general IRC etiquette is to ask in-chan if you can PM before doing it btw... especially on free help channels ;)
[14:40:43] CorySimmons: I need a link_to that has a class assigned to it, and image inside, and a span tag with text inside. Any suggestions on how to do this?
[14:40:44] defswork: you create a survey, add questions, question types (multiple choice, free format etc..) all database driven
[14:41:29] defswork: the answers though were just {question_key => answer } stored serialized
[14:42:04] defswork: presenting it depended on the survery definition to know the types etc..
[14:42:04] stef1a: how does it infer the question types, though?
[14:42:06] reynscem: workmad3 I will keep it in mind - may I pm? :P
[14:42:17] workmad3: go for it :)
[14:42:23] stef1a: defswork: it's that last part i don't get. how did the "survey definition" work?
[14:43:47] defswork: Survey has_many sections, sections has_many questions, questions have types, and type related data. I stored multiple choice prompts etc.. in serialized hash also
[14:44:28] sonvu_ae: i'm newbie to rails and i'm implement website with 3 kind of user "guest" "user" "admin user" with devise
[14:45:03] sonvu_ae: and i want to enable registration but i want to set role of user when sign_up
[14:45:27] sonvu_ae: anybody know how to solve this?
[14:47:06] reynscem: sonvu_ae: Using before_validation, or before_save call a method which sets self.role (or similar) to your desired value
[14:47:39] sonvu_ae: where do i have to put before_validation?
[14:48:24] sonvu_ae: oh i see must put it in the model
[14:48:28] sonvu_ae: i will try thanks you
[14:50:25] reynscem: sonvu_ae No problem, good luck
[14:54:07] sonvu_ae: it works thank reynscem
[14:54:28] reynscem: sonvu_ae no problem
[14:55:41] Satureja: hello, I want to learn my first programming language, is Ruby on Rails a good choice?
[14:56:36] workmad3: Satureja: well, apart from Ruby on Rails being a framework, not a programming language (the language is Ruby, not Rails)
[14:56:38] reynscem: Satureja: Ruby on Rails is not a programming language, it is a framework built on the language Ruby. While it is highly subjective which language is a good first one, generally people do not say Rails
[14:56:40] dllama: i'm trying to come up with a caching strategy for what i feel would be expensive queries, in my app, i'm loading the events calendar, todo list, and tickets, etc on every page load. so i'm trying to come up with an effective caching strategy, what i have happening right now is that i had an after_save action that would basically create a new array (lets say for tickets model) which i'm writing to cache as a json string.
[14:57:37] reynscem: Satureja: Many people recommend Python, and there are some good and easy tutorials for it online. reddit.com/r/learnprogramming has lots of resources and links you may find helpful
[14:57:56] workmad3: ewww, python :P
[14:58:11] dllama: i been at it for a few days now so i can't really tell if i'm being vague about it, but do you guys think i'm on the right track with it? what i started doing this morning is moving it to a seperate class entirely called cachestats, and in my after_save, i'm just hitting CacheStats.new(self.class.to_s).update_cache.
[14:58:24] donofrio: folks here is the error I'm getting when I run bundle in front of it...http://paste.debian.net/116189/
[14:58:25] reynscem: Yes, I don't like it either, but from a purely pedagogical point of view it may be a good plan. I have met a 9 year old who used Python...
[14:58:29] workmad3: ruby is fine as a first programming language... but I would recommend learning ruby separately from rails to start with, as otherwise you have a very large amount of stuff to learn :)
[14:58:39] dllama: i'm also thinking about moving it to a background job so not so tie up sockets on creates/saves for too long as the data set grows
[14:58:53] root3d: Satureja, depends on your priorities ?
[14:58:55] workmad3: Satureja: my last comment was aimed at your question btw :)
[14:59:09] mikecmpbll: dllama: rails has built in stuff for that.
[14:59:16] mikecmpbll: but other than that, seems like a reasonable approach
[14:59:18] Satureja: thanks a lot guys, so people tend to learn "Ruby" before "Ruby on Rails"? this sounds more logic now
[14:59:42] workmad3: Satureja: it's recommended to learn ruby before rails, and doubly recommended if you're new to programming
[14:59:44] root3d: donofrio, did you executed echo "secret_token: '$(bundle exec rake secret)'" >> config/settings.yml
[15:00:05] roelof: hello, when I want to ppen a new project on my arch based distro I see this error message : http://pastebin.com/zT7xCsdv
[15:00:05] Satureja: root3d: I have no preferences, I just do it for fun and knowledge.
[15:00:25] root3d: Satureja, project / job ?
[15:00:27] dllama: mikecmpbll: this is my first attempt at pushing more off to cache, has been really quick thus far, but i'm trying to think a few steps ahead and avoid possible bottle necks. i'm using dalli for this,
[15:00:48] donofrio: did that just now....
[15:00:52] Satureja: root3d: not even, I'm a marketing guy, but always had affinity with the true IT people :)
[15:00:53] donofrio: seems to have worked
[15:01:05] momomomomo: roelof: you need to install the gem spring
[15:01:20] momomomomo: roelof: "Could not find gem 'spring (>= 0) ruby' in the gems available on this machine."
[15:01:25] makerop: has anoyne bought multitenancy with rails
[15:01:28] makerop: by ryan bigg?
[15:01:35] roelof: momomomomo: just like this gem install spring ??
[15:01:46] workmad3: roelof: have you done a 'bundle install' in the project?
[15:01:47] momomomomo: typically, if your project depends on it, you should just run 'bundle install'
[15:01:47] mikecmpbll: dllama: the actual cache backend is all but irrelevant as rails has a generic cache interface
[15:02:05] donofrio: root3d: it worked http://paste.debian.net/116192/ (I think)
[15:02:06] momomomomo: makerop: I think I have, but I haven't read it through yet
[15:02:08] mikecmpbll: dllama: fragment caching with cache do .. end should be what you require.
[15:02:14] roelof: workmad3: nope, just did a rails new finance command
[15:02:19] makerop: momomomomo, was just curoius
[15:02:35] makerop: momomomomo, i bought it but havent gotten into it
[15:02:45] makerop: was curious if there is anything i should take into account as i read it
[15:02:46] root3d: donofrio, check by launching it .
[15:02:48] reynscem: Anyone able to help with a bundle / gem install issue please: Attempting to install webpffi fails with this -> ././jpegdec.h:3:25: fatal error: webp/encode.h: No such file or directory #include "webp/encode.h"
[15:02:52] dllama: https://gist.github.com/mvoloz/b9955d35214d1967e1e9 ??? this is a WIP but generally speaking thats where i'm at
[15:03:14] workmad3: reynscem: sudo apt-get install libwebp-dev
[15:03:15] momomomomo: makerop: there are also good railscasts http://railscasts.com/episodes/389-multitenancy-with-postgresql and http://railscasts.com/episodes/388-multitenancy-with-scopes
[15:03:27] mikecmpbll: like i say, you shouldn't need to roll your own, but if that floats your boat.
[15:03:32] root3d: workmad3, are you also bored with handling gem install / installation error queries here ?
[15:03:35] workmad3: reynscem: or google a suitable alternative for your package manager
[15:04:18] workmad3: root3d: somewhat, but I happen to know out-of-band that reynscem is setting up a project where I added webp stuff into the gemfile and didn't update the README :)
[15:05:21] reynscem: workmad3: thanks, it is now failing on a line further in. I will try and find the correct libraries myself
[15:05:40] root3d: workmad3, in general i meant
[15:05:53] workmad3: root3d: yeah, the 'somewhat' was in the general sense
[15:05:59] roelof: workmad3: a bundle install seems to do the job
[15:07:34] workmad3: root3d: it does make me wish we had a karma bot here though... 'install this dependency <...>' would be a way to easily get karma points :)
[15:07:52] stef1a: okay, i've finally decided i'm going to have three tables: evaluations, evaluation_questions, and evaluation_answers (or maybe question_answers). what should the associations be? i'm going to want build evaluations directly and feed them a list of questions, and later build answers for a specific evaluation through their respective questions.
[15:08:41] workmad3: stef1a: here's a question for you - how did you arrive at needing those 3 tables if you didn't consider what their associations were going to be?
[15:08:59] stef1a: evaluation has_many questions; question has_many answers?.. but each question can belong_to multiple evaluations
[15:09:17] stef1a: workmad3: i was roughly considering them along the way, but now i need to acutally implement them
[15:09:37] root3d: workmad3, yeah . Radar must have code that functionality in helpa for sure
[15:09:53] workmad3: root3d: nah, no karma bot in helpa
[15:10:25] workmad3: root3d: but he's open to PRs :) https://github.com/radar/railsbot
[15:11:38] mikecmpbll: as long as there's negative karma.
[15:12:38] workmad3: mikecmpbll: yeah, I'll need to be able to give you bad karma :P
[15:14:26] workmad3: Satureja: no unsolicited pms please
[15:15:14] drale2k: i have a pram key which is an dynamic integer (id), how can i permit that for attributes?
[15:15:23] drale2k: params key*
[15:15:46] tubbo: drale2k: what is a "dynamic" integer?
[15:15:59] drale2k: tubbo: it's created dynamically based on the id
[15:16:02] rhizome: outgoing and with-it
[15:16:05] helpa: drale2k: 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.
[15:16:05] momomomomo: drale2k: !code
[15:16:06] drale2k: i don't know it os i can't hardcode it
[15:16:57] momomomomo: also, why would an ID for something be the key?
[15:16:58] defswork: drale2k, permit is just declaring what can be mass assigned via update - if you have a param name - permit it
[15:17:07] tubbo: drale2k: so what you're saying is that the param key changes based on the form?
[15:17:37] tubbo: drale2k: is there a way you could make it not do that? that's a really shitty API design if you ask me.
[15:17:49] momomomomo: tubbo: defswork sometimes it's best to see code, and detect whether or not the implementation is not optimal, rather than throwing suggestions
[15:17:49] drale2k: tubbo: yeah i was thinking about that but i am not sure how
[15:17:51] drale2k: it is shitty
[15:17:56] helpa: drale2k: 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.
[15:17:56] momomomomo: drale2k: !code
[15:18:07] defswork: or at least add another parameter that is the key name
[15:18:30] drale2k: momomomomo: code what? You want me to post 300 lines of code completely out of context for you?
[15:18:36] defswork: then you can permit( params[:key_name] )
[15:18:43] drale2k: i looking to post the params though
[15:18:48] momomomomo: I want to see your model, and why you're using an ID as a key drale2k .
[15:19:05] momomomomo: and the controller
[15:19:06] drale2k: it's complicated, sec
[15:19:30] momomomomo: add any relevant information drale2k ; to create the context that would be missing if you just pasted the controller.
[15:19:32] helpa: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[15:19:39] momomomomo: we should have an !answer as well
[15:19:42] helpa: Incorrect.
[15:20:17] tubbo: heh, i'm not sure what you're going to accomplish by posting code
[15:20:26] tubbo: i know for a fact that his API design is a piece of shit
[15:20:36] tubbo: because he doesn't even know what params are being passed over
[15:21:01] waseem_: tubbo: Take a deep breath and rejoice that it's not your code. :)
[15:21:08] defswork: he came for help not a lambasting
[15:21:11] tubbo: i'm just saying, it's a waste of time
[15:21:28] workmad3: defswork: sometimes the best help is lambasting? :)
[15:21:42] tubbo: defswork: google helps. i make you a better programmer.
[15:21:57] momomomomo: Two issues: No one has seen the API yet; and you have to write bad code to get to write good code
[15:22:07] defswork: perhaps it's not his implementation ? perhaps its not his app posting the data ?
[15:22:07] momomomomo: also, tubbo IIRC you were writing really bad code earlier last year
[15:22:08] drale2k: THis is what the params looks like for 2 guests https://gist.github.com/drale2k/af7e942a53a196618c02
[15:22:23] tubbo: momomomomo: i write really bad code all the time
[15:22:28] stef1a: i accidentally created two plural models and then migrated. how can i get rid of them entirely? i tried rake db:rollback and rake d model [model name], but when i try to create the singular models, i get the error PG::DuplicateTable: ERROR: relation "plural_model_name" already exists
[15:22:35] momomomomo: drale2k: and they key you're wondering about is the '45' ? what does that stand for?
[15:22:42] tubbo: momomomomo: but i've been helping people out here, and writing in ruby, for about 5 years
[15:22:43] donofrio: Access denied for user 'dashboard'@'localhost' (using password: NO) (Mysql2::Error)
[15:22:43] donofrio: /var/lib/gems/1.9.1/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `connect'
[15:22:43] donofrio: /var/lib/gems/1.9.1/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `initialize'
[15:22:50] helpa: donofrio: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:22:50] momomomomo: donofrio: !gist
[15:22:52] tubbo: donofrio: first of all, don't paste
[15:22:57] drale2k: you can sign up a Group and you add group members (guests). What i do in the params i split them up into guest id's , which are keys like "45"
[15:22:59] donofrio: I know my bad
[15:23:05] tubbo: donofrio: second of all, pasting an error and going "?" is an asshole move.
[15:23:12] defswork: drale2k, you can't permit that - permit is purely to allow what can be mass assigned - you havent got an accessor called 45
[15:23:13] tubbo: donofrio: and thirdly, your db password is wrong
[15:23:15] donofrio: again hanging head
[15:23:19] momomomomo: drale2k: those should be passed in as parameters like 'groups'
[15:23:38] donofrio: but "using password: NO" is present?
[15:23:52] jhass: drale2k: it should look like {"guests" => [{"id" => 45, "time_slot_ids" => [..]}, {"id" => 46, ....
[15:24:00] momomomomo: drale2k: does a group have many guests?
[15:24:10] drale2k: momomomomo: yes many
[15:24:14] tubbo: donofrio: oh yeah, then i guess you need to pass the password :P
[15:24:19] drale2k: jhass: so basically just wrap them in "guests"
[15:24:29] momomomomo: drale2k: http://guides.rubyonrails.org/association_basics.html#the-has-many-association and http://guides.rubyonrails.org/association_basics.html#has-many-association-reference
[15:24:43] jhass: drale2k: I'd get rid of making the ids keys entirely, but that's the compromise
[15:24:46] momomomomo: please just don't toss int he fix without understanding what you're doing drale2k - read the docs I linked
[15:24:46] tubbo: donofrio: you haven't given me any context, though. so i can't really help you until you can show me how you got to this error in the first place.
[15:25:16] momomomomo: drale2k: if a group has many guests, then your form would send through the user ids of the guests to add to the group
[15:25:31] momomomomo: read the docs above, thoroughly - not quickly
[15:25:46] momomomomo: and also drale2k http://railscasts.com/episodes/47-two-many-to-many
[15:26:21] helpa: donofrio: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[15:26:21] momomomomo: donofrio: !ask
[15:32:08] momomomomo: sonvu_ae_: hello
[15:32:22] sonvu_ae_: i have an question
[15:32:32] helpa: ◉‿◉
[15:32:33] reynscem: sonvu_ae: ask away
[15:32:41] sonvu_ae_: why my User model with "before_save :set_role"
[15:32:50] helpa: sonvu_ae_: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[15:32:50] momomomomo: sonvu_ae_: !ask
[15:33:03] momomomomo: how do you not know why you rmodel is doing things? sonvu_ae_
[15:34:04] tubbo: sonvu_ae_: because you asked how to do it and that's what we told you to do
[15:34:05] sonvu_ae_: my User model with a method set_role "self.role= 'admin'"
[15:34:10] tubbo: sonvu_ae_: actually we told you to do before_validation :set_role
[15:34:40] tubbo: about 45 minutes ago
[15:35:14] sonvu_ae_: yeah, the point is i dont understand "set_role" method work
[15:35:29] tubbo: sonvu_ae_: you should probably do that.
[15:35:36] tubbo: sonvu_ae_: get to understanding it
[15:36:33] tubbo: sonvu_ae_: it's definitely not a method that rails came up with, probably part of your app and is specific to your app
[15:37:18] mikecmpbll: almost just lost 5 hours work with a copy paste error ????
[15:37:24] sonvu_ae_: tubbo: sorry if i asking question is out topic
[15:38:24] tubbo: sonvu_ae_: it's not off-topic, but consider what you're asking me: someone on your team (maybe you?) wrote a method, and now you're coming to me asking how it works
[15:38:29] tubbo: sonvu_ae_: how am i supposed to know that? ;)
[15:38:42] tubbo: sonvu_ae_: is `self.role= 'admin'` the way that the set_role() method is defined?
[15:39:08] reynscem: tubbo: he has written the method himself I believe
[15:39:36] sonvu_ae_: tubbo: yes it is, and not other one in my team, actually reynscem told me to do before
[15:39:51] tubbo: sonvu_ae_: okay, so what's the issue?
[15:40:10] stef1a: would it be clean to have: evaluation h_m questions, evaluation h_m answers; question h_m answers, b_t evaluation; answers b_t question, answers b_t evaluation?
[15:40:29] sonvu_ae_: tubbo: why need "self.role = :admin" but not "role = :admin"?
[15:41:05] tubbo: sonvu_ae_: because `self.role =` implies that you are calling the method 'role=', and simply `role =` is just setting a local variable in the method
[15:41:15] momomomomo: sonvu_ae_: you're showing a lack of understanding of rails models in general, I'd recommend reading through http://guides.rubyonrails.org/getting_started.html
[15:41:33] momomomomo: stef1a: out of context, that is gibberish
[15:41:49] tubbo: sonvu_ae_: http://www.ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/localvars.html is all about how variable scope works, in the first couple pghs
[15:42:22] tubbo: stef1a: why not evaluation has_many answers through questions? :)
[15:42:40] stef1a: tubbo: i'll look into it
[15:43:00] tubbo: i'm a big fan of linear, not circular, relations
[15:43:30] tubbo: stef1a: with that model, theoretically one could attach an answer to the evaluation that doesn't have a corresponding question
[15:43:32] stef1a: momomomomo: evaluations need to act as dynamic "surveys" or forms, so admins need to be able to modify their questions. when the evaluations are distributed to users, they fill them out and thus create new answers associated with their particular evaluations
[15:43:45] tubbo: because a question *always* has at least one answer
[15:44:11] stef1a: tubbo: that's not true; it's possible an evaluation hasn't been created with a new question
[15:44:32] stef1a: it is true that an answer always belongs to a question, though
[15:49:21] _bart: I'm using `f.collection_check_boxes(:profile_keyword_ids, column.values[0].compact, :id, :name)`, and it's generating all the correct checkboxes, but it's not checking them when there's already a link between profile and keyword, why?
[15:50:08] momomomomo: because you're passing it an array, not an association _bart
[15:50:43] momomomomo: _bart: http://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/collection_check_boxes
[15:52:43] _bart: momomomomo: it's an array of Keyword instances, just like Author.all in their example
[15:53:35] momomomomo: _bart: 'just like' is not the same.
[15:53:38] blackmesa: hi all. I use rails 4.1. In my console do I need to prepend 'spring ...' for rake/rails commands?
[15:53:38] _bart: momomomomo: some extra context: https://gist.github.com/bartolsthoorn/2a68787724f4f9ef5f74
[15:53:45] blackmesa: or is it automatically?
[15:53:53] _bart: momomomomo: could give me one more hint, I still don't see how to fix this
[15:54:03] momomomomo: _bart: pass in the relation, not the array.
[15:54:48] momomomomo: ah _bart actually
[15:55:14] _bart: momomomomo: I think the relations are lost here maybe: https://gist.github.com/bartolsthoorn/2a68787724f4f9ef5f74#file-_keywords-html-slim-L7
[15:55:15] momomomomo: if you're doing this for a Profile model
[15:55:43] momomomomo: you'd want: f.collection_check_boxes(:profile_keyword_ids, ProfileKeyword.all, :id, :name)`
[15:56:10] _bart: momomomomo: Ok but the simplified problem is this: https://gist.github.com/anonymous/c0fbf659edc377bc389b
[15:56:27] _bart: momomomomo: the thing is I cannot use ProfileKeyword.all, I have a bunch of Keyword instances
[15:57:25] momomomomo: the way you're doing it right now is telling rails to check if the profile_keyword table id is associated with the profile already
[15:57:29] rhizome: where is the 2, 4, 8 coming from?
[15:57:32] _bart: momomomomo: Obviously the `[Keyword.find(2), Keyword.find(4), Keyword.find(8)]` in there is just an example, but it shows my situation, I have a bunch of Keywords and now I need to create checkboxes for the relation between profile / checkbox (checked if there is a relation, uncheck if not)
[15:57:41] momomomomo: since that's just a join table, and it gets created when the profile is associated witha new keyword, that won't work
[15:57:53] momomomomo: ie: it checks the ID of the profile_keyword, not of the keyword itself.
[15:57:56] _bart: rhizome: it's just an example, to simplify the situation
[15:58:08] momomomomo: I believe you can resolve this with accepts_nested_attributes_for and doing a form for keywords directly
[15:58:18] rhizome: "where do the numbers you want in there come from" then
[15:58:23] momomomomo: _bart: http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html
[15:59:08] _bart: momomomomo: that doesn't show how to build the form out of form_for profile
[16:00:15] sonvu_ae_: hi tubbo i'm back, finally with your explain and after digging in google i understand my problem, it's hard to get what you and google explain because English not my primary language
[16:00:33] momomomomo: a good place to start (although a little old) _bart http://railscasts.com/episodes/196-nested-model-form-part-1
[16:00:47] momomomomo: gotta get back to my project though, good luck
[16:00:57] _bart: ok thanks
[16:01:03] justanotherrando: does anyone know of a strategy in Pundit similar to CanCan's `accessible_by` for scoping lists of records to those for which a user has permission?
[16:01:07] _bart: argh, complex forms, the hell of the web
[16:01:29] pontiki: form objects are your saviour
[16:02:03] _bart: ahhh they use fields_for, I tried that before, and since I'm using a manually assembled array of Keywords it's not really ideal
[16:02:29] pontiki: not that kind
[17:06:05] capin: im getting error on a contact form page i'm trying to build out. the error im getting is undefined method '[]' for nil:NilClass, my contact form looks like the following, https://github.com/ipatch/crj.com/blob/master/app/views/contact/index.html.erb
[17:09:21] rhizome: what line?
[17:12:47] xhoy: hi! what is the best js engine? therubyracer therubyrhino, nodejs?
[17:13:02] helpa: xhoy: "Best" and "better" are subjective. Try to use a different term.
[17:13:02] workmad3: xhoy: !best
[17:13:37] workmad3: xhoy: that said, I prefer using nodejs as it doesn't pollute my Gemfile dependency resolution and IMO gives better error messages on failure
[17:13:55] tbuehlmann: rails 4.1.5 \o/
[17:14:26] workmad3: xhoy: but if I was expecting quite a few people who weren't used to installing dependencies or setting up rails dev machines, etc. then I'd probably slap therubyracer in there to ease their setup time
[17:14:36] waseem_: workmad3: Is nodejs V8 based? Is this a valid question? :)
[17:14:39] goodbomb: anyone know how I can push an integer to a database array? Everything I do doesn???t update the database.
[17:14:41] xhoy: oke i had a feeling it was this complicated
[17:14:43] workmad3: waseem_: yes and no :)
[17:15:09] helpa: goodbomb: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[17:15:09] waseem_: goodbomb: !e
[17:15:18] workmad3: xhoy: avoid issues down the like... install nodejs and don't worry about it :)
[17:15:27] xhoy: workmad3: oke, that is what i had :)
[17:15:37] xhoy: i never new i had a choice
[17:15:46] xhoy: nodejs is the 'most' compatible :)
[17:16:32] waseem_: workmad3: Thanks for hanging out in thin channel. :)
[17:16:38] waseem_: s/thin/this
[17:16:43] workmad3: waseem_: yw ;)
[17:16:49] xhoy: no yw workmad3 !
[17:17:05] workmad3: waseem_: and with that... I'm off :P
[17:17:07] goodbomb: thanks waseem, I???ll make a gist and get back to you
[17:17:21] waseem_: workmad3: Aww! Long live the Queen.
[17:17:31] workmad3: goodbomb: btw, did you try using '+=' instead of '<<'?
[17:17:45] tewlz: hello frands
[17:17:54] aarkerio: hi! I have a validation rule: validates_uniqueness_of :email, message: ":non_unique_email" but If the user wants to save the same email when updating a row (I mean without changing his email) I got the validation error
[17:17:55] goodbomb: no, I read on stack overflow that that wasn???t supposed to work, I???ll give it a shot though
[17:18:26] workmad3: goodbomb: as the array, json and hstore support for postgres doesn't manage to catch dirty updates in all cases, especially ones that modify the in-memory data structure rather than re-assign it
[17:18:56] aarkerio: there is a way to tell to rails "this is the same email" don't validate ?
[17:18:57] workmad3: goodbomb: just make sure you do 'model.ary_attr += [my_int]'
[17:19:07] workmad3: goodbomb: or 'self.ary_attr += [my_int]'
[17:19:21] rhizome: aarkerio: if: attribute_changed?
[17:19:34] workmad3: goodbomb: it won't work if either 1) the int isn't in an array, or 2) you do it in a setter method and forget the 'self.'
[17:19:37] rhizome: not sure how that interacts with #create
[17:20:06] rhizome: aarkerio: meaning email_changed? activemodel::dirty
[17:20:21] goodbomb: workmad3: the integer wouldn???t be specificaly in an array
[17:20:30] goodbomb: it???s pulled from another model???s attribute
[17:20:35] workmad3: goodbomb: that's why I wrapped it in an array for the example ;)
[17:20:35] aarkerio: rhizome, thank you!
[17:20:47] workmad3: goodbomb: self.my_ary += [new_int]
[17:20:49] goodbomb: I???ll give it a go
[17:21:35] workmad3: goodbomb: if the new value could be already in an array, there's also the Array() method that will wrap a non-array in an array but not touch an array
[17:21:43] tewlz: Just curious, but I was taking a MOOC and they made a big deal about never lying for your clients user-agent....why is that such a big deal?
[17:21:45] workmad3: Array([]) => [], Array(1) => [1]
[17:22:04] goodbomb: ah, nice, I???ll try that in a moment as well
[17:23:26] waseem_: tewlz: What is MOOC?
[17:23:48] workmad3: waseem_: massively online open course
[17:24:15] waseem_: workmad3: Does is involve choosing a character?
[17:24:25] tewlz: waseem_: umm I forget what it stands for it's something like massive online something class
[17:24:27] workmad3: waseem_: I suppose you could create a MOOC persona...
[17:24:41] tewlz: open course, yeah that's i
[17:24:41] pontiki: remember: charisma is a dump stat
[17:24:44] workmad3: waseem_: it's not required though
[17:24:59] greenride: Is there any tool or command to print the request object in a more human readable way? I am at a pry prompt that was entered with a 'binding.pry' statement inserted ina a controller.
[17:25:08] waseem_: workmad3: Sounds more nerdy than I actually am.
[17:25:16] dllama: how do you convert a string into the name of a method to call it inside a model?
[17:25:24] workmad3: right, I really need to go now
[17:25:39] dllama: is send the best way or there are alternatives?
[17:26:42] pontiki: greenride: you might try the awesome_print gem
[17:27:06] waseem_: dllama: There was something called public_send.
[17:27:37] waseem_: dllama: Yes there is it. http://apidock.com/ruby/Object/public_send
[17:28:08] goodbomb: workmad3: didn???t seem to work. I made a gist here: https://gist.github.com/goodbomb/83cb35c99ab853a84cf1
[17:28:13] waseem_: greenride: You can try request.to_yaml.
[17:29:25] yza: goodmorning everyone
[17:29:36] goodbomb: I???m trying to insert IDs into that ???supporters??? array in the database. I???d prefer not to use an association simply because all I need are a couple of IDs
[17:29:37] dllama: thanks!, for now send([@klass, "_array"]) seems to be working
[17:29:48] dllama: i forgot to add .join
[17:29:55] waseem_: goodbomb: You are not saving the User after changing it.
[17:30:03] goodbomb: oooooh, right
[17:30:27] greenride: waseem_: What do I type? 'request.to_yaml' ?
[17:30:35] waseem_: greenride: Yes.
[17:31:11] greenride: waseem_: I get the error message, 'can't dump anonymous module'.
[17:31:21] waseem_: greenride: Usually you should try to find out specific information that you're looking for when debugging. But inspecting is also way to go.
[17:31:56] waseem_: greenride: Don't know how to fix it.
[17:32:11] goodbomb: waseem_: I updated the gist, but the save isn???t changing anything. https://gist.github.com/goodbomb/83cb35c99ab853a84cf1
[17:32:26] greenride: waseem_: Thanks for trying
[17:32:40] greenride: waseem_: I'm going to try out the awesome_print suggestion.
[17:33:12] pontiki: i'm going to guess awesome_print will fail the same way
[17:33:37] waseem_: goodbomb: You're doing it wrong buddy. That expression wont return a User object. It'll return the array. Try it `u = User.find(@cause_id); u.supporters += Array(@business_id); u.save!`.
[17:34:35] waseem_: goodbomb: I'm surprised it does not throw an error.
[17:34:50] danielpclark: Which is the best practice. To store API keys in the config/initializers files or in your environment ENV[MY_API_KEY] = the_key ?
[17:34:51] goodbomb: thanks, I???m still learning Rails :)
[17:34:58] waseem_: goodbomb: Anyways, when doing such stuff it's usually good practice to try it out in console first. :)
[17:34:59] goodbomb: only been at it a couple of weeks
[17:35:22] helpa: danielpclark: What you just asked could be classed as subjective. Subjective questions often start flamewars, which are tedious and boring. Try all the available options and see which one suits you the best.
[17:35:22] waseem_: danielpclark: !subjective
[17:35:35] pontiki: danielpclark: the new way is use the config/secrets.yml file, and inject your production-level keys via envars
[17:37:04] danielpclark: I've noticed I've been getting a little of one way, and a little of the other. I was thinking I should stick with just one method rather then having inconsistent patters.
[17:37:23] waseem_: danielpclark: That is a good thought.
[17:37:52] bricker`work: good thought indeed
[17:38:48] yza: argh i been scouring stackoverflow and googling could someone give me a example of posting additional attributes via json to a has many through association
[17:39:11] yza: before i just added object.collection_ids[1,2,3]
[17:39:26] bricker`work: yza: accepts_nested_attributes_for ?
[17:39:45] yza: would i need to do that for a many through association addtional details?
[17:40:46] yza: like i have a model/table with one_id and another_id somestring vlaue
[17:40:56] Trudko: Guys is there some debug console for rails as there is debug console for symfony framework? Some Web UI where you can see logs/ SQLs etc
[17:41:21] yza: trying to create a post in json to create that record with somestring value instead of just associating the two in the join table
[17:42:21] goodbomb: waseem_: it???s working now. Thanks!
[17:43:41] NemesisD: anyone having trouble updating to the latest rails patch? i can't get bundler to see the latest version
[17:44:49] tubbo: Trudko: yeah...it's pretty hard to guess though
[17:44:59] tubbo: Trudko: sometimes people can get to it with `rails console` :P
[17:45:35] tubbo: Trudko: there are actually 3 different places you can get that info: 1.) the rails app log in log/, 2.) the `rails console` which is effectively a REPL with your app pre-loaded, and 3.) the debugger or `pry`.
[17:45:54] tubbo: to initiate a debugger, do `require 'debug';debugger` wherever in your code you want to have a breakpoint
[17:56:18] yza: still not finding much
[17:58:01] railnubyist: I have an app with a route '<host>/locations' you can type '<host>/locations/<postcode>' and it will take you to that locations show action but can someone help me do this from a form? I want someone to type the postcode into a text box and on a button click it goes to this url?
[17:58:39] railnubyist: I do not want '?=' params etc.
[18:15:55] stef1a: i'm getting an AR ReadOnlyRecord error: https://gist.github.com/smlance/672d7385d4e60f37d276. i read online that it can be caused by using a join instead of an include, but i'm not explicitly calling join anywhere... help?
[18:16:49] stef1a: oh wait there is a joins
[18:17:29] waseem_: railnubyist: You should check it out http://stackoverflow.com/a/7624036/100466.
[18:25:24] tubbo: railnubyist: you could bind a JS function to the browser's "keyup" event for that <input>, then shove that into the end of an <a> tag that is on the page, so a user can basically type in text in that <input> and expect when the button's clicked, the window.location will be what they typed
[18:27:02] railnubyist: tubbo: nice idea
[18:27:03] alaing: HI I'm getting the following errors when i try generate a scaffold https://gist.github.com/aliuk2012/8c1bcbaabb4e96237568
[18:27:21] alaing: I'm a bit concerned it seems to be referring to ruby 1.9
[18:27:22] tubbo: alaing: you got Bundler installed? :)
[18:27:52] alaing: errr i' m sure i do let me check.
[18:27:55] workmad3: railnubyist: I'd personally have a normal text input with a JS change handler, when that files, it adjust's the form url submission to have the postcode on the end
[18:28:10] tubbo: alaing: `which bundle` should definitely point you to the ~/.rbenv dir
[18:29:01] railnubyist: Is it a bad idea to do routing this way?
[18:29:11] railnubyist: As it doesn't seem 'conventional'
[18:29:36] railnubyist: I always find myself going out of the box to do stuff in Rails and always worry I am missing the point
[18:30:27] railnubyist: My params show - {"action"=>"show", "controller"=>"locations", "id"=>"g27eq"} when I go to '<host>/locations/<postcode> and my controller takes the :id param and then finds the location by postcode
[18:30:52] railnubyist: If it returns nil I am rooting to the home page with a flash message
[18:30:55] tubbo: railnubyist: well if your app is totally "in the box", it's probably been done before, otherwise there would be no box for it to fit in.
[18:31:02] alaing: tubbo ah i've got bundle but its not point to rbenv
[18:31:28] tubbo: railnubyist: it's hard to say when you're doing something weird for a good reason (it's never been done before) or for a bad reason (ignorance of a better way to accomplish the same task)
[18:31:51] tubbo: railnubyist: that seems fine to me
[18:31:58] railnubyist: tubbo: guess thats where experience comes in to play more than anything really
[18:32:16] tubbo: railnubyist: some people use friendly_id for dealing with non-numerical IDs in the URL, but so far i've never needed it.
[18:32:35] workmad3: railnubyist: http://jsfiddle.net/oLau802u/ <-- there's a JS approach
[18:32:49] railnubyist: tubbo: heard about it, but didn't want to have to learn another thing
[18:33:06] tubbo: get used to it. programming is about 99% learning and 1% writing code.
[18:33:25] tubbo: if you stop learning, they'll stop paying you eventually :P
[18:33:28] workmad3: railnubyist: constructing a URL in JS is rather brittle though
[18:33:38] phat4life: sometimes ruby is frustrating because is soo high level
[18:33:50] phat4life: you can do some really inefficent things if you don???t think about it
[18:34:02] workmad3: phat4life: that's true in many a language
[18:34:10] alaing: how do i get bundle to point to the right installation, sorry complete newb
[18:34:17] workmad3: phat4life: I blame it on not thinking more than the language, personally
[18:34:20] waseem_: phat4life: You're right. Ruby is an abomination.
[18:34:31] phat4life: sometimes i wish i could use pointers in ruby
[18:34:47] tubbo: phat4life: you use pointers all the time in ruby
[18:34:50] tubbo: just not directly
[18:34:58] tubbo: i mean, ruby is built in C...there's gotta be at least 1 pointer in there
[18:35:01] workmad3: phat4life: you can... write a C extension :P
[18:35:14] tubbo: alaing: don't worry about it...even veterans have $PATH problems every so often
[18:35:15] phat4life: workmad3: i have looked at the c code for cruby, its crazy
[18:35:34] tubbo: alaing: it's pointing to the 1.9 install, right? try doing `rbenv rehash`.
[18:35:42] workmad3: phat4life: I'm not talking about forking the runtime codebase
[18:35:48] workmad3: phat4life: I mean using a native extension in a gem
[18:35:56] phat4life: i don???t get the satisfation of properly freeing all your memory with ruby
[18:35:59] tubbo: alaing: also try opening another terminal window so your $PATH resets, then navigate to the dir your project is in and try `which bundle` again
[18:36:00] phat4life: workmad3: i could
[18:36:03] workmad3: phat4life: or, more accurately, writing a native extension in a gem
[18:36:11] alaing: tubbo this is my $PATH /home/www/.rbenv/shims:/home/www/.rbenv/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/www/bin
[18:36:19] tubbo: phat4life: the idea that you're even cognizant of memory managemnt in ruby is quite hilarious
[18:36:27] tubbo: it's sorta like being aware of every single breath you take
[18:36:32] tubbo: waaay too low-level
[18:36:32] workmad3: phat4life: wow, if you get a thrill from freeing memory, then ruby is *not* the language for you :P
[18:36:41] tubbo: C is still an awesome language
[18:37:04] tubbo: and if you know C, and you love Ruby, then arm yourself with google translate and be a ruby superhero! (e.g. contribute to the lang itself)
[18:37:07] phat4life: i did a lot of grphics stuff in c++
[18:37:48] workmad3: phat4life: did you avoid decent smart pointers because they removed your thrill of memory management? :(
[18:38:26] workmad3: bratsche: evening
[18:38:39] bratsche: phat4life: Try Rust if you want something that feels a little closer to the metal.
[18:38:42] bratsche: Hey workmad3
[18:38:49] tubbo: alaing: try doing `rbenv rehash`
[18:39:14] tubbo: alaing: since ~/.rbenv/shims is in your path before /usr/local/bin, it should probably pick up the shim for `bundle`.
[18:39:40] railnubyist: tubbo: Getting an error on your fiddle in my app that 'function' is a reserved word
[18:39:53] workmad3: tubbo: does shims/ contain a wrapper for every gem binary installed? :/
[18:40:15] tubbo: workmad3: iirc, yes...except the ones installed by Bundler
[18:40:20] railnubyist: tubbo: it looked fine to paste in(other than using '/locations/' instead of '/postcodes/'
[18:40:32] workmad3: railnubyist: a) it's my fiddle, not tubbo's... b) that's plain javascript... I hope you're not trying to dump it into a ruby file or a coffeescript file
[18:40:36] greenride: I have a Rails model design question. I have a User, which would ideally be one model class. However, the information required for this model comes from a database and HTTP calls. I want to use an ORM and ActiveResource (for the HTTP calls). What's the best way to set this up?
[18:40:44] tubbo: workmad3: ruby != JS :)
[18:40:58] workmad3: gah, will people stop mis-highlighting :P
[18:40:59] railnubyist: workmad3: sugar sorry dude
[18:41:00] tubbo: workmad3: reason #349 why i don't use rbenv :P
[18:41:11] tubbo: i am also sorry
[18:41:24] workmad3: tubbo: heh :) are reasons 1-348 also basically 'shims directory is super-stupid'? :)
[18:41:31] tubbo: greenride: two model classes. one for your DB, the other for HTTP calls.
[18:41:42] alaing: hmmm still pointing to the local bin
[18:41:44] tubbo: workmad3: no, they're more like "made by sam stephenson" :P
[18:41:44] railnubyist: And yeah, I am dropping that into a coffee file, I thought it could handle that
[18:41:51] bratsche: greenride: You can write a class/method that makes the http calls and then does User.create with the response of that call.
[18:41:52] tubbo: buuuuuuuuuuuuuuuurn j/k
[18:41:54] workmad3: railnubyist: coffeescript != javascript
[18:42:06] tubbo: i actually have learned to love a lot of his code now
[18:42:12] railnubyist: Yeah I know that, but I thought Rails could handle JS in a CS file
[18:42:26] tubbo: railnubyist: coffeescript can't handle JS in a .coffee file, that's what is getting mad
[18:42:45] tubbo: has to get compiled at some point..
[18:42:47] greenride: tubbo: Two separate models? Why not a User model for the database part and a Module for the ActiveResource part and then mixin the module?
[18:43:02] workmad3: railnubyist: http://jsfiddle.net/oLau802u/1/ <-- there you go
[18:43:03] tubbo: greenride: well, when i do `user.name`, where does that information come from?
[18:43:04] workmad3: ACTION sighes
[18:43:17] alaing: tubbo: i did rbenv rehash
[18:43:30] greenride: tubbo: Rest API.
[18:43:36] alaing: tubbo: oppened another terminal tried again with no luck :-(
[18:43:39] greenride: tubbo: Or HTTP API.
[18:43:53] tubbo: greenride: yeah but how do *i* know that? :) i guess what really matters here is what the data is
[18:44:26] tubbo: getting data from an outside, networked resource such as an http api is a very different story than getting it from a local db server
[18:44:39] greenride: tubbo: Ideally, I don't want a user of the model class to be concerned with that information.
[18:44:51] tubbo: at some point, having one data model that amalgamates its data from multiple locations is going to bite you
[18:45:06] tubbo: greenride: how much data is stored locally vs. remotely?
[18:45:07] greenride: tubbo: Why will this bite me?
[18:45:16] greenride: tubbo: About half and half.
[18:45:41] tubbo: greenride: you're depending on the network for this user model's data, which is a classically unreliable resource
[18:45:41] greenride: tubbo: The portion from HTTP calls is internal.
[18:45:43] tubbo: your database is not
[18:45:55] tubbo: what does "internal" mean? oh, you mean it's another app on the same network?
[18:45:59] workmad3: tubbo: how about if the database isn't local? :P
[18:46:00] tubbo: that you're controlling?
[18:46:15] greenride: tubbo: Yes. It's another app on the network that I am controlling.
[18:46:22] tubbo: workmad3: the rails app will immediately blow up if it can't connect. i suppose you could test the connection on your http api as well.
[18:46:51] tubbo: greenride: oh well in that case you might have an easier time. TYPICALLY i encapsulate all of my network-calling logic in a class like MyNetwork::SomeModelName, and then i delegate methods to it within the data model
[18:47:06] workmad3: greenride: ^^ that's a good strategy anyway
[18:47:53] workmad3: greenride: and since you need to amalgamate, I'd suggest doing tubbo's suggestion for both HTTP and database, so your amalgamated model is only concerned with amalgamating from 2 data sources, not amalgamating a network source with database stuff it access directly
[18:48:34] tubbo: greenride: https://gist.github.com/tubbo/541fbd2c0708097e5775
[18:48:59] tubbo: hah...i'll have to remember that next time i have a problem like this, workmad3 :)
[18:49:26] workmad3: greenride: that also provides you with a better place to handle things like application-level error recovery (e.g. you provide a .save on the amalgamation model that does the HTTP save and only does the database save if the HTTP save suceeds, etc.)
[18:50:15] joelbrewer: anyone here familiar with Shopify application development? Just posted a question on their forums: https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/display-modal-window-right-before-checkout-page-208380
[18:51:13] tubbo: it's been so long since i worked on a shopify site
[18:51:37] workmad3: tubbo: it's an instance of the general idea of not mixing abstraction levels... accessing a data-source directly is at a different abstraction level to amalgamating data from data-sources ;)
[18:51:47] joelbrewer: tubbo: gotcha. It isn't a shopify site though, it's a Shopify app/plugin
[18:52:26] joelbrewer: tubbo: yeah.
[18:52:32] greenride: tubbo: In the code you sent, do you recommend using delegates to call Facebook::User methods from the User class/model?
[18:52:43] joelbrewer: tubbo: no worries though. just thought I'd check :)
[18:53:05] tubbo: greenride: you mean the `delegate` macro? yeah, i do that all the time. just had different naming conventions here
[18:53:59] greenride: tubbo: Why is that preferrable to making Facebook::User a Module and then mixing it into the User class?
[18:54:58] railnubyist: workmad3: Works great in the fiddle can see the alert, in app though all that happens is a '?' gets appended to the end of the root URL where I have the form
[18:55:40] stef1a: how do you dynamically create form fields by type? i'm trying <%= f.send(:type) :attribute %>, but this is giving me a syntax error
[18:55:41] workmad3: railnubyist: did you change the jquery selector attaching the handler to your input?
[18:55:41] tubbo: greenride: well one major reason i keep my http-api libs in a special module and separate them from the rails app is so i can easily package them up and extract them from the app if i need to share the client with another ruby app
[18:55:55] workmad3: railnubyist: because I just made up an id of 'postcode', which is unlikely to be the id you'll need
[18:56:07] BUTS`EEK`: To say semen in Yucatec Maya, you can say 'the atole that comes from the penis" or rather, "sa'il keep". another option is to say 'dick juice' or rather, "u ka'ab toon". Chimpout Forum encourages you to learn about Mayan culture with La Gruta del alux! http://www.youtube.com/watch?v=SPUHPcAWeEc
[18:56:07] BUTS`EEK`: Chimpout Forum is a multicultural and multiracial humanistic movement with the mission to combat the feral negroid beast! Join Chimpout Forum today! http://www.chimpout.com/forum
[18:56:40] railnubyist: workmad3: postcode seemed good, thats what the user types in there
[18:56:45] tubbo: greenride: it's also a good practice, and i think it's a little easier to see what methods User responds to, and how they're defined. because with mixins, if you define the same method twice, it's harder to reason about which method definition you get
[18:56:57] workmad3: railnubyist: yes... but you still need to make sure the <input> actually *has* that id
[18:57:07] tubbo: alaing: i'm not quite sure how to fix your problem since i don't use rbenv
[18:57:29] tubbo: alaing: but perhaps make sure you're on the right version with `rbenv 2.0.0` or whatever
[18:57:35] workmad3: railnubyist: or adjust the JS id selector to have the ID the <input> actually receives
[18:58:05] railnubyist: https://gist.github.com/JonleePeakman/6ed629d53e6e13f0488b
[18:58:41] alaing: tubbo: thanks i'll check, i'm actually following these notes https://github.com/TwilightCoders/FreeNAS-Rails-Setup
[18:59:04] alaing: tubbo: and then hoping to play about with rails and create some demo apps
[18:59:08] workmad3: railnubyist: btw, you're going to want to remove the submit handler
[18:59:13] tubbo: alaing: what exactly are you trying to do?
[18:59:15] workmad3: railnubyist: that was only there for demo purposes
[18:59:31] tubbo: i'm confused by why you'd install rails on FreeNAS :)
[18:59:53] workmad3: railnubyist: you'll also need to wrap that up in a 'jQuery ->' onready handler
[18:59:56] alaing: tubbo: lol not ideal i know
[19:00:18] workmad3: railnubyist: otherwise it's going to be trying to attach to elements that don't exist at time of attaching, which will just not do anything
[19:00:18] alaing: tubbo: I'm setting up a little portfolio website
[19:00:28] alaing: i've got my mac all settup
[19:00:49] workmad3: railnubyist: remember, the fiddle was just a demonstration of how you could approach that problem with JS, not a drop-in solution :P
[19:00:50] alaing: and just want to host it on a spare machine at home
[19:01:20] workmad3: alaing: hosting on a home connection really isn't advised
[19:01:47] tubbo: alaing: i think you should cut your losses and just go with ninefold or heroku
[19:02:02] alaing: workmad3: i have before but its mainly been php and apache conf
[19:02:03] workmad3: alaing: especially as you can set up all your demos and your portfolio site for free on heroku single-dyno apps and static pages on gh-pages
[19:02:21] tubbo: also ninefold has a free tier now
[19:02:22] workmad3: alaing: I've done it before too... didn't stop it being a bad idea then and doesn't stop it being a bad idea now ;)
[19:02:25] tubbo: been meaning to check that out
[19:02:38] alaing: workmad3: ah i was thinking that but one of my apps i want to do is a photo gallery for my family
[19:02:51] alaing: and theres a shed load of images and videos
[19:03:01] greenride: tubbo: To summarize your suggestion, you recommend defining a User model that inherits from ActiveRecord::Base or includes Mongoid::Document and then defining an ActiveResource model class ARUSer. After creating these two classes, the User model should get the methods it needs from ARUser through the use of delegates. Is that correct?
[19:03:54] alaing: workmad3: thanks for the suggestions I might look at them for my main portfolio pages
[19:04:15] workmad3: alaing: personally, I'd probably look @ hosting the photos on a google-drive account nowadays ;)
[19:04:25] alaing: as i tends to take my server offline over night do backups etc and then bring it back up in the morning
[19:05:09] tubbo: greenride: right.
[19:05:26] alaing: workmad3: I like full control of my images and wouldn't it cost me a small fortune a month for 100+ gigs?
[19:05:41] greenride: tubbo:Thanks
[19:06:10] workmad3: alaing: $10 a month for 1TB on google drive
[19:06:24] workmad3: alaing: $2 a month for 100gb
[19:06:25] tubbo: greenride: np man...tbh this is more of an opinion thing, it's really whatever floats your boat. i think you can reasonably accomplish this task in multiple different ways, this is just one way i've found to be easily testable and understandable.
[19:06:34] alaing: workmad3: thats not bad
[19:07:37] workmad3: alaing: you could also then slap the google-drive app on what you were planning to use as a server to keep a local backup ;)
[19:07:43] alaing: although I'm hoping to keep costs low( which those are but its still paying out for for) and use it as my little project to level up on my skills
[19:08:31] greenride: tubbo: It's a good suggestion. Ideally, I would like to use multiple inheritance, but that isn't possible. My reflex was to put the HTTP part in a module and mixin, but that has some problems. I like the 2 class approach with delegates in lieu of multiple inheritance.
[19:08:33] alaing: do I need to use passage or unicorn to host multiple apps?
[19:09:15] tubbo: alaing: you need a ruby server in general to host a rails app
[19:09:24] tubbo: so you need passenger or unicorn to host any amount of apps
[19:09:26] bratsche: So I did a lot of work on a Rails app (side project) over the weekend for the first time in quite awhile. It was kind of fun. :)
[19:09:36] pipework: workmad3: lololol
[19:09:55] pipework: anything that syncs but does not version is not a backup like you want.
[19:10:09] alaing: are those concidered ruby servers then....sorry only have experience with apache
[19:11:02] alaing: I get how apache/nginx communicate to them I just wondered whether it was just to host multiple apps.
[19:11:10] AntelopeSalad: tubbo, have you used ninefold?
[19:11:16] sergey_makagon: alaing, i prefer Nginx + Unicorn.
[19:11:25] tubbo: AntelopeSalad: i haven't
[19:11:26] AntelopeSalad: their free tier looks impressive, 1.5 gigs of ram is a lot for nothing
[19:11:39] tubbo: yeah...and they might not have crappy response times like heroku does
[19:11:46] alaing: sergey_makagon: ah I might pick your brains a bit later if you dont mind
[19:12:19] sergey_makagon: alaing, Nginx+Unicorn work pretty well if you have rvm to separate ruby versions and gemsets
[19:12:20] codezomb: stupid question, is there a way to traverse an associaiton chain? For example, Organization has many matters, matters has many players... I'd like to traverse from players to organization from an abstract standpoint.
[19:12:54] AntelopeSalad: tubbo, i'm guessing you've seen this? https://ninefold.com/performance
[19:13:02] codezomb: I was looking at reflect_on_all_associations, but I don't think that's where I want to be
[19:13:09] pipework: I made chums with ninefold's aussie great leader.
[19:13:12] alaing: sergey_makagon: as i said I'm been following this tutorial https://github.com/TwilightCoders/FreeNAS-Rails-Setup
[19:13:26] alaing: I might go with unicorn
[19:13:42] alaing: actually should I just bump rbenv and swap it out for rvm?
[19:13:49] pipework: alaing: no.
[19:13:53] pipework: Use chruby and ruby-install
[19:13:59] tubbo: AntelopeSalad: "You just have to choose a Rails platform host that cares about your users' experience as much as you do." ohhhhhh buuuuurn
[19:14:22] AntelopeSalad: hah, that's a pretty big burn
[19:14:22] tubbo: alaing: pipework's got the right idea. chruby/ruby-install are *much* more simple than using rbenv
[19:14:32] bratsche: Who are they burning?
[19:14:36] tubbo: bratsche: heroku
[19:14:42] helpa: Don't you mean http://lolroku.com/?
[19:14:49] bratsche: Ah, okay. I've never used Heroku.
[19:14:52] workmad3: tubbo: is it really a burn when their house is already on fire? :)
[19:15:46] dstarh: Trying to switch from https => http and vise versa in Rack::Proxy I've tried setting https => off and setting the schme to http but neither seems to have any effect. Am i missing something simple?
[19:15:48] tubbo: ninefold is now the 2nd hosting company i've seen to be backed by a major telecom provider
[19:15:48] bratsche: I mean, I used Heroku for a free hosting location. But I had no expectations of it being fast when it was free.
[19:15:52] tubbo: the first one was cloud at cost
[19:16:00] alaing: tubbo pipework: simplier than rbenv? Let me see if theres a port for freebsd
[19:16:01] pipework: mmm cloudatcost.
[19:16:14] tubbo: bratsche: one thing that is kinda underwhelming is that it's not really *that* fast when you pay for it either...
[19:16:18] pipework: alaing: if you have bash that isn't a million years old, why do you need a port?
[19:16:27] bratsche: tubbo: That's too bad. :(
[19:16:29] TheMoonMaster: chruby is "simpler" in that you have to do more work
[19:16:31] tubbo: bratsche: not to mention that it's like double the price
[19:16:33] TheMoonMaster: Which is kind of misleading
[19:16:34] tubbo: of a normal host setup
[19:16:51] tubbo: becuase you're basically paying for not having to set the box up with some config management system
[19:16:56] pipework: TheMoonMaster: What more work?
[19:16:58] bratsche: tubbo: The only things I've paid for were AWS and Digital Ocean. DO is noticeably slower than AWS to me, but it's still acceptable, especially for the price.
[19:17:11] TheMoonMaster: pipework: More than rbenv install 2.1.1
[19:17:15] AntelopeSalad: ninefold seems expensive outside of the free tier
[19:17:23] workmad3: TheMoonMaster: ruby-install ruby 2.1.1
[19:17:27] AntelopeSalad: expensive relative to DO at least
[19:17:31] tubbo: AntelopeSalad: so is heroku
[19:17:31] pipework: TheMoonMaster: ruby-install ruby 2.1.1 and then just start a new shell.
[19:17:39] alaing: pipework: its part of a FreeNAS jail which what i understand you have to have a port to install it
[19:17:39] AntelopeSalad: tubbo, yeah for sure
[19:17:44] bratsche: Yeah, Heroku is very expensive.
[19:17:52] pipework: Not using shared hosting is great.
[19:17:53] tubbo: heroku and ninefold are PaaS, not just SSD hosts...they're providing a lot more
[19:18:00] TheMoonMaster: Nah, starting a new shell is a pain.
[19:18:07] AntelopeSalad: i once priced out a pretty standard production setup on heroku, it was like $300/month for just normal stuff you'd expect like centralized logging, ES, etc.
[19:18:07] pipework: TheMoonMaster: Oh man, poor you.
[19:18:13] TheMoonMaster: I know, it sucks.
[19:18:15] AntelopeSalad: that was only with 1 worker too lol
[19:18:17] pipework: you only have like 12 tools to exec bash.
[19:18:18] workmad3: TheMoonMaster: source ~/.bashrc
[19:18:23] pipework: workmad3: That won't work.
[19:18:28] tubbo: TheMoonMaster: i found that i've had to do much less env-wrangling work with chruby, because i already am in pretty tight control of my env
[19:18:41] TheMoonMaster: Fair enough, I've never had to fight rbenv
[19:18:42] tubbo: TheMoonMaster: so stuff like rbenv and rvm were annoying because i had to sacrifice that control
[19:18:45] pipework: RUBIES isn't set on sourcing of your shell config, unless he changed it.
[19:18:51] bratsche: What do you all tend to use to manage database backups and stuff?
[19:18:54] tubbo: TheMoonMaster: don't ever move off rbenv, otherwise you will have to
[19:19:05] workmad3: pipework: ah, I think I've got something in my zshrc setting RUBIES :)
[19:19:06] tubbo: TheMoonMaster: does rbenv still start all your shims off with a hard-coded path to the ruby version? that always pissed me off
[19:19:07] stef1a: i'm trying to make dynamic form fields but am getting this error: https://gist.github.com/smlance/7b258452c29ef690e2cb. help?
[19:19:12] TheMoonMaster: Yeah, I feel like rbenv is the perfect middle ground imo.
[19:19:15] pipework: Shims are rubbish.
[19:19:16] AntelopeSalad: bratsche, i just use postres' backup package
[19:19:20] tubbo: having to go in and hand-edit shims/binstubs is a pain in the idck
[19:19:34] pipework: As long as you don't use rbenv in production, I give 0 fucks.
[19:19:40] bratsche: AntelopeSalad: Thanks. I'm unfamiliar with it, but I'll Google and learn.
[19:19:42] pipework: If you do, I worry for your coworkers.
[19:19:49] workmad3: tubbo: heh :) I really really want apple to produce an iphone dock with an idck daemon now :)
[19:20:09] bratsche: AntelopeSalad: Where do you store backups?
[19:20:13] tubbo: workmad3: http://www.abbreviations.com/IDCK
[19:21:01] alaing: pipework: yip theres a port, so I shoudl remove rbenv then
[19:21:10] AntelopeSalad: bratsche, the autobackup script is good at backing things up locally
[19:21:14] alaing: and install chruby
[19:21:20] pipework: alaing: This isn't for a production machine, right?
[19:21:34] AntelopeSalad: then it's up to you to figure out where to store them -- could be another host, email (if it's small), somewhere on aws, etc.
[19:21:36] pipework: I suggest always using your system package manager for anything remotely important.
[19:21:48] gizmore: i have a record model that has a complex def to_full_name ... how can i make that record where fullname => searchby?
[19:21:53] alaing: it will be but only for personal projects
[19:22:23] AntelopeSalad: bratsche, take a peek at https://packages.debian.org/wheezy/autopostgresqlbackup
[19:22:27] AntelopeSalad: there's one for mysql too
[19:22:33] pipework: I don't personally have any build toolchains on production machines, but I'm a bit of a pedant and a prick.
[19:22:49] bratsche: I hope I'll never have to use mysql again. :)
[19:22:53] bratsche: Thanks AntelopeSalad!
[19:23:42] AntelopeSalad: i recommend using the jessie version tho (1.0.5), it supports global objects and optional encryption
[19:23:45] workmad3: pipework: not that uncommon tbh... I'm gradually getting there, but I need to set up some deb repos before I can stop installing some of the stuff I use from source
[19:24:08] bratsche: I don't have this app quite ready to deploy yet anyway, so I'll need to bookmark this for later.
[19:24:56] alaing: lol pipework
[19:25:08] AntelopeSalad: workmad3, you know what's fun, rolling your own local apt cache server and storing your ruby builds there
[19:25:17] AntelopeSalad: 10 second ruby installs $
[19:25:19] tubbo: AntelopeSalad: welcome ot my life
[19:25:33] pipework: ACTION builds ruby in CI and serves that over apt
[19:25:35] tubbo: AntelopeSalad: you and i have a very different definition of the word "Fun"
[19:25:58] alaing: the reason I'm doing this.........to learn other technology. at work I only use ORACLE and ORACLE Application Express (better known as APEX)
[19:26:00] pontiki: that's understandable :)
[19:26:11] AntelopeSalad: tubbo, it was definitely anti-fun
[19:26:16] AntelopeSalad: but it's fun to use it
[19:26:25] pipework: alaing: I'll have my warrior clan pray for your soul.
[19:26:27] workmad3: AntelopeSalad: what would be better would be a CI omnibus build of my app into a .deb file, another one with the assets (so I can push them out to the front-end server) :)
[19:26:37] wmoxam: Any of you guys have a 3d printer?
[19:26:39] alaing: pipework: why?
[19:26:44] wmoxam: I'm thinking of getting one
[19:26:48] pontiki: not yet, wmoxam
[19:27:00] pontiki: i'm not sure i have a great reason to have one yet
[19:27:17] AntelopeSalad: workmad3, speaking of deploying... have you experimented with deploying pre-gem installed versioned zips?
[19:27:21] wmoxam: pontiki: reasons are thin at this point
[19:27:31] workmad3: AntelopeSalad: then that pushed into a test-env apt server which I can promote from once it's been through some verification
[19:27:32] wmoxam: pontiki: kinda like owning a home computer in 1977
[19:27:33] alaing: pipework: APEX is a real B!tch it doesn't intregrate all the good things in workflows like minify/concate js /css etc
[19:27:37] tubbo: yeah we've been considering that, workmad3...though rather than an omnibus we want to have CI kick off another build process on our build server, which will do the whole build and then run clonezilla to take an image off the machine and place it on a NFS store
[19:27:41] AntelopeSalad: i noticed a typical app with all the gems pre-bundled could easily be 100mb, it didn't seem reasonable to send that every push -- maybe rsync?
[19:27:48] alaing: and easy migration from dev to test to live
[19:27:49] pontiki: i have two friends who are hot into them, tho
[19:28:02] pontiki: and i love to see people pushing the envelope
[19:28:21] AntelopeSalad: gitlab's style of deployment seems pretty good
[19:28:26] tubbo: wmoxam: it's really expensive and while it seems like REALLY fun i just don't know what i'd make with it that was very useful
[19:28:28] AntelopeSalad: have you guys seen their setup?
[19:28:42] wmoxam: pontiki: I think you will see interesting things when they get faster
[19:28:44] tubbo: wmoxam: but my buddy is an architect, and his shop is getting a makerbot very soon so they can make little 3D models for clients
[19:28:49] tubbo: so i might be able to use theirs
[19:28:56] workmad3: tubbo: yeah, but you have a deploy process where re-imaging a machine is pretty much par for the course anyway :)
[19:29:02] wmoxam: tubbo: oh cool
[19:29:04] tubbo: the problem i see is materials...it can't do interesting materials yet
[19:29:08] tubbo: just that plastic stuff
[19:29:50] bratsche: Our office has a makerbot for some reason, but it broke. :/
[19:30:23] bratsche: We're not an architecture firm, so I'm not really sure why we had a makerbot to begin wtih. I guess it was just a cool toy.
[19:30:27] wmoxam: I was looking into buying a kit and assembling it
[19:30:38] wmoxam: but it looks very challenging
[19:31:11] pipework: AntelopeSalad: I prefer deploying something a bit more 'static' in nature.
[19:31:32] wmoxam: I just don't have the space and time to do it
[19:32:02] bratsche: A guy I worked with at a previous job bought one himself back when they first came out. He spent a small fortune on it. And he was always bringing stuff to work that he made in it, but they were always these dinky little plasticy things. Basically like the equivalent of little plastic army men.
[19:32:30] benlieb: what is the proper way of halting an action's execution in a before filter?
[19:32:50] tubbo: benlieb: render and return
[19:32:52] workmad3: benlieb: redirect or render
[19:32:58] russoneto: Im an experienced php developer, should I leave it behind and learn ruby? is it worthy?
[19:33:09] wmoxam: russoneto: why not both?
[19:33:29] tubbo: russoneto: why do you want to leave php behind?
[19:33:29] bratsche: russoneto: It's always nice to know multiple things. I've been learning stuff other than Ruby and Rails.
[19:33:43] wmoxam: http://media.tumblr.com/6e03f673ba78184eaa4ab8183f019716/tumblr_inline_nabf1b1I8R1r9igs6.jpg
[19:33:53] russoneto: good question.. i dont have too much free time
[19:34:05] bratsche: I don't either. :)
[19:34:14] workmad3: bratsche: I'm not sure I agree... my mind is cluttered with PHP and Java knowledge that sometimes encroaches on my sanity :(
[19:34:30] Jon30: Please help. I am getting this error when I am running bundle. googling wasn't helpful. :( /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Permission denied - /vendor (Errno::EACCES)
[19:34:45] wmoxam: russoneto: sure, but you still need to learn Ruby if you 'leave php behind' or not
[19:34:54] tubbo: Jon30: `ls -la vendor`, is it owned by your user or root/root?
[19:35:09] wmoxam: russoneto: since you're an experienced php dev you aren't leanring much new PHP stuff at this point
[19:35:22] Jon30: tubbo: by the user. that's the weird part.
[19:35:23] wmoxam: and IMO learning Ruby could help you to write better PHP
[19:35:23] workmad3: Jon30: did you by any chance type 'bundle install --path /vendor/bundle' rather than 'bundle install --path vendor/bundle'?
[19:35:24] tubbo: Jon30: oh wait that's doing a mkdir...yeah whatever user you ran `bundle` as doesn't have the permissions to fuck around in that dir.
[19:35:32] bratsche: russoneto: I don't want to be called a "Rails developer", or anything else like it. I used to do mostly gtk+ desktop development on Linux, I didn't want to be "a gtk developer" so I learned Ruby and Rails because they were interesting to me at the time. Now I'm learning Elixir and Rust because they seem cool.
[19:35:38] bratsche: russoneto: Learn anything that seems interesting to you. :)
[19:35:39] workmad3: tubbo: 'that dir' is /vendor (as in vendor under /)
[19:35:42] Jon30: workmad3: nope, i simply wrote bundle
[19:35:47] russoneto: my point is: what rails offer, is it worthy compared to any php framework?
[19:35:53] workmad3: Jon30: something has screwed up your .bundle/config then
[19:36:02] workmad3: Jon30: I'd suggest removing .bundle/config and trying again ;)
[19:36:26] workmad3: Jon30: alternatively, open it in a text editor and change '/vendor/bundle' to 'vendor/bundle'
[19:36:31] tubbo: russoneto: have you ever used rails? or watch any videos of people coding with rails?
[19:36:39] tubbo: or, better yet, have rails dev friends?
[19:36:54] tubbo: workmad3: o shiiiiiiiiiiiiiiiit
[19:36:57] tubbo: i did that once
[19:37:05] bratsche: russoneto: I don't know any php frameworks. When I was first getting into web stuff, Rails and Django seemed to be where exciting things were happening so that's what led me this way.
[19:37:10] workmad3: tubbo: what? manually editing .bundle/config?
[19:37:17] workmad3: tubbo: or trying to install to /vendor? :)
[19:37:21] tubbo: accidentally having that '/' before /vendor/bundle
[19:37:29] tubbo: i manually edit .bundle/config all the time
[19:37:57] workmad3: tubbo: yeah... isn't it funny how it's a bad idea to mess around in / on a *nix system? :)
[19:39:22] tubbo: workmad3: did you read that article on HN yesterday about fun with unix wildcards? :)
[19:39:26] wmoxam: russoneto: The best part about Rails is Ruby.
[19:39:29] tubbo: i call it "trolling tech support"
[19:39:34] tewlz: I used to delete stuff from current dir with `rm -rf ./*` until one day I accidentally missed typing the period.
[19:39:43] tubbo: `touch vendor/bundle/-rf` :{
[19:40:18] rhizome: some oses protect against rm -rf / nowadays
[19:40:41] pontiki: training wheels OFF
[19:40:56] dstarh: anyone use Rack::Proxy?
[19:40:57] workmad3: rhizome: I've got my own warning system too... zsh syntax highlighting that marks the entire line up with red background if I type 'rm -rf'
[19:41:11] workmad3: (doesn't stop me doing it... but at least it's obvious when I have so I don't do it by mistake :) )
[19:43:42] workmad3: dstarh: not used it myself, no... doesn't seem like it's that much use in all honesty
[19:44:31] Jon30: guys i am having issues installing nokogiri gem.. gem install nokogiri -v '1.6.0' the rror is: You don't have write permissions for the /usr/local/rvm/gems/ruby-1.9.3-p484 directory.
[19:44:35] Jon30: sudo gem install doesn't work
[19:44:44] Jon30: it says sudo: gem: command not found
[19:45:19] dstarh: workmad3: we use it to proxy api requests from front end server to api server so we don't have to deal with the hell that is CORS
[19:45:46] workmad3: dstarh: I'd do that in nginx
[19:46:22] workmad3: dstarh: rather than tie up a request thread in my ruby app server to proxy to another server
[19:48:52] rhizome: Jon30: are you using rvm, rbenv, etc.
[19:50:21] workmad3: Jon30: simple workaround, use rvmsudo instead... better solution - don't do a root install of RVM on your dev machine
[19:50:35] Jon30: thanks :)
[19:51:18] workmad3: Jon30: I'd highly recommend getting a user install of RVM sorted btw... it's really non-sensical to have a system install on a dev machine
[19:54:48] railnubyist: workmad3: sorry but I cannot get this working - https://gist.github.com/JonleePeakman/5d5fcca305545b991727
[19:55:08] railnubyist: workmad3: the #postcode is not updating the form action
[19:55:24] workmad3: railnubyist: !g jquery ready callback
[19:55:25] railnubyist: workmad3: I have turned off turbolinks
[20:05:38] stef1a: i'm getting this error PG::UndefinedColumn: ERROR: column evaluation_answers.evaluation_question_id does not exist where evaluation_answer belongs_to evaluation_question. do i need to add an index or something to one or both of these tables
[20:07:29] sergey_makagon: looks like you should add evaluation_question_id to EvaluationAnswer model
[20:08:32] stef1a: ah, i forgot i needed to add those manually, i guess...
[20:09:00] sergey_makagon: you should use migration i think :)
[20:09:48] stef1a: i mean, i forgot that just creating the models and associations wasn't enough
[20:09:56] stef1a: ofc i'd use a migration :)
[20:10:12] aarkerio: Hi! I have several models: Order->OrderItem->Product->ProductOffer
[20:10:26] aarkerio: I only have order.id and I need to get ProductOffer
[20:11:14] aarkerio: there is a "cascade pattern" to look for a "distant" model ?
[20:11:32] hfp: Hey all, which gem would you use for detecting the user's nearest city and populating a field with that info?
[20:12:04] aarkerio: orderItem could or could not have any product association
[20:12:33] bricker`work: hfp: https://github.com/cjheath/geoip is good
[20:12:51] hfp: bricker`work: Thanks
[20:13:15] kara_sweets: does a select statement in a database iterate through all records?
[20:13:39] kara_sweets: if there is no index on the queried column
[20:13:41] aarkerio: I can do a: if order.order_items.any? and inside look for the another model, but I am looking for something more elegant
[20:14:43] dstarh: hfp: you should also have a look at http://diveintohtml5.info/geolocation.html since it can be much more exact than geo ip
[20:14:52] imton: guys, would you use CanCan for authorizantion if you need to prevent user doing most of actions before compliting the profile?
[20:15:09] imton: *completing
[20:16:58] stef1a: i'm getting this error PG::UndefinedColumn: ERROR: column evaluation_questions.evaluation_id does not exist but any given EvaluaionQuestion may be "owned" by multiple Evaluations, so i do not want to give it a column for evaluation_id. help?
[20:18:46] hadifarnoud: can someone help me with capistrano? I see nginx default page. I have no idea where to look for issues
[20:19:33] stef1a: multiple Evaluations may have the same EvaluationQuestion, so it doesn't make sense to have an evaluation_id on EvaluationQuestion
[20:24:13] stef1a: i guess my approach is what would be a belongs_to_many, which doesn't exist...
[20:30:54] pipework: stef1a: hmt
[20:31:20] stef1a: pipework: by nature, it's a many-to-many rltn, so i think it has to be habtm
[20:31:35] pipework: hmt > habtm
[20:32:06] stef1a: pipework: could you explain why?
[20:32:35] pipework: stevednd: !g has_many through vs has_and_belongs_to_many
[20:34:31] hadifarnoud: can someone help me with nginx config for rails? I followed this tutorial https://gorails.com/deploy/ubuntu/14.04
[20:35:03] hadifarnoud: in /etc/nginx/sites-enabled/default, my root is /home/deploy/myapp/current/public
[20:35:08] hadifarnoud: that seems wrong
[20:36:03] workmad3: hadifarnoud: no, that's right
[20:36:21] hadifarnoud: workmad3: I see default nginx page though.
[20:36:22] workmad3: hadifarnoud: you set the root to public/ so that nginx can serve up static files from there
[20:36:33] stef1a: pipework: so hmt is for extra attributes and validations and callbacks?
[20:36:34] workmad3: hadifarnoud: sounds like you forgot to disable the default site and reload nginx
[20:37:12] hadifarnoud: workmad3: so, there might be something wrong somewhere else?
[20:39:01] stef1a: pipework: using another mediating class seems troublesome, because i already have: evaluation <-> evaluation_questions -> evaluation_answers
[20:39:04] dstarh: We're randomly getting an AuthToken exception in Devise sessions#create but we can't reproduce it at all. Anyone seen this? I've tried double clicking login button, back button, multiple tabs open at once
[20:39:12] workmad3: hadifarnoud: well, if you followed that guide, it missed out a rather important point... after editing the 'default' hostfile, you need to run 'sudo service nginx reload'
[20:39:30] hadifarnoud: workmad3: as this tutorial said, I just edited the default site
[20:39:30] hadifarnoud: do I have to rename 'default' to my domain?
[20:39:37] pipework: stevednd: You don't really have to use one, but the effort requires to add that other class is practically nil and most often the way you want to go.
[20:39:42] workmad3: hadifarnoud: no... you need to run that command I just said
[20:39:49] dstarh: We don't really want to disable the csrf token checking since we really shouldn't have to
[20:40:01] pipework: stevednd: The overhead is barely measureable, on the order of like 7 objects for over a thousand records, last we checked.
[20:40:06] dstarh: as an aside we've only seen the error in firefox
[20:41:15] stevednd: pipework: I'm pretty sure you're meaning to mention stef1a
[20:41:18] stef1a: pipework: agggh. so i'd have evaluation <-> evaluation_question_evaluation <-> evaluation_question -> evaluation_answer
[20:41:30] pipework: stevednd: You're right!
[20:41:39] pipework: stef1a: No.
[20:41:49] hadifarnoud: workmad3: I've done it. now default nginx page is gone. nothing is showing up now. I have two folder in /public, assets and system
[20:42:13] pipework: stef1a: Why are you making it so complicated? It's pretty simple. You have a join table, you make a class for it like any other activerecord anything.
[20:42:27] stef1a: oh, well i guess i was going to have to add a "join" table whether i used hmt or habtm...
[20:42:33] stef1a: regardless of whether*
[20:42:35] pipework: You use hmt using the class for the join table.
[20:42:46] stef1a: using the class?
[20:43:03] workmad3: hadifarnoud: doesn't sound right... don't know what could be wrong now though
[20:43:04] stef1a: you mean has_many :evaluations through: :join_table_name?
[20:43:13] pipework: stef1a: correct
[20:43:30] stef1a: oh i see. okay. thanks!
[20:43:30] pipework: stef1a: Like in the relations guide.
[20:43:42] hadifarnoud: workmad3: I think my root should be different. the app must be serverd from somewhere
[20:43:50] stef1a: pipework: the relations guide doesn't have a dual-way hmt, i'm pretty sure
[20:44:06] stef1a: it doesn't have a many-to-many rltn formed by hmt, rathe
[20:44:06] pipework: stef1a: They're just inversions of the opposite.
[20:44:17] stef1a: pipework: i don't understand. opposite of what?
[20:44:42] pipework: A has_many B, through: AB; B has_many A, through: AB
[20:44:51] rhizome: post has many categories, category has many posts
[20:49:03] doubleemms_: is there a strong consensus on 403 vs. 404? for instance, if a user is only allowed to access record 1, and makes a request for record 2, but record 2 does not exist, is it more secure to respond with 403 or 404?
[20:49:59] workmad3: doubleemms_: if it doesn't exist, 404 is fine
[20:50:09] workmad3: doubleemms_: if it exists but you can't reveal that, use 404
[20:50:26] workmad3: doubleemms_: if it exists and it doesn't matter if people know that as long as they can't access it, use 403
[20:50:29] stef1a: pipework: okay. what attributes should the join table have / how should i make it? right now i have this: https://gist.github.com/smlance/044c2ceb4e815f3177cb (the first line is just a screwup join table i had made from habtm)
[20:50:54] doubleemms_: workmad3: that makes sense, i guess.
[20:51:04] stef1a: oops, the second line should have the model names reversed...
[20:51:21] hadifarnoud: did someone use nginx and passenger for a server setup?
[20:51:28] workmad3: doubleemms_: if the resource doesn't exist but you're not allowed to reveal it... god knows what you should use :)
[20:52:24] doubleemms_: workmad3: well, my thought would be that 403 would win in that case. that way you're not leaking information about the record's existence.
[20:52:43] doubleemms_: workmad3: which is what sent me down this rabbit hole in the first place.
[20:52:55] pipework: stef1a: Why can't you just have a single join table called questions_evaluations that has id, question_id, and evaluation_id?
[20:53:04] workmad3: doubleemms_: I guess 403 can make sense there
[20:53:14] tubbo: is there like, any kind of documentation on 403 vs. 404?
[20:53:18] stef1a: pipework: what gives you the impression i'm not having just one?
[20:53:36] tubbo: like for example...why does github 404 you when you access a repo you don't control?
[20:53:48] pipework: stef1a: I must be confused. You have a question and question_evaluations?
[20:53:50] tubbo: why does it matter to them that nobody knows about the resource?
[20:54:02] pipework: tubbo: Because that's telling.
[20:54:04] stef1a: pipework: no. i have evaluations and an evaluation_questions
[20:54:12] tubbo: pipework: you're telling
[20:54:13] pipework: stef1a: Ah, okay.
[20:54:18] doubleemms_: tubbo: my coworker brought up github's behavior as an example.
[20:54:26] tubbo: i get it from a common sense perspective, believe me
[20:54:44] workmad3: tubbo: doc-wise, there's the RFC... and then things like http://httpstatusdogs.com that present said info in a more interesting manner
[20:54:57] tubbo: but i wonder if github ever though of it as just one more precaution or if they actually had an issue where someone fucked them up by knowing where a private repo was
[20:55:13] workmad3: tubbo: as for github... it'll be because they can't tell if it's important to their *users* if it's vital to not reveal a private repo's presence
[20:55:39] stef1a: pipework: so then you're saying the mig would look like this? https://gist.github.com/smlance/044c2ceb4e815f3177cb
[20:55:45] workmad3: tubbo: so they err on the side of caution and just give a unified 'we can't find that' 404 for all cases (which is documented as perfectly valid in the RFC)
[20:55:51] tubbo: workmad3: that's a good idea.
[20:55:56] tubbo: makes sense
[20:56:07] doubleemms_: and just never use 403?
[20:56:08] pipework: stef1a: I don't think you should have the id being false, but yeah.
[20:56:13] doubleemms_: because it's leaky...
[20:56:17] pipework: doubleemms_: No.
[20:56:31] workmad3: doubleemms_: it's only leaky if you use both
[20:56:43] doubleemms_: right. one or the other.
[20:57:14] stef1a: pipework: what do you mean the id being false?
[20:57:14] pipework: Use 403 when the requester's knowledge of the existence of the resource isn't potentially dangerous.
[20:57:24] pipework: stef1a: https://gist.github.com/smlance/044c2ceb4e815f3177cb#file-migrate-rb-L5
[20:57:24] stef1a: pipework: oh, i see.
[20:57:49] workmad3: same reason as why you shouldn't give errors back on individual fields during login... leaking that email X is a valid account but the password is wrong leaks information that you may not want attackers to gain
[20:58:07] doubleemms_: workmad3: right.
[20:58:41] workmad3: and hopefully you can't tell someone that the password is right but the email is incorrect... because if you can do that, you're storing passwords wrong
[20:59:25] pipework: workmad3: But I just wanna User.find_by_email_and_password(params)
[20:59:48] workmad3: pipework: that's great... please send your URL to http://plaintextoffenders.com/ and save me the trouble :P
[21:00:09] pipework: workmad3: Do they accept non-https links?
[21:00:46] troynt: Anyone know how to change the log path for Rails 3.2 ? I've tried config.paths['log'] = '/tmp', config.log_path, etc
[21:01:01] _bart: hey, just wondering, what's the biggest single rails project you guys've seen? Like how many models?
[21:01:25] pipework: troynt: That sounds like a bad idea.
[21:01:48] troynt: pipework, I'm not actually putting in '/tmp'
[21:01:55] troynt: pipework, I just want to know how to change path
[21:02:26] troynt: I've also checked http://guides.rubyonrails.org/v3.2.8/configuring.html
[21:02:42] stef1a: pipework: do i also need a model for the hmt join table?
[21:02:48] workmad3: stef1a: yes
[21:02:58] stef1a: gah so much overhead
[21:03:18] pipework: stef1a: You need a class.
[21:03:27] pipework: It's ~35s of work
[21:03:28] stef1a: pipework: a class, but not a model?
[21:03:41] pipework: stef1a: Tell me what the difference is.
[21:03:54] pipework: You need a class that inherits from activerecord base that points to the join table.
[21:04:18] dirtibirdi: Hey, any advice on finding junior jobs? what kind of skills should I show off to impress?
[21:04:23] stef1a: pipework: okay... how does the naming convention work for that? is it just [model_one_singular]_[model_two_singular]?
[21:04:34] pipework: stef1a: Yeah, I'm fairly sure.
[21:04:44] pipework: dirtibirdi: You should know how to learn.
[21:04:46] workmad3: troynt: set config.logger to a new Logger or ActiveSupport::Logger logger instance
[21:05:17] workmad3: stef1a: name it something useful
[21:05:35] pipework: If you can, do name it something useful.
[21:05:39] troynt: workmad3, I see that, but what about config.active_record.logger and other loggers? I just want to change the directory
[21:05:42] stef1a: workmad3: how do i name it whatever i want but still have rails recognize which table it corresponds to?
[21:05:52] workmad3: troynt: all the others default to config.logger
[21:05:53] dirtibirdi: pipework: I think I could show that, I feel I need something that stands out to get attention
[21:05:54] pipework: stef1a: set_table_name or something like that.
[21:05:58] hadifarnoud: in config/secrets.yml, I have secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> for production. how can I set this?
[21:06:07] pipework: dirtibirdi: Projects and open source code are favorable.
[21:06:09] troynt: workmad3, great! thx :)
[21:06:21] pipework: hadifarnoud: like you set anything else in ENV
[21:06:53] hadifarnoud: pipework: I forgot how to generate a random key
[21:06:56] workmad3: stef1a: alternatively, you rename the join table to correspond to the useful name
[21:07:01] pipework: hadifarnoud: rake -T
[21:07:29] joy4u: anyone want to contribute to this project https://github.com/himadriganguly/devise-polymorphic-association
[21:08:01] joy4u: pipework: thanks
[21:08:09] pipework: joy4u: you're welcome
[21:08:28] joy4u: pipework: ok
[21:14:32] dirtibirdi: pipework: if you were hiring what would impress you? for example, more features, test coverage, design patterns, algorithms, full-stack? I want something that stands out against other crud apps, I think I can knock those out no problem.
[21:15:35] pipework: dirtibirdi: Code, personality, desire to learn, ability to learn quickly, code, and how you respond to puns all day long.
[21:16:48] dirtibirdi: as long as no one says 'no pun intended'
[21:17:23] tubbo: yeah i think what will make you stand out is your personality
[21:18:46] lurraca: I have a question, is there any way I could send an XLS by email from a Rails app? The XLS is being generated on the controller, since I was generating and sending it to the browser on the fly but now I want to send it by email, anyone have done this so I can a look at some repo in github or something?
[21:18:48] wmoxam: If you can get shit done, you're already ahead
[21:19:06] antivert: also if you use ruby make sure you have a Mac, a guy in the bay area literally told me that
[21:19:08] dirtibirdi: im having a hard time even getting people to check out my github and projects. I guess I need a better way to get my resume to the right companies.
[21:19:12] antivert: I told him to get bent :D
[21:19:31] antivert: he was doing the hiring at a startup too. hope they failed
[21:19:33] lurraca: I checked the actionmailer docs, but I just show how to send a file, not an xls generated on the fly.
[21:20:08] makerop: lurraca, as an attatchement?
[21:20:17] lurraca: makerop: yeah
[21:20:56] lurraca: makerop: let me give you more context
[21:22:31] dirtibirdi: wmoxam: get what done?
[21:22:38] lurraca: makerop: actually in the controller I have an action called "xls_report" which set s a few variables, then I have view "xls_report.xls.erb" where I create the report using the vars that I set on the controller. I would like to email that as an attachment.
[21:23:25] makerop: lurraca, you cnat do it that way
[21:23:30] wmoxam: dirtibirdi: Things. In general.
[21:23:46] makerop: you need to either generate a file from all that, or do it another way on the fly
[21:24:16] wmoxam: dirtibirdi: a lot people just can't get anything shipped without a lot of hand holding
[21:24:58] wmoxam: dirtibirdi: most people don't have any oss software that they can point to
[21:25:00] lurraca: I have my app on heroku, since the heroku filesystem is volatile, doesn't it will get deleted before sending?, I plan to background job to send the email.
[21:26:13] makerop: lurraca, if you go the file route, just hook it up to s3
[21:26:24] dirtibirdi: wmoxam: ive got a half dozen apps i think are pretty good but no gems or anything. Maybe I will look for something in the early stages I can contrib to.
[21:26:41] makerop: but, you should be able to generate the xls, straight from a model, rather than putting it inot a template
[21:27:30] lurraca: makerop: can I save it s3 from a template?
[21:27:33] wmoxam: dirtibirdi: I guess my advice is to ship *something* ;-)
[21:28:03] makerop: why are you using a template to begin with?
[21:28:16] wmoxam: so if you throw in the kitchen sink just to prove you can do x,y,z it might never ship :p
[21:29:19] lurraca: makerop: it seemed like the simplest way to generate the .xls
[21:30:36] makerop: lurraca, http://railscasts.com/episodes/362-exporting-csv-and-excel?view=asciicast
[21:30:37] pipework: dirtibirdi: Depending on your audience, you'll want to express your interest in their chief concerns. Business people, you deliver quick and minimally complex answers to business needs. Technical people? You love what they love and know how to talk about it and insert your own interests.
[21:30:39] pipework: Things like that.
[21:30:40] makerop: you dont *need* a template
[21:32:21] hfp: What do you all use to manage your servers? Chef or Puppet?
[21:32:40] pipework: hfp: teenagers.
[21:32:44] hadifarnoud: how can I set my secret_key_base in production? I did put it in .env and I do have dotenv gem installed
[21:32:52] hfp: pipework: haha
[21:33:56] icole: could someone help me with strong params? i am trying to require a namespaced model "Api::V1::Part" and it doesn't seem to be working is this syntax right? params.require(:part).permit
[21:34:38] makerop: there are no atributes for part
[21:34:47] stef1a: for ActiveRecord::HasManyThroughNestedAssociationsAreReadonly, is autosave: false a fragile fix, or is it the best solution?
[21:34:52] dirtibirdi: can i get a one sentence review if this is worth showing... two of my latest apps... one for finding someone to pair with, http://shielded-shore-8263.herokuapp.com/, use example@example.com/password, one for fantasy football, http://bammers.herokuapp.com
[21:34:53] makerop: params.require(:part).permit(:color)
[21:35:06] pipework: icole: Don't namespace models for versioning responses, use serializers.
[21:35:21] wmoxam: hfp: both Chef and Puppet suck in their own special way IMO
[21:35:27] icole: this is really what i have i just omitted the permit piece params.require(:part).permit(:type_name, :manufacturer, :model)
[21:35:33] wmoxam: hfp: but somehow I use Chef
[21:35:44] makerop: iv used both extensively
[21:36:00] bricker`work: wmoxam: aww come on, I like Chef
[21:36:01] icole: pipework: ok that probably makes a little more sense, thanks
[21:36:08] bricker`work: wmoxam: compared to the manual alternative, anyways
[21:36:13] wmoxam: hfp: I've heard good things about Salt & Ansible
[21:36:26] wmoxam: bricker`work: it's better than nothing that's for sure
[21:36:39] wmoxam: bricker`work: but holy hell it's a mess
[21:38:37] coreycondardo: @dirtibird I think both are cool.
[21:38:48] coreycondardo: how to you mention in irc?
[21:39:25] hfp: wmoxam: Chef and Puppet both use Ruby so I'd rather. Why do they suck in their own way?
[21:39:44] hfp: coreycondardo: You can generally tpe the first few letters and hit <TAB> and your IRC client will complete the name
[21:42:13] makerop: hfp, it's how each functions
[21:43:07] pipework: hfp: They add their own kind of suck on top of ruby.
[21:43:11] makerop: chef is imperative, puppet is declarative, and has no run order
[21:44:17] makerop: but yes, tehy both have their own special way of sucking
[21:47:20] hadifarnoud: how can I check if ENV values are set from .env?
[21:47:48] hfp: I think I prefer declarative
[21:49:19] pipework: I prefer topless beaches.
[21:49:38] pipework: Makes me feel just as fat as I am, but with other fatties around to distract me.
[21:55:33] rikkipitt: evening guys
[21:56:22] rikkipitt: is there a way to add CSS from the database (using rails_admin) to the assets pipeline?
[21:56:57] rikkipitt: so users can tweak and override some CSS via the CMS is they absolutely have to
[21:57:54] troynt: rikkipitt, asset pipeline wont run in production as the assets will be compiled already. I think this is something you should create an endpoint (controller action) for, then include style tag in html
[21:58:23] rikkipitt: thanks troynt, I thought that would be the case
[21:58:28] _August_: anyone here use rubymine?
[21:58:43] rikkipitt: _August_: I do, what's up?
[21:58:47] _August_: im trying to figure out if theres a way to destroy a scaffold on t
[21:59:16] _August_: or is the the only way to do it is to type the command in the terminal
[21:59:24] rikkipitt: rails destroy scaffold <name>
[21:59:30] rikkipitt: in terminal is what I do
[22:01:35] dcope: hey all, i have a cache sweeper setup to expire_page. the sweeper is being loaded properly and expire_page works fine in the console with the path. but the after_ callbacks aren't getting called
[22:01:39] dcope: why is this?
[22:31:50] bricker`work: dcope: dunno, what have you done to try to debug?
[22:35:30] rhizome: dcope: what version of rails?
[22:38:23] dcope: rhizome: 3.2.18
[22:38:50] dcope: bricker`work: confirmed that the sweeper was getting loaded. i'm not sure what else i can do apart from that. the after_ methods in the sweeper weren't being called & nothign was in the logs
[22:41:33] rhizome: gist your model and sweeper
[22:42:53] rhizome: also consider using cache_digests
[22:46:33] bricker`work: dcope: how do you know they're not getting called?
[22:47:03] bricker`work: and, why do you think they are supposed to be getting called?
[22:48:24] dcope: bricker`work: because i put logging statements in them
[22:48:54] dcope: and i would imagine that after i create a model that is marked as "observe", the after_create would get called
[22:55:24] bricker`work: dcope: christ
[22:55:33] bricker`work: dcope: how about a gist or something before you lash out
[22:55:38] pipework: christ on a tree.
[23:34:35] lethjakman: bricker`work: HI
[23:34:38] lethjakman: HOW ARE YOU?
[23:51:43] lilia: hi all - anybody up for a quick question on counter_caches?
[23:54:46] centrx: lilia, The question must be asked before it can even be answered
[23:55:43] bricker`work: confuscious say
[23:58:59] lilia: the short version is: are counter_caches thread safe?