« Back to channel list

#RubyOnRails - 19 July 2013

« Back 1 day Forward 1 day »
[00:01:19] AntelopeSalad: Radar: it is basic -- http://pastie.org/8154019 -- what would you do if it were more complex tho so i know what to do in the future
[00:02:19] Radar: AntelopeSalad: tag("h3") { stat } + tag("p", class: 'stat_value', title: title) { variable }
[00:02:54] AntelopeSalad: that actually seems a lot more complicated heh
[00:04:26] AntelopeSalad: thanks though, i could see that being at some point
[00:06:31] lethjakman: hey, is there a good way to do something like fuzzy searching with rails? like with how google starts seaching as you start typing?
[00:07:54] AntelopeSalad: lethjakman: you'll likely want to use full text searching
[00:08:31] lethjakman: AntelopeSalad: that's what I imagine, I'm just wondering do I send a request to my server every time I type? that seems like it could get rediculously expensive
[00:09:37] AntelopeSalad: did you watch the railscast on that topic?
[00:19:51] superlou: Going a little crazy after leaving Rails for a bit and coming back. I'd like to refactor some logic into a class in the lib folder on 3.2. I understand that lib is no longer autoloaded, but for the life of me, can't find an example on best practice for putting a class in lib.
[00:20:26] brownies: superlou: you set the config.autoload_paths in application.rb ... check the Rails Guide on config
[00:20:41] brownies: that may not be the exact name of the config attribute. just going off memory here.
[00:21:19] superlou: brownies, it's config.autoload_paths and i did that, but I'm not sure how to structure the class in the module so i stop getting not found problems from the calling code
[00:21:19] Radar: Or you know you could just require the file at the bottom of config/application.rb or in an initializer
[00:21:26] Radar: I don't think loading everything in lib is a Good Idea.
[00:21:39] brownies: load it! load EVERYTHING!
[00:21:48] superlou: Radar, agreed. Was just trying to make sure everything's included to cut down on number of things i'm missing
[00:21:57] w0rd-driven: load lib. make it world writeable
[00:22:01] brownies: yeah, you have to be careful actually, because you might not want it loaded for things like rake tasks
[00:22:28] superlou: so, is there an example somewhere of best practice?
[00:22:36] superlou: i feel like dumping the class in models is kinda gross
[00:22:56] brownies: i've actually taken to throwing some of my POROs in /app/models.
[00:23:15] brownies: the best practice is "it depends"
[00:23:32] brownies: and also "don't be dumb"
[00:23:45] superlou: woh woh woh. Let's not make promises we can't deliver
[00:23:54] superlou: Being dumb is pretty much the only thing i can routinely handle
[00:25:28] superlou: but if it's in app/models, it should just be callable like any other model?
[00:25:38] superlou: or is this require_dependency mumbojumbo important?
[00:27:03] Dreamer3: what does rails do to speed up sprockets?
[00:27:17] Dreamer3: trying to use it on it's own bet every time i edit any file it takes almost 4 seconds to reload
[00:36:04] lethjakman: is it just me or does railscasts tend to be dated?
[00:37:04] Radar: Is it just me or does rails tend to evolve really quickly, thus making most screencasts outdated?
[00:37:18] Dreamer3: environment.cache = ActiveSupport::Cache::MemoryStore.new :size => 2.megabytes
[00:37:22] w0rd-driven: a little bit of both?
[00:37:28] Dreamer3: sprockets just needs a cache :)
[00:37:51] Dreamer3: now it's super fast :)
[00:38:04] Dreamer3: i suppose it caches which assets are built and only rebuilds those that have changed
[00:38:32] Dreamer3: weirdly it seemed to do that before, but only the top-level
[00:38:44] AntelopeSalad: i watched almost every non-pro video back to like 2011 -- they might be out dated but it seems like a lot of them can still be applied to 4.0, you just need to make small tweaks
[00:39:16] lethjakman: Radar: that's true. seems like every time I've been there I have to make large modifications to what they wanted me to do. it made things really difficult when I was first starting.
[00:39:16] AntelopeSalad: the comments are helpeful too usually, someone will post a snippet on how to convert some ancient code to something more recent
[00:41:50] diegoviola: i'm trying to leanr rspec/tdd/bdd, any ideas? is mocking/stubbing for faking objects and testing with them? please advice
[00:42:07] diegoviola: i'm not very experienced with tdd/bdd really
[00:42:31] diegoviola: faking/mimicking
[00:44:45] helpa: diegoviola: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Steve Klabnik, Ryan Bigg, Yehuda Katz
[00:44:45] Radar: diegoviola: !r4ia
[00:50:22] lethjakman: hrm, did something change with validates_presence_of in 4.0? I have it like this:
[00:50:23] lethjakman: validates_presence_of :password, on => :create
[00:50:39] lethjakman: but it tells me that local variable or method `on' is undefined
[00:51:50] Radar: lethjakman: where did you get that from?
[00:52:57] lethjakman: Radar: http://railscasts.com/episodes/270-authentication-in-rails-3-1
[00:53:14] lethjakman: a railscast, like I was just whining about.
[00:53:17] Radar: lethjakman: compare your code with that in the example for models/user.rb
[00:53:19] slash_nick: :on => :create, hopefully...
[00:53:27] Radar: look at your code and look back at the railscast's code
[00:53:38] Radar: there is a very important one character difference
[01:17:40] lethjakman: so, I'm trying to run @user = User.new(params[:user]) and I'm getting ActiveModel::ForbiddenAttributesError am I supposed to enable the id to be accessable somehow? I thought everything was automatically whitelisted now
[01:22:57] willbradley: post a gist with your model and the params being submitted
[01:24:52] lethjakman: willbradley: https://gist.github.com/lethjakman/6034397
[01:24:56] lethjakman: this should be everything.
[01:25:11] lethjakman: I tried whitelisting everything.
[01:41:01] willbradley: lethjakman: i need to see the params being submitted too (in your log)
[01:42:13] willbradley: also do rails -v
[01:44:04] willbradley: cuz rails4 doesn't auto-whitelist afaik https://www.google.com/search?q=ForbiddenAttributesError
[01:44:10] lethjakman: willbradley: https://gist.github.com/lethjakman/6034397
[01:44:40] lethjakman: I set up the user_params anyways
[01:49:28] willbradley: read up on strong_params if you haven't already
[01:49:47] willbradley: the new approach is not to auto-whitelist
[02:16:17] ner0x: Is there any smart way to keep what files are selected in the database rather than a cookie?
[02:16:33] ner0x: Possibly a hash meta column.
[02:19:20] lethjakman: is session the session variable?
[02:19:39] Radar: lethjakman: that question doesn't make sense.
[02:19:41] Radar: session *where*?
[02:19:56] lethjakman: Radar: inside of a controller I see: session[:user_id] = user.id
[02:20:03] lethjakman: is that modifying session data?
[02:20:05] Radar: lethjakman: that is a method call
[02:20:07] Radar: lethjakman: yes
[02:20:17] lethjakman: ok cool, thank you.
[02:22:16] ner0x: Radar: Hey broham.
[02:23:31] Radar: ner0x: hey
[02:23:41] ner0x: Radar: What's going on mang?
[02:23:54] Radar: Working with Backbone.Marionette on a new frontend for Spre.e
[02:25:27] ner0x: You have any experience with HStore?
[02:25:44] ner0x: Considering using it to keep track of what items are selected. :-/
[02:25:52] ner0x: Looks like a good idea. Not sure though.
[02:26:17] Radar: selected for what?
[02:26:25] ner0x: Radar: Deletion, email, table. etc.
[02:28:17] ner0x: Next question. Is migrating to Rails 4 from a 3.2.13 app difficult?
[02:30:19] rushed: ner0x: like most upgrades, it depends on your application :)
[02:30:43] ner0x: rushed: It's not too in depth yet. Just wanted the native hstore support.
[02:43:49] jdunck: serious question: how do people debug rails/ruby?
[02:44:46] lethjakman: jdunck: I use Rails.logger.info a lot, and you want to have tests for everything.
[02:45:14] lethjakman: jdunck: http://guides.rubyonrails.org/testing.html
[02:46:07] jdunck: lethjakman do you modify the rails source to add logger calls? (the problem i'm currently chasing is that a controller call under test is return 404 when afaics, it should be 200. i've verified the method is being called. i can't see a problem w the related view. using the debugger seems.. kind of broken.
[02:46:27] jdunck: (thanks for response, i'm just a bit frustrated with this. :(
[02:47:07] lethjakman: jdunck: you're fine. wait, you're trying to debug rails itself or something you've built?
[02:47:09] Radar: ner0x: try it and find out
[02:47:12] Radar: jdunck: pry gem
[02:47:32] jdunck: i'm trying to debug my app, but i can't figure out why 404 is being returned instead of 200
[02:47:47] jdunck: so i'm stepping into (or logging) rails layer trying to figure it out.
[02:48:02] lethjakman: jdunck: ahh ok. what server are you using? if you're not already using it passenger is really great
[02:48:23] rushed: jdunck: if you gist the console logs of the request, your routes & controller you might get a faster answer :)
[02:48:24] lethjakman: you get logs of what routes it's trying to follow as you submit requests.
[02:48:30] jdunck: currently zeus - the startup time is awful otherwise. this is under test, if it's not clear.
[02:49:16] lethjakman: jdunck: well I'm guessing your app is erroring out somewhere (just a guess.) so it's not returning anything. Rails.logger.info your params, and check your logs.
[02:50:11] jdunck: thanks, i'll try adding more logs.
[02:50:22] jdunck: Radar where would i insert a pry call?
[02:51:17] Radar: jdunck: where is it breaking?
[02:51:43] jdunck: it's just returning 404 instead of 200
[02:51:56] Radar: Rails does not simply return 404s whenever it feels like it!
[02:52:01] Radar: Show us the code that is returning the 404, please.
[02:55:07] helpa: jdunck: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[02:55:07] Radar: jdunck: !gist
[02:55:17] slash_nick: and the stack trace... those things usually help
[02:55:26] jdunck: no stack trace
[02:55:32] slash_nick: wait no stack trace lol
[02:55:38] Radar: slash_nick: it's a 404
[02:55:40] jdunck: as i said, it's 404, not 200
[02:55:43] Radar: of course there is no stacktrace. it is not an exception
[02:55:46] Radar: jdunck: code please
[02:55:56] slash_nick: ACTION facepalms
[02:56:24] jdunck: Radar i can share, but i'll have to trim it down some. it's a very large app.
[02:58:26] guipereira: Hello guys, just pop into my head one thing, how you choose to use class methods or instance methods ?
[02:59:19] Radar: guipereira: is the method applicable to the class or the instance?
[02:59:37] jdunck: welp, i now spot it, but not through getting any better at debugging rails suff.
[02:59:48] jdunck: i was using an undefined instance variable from the controller.
[02:59:49] guipereira: its more like a util method
[03:00:11] jdunck: ACTION scratches chin
[03:00:17] guipereira: it doest has state
[03:00:26] Radar: jdunck: and that was causing a 404?
[03:00:31] Radar: jdunck: that sound be more like a 500
[03:00:43] jdunck: not sure what to say..
[03:00:57] ulius: Can't seem to find this in the docs for rbenv: are they 100% for installing/compiling each ruby version on a user by user basis (i.e. no system wide rubies at all?). Or is this just the convention?
[03:02:30] jdunck: Radar fwiw, the nil deref would have happened in a route helper *_path(nil)
[03:02:33] slash_nick: ACTION unfacepalms
[03:03:12] Radar: ulius: yes, user by user basis only
[03:04:12] ulius: Radar: interesting
[03:04:25] ner0x: Radar: Ugh... That takes like... work and effort n shit.
[03:13:58] sodacrunch: when starting to learn rails, and running the command, rails new blog, there was a note saying "This will create a Rails application called Blog in a directory called blog and install the gem dependencies that are already mentioned in Gemfile using bundle install." but what gem dependencies is it speaking of?
[03:14:45] Radar: "install the gem dependencies that are already mentioned in Gemfile "
[03:14:52] Radar: sodacrunch: You answered your own question.
[03:16:11] sodacrunch: ah right, so when you install rails, there are still more dependancies to install once you create an app using the command
[03:16:51] lethjakman: is there somewhere in the guides that describes how to use has_and_belongs_to_many with the model? I have the database set up but I can't figure out how to create new ones.
[03:18:16] tigris_: I tend to leave port 80 open on my router and forward to port 8080 on my development machine, usually for paypal stuff so I can test the IPNs properly, and it's just generally handy.... but it seems the hax0rs have cottoned on to me, and my rails logs of late are filled with requests for http://wpad.myhomedomain.com/wpad.dat
[03:19:00] tigris_: i don't suppose there is a simple rack middleware that just dumps all these hacker requests? there are various others as well, such as /announce, but wpad.dat is by far the most common
[03:21:43] rushed: tigris_: … you probably want to stop doing that ><
[03:24:00] tigris_: rushed: yeah i probably will stop now and just open it when i need it, but would still be good to drop those requests in prod as well, before they get to rails routing... i'm sure someone is maintaining a list of known routes hackers poll for, some of them even generate a rails error in trying to generate the params hash
[03:24:58] rushed: tigris_: you shouldn't need it. dev machines are generally operated in modes designed to provide as much access & information as possible (to aid development)... that's essentially the opposite of what you want on a machine that is exposed to the internet
[03:26:40] tigris_: rushed: i do a lot of paypal IPN stuff, they send real IPNs back from their sandbox environment, so makes sense to test the real request coming in rather than some "mock" IPN i make up myself
[03:28:03] rushed: tigris_: exposing dev machines to the open internet is a terrible idea, providing reasons it might be useful doesn't really change that :)
[03:29:56] jdunck: Radar lethjakman thanks for your feedback earlier. lovely to be greeted by helpful people.
[03:30:20] lethjakman: jdunck: anytime :) did you figure it out?
[03:30:38] jdunck: lethjakman yes, i was passing nil to an url *_path helper
[03:30:55] jdunck: which apparently was swallowed in rendering(?) under test.
[03:30:55] lethjakman: lol that will do it.
[03:31:01] jdunck: i don't know why it was 404 instead of 500
[03:33:30] ner0x: Okay so what do I exactly do to upgrade from 3.2.13 to 4.0.0 ?
[03:33:38] ner0x: To the Gemfile specifically.
[03:36:06] sodacrunch: ner0x: I would like to know as well, my guess is "gem update rails"
[03:36:18] chrislerum: ner0x: you've created a new rails 4 app and looked at it?
[03:36:23] rushed: ner0x: you might consider finding an article or guide on upgrading, or create a clean 4 app and move the changes over to yours
[03:36:34] ner0x: chrislerum: I'm actually doing that right now. lol
[03:36:46] treehau55: there has got to be some better way to run tests in jruby that doesnt involve throwing more memory to the heap or some other crazy combination of java flags
[03:37:01] treehau55: this is just awful. I feel like Ive tried everything
[03:38:07] willbradley: treehau55: i'm running capybara tests on a netbook, i feel your pain
[03:38:26] treehau55: willbradley, holy jesus I just wouldn't even at that point
[03:39:42] treehau55: I tried messing with nailgun, I tried drip, I tried a wide assortments of jruby_opts, no dic
[03:44:43] ner0x: I think I'll just finish the app at 3.2.13 and migrate at a later date.
[03:50:06] tigris_: ner0x: 3.2.14 in a week or 2 ;)
[03:52:13] ner0x: tigris_: Hells yes. Something to look forward too.
[03:52:23] ner0x: I did, however, get hstore working.
[03:53:16] willbradley: wtf i'm trying to write a feature rspec and access the session var, but it won't let me: http://stackoverflow.com/questions/5481445/rspec-spec-helper-access-to-session-variable
[03:53:28] willbradley: i get "undefined local variable"
[03:54:11] rushed: willbradley: request/feature/etc specs you just interact via the "browser"
[03:55:00] willbradley: i'm trying to forge my own auth token so i can test form security. any ideas on accessing or resetting the auth token?
[03:57:52] willbradley: feature specs obviously have some ability to touch the db/etc
[04:06:13] ssb123: I have a model that has min and max value columns. Any idea how I can validate that there is no overlap? So that the range is unique..
[04:07:00] treehau55: in rspec is there a way to test message expectations on real objects, not just doubles?
[04:07:12] treehau55: trying to test method delegation
[04:08:12] treehau55: aha! I cannot spell receive.
[04:09:48] ssb123: I need a solution! Ahh
[04:14:11] ssb123: no ideas?
[04:16:36] chrislerum: ssb123: you know how you can write your own custom validation methods?
[04:17:13] ssb123: not really
[04:22:39] ner0x: Trying to create a selection method for a table. Would it be crazy to ajax the selection and update a hstore column on the record or would it make more sense to use cookies?
[04:24:00] lgarvey: ner0x: what do you mean by "a selection method"
[04:29:24] ner0x: lgarvey: A way to tell which rows are selected and which aren't. That persist along a pagination. So they'll have to be stored in either cookies, session, or database.
[04:31:11] lgarvey: ner0x: you mean you have like a checkbox beside rows?
[04:32:47] lgarvey: I'd ignore the pagniation requirement, get that working properly without pagination and then enhance it to use javascript and ajax pagination so you use the dom to prepare the form like chrislerum suggests.
[04:45:42] sodacrunch: im never learning Rails on Windows again, its been hell
[04:50:17] helpa: The Active Record Validations and Callbacks Guide - http://guides.rubyonrails.org/active_record_validations_callbacks.html - Written by Jaime Iniesta
[04:50:17] Radar: !validations
[04:50:29] Radar: sodacrunch: Good <gender-specific pronoun goes here>
[04:54:41] RubyPanther: Good biological unit. *pat* *pat* *pat*
[05:14:06] lethjakman: hey so I have a has_and_belongs_to_many relatinoship between media and users, what makes the table media_users instead of user_medias ?
[05:14:36] Lewix: convention
[05:14:43] lethjakman: Lewix: how so?
[05:14:57] lethjakman: I mean...they both belong to eachothre. is it alphabetical?
[05:15:44] Lewix: lethjakman: can you rephrase please. I'm not sure I follow you
[05:17:03] lethjakman: what are the rules to give it that name?
[05:17:45] harryhcs: hi, Im struggling with recursive self relations. I am trying to add a company to a company as a subsidiary, and so on.
[05:18:36] harryhcs: The problem Im facing is I want to add a subsidiary company to a parent company. But as I have it Im adding subsidiaries as parent companies.
[05:18:42] helpa: lethjakman: http://guides.rubyonrails.org/association_basics.html - Active Record Association Basics by Mike Gunderloy
[05:18:42] Radar: lethjakman: !associations
[05:19:26] Radar: Also explained better here: http://radar.github.io/sume/#!/search/ActiveRecord::Associations::ClassMethods#has_and_belongs_to_many
[05:20:19] harryhcs: This is what I have done sofa, like the documenations http://stackoverflow.com/questions/17726359/rails-models-has-many
[05:20:55] sodacrunch: Radar: would it be best for me to just use ruby 1.9 and rails 4, instead of ruby 2.0 and Rails 4 which seem to have issues for people getting started?
[05:21:09] Radar: sodacrunch: what issues? Where are you looking to see these issues that I am not?
[05:21:42] Lewix: lethjakman: apparently it's calculated using the < operator between the two strings
[05:21:44] rushed: sodacrunch: ruby 2 and rails 4 are like peanut butter and chocolate
[05:23:42] harryhcs: I do this afterwards rails g migration add_parent_company_id_to_companies parent_company_id:integer
[05:23:50] harryhcs: is that correct?
[05:24:11] sodacrunch: I am reading all the crap online as far as Linux distros and updating Ruby from 1.9 to 2 is sometimes a pain, and one person will say to use rvm and then another to use rbenv, and that a simple apt-get install ruby wont suffice as far as installing the latest, etc etc
[05:25:17] rushed: sodacrunch: you should be using a ruby version manager (rvm, rbenv, or another) not the system ruby or something from a package manager but that doesn't really have anything to do with ruby 2 & rails 4 :)
[05:25:45] harryhcs: At the moment I save A with subsidiary B. Then when i look at B it tells me it has one subsidiary A!
[05:25:46] rushed: sodacrunch: if you ask about the specific platform you're working with someone might provide a link to a tailored setup guide :)
[05:26:06] rushed: sodacrunch: unless you say windows :P
[05:26:09] sodacrunch: ok cool, thanks rushed
[05:26:56] sodacrunch: is there a recommended distro?
[05:27:14] rushed: sodacrunch: ubuntu is a safe bet in terms of finding information
[05:27:45] certainty: ubuntu is a safe bet in terms of being as annoying as possible
[05:28:15] lethjakman: ahh it is lexical
[05:35:34] ner0x: lgarvey: So you're saying ignore the persistence requirement and just have the select what's currently in the DOM.
[05:36:00] lgarvey: ner0x: you've made up the persistence requirement
[05:36:16] ner0x: lgarvey: That's true.
[05:36:18] lgarvey: ner0x: the actual feature you're trying to implement is to select rows in a table and submit them to the backend
[05:36:25] lgarvey: ner0x: but the problem you have with that is you table is huge
[05:36:54] lgarvey: ner0x: fix that problem with javascript
[05:37:17] ner0x: That's easy enough.
[05:39:46] ner0x: lgarvey: Thanks. I'll just remove the "over-pagination" portion and have whatever is selected on the DOM be what's removed. Makes things quite a bit easier.
[05:41:21] Apane: any good comment gems besides disqus?
[05:42:49] rushed: Apane: Disqus is an external service so it's not exactly just a gem, but you might find these useful https://www.ruby-toolbox.com/categories/rails_comments http://railscasts.com/episodes/154-polymorphic-association-revised
[05:44:51] codeshah: hey guys, I have some HTML content want to convert all <img src=" to base64 encoded .. what's the best way?
[05:47:57] Apane: rushed, cool thanks
[05:50:04] sodacrunch: goodnight friends
[05:50:38] Apane: goodnight brother
[05:52:37] lethjakman: hey, I have a insert that looks like this: https://gist.github.com/lethjakman/6036943
[05:52:50] lethjakman: it's failing a unique constraint (as it should) but I'm not sure how to fail gracefully. any ideas?
[06:13:03] willbradley: lethjakman: try the first result https://www.google.com/search?q=handle+unique+constraint+rails
[06:15:06] harryhcs: Hey, I would I do this for a check box? So Iw ant to check something and then check it? <%= c.check_box :parent_id, {checked: "#{if @company.subsidiaries.all.map(&:id).include? company.id then true end}" } %>
[06:15:20] lethjakman: willbradley: I actually tried something very similar to that already: https://gist.github.com/lethjakman/6036943
[06:15:29] lethjakman: it doesn't seem to be caught. maybe I'm doing something wrong?
[06:17:39] xavier23: HI….. can somebody explain the `fields_for` helper?
[06:17:43] lethjakman: willbradley: actually...just saw the one later on with the controller action and that work.s so thank you! :)
[06:18:02] xavier23: And why it fails silently in HAML?
[06:30:19] harryhcs: Im adding a checkbox to my template, why is there a hidden input field above the checkbox with a value of 0 ?
[06:30:49] harryhcs: <%= c.check_box(:parent_id, (@company.subsidiaries.all.map(&:id).include?(company.id) ?{:checked => true} : {:checked => false}), company.id) %>
[06:32:00] xavier23: oh thank god
[06:32:50] xavier23: harryhcs: paste your full view to http://vpaste.net
[06:33:22] oceanbreeze: Sup guys, someone already got the new Ruby 2.0 pickaxe book?
[06:33:33] tagrudev: just use gist
[06:33:52] harryhcs: xavier23:http://vpaste.net/UCoVo
[06:37:33] xavier23: Is it related to this? ` company_path(company, :id => company.id) `
[06:38:08] xavier23: Try @company.id
[06:38:38] xavier23: Or.. check the use of @company and company in this code block
[06:38:44] xavier23: Something looks wrong
[06:38:49] harryhcs: the ID is set, I can see it in the checkbox value correctly
[06:39:05] harryhcs: @company would be the company variable sent to the template, not the company in the loop
[06:41:45] xavier23: Does the hidden field disappear when u remove the check box?
[06:43:46] harryhcs: I guess its so that when a check box is checked the input needs to be updated with its parent id
[06:43:51] harryhcs: i means its value
[06:45:11] willbradley: any idea why this cancan ability would not get overridden by a "can read newsitem"? can :read, NewsItem, {office_id: nil, news_submission: { state: 'accepted' }}
[06:45:56] willbradley: it's like the hash is overriding all other less-specific definitions
[06:46:11] xavier23: harryhcs: Well when a checkbox is checked, it's usually sent to the browser in params
[06:46:26] xavier23: When it's unchecked, nothing is sent
[06:47:12] harryhcs: ja thats the problem i guess
[06:47:28] harryhcs: i don't get it, the impty ones
[06:47:40] xavier23: harryhcs: I just read this on the docs
[06:47:57] xavier23: `The HTML specification says unchecked check boxes are not successful, and thus web browsers do not send them. Unfortunately this introduces a gotcha: if an Invoice model has a paid flag, and in the form that edits a paid invoice the user unchecks its check box, no paid parameter is sent. So, any mass-assignment idiom like @invoice.update_attributes(params[:invoice]). wouldn’t update the flag.
[06:47:57] xavier23: To prevent this the helper generates an auxiliary hidden field before the very check box. The hidden field has the same name and its attributes mimic an unchecked check box. `
[06:48:22] xavier23: http://apidock.com/rails/ActionView/Helpers/FormHelper/check_box
[07:09:47] Syrit: hello guys, In my app, I'm using MongoDB, and Nested attributes are not working, could this be because am not inheriting from ActiveRecord::Base ? should i do it in the first place ?
[07:14:10] prsn: Hi! I'm trying to render an ERB template with bindings from a hash, as described here: http://splatoperator.com/2012/07/render-a-template-from-a-hash-in-ruby/
[07:14:26] prsn: however, bindings in the function scope shadow those in the passed in hash
[07:14:42] prsn: it seems like the author of that page didn't realize this. Is there a more correct way to do this?
[08:00:31] tagrudev: anyone using a gem for the foursquare api ?
[08:03:52] oceanbreeze: Guys give me an idea how to build an image gallery in rails via file uploading
[08:04:55] rushed: oceanbreeze: you might find these useful http://railscasts.com/episodes/253-carrierwave-file-uploads http://railscasts.com/episodes?search=image
[08:10:30] thrillERboy: Hi, How do I send an extra attribute with each input?
[08:11:19] thrillERboy: I have many book_extras, which belongs_to book model, book accepts nested attributes, but each book_extra is different type
[08:11:41] rushed: thrillERboy: you might find this useful http://railscasts.com/episodes/196-nested-model-form-revised
[08:11:45] oceanbreeze: rushed: Thanks, but maybe you have preconfigured gallery that you can share with me ? :P
[08:12:04] oceanbreeze: rushed: or just some parts :)
[08:12:13] thrillERboy: rushed: thanks thanks :)
[08:12:21] thrillERboy: ACTION running to rails casts
[08:12:56] rushed: oceanbreeze: did you see the "source code" link next to download? :P
[08:13:31] oceanbreeze: rushed: Yes, but example listed in it is quite primitive, i am lookin for something more complex
[08:13:43] rushed: oceanbreeze: you might find this useful http://www.squarespace.com
[08:18:21] prsn: Hi! I'm trying to render an ERB template with bindings from a hash, as described here: http://splatoperator.com/2012/07/render-a-template-from-a-hash-in-ruby/
[08:18:24] prsn: however, bindings in the function scope shadow those in the passed in hash
[08:18:27] prsn: it seems like the author of that page didn't realize this. Is there a more correct way to do this?
[08:20:05] vikewoods: Hey guys can some 1 help me pls with this https://gist.github.com/vikewoods/6037567
[08:49:15] jonahR: If anyone is interested, here is a free hall pass for CodeSchool, cheers! http://go.codeschool.com/9QTYTQ
[09:20:30] varfoo: hey losers :P
[09:21:02] varfoo: i receive this issue when i push to heroku... ssh: connect to host varfoo.com port 22: Connection timed out
[09:21:02] varfoo: fatal: Could not read from remote repository.
[09:21:36] varfoo: any thoughts or idea's on how to fix this prob? git remote setup seems fine, and heroku keys are there.
[09:22:35] vikewoods: hey help please =(((( https://gist.github.com/vikewoods/6037567
[09:27:09] mikecmpbll: i've created a bunch of objects and I want to save them but if any one fails I need to rollback the whole lot. I tried just wrapping it in a transaction but this doesn't appear to werk.
[09:28:56] nobitanobi: mikecmpbll, show your code
[09:30:39] mikecmpbll: https://gist.github.com/mikecmpbll/ec0ffaeea98f560e576f
[09:31:13] mikecmpbll: it bows out with an exception and i'm left with fragmented data that's persisted in my DB.
[09:31:57] slash_nick: mikecmpbll: it'd help to add the exception...
[09:32:14] mikecmpbll: slash_nick: I can't see how the exception is of any relevance.
[09:32:52] mikecmpbll: ahhh balls, wait a minute.
[09:32:58] slash_nick: I can't see how it's not
[09:33:33] slash_nick: ignoring the fact that you're giving us fake code
[09:34:10] mikecmpbll: slash_nick: the code isn't fake, the hash is fake because the actual hash contains about a million values.
[09:38:57] vikewoods: no luck for me ? =(
[09:39:09] slash_nick: mikecmpbll: If I could read the stack trace, I'd confirm that you're not lying and the exception is in fact occurring inside the block as you claim... the fact that your gist says "something like" tells me ... "this is not the code that is producing the exception I don't want to show you"
[09:39:58] mikecmpbll: true enough. you wins on that one.
[09:43:34] slash_nick: vikewoods: take the time to read this closely... in the wiki: https://github.com/sferik/rails_admin/wiki/Railsadmin-DSL
[09:48:02] vikewoods: cant figure out how to do this (
[09:53:18] vmarceti_: how can you with cancan, check if user haves role for current company that he is using. So for example user can have multiple companies but he is admin in company 1 and user in company 2
[09:56:00] slash_nick: vikewoods: I read that the fields for belongs_to associations are hidden by default but can be enabled...
[09:56:23] slash_nick: vikewoods: I also see a number of methods that seem to describe how to configure a label for a field
[09:57:55] vikewoods: rails_admin do
[09:57:55] vikewoods: field :name
[09:57:55] vikewoods: field :child_catalog do
[09:57:58] tagrudev: http://geekandpoke.typepad.com/.a/6a00d8341d3df553ef0134885909e0970c-pi
[10:03:05] vikewoods: https://gist.github.com/vikewoods/6037567#file-model-rb-L35 but how overwrite value of child_catalog.name
[10:07:42] vikewoods: def self.name
[10:07:43] vikewoods: self.catalog.name + self.parent_catalog.name + self.name
[10:07:56] vikewoods: This one doesn't work ((
[10:08:09] jammanbo: Can someone please tell me how to check that two arrays contain the same elements, order ignored, using the MiniTest::Spec style??
[10:15:19] mikecmpbll: I've not had this error before: ActiveRecord::ReadOnlyRecord
[10:15:21] mikecmpbll: https://gist.github.com/mikecmpbll/b7a2a3e2595a15e939a3
[10:16:34] sevenseacat: an error that doesnt relate to the code above it, excellent.
[10:16:51] mikecmpbll: sevenseacat: in what way?
[10:17:09] sevenseacat: app/controllers/settings_controller.rb:21:in `password'
[10:17:18] mikecmpbll: sorry, line 21 is u.save!
[10:17:42] freesteph: with the asset pipeline enabled
[10:17:46] mikecmpbll: and the raise is a hangover from my debugging, didn't mean to include that, removing now ..
[10:18:01] freesteph: does that mean I can include all non-minifed version of libraries in javascripts/vendor ?
[10:18:49] geoffw8_: Howdy rails. A toughie here, can't get my head round it. I have a constant User::SuperAdmin, and I have a symbol, :super_admin, how can I get from the symbol to the constant? How can I "add" sym.to_s.upcase.constantize to User::
[10:19:31] mikecmpbll: "User::#{sym.to_s.upcase}".constantize ?
[10:19:55] GarethAdams: User.const_get(…)
[10:19:56] geoffw8_: mikecmpbll: ha, what a spanner. If that works. I didn't even consider putting it all inside a string, then constantizing the whole thing
[10:19:57] mikecmpbll: meta programming ftw ...
[10:20:20] geoffw8_: mikecmpbll: It takes about 20 seconds for me to feel like I'm being smart.... to feeling like I've been a total plank
[10:20:43] GarethAdams: you don't mean upcase there though
[10:21:12] geoffw8_: GarethAdams: "INTERNAL_LIMITED = 2"
[10:21:15] geoffw8_: thats the constant
[10:21:29] geoffw8_: bad form for caps constants?
[10:21:31] GarethAdams: oh, I thought it was :super_admin => SuperAdmin
[10:21:59] geoffw8_: re: MetaProgramming
[10:22:07] geoffw8_: its only sort of dawned on me what it is recently
[10:22:26] geoffw8_: very useful
[10:22:33] GarethAdams: User.const_get sym.to_s.upcase
[10:22:35] geoffw8_: I'm surprised I haven't seen more of it
[10:23:03] geoffw8_: ahh, interesting GarethAdams, didn't know classes had a const_get method
[10:23:05] mikecmpbll: rails internals is full of it, but it's generally considered a substitute for poor design if you're using it a lot throughout your code.
[10:23:35] mikecmpbll: a substitute for good design* i should say.
[10:24:27] geoffw8_: cool, well thanks for your helps guys!
[10:24:31] geoffw8_: happy friday!
[10:25:58] geoffw8_: ahh, actually!
[10:26:18] geoffw8_: what I was trying to do is make an is? method, for authentication. So if is? :super_admin
[10:26:38] geoffw8_: nevermind. I need to think about this.
[10:26:58] xhoy: good luck with thinking!
[10:27:54] mikecmpbll: geoffw8_: can you just use rails is_a? method?
[10:28:20] mikecmpbll: current_user.is_a?(User::SuperUser) or whatever.
[10:28:22] universa1: or if is? SuperAdmin ;)
[10:29:30] geoffw8_: roles.map {|r| "User::#{r.to_s.upcase}".constantize}.each {|r| return true if current_user.user_level == r}
[10:29:34] geoffw8_: thats what I landed on
[10:29:43] geoffw8_: def is?(roles)
[10:29:53] geoffw8_: I want it to look pretty in the view
[10:30:28] geoffw8_: I changed the end to a ternary
[10:30:50] mikecmpbll: you don't need return true if, that's code smell!
[10:30:53] mikecmpbll: just return the value.
[10:30:58] geoffw8_: roles.map {|r| "User::#{r.to_s.upcase}".constantize}.each {|r| current_user.user_level == r ? true : false}
[10:31:07] mikecmpbll: you don't need the ternary
[10:31:07] slash_nick: geoffw8_: noooo
[10:31:08] geoffw8_: man I used to use return wayyyy to much
[10:31:21] slash_nick: current_user.user_level == r
[10:31:21] geoffw8_: ok, I'm bracing for a lesson
[10:31:33] mikecmpbll: and you will need the return if you want it to exit the method
[10:31:34] universa1: geoffw8_: hmm, ,each returns the thing it iterated on
[10:31:35] geoffw8_: derr, == returns true or false
[10:31:46] slash_nick: geoffw8_: exactly
[10:32:36] geoffw8_: haha, thanks all. That put a smile on my face!
[10:32:59] universa1: geoffw8_: and i'd put the logic into user.has_level? r; self.user_level.is?(r);end UserLevel; def is?(r); r == :user_level; end
[10:33:22] universa1: but then i don't really like constantize in my code ;)
[10:34:36] slash_nick: vikewoods: the method #name... not the best choice
[10:35:33] slash_nick: vikewoods: see what I mean? Object.name #=> "Object"..... Class.name #=> "Class"
[10:36:20] brazenbraden: anyone use the "best_in_place" gem here? I am having serious issues with it :(
[10:37:08] helpa: brazenbraden: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[10:37:08] universa1: brazenbraden: !used
[10:38:21] brazenbraden: alright... I am using the best_in_place gem. I have followed all instructions. Added it into my application.js file, initilized it, added the tags to the elements and want to edit and have my controllers all set up with RESTfulness and all..
[10:38:45] brazenbraden: When I click the field, it allows me to edit it. BUT on save it reverts back to the original value.
[10:39:10] brazenbraden: in my "inspect element" I get a javascript POST error 404 for controller/id that does not exist apparently
[10:39:11] universa1: brazenbraden: any requests on your controller? anything in the browser console?
[10:39:49] brazenbraden: POST http://0.0.0.0:3000/pandora_contents/2 404 (Not Found) jquery.js?body=1:8707
[10:39:50] brazenbraden: send jquery.js?body=1:8707
[10:39:50] brazenbraden: jQuery.extend.ajax jquery.js?body=1:8137
[10:39:50] mikecmpbll: that'll do it.
[10:39:51] brazenbraden: BestInPlaceEditor.ajax best_in_place.js?body=1:234
[10:39:53] brazenbraden: BestInPlaceEditor.update best_in_place.js?body=1:82
[10:39:55] brazenbraden: BestInPlaceEditor.forms.input.submitHandler best_in_place.js?body=1:374
[10:39:57] brazenbraden: jQuery.event.dispatch jquery.js?body=1:5096
[10:39:57] sentinal8473: what would be the best way to stop a parent recorded that has a belongs_to associated with it
[10:39:59] brazenbraden: elemData.handle
[10:40:03] helpa: brazenbraden: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[10:40:03] universa1: brazenbraden: !gist
[10:40:30] brazenbraden: ah.. sorry :( its been years since i was last on IRC
[10:41:15] brazenbraden: https://gist.github.com/anonymous/980e6f19d3afba05f446
[10:42:24] universa1: brazenbraden: what does your development.log say?
[10:42:45] universa1: brazenbraden: do you have a pandora_contents controller?
[10:42:58] sentinal8473: missed a bit, what would be the best way to stop a parent recorded being deleted, that has a belongs_to associated with it
[10:43:03] brazenbraden: I do. and a PandoraContent model
[10:43:40] dagen: need help! if present '/pages/*' in request.fullpath DO substitution from '/pages/*' to '*', then put '*' to some_param -> value = 'some_param'
[10:43:41] dagen: <%# for example: '/pages/t1' -> value = 't1' %>
[10:44:24] dagen: or maybe present some command wich splitting the request.fullpath separated by '/'?
[10:46:02] brazenbraden: https://gist.github.com/anonymous/009bf5f68e1f08428fb6 <-- it keeps reverting my highlighting to text -.-
[10:46:36] universa1: brazenbraden: rails 4?
[10:46:39] brazenbraden: but I kind of see whats wrong..
[10:46:54] brazenbraden: strong params messup?
[10:46:54] universa1: brazenbraden: than it should be patch not a put request
[10:47:16] rvanlieshout: isn't it just params[:id]? that's really not a strong params thing
[10:47:18] universa1: brazenbraden: no, update is now PATCH
[10:47:19] brazenbraden: I know but I do not specify anywhere what kind of request it should be.
[10:47:32] brazenbraden: rvanlieshout: will change it and give it a try
[10:47:34] universa1: brazenbraden: the best_in_place somewhere does
[10:47:42] universa1: brazenbraden: you're getting a 404...
[10:47:49] brazenbraden: so I need to go digging into the best_in_place internal code?
[10:48:37] universa1: was misreading something
[10:48:39] universa1: time for lunch
[10:48:40] dagen: anybody pls help...
[10:48:56] brazenbraden: i have an update
[10:49:27] brazenbraden: removed the strong params but and just put int params[:id] like rvanlieshout suggested.. Now I get a 500 Internal Server error
[10:49:57] universa1: dagen: check the routes docs/guide, there should be something in there for fetching even nested params.
[10:50:39] universa1: dagen: http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
[10:50:56] brazenbraden: The 500 error is caused by "NoMethodError (undefined method `stringify_keys' ...)" apparently
[10:51:17] brazenbraden: stringify_keys being a best_in_place thing?
[10:51:32] universa1: brazenbraden: no. please show the full code of your controller and the full error
[10:51:51] dagen: universa1 but how i can get the name of /pages/<some_name> if there is dynamic pages controlled with some gem not routes.rb
[10:51:54] brazenbraden: ok. one sec while I put that together in a pastbin
[10:52:13] universa1: dagen: what?
[10:52:42] dagen: i need to parse some path
[10:52:46] universa1: dagen: then maybe start telling us what gem you are actually using...
[10:52:53] dagen: this path is not present in routes.rb
[10:54:10] brazenbraden: universa1: http://pastebin.com/0H2p4RxC
[10:54:21] dagen: universa1 i think textism
[10:54:28] universa1: dagen: you think?
[10:54:41] vikewoods: http://stackoverflow.com/questions/17741593/rails-3-model-associations-model-with-rails-admin
[10:55:04] dagen: i just try to get request.fullpath and parse from it /pages/ thats all
[10:56:00] brazenbraden: universa1: https://gist.github.com/anonymous/247bb35b36cfe7602eab
[10:56:13] universa1: dagen: then do that...
[10:56:57] dagen: i try this: <% url = URI.parse(url) %> <% url = URI.parse("/pages/#{url}") %>
[10:57:12] dagen: but nothing work
[10:57:45] universa1: brazenbraden: i just made your gist readable: https://gist.github.com/universal/a650cd98447b1f2ef365 ;-)
[10:57:52] universa1: dagen: what is url?
[10:58:02] brazenbraden: Thanks.. I selected Ruby but it just went all boring on me after saving
[10:58:12] dagen: universa1 hmm i stucked
[10:58:50] universa1: brazenbraden: debug what you get returned from update_page_params
[10:58:57] universa1: brazenbraden: you're referencing non existing keys ;)
[10:59:27] brazenbraden: I figured that but I'm not sure why.. I will go ahead and debug those things.. see where my id is going..
[10:59:29] universa1: dagen: then start by telling what you're actually trying to achieve. and no that's not parsing pages from a string...
[11:00:04] brazenbraden: I gotta scooch for a bit.. meeting.. I will be back a little later and check it out... thanks for alerting me to the development.log file lol.. didnt know it was there and it helps
[11:00:09] dagen: universa1 i try to split request.fullpath
[11:00:16] universa1: dagen: why?
[11:00:31] universa1: dagen: what is the non-code(!) reason for this?
[11:00:32] dagen: i need second part of them
[11:00:54] dagen: because i'm newbie and i dont know how to do this by other way
[11:01:02] universa1: dagen: what are you trying to do?
[11:01:08] universa1: abstract level!
[11:02:10] dagen: universa1 i have request.fullpath= '/pages/somepage' and i need to get somepage from this url to some_param.
[11:02:24] universa1: dagen: why do you need to get somepage ???
[11:02:36] dagen: to use this somepage in value=''
[11:02:59] dagen: Because i need to post form with this value
[11:03:51] GarethAdams: dagen: this sounds like a job for ROUTING
[11:04:17] universa1: GarethAdams: he doesn't even know the gem which generates the routes...
[11:04:27] GarethAdams: you probably already have a params[] variable with this in?
[11:04:42] dagen: i have some gem wich controlling the new page creation, but for using this page i must add them to DB
[11:04:57] universa1: dagen: what is the name of "some gem"
[11:05:02] GarethAdams: dagen: is /pages(/:something) in the output of `rake routes`?
[11:05:15] universa1: dagen: have you inspected params? and as GarethAdams
[11:05:25] dagen: how i must inspect them?
[11:05:31] universa1: dagen: http://rubygems.org/search?utf8=%E2%9C%93&query=textism
[11:05:40] universa1: and with that I'm off to lunch.
[11:05:44] jammanbo: Has anyone got any hints about this error? NoMethodError: undefined method `unresolved_deps' for Gem:Module. It seems to be related to `include Mongoid::Document' in my models and is thrown whenever I try to use a model.
[11:05:58] GarethAdams: dagen: run `rake routes` from a terminal window, in your project directory
[11:06:24] universa1: GarethAdams: hf gl ;-)
[11:06:27] GarethAdams: can you see one starting with /pages
[11:06:52] GarethAdams: paste that line here
[11:07:08] dagen: http://pastebin.com/Kic0hRpf
[11:07:10] GarethAdams: (make sure it has GET in there somwhere)
[11:07:26] GarethAdams: dagen: ok, so all you need is params[:id]
[11:07:31] GarethAdams: that will have the value in
[11:07:40] dagen: hm just a moment..
[11:08:28] dagen: you genius!
[11:08:42] dagen: GarethAdams very big thanks
[11:08:45] GarethAdams: string manipulation is for losers
[11:09:01] dagen: and how i can get first /pages?
[11:09:23] GarethAdams: dagen: what would you need that for?
[11:09:27] dagen: where i can read about this?
[11:09:57] GarethAdams: dagen: (usually you wouldn't. The point of routing is that the text in the URL doesn't have to relate to the action that is called)
[11:11:35] GarethAdams: dagen: tell me what you think you want to do with '/pages' and I'll tell you what you actually want to do :)
[11:11:54] Syrit: Hello, In my app, I have Client, and a Contact model, i've set nested attributes so that client model can add and remove contacts, Now, the Client can have more than one contact, and what i want is, to have a button "Add more contact" to the client _form, so the user can add more contacts, Any ideas how would i do that ?
[11:12:25] dagen: i try to detect present of '/pages/' in request.fullpath by <% if request.fullpath bla-bla-bla '/pages/' %> bla bla <% end %>
[11:12:45] dagen: and if pages is present displays some text
[11:13:10] dagen: GarethAdams something like that )
[11:13:51] GarethAdams: dagen: which file would you be putting this code in?
[11:14:07] GarethAdams: /app/views/(what?)
[11:14:35] dagen: app/views/home/404.htm
[11:14:38] dagen: app/views/home/404.html.erb
[11:16:14] dagen: i like ruby on rails very much but i'm fully newbie... yet
[11:17:49] GarethAdams: dagen: in that case I would probably check the value of controller.controller_name
[11:18:27] GarethAdams: but a lot still depends on why you're trying to show text only when you have a page that doesn't exist
[11:20:59] dagen: http://pastie.org/8155371
[11:21:10] dagen: GarethAdams this is my controller for pages
[11:21:56] GarethAdams: dagen: that's not so relevant. The question (again) was why
[11:23:03] GarethAdams: dagen: there are lots of ways to "Show some text depending on [something]", but without knowing what specifically the point is, I can't suggest the correct way
[11:23:22] dagen: if i get an 404 error when some page is not present yet. i try to display the button wich creates the new page content, but only for urls with /pages/*
[11:23:45] GarethAdams: so you don't need to use the generic 404 page
[11:23:48] dagen: this buttons open pages/*/edit to add new text for this new page
[11:24:18] dagen: i have many pages on my site and for some of this pages i dont have the text yet
[11:24:39] dagen: and if i try call url /pages/page_without_text i have an 404 error
[11:25:03] dagen: and i must to choose igonre this error or add a new text for this page and then page with appears
[11:26:12] dagen: with this button i post the form wich creates new page and forward me to editing the text of they
[11:26:15] freesteph: having trouble validating presence of a datetime field
[11:26:33] freesteph: validates :arrival_date, :presence => true
[11:26:49] freesteph: yet, FactoryGirl.build(mymodel, :arrival_date => nil) is valid
[11:27:24] rvanlieshout: freesteph: is valid because .valid? returns true?
[11:27:49] dagen: GarethAdams maybe ror haves something like: <% if request.fullpath contains '/pages/' %>?
[11:28:05] GarethAdams: dagen: I already told you about string manipulation
[11:28:10] mikecmpbll: i'm trying to apply a scope to all uniqueness validations on a AR model, but it has to be done with a mixin, anyone got any clue how I'd go about that?
[11:28:24] dagen: GarethAdams i miss it. where&
[11:28:33] GarethAdams: dagen: it's for losers, you don't need it
[11:28:36] freesteph: rvanlieshout: it is valid, but it shouldn't because the date is nil
[11:28:45] GarethAdams: dagen: I also already told you about controller.controller_name
[11:28:58] dagen: GarethAdams and what i mut to do in controller?
[11:28:59] GarethAdams: which is better, but still not "right" for what you're doing
[11:29:12] dagen: i post them to pstie but i dont understand what i must to do
[11:29:42] GarethAdams: dagen: I think the best solution is this:
[11:30:07] GarethAdams: in your controller add `rescue_from ActiveRecord::RecordNotFound, :with => :page_missing`
[11:30:27] GarethAdams: add that below your load_and_authorize_resource line
[11:30:33] rvanlieshout: freesteph: and what's the output of .inspect for that object?
[11:30:44] rvanlieshout: and of .errors.to_a after .valid?
[11:30:55] dagen: GarethAdams i m newbie for this yet(
[11:31:20] GarethAdams: dagen: that's ok - it doesn't stop you adding that line does it?
[11:31:34] GarethAdams: dagen: then add a page_missing.html.erb inside your /app/views/pages/
[11:31:39] freesteph: rvanlieshout: inspect shows a nil date
[11:31:59] freesteph: and my test is expect(gift).to have(1).errors_on(:arrival_date)
[11:32:04] freesteph: but it has 0
[11:32:09] GarethAdams: dagen: what that says is, whenever a record can't be found, use page_missing to deal with it
[11:32:21] dagen: GarethAdams undefined method `page_missing' for class `PagesController'
[11:32:52] GarethAdams: so you can add a `def page_missing` inside that controller
[11:33:28] dagen: what next? :)
[11:33:46] GarethAdams: put something in the new view and see if it gets rendered
[11:35:39] dagen: GarethAdams nothing rendered
[11:35:46] dagen: just a blank page
[11:36:54] dagen: GarethAdams http://prntscr.com/1gaygk
[11:38:00] GarethAdams: you may need to `render :action => :page_missing` inside the def page_missing
[11:38:08] dagen: GarethAdams http://prntscr.com/1gayml
[11:38:09] GarethAdams: I thought it was implied but maybe not
[11:38:44] dagen: GarethAdams i can see some text placed in view
[11:40:27] GarethAdams: dagen: great!
[11:41:00] GarethAdams: dagen: so, that view will only be shown when a page is missing. There's no need to worry about checking for '/pages'
[11:41:18] dagen: GarethAdams you right! damn
[11:42:18] GarethAdams: dagen: does it make sense how this all works?
[11:42:26] dagen: GarethAdams now i can add cheking of admin or customer role
[11:42:37] dagen: GarethAdams yes
[11:42:55] GarethAdams: dagen: correct, and you can do a lot in the page_missing method if you want
[11:44:38] dagen: GarethAdams thank you))
[11:45:12] avril14th: Hello, doesn anyone know a gem a manage calendar events?
[11:45:40] avril14th: like calendar dates, book events, get business days
[11:46:46] dagen: GarethAdams and if i want to check user by role admin or not? i set IF and then if role is customer want to render error404.html.erb
[11:46:59] dagen: GarethAdams i must: render not_found?
[11:47:07] GarethAdams: dagen: not necessarily
[11:47:15] GarethAdams: dagen: don't check "whether they are an admin"
[11:47:15] dagen: but how else?
[11:47:27] GarethAdams: check "whether they can create a page"
[11:47:41] GarethAdams: have you set up your cancan ability.rb file?
[11:47:43] dagen: really good idea
[11:47:51] dagen: yes i can
[11:48:32] GarethAdams: if you've got the right things in your ability.rb then your page_missing can contain `if can? :create, Page`
[11:50:38] dagen: GarethAdams http://prntscr.com/1gb0bz
[11:50:44] dagen: my ability.rb
[11:51:02] GarethAdams: dagen: cancan has plenty of documentation
[11:51:29] GarethAdams: if you have specific problems then feel free to ask, but I don't think you need your hand held every step of the way :)
[11:52:09] GarethAdams: dagen: the point is, now you have a place to put this code and you know that you can use an `if` statement and `render :action => [something]`
[11:52:37] dagen: render :action => [something]
[11:53:06] dagen: like this? render :action => :not_found
[11:53:24] GarethAdams: just like you already added
[11:53:34] GarethAdams: although, :not_found isn't very descriptive
[11:54:27] dagen: i try to render error404.page if user cant edit page
[11:54:40] dagen: i must set not_found first in controller?
[11:55:37] GarethAdams: all `render :action =>` does is tell Rails which view to render
[11:56:07] GarethAdams: but you should name it in a way that explains what the page is for
[11:56:52] dagen: i found this http://prntscr.com/1gb188
[11:57:03] dagen: in my application_controller.rb
[11:57:56] rvanlieshout: ik zal het met martijn verder oppakken. dat wordt na volgende week. is dat ok?
[11:57:59] dagen: o'm confused
[11:58:06] GarethAdams: you might have a view that lets users create a missing page
[11:58:17] rvanlieshout: i need irrsi to display the active window better :)
[11:58:22] GarethAdams: dagen: so you would probably call that create_missing_page.html.erb
[11:58:32] GarethAdams: dagen: and then render :action => :create_missing_page
[11:59:01] dagen: i allready have no_found.html.erb but i cant render them (
[11:59:38] GarethAdams: if it's not in the same folder, you will need to render `:template => "/foo/bar"`
[11:59:50] GarethAdams: `render :template => "/foo/bar"`
[12:00:06] GarethAdams: where that path starts from the views folder
[12:00:25] GarethAdams: well, like in your last screenshot
[12:00:54] dagen: GarethAdams http://prntscr.com/1gb1te
[12:01:57] dagen: its working!
[12:02:10] dagen: GarethAdams your are the best!) thank you very much)
[12:02:29] GarethAdams: I have no idea why you're typing so many )
[12:03:52] GarethAdams: dagen: as much as possible, try to separate out code that does different things
[12:04:11] GarethAdams: dagen: your original idea would have left you with one MASSIVE view file with lots of different branches in it
[12:04:18] GarethAdams: ain't no one got time for that
[12:12:00] dagen: GarethAdams you right
[12:20:44] IlyaLevin: Hey guys. Two questions on the conventions of Ruby and Rails. 1: I want to merge two configuration hashes in one constant (one part is stored in a yaml file and is fixed, the other is in the database and can be changed by the user). Is it a good idea to access the database in an initializer file?
[12:21:29] IlyaLevin: Sorry, explained wrong.
[12:21:38] harryhcs: lets say I have an array like this ["", "1", "", "2", "" ,"" ] How Can I check how many values are in there? So not counting the "" empty strings? And how would I return the list with only those strings that is not blank?
[12:22:41] avril14th: harryhcs: array.count{ |item| !item.blank? }
[12:22:55] avril14th: and second question
[12:23:27] avril14th: harryhcs: array.count{ |item| item.blank? : nil : item }.compact
[12:23:39] avril14th: this is lazy as it makes two loops
[12:23:46] avril14th: there are faster ways
[12:23:48] avril14th: but im tired
[12:23:51] avril14th: cant type anymore
[12:23:52] IlyaLevin: cities.reject! { |c| c.empty? }
[12:23:57] harryhcs: avril14th: sheet! thats easy enough! my second day on rails, I see the magic :-)
[12:24:09] IlyaLevin: where cities is your array
[12:24:19] avril14th: IlyaLevin: good one
[12:24:30] avril14th: you saved my typing
[12:24:45] IlyaLevin: One question for you may be.
[12:25:48] avril14th: not sure I have answers but u can try
[12:25:57] IlyaLevin: avril14th I need to merge 2 configuration hashes. One is fixed and comes from a YAML file, and second one is dynamic - stored in the database. What is the best way you think to do it?
[12:26:16] avril14th: well, merge! :)
[12:26:33] avril14th: what's wrong with it?
[12:26:34] IlyaLevin: is it fine to merge constants?
[12:26:48] avril14th: you said hashes
[12:26:50] avril14th: not constants
[12:26:52] IlyaLevin: Because I get the fixed part in an initializer
[12:27:03] avril14th: from a yaml file?
[12:27:07] IlyaLevin: so it doesn't get read every time
[12:27:21] avril14th: why make it constant?
[12:27:27] avril14th: you can simply keep it as attribute
[12:27:35] IlyaLevin: can you show me?
[12:27:47] avril14th: want to be sure what you trying to do?
[12:27:51] IlyaLevin: Cause somehow simple variables are not working
[12:28:02] avril14th: show me the initialize in a gist if that's what you want
[12:28:24] avril14th: or I accept stub gists
[12:28:30] IlyaLevin: APP_CONFIG = YAML.load(File.read(Rails.root.join('config','app_config.yml'))).deep_symbolize_keys
[12:28:37] IlyaLevin: This is the only line)
[12:29:09] avril14th: @conf ||= def erase
[12:29:09] avril14th: self.parent.detach_child(self) if parent #Remove itself from the parent's cache list
[12:29:26] DouweM: Don't you just hate people who DDoS GitHub?
[12:29:42] avril14th: DouweM: I know I'm talking here cause I cant access GitHub
[12:30:38] IlyaLevin: you mean something like this? https://gist.github.com/Almaron/6038800
[12:30:58] avril14th: IlyaLevin: https://gist.github.com/muichkine/cd7081b8ba5ca19880f1
[12:31:32] avril14th: what0's wrong with that way of doing?
[12:32:12] IlyaLevin: that's what I was asking if it's OK to merge constants)
[12:32:34] avril14th: well in that case its' not constant
[12:32:40] avril14th: so you can merge everything u want
[12:33:05] avril14th: now also, as far as ruby 2.0 is, you can modify constants anyway, you'll just get a warning
[12:33:13] harryhcs: Say I have this array of objects Company.find(:all, :conditions => ["parent_id == ?", @company.id]) How would i make the parent_id of each blank?
[12:34:03] soahccc: I have an external database (teamspeak 3 tokens) to generate tokens for registered users. This table has no id, no primary key and for some reason not even an index. I can create token but obviously I can't delete them as the query looks something like this: DELETE FROM `teamspeak3`.`tokens` WHERE `teamspeak3`.`tokens`.`` = NULL
[12:34:28] rvanlieshout: Company.where(parent_id: @company.id).update_all(parent_id: nil)
[12:34:48] harryhcs: crazy! rvanlieshout
[12:34:52] soahccc: What is the best way to make a custom deleter without breaking the destroy method with callbacks and stuff?
[12:35:07] rvanlieshout: soahccc: WHERE teamspeak3.tokens IS NULL
[12:35:12] TIJ: i have render :nothing, true on certain case how should i write rspec for this case
[12:35:39] TIJ: means what should i expect(response).to render ???
[12:35:59] TIJ: can anbody help me with this
[12:37:02] elepedus: Could someone tell me where I can find the bootstrap scss files if I install the gem?
[12:37:14] rvanlieshout: elepedus: bundle show <gem>
[12:37:56] IlyaLevin: soahccc I prefer to add a new method.
[12:37:57] glauco291: I am using Rails 4, and in my model I have a date validation (with regex for this format: dd/mm/yyyy). When a check vadality it returns false, inspecting I saw that the date is coming in this format 1990-01-01, I have a pt-BR yml in my locales, Why Rails is using other format?
[12:38:09] IlyaLevin: As long as you follow the CRUD, it's ok)
[12:38:25] rvanlieshout: glauco291: it'll use that format cause your database wants that format too
[12:38:54] glauco291: this field is created as date type in postgres
[12:38:59] soahccc: rvanlieshout: I guess rails tries to use the id column here which does not exist. The token should be unique so I would like to tell rails to use this. The thing is that I don't want to alter the teamspeak3 database.
[12:39:06] rvanlieshout: glauco291: and has a value of yyyy-mm-dd
[12:39:07] IlyaLevin: elepedus - search the gem)
[12:39:16] rvanlieshout: glauco291: you use your locale to present it in a different format... not to save it in a different format
[12:39:31] IlyaLevin: elepedus use bundle show gemname to see where it is and look there
[12:39:32] rvanlieshout: soahccc: then tell rails your primary key is the token?
[12:39:41] elepedus: IlyaLevin: oil thanks :)
[12:39:49] glauco291: all right, but my visitors have to write date in format dd/mm/yyyy
[12:40:16] rvanlieshout: glauco291: that's still doesn't change the way it should be saved
[12:41:01] glauco291: ok, so I have do validate with psql date?
[12:41:51] rvanlieshout: glauco291: you shouldn't validate the format of your date in your model
[12:42:18] rvanlieshout: why do they have to enter it like that? why not just make sure you accept it if they enter it like that
[12:42:28] rvanlieshout: because your model shouldn't know about localization
[12:43:48] universa1: soahccc: hmm, did you try adding a auto-generated pk? maybe ts3 doesn't care :-)
[12:44:11] dEPy: how bad is doing multiple requests per page in single page app?
[12:44:17] rvanlieshout: soahccc: just use the primary_key method
[12:44:20] dEPy: xhr requests that is
[12:46:38] elepedus: I've found the location of the bootstrap gem, but I'm trying to find the actually scss files for my application. Would they be in the gem's directory?
[12:50:32] clocKwize: elepedus: in the asset directory I'd guess.
[12:51:42] elepedus: It's not in there :S
[12:52:50] mosez: elepedus: it's in the gem assets directory.
[12:53:02] mosez: elepedus: what about bootstrap-scss?
[12:53:21] mosez: elepedus: that's the only one i've got running without problems.
[12:53:33] rshetty: I am using Connection Pool to manage workers for Push Notifications using Houston
[12:53:46] rshetty: I am getting "Broken Pipe" and "SSL write error" after some time
[12:54:44] rshetty: Does anybody faced this issue of "broken pipe" and "ssl write" error before
[12:54:54] rshetty: while working with Workers Resque ?
[12:55:50] elepedus: mosez: I've got bootstrap-sass, but none of the assets are in the normal asset locations (but it does work correctly when viewed). I'm just wondering where I would go if I wanted to customise bootstrap itself
[12:56:33] clocKwize: elepedus: the bootstrap gem is just a packaged up version of the source. if you want to modify it, just download the sources and put them in your app
[12:56:54] universa1: elepedus: bundle show bootstrap-sass
[12:56:57] elepedus: OIC, so I can't modify the source if I use the gem?
[12:56:59] clocKwize: but you really should use the bootstrap_and_overrides file to customise it, not changing the actual code
[12:57:22] elepedus: oh, what's that?
[12:57:31] clocKwize: just a file
[12:57:35] clocKwize: an empty file
[12:57:42] clocKwize: that you put your css in that overrides bootstrap..
[12:57:49] clocKwize: you can call it anything you want lol
[12:58:05] elepedus: but then I haven't got the bootstrap source in ther
[12:58:14] elepedus: so i have to overwrite it manually?
[12:58:31] elepedus: a bit like just typing my code in custom.css.scss?
[13:00:06] soahccc: rvanlieshout: Thanks that works :) It adds the primary key to attr_protected (which is good but annoying in my case) but I can live with that, just one thing to edit
[13:01:40] clocKwize: elepedus: yes that is how css works
[13:02:34] soahccc: elepedus: With the sass bundle you can require the parts individually and then override the mixins and variables
[13:03:10] LongLiveBacon: Hi all -- how do I prevent a ruby program from exiting? I am running an external process in a new thread and need to continuously monitor it.
[13:03:58] elepedus: yes, I know that's how css works, I'm just wondering whether it might be in the sporty of DRY to actually modify things in the bootstrap files, rather than just overwriting it with a new file
[13:05:47] soahccc: elepedus: https://github.com/thomas-mcdonald/bootstrap-sass#configuration and I suppose everything else needs to be overwritten after bootstrap
[13:06:24] soahccc: I love the sentence: "As a general rule, errors are something you should try to avoid."
[13:06:33] elepedus: soahccc: sweet thanks :)
[13:11:22] LongLiveBacon: Does anyone have experience using the timers gem? I am trying to run a really simple script but the program exits before it even gets to the timer - https://gist.github.com/anonymous/260072947449dc821dc9
[13:13:08] universa1: LongLiveBacon: loop { timers.wait } -- add that at the end of your script: guess programming from the readme ;)
[13:15:07] clocKwize: LongLiveBacon: as universa1 said. a script will end when it gets to the end of the file, regardless of any other threads running, you need to ensure the main thread (script) doesn't exit until everything else has finished
[13:20:48] soahccc: Is it "safe" to rely on the activerecord session store gem in rails 4? It might not support 4.1 it says... I'm afraid that the 4kb limit with cookies needs a lot of work to not overflow... Just return_to URLs + some other values may exceed this quickly
[13:33:14] stef1a: This is my routes.rb. How can I edit it (or some other file) to make all the paths use singular words (particular for "user")? currently, domain.com/user/x works, but in subdirectories, like domain.com/users/x/profile/edit, the "user" becomes pluralized. How can I make them singular? http://pastie.org/8155655
[13:34:13] DouweM: do not repeat the resources :users, just add :path to the one currently on line 16
[13:34:17] DouweM: why do you want to change the path anyway?
[13:35:23] stef1a: because writing /users/ in the path is clumsy and no one does it
[13:35:27] stef1a: makes more sense to use /user/
[13:35:28] madnificent: DouweM: it's 1337 h4x0R, you're so n00b
[13:35:38] DouweM: stef1a: you're joking right?
[13:35:43] stef1a: DouweM: nope
[13:36:23] DouweM: yeah, I'm not going to argue about whether "no one does [a Rails default]"
[13:36:35] madnificent: stef1a: well, it's restful, it's an (informal?) standard. i'd try to stick with it and see if it keeps stabbing your eyes out, but you can adjust it that way. i think you can also override the behaviour of the resources call so you don't need to swap out as much.
[13:36:38] avril14th: cause default sucks
[13:36:42] avril14th: today internet is all about style
[13:37:40] stef1a: how would I edit line 16?
[13:37:48] stef1a: I'm not sure how to make it fit in with the do end block
[13:38:08] DouweM: stef1a: yeah, you might get the hang of what you're doing before you go make style decisions against the norm
[13:38:39] stef1a: DouweM: maybe. also, i figured out how to do it. thanks. line 1 was the key.
[13:38:49] _axx: Hey guys, i'm searching for a Database that can "thin out" my data, so i save rows every day, and with every 10 new rows, 9 old rows get deleted. Any ideas? :)
[13:39:00] DouweM: stef1a: yeah, just add it before do, like :except currently
[13:39:02] madnificent: DouweM: for the sake of definding stef1a. it may make sense to try and do things the framework doesn't want you to do when you're starting out, just to see how hard it will work against you.
[13:39:25] DouweM: madnificent: right, but that's not quite "because writing /users/ in the path is clumsy and no one does it
[13:39:25] DouweM: 15:35:32"
[13:39:53] madnificent: DouweM: i'm not saying it's an improvement
[13:40:21] stef1a: I just don't like it. It's something I want to change. In learning how to change it, I learned more about Rails. I'm glad I did it. If I want to change it later for some reason, I will. I'm glad you guys could help.
[13:40:26] madnificent: _axx: i'd go for a cron script or something of the likes. and i think you'll want to do that on an object level.
[13:40:44] ssb123: I have a model that has min and max value columns. Any idea how I can validate that there is no overlap? So that the range is unique..
[13:40:51] solars: question: I've got a fixed hierarchical list about features externals have to implement. I've they did, the mark a feature as done with a checkbox.. can anyone suggest a way to store this, or gem to use? (I'm using mongoid)
[13:41:05] _axx: madnificent: hm.. i hoped that there is some database, that could do that. (redis or something). :) Maybe i need to do this myself
[13:41:15] DouweM: stef1a: it's your code, knock yourself out :)
[13:41:15] madnificent: stef1a: what is cool is that if you change your routes file correctly, you don't have to change any other code than the routes file.
[13:41:50] DouweM: agreed, Rails is convention over configuration, but in a lot of cases it allows you to stray from the convention quite nicely
[13:43:03] madnificent: _axx: it's complex to keep your data consistent if you want to do it on a database level. for instance, assume that you have a habtm relationship, deleting the rows may disconnect that row and make it inaccessible. however, the script needn't be complex. create a scope for fetching <Object> which has a created_at in the last 24 hours, and delete 90% from that
[13:43:53] DouweM: ssb123: ooh, I have just what you need. gimme a sec
[13:44:00] _axx: madnificent: yeah, it doesn't really have to be mysql. it could be document based data store. but i guess it's a way to do it
[13:44:21] stef1a: madnificent: if i were changing what?
[13:44:27] madnificent: _axx: deleting the rows may disconnect *an object* (not that row).
[13:44:30] DouweM: stef1a: the path
[13:44:38] ssb123: DouweM: Awesome, thanks!
[13:44:40] _axx: madnificent: hm
[13:44:46] stef1a: DouweM: right. routes.rb is awesome. :)
[13:45:33] Criten: just finished my first small rails 4 project :P
[13:45:45] Criten: I like the new way they do the model column permissions
[13:45:51] Criten: gives more control
[13:46:43] soahccc: That isn't the supposed output for awesome_print is it? http://files.sven.bmonkeys.net/images/ten-20130719-154609.png
[13:46:48] madnificent: Criten: care to elaborate? i haven't seen it yet :)
[13:47:21] DouweM: ssb123: https://gist.github.com/DouweM/c9f02e3df830121a0e2d - it works a little bit differently from yours, but it should be helpful
[13:47:41] jgrevich: Does anyone know how CodeClimate's Security Monitor (https://codeclimate.com/security-monitor) compares to Brakeman's analysis?
[13:47:54] DouweM: ssb123: the first is a module I include in any class that uses a date period (start_date ... end_date), the latter is the validation on such a class
[13:48:06] DouweM: ssb123: it's mongoid and it deals with dates, not normal numbers, but the theory is the same
[13:48:25] ssb123: DouweM: Right, thanks!!
[13:48:29] DouweM: ssb123: instead of date_range.max and .min you can also just use your min and max directly
[13:48:45] Criten: madnificent, they basically got rid of the attr_accessable in the models and it's handled in the controller now
[13:48:58] Criten: it's a littttle more code to do the same thing but it's allot more flexable
[13:49:03] DouweM: ssb123: the .siblings method is basically .parent.children.excludes(id: self.id)
[13:49:25] DouweM: ssb123: the overlapping scope and overlaps? method are where the overlap magic happens
[13:50:35] schopenhauer: hi. I get an unpermitted params output in the log when trying to update a model even though the controller specifies the params and I've even got an initializer to allow them. Any ideas? https://gist.github.com/pawel2105/6039236
[13:50:37] sirn: I have model like this: https://gist.github.com/sirn/6039229 is there any way to make self.some_complex_count access current scope *without* includes?
[13:51:42] sirn: Rails 3.2 btw :\
[13:51:57] schopenhauer: so funtion, phone, position and type are unpermitted
[13:51:58] madnificent: Criten: not sure how i feel about that, a combination of both may be better, but what do i know.
[13:52:01] madnificent: Criten: thanks :)
[13:52:50] madnificent: schopenhauer: checked the attr_accessible specification in the model?
[13:52:59] RubNoob: hello - does anyone have a good way in RSpec to test a cancan ability of 'create'
[13:53:04] schopenhauer: madnificent there is no attr_accessible
[13:53:08] schopenhauer: using strong_params
[13:53:38] madnificent: schopenhauer: in that case, i don't have a go-to thing to look at
[13:58:50] twinkleHood: I have an issue, I'm using rvm to work on a rails 2.1 app, and I'm suddenly getting 'Invalid gemspec in (...) Illformed requirement ["#<YAML::Syck(...'
[13:59:05] twinkleHood: I don't want to upgrade, what do i do? :'(
[13:59:25] interactionjaxsn: twinkleHood: paste your error to gist so someone can take a gander
[13:59:34] twinkleHood: Aight, hang on.
[14:00:11] mjc_: twinkleHood: wow that's old
[14:00:37] mjc_: it's only going to get harder
[14:00:51] mjc_: to maintain that etc
[14:01:10] twinkleHood: https://gist.github.com/kholbekj/6039319
[14:01:36] twinkleHood: I know, I'm working on upgrading it on the side, but currently working on a hotfix for the old version, and this stuff popped up.
[14:02:19] twinkleHood: I'm curious about the 'actionmailer 3.2' stuff
[14:02:20] mjc_: twinkleHood: make a gemset for it, will probably solve your issue
[14:02:36] mjc_: older bundler trying to read newer gems or something like that
[14:03:14] oupa: I am tearing my hair out with a CSRF issue (I think). I have followed every thread and stackoverflow I could find on the web but nothing works. I have an AngularJS app running against a Rails 3.2 server. I am trying to use JQuery-file-uploader (blueimp) and getting 'Completed 401 Unauthorized' from just
[14:03:18] twinkleHood: I hate rvm. I also love it of course.
[14:03:19] mjc_: rvm use 1.8.7@foo --create
[14:03:28] mjc_: twinkleHood: it's not rvm that's causing this :)
[14:03:39] twinkleHood: It is SO rvm causing this.
[14:04:10] oupa: When I deploy the Angular app, it runs in the Rails public folder, which is fine
[14:04:12] mjc_: twinkleHood: it's your really old bundler in your 5 year old app trying to read new gems
[14:04:35] oupa: other Angular GETS and POSTS also run fine
[14:04:48] oupa: any ideas please?
[14:05:04] mjc_: twinkleHood: rvm will let you separate them with gemsets, without rvm or similar you'd be up a creek
[14:05:19] twinkleHood: That's why i hastily added the 'love it too part'
[14:05:31] twinkleHood: It's the... entanglement i hate.
[14:05:52] twinkleHood: Why is my stupid old bundler so stupid.
[14:05:59] twinkleHood: Gah, can't wait to have this baby ported to 3.2
[14:06:35] mjc_: why not port to 4?
[14:06:41] mjc_: not much extra work
[14:06:45] twinkleHood: That is the step after.
[14:06:55] Lewix: can we use a before_filter inside a method
[14:07:09] twinkleHood: I figured straight from 2.1 to 3.2 would enough of a giant leap to begin with lol
[14:07:30] twinkleHood: Also, when i begun upgrading, 4 wasn't out yet.
[14:08:22] twinkleHood: It's a pretty big app. And it runs actual lasers. So can't be too frisky on the nightlies ;)
[14:17:09] mikecmpbll: is there an equivalent of array#delete_if that behaves like array#delete? (returning the deleted items)
[14:17:58] tagrudev: certainty, universa1 http://lorizzle.nl/
[14:21:02] shambat: I have this erb code that is supposed to generate a select element but the multiple-choice option is not taking: http://dpaste.com/1310647/
[14:21:13] shambat: what am I doing wrong?
[14:28:29] interactionjaxsn: mikecmpbll: array#keep_if but that might get confusing
[14:29:10] RubNoob: does anyone know how to handle a :create permission in CanCan when the ability is complex?
[14:29:27] RubNoob: i.e. when you need to check something other than a relationship to the parent object?
[14:29:38] mikecmpbll: interactionjaxsn: well, keep_if returns the mutated array too.
[14:30:01] jumz: RubNoob: You can pass it a block then evaluate the block in the ability class.
[14:30:42] interactionjaxsn: mikecmpbll: right... that's why i said it might get confusing. you have to change the conditional
[14:30:55] mikecmpbll: interactionjaxsn: yeah but even if i change the conditional it wouldn't help.
[14:31:01] RubNoob: jumz how does that work though as far as implementation is concerned? in otehr words, in the view, would it work like this?: can?(:create, @topic.post.new)
[14:31:07] interactionjaxsn: mikecmpbll: you don't want the array changed at all/
[14:31:17] mikecmpbll: i want to mutate the array, and return what I've removed.
[14:31:55] interactionjaxsn: mikecmpbll: keep if... it sounds counter intuitive and that's what makes it confusing
[14:31:55] mikecmpbll: a = [1,2,3,4].delete_if{|v| v > 3}
[14:32:13] interactionjaxsn: a = [1,2,3,4].keep_if{|v| v < 3}
[14:32:19] jumz: I mean when you define the ability you can pass it a block. Check this: https://github.com/ryanb/cancan/wiki/Defining-Abilities-with-Blocks
[14:32:36] mikecmpbll: a would then = [1,2,3]
[14:32:41] mikecmpbll: interactionjaxsn
[14:32:41] toddWork_: i have a simple_form; and the field is content; but i want to assign that value to params[:content][:post_content][:value]; so, when the form is submitted, assign that form content to that other address.
[14:32:58] RubNoob: jumz that I do understand, but what I don't understand is how you check the can? method for that case
[14:33:10] interactionjaxsn: mikecmpbll: right... dropping the 4
[14:33:23] RubNoob: jumz in other words, if I have a post belongs_to topic, how would I check the can?(:create, )?
[14:33:26] mikecmpbll: exactly, which isn't what i want, i want to return the deleted items, remember? :)
[14:33:30] RubNoob: if I have @topic
[14:33:32] mikecmpbll: like `delete` does
[14:33:39] mikecmpbll: a = [1,2,3].delete(1)
[14:34:07] interactionjaxsn: mikecmpbll: what gets deleted here?
[14:34:09] interactionjaxsn: a = [1,2,3,4].delete_if{|v| v > 3}
[14:34:59] interactionjaxsn: mikecmpbll: what gets kept here: a = [1,2,3,4].keep_if{|v| v > 3}
[14:35:22] interactionjaxsn: that what you want?
[14:35:46] interactionjaxsn: mikecmpbll: a = [1,2,3,4]
[14:35:52] interactionjaxsn: what do you want out of that?
[14:36:04] mikecmpbll: i want the array to be [1,2,3]
[14:36:09] mikecmpbll: but i want `a` to be [4]
[14:37:13] mikecmpbll: for example: a = [1,2,3]; b = a.delete_if{|v| v>2}
[14:37:26] mikecmpbll: b == 3 => true
[14:37:37] mikecmpbll: a = [1,2] => true
[14:39:21] interactionjaxsn: mikecmpbll: a = [1,2,3]; b = a.keep_if{|v| v>2}
[14:41:45] mikecmpbll: no neat way to do it by the looks of things.
[14:42:39] interactionjaxsn: mikecmpbll: what about take_while ?
[14:43:54] interactionjaxsn: mikecmpbll: ehh...no
[14:44:00] sqbell: Hello. I have filters[filter_1] and filters[filter_2] in a form and I would like to catch those settings in a model. I have def filters=(filters); end, but nothing comes through. Is there a way to do this w/o the use of controller?
[14:44:13] mikecmpbll: if there was a bang version of take_while, that'd do it :p
[14:44:23] xipho: I have a module Aliases in config/intializers with things like Foo = Bar. How can I get this to be read when I use 'rails c'?
[14:44:32] krainboltgreene: sqbell: Make an object that extracts what you want.
[14:44:39] krainboltgreene: Call it a normalizer
[14:47:11] sqbell: krainboltgreene: I'd have to do this in a controller then, correct?
[14:47:32] krainboltgreene: Well, the controller instantiates this object, yes.
[14:47:33] mikecmpbll: interactionjaxsn: looks like I can bodge it with `partition`. a = [1,2,3,4]; b, a = a.partition{|v| v>2}
[14:47:57] krainboltgreene: def update; Account.update_attributes(AccountNormalizer.new(params[:account]))
[14:48:53] interactionjaxsn: mikecmpbll: hadn't even looked in enumerable yet...
[14:50:51] marrin: REGISTER martin
[14:51:19] interactionjaxsn: mikecmpbll: that's pretty nifty
[14:51:34] mikecmpbll: seems to do the trick.
[14:53:08] marrin: Hi, does anyone have a few minutes to help with my RoR installation? I have ruby 2 and rails 4 installed and new apps work fine but after checking out an older app from an svn repository I cannot for the life of me get it to run
[14:54:02] interactionjaxsn: marrin: are you managing your ruby versions?
[14:54:34] marrin: I have rbenv installed but I'm a bit of a n00b so still not sure of a lot of things
[14:55:36] interactionjaxsn: marrin: are you using ruby2 in your 'older app'
[14:56:45] marrin: interactionjaxsn: good question, a problem I had is that the checkout had no gemfile, only a gemfile.lock so from that I pieced a gemfile together. I know the version of rails the app is using but not the version of ruby
[14:57:12] sqbell: krainboltgreene: I was thinking about multiparameter arguments (like the ones with date: _1i, _2i) but it seems this is difficult. I think I'll stick with your solution, thanks.
[14:57:33] interactionjaxsn: marrin: ruby -v or whatever from the directory of your old app
[14:58:14] marrin: interactionjaxsn: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]
[14:58:38] interactionjaxsn: marrin: that's probably not the one you want on your older app...
[14:59:09] marrin: interactionjaxsn: yeah, was thinking that but not sure on how to fix it
[14:59:33] interactionjaxsn: marrin: https://github.com/sstephenson/rbenv look at choosing the ruby version
[15:01:30] marrin: interactionjaxsn: is there a lookup table to find out what version(s) of ruby are compatible with rails 2.3.14?
[15:01:59] interactionjaxsn: marrin: thankfully i don't know... :/
[15:03:41] interactionjaxsn: marrin: it last officially supported Ruby 1.9.1. is all i could find in the googles
[15:04:01] interactionjaxsn: marrin: and Rails 2.3.14 don't boot under Ruby 1.9.3 unless every single controller has a helper class defined in a helper file.
[15:05:46] ner0x: Good morning all. I'm looking to setup a persistant way to store which ids are "selected" in a table that has pagination enabled. I want the persistence because they'll be selecting files to email, download, etc. Any sane way to do this? Or better options?
[15:07:09] darrik: ner0x: how persistent?
[15:07:41] darrik: ner0x: you could store them in the session, if they should only last as long as that and be client-specific
[15:12:46] marrin: interactionjaxsn: thanks, will have a go at getting the old app to use 1.9.1
[15:13:45] soahccc: Does anyone know a simple backend for I18n which "compiles" to yaml for production? I like the approach of translation_center but it is way to heavy and have a lot of dependencies not working with Rails 4
[15:14:12] toddWork_: could use some help here: https://gist.github.com/anonymous/52b784a87c7f3b7699be
[15:14:27] toddWork_: am i showing up or am i hellbanned? #paraniod
[15:14:50] gwillen: toddWork_: you're showing up, it's just quiet
[15:15:05] gwillen: toddWork_: there are no hellbans on IRC, if nobody could hear you, you'd be seeing the message "Can't send to channel"
[15:15:28] toddWork_: thanks gwillen; i can't tell if my user is 'logged in' to irc. right; ok.
[15:15:29] mklappstuhl: toddWork_: content = params[:content][:post_content][:value] rescue params[:content] :D
[15:15:50] mklappstuhl: wouldn't actually advise to do that but should work
[15:15:52] gwillen: heh, you could do that (using exceptions) but I would suggest something more like
[15:16:13] toddWork_: mklappstuhl: thanks, and yes, i understand it's not the best practice. i'm just trying to get something working.
[15:16:24] gwillen: (params[:content] && params[:content][:post_content] && params[:content][:post_content][:value]) || params[:content]
[15:16:35] mklappstuhl: toddWork_: I actually changed that line slightly
[15:16:41] gwillen: what that's doing is checking that the element exists at each step
[15:16:45] gwillen: before trying to use it as a hash
[15:16:47] toddWork_: mklappstuhl: ok, ill check it out.
[15:16:57] gwillen: if you know for sure that all those elements exist you might not have to check all of htem
[15:17:00] mklappstuhl: toddWork_: there is nothing wrong with your code per se
[15:17:04] slainer6_: gwillen: bwarppp
[15:17:34] toddWork_: gwillen: right; i used to do that same trick in javascript! kind of reassuring to know that other languages sometimes behave similarily.
[15:17:42] gwillen: toddWork_: *nods*
[15:17:53] toddWork_: mklappstuhl: works as expected. thank you.
[15:17:53] gwillen: toddWork_: I would normally write it with an if, I think
[15:18:05] gwillen: toddWork_: the only language where I'd use a lot of && || together is perl, because it's expected there ;-)
[15:18:15] mklappstuhl: toddWork_: maybe there is something clever you can do with rails' try
[15:18:17] gwillen: (I mean, use them instead of an if statement)
[15:18:18] mklappstuhl: not sure though
[15:18:34] slainer6_: gwillen: http://stackoverflow.com/questions/6224875/equivalent-of-try-for-a-hash#6225321
[15:19:22] mklappstuhl: I actually think the rescue isn't so bad in that case
[15:19:30] gwillen: slainer6_: that's cute
[15:19:41] gwillen: slainer6_: you should probably also point it out to the person who originally asked the question
[15:19:49] mdhopkins: is rails 4 + important gems production ready? i'm starting a new project tomorrow and would like to use it, but don't want to get stuck and have to restart with 3.2
[15:20:06] slainer6_: gwillen: sorry i didn't know :P
[15:20:30] mdhopkins: the gems compatibility is the big question. how have maintainers been doing getting ready?
[15:25:29] deanclkclk: running apt-get install ruby1.9.2-full
[15:25:32] deanclkclk: is that the command?
[15:25:56] pothibo: anyone familiar with XSS security here? I think I landed on a XSS vulnerability in rails and I don't want to discuss about it for no reason
[15:26:23] helpa: deanclkclk: RVM (Ruby Version Manager) - http://rvm.io
[15:26:23] crankharder: deanclkclk: !rvm
[15:27:29] crankharder: pothibo: http://rubyonrails.org/security
[15:28:07] ner0x: darrik: Store via ajax when they click the select button? I was thinking of adding an hstore column and setting selected: true in that. Easier to query.
[15:29:05] ssb123: I wrote a custom validation that basically runs a where query and if any results show up there's an error. My issue is when editing the record that is being edited is included in the where and an error is thrown.
[15:29:29] darrik: ner0x: you might simply send all the selected ids when a different page is selected
[15:29:55] crankharder: ssb123: .where(["id <> ?", self.id])
[15:30:06] darrik: ner0x: i'm assuming you're trying to store these across pages such that a user could select a few rows from page 1, a few from page 2, etc, and then operate on them all at once
[15:30:17] deanclkclk: ok with rvm how can i check what version of ruby I am running?
[15:31:09] darrik: deanclkclk: rvm info
[15:32:52] deanclkclk: darrik: http://pastie.org/8155950
[15:33:02] deanclkclk: gem "not set", ruby "not set"
[15:33:08] deanclkclk: means I need to install them?
[15:33:43] ssb123: crankharder: what's that do?
[15:34:01] vikewoods: hey guys ) could some 1 help me pls with this √
[15:34:08] deanclkclk: also can I tell rvm to install the latest ruby?
[15:34:09] vikewoods: https://gist.github.com/vikewoods/6037567
[15:34:19] deanclkclk: example...the full version with "dev"
[15:37:14] _bart: I'm stuck, I have devise+omniauth+doorkeeper provider and a client, but since an update I get "Authentication failure! invalid_credentials: OmniAuth::Strategies::OAuth2::CallbackError, OmniAuth::Strategies::OAuth2::CallbackError"
[15:37:23] lethjakm1: vikewoods: what are you expecting that to do?
[15:37:42] ner0x: darrik: Correct. Where do you store them? And how do you update it when you mark them selected/unselected
[15:37:57] _bart: And rack session holds Could not authenticate you from Doorkeeper because "Csrf detected".
[15:38:28] _bart: Which is weird, because I removed all the protect_from_forgery lines
[15:39:08] vikewoods: lethjakm1: child_catalog_name = catalog.name + parent_catalog.name + child_catalog.name like that in product edit menu )
[15:39:20] crankharder: ssb123: it excludes the current record from your validation
[15:39:22] lethjakman: vikewoods: also...where is it located?
[15:39:51] vikewoods: lethjakm1: https://gist.github.com/vikewoods/6037567 take a look @ gist
[15:39:53] lethjakman: you probably want "#{catalog.name} #{parent_catalog.name} #{child_catalog.name}"
[15:39:53] ssb123: crankharder: I added AND id <> ?", self.id]) to the end and now the validation is allowing everything.
[15:40:10] lethjakman: vikewoods: also...there's no = sign in your gist.
[15:40:13] crankharder: ssb123: show some code
[15:40:28] lethjakman: and I have no clue where that def is located.
[15:41:04] lethjakman: is that a helper, a method of some class, or what?
[15:41:07] ssb123: https://gist.github.com/scottbartell/70b379156d7bb77cae08
[15:44:19] vikewoods: its a model - product (as admin interf. we use rails_admin) http://s11.postimg.org/kxd8doo5f/image.png
[15:46:40] darrik: ner0x: why not just append a list of selected ids dynamically to the page links? then uniquely append any passed in id's to a list
[15:47:29] deanclkclk: anyone knows why I am getting this problem? http://pastie.org/8155980
[15:48:05] xipho: deanclick
[15:48:14] ssb123: @crankharder https://gist.github.com/scottbartell/70b379156d7bb77cae08
[15:48:15] vikewoods: so its any method to overwrite child_catalog name ? (
[15:48:36] marrin: can't seem to get this gem to install, does anyone have any ideas? gem install radar-by_star
[15:49:02] vikewoods: deanclkclk: http://stackoverflow.com/questions/9336596/rvm-installation-not-working-rvm-is-not-a-function
[15:49:22] lethjakman: vikewoods: https://gist.github.com/lethjakman/6040176
[15:49:46] interactionjaxsn: marrin: you mean gem install 'by_star' ?
[15:50:43] marrin: interactionjaxsn: I think that's a name for the newer version but the gemlock file for this pesky app explicitly says radar-by_star (0.2.5)
[15:51:11] vikewoods: lethjakman: lethjakman
[15:51:12] crankharder: ssb123: seems weird, why are you comparing the max cutoff to the min cutoff in the second validation. also if it's a unique cosntraint, dont you want '<= 1' ?
[15:51:21] vikewoods: https://gist.github.com/lethjakman/6040176
[15:51:44] lethjakman: vikewoods: ok. what's your error?
[15:52:13] vikewoods: undefined method `catalog' for #<Class:0x007fd10e4e3310>
[15:52:15] lethjakman: also. I don't think you need self infront of that. you just place it inside of the class.
[15:52:35] interactionjaxsn: marrin: can't find that one here http://rubygems.org/search?utf8=%E2%9C%93&query=star
[15:53:15] lethjakman: vikewoods: ok that means catalog doesn't exist for the class you're calling it on.
[15:54:20] marrin: interactionjaxsn: thanks, think you're right, tried just the by_star and it worked, onto the next error...
[15:55:32] yaymukund: this is dumb but does nayone remember that recent site that was on HN a week or two ago that let you test requests from REST apis?
[15:56:33] vikewoods: https://gist.github.com/lethjakman/6040176
[15:58:02] rosano: Is there a standard way to extract the same attribute from multiple objects? https://gist.github.com/rosano/6040257
[15:58:23] rhizome: rosano: collect/map
[16:00:23] lethjakman: vikewoods: where is catalog supposed to come from? I'm guessing you're missing a belongs_to or has relationship.
[16:00:29] lethjakman: there's no reason for that to exist.
[16:02:28] vikewoods: Catalog has_many ParentCatalog has_many ChildCatalog has_many Products
[16:02:28] vikewoods: Products belongs_to ChildCatalog belongs_to ParentCatalog belongs_to Catalog
[16:02:28] vikewoods: lethjakman:
[16:03:38] lethjakman: vikewoods: right, and self.parent_catalog makes sense, but where is self.catalog coming from?
[16:05:22] vikewoods: def self.name
[16:05:22] vikewoods: "#{self.parent_catalog.name} #{self.name}"
[16:05:22] vikewoods: yep but even this is not working(
[16:05:22] vikewoods: forget about catalog.name
[16:05:31] vikewoods: lets do parent_catalog.name that would be fine
[16:06:10] hellion: nobodies home at #prawn….anyone here know how to fill_color a bounding_box?
[16:07:00] lethjakman: vikewoods: alright, what's your error now? can you load it into a file on that gist?
[16:07:30] vikewoods: https://gist.github.com/lethjakman/6040176
[16:07:34] vikewoods: last comment ((
[16:11:34] lethjakman: vikewoods: alright well I don't know how to use a belongs to in the way you're trying to (if anyone does let me know, seems nice.) but you can probably do something more like this: https://gist.github.com/lethjakman/6040176
[16:11:37] lethjakman: under what_you_want
[16:12:25] lethjakman: I may have syntax wrong somewhere...I don't do a ton of rails, but that's the general idea.
[16:15:10] wisconsin: anyone tried this? http://rubyluwak.com/
[16:16:24] Spami: interactionjaxsn, you might find this interesting https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4960
[16:20:48] interactionjaxsn: wisconsin: http://ruboto.org/
[16:21:11] interactionjaxsn: Spami: i do. you are doing something with Time in your chain?
[16:21:46] Spami: but I was looking around with chained scope
[16:22:11] wisconsin: interactionjaxsn: "Ruboto depends on JRuby"
[16:22:31] interactionjaxsn: wisconsin: and it's cheaper.
[16:22:56] ner0x: darrik: When you paginate a new ajax call is done. Sending them is easier I'm just wondering how to store them.
[16:24:38] wisconsin: interactionjaxsn: true
[16:27:16] interactionjaxsn: wisconsin: development in jruby is great. aside from the time it takes to start up the jvm. also some of they guys that contribute to jruby have a hand in ruboto as well
[16:29:13] wisconsin: interactionjaxsn: the jvm starts quickly, jruby initialization takes a while
[16:29:55] interactionjaxsn: wisconsin: noted
[16:37:12] Aristata: Is it possible to get the html of a partial without calling 'render'
[16:38:37] injekt: render_to_string ?
[16:39:17] Aristata: Awesome thanks
[16:49:10] starfox21: Hi, I need to slightly modify the output of a rails view helper (grouped_collection_select ). Namely I need to add an empty <option></option> tag as my first option. I was planing to create an helper method that basically functioned as a wrapper around grouped_collection_select and added that empty option tag. What would be the best way to do this?
[16:55:36] DouweM: starfox21: you're aware of the :prompt option on collection_select?
[16:56:41] DouweM: that would pretty much do what you're looking for
[16:57:06] starfox21: DouweM: yup, that's exactly what I needed.
[17:02:28] xavier23: HI….. is anyone familiar with the custom `build` helpers in rails?
[17:02:39] xavier23: eg. build_{model}
[17:02:58] xavier23: @{model_1}.build_{model_2}
[17:06:29] xavier23: Huh. It turns out its part of belongs_to / has_one association
[17:06:52] DouweM: xavier23: yup, it's all in the docs
[17:08:01] ner0x: darrik: So does a cookie seem like a good idea?
[17:09:12] DouweM: I could go for a cookie right now
[17:09:29] lethjakman: ner0x: do it in your get path.
[17:11:09] ner0x: lethjakman: I meant persisting the ids that are selected.
[17:11:28] lethjakman: ner0x: oh, I'd do session data.
[17:11:38] lethjakman: or...that could be in the url too.
[17:12:06] ner0x: lethjakman: Can't be url since changing the page is a new request. Session data? Meaning an ajax call each time you select a row?
[17:13:32] lethjakman: ner0x: of course it can, just do a hash tag or something, then do the ajax call when the person navigates to the page. that way people can send links around.
[17:17:11] ner0x: lethjakman: So every single time I load the table I send the selected ids?
[17:18:20] dethkrieg: what kind of job roles are there out there for developers who are tired of learning new stuff, but understand the high level use of technology?
[17:18:37] dethkrieg: well tired of learning new details specific to programming
[17:18:57] Criten: haha tired of learning new stuff?
[17:19:16] dethkrieg: well i've learned c, java, coldfusion, mssql, mysql,
[17:19:19] dethkrieg: javascript, jquery
[17:19:21] Criten: become a manager i guess
[17:19:46] wmoxam: dethkrieg: flip burgers
[17:20:04] wmoxam: developers should always be learning
[17:20:08] dethkrieg: are there really developers out there that after they just learned all this great stuff and how to use Jquery, they'll see coffee script and go, sweet, time to learn something new?
[17:20:24] dethkrieg: where are the ones like me who get overwhelmed?
[17:20:37] tubbo: dethkrieg: yes. i am one of those people.
[17:20:56] tubbo: dethkrieg: where did you start out?
[17:20:57] wmoxam: dethkrieg: they tend to not be programmers anymore
[17:21:06] dethkrieg: cs major, masters in information systems
[17:21:09] dethkrieg: developer for 4 years
[17:21:20] Criten: and you're already sick of it? :P
[17:21:22] tubbo: dethkrieg: what were you developing for those 4 years? your college degree is irrelevant :P
[17:21:25] webdestroya: a developer who doesnt have a passion for learning new things and how to improve themselves isnt a true developer. they are a just an employee in need of a paycheck
[17:21:26] codezombie: is there any safer way to handle this? https://gist.github.com/codezomb/fd6cf05d2a8df950c909
[17:21:38] wmoxam: dethkrieg: whenever you see an article about 'ageism in programming', it's about developers who stopped learning
[17:21:44] codezombie: specifically the klass method
[17:21:48] dethkrieg: i'd say im more interested in the business use of the technology, not learning MVC structures, etc
[17:22:11] tubbo: codezombie: that's fine...i'd rename it to `model` instead of klass because that's really what it s.
[17:22:18] tubbo: or even `relation` because that's actually an AR::Relation
[17:22:27] Criten: so become a manager who deligates :P then you don't need to knpow the nitty gritty aspects of everything
[17:22:35] wmoxam: dethkrieg: you need to learn new tech to be able to apply it to business usage :P
[17:22:38] dethkrieg: hmmm, how does one go from developer to manager?
[17:22:38] codezombie: tubbo, thanks. I've tried running a few different ways through codeclimates security scan, and it catches me every time.
[17:22:40] tubbo: codezombie: you should probably render and return if the model can't be found
[17:23:00] Criten: or just get a job at a place that doesn't implement new stuff... there are plenty of places stuck in the olden days
[17:23:01] madnificent: dethkrieg: it's much easier to understand the business use once you understand at least the basics of the technical details. it's either that, or get really good advisors who do know the details and who manage to communicate the effects of it to you efficiently.
[17:23:13] dethkrieg: im interested in learning new tech from a high level. i.e. how will using coffee script improve our development timeline, rather than learning the nitty gritty
[17:23:16] codezombie: tubbo: that's actually handled with rescue from StandardError on line 7. Since it's a generic catch. I have plans for better handling later.
[17:23:31] tubbo: Criten: yeah that's great, let's put more people in power who have no fucking clue what they're doing and, to make matters worse, don't even want to learn
[17:23:47] dethkrieg: okay, lets back up. I want to learn, but not the nitty gritty
[17:23:58] wmoxam: dethkrieg: then you're not learning much :p
[17:24:11] tubbo: codezombie: oh yeah look at that. probably why CodeClimate is screaming at you
[17:24:22] tubbo: codezombie: you're raising an error to deal with control flow. exceptions are not part of control flow.
[17:24:34] codezombie: tubbo: CodeClimate actually gives me this... Unsafe Reflection method constantize called with parameter value
[17:24:55] wmoxam: IMO management & dev skills have almost no overlap
[17:24:55] codezombie: It knows I'm trying to game the system :D
[17:24:56] tubbo: dethkrieg: developers get paid a lot for a reason, it's not an easy job nor is it easy to maintain
[17:25:12] dethkrieg: tubbo, right, and i worry about my ability to sustain it
[17:25:14] tubbo: codezombie: oh right, you might want to rescue out of that in the method somehow
[17:25:31] codezombie: yeah, I definitely need better error handling.
[17:26:04] dethkrieg: i learned ruby/rails and php/cakephp on my own, yes it was fun learning some aspects, but my outputs were not where i wanted my projects to be. i had to learn more to get there
[17:26:14] amh345: i need to revisit my authlogic authentication setup. i need to add some more user levels. I'm wondering.. it's rails secure_password any good? i should i stick with something like authlogic or devise ?
[17:26:25] tubbo: codezombie: so what if `resource_type` turns up nil? what happens
[17:26:35] trent2: I have set Rails.logger to log to a specific file for cron related tasks, ActiveRecord does not log to this specific file, is there something obvious I may be missing?
[17:26:50] tubbo: dethkrieg: yeah, that's the way i felt when i first was starting out.
[17:26:53] codezombie: tubbo: currently, the rescue on line 7 triggers with "Invalid Login". Not very descriptive, but it's working for now.
[17:27:01] tubbo: dethkrieg: a lot of my early 2.x-era rails apps didn't work or were horribly misinformed.
[17:27:18] tubbo: codezombie: right, that might be why codeclimate is freaking out
[17:27:29] tubbo: in klass(), you don't have a way to deal with that
[17:27:36] codezombie: tubbo: I'm not sure I understand what you mean.
[17:27:36] dethkrieg: tubbo, good to know
[17:28:16] codezombie: tubbo: from my understanding, it's just the fact that I'm technically running constantize on a param, even though it's not technically on the param itself.
[17:28:45] codezombie: I definitely need to fix my error situation, I just didn't think CC would trip up on that, and throw a completely different error.
[17:29:13] wmoxam: dethkrieg: it's normal to look back at code you've written in the past and want to vomit
[17:29:25] tubbo: codezombie: https://gist.github.com/tubbo/a7784427a678b4de9800
[17:29:49] wmoxam: dethkrieg: after a decade or so old code just look a little lol
[17:29:50] tubbo: here's the real kicker https://gist.github.com/tubbo/a7784427a678b4de9800#file-login_controller-rb-L16
[17:30:04] wmoxam: dethkrieg: which is a marked improvement
[17:30:33] tubbo: dethkrieg: you just gotta keep going. work is hard. you're not gonna get paid $50-60k and up for doing a job that isn't hard in SOME way.
[17:30:43] codezombie: tubbo: yeah, but the rescue, is actually for an actual failed authentication. Not just if the model isn't found :)
[17:31:16] codezombie: tubbo: I tend to favor rescue of if/else
[17:31:21] tubbo: codezombie: well that's incorrect.
[17:31:25] codezombie: probably a bad habit
[17:31:28] tubbo: codezombie: exceptions should not be used as control flow.
[17:31:38] tubbo: codezombie: did you notice my `render and return`?
[17:31:46] codezombie: ah, just did
[17:31:51] tubbo: that will actually stop processing the request and end by rendering something right there
[17:31:59] tubbo: so that's a better way of describing control flow
[17:32:10] tubbo: codezombie: use exceptions only when there's a server error, like "the database box is on fire"
[17:32:16] dethkrieg: tubbo, wmoxam, thanks for listening
[17:32:20] tubbo: or "someone is shooting up the building"
[17:32:38] codezombie: tubbo: I'm not actually triggering exceptions here, I'm only piggybacking on the ones rails already outputs.
[17:32:52] codezombie: though, I still get your point
[17:33:03] codezombie: it's sad, because it's so much more readable.
[17:33:29] goleldar: as far as style goes. in a class should attr_reader come before or after constants?
[17:33:39] tubbo: codezombie: which exceptions are these?
[17:33:46] tubbo: (and btw, if rails is throwing an exception you need to HANDLE IT.)
[17:33:51] codezombie: tubbo: currently, just StandardError
[17:34:05] tubbo: codezombie: no what i mean is, when does rails throw an exception for you?
[17:34:09] tubbo: just when records aren't found right?
[17:34:21] codezombie: tubbo: these aren't actualy exceptions... For example, ActiveRecord::RecordNotFound, or Validation Failed, etc...
[17:34:52] slash_nick: what are they?
[17:35:05] codezombie: for example, if I call create! or save!, I get an exception rather than just a soft error.
[17:35:17] tubbo: codezombie: yeah, that's the point. you aren't supposed to be using them in a control flow.
[17:35:25] tubbo: that's why they're not the default
[17:35:33] codezombie: damn, tubbo... Why you gotta go and poke holes in my logic?
[17:35:38] codezombie: that's just not cool :)
[17:35:45] tubbo: i feel like someone should definitely mention that to new devs
[17:35:51] tubbo: because i too thought those methods were the norm
[17:36:02] tubbo: meh maybe i'll make a guide update later :P
[17:36:14] codezombie: tubbo: it's something I recently started. I'm not new, but I definitely always look for ways to reduce lines / add readability.
[17:36:14] tubbo: codezombie: yeah so create() and save() are the "nicer" versions of those methods.
[17:36:26] tubbo: codezombie: when they fail, they return nil
[17:36:48] tubbo: so you can do something like @model = Model.create(attributes); render 'error', status: 404 unless @model.present?
[17:36:55] tubbo: err, render ... and return
[17:37:10] tubbo: describes control flow using conditionals, but doesn't look like an ugly if/else/end
[17:37:24] codezombie: tubbo: yeah, I've used the traditional way for years. I just decided to stray, thinking it would work.
[17:37:31] tubbo: i forget what the theoretical term for this style of programming is but i call it "filter-style"
[17:37:41] codezombie: it does work, but I'm just going to far out of the standard way.
[17:37:55] tubbo: codezombie: the reason exceptions are highlighted better than regular control flow is because it's supposed to catch your eye as you're reviewing code.
[17:38:03] codezombie: I just _really_ hate having if/else in every single controller action
[17:38:17] tubbo: either for instances where it's inappropriate for cases where you are communicating to readers that this shit HAS to work or the whole program will blow up
[17:39:04] codezombie: alright, well time for lunch. Then I guess I'll rewrite some controller flow.
[17:39:19] codezombie: thanks tubbo
[17:42:13] espinet: when using Fixtures.create_fixtures, can can i specify the namespace of the model. it tries use the model without the namespace
[17:42:15] xipho: Is there a Ruby one liner that would get me platform of the Ruby binary being used with relative certainty for the categories (os x, *nix, windows)?
[17:42:29] tubbo: codezombie: here's what i was talking about https://gist.github.com/tubbo/43558c1dbf85d5a1e83d
[17:42:36] tubbo: that's how i'd write a simple controller that responds to /posts/:id
[17:43:31] tubbo: codezombie: notice how there actually are conditionals but there are no if/else/end blocks to notate them.
[17:44:40] espinet: when using Fixtures.create_fixtures, can can i specify the namespace of the model. it tries use the model without the namespace
[17:44:46] espinet: i got disconnected if anyone answered
[17:46:55] ner0x: darrik: Actually... dataTables docs have an example of it done in a very simple way... Overthinking this. lol
[17:47:10] darrik: ner0x: link, please :)
[17:47:24] codezombie: tubbo: right, but you assume implicit rendering, something I don't have the luxury of in this project. Though, I can work around it.
[17:49:57] shawnjgoff: I'm trying out optimistic locking and am having trouble - the StaleObjectError happens every time. Here is my object and its saved record: http://pastebin.com/kFpXA2y9 . Both lock versions are the same, so I expect to be able to save it.
[17:50:24] ner0x: darrik: datatables.net/examples/server_side/select_rows.html
[17:51:36] darrik: ner0x: thanks
[17:52:20] ner0x: darrik: Quite simple compared to my cookie option. It won't persist over page loads but it will over paging.
[17:52:29] ner0x: darrik: Which is good enough for me.
[17:52:45] shawnjgoff: pastie link for above: http://pastie.org/8156307
[18:10:37] Trudko: Guys how do I format number in erb so it does show decimal places if decimal is zero -> 4.0 to 4
[18:14:09] mocfive_: I heard something about rails 3.2 won't be getting updates now rails 4 is released, do you guys know if this is true?
[18:14:40] Apane: what are the advantages (if any) of developing in Ubuntu (virtual machine) vs. locally
[18:14:48] eladmeidar: rails 3.2.13 should be LTS
[18:15:02] eladmeidar: Apane: locally as "windows"?
[18:15:11] wmoxam: mocfive_: http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/
[18:15:43] shawnjgoff: And here is a more full example showing the StaleObjectError even though the lock_version is unchanged: http://pastie.org/pastes/8156347/text . What am I doing wrong here?
[18:15:45] wmoxam: Apane: VM can be made to match your staging/production ENV exactly
[18:16:14] wmoxam: Apane: but usually only used by developers who use Windows as their desktop OS
[18:16:23] Apane: wmoxam, i see, can that be done locally? i'm running os
[18:17:22] wmoxam: Apane: OSX?
[18:21:02] tubbo: yeah most people run ubuntu VMs simply because installing for windows is a joke
[18:21:22] tubbo: also it actually does take a fucking day to set up OS X for Ruby/Rails
[18:21:23] Apane: wmonxam, yeas
[18:21:33] tubbo: so it's not really much of an improvement to be using OS X anymore imho
[18:21:43] wmoxam: tubbo: not a day
[18:21:47] tubbo: took me a day
[18:21:54] wmoxam: install brew, install rbenv, done
[18:22:04] wmoxam: pretty close
[18:22:08] tubbo: first you need cmd line tools for xcode
[18:22:20] tubbo: wmoxam: when was the last time you did it? i just did it 2 days ago and i had to install the entire xcode
[18:22:33] tubbo: first you need command-line tools to install homebrew & packages
[18:22:41] tubbo: then you need actual xcode because gcc for mac doesn't work without it
[18:22:46] tubbo: (even though it's supposed to)
[18:22:47] wmoxam: tubbo: I did it back in March
[18:22:55] wmoxam: tubbo: I commited code that day :p
[18:22:56] tubbo: yeah things have changed. that was also the last time i did it
[18:23:02] tubbo: weird shit too
[18:23:29] tubbo: long story short, i now have llvm *and* gcc
[18:23:38] tubbo: i feel like i shouldn't need both..
[18:24:09] wmoxam: went smoothly for me
[18:24:12] mocfive_: wmoxam: thanks!
[18:24:20] wmoxam: maybe I've just done it enough
[18:41:23] Ace20: is there any easy way to change the path for an edit_resource route? like, changing users/1/edit to just /settings
[18:41:44] Ace20: and still be able to call the named route helper as just edit_user
[18:42:10] tfitts: anyone in here use redis for autocompletion?
[18:43:19] mayatron: trying to create a record in a mysql database with a boolean type with activerecodd and it's failing. Any idea what we're doing wrong? https://dpaste.de/cOMLQ/
[18:43:54] mayatron: a.errors tells me the `primary` field can't be blank
[18:44:26] Ace20: boolean column validations can't just be presence: true, sadly, since false is not present
[18:45:03] Ace20: I tend to do this: validates :primary, presence: true, unless: ->(inst){ inst.primary == false }
[18:45:51] mayatron: ok, got it. thanks
[18:51:40] eladmeidar: toretore: remember those bug mashes we used to do?
[18:51:52] eladmeidar: toretore: hi, btw :)
[18:52:33] bakis: For anyone familiar with pg_search, how do I get it to recognize symbols? Like if i want to search for "#hello" it's returning results without the pound symbol. is there a way to tell it to pay attention to that symbol?
[18:53:11] bakis: that didn't work, i tried.
[18:54:18] bakis: is there a way to use regex with pg_search?
[18:58:52] Trudko: Guys how do I format number in erb so it does show decimal places if decimal is zero -> 4.0 to 4
[19:02:59] KU0N: I am migrating from attr_accessible and the like to strong parameters, and I've been wondering something. I have some controller methods that accept nested resources within the json (like {"name":"foo", "someassociation": {"name":"bar"}}) and I wrote some code that handle that. This code presentely lives in the models, but, with strong parameters, I was wondering if it's places was not in the controller instead.
[19:04:40] interactionjaxsn: Trudko: 4.0.to_i should do it.
[19:05:07] KU0N: https://gist.github.com/kuon/6041568 to illustrate
[19:05:48] KU0N: This method accepts an array of terms where each term may have children terms
[19:06:51] interactionjaxsn: Trudko: but be careful cause 4.9.to_i is 4.
[19:07:11] Trudko: interactionjaxsn: yeah just want to tell you :) i want to format only if there is 4.0
[19:07:17] Trudko: 4.9 should stay 4.9
[19:09:11] interactionjaxsn: Trudko: var.to_i if var.to_s.include?('.0') but there has to be something more elegant... i've been doing python lately so my mind is a little scrambled at the moment
[19:10:09] KU0N: n != n.ceil or n = n.to_i
[19:11:15] KU0N: no sure of the question though:)
[19:13:37] interactionjaxsn: Trudko: so it does show decimal places if decimal is zero? so its a 4 and you want it to be 4.0
[19:14:38] Trudko: interactionjaxsn: other way around I have 4.0 or 4.5 and I want it to be 4 and 4.5
[19:14:43] Trudko: so cut off the .0
[19:15:15] KU0N: Trudko: var = var.to_i if var != var.ceil
[19:23:55] interactionjaxsn: Trudko: yeah.. we don't have that like ruby does :/
[19:31:34] Trudko: nevermind
[19:37:28] interactionjaxsn: if anyone was following along with Trudko's question and was interested in the answer. #ruby gave him result = var/(var.to_i) != 1.0 ? var : var.to_i
[19:45:14] Squarepy: could also use mod interactionjaxsn
[19:45:33] interactionjaxsn: Squarepy: indulge me my good sir
[19:46:31] Squarepy: result = var%1.0 != 0 ? var : var.to_i
[19:46:50] rhizome: var%var.to_i
[19:47:23] interactionjaxsn: Squarepy: modulus... i'm an idiot. thanks fellas...
[19:47:28] Squarepy: that doesn't work I think rhizome
[19:47:41] Squarepy: nice shortcut interactionjaxsn
[19:47:52] n_blownapart: hi why do I need to escape the apostrophe on line 11 here? before I added the let function on line 5 I didn't need to escape. thanks: http://pastie.org/8156530
[19:47:55] interactionjaxsn: don't force me to write tests just to prove this ;)
[19:48:42] KU0N: n_blownapart: on line 5 you use double quotes, on line 11 you use single quotes
[19:49:10] interactionjaxsn: " can't be good " 'can\'t be good'
[19:50:23] n_blownapart: thanks KU0N interactionjaxsn will check
[19:53:41] trent2: im trying to setup logging in my queue, I have assigned Rails.logger to write to seperate file. ActiveRecord still writes logs to the main application log, is there something i am missing?
[19:54:58] rhizome: "Rails.logger" is probably always going to go to the default and can't be redefined without doing it on purpose. You probably want a new logger.
[19:56:09] trent2: rhizome: so i can only change logging locations with config.logger= ?
[19:56:49] n_blownapart: interactionjaxsn KUON yea that did it but why didn't it complain before adding let on line 5 with the #{base_title} interPolation ? http://pastie.org/8156530
[19:58:33] rhizome: trent2: use more words
[20:00:14] KU0N: n_blownapart: you should read more about ruby strings and how it works. Quotes are for the parser, the runtime doesn't care about them. This means a = ' "quoted value" ' b = "#{a}" won't produce any error. b will contain "quoted value" (with the quotes)
[20:00:25] KU0N: ACTION is not sure his explanation is understandable
[20:02:25] DouweM: n_blownapart: you didn't have the \' on line 11 before while you used single quotes around the string and it worked? I very much doubt that
[20:03:31] DouweM: n_blownapart: stuff between single quotes is a string, so if you want to use a single quote in there, you have to indicate it shouldn't end the string, for which you use an escape character. there's no situations in which that isn't the case
[20:03:53] n_blownapart: KUON thanks gotta review that . could you explain in the context of the pastie if you have time?
[20:04:17] KU0N: n_blownapart: I don't really see anything more to explain.
[20:04:48] n_blownapart: shit DouweM just saw your post I was scrolled up somehow thanks you too KUON ^^
[20:11:28] hellion: anyone know how to add fill_color to a bounding_box in #prawn?
[20:11:48] aces1up: hey all new to associations, just wondering if someone might help me with this bit o code. http://codepad.org/LZ5zAM70
[20:14:18] rhizome: aces1up: what's your question in plain english?
[20:14:54] interactionjaxsn: aces1up: Campaign has_one :node ; Node belongs_to :campaign ?
[20:15:29] interactionjaxsn: aces1up: aslo => http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
[20:16:19] n_blownapart: DouweM: btw yeah on line 11 it was set up like line 24 and 37 et al. but once I add the interpolation and line 5's let function it requires the apostrophe. sorry to belabor it... http://pastie.org/8156530
[20:16:32] aces1up: interactionjaxsn campaign has_many nodes
[20:16:41] aces1up: and node belongs_to campaign.
[20:16:56] aces1up: typically i am processing a node, and might not have reference to campaign ar object.
[20:17:17] DouweM: n_blownapart: show us a version that works with ' instead of \' on line 11
[20:17:24] aces1up: so i would like to in effect clone current node to have same AR campaign_id as current but with different other settings.
[20:18:32] tfitts: anyone here use soulmate/redis for autocomplete? I'm trying to follow the directions but it doesn't seem like it is installing after I run gem install soulmate
[20:19:10] interactionjaxsn: aces1up: fair enough. I'm not sure exactly what you need outside of a basic primer to AR associations. check the link i provided and see if tht gets you further down the road
[20:20:03] interactionjaxsn: tfitts: i was wondering when you would get to that... I had the same problem with soulmate so I didn't use it either.
[20:20:24] tfitts: interactionjaxsn: so are you using redis?
[20:20:30] interactionjaxsn: tfitts: i'm not using redis either although i wish i was.
[20:20:42] tfitts: how come you stopped using it?
[20:21:00] tfitts: you wish you were
[20:21:00] interactionjaxsn: tfitts: thats why i didn't respond earlier nothing relevant to share.
[20:21:39] interactionjaxsn: tfitts: stakeholders didn't like the idea of using memory... :/
[20:22:56] interactionjaxsn: tfitts: railscasts has an episode on autocomplete that is what i used, slightly modified to fit my needs.
[20:23:28] n_blownapart: DouweM: sorry not sure what's going on. more drama to come.
[20:23:47] DouweM: n_blownapart: well, it's not like I've got anything better to do on a Friday night :P
[20:24:01] n_blownapart: DouweM: thanks have a great night
[20:24:02] tfitts: interactionjaxsn: yeah, I watched the railscast. That's how I got onto soulmate in the first place but I guess I may end up going with just redis
[20:25:46] tfitts: rhizome: was that to me?
[20:34:56] halogenandtoast: So probably an odd questions, but what's something someone would like a book written about in the domain of rails that doesn't currently exist?
[20:41:35] toddWork_: in my controller, how do i make this a GET? redirect_to "/docs/#{@cat.id}/category_description"
[20:42:28] RubyPanther: halogenandtoast: I would like 1000 pages or so about advanced AR queries using only arel, especially including db-specific capabilities, and categorized or cross-referenced with traditional SQL
[20:42:45] halogenandtoast: RubyPanther: That sounds fun.
[20:43:57] halogenandtoast: 1000 pages seems like a lot, I could use a big font.
[20:44:12] interactionjaxsn: i'm sure you could get that in 1000
[20:45:03] RubyPanther: halogenandtoast: the other thing I'd really want is a book that walks through implementing Use Case driven development with rails as a plugable delivery mechanism along the lines of what was described by Uncle Bob http://confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years
[20:45:49] RubyPanther: the latter book would sell a million copies, the former... well, I'd buy it.
[20:49:19] interactionjaxsn: RubyPanther: what term would you use... in regards to your DSL comment in #ruby
[20:49:39] sethetter: How do I update test/fixtures with new migrations?
[20:49:44] halogenandtoast: RubyPanther: I haven't watched this talk yet so I'm going to savor it.
[20:50:48] livsom: question about using paperclip that has attachments in the cloud (i.e. rackspace cloud files) - is there a good way to implement this in a way that you are creating an attachment record and "connecting" to an existing cloud object file vs having to create the attachment locally first and then have paperclip upload it? I have an app outside of the rails app that is putting the files into the cloud from our customer sites and
[20:50:48] livsom: would like to create a model object in our rails app that has an attachment that is connected to the cloud file object but not have to pull it down, attach it, and upload it again
[20:51:00] RubyPanther: halogenandtoast: I usually only read transcripts and I watched it like 5 times, that's how good it is.
[20:51:14] sethetter: RubyPanther: what talk is this?
[20:52:18] espinet: anyone understand the fixture error
[20:52:18] espinet: Fixture::FormatError: Bad data for Rsp::InteractionType fixture named {"id"=>"1", "name"=>"Inform", "created_at"=>"2013-03-13 10:34:39.251053", "updated_at"=>"2013-03-13 10:34:39.251053"} (nil)
[20:52:41] RubyPanther: sethetter: http://confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years
[20:55:11] RubyPanther: His suggestions are very ambitious, but even if you're still going to do things the "rails way," it still really helps. I try to keep the spirit of his suggestions in mind when deciding what goes in a view, what goes in a helper, what goes in a model, etc
[20:58:44] rhizome: livsom: doesn't sound like a paperclip thing, but just a "have the app create new models with the path of the cloud file"
[20:59:42] livsom: well I still want to access the file later and figured paperclip ail give me the automatic access to it when I want to pull it down locally later for processing (these are files that will get processed on the server at some point)
[21:00:20] aces1up: what is the best way to initialize other model objects that need to be initialized after a certain model object has been created? using something like the callback after create?
[21:00:46] livsom: i was trying to leverage some of the automatic behind the scenes access to the file instead of having to write more cloud file code - these are not public access CDN files - rather require api access to get them
[21:14:59] jabagawee: three models: Query, FilterGroup, Filter. a query has many filtergroups, which each have many filters. however, a filtergroup can only belong to one query. what is the best way to model associations?
[21:15:14] jabagawee: also, a filter can only belong to one filtergrou
[21:37:36] asoliman: is it possible to use a group_by but convert datetime object to date so the keys are dates not date_time?
[21:37:46] asoliman: @council_events_by_date = @council_events.group_by(&:date) that is the line i am referencing
[21:41:32] asoliman: nvm, sorry got it
[21:48:18] dopie: http://pastebin.com/3KeEMBR7
[21:50:32] DylanJ: has anyone here ever run into the odd scenario where you needed i18n'd active merchant errors.
[21:51:55] DylanJ: and by errors i mean "is not a valid credit card", "is expired", "is required"
[21:51:59] rakl: pastebin
[21:52:04] rakl: pastebin.com
[21:52:16] rakl: http://pastebin.com
[21:52:26] rakl: why won't helpa talk to me
[21:52:31] xcv: I'm running into something weird here: I added a column via a migration, but it's not being detected in 'rspec spec' (no method error)
[21:52:37] rakl: http://pastebin.com/asdasda
[21:52:38] xcv: I can see it in rails console
[21:52:47] DylanJ: xcv RAILS_ENV=test rake db:migrate
[21:53:02] xcv: I feel silly now
[21:53:07] DylanJ: it happens
[21:53:07] xcv: it had to be something obvious
[21:53:13] rakl: rake db:test:prepare
[21:54:19] xcv: thanks!
[21:54:21] DylanJ: rakl: blowin' my mind right here
[21:54:40] rakl: what how?
[21:55:35] DylanJ: i've always used rails_env
[21:55:41] DylanJ: but this saves so many characters
[21:56:21] rakl: hah yeah. it's better. it drops and creates the db too.
[21:56:25] rakl: and seeds it I think
[21:58:47] terrellt: So find_by is deprecated. Do I have to manually raise ActiveRecord::NotFound when .where.first == nil?
[22:00:51] DylanJ: is it deprecared in rails 4?
[22:00:55] DylanJ: deprecated**
[22:01:14] KU0N: terrellt: find_by is not deprecated, dynamic finders are
[22:01:26] KU0N: find_by :id => someid
[22:01:30] DylanJ: ^ this is what i thought.
[22:01:46] DylanJ: find_by_some_column(col_val)
[22:01:58] terrellt: Alright, is that preferred syntax over .where().first!?
[22:01:59] lethjakman: find_by_email is depreciated but find_by :email => 'value' is not?
[22:02:07] bricker: lethjakman: no
[22:02:14] bricker: both work and are not deprecated
[22:02:28] KU0N: And find_by don't raise NotFound error, only find does.
[22:02:32] lethjakman: bricker: ok...good. that was about to be a huge pain in my butt.
[22:03:07] bricker: terrellt: where().first! technically goes through less code so you might prefer that if you're worried about micro-optimizations
[22:03:27] terrellt: find_by! does, I'd imagine.
[22:03:30] terrellt: bricker: Thanks.
[22:03:38] terrellt: And to everyone else too.
[22:03:54] KU0N: I read somewhere that dynamic finders would be deprecated at some point, there are not yet in rails 4.0.0
[22:04:00] lethjakman: however I was curious, I keep seeing the code find(params), and that seems like it could be a big security hole. am I right in assuming that's bad?
[22:04:17] KU0N: Maybe it is still a discussion in an issue, they rely on method_missing which was considered unclean implementation.
[22:05:05] KU0N: But if it works and you don't get warning, no need to change I suppose.
[22:05:45] KU0N: http://edgeguides.rubyonrails.org/4_0_release_notes.html
[22:05:57] KU0N: I wasn't dreaming, they are actually deprecated.
[22:06:12] KU0N: but not all of them.
[22:06:22] KU0N: find_by_email is fine for now
[22:06:32] rakl: what's a good way to do authentication in capybara if your users are authenticating with ldap?
[22:07:03] rakl: Everything in my app requires authentication
[22:07:25] bricker: rakl: stub current_user or whatever your controller checks
[22:08:22] blitz: so if I implement a validates_inclusion_of in a class, how do I check if a something is then valid
[22:08:40] rakl: bricker it checks session[:userid], but I don't have access to the session variable in this test for some reason?
[22:09:08] rakl: path is spec/features/some_controller_spec.rb
[22:09:29] bricker: rakl: surely you have a current_user method or something similar?
[22:09:41] rakl: bricker :( no
[22:09:48] rakl: I'm not allowed to touch the code either
[22:09:55] rakl: until we get current functionality tested
[22:10:48] Netun0: [D[D[A
[22:11:07] terrellt: Do controllers only respond with 404 when the record's not found in production?
[22:11:32] terrellt: It's just not a pretty JSOn response.
[22:14:59] blitz: how would you check if a validates_inclusion_of is working
[22:15:32] lupine: any of y'all familiar with opalrb ?
[22:17:31] dopie: Hey all i am deploying using capistrano
[22:17:39] dopie: http://50.57.132.227/
[22:17:44] dopie: my assets arent showing up
[22:19:37] hellion: whats the preferred method for pushing specific tables to heroku? taps or heroku-pg-transfer? I don't like that taps depends on sqlite…and have not used pt-transfer.
[22:20:53] bricker: blitz: with a test... try passing in something that shouldn't be allowed and assert that it's invalid
[22:26:35] dopie: bricker, can yeh help me out here
[22:27:43] bricker: dopie: well what's the problem, are you getting 404 errors, 400 errors, 403...?
[22:27:53] dopie: Im getting no errors
[22:27:55] dopie: http://50.57.132.227/
[22:28:13] bricker: I see three errors
[22:28:21] dopie: not found
[22:28:48] bricker: dopie: http://50.57.132.227/assets/application.css
[22:28:57] bricker: so it's there, maybe the manifest is incorrect
[22:29:16] dopie: ok wow...
[22:30:00] dopie: how would i even go about fixing that
[22:31:18] bricker: make sure your deploy process is setup to handle the assets properly.
[22:31:36] bricker: dopie: capistrano has it built-in but you might need to enable it
[22:40:43] ulfric: hey so for some reason
[22:40:54] ulfric: ationmailer just stopped working locally
[22:40:59] ulfric: actionmailer*
[22:41:03] ulfric: like on all my apps
[22:41:53] ulfric: anyone ever experience this before
[22:48:42] davidz_: is naming different classes like Foo::Email and Bar::Email by the same name but under different namespaces not recommended?
[22:49:27] RubyPanther: davidz_: it is normal if they're implementing the same interface
[22:50:42] davidz_: i suppose they do according to my task description
[22:53:16] MyNerv: Hi guys - I'm thinking of moving from MAMP to RoR. I know this is a big change, but can anyone give me some pointers into a good route to take to get 'The Ruby way'?
[22:54:59] Mathias__: who is tor ?
[22:58:52] davidcelis: MyNerv: How's your Ruby
[23:01:43] mjc_: ugh .to_json performance :(
[23:04:07] MyNerv: davidcelis: not good - never used it
[23:14:46] rhizome: mjc_: yajl, etc.
[23:15:19] mjc_: rhizome: trying to monkeypatch .to_json to use oj
[23:16:17] ulfric: so my action mailer
[23:16:24] ulfric: just stopped sending emails locally
[23:17:12] ulfric: has anyone experienced this lately
[23:20:53] mjc_: bzitzow_: https://github.com/ohler55/oj
[23:27:59] bricker: ulfric: could be a problem with your server's smtp config
[23:28:13] ulfric: how could i check that out?
[23:28:39] ulfric: bricker: what could have changed from yesterday to today/
[23:28:50] bricker: ulfric: /etc/mail/sendmail.conf or something like that.
[23:29:04] bricker: ulfric: no idea
[23:29:23] bricker: ulfric: maybe your server/app got flagged as spam somewhere
[23:29:42] bricker: or maybe it's going through another server which is catching is as spam.
[23:30:08] ulfric: bricker: i tried it on a whole bunch of diff apps
[23:30:09] bricker: or maybe someone changed the action mailer config in your app
[23:30:16] ulfric: could it be a problem with actionmailer
[23:30:25] bricker: probably not.
[23:30:41] bricker: actionmailer is simple and works well almost all of the time
[23:31:57] bricker: ulfric: I assume you're using sendmail, if not then it could be another problem
[23:52:01] rhizome: mjc_: change as_json if anything
[23:56:24] fuzzyhorns: any tips for learning a new, big, app?
[23:57:59] bricker: fuzzyhorns: ask a lot of questions
[23:58:04] bricker: to someone who knows itp
[23:58:12] fuzzyhorns: lol fair enough
[23:58:32] fuzzyhorns: i am at my first junior web dev job, wondering how long it usually takes people
[23:58:37] fuzzyhorns: i want to do a good job