« Back to channel list

#RubyOnRails - 22 July 2013

« Back 1 day Forward 1 day »
[00:07:18] toretore: dcope: for testing?
[00:09:31] Radar: dcope: looks like a solution in search of a problem.
[00:10:34] Radar: dcope: why do you want to do this?
[00:19:51] dcope: Radar: a gem im using requires it
[00:21:25] Radar: dcope: Could you please explain using more than 6 words? Preferrably a couple of sentences?
[00:21:41] Radar: dcope: It's all fine and dandy that you understand the context yourself, but if you want help you're going to have to make other people understand the context too.
[00:27:31] t00r: Can I use devise without permit sing up of new users?
[00:28:47] sj26: t00r: yes, just don't use the registrations module.
[00:29:35] t00r: sj26: sry about the stupid question, but how I do that?
[00:29:49] sj26: In the model (https://github.com/plataformatec/devise#configuring-models) omit registerable
[00:30:50] t00r: sj26: I will try it. Thanks! =d
[00:31:04] sj26: t00r: np, good luck
[00:35:35] t00r: devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
[00:36:04] t00r: sj26: I just cut :registerable and it works. thx
[00:37:35] sj26: t00r: great!
[00:38:20] sj26: t00r: for anything else you can always consult the readme (https://github.com/plataformatec/devise) and how to guides (https://github.com/plataformatec/devise/wiki/How-Tos)
[00:38:53] t00r: sj26: ok, thank you very much! :)
[00:54:52] dllama: is there a way to paste full method into pry for testing or do i hate to do it line by line?
[01:09:01] a|i: is http://api.rubyonrails.org/ open source? I wonder how the text editor for that website works.
[01:09:24] a|i: and how is the structured text modeled in database.
[01:10:07] Radar: a|i: no it's not open source.
[01:10:18] Radar: If it was open source then it wouldn't look like that :)
[01:11:11] a|i: Radar: any idea how the text is modeled in db? is it based on a wiki software?
[01:11:15] Radar: a|i: no idea.
[01:11:24] Radar: a|i: I *think* it might use sdoc
[01:12:21] a|i: Radar: you're right! https://github.com/voloko/sdoc/ : Powering http://api.rubyonrails.org/
[01:12:46] sevenseacat: Radar wins this round
[01:12:52] a|i: see, it's open souce!
[01:18:33] dllama: whats the best place to put a class that i would want to run on start up?
[01:19:22] a|i: dllama: config/initializers
[01:20:00] dllama: hmm ok thanks will try that
[01:25:56] chrisan: I'm getting `Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'` when I try to rake db:migrate -- gem list shows EventMachine in there, and I have another app on the same server with the same EventMachine version that works.., any ideas?
[01:50:41] terra43110: has anyone taken the SaaS courses on edx?
[01:53:45] Radar: terra43110: link?
[02:02:45] terra43110: https://www.edx.org/course/uc-berkeley/cs-169-1x/software-service/993
[02:03:02] terra43110: it's teaching RoR
[02:03:24] Destriant: Quick question, hoping someone has an idea. I'm setting up a controller to broadcast Server Sent Events (https://gist.github.com/6050862) and need to write the total count of rows in my table. Right now I'm using the model's count method (Pledge.count) to get the count. However, when a row gets added to the DB, the count doesn't increment (unless I reload the page). Is this a caching issue, or something with the way I've defined
[02:03:25] terra43110: i was hoping to learn it thru that class, but not sure i can handle it
[02:04:01] Radar: terra43110: I wrote a book about building a SaaS app with Rails. You can read that at your own leisure.
[02:04:03] helpa: terra43110: Multitenancy With Rails - https://leanpub.com/multi-tenancy-rails - An excellent book that teaches you about building a Multitenanted Rails application. Written by Ryan Bigg.
[02:04:03] Radar: terra43110: !mtwr
[02:05:01] Destriant: Line 13 of the Gist doesn't reflect a new value when the pledges table gets a new row https://gist.github.com/6050862
[02:10:13] Radar: Destriant: why are you using tabs as indentation? 2 spaces is the standard in Ruby.
[02:18:57] Destriant: Eh I haven't updated my editor prefs yet.
[02:19:33] Destriant: https://gist.github.com/6050935 new gist with indentation fixed
[02:21:38] Destriant: Sorry about that Radar
[02:22:04] Radar: I have no idea about your problem btw. Indenting with tabs just irks me
[02:22:12] Radar: thank you for updating the gist though
[02:22:51] Destriant: Cool, thanks anyways
[02:27:10] ritek: How can I see the 1.1.6 guides on http://guides.rubyonrails.org/?
[02:32:13] Radar: ritek: why 1.1.6? There were never any 1.1.6 guides.
[02:32:38] spaghettiman: when running a background job in rails with something like rufus, is it customary to make a special environment just for the background jobs? I am trying isolate my background logs from development.log and production.log
[02:33:10] spaghettiman: i wanted to be able to run the background jobs with different environments but it looks like i cant: https://github.com/rails/rails/blob/3-2-stable/railties/lib/rails/application/configuration.rb#L89
[02:34:38] ritek: Radar: no guides for that version? really!?
[02:34:50] ritek: Radar: I was given legacy code in that rails ver
[02:35:11] Radar: ./quit your job
[02:35:12] sevenseacat: it would greatly surprise me if there were docs for such a version
[02:35:16] Radar: 1.1.6 is anccciiiieeeennnntttt
[02:35:24] Radar: The only docs you will find on it are the API docs and glhf finding thoise
[02:38:48] Radar: ritek: 1.1.6 was the version of Rails I started on.
[02:40:47] ritek: Radar: there are indeed plans to upgrade for sure. But I think we can agree this upgrade process will take time, quite a big codebase
[02:40:54] Radar: ritek: yes
[02:41:09] Radar: and can we also agree that the chances of you getting help in this channel with such an ancient version are slim to none?
[02:41:09] ritek: Radar: cool! how was it, in general? (I started with 3.x)
[02:41:18] Radar: terrible.
[02:41:28] Radar: compared with what 3.0 is now
[02:41:37] Radar: and 4.0 is a nice polish on top of what 3.0 accomplished
[02:42:11] Radar: bbl, lunch nomming
[02:42:51] ritek: yeah I asume before 3.x compared with what we have now would be qualified as terrible
[02:43:52] ritek: it seems not so much people talked about 1.1.6 back on those times or so. Info seems kind of limited
[03:09:04] jsilver: Wall Hallo Thar
[03:09:28] jsilver: If matz is so nice, how come one time he kick my dog
[03:10:58] n_blownapart: hi I'm getting 3 fails from, seemingly, line 98. The error is: 'Undefined method 'save' for nil:NilClass. thanks: http://pastie.org/8162823
[03:12:17] sevenseacat: n_blownapart: and where are you defining @user ?
[03:12:53] n_blownapart: sevenseacat: here's the full error message: http://pastie.org/8162828
[03:13:03] sevenseacat: (if you clean up your indentation it would probably be clearer)
[03:15:48] n_blownapart: sevenseacat: well @user is defined on line 84. This is a book example; I'm looking for my error
[03:16:17] sevenseacat: n_blownapart: its defined for that describe block on line 84, yes
[03:16:25] sevenseacat: you are not in that describe block
[03:18:10] sevenseacat: your describe block begins on line 97
[03:18:24] sevenseacat: no @user defined there
[03:26:01] n_blownapart: sevenseacat: I'm working on it after making things worse.
[03:37:20] rakl: I'm having a little bit of trouble with capybara in an app that uses a lot of async js. When I use click_link('New'), how can I ensure that it's actually clicking the "New" I want it to?
[03:37:37] rakl: I think there's only one on the page, and when I say find_link("New"), it seems to be right one
[03:38:17] rakl: but capybara complains that there is no action New on the SiteController. When I click the New link in my browser, it's going to the correct controller which has a New link
[03:38:20] rakl: New action* sorry
[03:38:31] sevenseacat: rakl: code and error plz
[03:41:14] rakl: hmm, I think I know see the problem..but I don't know how to get around it
[03:41:14] rakl: http://pastie.org/8162902
[03:41:25] rakl: job_requests#index is rendering site/index
[03:43:10] laura__: I created a basic scaffolded project - in the xxx_Controller there is a method for new and within the method is a respond_to do -- I have googled the topic, and nothing that great yet turns up. I am trying to understand how the new.html.erb page gets "chosen" to run. Any sources that might be the best to checkout for details on this?
[03:45:35] sevenseacat: rakl: and the problem is?
[03:46:06] sevenseacat: laura__: http://stackoverflow.com/questions/6118639/rails-respond-with-how-does-it-work
[03:46:13] rakl: the problem is that this codebase sucks ass and I've been told to write tests for it without touching the code
[03:46:42] rakl: in this case, the problem was that this was in one of the views:
[03:46:55] rakl: #new-button=link_to 'New', new_path, :remote => true
[03:47:43] rakl: and new_path was ambigious enough that in the test environment, it was attempting to go to site#new instead of job_requests#new where it should go
[03:47:57] sevenseacat: new_path isnt ambiguous
[03:48:06] sevenseacat: it refers to whatever your routes define new_path as
[03:50:20] rakl: hmm… well in rake routes, I"m clearly seeing new_path points to site#new. But when I use the app in a browser an click the button, I can see it firing a request to /job_requests/new
[03:50:38] sevenseacat: code/logs plz
[03:53:17] rakl: sevenseacat http://pastie.org/8162931#
[03:55:40] n_blownapart: sevenseacat: hi again. Are you saying I need another subject { @user } somewhere close to line 84 ? Confusing... thanks: http://pastie.org/8162823#1,45
[03:56:08] sevenseacat: rakl: so in the absence of any code that actually demonstrates the problem are you trying to tell me that a link to /sites/new actually goes to /job_requests/new ?
[03:56:15] n_blownapart: http://pastie.org/8162823 ^^
[03:56:43] Radar: rakl: please show us how new_path is being defined.
[03:56:58] sevenseacat: n_blownapart: not really confusing. things are only defined in the context of their parents - your user on line 84 is defined for lines 82-88 only
[03:57:18] sevenseacat: n_blownapart: your indentation is still confusing the issue
[03:57:20] rakl: match 'new', :to => "site#new"
[03:57:27] n_blownapart: sevenseacat: ok I'm working on it
[03:57:42] Radar: n_blownapart: end on line 95 looks wrong.
[03:58:19] sevenseacat: Radar: one of many problems with this code.
[03:58:47] sevenseacat: the indentation is wrecked - as far as I can tell, the user specs actually end on line 79
[03:59:56] n_blownapart: sevenseacat: the tutorial puts it together piecemeal with sections missing/abbreviated. maddening for a beginner.
[04:00:06] sevenseacat: what tutorial?
[04:00:09] sevenseacat: because i doubt that
[04:00:41] Radar: rails tutorial I bet.
[04:01:13] n_blownapart: sevenseacat: I'll show you it's michael hartl. Radar yeah
[04:02:14] Radar: Strangely so many people have problems with Rails Tutorial but rarely see people asking about Rails 4 in Action in here :)
[04:02:29] n_blownapart: sevenseacat: you mean that I want to show you or that it is hartl?
[04:02:33] sevenseacat: Radar: funny about that
[04:02:38] n_blownapart: I'm going to buy it as per sevenseacat suggestion
[04:03:09] n_blownapart: yeah screw it I hate this tutorial. Radar sevenseacat
[04:03:46] n_blownapart: but thanks ^^ !
[04:04:33] n_blownapart: here it is if you have the time Radar sevenseacat http://ruby.railstutorial.org/chapters/modeling-users#sec-an_encrypted_password
[04:04:39] sevenseacat: well thats the first part of the spec
[04:04:53] Radar: n_blownapart: Fix your indentation and then we will look :)
[04:04:54] sevenseacat: thats not the messed up part you have at the end
[04:05:22] Radar: n_blownapart: end on line 78 looks to me like it shouldn't be there.
[04:08:14] n_blownapart: sevenseacat: Radar I'm doing this on a laptop... can't keep it straight
[04:08:37] sevenseacat: what kind of excuse is that? :/
[04:08:42] Radar: it doesn't matter what you're doing it on :\
[04:09:09] sevenseacat: ACTION works on a 15" laptop
[04:09:12] n_blownapart: alright please bear with me if you have the time/inclination
[04:09:23] Radar: n_blownapart: what editor are you using?
[04:09:30] sevenseacat: i went back to using my old 13" laptop on the weekend .feels so small now.
[04:10:06] n_blownapart: Radar: sublime2
[04:10:18] n_blownapart: Radar: I'm pretty much a beginner to programming
[04:11:10] Radar: n_blownapart: mouse over the sidebar where the line numbers are and you will see small triangles. Click the triangles to close the code blocks
[04:11:53] Radar: n_blownapart: end on line 78 shouldn't be there
[04:12:06] Radar: line 90 should be indented one space left
[04:12:43] Radar: remove the second end after "when password doesn't match confirmation" describe block
[04:12:51] Radar: two describes underneath that end should be indented left once
[04:13:30] Radar: Clicking the triangle at the top of the describe 'User' block should make the file just have the describe and end lines visible.
[04:13:31] n_blownapart: Radar: hold on I'm going to send it again I've been screwing with it. thanks !
[04:13:36] Radar: Once you have that, we will help you.
[04:14:00] n_blownapart: Radar: ok thanks
[04:33:08] n_blownapart: Radar: here it is again. Also posted the user.rb file and I think I shouldn't even have line 15-16. thanks
[04:33:09] n_blownapart: http://pastie.org/8163014
[04:37:40] sevenseacat: gah, why is my mailer trying to actually send email in test env
[04:38:18] sevenseacat: its probably not in test env
[04:39:13] laura__: sevenseacat - link was helpful - got me a bit further --- still a bit confusing. But it led me to more links etc. Thank-you!
[04:42:02] sevenseacat: if only i could work out why my action mailer was being silly even though Rails.application.config.action_mailer.delivery_method => :test even in the middle of my test
[04:44:42] sevenseacat: note to self: actually read the error message next time
[04:47:04] Guest____: I've got an older 2.3.18 install which i've just upgraded to run on ruby 1.9.3. Having a quick click around I've noticed that error messages are rendering incorrectly. Instead of highlighting fields and rendering the error it's rendering the full html code to the page <span class="fieldWithErrors"><input…</span>. Has anyone seen this before or have any ideas as to how to fix?
[04:53:30] codemannew: use ruby mime it says sdk not installed sigh
[04:54:50] amh345: fun question time!! nginx + rails. is there a way to get a portion of my app to have a different domain name?
[04:55:22] amh345: more specifically. a single controller.
[04:55:47] codemannew: ANY ONE HERE use rubymine
[04:55:52] codemannew: please let me know thanks
[04:56:30] gwillen: codemannew: it might help if you gave the full text of the error message you're getting
[04:57:33] amh345: oh. there a :constraints => { :domain => "domain.com" } for routes. inneresting.
[04:58:01] amh345: time to hit up /hosts
[05:02:51] codemannew: error running no sdk
[05:03:10] codemannew: specified and i need to install it sigh im so used to visual studio and all but im liking the ruby mine a bit
[05:04:01] amh345: why use an die?
[05:04:15] amh345: i haven't touched an die since netbeans
[05:07:15] codemannew: so help me plz
[05:08:03] codemannew: like i dont get it
[05:12:23] amh345: what is the problem?
[05:13:52] Radar: codemannew: please don't spam the channel
[05:15:03] codemannew: im not spamming
[05:15:18] codemannew: how can i make it work the rubymine work it says like no sdk
[05:15:53] Radar: codemannew: You've written 95% of the messages in the last 20 minutes.
[05:15:59] Radar: codemannew: You have asked the same question over and over again
[05:16:01] Radar: That is spamming.
[05:16:03] Radar: Please don't do that.
[05:16:07] Radar: Ask once and then wait.
[05:16:34] amh345: wtf is "says like no sdk" ?
[05:16:45] amh345: me no likey sdk ?
[05:17:19] codemannew: im sorry radar im very stressed thats all
[05:17:27] codemannew: and its just hurting my back and eyes and head
[05:17:41] Radar: +q codemannew!*@*
[05:17:49] Radar: Cool. Take a break for 1 hour and come back to it.
[05:19:53] [narcan]: anyone got any suggestions for ssl certs, thinking of using rapidssl ?
[05:23:14] amh345: bingo bang. match 'testlogin', :to => 'sessions#new', :constraints => { :host => "www.blahblah.com" } works.
[05:23:27] amh345: codemannew: please don't pm unless you ask ahead of time.
[05:24:34] amh345: i would like to find out how to have a condition root.
[05:31:31] amh345: i got it. root :to => "admin::sessions#new", :constraints => { :host => "www.blahblah.com" } followed by root :to => "public#index" it seems to work. i hope its right.
[05:59:48] darkstar|: morning elaptics
[06:00:36] elaptics: darkstar| hi
[06:17:01] whowantstolivefo: hiya, does anyone around worked with firebird db before?
[06:17:33] sevenseacat: it wasn't much fun.
[06:18:41] whowantstolivefo: sevenseacat: hmm i understand but my company works with Firebird and im sick of running stuff about db in windows, i use Ubuntu and i want to make my reports with rails web based and it will be tutorial for me also
[06:19:22] whowantstolivefo: we have an hospital ERP and it works with Firebird 2.1
[06:20:17] whowantstolivefo: i've found an example here http://mapopa.blogspot.com/2009/02/rails-on-firebird-status-after-adapter.html but i dont know will it work or no
[06:20:27] rhizome: one way to find out
[06:21:13] sevenseacat: from memory i used jruby and a jdbs adapter to talk to firebird from rails
[06:22:02] whowantstolivefo: hmm. then i must digg jruby and jdbs
[06:42:12] xhoy: hi, i try to help somebody on a gem (the gem is there but is missing documentation etc) how where is good place to start reading on how to use gem? (since includeing it in a rails app isn't a realy good idear as i see :))
[06:42:27] xhoy: i saw i could use irb and load the gem etc
[06:47:03] mauro1254: Hi guys, I have a rails app (v. 3.2.13) and I need to create to folders in app/views for layout + partial for subdomains ... How can I then set the view folder according to the subdomain on the AplicationController? Many thanks.
[06:47:32] xhoy: isn't there by default a /layout dir?
[06:47:36] mauro1254: Something like app/views/dom1 & app/views/dom2
[06:47:43] mauro1254: not just for the layaout ...
[06:48:00] xhoy: what else?
[06:48:03] mauro1254: layout and views differs
[06:48:11] xhoy: mm how mutch?
[06:48:15] xhoy: different colors?
[06:48:20] xhoy: or is it like /admin?
[06:48:22] mauro1254: not just css
[06:48:24] xhoy: and default?
[06:48:33] mauro1254: same app for two institutes ...
[06:48:38] xhoy: aaaaaaaaah
[06:48:41] xhoy: make a git repo
[06:48:46] xhoy: and 2 branches
[06:48:52] xhoy: that is WAY easyer :)
[06:49:02] xhoy: def the controller and models in the master
[06:49:09] mauro1254: Well ... I have to deploy one app that support 2 institutes
[06:49:11] xhoy: and downmerge them for the views
[06:49:24] mauro1254: controllers are identic
[06:49:38] xhoy: and it is like org1.domain.tld and org2.domain.tld?
[06:49:39] mauro1254: one controllers but diferent views
[06:50:03] mauro1254: same controller, per domain views and layout
[06:50:10] xhoy: http://stackoverflow.com/questions/5099320/ruby-on-rails-different-views-for-same-action-based-on-users-role
[06:50:20] xhoy: but that would be a pain..
[06:50:35] xhoy: mauro1254: do you have one rails server?
[06:50:41] xhoy: mauro1254: do they use the same data?
[06:50:46] xhoy: (same db etc?)
[06:50:55] mauro1254: same server, same data, same controller
[06:51:11] mauro1254: probably different js, for sure different view
[06:51:19] mauro1254: data is presented in a different way
[06:51:25] xhoy: then yuou have different assets
[06:51:35] mauro1254: different css, images, ...
[06:51:42] mauro1254: this is not a problem
[06:51:44] xhoy: mmm, its a lot of work, making to different apps is mutch easyer...
[06:51:49] mauro1254: I already have to layouts
[06:51:55] mauro1254: yes I know ...
[06:52:17] xhoy: what does google say?
[06:52:23] mauro1254: and each layout includes its application.css file
[06:52:51] mauro1254: I didn't find a solution and I thought that the best way was to ask here
[06:52:55] xhoy: http://stackoverflow.com/questions/1772408/running-multiple-sites-from-the-same-rails-codebase
[06:53:09] xhoy: yeah i know but sometimes google gives you idears :)
[06:53:19] xhoy: isn't there a gem for this?
[06:53:46] xhoy: http://stackoverflow.com/questions/2599920/multiple-applications-with-ruby-on-rails/2600043#2600043
[06:53:57] mauro1254: Is there a method like 'layout'
[06:54:03] xhoy: namespaces
[06:54:07] mauro1254: to redefine the parial folder
[06:54:25] mauro1254: app/views/dom1 instead of app/views/
[06:54:48] mauro1254: I need to investigate ...
[06:54:55] xhoy: you could redefine that dir
[06:55:24] xhoy: the problem is, you need it on the view :P
[06:55:30] mauro1254: ApplicationController extract domain from url and then need to redefine the dir
[06:55:41] xhoy: so you need to redefine/fix the render command
[06:56:00] mauro1254: you can set the layout with layout method
[06:56:12] xhoy: mauro1254: and is domain.tld/inst-1/ an idear?
[06:56:22] xhoy: then you could just dupe your routes
[06:56:37] mauro1254: it is not possible now ...
[06:56:54] mauro1254: I have a collection of apps that use subdomains depending on the institute ...
[06:56:56] xhoy: you COULD do that with a proxy :)
[06:57:04] mauro1254: need to investigate
[06:57:13] mauro1254: I'll back soon
[06:57:17] xhoy: scope 'my_subdir' do # all resources and routes go here
[06:57:19] mauro1254: Thanks for your help
[06:57:37] xhoy: i would say comeback this afthernoon and ask again
[06:57:46] xhoy: maby somebody with more experince is a wake then :)
[06:58:01] xhoy: http://apidock.com/rails/ActionController/Base/url_for
[06:58:09] xhoy: mauro1254: i think thi sis your friend :)
[06:59:03] aantix: if I wanted to do, x = pledge.user.name what's a convenient way to set this to nil if the associated user object doesn't exist?
[06:59:20] xhoy: x = pledge.user.name ||= nil
[06:59:28] xhoy: let the model return nil if it is empty
[06:59:30] sevenseacat: xhoy: if user is nil, that will error.
[07:00:11] xhoy: sevenseacat: but when does that work then?
[07:00:32] sevenseacat: easiest way to do it is probably pledge.user.try(:name), though i'd probably put delegates in the pledge model and handle it that way
[07:00:32] aantix: I could do x = pledge.user.name rescue nil
[07:00:39] xhoy: if plegdge.user plgdge.user.name else nil
[07:01:10] xhoy: i tought ||= is when the "before" is nil?
[07:01:18] xhoy: ow, because it is non exsisting?
[07:01:31] sevenseacat: xhoy: it will error before it gets to the ||=.
[07:01:37] sevenseacat: you cant call name on nil.
[07:01:55] aantix: I'l give the "try" a try. :) Thanks for the suggestions
[07:02:05] xhoy: aaaaaaaaaaah
[07:12:12] darkstar|: what would be the best way about making line 5 link_to something https://gist.github.com/overhang/421a49e6baaaec297624 trying to treat first.name and last.name as one element?
[07:13:01] dagen: GarethAdams hi)
[07:14:52] darkstar|: ok found the answer on stackoverflow
[07:15:38] tagrudev: darkstar|, usually I make a method in the model like .name which builds first_name + last_name
[07:17:48] dagen: I have some model "page.rb" -> http://prntscr.com/1gtnfx, and "pages_controlle.rb" -> http://prntscr.com/1gtnk2 ... all data for this pages was saved to DB in pages table, and for view of pages i just type in adress bar of my browser /pages/some_page/ ... i need help to understand how i can call some page from my table PAGES to insert into /views/home/temp.html.erb (by render or redirect_to method)? or there is must be another true way?
[07:29:30] darkstar|: tagrudev: im trying to make it so that when a user clicks to on line 6 of show.html.erb it redirects to the contacts page with the appropriate contact_id , and contacts is a nested resource to company, any idea? https://gist.github.com/overhang/6051926
[07:29:52] darkstar|: that show.html.erb belongs to the companies_controller
[07:39:37] liquid-silence: love_color_text :P
[07:42:29] avril14th: I have this scope: scope :for_inventory, lambda{ |inv| where('(credited_inventory_id = :id AND credited_inventory_type = :type) OR (debited_inventory_id = :id AND debited_inventory_type = :type)', :id => inv.id, :type => inv.class) } . Is it possible to rewrite the thing to pass a list of inventories?
[07:48:58] twinkleH1od: avril14th, you mean, give it a list which it searches for? Or return a list of matches?
[07:49:44] avril14th: twinkleH1od: debited/credited inventories are polymorphic relations
[07:50:18] avril14th: So I'm just trying to search for a list of inventories
[07:50:23] avril14th: whatever their types
[07:50:28] avril14th: that's the idea
[07:50:49] avril14th: (this is aka includes for polymorphic associations)
[07:52:02] twinkleH1od: avril14th, Sorry, I pass xD Not really toyed with it, and can't see an obvious solution.
[08:16:53] Oog: the cookie i want is in HTTP_COOKIE but it isnt showing up in the cookies variable... "HTTP_COOKIE"=>"remember_token=w1xMtDnavgjjZrxoBXj2kQ" and for some reason when i log request.env i also see @delete_cookies={"remember_token"=>{:path=>"/"}}
[08:21:38] dagen: Please help... I have some model "page.rb" -> http://prntscr.com/1gtnfx, and "pages_controller.rb" -> http://prntscr.com/1gtnk2 ... all data for this pages was saved to DB in pages table, and for view of pages i just type in adress bar of my browser /pages/some_page/ ... i want to understand how i can call some page from my table PAGES to insert into /views/home/temp.html.erb (by render or redirect_to method)? or maybe there is another true way?
[08:22:23] Oog: WARNING: Can't verify CSRF token authenticity
[08:22:26] Oog: i think is causing signou
[08:22:29] Oog: to the max
[08:24:41] Oog: how do i disable the check for json methods
[08:25:02] universa1: dagen: you load the page in the respective controller/action and then render the appropriate thing in views/home/temp.html.erb
[08:25:33] darkstar|: how can i make it that when line 5 of show.html.erb(companies) when clicked opens the correct show page for that contact https://gist.github.com/overhang/6051926 ?
[08:26:35] universa1: darkstar|: contact path takes an argument
[08:26:43] universa1: the contact it should generate a path for
[08:26:49] universa1: darkstar|: so contact_path(contact)
[08:27:02] helpa: darkstar|: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[08:27:02] universa1: darkstar|: !routing
[08:27:24] darkstar|: aha that makes sense
[08:27:30] darkstar|: or atleast worked
[08:28:03] universa1: darkstar|: read the routing guide.
[08:28:29] darkstar|: will do universa1 thank you
[08:30:14] mikecmpbll: where are the route helpers defined? or rather, where are they described as I imagine they'd have to be defined dynamically.
[08:30:25] mikecmpbll: just trying to work out where my call to posts_path for example, goes.
[08:38:39] IlyaLevin: Hi guys. I'm trying out the zurb Foundation bootstrap. And I got a bit stuck with alerts. http://foundation.zurb.com/docs/components/alert-boxes.html
[08:39:22] IlyaLevin: Somehow they not only appear where they should be, but also pop-up as javascript alerts, wich is undesired.
[08:39:50] sevenseacat: without your code, we can't help you
[08:40:22] avril14th: Hello, Rails doc says "This will execute one query to load the addresses and load the addressables with one query per addressable type. For example if all the addressables are either of class Person or Company then a total of 3 queries will be executed. The list of addressable types to load is determined on the back of the addresses loaded. This is not supported if Active Record has to fallback to the previous implementation of eager
[08:40:23] avril14th: loading and will raise ActiveRecord::EagerLoadPolymorphicError. The reason is that the parent model’s type is a column value so its corresponding table name cannot be put in the FROM/JOIN clauses of that query.".
[08:40:35] avril14th: What is the "previous implementation" ?
[08:41:28] sevenseacat: something not supported, apparently.
[08:41:58] avril14th: Well, they say it's supported except with previous implementation
[08:42:03] avril14th: so when is previous implemetnation
[08:42:05] IlyaLevin: sevenseacat: https://gist.github.com/Almaron/6052316 here is the partial including the alert boxes as mentioned in the manual
[08:42:26] maasha: What would the syntax of a rspec (w. shoulda matchers) test for the existence of a server side dir look like?
[08:42:35] IlyaLevin: everything else is by the book as well
[08:42:59] IlyaLevin: except I moved the javascript_link tag back to the head section in the layout
[08:43:25] sevenseacat: that does not match the HTML as provided in the docs you linked us to
[08:44:22] sevenseacat: it also isnt all the code related to the alerts
[08:48:07] IlyaLevin: sevenseacat hm... How doesn't it match? The data-alert attribute is optional and adding it changes nothing
[08:48:47] sevenseacat: its not optional if you want close buttons
[08:49:17] sevenseacat: which your code has
[08:50:51] IlyaLevin: ok, added it but it still pops up in an alert.
[08:54:26] xhoy: i am working in irb for a gem, how can i reload the files?
[08:54:42] xhoy: or put it in some kind of dev mode it does this by default? :)
[08:55:06] twinkleH1od: Anyone know on the top of their head what the pretty way is to install gems before bundle? (specifically, 2.1.2)
[08:55:13] alienaut: never define a action method called "send" on your controllers :(
[08:55:52] sevenseacat: alienaut: indeed.
[08:59:36] alienaut: aww! it took my two hours to understand what is wrong. i think, there is buildin method called "send" on ApplicationController so my method overrides it :( but what if i want to do it? any idea?
[08:59:55] avril14th: alienaut: send is defined for every ruby Object on earth
[08:59:56] sevenseacat: there's a built-in method on *Object* called send.
[09:00:10] sevenseacat: rename your action.
[09:00:26] alienaut: so is it raw ruby?
[09:00:44] avril14th: alienaut: even an Integer has a send
[09:17:26] xhoy: i have a sting that i camelize (ticket_id to TicketId) but i need it to be TicketID, any suggestions (except rewriteing it) :P
[09:17:39] xhoy: (and i have it with user_id to UserID aswell
[09:28:09] artmann: Hi, I've got a field in one of my models that contains text that is formated with html for example "<p>Lorem ipsum<img src="foobar.png"></p>" And I want to render this html in my view, I've tried ra and html_safe but I cant get rails to parse the html rather then just printing it
[09:28:41] dagen: universa1 what does it mean?
[09:29:55] dagen: universa1 how i can load the page in the respective controller/action? and how the i must render them?
[09:30:23] DaniG2k: guys if I have a tutoring website
[09:30:31] DaniG2k: I'm trying to figure out how I'd set up the model
[09:30:36] DaniG2k: I have tutors, students
[09:30:45] DaniG2k: but they all should sign up as users
[09:30:51] DaniG2k: do I make three models?
[09:31:01] DaniG2k: or have an authentication gem and then two models (tutors/students)?
[09:44:42] DaniG2k: I'm wondering what the best way would be to set up models in Ruby on Rails for a tutoring website.
[09:44:45] DaniG2k: I would like the users to register (I have no particular way in mind but I'm assuming I'll go with one of the more popular ruby gems). They can then choose to be either tutors or students or both.
[09:44:49] DaniG2k: Should I make a tutors model, a students model and have them inherit basic info from the authentication? Or would it be better to have a users model where all the basic info goes (birthday, gender) and then have student/tutor inherit from that?
[09:50:38] helpa: dagen: http://guides.rubyonrails.org/getting_started.html - Getting started with Ruby on Rails guide written by Mike Gunderloy
[09:50:38] universa1: dagen: !getting_started
[09:50:46] universa1: work through that completely first, please!
[09:50:56] dagen: universa1 i dont know how(
[09:51:15] dagen: you mean read docs first
[09:51:17] universa1: dagen: read, try, read, try, tread.
[09:51:32] universa1: dagen: i linked you a guide...
[09:51:47] universa1: DaniG2k: i think that depends on onl you can decide that really ;)
[09:51:54] dagen: universa1 i do the same way you talking for. but its dont working
[09:52:05] artmann: DaniG2k: http://railscasts.com/ There is a few tutorials there on auuth and role handling
[09:52:11] adac: Via migrations I add a new field that I need to fill on my staging/production server with some content. Now I'm using seed_fu for my seeds. I was wondering what is the correct way to seed the data on staging and production with seed_fu?
[09:52:32] universa1: dagen: ok have you worked through the getting started guide i just linked to you? yes? no?
[09:52:47] adac: For example if I seed data now and then its modified, the seed should not overwrite that data again
[09:53:00] dagen: universa1 yes i read before some docs and guide
[09:53:08] universa1: dagen: reading is not enough.
[09:53:12] adac: Do I hve to do a manual "nil" check for that?
[09:53:15] dagen: i setting up the server with ruby and ror linked ghim to herokuapp
[09:53:27] dagen: and some functional is working fine
[09:53:29] universa1: dagen: ok have you worked through the getting started guide i just linked to you? yes? no?
[09:53:40] dagen: but with thgis problem i cant understand how i can do this
[09:54:09] artmann: DaniG2k: Usually You have a model for users and another model for roles and the a relationship between them
[09:54:16] universa1: dagen: you need to learn/understand the basics first. no use in telling you what to do, because you wont understand most of it. that's why you should really work through the guide!
[09:54:17] artmann: I've got a field in one of my models that contains text that is formated with html for example "<p>Lorem ipsum<img src="foobar.png"></p>" And I want to render this html in my view, I've tried ra and html_safe but I cant get rails to parse the html rather then just printing it
[09:54:41] universa1: and working through means, creating the example application that is created there yourself, and understand what is done in each step
[09:54:50] universa1: DaniG2k: can students also be tutors?
[09:54:55] DaniG2k: universa1: yea
[09:55:00] DaniG2k: I'm a total rails n00b so
[09:55:01] dagen: universa1 there is some important things for me wich i cant understand yet - and i'm going to askjing abput this on this channel.
[09:55:05] DaniG2k: I'm just trying to figure this bit out
[09:55:41] dagen: universa1 i'm 12 eayrs old and some things is hard for me yet. but i'm trying!
[09:55:48] universa1: dagen: and i/we keep expecting from you that you spend time on learning things.
[09:56:01] universa1: dagen: the most important thing for you right now is to learn the basics!
[09:56:27] dagen: universa1 i try learn the basics with examples and when i try to do this examples i stucked.
[09:56:27] universa1: dagen: and that's why you should work through the getting started guide, get a book/other tutorials for starting with rails
[09:56:45] adac: Hmm this http://stackoverflow.com/questions/9328449/how-to-update-delete-record-using-seed-fu-gem-in-ruby states that seed_fu does only insert anyways. So i guess when I add a new filed it will inserted only when it is empty
[09:56:46] universa1: dagen: please just do the guide.
[09:57:17] dagen: universa1 i understand some things and can coding some functuional! but sometimes i stucked on simple thing and cant understand.
[09:57:24] dagen: universa1 i understand you
[09:57:25] universa1: dagen: it explains 90% of what you need.
[09:57:55] dagen: universa1 is not true
[09:58:03] universa1: dagen: it is.
[09:58:32] dagen: universa1 i found some decisions in many faq's but examples from this faq's dont help me with my tasks
[09:58:32] universa1: dagen: the other 10% are in other guides and adopting what is in the guides to your needs.
[09:59:36] universa1: dagen: yeah because you don't understand the basics, things look like magic. and i linked the guide with a reason for you. because it explains lots of the basics/shows rails philosophy
[10:00:20] universa1: DaniG2k: even though rails has certain conventions for db design, it isn't really rails specific problem you're having ;)
[10:00:40] universa1: yes, *sigh*
[10:03:01] universa1: DaniG2k: i'd take a pen and paper and draw it out :-)
[10:04:24] universa1: adac: i'd probably update the seeds to reflect the state for a fresh database, and then create a rake task for the existing database/data to migrate it to the new format :-)
[10:05:13] adac: universa1, that sounds cool as well :)
[10:05:58] sqbell: Hello. I need to add a method to ActiveSupport::HashWithIndifferentAccess. I've put it in 'lib/patches/active_support/hash_with_indifferent_access.rb', it looks like so: http://pastie.org/8163634. I've also added it in application.rb (config.autoload_paths += Dir["#{config.root}/lib/patches/**/"]). But the method is not added, even though ActiveSupport::Dependencies.autoload_paths shows the path. Am I missing something?
[10:06:25] sqbell: I'm using Rails 3.2.13.
[10:06:55] universa1: sqbell: why are you inheriting from hash again? iirc you won't need that.
[10:07:11] universa1: sqbell: does the code work if you paste it into the console?
[10:07:26] DaniG2k: universa1: I think what I want is pretty OOP style Tutor < User and Student < User or something
[10:07:35] DaniG2k: should probably go with single table inheritance
[10:07:41] adac: universa1, I just thougt if seed_fu is already smart enough I'd give it a try
[10:07:56] universa1: DaniG2k: what happens with Students who are also Tutors?
[10:08:46] sqbell: universa1: Removed the < Hash but it still is not working. Pasting into rails console works.
[10:09:03] universa1: DaniG2k: i'd most likely model it like this: Course has_many course_tutors; has_many :tutors through: course_tutors; end; CourseTutors; belongs_to course; belongs_to user; end
[10:09:11] universa1: DaniG2k: same for students
[10:09:51] universa1: adac: :-) yeah, good idea!
[10:10:35] universa1: sqbell: ok, could you add some Rails.logger/puts statement at the top to see if the file is actually loaded?
[10:11:38] universa1: sqbell: and not sure about the autoload_paths, did you check that it actually finds your file/directory ?
[10:11:45] martin____: apologies for asking but I am completely lost as to why my rails environment is broken, I am using passenger and it says:
[10:11:54] martin____: Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError) but the gem is installed
[10:12:04] universa1: martin____: under passenger ruby?
[10:12:14] universa1: martin____: bundled?
[10:12:49] universa1: martin____: rails / ruby version?
[10:14:05] sqbell: universa1: I've put the Rails.logger.debug statement at the top but see nothing in the logs, so I guess it is not being loaded. How would I check if it gets found?
[10:14:06] martin____: universa1: Rails 2.3.14 and ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin12.4.0] (using rbenv)
[10:14:28] universa1: martin____: passenger under apache/nginx?
[10:14:47] universa1: martin____: weird version combination btw ;)
[10:16:22] martin____: universa1: sorry, it's apache. I also made a stupid mistake when getting apache to run, I did a chmod 777 to all files and folders in my user folder and now I also get this warning: Insecure world writable dir /Users/martin/.rbenv/versions/1.9.1-p378/bin in PATH, mode 040777
[10:16:45] universa1: martin____: how did you install passenger? what ruby version does it use?
[10:16:57] universa1: martin____: which passenger version btw?
[10:18:26] martin____: universa1: passenger (4.0.10). Installed just by gem install passenger. Was wondering about the versions, started off with rails 2 and ruby 4 and got sample apps working but the svn checkout I have is using older versions, rails 2.3.14 but didn't know what version of ruby was most suitable for that
[10:18:48] universa1: martin____: which ruby version does passenger use?
[10:19:03] martin____: universa1: not sure how to find that out?
[10:20:10] universa1: martin____: it told you to generate some config for apache at the end of passenger-install-apache2-module
[10:20:56] universa1: martin____: or as it looks like you can configure it with passenger 4
[10:21:11] universa1: in the vhost, haven't used passenger in quite some time
[10:21:42] martin____: universa1: two seconds and I will check the conf
[10:22:26] martin____: universa1: (apologies for the dump) LoadModule passenger_module /Users/martin/.rbenv/versions/1.9.1-p378/lib/ruby/gems/1.9.1/gem$ PassengerRoot /Users/martin/.rbenv/versions/1.9.1-p378/lib/ruby/gems/1.9.1/gems/passenger-4.$ PassengerDefaultRuby /Users/martin/.rbenv/versions/1.9.1-p378/bin/ruby
[10:23:21] universa1: martin____: are you using a gemset for your application?
[10:23:52] martin____: universa1: another strange thing about this project, it has a gemfile.lock but no gemfile
[10:24:33] universa1: martin____: what project are you running? does stuff like script/console work?
[10:26:10] martin____: universa1: just trying to run an svn checkout of an existing rails app, script/console dies with the same errors shown in passenger
[10:26:59] universa1: martin____: why are you even trying to run such an old app?
[10:27:50] martin____: universa1: just started a new role so the app is the company's crm which was developed in that environment
[10:27:59] universa1: martin____: ok
[10:28:18] universa1: martin____: so iirc ruby 1.8.7 is the recommended version for rails 2.3
[10:28:48] universa1: martin____: so please do rvm install 1.8.7 and then rvm use 1.8.7
[10:29:08] universa1: martin____: then check the app code to see if bundler has been integrated or not
[10:29:27] universa1: martin____: http://bundler.io/rails23.html
[10:29:31] martin____: universa1: will need to do the rbenv equivalent, using that instead of rvm (blindly followed some tutorial when setting up rails)
[10:30:00] universa1: martin____: ohh ok, somehow had rvm in my mind
[10:33:12] martin____: universa1: rbenv install 1.8.7 returns a lot of versions, will any one suffice?
[10:34:03] universa1: martin____: hmm, use the one with the highest patch level
[10:37:24] martin____: universa1: hmm, it said build failed :/
[10:38:49] rvanlieshout: martin____: then read why
[10:39:38] martin____: rvanlieshout: it's not exactly a straight forward error message: Inspect or clean up the working tree at /var/folders/j5/fn13s72s23d82ds86mnhwkw80000gn/T/ruby-build.20130722113548.73885 Results logged to /var/folders/j5/fn13s72s23d82ds86mnhwkw80000gn/T/ruby-build.20130722113548.73885.log Last 10 log lines: tcltklib.c:9862: error: expected ‘;’ before ‘event’ tcltklib.c:9892: error: ‘struct dummy_TkMenu’ has no membe
[10:40:17] linusoleander: I want to be able to point a domain name to a specific namespace, is that possible?
[10:40:33] rvanlieshout: martin____: try the first result on google for that error
[10:40:49] universa1: linusoleander: what?
[10:41:59] linusoleander: universa1: I want to point example1.com to one namespace and example2.com to another inside the same app
[10:42:04] chrisan: what service do you guys use if a client wants to setup a drip email campaign?
[10:42:25] linusoleander: I tried adding a constraint, but that didn't work, I just get a 404 error
[10:42:36] universa1: linusoleander: hmm, i think adopting what the subdomain examples do, should work
[10:42:52] linusoleander: universa1: I'll gist what I've so far
[10:43:59] arefaslani: I am building a social network for students.
[10:44:14] arefaslani: I have a course model: https://gist.github.com/arefaslani/6052946
[10:44:47] arefaslani: and a test for it: https://gist.github.com/arefaslani/6052953
[10:45:08] arefaslani: and its factory: https://gist.github.com/arefaslani/6052954
[10:45:20] universa1: arefaslani: you can add multiple files to one gist!
[10:45:31] universa1: makes it easier to read for people.
[10:45:55] arefaslani: when i run tests i get this error: https://dl.dropboxusercontent.com/s/bmtjd2pxzumzn1h/Screen%20Shot%201392-04-31%20at%201.53.46%20PM.png?token_hash=AAHa32UfZ9buOOtCZbNdymKU_YlXavJQ9fsQ407dAILf6A
[10:46:13] arefaslani: universa1: I didn't know! Thanks
[10:46:13] universa1: linusoleander: https://gist.github.com/bsodmike/1369419 -- see the custom constraint class, you get the request object and then can check whcih domain :-)
[10:46:34] linusoleander: universa1: I've read that one
[10:46:49] linusoleander: universa1: https://gist.github.com/oleander/c1f9b65e5e33a544d82f
[10:46:54] linusoleander: So that I what I've so far
[10:47:09] linusoleander: Visiting test.lvh.me:3000/example2 works
[10:47:22] linusoleander: But I only want to use test.lvh.me:3000
[10:47:47] arefaslani: I think it is because factory girl return units as BigDecimal that is not integer
[10:48:05] arefaslani: but dont know how to change it
[10:48:23] universa1: arefaslani: ahve you checked what the actual value is?
[10:48:44] martin____: rvabkieshout: tried env CC=/usr/bin/gcc rbenv install 1.8.7-p374 but no luck
[10:48:56] arefaslani: universa1: Actual value? what do you mean?
[10:49:01] linusoleander: universa1: Any suggestion?
[10:49:18] rvanlieshout: martin____: i don't know what you've googled for but i'm redirected to https://github.com/sstephenson/ruby-build/issues/207
[10:49:35] universa1: arefaslani: FactoryGirl.build(:course).units.class.should == Integer
[10:49:36] arefaslani: factory girl returned value is BigDecimal
[10:50:06] linusoleander: Using a scope like this only renders the regular index page
[10:50:06] linusoleander: https://gist.github.com/oleander/8017b4e45e5622135c72
[10:50:36] universa1: linusoleander: not really, haven't used that/done anything in that direction yet :-)
[10:51:34] arefaslani: universa1: how can I force factory girl to return Integer instead of BigDecimal?
[10:51:53] martin____: rvanlieshout: thanks, will give that a try
[10:52:30] DaniG2k: guys I have a pretty simple mvc now
[10:52:39] DaniG2k: when i create a table
[10:52:40] universa1: arefaslani: by creating Integer instances and not bigdecimal
[10:53:00] universa1: arefaslani: but then i wouldn't test it that way anyways.
[10:53:10] DaniG2k: I get No route matches [POST] "/students/new"
[10:53:20] DaniG2k: i have a pretty vanilla setup so i dont understand why
[10:53:21] universa1: DaniG2k: your form is wron ;)
[10:54:41] arefaslani: universa1: You mean it is not necessary to test this part?
[10:54:53] universa1: arefaslani: and then it's rails converting the value to a bigdecimal, and not factory girl.
[10:55:13] universa1: arefaslani: no, your just testing your factory, not the actual implementation
[10:55:25] arefaslani: universa1: Understood. Thank you ;)
[10:55:26] DaniG2k: universa1: is this wrong? <%= form_for :student do |f| %>
[10:55:34] DaniG2k: do I need the url parameter as well
[10:55:36] universa1: DaniG2k: yes
[10:55:56] arefaslani: DaniG2k: it is true
[10:56:09] universa1: DaniG2k: usually i do: form_for @some_student_object
[10:56:17] martin____: rvanlieshout: it worked, thank you, I really appreciate your help
[10:56:24] universa1: pass the actual object, not a symbol
[10:56:31] arefaslani: DaniG2k: what will happen when in an html form you omit action property?
[10:56:48] DaniG2k: ah ok it worked now
[10:56:48] arefaslani: this is same thing
[10:56:51] DaniG2k: I added the object
[10:57:12] DaniG2k: so it infers the path from the object?
[10:57:14] martin____: universa1: changed the local ruby version to 1.8.7, will I update the apache conf or is there something else I should do for my next step?
[10:57:32] universa1: martin____: get the project running without passenger first
[10:57:47] universa1: martin____: and as i told you before, you should check if the project has been converted to use bundler
[10:57:57] universa1: martin____: http://bundler.io/rails23.html
[10:58:23] universa1: and with that i'm off to lunch
[11:05:07] martin____: universa1: nope, it's not converted to use bundler
[11:08:43] shambat: I have a many-to-many relation that is not working correctly, what is the best way to troubleshoot it? I am saving data successfully, but not through the association table, the saves are made as in a one-to-many ralation.
[11:25:23] universa1: shambat: show your code.
[11:25:42] universa1: martin____: so install rails 2.3.14
[11:25:50] universa1: martin____: does it use vendored/frozen gems?
[11:40:30] mauro1254: Hi guys, I developed a rails app (v. 3.2.13) accessible through two subdomains (e.g. d1.myapp.com & d2.myapp.com). d1 & d2 shares the same logic, but need to have a different presentation (layouts and partial may differ). In order to accomplish this I'd like to create the two folders in app/views/d1 & app/views/d2, but then how can I set the view folder according to the subdomain on the...
[11:40:31] mauro1254: ...AplicationController? Many thanks.
[11:41:11] doxuanhuy: anyone here know about using pow with rvm and zsh
[11:41:20] doxuanhuy: I've tried many links in google but no luck
[11:41:24] universa1: mauro1254: http://blog.socialcast.com/incremental-redesign-with-rails/
[11:41:25] kasper_: mauro1254: You can use prepend_view_path
[11:42:23] doxuanhuy: pow always tries to use system ruby but not rvm ruby
[11:44:13] mauro1254: kasper_: thx, this seems to be what I'm looking for
[11:44:25] mauro1254: universa1: I'll check the link
[11:44:30] kasper_: mauro1254: universa1s link also mentions this :)
[11:44:37] universa1: mauro1254: it's about what kasper said ;)
[11:45:26] mauro1254: Many thanks for your precious help
[11:45:47] DaniG2k: is there rails documentation on setting up STI?
[11:48:14] universa1: DaniG2k: google should find you some, but i try to avoid sti ;)
[11:48:20] kasper_: DaniG2k: Reconsider if you really need STI. It has bitten our team so much that it is not even fun.
[11:48:47] DaniG2k: kasper_: yeah thats what i thought as well
[11:48:59] DaniG2k: kasper_: but I asked on stackoverflow and people suggested I use it
[11:49:06] universa1: DaniG2k: link?
[11:49:11] DaniG2k: kasper_: http://stackoverflow.com/questions/17784404/setting-up-models-for-tutor-website
[11:49:46] universa1: DaniG2k: and again: can students also be tutors? then your sti stuff breaks down ;)
[11:50:13] DaniG2k: well, tutors can be students if they choose, and students can be tutors if they choose
[11:50:29] universa1: DaniG2k: so how should sti work then?
[11:51:12] DaniG2k: universa1: it would be users with basic info (like name, birthday, gender)
[11:51:17] DaniG2k: and student/tutor inherit from those
[11:53:10] DaniG2k: does that not make sense?
[11:53:31] universa1: DaniG2k: if a user is both, which class should it be? student or tutor?
[11:53:35] universa1: or a third class studenttutor?
[11:54:19] DaniG2k: universa1: I have in mind more of an inheritance model where there's User with two branches -> Tutor and Student.
[11:54:26] DaniG2k: so Tutor inherits from User
[11:54:30] DaniG2k: and Student inherits from User
[11:54:33] universa1: DaniG2k: and yet you said a user can be both.
[11:54:48] DaniG2k: if they so choose
[11:54:54] DaniG2k: doesn't that make sense?
[11:55:06] universa1: DaniG2k: it makes sense, but your inheritance doesn't work then.
[11:55:23] DaniG2k: the inheritance would be for basic info
[11:55:28] DaniG2k: like name, gender
[11:55:30] kasper_: Because they are either a Tutor or a Student
[11:55:35] DaniG2k: which both tutors and students would have
[11:57:29] universa1: DaniG2k: http://stackoverflow.com/questions/17784404/setting-up-models-for-tutor-website/17786987#17786987
[11:58:18] kasper_: universa1: +1
[11:58:46] DaniG2k: so you're aha
[11:58:54] DaniG2k: oops, I meant *aha
[11:59:18] DaniG2k: so there can still be inheritance of basic info despite the two models being separate?
[12:00:21] universa1: DaniG2k: the Student model would carry all the student specific information and have a reference to an user
[12:00:41] universa1: DaniG2k: for easy access one could delegate stuff from the student model to the associated user :-)
[12:00:48] DaniG2k: so....that would be single table inheritance. what I was saying before
[12:00:54] universa1: DaniG2k: no.
[12:01:25] universa1: DaniG2k: it would mean an extra table for students in addition to users.
[12:01:53] universa1: DaniG2k: class Student; belongs_to user; end; class User; has_one :student # optional; end
[12:02:16] ajkochanowicz: Is there a way to read/write attributes to a join table? E.g. in the case of putting an order on items of a group?
[12:02:33] universa1: ajkochanowicz: has many through
[12:02:58] ajkochanowicz: universa1: So if I have many contacts who can belong to many groups, what is the "through"?
[12:03:07] universa1: ajkochanowicz: http://guides.rubyonrails.org/association_basics.html#choosing-between-has-many-through-and-has-and-belongs-to-many
[12:03:13] DaniG2k: universa1: ooooh i see what you're saying. So STI would differ in that it's an actual inheritance (using the < operator) whereas what you're saying, the association is simply made with has_many and belongs_to info
[12:03:32] universa1: DaniG2k: draw it out.
[12:03:37] universa1: DaniG2k: i think that clears it up
[12:03:58] DaniG2k: yeah i should
[12:04:02] DaniG2k: *at work now* -_-
[12:04:05] ajkochanowicz: universa1: I'm familiar with the link but it's not clear to me how that solves my issue?
[12:04:11] ma_il: hello everyone. I have a problem using the PostgreSQL adapter in ActiveRecord (4.0); the create_tablespace command isn't found when running a migration. The regular commands all work fine but I cannot use the postgresql-specific functionality.
[12:04:34] universa1: ajkochanowicz: if you know what has_many through does, it answers your question
[12:04:59] ajkochanowicz: universa1: has_many through does not add attributes to a join table.
[12:05:46] universa1: ajkochanowicz: http://stackoverflow.com/questions/17784404/setting-up-models-for-tutor-website/17786987#17786987 -- see that setup
[12:06:16] universa1: ajkochanowicz: now one can add information to the join model: courseStudent like: registered_on, passed_exam, ...
[12:07:10] universa1: ajkochanowicz: jhas_many through is exactly for the case where you need attributes on the join model("table")
[12:08:05] ajkochanowicz: universa1: So in the case of my example, If I want to have a "rank" for each of my contacts in a group (users change the order they appear respective to group), what is the "through" object?
[12:09:12] universa1: ajkochanowicz: class GroupContacts; belongs_to :contact; belongs_to :group; end class Contact; has_many :group_contacts; has_many :groups, through: group_contacts; end
[12:09:33] ajkochanowicz: universa1: Sounds like I'd actually have to create a model for the join table itself. Yuk.
[12:09:48] universa1: ajkochanowicz: yes. if you want attributes on it, you need a model.
[12:09:59] ajkochanowicz: universa1: Okay, thank you. This answers my question.
[12:11:38] chase-work: what would be the most ideal way to fetch a set of cached items unique to a particular user? Apparently we can't fetch with a regexp
[12:12:03] universa1: chase-work: elaborate.
[12:12:12] universa1: chase-work: where are they cached?
[12:12:17] chase-work: universa1 using memcached
[12:12:19] universa1: how are they cached?
[12:12:39] chase-work: I cache a GUID, where the users account name is prepended
[12:13:01] universa1: chase-work: ok, i'm out ;) never used memcached. but maybe someone else can help you, now that they know it's about memcache ;)
[12:13:11] chase-work: haha, well thanks for considering!
[12:15:25] universa1: chase-work: hmm, so i quickly scanned the docs for dalli. and i think you probably need to store the information under a known key, and then retrieve it from there
[12:16:04] chase-work: so cache a single key that points to many?
[12:16:47] universa1: chase-work: would be my naive solution
[12:16:55] chase-work: universa1 i considered this as well
[12:17:05] chase-work: wasn't' sure if it was the most ideal though
[12:17:19] chase-work: I saw some references to a memcached tagging feature
[12:17:23] universa1: chase-work: so something like Cache.get_many(Cache.get("some_key_with_many_keys_inside"))
[12:18:05] universa1: yeah well, i don't really have a clue ;)
[12:18:16] chase-work: its as good as any i suppose
[12:18:21] chase-work: thanks for looking into that
[12:26:40] chase-work: universa1 fyi, my goal is to show the user how many items they have cached
[12:26:44] lessless: hi folks! my app receives external data via soap: a set of serialized objects each of which corresponds to a model in the application. this objects are related via 32bits hexadecimal uids. how to translate this in to the native rails relations - has_one, has_many, belongs_to?
[12:27:09] rvanlieshout: lessless: you tell us
[12:27:28] rvanlieshout: what's the relation between the 32bit hex uid and an object?
[12:27:50] universa1: chase-work: hmm why would they be interested in that? ;)
[12:27:54] Alkorn: Hey guys is it nessesery to regiater nick
[12:28:14] universa1: Alkorn: it looks like it isn't anymore
[12:28:21] lessless: uids are used in the same way as primary indexes in activemodel: to establish relations between objects
[12:28:45] rvanlieshout: lessless: then why not add an attribute for it?
[12:28:49] chase-work: universa1 we cache a users search, for 24 hours. the searches can be very expensive. if they want to get the data again from a search performed in the last 24 hours, they can access the results
[12:29:32] universa1: chase-work: ok, makes sense i guess ;)
[12:29:58] i42n: hey, I have the following route: match '/:slugintern' => 'podcasts#info', :as => :info . How can I make it accept /someslug&title=123123 ? How can I tell it to ignore the & attributes?
[12:30:02] chase-work: it'd definitely be useful, just trying to see if i can be done cache-only w/o added a model to the db to track counts and list of GUIDs
[12:30:40] lessless: rvanlieshout, that's ok, but is there a way to allow a has_one, has_many and belongs_to helpers to work with them?
[12:31:31] universa1: chase-work: that information can be put into the cache itself
[12:31:50] rvanlieshout: lessless: attribute != relationship
[12:31:59] universa1: so something like: user_id_cached_searches -> [search1_key, search2_key, search3_key]
[12:32:40] universa1: chase-work: would just need some housekeeping to remove expired keys
[12:36:44] lessless: rvanlieshout, so, is it possible or not?
[12:37:28] universa1: lessless: yes.
[12:37:29] maasha: how to pretty print json with to_json?
[12:38:18] maasha: pretty_generate(my_json)
[12:40:21] Criten: has anyone here used redcarpet for markdown? It looks pretty good, are there any better markdown libraries?
[12:40:38] universa1: Criten: yes, and depends.
[12:41:29] Criten: markdown seems to give you allot of filters, options, etc. What do other libraries give you?
[12:41:52] universa1: markdown is a "language"
[12:42:06] universa1: pandoc for example gives you conversion to a various number of formats
[12:42:22] Criten: ah gotcha
[12:42:31] universa1: maruku (iirc the name) is a pure ruby library
[12:43:47] DaniG2k: do you guys use railscasts?
[12:43:51] DaniG2k: is it worth it to sign up?
[12:44:02] universa1: DaniG2k: yes, yes!
[12:44:05] lessless: universa1, help me please - I can't find any documentation on how to use has_* with foreign keys :)
[12:44:08] Criten: We have an account at work. it's very good
[12:44:14] DaniG2k: I've already purchased manning's rails 4 in action...was like 30 dollars for the e-book -_-
[12:44:27] lessless: I mean custom attribute
[12:44:36] DaniG2k: and it's just $9 a month for all episodes?
[12:44:39] universa1: lessless: -> foreign_key
[12:44:44] universa1: DaniG2k: yes.
[12:44:45] Criten: DaniG2k, as far as i know, yes
[12:44:48] lessless: lol, yeah! it's in the api :)
[12:44:54] DaniG2k: I'll sign up later :P
[12:45:02] universa1: lessless: ohh http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_many -> foreign_key
[12:45:02] DaniG2k: the guy must make a ton of money
[12:45:05] lessless: will it recognize hexadecimal uids?
[12:45:22] Criten: Well he does excelent videos and his site is awesome, he deserves it : )
[12:45:47] helpa: lessless: Why don't you try it and find out for yourself?
[12:45:47] universa1: lessless: !try and also see primary_key
[12:53:32] twinkleH1od: Okay, really tricky one: I'm on server A, and i want my rails to scp to server b. Server A has an rsa key in /root/.ssh/id_rsa.pub, and this is authenticated with server B. I can log in fin with regular ssh and scp, but when i let ruby do it, it gives me an authentication-error. http://goo.gl/mdiKZU
[12:54:26] rvanlieshout: twinkleH1od: your client chooses to use the keys or not
[12:54:42] rvanlieshout: you could turn on debugging on your econd server to find out if this is the correct way to specify that
[12:54:56] rvanlieshout: econd = second
[12:55:12] rvanlieshout: is this user even able to read the key for user root?
[12:55:17] twinkleH1od: But this -is- the correct way, I've got it running fine locally.
[12:55:29] twinkleH1od: And yes, I'm running the ruby as root
[12:55:41] rvanlieshout: then just turn on debugging on your server B
[12:55:44] rvanlieshout: and find out what happens
[12:55:52] twinkleH1od: Server B is winblows/cygqin
[12:55:55] rvanlieshout: since you know this is the correct way it should be something non-ruby related
[12:56:15] twinkleH1od: Except, it's working outside of ruby, and not within :(
[12:56:35] rvanlieshout: that doesn't change the fact that sever B can do some logging
[12:56:49] universa1: twinkleH1od: then your ruby code is probably wrong.
[12:57:09] twinkleH1od: Server B is a live production build-into a lasering machine, I'd rather not fiddle with that if at all avoidable.
[12:57:22] rvanlieshout: then you're not going to find out what's wrong here
[12:59:46] universa1: twinkleH1od: and since net::scp delegates to net:ssh, and reading the documentation for it it looks like your ruby code is wrong
[13:00:04] universa1: twinkleH1od: verbose copy: :keys This specifies the list of private key files to use instead of the defaults ($HOME/.ssh/id_dsa, $HOME/.ssh2/id_dsa, $HOME/.ssh/id_rsa, and $HOME/.ssh2/id_rsa). The value of this option should be an array of strings.
[13:00:14] twinkleH1od: I just found it!
[13:00:24] twinkleH1od: It was of course not ruby related, I'm sowwi.
[13:00:30] twinkleH1od: It was me using sudo instead of sudo su
[13:11:31] lessless: ok, another question - does device have an ability to impersonate user, so a multiple people can access one "account" ?
[13:11:50] HardFu: XMLHttpRequest cannot load https://test.storage.googleapis.com/. Origin http://localhost.com:8080 is not allowed by Access-Control-Allow-Origin.
[13:12:00] HardFu: any clues how to solve this nut
[13:12:12] HardFu: I'm trying to upload a file to google cloud
[13:12:19] HardFu: and this is what I get
[13:13:33] universa1: lessless: sign_in some_user_object iirc
[13:14:01] Xeago: lessless: discourse allows impersonation and they use device if I am not mistaken
[13:14:14] Xeago: they don't allow you to un-imporsonate which is very annoying
[13:14:18] universa1: easy to build yourself.
[13:20:00] xhoy: i have an model, that has a validates_inclusion_of :format, in: %w( jpg gif png ), message: "extension %{value} is not included in the list" format,
[13:20:19] xhoy: for example, is there a way to see what options are avaible?
[13:20:29] xhoy: (the %w() list?)
[13:20:46] xhoy: in this case to make a dropdownbox )
[13:20:56] elaptics: xhoy: put the list in a constant and then reuse that where you want
[13:21:04] universa1: xhoy: Model::AllowedFormats = %w(jpg gif png)
[13:21:11] elaptics: ^ just like that :)
[13:22:58] banas: Is there an example spree app with spree_fancy on it that I can fork directly?
[13:23:28] universa1: banas: searched github?
[13:24:45] banas: universa1: Kinda, yeah but couldn't find any. :( I was trying to install my own, but I'm running into problems.
[13:25:05] sheeny: Hi all, More advice than anything.. I am making some apps in work and they need to be able to "upload" the results as such. Basically its just a simple AR type model and children (gas_assessment has many wells.) I am planning on creating a web facing app which will receive this upload and then they will be able to view the results on their too. I was just wondering what would be the best way to go about doing an upload like tha
[13:25:14] Apane: So I have a country's model, how do I populate the dropdown with various countries?
[13:26:10] elaptics: sheeny: is that a long winded way of saying you need to be able to upload a file and attach it to an AR model?
[13:26:13] universa1: Apane: select_tag :coutnry, options_for_select(Country.all, :name, :id) <-- guess coding, can't remember the exact signature of the methods.
[13:26:26] universa1: sheeny: probably some json api.
[13:26:35] sheeny: elaptics: no the app is an iOS app
[13:26:39] elaptics: Apane: there's a country_select gem which does just what you want
[13:26:50] sheeny: elaptics: which im using RubyMotion for
[13:26:58] Alkorn: guys I nneed an advice - I want to buy a book: Agile web development with rais but not sure what too do - wait for new version or buy for version 3.2
[13:27:12] Apane: elaptics, awesome!
[13:27:27] elaptics: Alkorn: the book is in beta so I'd go for that one and get started with 4
[13:28:02] Alkorn: Ш ерштл ащк ерфе ш туув цфше ешдд тщмуьиук
[13:28:12] elaptics: sheeny: you probably want to ask in a different channel then. From the rails side of things you'd probably want to use something like carrierwave or paperclip
[13:28:22] Alkorn: I think i need to wait till november for new version
[13:28:39] universa1: Alkorn: can't you get the beta version as an ebook now?
[13:29:22] Alkorn: I don't want to buy betta it is a lil bit expensive for betta
[13:29:27] universa1: sheeny: are you uploading a binary file like an image? or just some data? if the latter look up how to create a json api in rails
[13:29:36] universa1: Alkorn: you get the final version, too...
[13:29:45] sheeny: universal: just data
[13:30:08] universa1: Alkorn: and since the book is hopefully in the range of the salary of one hour...
[13:30:16] sheeny: To explain more.. the app uses pure Ruby and has an AR type model, just need to get the model data onto a web app somehow
[13:30:29] sheeny: ill look into the json api
[13:30:38] Alkorn: s 5 hours of my work (
[13:31:13] Alkorn: okey so if i'll by for example: Beta eBook + Paper Book ($54.75) what I will get?
[13:31:20] banas: universa1: Could you please help me with the spree problem?
[13:31:35] universa1: banas: nope, i'm not using spree, never have, and won't in the near future.
[13:31:54] universa1: banas: but then you're not elling us what problem you actually have, so we can't help you.
[13:37:31] Criten: What's the best way to debug a render :json call? it's giving me from /Users/zackmattor/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/activemodel-3.2.12/lib/active_model/attribute_methods.rb:407:in `method_missing'
[13:37:59] elaptics: Alkorn: you get the ebook constantly updated as they finish the book as well as the final version when it's released. You also get the final released book on paper
[13:38:19] Criten: it started when i added a has_one relation to the serializer. and if i have an object of that type i can navigate to the desired object perfectly
[13:38:44] helpa: Criten: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[13:38:44] universa1: Criten: !gist <- code + full stacktrace
[13:38:45] elaptics: Criten: look at the whole stacktrace and see which lines relate to your codebase?
[13:43:33] Criten: https://gist.github.com/Criten/6053909
[13:47:08] universa1: Criten: i'd try it out with a single instance and see if it breaks there already, no need for the rails render call stack, etc...
[13:47:36] treehau55: anyone using OrientDB in production?
[13:48:25] helpa: treehau55: Nope. No one. Ever. In the history of the world.
[13:48:25] universa1: treehau55: !anyone
[13:48:46] helpa: treehau55: 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.
[13:48:46] universa1: treehau55: !used
[13:49:05] elepedus: does anyone have any idea why cap deploy gives me permission denied errors even if I use root (with correct password!)
[13:49:28] Criten: universa1, a single instance of elemnentLight?
[13:49:30] universa1: elepedus: without seeing the actual error / cap trace -> no.
[13:49:38] universa1: Criten: yes, and in a test or console
[13:50:14] Criten: yeah.. it breaks with just one instance
[13:50:26] elepedus: it just says permission denied, please try again after cloning into '…..'
[13:51:08] universa1: Criten: so look at the stack trace, does anything pop out?
[13:51:29] universa1: elepedus: the complete output is just permission denied? i seriously doubt that.
[13:52:34] treehau55: universa1, in this case, I was literally just actually curious if anyone used it, don't necessarily have a problem
[13:52:44] treehau55: been here before, but thanks for the tips
[13:54:29] elepedus: 2013-07-22 14:44:23 executing `deploy'
[13:54:30] elepedus: * 2013-07-22 14:44:23 executing `deploy:update'
[13:54:32] elepedus: ** transaction: start
[13:54:33] elepedus: * 2013-07-22 14:44:23 executing `deploy:update_code'
[13:54:35] elepedus: executing locally: "git ls-remote ssh://root@xxx.xxx.xxx.xxx/var/www/xxx.git master"
[13:54:36] universa1: electricpants:
[13:54:36] elepedus: root@xxx.xxx.xxx.xxx's password:
[13:54:38] elepedus: command finished in 3007ms
[13:54:39] elepedus: * executing "git clone -b master --depth 1 ssh://root@xxx.xxx.xxx.xxx/var/www/xxx.git /var/www/xxx/releases/20130722134426 && cd /var/www/xxx/releases/20130722134426 && git checkout -b deploy f1de2f11fe7f8cdc0bf8f8f0d4113dd82e86d0f4 && rm -Rf /var/www/xxx/releases/20130722134426/.git && (echo f1de2f11fe7f8cdc0bf8f8f0d4113dd82e86d0f4 > /var/www/xxx/releases/20130722134426/REVISION)"
[13:54:41] universa1: oops, wrong highlight
[13:54:41] elepedus: servers: ["xxx.xxx.xxx.xxx"]
[13:54:44] elepedus: [xxx.xxx.xxx.xxx] executing command
[13:54:44] helpa: elepedus: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[13:54:44] universa1: elepedus: !gist
[13:54:45] elepedus: ** [xxx.xxx.xxx.xxx :: out] Cloning into '/var/www/xxx/releases/20130722134426'...
[13:54:47] elepedus: ** [xxx.xxx.xxx.xxx :: out]
[13:54:48] elepedus: ** [xxx.xxx.xxx.xxx :: out] root@xxx.xxx.xxx.xxx's password:
[13:54:48] universa1: stop spamming the channel.
[13:54:51] elepedus: ** [xxx.xxx.xxx.xxx :: out]
[13:54:53] elepedus: ** [xxx.xxx.xxx.xxx :: out] Permission denied, please try again.
[13:54:53] elepedus: ** root@xxx.xxx.xxx.xxx's password:
[13:55:47] universa1: Criten: so your server user can't clone the git repository. you haven't set up ssh forwarding, and your root password for root@git_host is most likely wrong.
[13:55:54] universa1: elepedus: see above
[13:55:54] alienaut: hey! i have "Message" model that have "from_user_id" and "to_user_id" attributes. somehow i want to reach messages sent by user and sent to user. is there built-in association for this should handle this by creating my own custom methods for this?
[13:56:01] universa1: Criten: sry for the wrong highlight .-)
[13:56:09] adac: Is it common to test the model attr_accessible attributes?
[13:56:21] Criten: universa1, no problem : )
[13:57:33] universa1: alienaut: class Message;scope :for_user, lambda{|user| where("from_user_id = ? OR to_user_id = ?", user}; end
[13:57:37] Criten: universa1, should I be able to do render json: object_here in console?
[13:57:56] universa1: Criten: hmm, ahven't used the serializer stuff, but it probably just calls to_json ?
[13:59:38] elepedus: sorry about that, here's the gist: https://gist.github.com/elepedus/6054035
[14:00:00] universa1: elepedus: : so your server user can't clone the git repository. you haven't set up ssh forwarding, and your root password for root@git_host is most likely wrong
[14:01:09] universa1: elepedus: ssh into the server as the deploy user and try ssh://root@xxx.xxx.xxx.xxx/var/www/project.git
[14:01:19] alienaut: universa1: then should i call them by "messages = user.message"? uhmm i think i should learn about this "scope" stuff
[14:01:22] universa1: elepedus: make that work, then capistrano should work too
[14:01:31] elepedus: the git host is the same machine, so the root user is the same
[14:01:53] universa1: alienaut: no, messages = Message.for_user(user).all
[14:01:58] flip_digits: in rails would flash messages be considered callbacks?
[14:02:26] universa1: flip_digits: nope, they are just things kept alive for the next request
[14:02:43] alienaut: universa1: thank you
[14:02:47] flip_digits: universa1: ok, than you
[14:03:31] alienaut: oh sorry about smiley message. i think it is not allowed
[14:05:12] alienaut: uhmm. some says only smiley texts is spam
[14:06:17] universa1: unless you're doing that excessively, it's ok in here imho
[14:07:54] robertjpayne: Is there any way to completely create a custom file upload handler? So that by the time it hits params it's potentially a ruby object?
[14:08:04] robertjpayne: I mean a custom ruby object*
[14:09:10] TheBlackMan: robertjpayne: you don't want it to be a file object?
[14:10:11] robertjpayne: TheBlackMan: All of my files will be going to another server.. figured I could proxy that directly in the request, though it may be smarter to do it when everything else in the request is valid instead.
[14:11:16] TheBlackMan: robertjpayne: I'm not an expert but you might have to monkey patch for that feature or change params directly in a before_filter
[14:11:56] universa1: probably some rack middleware, no clue where the file handling actually happens.
[14:11:58] robertjpayne: TheBlackMan: yea, really it may make more sense to leave it and only transfer the file when the database object is going to save
[14:14:26] elepedus: I still can't figure out why capistrano says permission denied
[14:14:41] universa1: elepedus: so if you ssh into the deploy machine
[14:14:50] universa1: and do the git clone capistrano tries, it works?
[14:15:06] elepedus: universa1: I haven't tried that
[14:15:14] elepedus: i can ssh, but I haven't tried running it
[14:15:28] universa1: elepedus: cool. please read what other people write.
[14:15:30] Criten: universa1, i ended up just adding a vertual method to the serializer to include the state name... it's all I need and it's taking to long to figure out -_-
[14:15:50] universa1: Criten: hehe :-)
[14:16:03] elepedus: universa1: I didn't realise that was what you meant
[14:16:20] Criten: From what I can see there is no reason why it shouldn't be working.. it works just like the other association there.. actually it's almost identicle :P
[14:16:22] elepedus: i just tried it and it says that it already exists and it's not an empty dir
[14:16:54] universa1: elepedus: go to /tmp and try the git command there...
[14:17:12] universa1: <universa1> elepedus: ssh into the server as the deploy user and try git clone ssh://root@xxx.xxx.xxx.xxx/var/www/project.git
[14:18:37] elepedus: universa1: it worked from /tmp
[14:22:01] elepedus: the git repo is on the same server
[14:27:52] elepedus: can somebody please explain to me how I can get permission denied errors when running as root?
[14:29:22] fryguy: elepedus: depends on what you are being denied for
[14:30:07] elepedus: some kind of git clone
[14:30:43] elepedus: from the git repo on the local machine into a folder on the same machine
[14:30:52] alienaut: universa1: see, what i wrote. now i can separate messages sent to user and sent by user. is it ok? it worked for me but i want someone experienced's opinion https://gist.github.com/alienaut/c8e2a9bf03de8bda4d3a
[14:31:02] elepedus: copied and pasted it from a failing capistrano task
[14:33:10] lessless: why devise do not setup a validation of uniqueness of the email by default?
[14:35:34] alienaut: what if you want to allow different users with same email addresses.
[14:36:34] interactionjaxsn: sounds fair to me. You don't want a something that's too opinionated.
[14:48:04] interactionjaxsn: davidcelis: good point...
[14:48:25] momomomomo: What's wrong with rails today?
[14:48:48] avgerinos: momomomomo: turbolinks :P
[14:51:41] tubbo: avgerinos: that shit is optional fool
[14:52:01] avgerinos: tubbo: I know, it was a joke
[14:52:07] davidcelis: momomomomo: aside from its inability to scale to the web? nothing, really
[14:52:10] interactionjaxsn: that's your opinion
[14:52:32] momomomomo: davidcelis: bad programming & web server set up doesn't mean that Rails can't scale
[14:52:49] helpa: web-scalable.
[14:52:49] tubbo: !spiderman
[14:52:51] davidcelis: momomomomo: hey man don't preach it to me
[14:52:54] davidcelis: momomomomo: you should tell twitter
[14:53:14] tubbo: i'm a bad programmer
[14:53:23] tubbo: that's why i use Ruby On Rails for all of my work
[14:53:32] momomomomo: I'm not preaching, just stating that it's an issue in any framework; if I write a C program that leaks memory, and blame it for not handling overflows better, that's not a C issue
[14:53:39] tubbo: one time i wrote a car in rails
[14:53:45] TheBlackMan: rails is bad and it should feel bad - rails dev
[14:53:45] tubbo: gem install ford_pinto
[14:53:55] tubbo: ford_pinto start => SEGFAULT
[14:54:11] momomomomo: Also, never said anyone was a bad programmer - I don't want to start an argument :p
[14:54:20] tubbo: momomomomo: i said that.
[14:54:32] interactionjaxsn: and i'm guilty of that
[14:54:42] tubbo: if you don't work for google or facebook you're a bad programmer imo
[14:54:43] fuzzyhorns: learning how to work with git branches, when i try to pull from a dev branch it keeps saying "Specify a user to pull from"
[14:54:48] fuzzyhorns: I dont really get what that means
[14:55:02] tubbo: and if you do work for google or facebook you're just in a cult so have fun drinking the kool-aid and going to heaven
[14:55:04] momomomomo: fuzzyhorns: maybe try #git
[14:55:06] wmoxam: Rails == VB of web programming
[14:55:14] davidcelis: fuzzyhorns: son this is #rubyonrails
[14:55:16] fuzzyhorns: momomomomo: sure ty
[14:55:19] davidcelis: fuzzyhorns: you in the wrong neighborhood
[14:55:22] wmoxam: therefore we are all VB programmers
[14:55:22] fuzzyhorns: davidcelis: lol ok
[14:55:29] TheBlackMan: tubbo: i like kool-ai
[14:55:45] tubbo: TheBlackMan: hah!
[14:55:55] tubbo: honestly me too
[14:56:03] tubbo: i wish we could turn the ocean into kool-aid just for one day
[14:56:07] interactionjaxsn: green one for me
[14:56:11] tubbo: but which flavor???
[14:56:23] fuzzyhorns: tubbo: given how salty the ocean is that'd be like making it gatorade for a day
[14:56:39] tubbo: fuzzyhorns: i think we just discovered the formula for gatorade...
[14:56:52] tubbo: evaporated seawater + kool-aid powder
[14:57:07] tubbo: interactionjaxsn: it's GREEN.
[14:57:17] tubbo: or the purple stuff
[14:58:25] alienaut: omg boys don't make me scared
[14:58:38] davidcelis: alienaut: ...
[15:00:08] Kol: i want to make a sort of search filter feature in my project, and i'm not too sure how to approach it. i want users to be able to share their searches with other users, so URL manipulation sohuld be possible, but i also want to update results on the page through javascript should the search queries be changed. any recommendations in terms of what gems/approach i sohuld use?
[15:00:43] davidcelis: have the filter read from and/or update a URL hash?
[15:01:09] Kol: that's what i was thinking as well. but i'm wondering how to make the forms from a rails standpoint
[15:01:21] davidcelis: same way you'd make any other rails form
[15:01:30] momomomomo: Kol: check out Ransack
[15:01:32] davidcelis: the bulk of your work is going to be in javascript either way
[15:01:33] alienaut: i mean my high school teacher dictate us visual studio, that's why i am here. if it is VB for web developers i am completely lost.
[15:01:53] DaniG2k: guys im having a hard time with my destroy method. it's quite plain as i'm taking it from the rails guide. Once I destroy one of my records, it redirect to that record's id
[15:01:59] DaniG2k: and tries to find the show method
[15:02:04] momomomomo: Who equated rails to vb?
[15:02:21] momomomomo: I've only done an extremely tiny, tiny, amount of vb, and didn't love it at all
[15:02:22] DaniG2k: where it cannot find the params[:id] (obviously, since the object is destroyed)
[15:02:24] tubbo: ACTION points to wmoxam 
[15:03:00] helpa: DaniG2k: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[15:03:00] momomomomo: DaniG2k: !code
[15:03:17] DaniG2k: momomomomo: i was just about to post it
[15:04:17] DaniG2k: momomomomo: https://gist.github.com/DaniG2k/6054530
[15:04:22] davidcelis: DaniG2k: sooo... redirect somewhere else...?
[15:04:37] davidcelis: "redirect_to tutor_path"
[15:04:47] davidcelis: is probably what you wanted
[15:04:57] DaniG2k: damn plurals
[15:05:03] davidcelis: how does it work
[15:05:03] heba: Hi, I'm trying to understand the implementation of ActiveResource::Base, but I just stopped in front of the method "prefix". Can somebody please explain it? https://github.com/rails/activeresource/blob/master/lib/active_resource/base.rb#L641
[15:05:21] lessless: In order to lookup by fk field should it be specified as :primary_key in the model https://gist.github.com/dirty-hippie/6054543 ?
[15:05:34] DaniG2k: davidcelis: im getting the same problem now
[15:05:34] avril14th: DaniG2k: use rake routes to get the dictionary of named paths
[15:05:51] DaniG2k: but now its looking for the params[:id] inside the destroy method
[15:05:54] DaniG2k: recordnotfound
[15:06:35] davidcelis: lessless: why are you generating two unique identifiers for User
[15:06:53] davidcelis: just choose one. auto-incrementing integer or UUID
[15:07:03] allaire: Hi, what's the advantage of using a gem like Devise for auth when has_secure_password just take a couple lines and is really simple, anybody can hint me on that? (not trying to start a war or anything here :])
[15:07:24] davidcelis: allaire: devise does more out of the box that you'd have to manually code in if you were to use has_secure_password
[15:07:29] DaniG2k: davidcelis: ah ok
[15:07:31] Xeago: allaire: devise has support for other forms of authentication/authorization
[15:07:37] DaniG2k: davidcelis: I had to restart the rails server
[15:07:43] slash_nick: allaire: devise builds lots of views and controller actions... it's pretty much the entire set of authentication behaviors
[15:07:46] davidcelis: allaire: that being said, IMO, an authentication system is so critical that i think it's best to know everything it's doing. so i always roll my own using has_secure_password anyway.
[15:07:46] Xeago: for example impersonation, authentication-providers
[15:08:21] allaire: Ok good to know. Yeah I also like to understand what's under the hood of auth, thanks guys
[15:08:51] sheeny: If i am doing a HTTP post from a different location how do I solve the CSRF issue?
[15:08:53] mikecmpbll: say I have posts with categories, and each post can only have one category where main=true, how would I define a post#main_category association that returns a single category record?
[15:09:30] lessless: davidcelis, I need to setup associations by keys supplied by outer system
[15:09:37] injekt: I have a has_one for a polymorphic association, and whenever I use joins it says it cant find the association, ie Address.belongs_to :addressable; Foo.has_one :address, as: :addressable; Foo.joins(:address) #=> error, what am I missing?
[15:10:14] avril14th: mikecmpbll: def main_category self.categories.where(:main => true).last; end ?
[15:10:21] davidcelis: Address.belongs_to :addressable, polymorphic: true
[15:10:22] lessless: these models will be deserialized from soap, and they are coming with uuids
[15:10:34] injekt: davidcelis: right that's there, I just forgot to type it in here
[15:10:44] davidcelis: should work, then
[15:12:54] sheeny: How do i bypass or correctly implement the CSRF if im doing a post from a different app?
[15:13:37] davidcelis: mikecmpbll: https://gist.github.com/davidcelis/ad4797bef8b4c5fae327
[15:14:01] kaspergrubbe: sheeny: protect_from_forgery :except => [:create]
[15:14:15] davidcelis: kaspergrubbe: sounds super secure
[15:14:44] mikecmpbll: davidcelis, avril14th: that's what I'm doing at the moment, but that's not an association so i can't use it in joins etc
[15:14:52] kaspergrubbe: Or you can use: skip_before_filter :verify_authenticity_token, :only=> :create
[15:15:00] sheeny: kaspergrubbe: thanks, not greatly secure but should do the trick, is there a way to specify the csrf so i can have some security in?
[15:15:21] davidcelis: mikecmpbll: what's not an association
[15:15:36] mikecmpbll: oops, didn't read it properly
[15:16:11] kaspergrubbe: sheeny: If you are building it like an API, you can let that API utilise authentication in some form
[15:16:33] mikecmpbll: davidcelis: how would I call that? @post.categories.main?
[15:16:42] sheeny: kaspergrubbe: its going to work as both an API and a web app
[15:17:20] mikecmpbll: problem is I want to be able to use the association as a through: part of another association
[15:19:13] kaspergrubbe: sheeny: Perhaps this will help you: http://stackoverflow.com/questions/7600347/rails-api-design-without-disabling-csrf-protection
[15:19:48] sheeny: kaspergrubbe: thank you very much
[15:21:55] davidcelis: mikecmpbll: refresh https://gist.github.com/davidcelis/ad4797bef8b4c5fae327
[15:23:11] davidcelis: errr, one more time.
[15:23:52] mikecmpbll: the relationship with categories is habtm, will that make a diff?
[15:25:40] momomomomo: You could just do a validation
[15:25:46] momomomomo: has_many 'blah'
[15:26:04] momomomomo: then write your validation method that limits that of all blah's, only one can be 'main'
[15:26:16] momomomomo: then do a scope, which returns the one 'main' blah
[15:26:19] alienaut: what is this "->"
[15:26:24] momomomomo: that's the stubby lamda
[15:26:26] avril14th: alienaut: same as "lambda"
[15:26:27] mikecmpbll: momomomomo: doesn't solve the issue of needing to use it as part of though: on another association
[15:26:42] momomomomo: mikecmpbll: not sure I understand why not?
[15:26:47] mikecmpbll: lemme gist something
[15:27:32] davidcelis: mikecmpbll: maybe you should just do some data denormalization
[15:27:44] davidcelis: shove a `primary_category_id` field on the posts table, use a belongs_to, and be done with it
[15:27:57] momomomomo: davidcelis: simple, effective
[15:28:03] davidcelis: more efficient than joining
[15:31:10] mikecmpbll: I actually simplified it, the condition for the singular relationship is based on an in memory value if that makes sense
[15:31:14] mikecmpbll: something like: https://gist.github.com/mikecmpbll/c160ff687f3e86e6efe3
[15:32:29] Syrit: Hello, in my App, when i use "validates_format_of" , that field can't be blank... what is the right syntax to add allow_blank ?
[15:32:33] omarqureshi: what is current_tenant mikecmpbll ?
[15:32:46] omarqureshi: as in, what is the code that determines that?
[15:32:51] mikecmpbll: a value derived from the subdomain
[15:33:03] omarqureshi: ok - you cannot do that safely
[15:33:04] davidcelis: mikecmpbll: D:
[15:33:11] mikecmpbll: omarqureshi: yes i can.
[15:33:52] mikecmpbll: how not? it's like any bit of data you get from an end user.
[15:34:05] mikecmpbll: it just does a lookup of Clients based on the subdomain, nothing unsafe about that.
[15:35:15] omarqureshi: doesnt that just feel a little dirty though? you're making your model code look up something where it really shouldnt have access (i.e. the subdomain info)
[15:35:19] omarqureshi: maybe im misunderstand.
[15:35:19] momomomomo: Well, say I'm tenant 3828, and I send you a parameter that I'm actually tenant 13
[15:35:38] mikecmpbll: momomomomo: okay? then you'll have to log in as tenant 13.
[15:35:40] momomomomo: what do you do to validate that? - if it's based on some authentication, then ok
[15:35:56] mikecmpbll: sessions are scoped to subdomain.
[15:36:25] elepedus: any idea why nginx would try to serve /var/www/app_folder/config/public/index.html ?
[15:36:35] mikecmpbll: it's how 85% of multi tenant applications operate, i just have a bit of complexity around users being able to be members of user_groups at multiple tenants.
[15:37:03] davidcelis: elepedus: because it's a static file that nginx found?
[15:37:25] davidcelis: elepedus: and you probably have nginx set to serve static assets if it finds them?
[15:37:49] elepedus: but it hasn't - it 404's, and nginx isn't supposed to look in config?
[15:38:00] davidcelis: just noticed that
[15:38:13] helpa: elepedus: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[15:38:13] davidcelis: elepedus: !gist your nginx conf file
[15:38:26] davidcelis: mikecmpbll: have you read the Multitenancy with Rails book
[15:38:44] omarqureshi: just pass parameters around yo
[15:38:57] omarqureshi: it avoids this threaded state bollocks
[15:38:59] mikecmpbll: davidcelis: yeah I've got it. doesn't go into much detail in scoping with IDs though, quite rightly because schemas are better but they don't fit the bill for me.
[15:39:31] davidcelis: thread safety: a thing
[15:39:52] mikecmpbll: i run it on passenger.
[15:40:04] mikecmpbll: without concurrency.
[15:40:39] Xeago: I am running rails s from an nfs mounted location
[15:40:47] Xeago: code changes are not picked up by rails s in development mode
[15:40:57] Xeago: is this expected behavior, if so, how do I work around this?
[15:41:07] davidcelis: Xeago: have you changed the app config at all?
[15:41:38] Xeago: don't know, I inherited code and a vagrant machine
[15:41:52] Xeago: config.cache_classes = false
[15:41:57] Xeago: already checked for that
[15:42:18] davidcelis: then no, it's unexpected behavior
[15:42:28] kaspergrubbe: Xeago: That is expected behavior in a production environment. Which environment are you running it in?
[15:42:37] DaniG2k: guys is this destroy method written properly? <% @person.each do |p| %> <%= link_to 'Destroy', p, method: :delete %>
[15:42:41] davidcelis: kaspergrubbe: [08:40:47] <Xeago> code changes are not picked up by rails s in development mode
[15:42:45] elepedus: https://gist.github.com/elepedus/6054875
[15:42:45] terrellt: Is there a shortcut method for 401 responses in controller specs (rspec)? So like, there's expect(response).to be_not_found, but there's no expect(response).to be_unauthorized
[15:42:54] DaniG2k: basically, can I pass in p to the destroy link?
[15:43:00] DaniG2k: or should I be passing in something else
[15:43:01] elepedus: that's my nginx.conf
[15:43:47] soahccc: DaniG2k: If you pass a model it uses #to_param which is by default the id so you should be good
[15:43:53] Xeago: davidcelis: do you know how rails s detects filesystem changes?
[15:44:09] Xeago: if so, the notification system for nfs-mounts might be unavailable/not in use
[15:44:12] DaniG2k: soahccc: ok thanks :)
[15:44:19] davidcelis: DaniG2k: Inspect the HTML and see?
[15:44:26] DaniG2k: davidcelis: good call :P
[15:45:13] kaspergrubbe: Xeago: I think rails will re-evaluate all source files for each request in development-mode. But it can be that it tries to be smart about it, and only preloads changed files, and perhaps NFS doesn't "touch" the files properly after update?
[15:45:14] lingz: Does chaining in Rails somehow prevent loading large amounts of objects into memory
[15:45:30] lingz: So User.posts.at_depth(0).class returns an ActiveRecord::Relation
[15:45:43] lingz: but because User.posts is itself an array, is that array loaded into memory?
[15:45:51] Xeago: kaspergrubbe: that along the lines what I suspect too
[15:46:17] DaniG2k: <a data-confirm="Are you sure?" data-method="delete" href="/people/2" rel="nofollow">Destroy</a>
[15:46:25] DaniG2k: yeah that looks about right :D
[15:46:31] DaniG2k: wow I'm starting to like rails
[15:46:40] DaniG2k: so friendly
[15:47:03] brendan6: I'm curious, when using a nginx + unicorn setup, would send_file tie up the unicorn worker until the request is finished?
[15:47:17] elepedus: any idea why nginx is trying to serve files from config directory? My conf file just points to plublic
[15:47:19] elepedus: https://gist.github.com/elepedus/6054875
[15:47:19] davidcelis: lingz: #posts is not an array, it's an ActiveRecord::Relation
[15:47:45] lingz: class.name returns "array" to me
[15:48:00] davidcelis: lingz: In console?
[15:48:04] lingz: davidcelis: Yeah
[15:48:19] lingz: So something like User.find(1).posts
[15:48:22] lingz: returns array
[15:48:40] davidcelis: console behavior is a bit different, but it should still be a relation
[15:48:50] kaspergrubbe: brendan6: Good question, would like to know this as well.
[15:48:52] lingz: davidcelis: So I'll trust it is a relation?
[15:49:11] davidcelis: lingz: It's a relation if you can chain other query methods on it
[15:49:19] davidcelis: lingz: Try throwing a #where on it, i guess?
[15:49:25] kaspergrubbe: brendan6: It could have something to do with http://wiki.nginx.org/X-accel
[15:49:42] Kol: if i have a feature that will return the same data in 3 ways (table/graph/list) and i want them separated by tabs, should i have 3 separate views or put them into 1 somehow? i want to be able to switch between tabs using javascript eventually
[15:49:51] lingz: davidcelis: yeah where works
[15:49:55] DaniG2k: why is it that I have link_to 'Destroy', method: :delete but then in my controller i have method destroy?
[15:50:06] elaptics: brendan6: depends if you have the x-sendfile headers set up or not
[15:50:12] DaniG2k: how is rails figuring out that method: :delete actually refers to method destroy?
[15:50:17] davidcelis: lingz: console is a little different because queries get executed when you call them
[15:50:25] lingz: davidcelis: Okay, I see - thanks
[15:50:33] davidcelis: lingz: Typically when you're running the server, a query doesn't get executed until you try to enumerate over the relation and start using records
[15:50:54] lingz: davidcelis: Okay, I see - thanks
[15:51:08] lingz: davidcelis: By the way, is there a way to use .where to find by the First Letter of the field?
[15:51:22] lingz: davidcelis: So return all results where the username starts with b, for example
[15:51:35] davidcelis: lingz: It depends on the database; postgres?
[15:51:40] brendan6: kaspergrubbe: Just found this, http://blog.kiskolabs.com/post/637725747/nginx-rails-send-file Thanks elaptics, that is also that approach being used here
[15:51:47] roughsquare: Dani: That is referring to the HTTP method, put, post, delete, update etc.
[15:51:55] lingz: davidcelis: mysql
[15:52:12] davidcelis: lingz: User.where('username LIKE "b%"')
[15:52:26] Kol: if i have a feature that will return the same data in 3 ways (table/graph/list) and i want them separated by tabs, should i have 3 separate views or put them into 1 somehow? i want to be able to switch between tabs using javascript eventually
[15:52:28] roughsquare: Dani: http://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
[15:52:37] kaspergrubbe: brendan6: Isn't that related to downloads rather than uploads?
[15:52:44] brendan6: DaniG2k: HTTP DELETE maps directory to the controller #destroy method when using resources in your routes
[15:52:50] davidcelis: lingz: you basically have to use the LIKE (ILIKE in postgres) operator, so there's not a pretty way to do that in rails. you have to use an SQL fragment
[15:53:08] kaspergrubbe: brendan6: Ah, you didn't ask about uploads, sorry
[15:53:10] lingz_: davidcelis: How does Rails handle direct SQL?
[15:53:14] brendan6: kaspergrubbe: Yes, that is what I was trying to do. For uploads, you can use the nginx upload module to proxy that
[15:53:23] lingz_: davidcelis: As in, I thought Rails abstracts away the database
[15:53:36] davidcelis: lingz: For the most part it does. But eventually, what your database wants is SQL.
[15:53:43] lingz_: davidcelis: I'm trying to build a gem, so does that mean if I use the LIKE SQL fragment, it won't work for rails projects with other types of db?
[15:53:46] brendan6: kaspergrubbe: I have that setup in my app right now actually, I can dig up the config for you and paste it into a gist if you liek
[15:53:47] kaspergrubbe: brendan6: I will look into that, thanks
[15:53:49] lingz_: davidcelis: Will it just throw an error?
[15:53:57] davidcelis: lingz_: ActiveRecord just converts chainable query methods like #where or #limit to SQL fragments that it joins together
[15:53:58] kaspergrubbe: brendan6: that would be nice
[15:54:16] davidcelis: lingz: Yes, you have to see what database adapter they're using
[15:54:33] lingz_: davidcelis: Oh that's not nice, oh it'll be fine anyhow, thanks for your help!
[15:54:35] davidcelis: lingz: `LIKE` in postgres wouldn't behave the same way because it's case sensitive
[16:00:24] Syrit: In my app, I am applying a Number format validation , it doesn't accept letters, but if i enter letters, it doesn't complain, it only assignes 0 what should i do about this?
[16:02:04] lethjakman: Syrit: I'd write a validation: http://guides.rubyonrails.org/active_record_validations.html
[16:02:11] lethjakman: you can use a regex.
[16:02:20] Syrit: i am using regex
[16:02:44] lethjakman: Syrit: what is it? it should error out from my understanding.
[16:03:04] Syrit: validates :phone_num, format: NUMBER_FORMAT, allow_blank: true
[16:03:17] Syrit: NUMBER_FORMAT = /^(\d|\s|-|\(|\))+$/
[16:03:42] roughsquare: Syrit is it putting 0 before or after your save?
[16:04:04] Syrit: after i save roughsquare
[16:04:12] roughsquare: Is your column's default a 0?
[16:04:14] davidroy: hey, I'm using Rack::StreamingProxy and getting a 400 error from nginx when sending from https to https. anyone seen this before?
[16:04:32] Syrit: i did not set a default value
[16:05:49] jonahR: To anyone interested, here is a two day free hallpass to CodeSchool, anyone feel free to use it http://go.codeschool.com/9QTYTQ
[16:05:55] mikecmpbll: Syrit: your validation isn't working at all, if you try and save text to an integer column, in mysql certainly, it will save a 0
[16:06:20] lethjakman: roughsquare: shouldn't the validation catch that before it gets to the database?
[16:06:24] Syrit: mikecmpbll i am using Mongoid
[16:06:30] mikecmpbll: Syrit: then it's probably the same.
[16:06:33] lethjakman: Syrit: that's my thinking. your validation isn't catching it.
[16:07:35] Syrit: what should i be doing in this case ?!
[16:07:51] lethjakman: Syrit: shouldn't that be square brackets? you're saying it could be \d, \s, -, a, (, a, or )
[16:08:17] mikecmpbll: Syrit: what are you trying to validate?
[16:08:20] Kol: if i have a feature that will return the same data in 3 ways (table/graph/list) and i want them separated by tabs, should i have 3 separate views or put them into 1 somehow? i want to be able to switch between tabs using javascript eventually
[16:08:26] lethjakman: Syrit: /^[\d\s-\(\)]+$/
[16:08:34] Syrit: phone number mikecmpbll
[16:08:40] Syrit: i will try that lethjakman
[16:08:41] ramzay: Could someone help me? i can't install RVM, also site https://rvm.beginrescueend.com/install/rvm is not work. Is there is a reson that dont work % bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
[16:08:58] mikecmpbll: oh, i see, so your not validating a number
[16:09:09] katherinem13: I've got a situation where I've got a single view that I'd like to use as a partial in some situations and like a normal view in other situations. How should I approach this problem?
[16:09:19] lethjakman: Syrit: lemme know.
[16:09:29] mikecmpbll: in no respect are phone numbers to be considered numbers, by any system. what column type are you using?
[16:09:53] Syrit: mikecmpbll Integer
[16:10:22] lethjakman: Syrit: ahhh an integer would break with anything but a number in it.
[16:10:23] mikecmpbll: does your phone number have dashes in? or am i just not reading that regex properly.
[16:10:32] lethjakman: you do want a string for this.
[16:10:47] Syrit: oh my *blushing*
[16:11:01] kenyabob: I have a somewhat complicated set on circumstances in which I should display a certain block of content on my site. its based off the controller and method we are in. I don't want to have this confusing block of if/else in my layout, so I can create a helper that can process the complicated logic and just return whether the content should be visible?
[16:11:02] lethjakman: lol it happens. if you don't know databases gotchas like that can be really confusing.
[16:11:48] katherinem13: Is it bad to have a partial and a non-partial view with the same name?
[16:12:10] Syrit: it worked after changing the field type to String
[16:12:16] mikecmpbll: presumably you don't mean /exactly/ the same name.
[16:12:26] Syrit: did not work with square brackets lethjakman :P
[16:12:38] Syrit: Thank you guys
[16:12:38] lethjakman: interesting. maybe I just don't know how ruby regex works very well.
[16:12:41] katherinem13: mikecmpbll: I mean like, '_aname.html.erb' and 'aname.html.erb'.
[16:12:52] mikecmpbll: katherinem13: nothing wrong with it as far as I'm aware.
[16:13:06] mikecmpbll: could be wrong though.
[16:13:30] mikecmpbll: katherinem13: what's the use case? I can't think of any time i'd actually want to do that.
[16:14:28] katherinem13: mikecmpbll: I have a piece of content that I need to render like a partial sometime (passing locals, etc) and like a normal view at other, so I'm trying to figure out how to achieve that.
[16:15:27] Kol: 5th time's a charm? ._.
[16:15:32] katherinem13: mikecmpbll: So I'm thinking of having the partial '_aname', and then a regular view 'aname' that just contains "render partial: 'aname', locals: params ".
[16:16:47] lingz_: so User.where("name like 'a%'") works
[16:16:57] lingz_: but User.where("name like '[ab]%'") doesn't work
[16:16:59] lingz_: any ideas?
[16:17:19] pontiki: katherinem13: that will work
[16:17:26] pontiki: i've done it a time or two
[16:17:50] pontiki: lingz_: mysql "like" does not use regexp
[16:17:50] katherinem13: pontiki: okay, cool. if you didn't find a better way eithr I guess I'll assume that's the best way of doing it.
[16:18:01] pontiki: nah, i didn't try that hard :)
[16:18:06] lingz_: pontiki: Oh, how would I do a group match like that then?
[16:18:16] lingz_: pontiki: Or what would be similar?
[16:18:29] pontiki: lingz_: i'd have to delve into it; i've not tried it before
[16:18:57] pontiki: lingz_: generally all i've done when doing mysql likes is find the bit that is unchanging
[16:19:07] pontiki: and match on that with "%"
[16:19:17] mjc_: how does rails' routing stuff create the named parameters it uses in the url patterns? like "/foo/:id-:name". I like that method of interpolating strings and want to use something liek that elsewhere
[16:19:39] lingz_: pontiki: Oh you can just use REGEXP operator
[16:19:55] xhoy: I like to do: order.@active_tab[:sub_grouped_by][:field], :format => :short , where active_tab[:] is the field i needed...
[16:20:06] xhoy: but ofcourse that doesn't work but what would be a fix ?
[16:20:07] pontiki: well then!
[16:20:10] pontiki: ok, gotta run
[16:20:41] mjc_: having trouble finding it in actiondispatch
[16:21:14] lingz_: In a gem, is there a way to test the type of database they are using?
[16:22:29] pontiki: you could probably query ActiveRecord somehow
[16:22:40] injekt: lingz_: ActiveRecord::Base.connection.adapter_name
[16:24:57] elaptics: xhoy: I don't understand what you're asking to do
[16:25:25] Kol: 5th time's a charm? ._.
[16:25:28] Kol: if i have a feature that will return the same data in 3 ways (table/graph/list) and i want them separated by tabs, should i have 3 separate views or put them into 1 somehow? i want to be able to switch between tabs using javascript eventually
[16:26:18] injekt: Kol: same view, separate partials
[16:26:51] interactionjaxsn: Kol: different instance variables?
[16:26:51] Kol: err i don't know what partials are D:
[16:27:06] interactionjaxsn: Kol: http://guides.rubyonrails.org/layouts_and_rendering.html
[16:27:19] Kol: so i don't need a gem like tabulous?
[16:27:49] injekt: this is pretty basic stuff
[16:29:43] interactionjaxsn: tabulous does look interesting. i like the separation of concern
[16:30:20] Kol: yeah it seemed pretty straightforward
[16:30:33] Kol: but i didn't know if i was gonna be able to do much more with it
[16:31:57] asoliman: hey, if i am using a .each loop in rails, iterating through some objects, can i somehow also keep count of how many iterations i have done?
[16:32:07] asoliman: without the normal create a variable and increment it manually
[16:32:35] interactionjaxsn: .each_with_index
[16:32:45] asoliman: interactionjaxsn: thank you!
[16:33:04] pontiki: that's not *quite* what you asked for
[16:33:05] interactionjaxsn: asoliman: http://ruby-doc.org/core-2.0/Enumerable.html#method-i-each_with_index
[16:33:27] asoliman: interactionjaxsn: perfect, that is just what i needed. Thank you!
[16:33:28] interactionjaxsn: pontiki: good catch...
[16:34:30] interactionjaxsn: pontiki: for the most part i assume people don't know what they want so i give the closest thing I can think of. they'll come back if it doesn't match
[16:35:08] rhizome: the simplest thing that could possibly work
[16:35:59] lingz_: after a User.where() call, is it necessary to convert it to an array
[16:36:03] lingz_: with .all
[16:36:24] injekt: lingz_: no
[16:36:32] injekt: lingz_: and in rails 4 that does not return an Array
[16:36:53] |PiP|`: how can i enable query logging for a rails 2.3 app? im debugging an old application and want to see the database queries in teh logs.
[16:38:01] lingz_: injekt: Why do they do @users = User.all
[16:38:16] lingz_: injekt: So I can just do @users = User.where()
[16:38:21] lingz_: injekt: and that's fine?
[16:38:25] injekt: lingz_: that doesn't make much sense
[16:38:57] injekt: lingz_: You want User.all or User.scoped; the first returns an Array the second returns a relation and does not execute the query until you call .all .each or a couple of other methods
[16:38:59] interactionjaxsn: lingz_: that returns an empty relation.
[16:39:16] rhizome: who is "they"?
[16:39:36] lingz_: injekt: Oh I see, thanks, I understand the query after .each now
[16:39:55] rhizome: |PiP|`: in dev, they should be there already
[16:41:31] Catbuntu: Is there any wiki or something with some recommended RoR hostings?
[16:42:53] fuzzyhorns: i dont suppose there is already a gem to turn routes into google analytics goals is there?
[16:45:18] nivoc: Hi is there a way to a spesific-fixtures into development?
[16:45:31] nivoc: specific fixture file
[16:48:25] digitalcake: Running into a wall with ActiveRecord::Relation. I have a need to make scopes that uses methods vs attributes of the object to order the ActiveRecord::Relation
[16:49:13] digitalcake: I understand that idea wont work, but I not really sure the best way to design this
[16:49:46] rhizome: http://stackoverflow.com/questions/4055799/how-do-you-order-by-a-custom-model-method-that-has-no-attribute-in-sql
[16:50:09] digitalcake: thanks rhizome will read
[16:51:06] digitalcake: ok so I have not been 100% clear.
[16:51:33] digitalcake: this ActiveRecord::Relation has kaminari at the end of it.
[16:51:51] digitalcake: so if I do a sort it will only be on the subset
[16:52:42] digitalcake: and that there lies the problem, cant order with sql if there is no attributes to select but the sort needs to happen before the limit
[16:53:18] rhizome: either you cache the whole thing, or you figure out why you're doing this in the first place
[16:54:04] rhizome: i lean toward the latter
[16:54:28] goleldar: how do you test if a piece of code is thread safe?
[16:54:44] rhizome: very carefully?
[16:55:01] davidcelis: that's an excellent question
[16:55:10] davidcelis: show it to mike perham
[16:55:56] youl: I want to override link_to with always the same href
[16:56:15] elaptics: digitalcake: you can use kaminari with a plain array so that could be your fallback if you don't find a satisfactory solution with sql
[16:56:45] youl: davidcelis: ... I gist
[16:57:03] elaptics: davidcelis: I think you meant "WAT!"
[16:57:58] youl: https://gist.github.com/breinz/6055550
[16:58:11] youl: how to take care of the block
[16:58:37] ziyadb: https://gist.github.com/ziyadbasheer/195a4d42c27f6d357098 <- very simple create action, the channel isn't being created. Why?
[16:58:46] elaptics: youl: you mean you want to pass the block through?
[16:59:09] youl: if I pass a block in a view, how to render it correctly ?
[17:01:03] elaptics: youl: same way as link_to/content_tag does it. Check the source, but ultimately comes down to "if block_given?"
[17:03:21] Aristata: I am having a lot of trouble getting a rake task to execute in the correct environment. I have tried each of these commands: http://pastie.org/8164615 but it still spins up in development. I have also put Rails.env = 'resque' in the resque namespace of my task, but it sets every single rake task I have to that environment if I do it that way, I can't set it inside the task itself because I need it to boot in the 'resque' env to connect to the right se
[17:04:15] youl: elaptics: thanks I found my anwer in link_to source :)
[17:04:28] youl: just use content_tag(:a, ...)
[17:04:34] youl: elaptics++
[17:10:19] soahccc: ACTION just noticed that he just need his left hand to type "server address"
[17:10:34] davidcelis: youl: Wait why the helper? If the href is always the same, why not just put an <a> tag directly in the template
[17:11:34] youl: davidcelis: to avoid to write "javascript:void(0)" each time
[17:11:59] davidcelis: youl: why do you need the javascript:void(0)
[17:12:57] youl: I need a link who does nothing but calling a javascript on his onclick attr
[17:13:53] davidcelis: people still do that?
[17:14:04] davidcelis: Just bind your click event in a .js file that you include
[17:14:23] davidcelis: the href can just be "#"
[17:14:23] elaptics: youl: better to stick a data attribute on it and then bind it in your js once to preventDefault()
[17:14:26] davidcelis: it doesn't even need to be a link
[17:15:24] youl: ok thanks for the tip :)
[17:17:42] youl: but I wanted to avoid the # in url, does preventDefault() do that ?
[17:18:08] youl: .. ill test anyway
[17:28:23] mdhopkins: what's the standard solution for ajax file upload for forms right now? i use carrierwave
[17:28:28] mdhopkins: elsewhere in the application.
[17:29:07] terrellt: mdhopkins: Carrierwave + something like jquery.upload?
[17:31:56] lingz_: I want to send a custom method to ActiveRecord::Relation
[17:32:01] lingz_: How do I do this?
[17:32:03] mdhopkins: terrellt: yeah, I suppose something like this would work. Just didn't want to reduplicate if something more off-the-shelf existed. https://github.com/n0ne/Rails-Carrierwave-jQuery-File-Upload/blob/master/app/controllers/pictures_controller.rb
[17:32:09] lingz_: In a gem (maybe using railties?)
[17:32:57] davidcelis: lingz_: whats it do
[17:33:12] lingz_: davidcelis: It uses .where to build a pagination table
[17:33:30] davidcelis: pagination... table?
[17:33:42] davidcelis: like, an HTML table element...?
[17:34:24] lingz_: Not like an HTML Table
[17:34:34] lingz_: I've written a method that just does .where queries to build pagination
[17:34:44] lingz_: and would like to add it to ActiveRecord from my gem
[17:34:45] terrellt: lingz_: https://github.com/amatsuda/kaminari Kaminari does the same thing you're trying to do - you're probably looking for lib/railtie.rb and lib/hooks.rb
[17:35:05] davidcelis: lingz_: mind if i ask why? there are a few gems that already create pagination methods
[17:35:05] terrellt: Bah, lib/kaminari/railtie.rb and lib/kaminari/hooks.rb
[17:36:14] lingz_: davidcelis: Couldn't find one that needed the specifications for my project, so thought I'd package it in a gem as a learning exercise
[17:36:43] davidcelis: anyway, yes, you'll probably want a railtie
[17:36:55] lingz_: Currently my line looks like
[17:37:00] lingz_: ActiveRecord::Relation.send :include, ControllerHelpers
[17:37:15] lingz_: but it implants the method into ActiveRecord::Relation::GemName::ControllerHelper
[17:37:20] davidcelis: are you sure ActiveRecord::Relation is where you wanna put it?
[17:37:39] lingz_: davidcelis: yeah, I want to run .where queries on relations
[17:38:01] davidcelis: ActiveRecord::QueryMethods seems like it might be a better spot? though it may be an issue if that's already been included before your method gets added to it
[17:39:45] lingz_: I want it to be able to be used like - User.alpha_paginate
[17:40:07] davidcelis: Right; I suggested ActiveRecord::QueryMethods because that is where most of the chainable query methods are defined
[17:41:03] davidcelis: But it'd end up being a problem if it's included into ActiveRecord::Relation before you add your method to it. So Relation may be a better spot, I guess
[17:41:57] jarray52: When using the postgresql adapter (pg gem), what does the schema_search_path do? Specifying schemas here doesn't seem to be necessary for models to work. They work fine with schemas outside this search path.
[17:42:11] lingz_: davidcelis: So how do I extend my method into ActiveRecord::Relation?
[17:42:19] lingz_: do I use extend ActiveRecord?
[17:42:27] davidcelis: with a railtie, you mean?
[17:43:32] lingz_: davidcelis: Yup
[17:43:50] RubyPanther: jarray52: if you don't use postgres schemas, just ignore it. things are in a "public" schema by default.
[17:44:25] pallavi: How to upgrade to rails 4 ?
[17:44:36] jarray52: RubyPanther: I am using postgres schemas.
[17:44:39] RubyPanther: The only rails-related use to schema_search_path I've seen is using it with postgis to keep the postgis tables in a different schema so that they don't get exported to schema.rb
[17:45:05] davidcelis: lingz_: My guess is in a block like: ActiveSupport.on_load(:active_record) { ... }
[17:45:09] RubyPanther: jarray52: then search path does the same as search path in the shell or anywhere :)
[17:45:12] kaspergrubbe: pallavi: http://railscasts.com/episodes/415-upgrading-to-rails-4
[17:45:41] davidcelis: kaspergrubbe: That's for RC1
[17:46:40] kaspergrubbe: davidcelis: did they switch procedure between RC1 and the final version?
[17:46:40] pallavi: I saw that . I'm new to rails , just starting now . I dont want to upgrade my existing rails project to rails 4
[17:46:50] pallavi: I want start with rails 4
[17:47:01] pallavi: How do I set it to default
[17:47:19] davidcelis: pallavi: just... gem update rails?
[17:47:51] pallavi: running it
[17:49:16] pallavi: pallavi@pallavi-work:~/app-gen$ rails -v
[17:49:17] pallavi: Rails 3.2.13
[17:49:17] pallavi: pallavi@pallavi-work:~/app-gen$ gem update rails
[17:49:17] pallavi: Updating installed gems
[17:49:17] pallavi: Nothing to update
[17:49:18] pallavi: pallavi@pallavi-work:~/app-gen$ rails -v
[17:49:20] pallavi: Rails 3.2.13
[17:49:22] pallavi: pallavi@pallavi-work:~/app-gen$ ^C
[17:49:24] pallavi: pallavi@pallavi-work:~/app-gen$
[17:49:34] kaspergrubbe: do you have a gemfile in that dir?
[17:50:39] pallavi: Oh I get it
[17:50:55] pallavi: outside that dir it show rails4
[17:51:20] kaspergrubbe: You can also call it directly: rails _4.0.0_ --version
[17:51:48] pallavi: So now when I create new rails app , Is it going to be rails4 app ?
[17:52:26] kaspergrubbe: if that is what rails -v return, yes.
[17:52:27] |PiP|`: rhizome: i wanted to enable for production
[17:52:41] pallavi: kaspergrubbe, Thank you :)
[17:52:48] |PiP|`: rhizome: some queries are taking a long time and im wondering which one
[18:01:19] davidcelis: |PiP|`: you could use something like new relic
[18:03:14] kaspergrubbe: |PiP|`: You could try to use bullet locally and see if that warns you about any problems: https://github.com/flyerhzm/bullet
[18:03:42] ziyadb: https://gist.github.com/ziyadbasheer/195a4d42c27f6d357098 <- very simple create action, the channel isn't being created. Why?
[18:04:46] kaspergrubbe: ziyadb: Try to see if @channel.errors contains anything
[18:06:28] kaspergrubbe: and you could call @channel.save! instead of @channel.save to throw an exception with the issues met while trying to save
[18:06:41] ziyadb: kaspergrubbe: ah, that sounds better.
[18:07:02] ziyadb: Oh, I also need to check if I have any model validations that might be preventing it from saving.
[18:07:39] kaspergrubbe: ziyadb: yep, @channel.errors will contain a list of those
[18:08:12] ziyadb: Perfect, let's see...
[18:14:34] ziyadb: kaspergrubbe: yup, validations.
[18:15:15] ziyadb: Though that presents an interesting issue, since one of the parameters' uniqueness is validated, I can't pass in an empty string or whatever.
[18:15:43] ziyadb: I suppose I could generate some value based on unique user parameters..
[18:16:29] lingz_: What is the type of User
[18:16:49] lingz_: User.posts is ActiveRecord::Relation, but User.class.name just gives "Class" in console
[18:17:10] terrellt: ziyadb: I'm confused. What are you trying to do here?
[18:17:51] ziyadb: terrellt: I'm trying to generate a channel with a unique title for each user.
[18:18:27] terrellt: ziyadb: If usernames are unique then set the default to the user who owns it?
[18:19:12] ziyadb: terrellt: negative, no usernames, email addresses perhaps.
[18:19:54] terrellt: ziyadb: Then you can either generate random names or do an MD5 hash of their email.
[18:20:41] ziyadb: terrellt: or I could suspend the channel title uniqueness validation. Pondering whether that would have any undesirable implications.
[18:25:25] |PiP|`: whats the best way to do log management across 4 servers?
[18:25:33] |PiP|`: i want a centralized place for my production logs
[18:26:18] jarray52: When doing a rake db:schema:dump on a postgres database that uses schemas, the generated schema.rb file seems to remove the schema information for each table. Is there a way to preserve this information?
[18:27:29] katherinem13: When I print a page (i.e., to a paper printer), does Rails send the usual CSS files that would be on that page, or do I have to do something special to get CSS on my print?
[18:27:48] jarray52: In other words, all the tables of all schemas listed in the schema_search_path in database.yml end up in the same schema.
[18:35:09] eka: hi there, I need to make a cron job that will run a task periodically, that task should access all the models, etc… what is best a rake task or a rails command?
[18:36:17] ameech: eka: You could try the whenever gem
[18:36:25] ameech: https://github.com/javan/whenever
[18:36:39] dopie: got a quick question this is weird
[18:36:44] dopie: <%= link_to('Administration', admin_path) %>
[18:36:55] eka: ameech: looking
[18:37:02] dopie: i have defined index , and show in the admin controller
[18:38:17] eka: ameech: so that will generate a cron line for me? I mean, I set the schedule.rb with my things, and then the whenever command will generate an output for that?
[18:38:32] dopie: https://gist.github.com/staycreativedesign/6056376
[18:38:37] dopie: why isnt my link_to workoing?!
[18:39:10] ameech: eka: I've only played with it shortly and I don't think it will create a line in the crontab, but what are you trying to do?
[18:39:21] eka: ameech: thanks… there is a railscasts on it… will look at it…
[18:39:26] rhizome: dopie: admin_path requires an id
[18:39:31] ameech: eka: Yep, I should've sent that along with it
[18:39:48] eka: ameech: run some periodic task… I think whenever it's the thing… thanks
[18:39:56] dopie: rhizome, oooh ok
[18:40:01] ameech: eka: No problem!
[18:40:06] dopie: well how do i call just the admin index ?!
[18:40:17] jarray52: admin_index_path
[18:40:25] ameech: what jarray52 said
[18:41:32] rhizome: dopie: seriously? look at your own gist.
[18:41:50] eka: ameech: I see what whenever does… but my question is… should i do a rake task myself or use a runner… my task is a web scraper that puts things into DB so I don't think that a runner is enough…
[18:42:01] jarray52: When doing a rake db:schema: dump on a postgres database that uses schemas(table namespaces), the generated schema.rb file dumps all tables for schemas(table namespaces) listed in the schema_search_path, but it removes the schema(table namespace) information for each table. Is there a way to preserve this information?
[18:42:05] eka: ameech: then with my 'task' I use whenever
[18:42:13] chase-work: I just build a gem, added it to the gem file, and installed the gem, then ran bundle install. everything is happy. if I try to do any config options in the environment/*.rb files, I get an undefined method error when running rails s or rails c
[18:42:45] dopie: admin_index
[18:42:59] jarray52: dopie: You need _path at the end.
[18:43:22] ameech: eka: not knowing how your application works, I would probably just call the rake task with whenever
[18:44:13] jarred: What might cause generating URLs to implicit controller actions (i.e no method defined in the controller, but a view for that exists) to redirect to another (broken) route? E.g. you have a FAQ page with many sections and you don't define a method for every view in the controller. So, when you go to "/faq/tutorial" it redirects to "broken_route?controller=faqs&action=tutorial" when it used to just go there?
[18:44:25] eka: ameech: ok… so I should do a rake task…
[18:44:38] eka: ameech: from a rake task can I access all the rails env?
[18:44:48] eka: yes I think
[18:45:53] ameech: eka: Actually looks like you can use either, might all depend on what you are doing as well. If you are only calling one method probably use runner, if you are calling multiple use rake task
[18:46:42] bricker: jarred: gist your routes
[18:46:53] bricker: rake routes I mean
[18:47:04] bricker: and the file
[18:47:45] dopie: jarray52, stupid me
[18:47:51] dopie: im extremely rusty
[18:47:56] kalleth: oh god running bundle update on a project that hasn't had its gems updated in 6 months
[18:48:00] kalleth: how painful is this going to be 1-10
[18:48:16] kalleth: THATS NOT ON A SCALE OF 1-10!
[18:48:21] eka: ameech: right… I'm calling multiple, so I will do a rake task and then use whenever. thanks
[18:48:58] dimensiOn: that's gonna be epic
[18:49:00] kalleth: well, it's not bombed out when i booted it
[18:49:10] kalleth: and everything works
[18:49:16] kalleth: ('everything' *chortle*)
[18:49:21] kalleth: i don't have a test suite so i can't actually test :p
[18:49:21] ameech: eka: No problem
[18:49:28] adizam: bundle update on every gem kalleth?
[18:49:35] kalleth: yep, adizam
[18:49:43] kalleth: i tend to try it, see if anything breaks, if so revert
[18:49:44] adizam: Wouldn't it be better to slowly update each gem/dependency?
[18:49:58] kalleth: bundler seems to be reasonably intelligent about not updating majors
[18:50:04] kalleth: and gem authors are reasonably intelligent about not breaking API's
[18:50:15] adizam: I agree with the first statement, not the second
[18:50:31] kalleth: in my experience which may vary from your experience
[18:50:37] kalleth: i've been slacking on my rails dev recently
[18:59:39] Catbuntu: Question question, when I deploy a RoR application to a server, how am I supposed to "deploy the database" too?
[18:59:59] Catbuntu: I mean if I use Passenger at the server do I have to set up a database too?
[19:01:45] kaspergrubbe: Catbuntu: Where is your RoR going to store its information without a database+
[19:01:57] joelteon: in the filesystem of course
[19:02:07] pontiki: YAML::Store?
[19:02:26] krang: Hey all. I want to authenticate communication between an app running in my browser and a webserver running on localhost, is it good enough to generate a secret on the webserver side (it'll be embedded in a desktop app) and have the user paste it into the webapp, which then stores it in localstorage and includes it a required parameter in every request to the desktop app/webserver's API? I am assuming no rogue app
[19:02:26] krang: s on the machine itself for now.
[19:02:45] eka: how to test security on an app that let user import/export to YAML… my concern it's the import part…
[19:02:53] kalleth: joelteon: in a tempfile in /tmp in rot13
[19:03:13] kalleth: think of the benchmarks
[19:03:16] eka: or in /dev/null ;)
[19:03:18] kalleth: it'll be much faster than mongodb
[19:03:24] eka: fastest DB on earth
[19:03:24] kalleth: and just as reliable across reboots
[19:03:53] joelteon: it's a WRMO database
[19:04:07] Catbuntu: kaspergrubbe, *locally* you don't need to care about databases.
[19:04:16] Catbuntu: I mean it uses SQLite as far as I know.
[19:04:29] Catbuntu: So when you deploy it, it's as simple as using the pg gem or do you have to do more system-wide things?
[19:04:44] Rubba: so if i have a feature that displays data in 3 ways (table/graph/list), and i want to switch between the views using tabs, should i have 1 controller and 3 views and use render to choose which view to render?
[19:04:56] mfilipe: someone here uses dragonfly gem? I'm working in a project that use it but I think that it is generating strange url that my localhost instance can't find :(
[19:04:58] kaspergrubbe: Catbuntu: You need to add the pg gem, and have a postgres server running
[19:05:19] Catbuntu: Isn't postgres a Heroku thing?
[19:05:28] mfilipe: I wanna get the images from the production environment and put on my local instance
[19:05:37] davidcelis: Catbuntu: You have to have the database installed, of course
[19:05:45] davidcelis: Catbuntu: and create the production database
[19:05:47] pontiki: hmm, rubba and/or kol never gets an answer to their question. same question asked 5 times
[19:05:50] davidcelis: database server installed*
[19:06:00] Catbuntu: so the pg gem is more like a driver between Rails and the actual database?
[19:06:10] davidcelis: that's exactly correct
[19:06:45] davidcelis: that'd be the easiest way to do it
[19:06:48] kalleth: Rubba: the controller should prepare the data for the view, and in all 3 cases the same data is being displayed
[19:06:56] kalleth: just in a different manner
[19:07:02] kaldrenon: Catbuntu: Worth noting, 'pg' is only the driver if you configure the app to use PostgreSQL. There are other gems/drivers depending on the database.
[19:07:03] kalleth: 1 controller, 3 views :)
[19:07:06] Rubba: yeah, but the data might be slightly different in the list view
[19:07:09] pontiki: i read that answer earlier, too
[19:07:17] kalleth: Rubba: it depends how 'slightly different'
[19:07:27] kalleth: you could use 1 controller, 3 presenters, 3 views :)
[19:07:33] kaldrenon: Catbuntu: I don't know what they are though, because I've only use PostgresSQL with Rails
[19:07:33] kalleth: but i don't fully understand presenters myself yet
[19:07:36] Catbuntu: Oh my god this is so complicated haha
[19:07:41] Rubba: i've never even heard of presenters :d
[19:07:51] Catbuntu: I'm following the RailsTutorial thing but I can't even understand what I do.
[19:07:58] Rubba: my data is ticket counts, the graph and table display the counts, and the list will display the individual ticktes
[19:08:00] kalleth: Rubba: they're a thing that not very many people use
[19:08:02] Catbuntu: It seems to make things too difficult and not worth it :(
[19:08:06] kaldrenon: Catbuntu: It's not too bad really, it just takes a little bit to learn one's way around.
[19:08:09] Catbuntu: But lots of people love Rails...
[19:08:21] Catbuntu: kaldrenon, would you recommend me some book or something to learn it?
[19:08:29] Catbuntu: Basically the concepts
[19:08:30] asoliman: if i am using a .each and passing in a grade object and want to use it to create a form_for, what would i use as my object? https://gist.github.com/abdallahsoliman/a96c4bfcb3494902170e
[19:08:48] kalleth: http://blog.jayfields.com/2007/03/rails-presenter-pattern.html Rubba
[19:08:53] kalleth: but i wouldn't worry about that now :)
[19:09:02] Rubba: yeah i'm kinda scared to venture into new territory
[19:09:03] kalleth: just slightly massage the data in the 3rd view that needs to change it a bit
[19:09:06] adizam: is projected_grades an array or a hash of objects?
[19:09:17] Rubba: btw kalleth if i'm using tabs with 3 views, is it easy to have them switch with javascript then?
[19:09:23] kalleth: Rubba: i'd use pjax
[19:09:36] kaldrenon: Catbuntu: I'm not sure. The Rails Guides are very good ( http://guides.rubyonrails.org/v3.2.13/ ) but I learned a lot of what I know (which isn't a ton, I'm new to rails) by just having tasks to accomplish and searching Google until I found and answer. :P
[19:09:37] kalleth: or render all 3 at load time and then just have 2 hidden depending on the size of your dataset
[19:09:42] kalleth: up to you :)
[19:09:45] asoliman: adizam: its returned from an active record query
[19:09:46] kalleth: but yes, in short, it's very simple
[19:10:04] Rubba: alright, thanks. i was having a look at jquery ui but i wasn't sure how i'd integrate that with rails
[19:10:16] kalleth: ugh, jquery ui
[19:10:27] kaldrenon: Catbuntu: Railscasts.com is very helpful for finding samples of specific concepts.
[19:10:31] adizam: what is the point of passing each_with_index.. don't see you accessing the index at all
[19:10:56] Catbuntu: Problem is I don't even know what to search lol
[19:11:12] asoliman: adizam: its an array of objects, i utilized it once in the line <%= "active" if index == 0 %>
[19:11:34] krang: Does anyone have any recommendations for communicating securely between a browser app and a rails server running locally? I'm not sure what my options are.
[19:11:44] adizam: Was on the wrong gist on that second question, sorry :)
[19:11:47] asoliman: adizam: for the bootstrap carousel i have to give the first item the class active, the rest do not get it
[19:12:10] adizam: krang: create a restful api in your rails app and have the browser app consume it (use it)
[19:12:19] dobry-den: I have Rails.root + '/lib' on my autoload_paths but my rake task (loads :environment) can't see the classes I declared in /lib.
[19:12:21] asoliman: im just unsure what i need to pass in form_for()
[19:12:55] Rubba: kalleth dyou think i'll easily be able to implement tab-switching later on or do i have to worry about it now while designing the app?
[19:13:04] krang: adizam: My problem is securing the API from rogue webapps. I'm thinking of a shared secret which must be included in each request as a parameter.
[19:13:21] asoliman: its basically just a form to update the grade object, but i cant pass in "grade" or i get an error
[19:13:40] adizam: krang: yes, restful api with an api key for authentication. only the browser app & the server will know the app key. ignore other requests. just google "rails restful api" for tips. its pretty basic to implement
[19:14:06] kaldrenon: Catbuntu: It's very daunting if you look at it all at once. Break it up into the tiniest pieces you can. "I want to get the server to start", "I want to get a page to show when I browse to a certain location", "I want to create a really basic model", etc
[19:14:51] kalleth: Rubba: it depends on how much data you want each bit to display. But honestly, it's pretty simple.
[19:15:03] krang: adizam: Cool, glad that sounds about right. To complicate slightly: if I assume there may be a rogue local app which may spoof my API, and that my own server on localhost has secure storage, is something like CHAP to get a session token the best way?
[19:15:04] kalleth: again, short answer, yes its simple to implement if you have any knowledge of JS whatsoever
[19:15:27] Rubba: i have barely any :D but i've got programming experience and can pick up new languages decently wel
[19:15:43] Catbuntu: kaldrenon, well I actually know those things lol.
[19:15:55] Catbuntu: I guess routes are one of the few things I got clear.
[19:16:13] adizam: krang: You assume something is going to spoof your local api.. like modify your hosts file to redirect to their own implementation?
[19:16:45] adizam: krang: I guess using a handshake method to create the session token is fine.. but if they're diligent enough they'll probably figure out how you're calculating it and spoof that as well
[19:17:08] kaldrenon: Catbuntu: Well, unfortunately I can't recommend much other than keep working at it. I learned Rails by bashing my head against it until it made sense.
[19:17:32] Rubba: kalleth if i have a section on the page for input to search filters or whatnot, i keep that in the layout right?
[19:17:58] Catbuntu: kaldrenon, problem is I can't manage to understand why use it.
[19:18:14] Catbuntu: I mean all this complications to do what I could do with PHP or whatever.
[19:18:42] kalleth: Rubba: stuff in the 'layout' should only be things that are on every page in yor app
[19:19:19] helpa: Catbuntu: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
[19:19:19] kalleth: Catbuntu: !whyphpsucks
[19:19:20] krang: adizam: well, if I have a secure secret and use CHAP to authenticate, they shouldn't be able to.
[19:19:53] krang: adizam: assuming I use a random token for each session, of course!
[19:19:54] kalleth: i mean i'm agnostic when it comes to python/ruby/haskell (no, really?)/emberjsetc sites
[19:19:57] kalleth: but really, PHP? :/
[19:20:02] kaldrenon: Catbuntu: This is just personal, but I find PHP significantly more frustrating to use. In Rails it's very easy to set up a structure/format and then stick to it, and have your database content very easy to access and manage, and Ruby has powerful tools for cleaning up markup (HAML, CoffeeScript, SASS)
[19:20:25] kalleth: kaldrenon: don't forget T_PAYAKIIM_NEUDOTTIM
[19:21:00] kaldrenon: If your application doesn't rely that heavily on a database, some of the benefit of Rails diminishes. But if that's the case, Sinatra is still way better (in my humble opinion) than PHP.
[19:21:59] dobry-den: Catbuntu: well, duh. your comfort zone is always more appealing than novel things
[19:22:04] dobry-den: imagine that
[19:22:31] davidcelis: I don't think that either ruby or rails could be described as "novel" anymore
[19:22:31] kalleth: rails isn't novel or new or 'the new hotness' anymore
[19:22:35] kalleth: it's just a tool
[19:22:36] davidcelis: they've both been around quite a while
[19:22:37] kalleth: dammit, davidcelis
[19:22:44] krang: adizam: I wasn't thinking of a modified hosts file, just the rogue API running when mine isn't (it's transient) and potentially capturing the secret if I just blindly fire it with each request.
[19:23:01] kaldrenon: davidcelis: They may not be novel to the industry, but they can still be new to an individual, which was the context there.
[19:23:05] dobry-den: novel as in novel to the collection of things Catbuntu is proficient in
[19:23:34] kalleth: i'll agree however that ruby/rails has a far greater 'setup' learning curve/deployment investment/infrastructure requirements than a 'php application'
[19:23:37] terra43110: now that i'm learning rails, it's clearly not the new hotness.
[19:23:37] kalleth: even if we're getting there
[19:23:52] kalleth: honestly, though, i want to be rake docker:package, be rake deploy-to:host-identifer
[19:23:53] RubyPanther: this channel was already here in 04
[19:23:54] kalleth: and just have it run
[19:23:57] kalleth: and we're nearly there
[19:24:19] adizam: krang: Gotcha
[19:24:20] RubyPanther: in 10 years nobody will use rails anymore, but we'll still be in here talking about ActiveRecord
[19:24:24] adizam: krang: yeah, your idea will work fine
[19:24:35] kalleth: RubyPanther: s/talking/complaining
[19:24:51] Catbuntu: I don't really like PHP either lol.
[19:24:54] davejlong1: I was wondering if someone could give me an idea of how to use the Liquid templating engine for files with the extension of .html?
[19:24:57] Catbuntu: But I guess I know it for some reason ;P
[19:25:06] terra43110: y won't anyone use rails in 10 yrs? lol
[19:25:16] RubyPanther: kalleth: I know I know, for years and years... "what do you want new in rails?" "Replace AR!" And then it switched to using arel, and everybody <3's AR
[19:25:27] krang: adizam: Cheers. Any idea about gems that would smooth the process? I really don't want to have to implement CHAP if it isn't necessary
[19:25:27] kalleth: terra43110: in my opinion, rails is becoming *too* opinionated and the learning curve for new people is now HOLY SHIT
[19:25:39] kalleth: my opinion may or may not be valid
[19:25:45] kalleth: but i wouldn't know where the good goddamn to start if i tried to begin with rails now
[19:26:02] terra43110: i think more people use rails (or whatever else)... it's just that they'll also be more other things
[19:26:07] dobry-den: rails was never optimize for newbie. it's optimized for abstracting the rigmarole into succinct incantations.
[19:26:12] terra43110: so rails (or whatever) might be a smaller share of a bigger pie
[19:26:13] kalleth: RubyPanther: I use activerecord for rails apps and rails apps only because gem compatibility lol, and then for any ruby app outside rails / the rails stack I use datamapper
[19:26:13] kaldrenon: Catbuntu: You know PHP because someone, at some point in your past, secretly wanted you to suffer.
[19:26:58] davidcelis: GUYS i just wanna be able to deploy a rails app to new servers easily. and not have to learn chef or puppet because getting started with either chef solo or puppet standalone may as well be like getting started with vim
[19:26:58] terra43110: alot of ppl are suffering
[19:27:07] kaldrenon: The only reason I don't utterly and complete hate PHP from the very core of my being is the time that being able to write PHP got me a huge raise at a past job.
[19:27:13] kalleth: davidcelis: this, precisely
[19:27:16] davidcelis: i just wanna spin up a new VPS, run a script against the IP address, and be done with it
[19:27:23] davidcelis: why is deploying still so hard
[19:27:24] RubyPanther: the first thing you do, is bang out a quick WTF. Then, throw it away, quick. If you're also new to Ruby, repeat step 1 at least 3 times before proceeding to step 2: set your google searches to the past year only if there is any chance in hell you might paste some of the code into your project
[19:27:30] kalleth: davidcelis: GIVE ME THIS SCRIPT
[19:27:43] kalleth: unless you were being ironic
[19:27:54] davidcelis: no, deploying is still too hard
[19:27:57] kalleth: because seriously, puppet needs to die
[19:28:02] kalleth: its syntax is terrible
[19:28:08] kalleth: chef has a learning curve like |
[19:28:15] kalleth: saltstack looks somewhat interesting
[19:28:17] kalleth: but its still not simple
[19:28:26] davidcelis: kalleth: i looked into it briefly
[19:28:33] davidcelis: then saw how complex it still was, and moved on
[19:28:38] RubyPanther: davidcelis: because you didn't automate it early enough
[19:28:49] dobry-den: i just move my source to my server and restart the rails process. it just sits behind nginx.
[19:28:56] kaspergrubbe: kalleth: have a look at ansible
[19:29:04] davidcelis: i'm looking at https://github.com/DAddYE/do, https://github.com/kenn/sunzi, and https://github.com/sprinkle-tool/sprinkle
[19:29:10] kalleth: kaspergrubbe: 'radically simple IT orchestration'
[19:29:25] kalleth: how can i put this
[19:29:25] davidcelis: RubyPanther: And how early should that be?
[19:29:26] kalleth: 'startuppy'?
[19:29:45] kalleth: "Arista leverages Ansible’s automation framework in conjunction with the extensible nature of EOS for implementing network programmability, delivering network automation for our customers."
[19:29:47] kalleth: WHAT DOES THAT EVEN MEAN
[19:29:59] RubyPanther: davidcelis: before you implement project code
[19:30:27] kalleth: RubyPanther: for the simple case, i want to be able to do 'hurr durr this rials website, haev config file, press butan, apprunz'
[19:30:27] kalleth: and not pay heroku £fucklol
[19:30:50] kalleth: 'here is my app'
[19:30:58] kalleth: 'here is a bare metal server of some description'
[19:31:05] kalleth: 'make app run on this host'
[19:31:06] RubyPanther: kalleth: that's what I do
[19:31:28] kalleth: RubyPanther: that's what I do too, at work, with puppet configuration files and manifests and modules and oh god so many brackets and terrible syntaxes
[19:31:40] RubyPanther: writing your generators is an O(1) cost that saves you time forever.
[19:31:42] kaspergrubbe: kalleth: yes, there is a lot of marketing bullshit
[19:32:02] kalleth: RubyPanther: i don't dispute that, but to deploy a rails application stack i *SHOULD NOT HAVE TO BE A SYSADMIN*
[19:32:28] RubyPanther: kalleth: I agree, but you _should_ have a sysadmin on a project.
[19:32:31] kalleth: rhizome: coders do not good sysadmins make.
[19:32:39] toretore: it's hard because it's complicated, because it has to be. i could give you my bootstrap/deploy script, but it will inevitably not be right for your situation
[19:32:51] kalleth: toretore: i want a solution for rails which is
[19:32:55] kalleth: 'here is some processing power online'
[19:33:02] kalleth: 'here are the authentication details for this processing power unit something'
[19:33:03] rhizome: sometimes there is not yet a simple solution
[19:33:04] kaldrenon: I think the big thing is that it feels like a solvable problem to set up a pretty sane automatic deploy system given a few logical defaults, so the fact that this isn't a solved problem can be frustrating.
[19:33:06] RubyPanther: It is more efficient if the dev is enough of a sysadmin to configure a mainstream web server for the platform they use
[19:33:07] kalleth: 'make app run on this processing unit'
[19:33:16] kalleth: RubyPanther: terrible terrible terrible terrible terrible idea
[19:33:28] RubyPanther: Traditionally it was a basic expectation.
[19:33:32] toretore: kalleth: heroku, aws, etc already do that
[19:33:34] kalleth: 'we don't need those automatic updates and security alerts and monitoring, we have a DEADLINE TO MEET'
[19:33:46] kalleth: toretore: and cost £lol
[19:33:52] RubyPanther: It's O(1). It is free.
[19:33:54] davidcelis: i wanna be able to define something like "This rails app needs postgres version X, redis version Y, and nginx version Z. after you install those, run some commands to symlink config files. here's an IP address, go."
[19:33:56] kalleth: i want to be able to say here's my cheap as ass digitalocean vps, and my rails applcation.
[19:34:02] davidcelis: but not have to learn chef or puppet because fuck those technologies
[19:34:10] kalleth: RubyPanther: my time has value, and my frustration levels with current configuration management tools cost $mytime*2000
[19:34:16] toretore: god what a useless discussion
[19:34:26] rhizome: ITT: irrational idealism
[19:34:28] RubyPanther: Your time has less value if you have less knowledge.
[19:34:48] kalleth: RubyPanther: I know how to use Puppet. I know how to use Chef. I have used both in anger at work for clients sites. I hate both of them.
[19:35:10] RubyPanther: Writing your code generators is a source of value, and it _______saves_____time_______. It does _not_ cost time. It saves time.
[19:35:14] rhizome: you should have them pay you to endure such anger
[19:35:15] dobry-den: I was heroku-only until I spent a moment on my Linode VPS setting up my environment by hand. It was simple to get postgres, nginx, etc. set up. And it's trivial to get my Rails app on it and running. I wrote a simple script that runs my shell commands in order from start to finish to make that happen. learned a lot in the process.
[19:35:19] toretore: what you're really saying is that the current unix style os isn't good enough
[19:35:33] kalleth: toretore: docker looks really interesting, and *could* move along the way to solving the problem
[19:35:39] kalleth: or something similar
[19:35:59] RubyPanther: If you aren't going to learn *nix, your choices are to have a sysadmin on the team, or to spend silly amounts of time thrashing in the dark.
[19:36:10] rhizome: wait, i have to install something in order to do these one-click scratch deploys? f-that.
[19:36:12] kalleth: i thrash in the dark in my own private kalleth time, tyvm
[19:36:36] RubyPanther: Well, if it isn't with *nix, you need a sysadmin. ;)
[19:36:53] kalleth: have you *seen* your average sysadmin?!
[19:36:58] rhizome: installshield for rails. I See A Great Need.
[19:36:59] kalleth: not my idea of a good time :P
[19:37:02] kalleth: rhizome: YES
[19:37:02] toretore: programming is too hard, why isn't there some sort of technology that will write the code for me and all i have to do is tell it what i want?
[19:37:04] kalleth: that's what i want
[19:37:15] RubyPanther: No, the sysadmins I know are rockstars and superheros.
[19:37:22] kalleth: oh god, 'rockstars'
[19:37:23] kalleth: murder me now
[19:37:30] kalleth: RubyPanther: !rockstar
[19:37:33] kalleth: is that a thing on the bot?
[19:37:33] davidcelis: RubyPanther: come back when you have a ninja sysadmin
[19:37:34] kalleth: it should be.
[19:37:46] davidcelis: good. !ninja should be silent.
[19:37:46] helpa: stop that right now!
[19:37:55] helpa: toretore: davidcelis just got stabbed
[19:37:55] davidcelis: toretore: !stab
[19:38:06] helpa: davidcelis: Keep Fucking Adding BullShit To Helpa
[19:38:06] kalleth: davidcelis: !KFABSTH
[19:38:18] helpa: davidcelis just got stabbed
[19:38:18] davidcelis: !stab toretore
[19:38:30] helpa: Matz Is Nice But I Am Not A Sheep And So I Am A Complete Bastard
[19:38:30] kalleth: !MINBIANASASIAACB
[19:38:30] RubyPanther: I dated a sysadmin who supported solid state servers on ships via satellite, they weren't pirates though they were just saving whales
[19:38:43] kalleth: lol, greenpeace
[19:39:14] kalleth: right, i've successfully diverged the topic towards a full on argument
[19:39:17] kalleth: im going to go back tow ork now
[19:39:21] RubyPanther: You meet a sysadmin on freenode, they might work on a huge government database, or an international bank, or a major NGO, or be a nerd in their garage
[19:39:38] kalleth: i Maek Websitez and sometimes sysadmin
[19:40:00] toretore: php is dead easy to deploy
[19:40:01] RubyPanther: I'm sure the sysadmin you could hire for a small project to help devs that don't understand *nix would be somebody less interesting
[19:40:02] kalleth: pretty sure half the boxes i've set up have been rooted though
[19:40:06] toretore: you should check it out
[19:40:17] kalleth: toretore: oh sure i'm on it man
[19:40:31] kalleth: toretore: mysql_real_escape_string looks rEALLY COOL, how come ruby doesn't have it?
[19:41:12] kalleth: that was a joke.
[19:41:14] ahawkins: hey, anyone know that web app that cpatured errors and open issues on a GH repo? It was FOSS iirc
[19:41:20] kalleth: ahawkins: errbit
[19:42:11] toretore: sounds like a spendid idea
[19:42:49] ahawkins: kalleth: thanks
[19:42:51] kalleth: really tempted to add in mysql_real_escape_string global function as a gem and open source it
[19:43:03] kalleth: make it fundamentally broken
[19:43:08] kalleth: then it'd be a drop in replacement, right guiyz
[19:43:33] Voker57|2: make magic quotes gem instead
[19:44:13] mjc_: kalleth: haha
[19:47:40] gabeodess: Can anyone here help me with hstore? I can't seem to query for null values… this is what I am trying: User.where("storage -> 'campaign_id' is null").count
[19:51:27] toretore: why are you using hstore?
[19:52:08] toretore: oh, pg hstore, carry on
[19:54:27] gabeodess: toretore: what were you thinking I was talking about?
[19:55:03] toretore: i was thinking pstore, which would be somewhat insane
[19:57:24] Rubba: are params[] sent to the layout?
[19:58:23] Rubba: so i'd have to make instance variables to send them through?
[19:59:04] toretore: you have access to params in the layour
[20:01:04] Rubba: how do i know whether i should be using partials or just writing into the layout?
[20:01:44] breakingthings: whether that thing is it's own component or not.
[20:02:19] stef1a: what's the proper way to display a message on a page ONLY ONCE (i.e., the first time the user hits the page (e.g., after signup, show a welcome message, but never again after that first visit to the signup?))
[20:02:36] toretore: flag in user
[20:02:39] pontiki: ditto, flash
[20:03:12] toretore: <% unless current_user.seen_msg? %>msg<% end %>
[20:03:15] terrellt: Flash is smart - set a flash message at the right point in your sign up controller and call it a day.
[20:03:29] breakingthings: nah that's silly toretore
[20:03:36] breakingthings: not if it's an automatic redirect
[20:04:57] toretore: it depends on the use case - it's the only way to be sure to show a message to a user exactly once
[20:05:11] davidcelis: create a `messages` table that has an array column that stores IDs of users that have viewed the message
[20:05:14] breakingthings: his use case is "after signup show a welcome message once"
[20:05:20] breakingthings: and also that's not the only way to be sure
[20:05:38] toretore: unless they load the page simultaneously in separate tabs <= number of concurrent server handlers
[20:05:51] brahmana: How do I allow destroy action via POST method in my resourceful routes?
[20:06:05] davidcelis: brahmana: .... what
[20:06:09] toretore: breakingthings: that was his 'e.g'
[20:06:18] brahmana: By default it is DELETE, I want to allow POST method also
[20:06:19] stef1a: so i'm gonna go with flash. thanks guys. i'll speak up if i run into any more trouble.
[20:06:22] davidcelis: brahmana: no... please don't...
[20:06:27] davidcelis: brahmana: why bro? whyyy
[20:06:36] breakingthings: toretore: yours would only be for a much smaller usecase.
[20:06:43] brahmana: davidcelis: because not all browsers support DELETE method
[20:06:45] breakingthings: toretore: like, "have you read our updated terms" :p
[20:06:56] brahmana: davidcelis: specifically the ones on semi-smart phones
[20:07:10] davidcelis: brahmana: rails helps you with that and looks for a "_method" param
[20:07:24] davidcelis: brahmana: just put :method => :delete on whatever you're trying to use as the deletion link
[20:08:03] brahmana: davidcelis: So I just send a regular POST with a _method=delete param and rails will understand?
[20:08:17] davidcelis: no browser support? rails doesn't give a fuck
[20:08:21] davidcelis: it JUST WORKS™
[20:08:39] brahmana: davidcelis: And why not use POST, btw?
[20:08:45] lethjakman: davidcelis: is there a list of all those methods somewhere/
[20:08:55] davidcelis: brahmana: because DELETE is the correct HTTP verb
[20:08:55] brahmana: apart from sticking to ReST principles
[20:08:59] Rubba: how do i do multiline commenting again? i had tried =begin and =end or something but it didn't seem to work
[20:09:00] davidcelis: please to be following HTTP principles
[20:09:06] breakingthings: because reasons, brahmana
[20:09:08] davidcelis: lethjakman: it's just an HTTP verb
[20:09:17] lethjakman: no I mean the :method => :delete
[20:09:19] davidcelis: lethjakman: GET, POST, PUT, PATCH, DELETE. those are the only ones
[20:09:20] breakingthings: the PHP deity will take you to it's land of torture if you don't
[20:09:23] pontiki: rubba: make sure =begin/=end are in the very first column
[20:09:39] pontiki: otherwise, screw it an just comment each line
[20:09:41] lethjakman: there's just one for each of those?
[20:09:46] Rubba: ahh there we go thanks
[20:09:46] brahmana: breakingthings: hahaha.... thats indeed a dangerous thing... :)
[20:09:53] davidcelis: lethjakman: yes because technically browsers won't do anything but GETs and POSTs
[20:10:20] pontiki: what about CROMULATE!!!
[20:10:21] davidcelis: browsers kinda suck
[20:10:38] breakingthings: we should all browse through wget like RMS
[20:10:48] davidcelis: my web browser is curl
[20:11:01] pontiki: dammit davidcelis, you stole my line!
[20:11:04] davidcelis: mechanize if i wanna spend the extra time to automate
[20:11:13] brahmana: thanks folks.. will go with your suggestions
[20:11:15] Rubba: do i need to run rails generate to create a partial or just make a new file wherever i want?
[20:11:25] davidcelis: Rubba: just... make files....
[20:11:36] lethjakman: Rubba: make a new file, generators are there to make things easier.
[20:11:36] pontiki: rubba, creating one file is so much easier
[20:11:42] wmoxam: davidcelis: pffft, purists use telnet
[20:11:51] lethjakman: but it only makes things easier with something more complex like a controller or a model.
[20:11:51] davidcelis: echo "%p I made a partial!!!" >> app/views/shared/_partial.html.haml
[20:11:56] pontiki: i feel an xkcd coming...
[20:12:04] pontiki: M-x butterflies
[20:12:05] brahmana: wmoxam: no netcat?
[20:12:14] eka: real programmers use butterflies
[20:12:18] davidcelis: wmoxam: telnet is for MUDs
[20:12:19] eka: pontiki: you beat me
[20:12:30] pontiki: eka: "Emacs has that built in"
[20:12:56] wmoxam: davidcelis: bro, do you even bbs?
[20:13:03] pontiki: netcat is actually a really useful tool
[20:13:14] eka: bbs… that old world… even I remember Fido net
[20:13:26] davidcelis: wmoxam: that was before my time
[20:13:38] lethjakman: wmoxam: are those even stil around?
[20:13:47] wmoxam: lethjakman: probably
[20:13:54] lethjakman: I think I saw someone talking about one actually
[20:13:56] eka: webpages are today's bbs
[20:13:59] lethjakman: and I thought I was the only person who played MUDs
[20:14:03] wmoxam: newtoruby: wat
[20:14:08] pontiki: lol, google had a bbs doodle
[20:14:13] davidcelis: wmoxam: i got one too
[20:14:15] davidcelis: i think it's a bot
[20:14:39] davidcelis: newtoruby: .part
[20:14:47] pontiki: forget this web crap, we're going back to gopher
[20:15:40] davidcelis: newtoruby: stop
[20:15:42] wmoxam: 16:15 <newtoruby> when i try to say hi on chat, it says 'HI unknown command'
[20:16:01] dopie: How do i add a js file to be read only in 1 file?
[20:16:16] davidcelis: dopie: javascript_include_tag wherever you want to require it?
[20:16:47] dopie: davidcelis, so i just dont put the file in the assets dir?
[20:16:56] davidcelis: why wouldn't you?
[20:17:04] dopie: wouldnt it call it
[20:17:14] davidcelis: wouldn't what call what?
[20:17:26] pontiki: what does "read only in 1 file" mean?
[20:17:30] davidcelis: app/assets/javascripts/standalone.js
[20:17:31] dopie: woudlnt application.js call the file name
[20:17:39] davidcelis: dopie: application.js only does what you tell it to do
[20:17:44] davidcelis: just don't add it to the manifest bro
[20:17:46] dopie: thnak you
[20:17:50] dopie: just making sure :)
[20:18:05] davidcelis: as long as you're not doing one of those stupid `//= require_tree .` calls
[20:18:08] davidcelis: that requires everything
[20:20:02] pontiki: newtoruby may be newtoirc, too
[20:21:07] wmoxam: newtoallthethings
[20:22:46] jstew: Speaking is overrated.
[20:23:31] ntdavison1: hello, could anyone here spare a minute to help me out with a question I have regarding remember tokens in cookies for a rails app?
[20:24:09] helpa: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[20:24:14] pontiki: only if you ask it
[20:25:46] ntdavison1: i don't quite understand how the rails tutorial approach to remember tokens provides security from session hijacking. what is stopping someone from stealing a remember me cookie and just visiting the app?
[20:26:40] chase-work: i have a gem I build, and its included in the Gemfile, the server starts up fine, but if I require it in the console, I get a load error, any ideas what that would happen?
[20:26:59] Rubba: did you do bundle install
[20:27:12] Rubba: (i don't actually know what i'm talking about, wild guess)
[20:27:32] chase-work: Rubba yea its installed and bundle install shows it in the last
[20:28:04] Rubba: then yeah 'fraid i can't be any more help :p
[20:28:24] dopie: newtoruby, YOU MUST NOW IDENTIFY your nick
[20:28:43] Lewix: anybody use sublime?
[20:28:47] Lewix: hello dopie
[20:29:18] dopie: Lewix, i do
[20:29:28] dopie: Lewix, #railsnoob
[20:29:29] jstew: chase-work: What if you exec your console under bundler... ie: bundle exec rails console
[20:29:55] Lewix: chase-work: after installing a gem my application.css.scss went from being higlighted to not being highlighted and some of my css did not get applied
[20:30:53] chase-work: jstew I still get "LoadError: cannot load such file -- gem name"
[20:31:00] Lewix: it disrupted my css settings
[20:31:19] jstew: chase-work: Why would you want to require it? Are you using :require => false in your gemfile?
[20:31:22] chase-work: Lewix a gem should have no effect on your sublime text theme
[20:31:23] davidcelis: chase-work: if it's in the Gemfile, it's already loaded in console
[20:31:37] chase-work: jstew to test it for errors
[20:31:45] chase-work: davidcelis yes, in which case it would return false
[20:31:54] chase-work: davidcelis not a load error
[20:31:56] Lewix: chase-work: that's right, so I am puzzled, I'm pretty sure I am not drunk
[20:31:56] jstew: chase-work: like davidcelis said, it should already be required under bundler.
[20:32:12] davidcelis: chase-work: gist your Gemfile, and also gist your shell/console session
[20:32:56] chase-work: davidcelis alright, but its pretty standard,
[20:37:54] lxsameer: how can i get the current locale in View ?
[20:40:27] davidcelis: y... you're welcome.....
[20:43:35] chase-work: dabradley https://gist.github.com/umdstu/6057486
[20:43:39] chase-work: davidcelis https://gist.github.com/umdstu/6057486
[20:44:38] davidcelis: chase-work: LoadError: cannot load such file -- active_support/core_ext/class/attribute
[20:44:52] davidcelis: your gem depends on ActiveSupport but doesn't list it as a dependency?
[20:45:45] chase-work: its not my gem, I just made some tiny mods, and rebuilt. but no, active support is not listed in the gemspec
[20:46:38] chase-work: where are you getting the active_support message?
[20:46:56] davidcelis: i gem installed and required in irb
[20:47:15] chase-work: see, I can't even do that
[20:47:30] chase-work: i tried loading in rib as well, after require ruby gems, and it gives same error
[20:48:04] chase-work: something must be wrong with the gem
[20:48:16] davidcelis: OMG GRAVATAR IS DOWN
[20:50:45] luckyruby: ACTION is in enterprise hell.
[20:51:30] luckyruby: on that note, anyone been able to pull off devise + ldap + pci compliance in an enterprise setting? By that I mean, strong password validation + password expiration after 90 days, etc.
[20:52:56] stef1a: anyone know why my flash message isn't being shown after signup? : http://i.imgur.com/Ncwce7j.png
[20:53:06] davidcelis: did you just
[20:53:08] davidcelis: screenshot your code
[20:53:12] davidcelis: upload it to imgur
[20:53:17] davidcelis: and then give us a screenshot
[20:53:27] davidcelis: so we can't actually select anything or highlight anything or really do anything with it at all
[20:53:29] helpa: stef1a: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[20:53:29] davidcelis: stef1a: !gist
[20:53:45] RubyPanther: you have the default emacs color scheme
[20:53:47] stef1a: so easy on my part <3
[20:54:00] stef1a: RubyPanther: actually i don't think zenburn is included in emacs
[20:54:07] davidcelis: stef1a: flash.now # INCORRECT
[20:54:17] davidcelis: stef1a: flash.now is for when your action ends in `render`
[20:54:30] davidcelis: it's for the current action
[20:54:31] lethjakman: davidcelis: why do I recognise your name? do you run a blog or something?
[20:54:35] davidcelis: you want it to display on the NEXT action
[20:54:45] RubyPanther: '(default ((t (:inherit nil :stipple nil :background "DarkSlateGray" :foreground "Wheat" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
[20:54:46] davidcelis: lethjakman: i'm liek internet famous~~*~❤
[20:55:25] davidcelis: stef1a: just `flash[:notice] = "my message"`
[20:55:33] luckyruby: davidcelis: what happened to goodbre.ws?
[20:55:48] davidcelis: luckyruby: got too big for its britches
[20:56:05] davidcelis: luckyruby: and i took the downtime as an excuse to fix another issue, which was curating a huge database of beers by myself
[20:56:22] stef1a: davidcelis: didn't work... does it need to be :notice?
[20:56:33] davidcelis: stef1a: well, that's the standard
[20:56:39] davidcelis: and then you'd display flash[:notice] in the view
[20:56:41] RubyPanther: you mixed .now with a redirect, which isn't now
[20:56:43] davidcelis: but i guess you changed the key
[20:56:53] davidcelis: luckyruby: i've re-pulled my data from BreweryDB but they give so much more info that it's warranted a rewrite of the front end
[20:56:57] RubyPanther: that's like, later
[20:57:01] stef1a: davidcelis: but i want to only display a SPECIFIC message
[20:57:02] davidcelis: luckyruby: and my life is busier than it used to be, so that's not done yet :\
[20:57:08] davidcelis: stef1a: then just remove .now
[20:57:12] davidcelis: stef1a: and be done with it
[20:57:17] luckyruby: davidcelis: nice
[20:57:19] davidcelis: lethjakman: http://davidcel.is/ maybe?
[20:57:19] stef1a: davidcelis: doesn't work
[20:58:10] stef1a: i'm guessing something is wrong with the application.html.erb
[20:58:14] davidcelis: luckyruby: i hope to bring it back up in the next couple months
[20:58:17] lethjakman: davidcelis: bet I've seen you on lifehacker
[20:58:27] davidcelis: i got a hefty 7000 users right before it went down. i wonder how many will come back :(
[20:58:38] davidcelis: lethjakman: goodbre.ws was on lifehacker
[20:58:47] davidcelis: then my redis got too big because i was dumb
[20:59:06] lethjakman: davidcelis: I like the looks of this.
[21:00:51] davidcelis: i was gonna rewrite it as a rails API and ember frontend but the learning curve is still a bit too high to be able to crank it out fairly quickly
[21:01:28] lethjakman: davidcelis: why didn't you just leave the other one up?
[21:01:59] davidcelis: lethjakman: i wanted to solve the issue with my data source while people weren't using the site and creating more ratings that i'd try to have to migrate
[21:02:42] lethjakman: interesting. too de-normalized?
[21:02:45] davidcelis: and i haven't brought the old one back up again because i'm too much of a perfectionist and the old frontend doesn't make sense anymore
[21:03:11] davidcelis: lethjakman: too big for me to manage. i had 60k beers and was basically curating it myself
[21:03:32] davidcelis: i tried the whole "let users suggest new data and suggest edits but i have to approve it"
[21:03:35] davidcelis: and that was, in a way, worse
[21:03:54] davidcelis: so what i ended up with was a database of beers that was over two years outdated :)
[21:04:11] lethjakman: hrm...why was that worse?
[21:04:17] davidcelis: too many suggestions
[21:04:23] lethjakman: I'm writing a project somewhat similar to this, more media related thoguh.
[21:04:25] davidcelis: i still had to do manual checking to see if they were good
[21:04:49] lethjakman: I haven't been able to find a solution I like for that yet...it does seem like a pain.
[21:04:55] davidcelis: people would submit beers that i already had in the database, but they'd submit it under slightly different names
[21:05:28] lethjakman: hrm, maybe there's some sort of fuzzy searching that could be implemented
[21:05:44] lethjakman: something that would say "did you mean one of these beers?"
[21:05:47] davidcelis: i had to do that to move ratings from my old database to the new one
[21:05:53] davidcelis: unsurprisingly difficult
[21:06:02] davidcelis: i'm still surprised i managed to keep 80% of them
[21:06:24] davidcelis: matching the old beers to the new ones based on name and brewery info was maybe harder than you'd think
[21:06:54] lethjakman: davidcelis: what about Levenshtein distance?
[21:06:58] davidcelis: i tried various string matching algorithms and most of them weren't very effective
[21:06:59] davidcelis: including that one
[21:07:00] lethjakman: what DB are you using?
[21:07:29] luckyruby: Not sure I agree with rating beers straightforward like that. It may be better to play the role of a matchmaker as far as pairing a user up with another user with similar tastes in beer. And through that relationship, recommend beers.
[21:07:52] davidcelis: that's what the site's doing
[21:08:05] davidcelis: except instead of pairing a user up with another user, it pairs the user up with a lot of other users
[21:08:08] davidcelis: collaborative filtering, yo
[21:08:58] Paradox: i have Patents which have many Claims. How would I do a query to return all Patents who have more than 20 claims? I'm not very good with sql, makes my brain fuzzy
[21:09:38] Paradox: i have squeel installed too, if that helps
[21:09:42] davidcelis: Paradox: you're gonna need to joins
[21:09:46] davidcelis: Paradox: Or make a counter cache
[21:09:47] Paradox: davidcelis, thats what i figured
[21:09:52] Paradox: but i couldnt figure out the join syntax
[21:09:57] lethjakman: Paradox: the counter cache would be a really nice solution.
[21:09:58] davidcelis: if you're doing this all over the place, then i'd suggest a counter cache
[21:10:42] Paradox: say its a one-off operation for now
[21:10:42] davidcelis: also, fuck patents
[21:10:46] Paradox: and i dont just want a count
[21:10:57] davidcelis: it wouldn't be just a count
[21:10:57] Paradox: i want the actual patents that have more than x claims
[21:11:03] davidcelis: the counter cache is to store the count
[21:11:06] davidcelis: so you could do a query like
[21:11:19] davidcelis: Patent.where('claim_count > ?', 20)
[21:11:32] Paradox: derp, you're right
[21:11:33] lethjakman: Paradox: then you can select all the patents with the cache that's higher than that, rather than doing a group by.
[21:11:44] Paradox: what would be the proper join syntax though, just for my education
[21:11:51] davidcelis: claims_count*
[21:11:52] davidcelis: would be the default
[21:12:04] davidcelis: Paradox: i can never remember :(
[21:12:17] Paradox: like i said, i have squeel which is supposed to make this shit easier
[21:12:32] gwillen: the joined version will involve a 'having' I think
[21:12:34] Paradox: https://github.com/ernie/squeel
[21:13:08] lethjakman: gwillen: that would be for the group by
[21:13:10] gwillen: Patent.joins(:claims).select('count(*)').group("patent.id").having("count > 20") perhaps
[21:13:28] luckyruby: select patent_id, count(*) from claims group by patent_id having count(*) > 20
[21:13:43] gwillen: ah, yeah, I left off the select of the id
[21:14:53] sdwrage: hey all. I am trying to follow a capistrano tutorial and it asks me to put something in config.rb but I currently don't have one in my rails 4 project. Do I have to create it or is it named something different now?
[21:15:15] Paradox: ouch, thats some janky sql
[21:15:31] luckyruby: Paradox: did it work?
[21:15:33] Paradox: thanks though, let me see if i can figure that out in squeel
[21:15:34] codeshah: hey gusy, on heroku I am getting a jquery is not defined
[21:15:37] codeshah: even though I precompiled assets
[21:15:42] codeshah: locally and remotely [tried both]
[21:15:43] Paradox: let me run it
[21:15:49] luckyruby: Paradox: try the sql direct against the db
[21:16:15] Paradox: squeel lets you run functions inline
[21:16:20] Paradox: no weird arel stuff
[21:17:14] gwillen: Paradox: wow, that's really cute
[21:17:23] sdwrage: anyone know? can't find a config.rb file
[21:17:23] Paradox: gwillen, the gem?
[21:17:27] gwillen: Paradox: I've really wanted something like that. How is it, bug-wise? How often does it do something weird you didn't predict?
[21:17:31] gwillen: Paradox: yeah, squeel
[21:17:38] Paradox: its by the same guy who coded metawhere
[21:17:41] Paradox: its the spiritual successor
[21:18:04] luckyruby: sdwrage: which tutorial?
[21:18:47] sdwrage: luckyruby, hold on
[21:18:57] sdwrage: https://gist.github.com/jrochkind/2161449
[21:19:00] sdwrage: luckyruby, ^^
[21:19:38] luckyruby: i think that's a typo
[21:19:43] luckyruby: should be deploy.rb
[21:19:46] Paradox: luckyruby, yes yours works
[21:20:08] Paradox: now to see if i can squealify it
[21:20:18] sdwrage: luckyruby, so this "server "your.server", :app, :web, :db, :primary => true" goes in the deploy.rb file?
[21:21:42] Paradox: while we're in the same vein as earlier
[21:21:53] Paradox: i have a habtm relationship between patents and agents
[21:22:04] Paradox: patents have many agents and agents can have many patents
[21:22:11] Paradox: whats the simplest way to find an agent that has more than 20 patents
[21:22:34] lethjakman: davidcelis: what about allowing a way for users to submit duplicates?
[21:22:40] Paradox: preferibly something arel or squeel or in-app, instead of raw sql
[21:22:44] davidcelis: lethjakman: ?
[21:22:49] lethjakman: perhaps flag them as duplicates and if there's a certian number of flags between two it removes one of them.
[21:22:52] lethjakman: davidcelis: your beer app
[21:22:57] davidcelis: oh you mean report dupes
[21:23:19] davidcelis: i mean, i guess? but why bother? now a third party is taking care of the data for me
[21:23:22] davidcelis: i don't have to worry about any of it
[21:23:24] luckyruby: Paradox: what's the name of your join table
[21:23:30] luckyruby: agents_patents?
[21:23:37] Paradox: its a rails-created one
[21:24:08] codeshah: it seems in my production heroku app .. the //require jquery etc. are not being actually run
[21:24:09] lethjakman: davidcelis: oh they are? I didn't know that.
[21:24:10] codeshah: why would this be?
[21:24:18] codeshah: i.e. application.js on there just has //require js
[21:24:44] davidcelis: lethjakman: brewerydb
[21:27:12] luckyruby: Paradox: select agent_id, count(*) from agents_patents group by agent_id having count(*) > 20;
[21:27:52] Paradox: luckyruby, yeah that works. Any way i could do it using arel?
[21:27:56] Paradox: (thanks btw)
[21:29:39] luckyruby: Paradox: might be simpler to just use raw sql for that
[21:30:14] luckyruby: Agent.find_by_sql("select agent_id, count(*) from agents_patents group by agent_id having count(*) > 20")
[21:30:41] Paradox: think of a learning exercise, but you're right
[21:31:15] brycesenz: I have a question on rails validations and their impact on testing. I have a few model relationships - Customers have Addresses, Phone Numbers, and also Contracts. In addition, they can make Payments, which belong to both Customers and Contracts. So I have validations to ensure Address and Phone Number presence for each Customer, and validations to ensure that the Payment's Contract has the same Customer as the Cus
[21:31:15] brycesenz: tomer Id for the Payment itself. Complex, right?
[21:31:16] gwillen: what is the difference between arel and activerecord?
[21:31:23] gwillen: I understand that arel is lower level or something?
[21:31:30] gwillen: I am not sure if I've ever used it directly or not.
[21:31:34] Paradox: other way around
[21:31:42] Paradox: arel is how you query activerecord
[21:31:44] brycesenz: So my question is that are these validations all necessary? It means that my test setup takes forever to get all of the right associations in place.
[21:31:46] gwillen: ohhh, okay
[21:31:48] gwillen: thanks Paradox
[21:32:07] Paradox: luckyruby, almost there, but that returns the agent id and count, ideally i'd like the Agent itself
[21:32:12] slash_nick: Paradox: eh, arel is how activerecord queries db?
[21:32:22] fryguy: brycesenz: stubs and mocks are helpful, so are fixtures and factorygirl, or just disabling validations for specific tests as needed
[21:32:22] Paradox: im probably butchering explanations
[21:32:25] Paradox: but thats how i was taught
[21:32:41] gwillen: Paradox: the find_by_sql will give you back Agent objects, but they will be missing all their properties except id
[21:32:44] brycesenz: fryguy: How does one disable validations for specific tests?
[21:32:57] Paradox: thats what i noticed
[21:33:09] brycesenz: fryguy: I do use FactoryGirl, but my factories are crazy complex. To set up a Customer object for testing, I need to create like 4 objects.
[21:33:16] gwillen: Paradox: you could try 'select agent.*, count(*) from agents, agents_patents group by agent_id having count(*) > 20'
[21:33:19] rsl: making a big upgrade from rails 2 to rails 4 in this app and getting error in integration tests when trying to check session variable being set. does this sound familiar to anyone? https://gist.github.com/rsl/29c5bb1b956861e683b5
[21:33:37] gwillen: Paradox: I'm not sure if that will work right with the group by, I feel like I've had similar things work but also had them fail and I don't know why
[21:33:57] gwillen: Paradox: oh, and you need a 'where agents.id = agents_patents.agent_id' in there too
[21:34:06] Paradox: brycesenz, there's a save_without_validations or something
[21:34:32] brycesenz: Paradox: Does that work with FactoryGirl by any chance?
[21:34:35] rushed: rsl: for request/feature/integration tests you generally just interact via the "browser"
[21:34:49] Paradox: google the proper method name
[21:34:58] sdwrage: luckyruby, thanks for the help just getting into capistrano and is a bit daunting :P
[21:35:02] rsl: rushed: i'm just porting existing tests over. not rewriting the whole integration test suite unfortunately.
[21:35:30] luckyruby: sdwrage: yeah. once you get it going though, you'll wonder how you ever managed without it.
[21:35:48] brycesenz: Paradox & fryguy: So in your opinion (this is really my biggest concern), is it a problem to have complex model validations? For example, validating some relationship between multiple foreign keys in a model, etc.?
[21:36:20] Paradox: they can make your database more brittle
[21:36:23] luckyruby: I also use capistrano-ext which lets you define deploy.rb for multiple environments (staging, production, qa, etc.)
[21:36:25] Paradox: but they may be needed
[21:36:25] sdwrage: luckyruby, yeah. I was using webbynodes rapid deployment gem
[21:36:44] sdwrage: all I had to do was git add -A && git commit -m "message here" && wn push
[21:37:02] sdwrage: only problem is it has issues with rails 3 apparently
[21:37:23] rushed: rsl: might want to see if the "# Some login stuff" is via the browser or setting session variables and the like… if it's talking directly to warden or something that may work as a controller test without modification
[21:38:10] rsl: rushed: thanks for the help but that's not the issue. i'll keep looking/asking.
[21:38:14] slash_nick: sdwrage: look at this... it walks through deploying a rails 3 app http://isotope11.com/blog/deploying-a-rails-3-dot-2-plus-app-from-scratch-on-ubuntu
[21:40:42] sdwrage: slash, is it the same process with rails 4?
[21:42:03] slash_nick: sdwrage: couldn't say
[21:44:52] Paradox: luckyruby, gwillen. I figured out how to get agents with more than x patents using squeel
[21:45:01] Paradox: Agent.joins{patents}.group{agents.id}.having{{patents.count => 5 }}
[21:45:34] sdwrage: luckyruby, do you run cap deploy on the server or the dev machine?
[21:49:13] bjorn_: hey guys i have a weird problem; so after creating a new rails app two my oher projects actionmailer stopped working
[21:49:44] toretore: need more information
[21:50:33] bjorn_: one app is using actionmailer 3.2.11 and mail 2.4.4
[21:50:58] bjorn_: the other is using 3.2.13 and 2.5.3
[21:51:01] flip_digits: in rails is the term "transaction" used to mean saving to the database?
[21:51:47] toretore: flip_digits: do you mean is it a reserved word? then probably
[21:51:53] toretore: maybe not, but probably
[21:51:57] bratsche: Or it could be deleting from the database, etc.
[21:52:07] toretore: bjorn_: are you sure they're using those versions?
[21:52:15] slash_nick: noitcasnart is a reversed word, fwiw
[21:52:40] toretore: bjorn_: also, "not working" is the shittiest way to describe a problem one could possibly come up with
[21:53:13] flip_digits: toretore: I was watching a screencast on the speaker used the term transaction when talking about saving a record thanks!
[21:53:30] bjorn_: toretore: sorry for the description of "not working" ; yes positive just double checked Gemfile.lock; so what happens is in the development.log i can see the email was sent but i never get it
[21:53:37] toretore: flip_digits: it's a db term, google "database transaction"
[21:53:42] bratsche: flip_digits: It's a normal term used when talking about databases.
[21:53:49] flip_digits: toretore: thanks
[21:53:51] toretore: bjorn_: env?
[21:54:03] toretore: bjorn_: more info
[21:54:14] bjorn_: toretore: im in dev enviroment
[21:54:17] toretore: oh, development.log heh
[21:54:27] elaptics: slash_nick: ecnetnes desrever a si siht dna
[21:54:39] toretore: so, why are you expecting that an email is actually sent in dev?
[21:55:12] Apane: how do i make CanCan work for users with the admin boolean set to true, this is what i have so farhttps://gist.github.com/Apane/4bda66417e63e8b8f7d2
[21:55:30] bjorn_: toretore: send email in dev is set to true. Also forgot to mention the app was sending locally until 3 days ago when the problem arose
[21:56:08] toretore: Apane: link not clickable, didn't read
[21:56:28] slash_nick: elaptics: :D fun, fun, fun
[21:56:29] elaptics: Apane: that is correct
[21:56:46] gwillen: Paradox: what sql does that emit, out of curiosity?
[21:56:49] toretore: also, didn't read because i don't know anything about cancan
[21:56:55] Paradox: i just closed the tab
[21:57:09] Paradox: give me a sec
[21:57:27] toretore: bjorn_: still not enough information to go on unless one has seen that exact problem before
[21:57:34] slash_nick: Control Shift T oughta reopen the tab you closed
[21:58:09] Paradox: gwillen, SELECT "agents".* FROM "agents" INNER JOIN "agents_patents" ON "agents_patents"."agent_id" = "agents"."id" INNER JOIN "patents" ON "patents"."id" = "agents_patents"."patent_id" GROUP BY "agents"."id" HAVING "patents"."count" = 5
[21:58:43] Rubba: what's the accepted way to throw errors in rails?
[21:59:04] Rubba: preferably very simple like error("blahblabhbla") that would kill further processing
[21:59:20] Paradox: raise does a good job of raising things
[21:59:21] Apane: elaptics, let me give it another shot
[21:59:28] Rubba: eh.. something like die() in php?
[21:59:30] toretore: citizen, you must elaborate
[21:59:57] davidcelis: rushed: raise
[21:59:59] terrellt: Rubba: There's no "fatal error" - because that would be a bad thing. You can use "raise" to throw an exception, though. =)
[22:00:11] Paradox: whenever i have to write code to deal with errors, i feel like im playing a poker game
[22:00:18] Rubba: alright i'll have a look
[22:00:22] Paradox: I see ur errah, an i raize u a fouer
[22:00:31] Rubba: i'm doing some basic validation right now
[22:00:38] Rubba: and i just want a quick hack for throwing an exception
[22:00:42] toretore: right, now he goes putting raise all over the place, great job
[22:00:48] Rubba: i'll go back and make it better later
[22:01:13] toretore: citizens, you are under watch for shitty advice
[22:01:24] bjorn_: toretore: could it be sendgrid as both of those apps use sendgrid
[22:01:29] sdwrage: luckyruby, hem I was able to log into github via "cap deploy" and even into my ssh without errors when I go to look in the folder though (releases) I don't see anything 0_o is that normal?
[22:01:49] toretore: bjorn_: have you switched from sendgrid to something else?
[22:01:58] toretore: (or use something else in dev)
[22:02:14] bjorn_: toretore: iv used gmail in the other apps
[22:02:21] bjorn_: toretore: gonna test this theory now
[22:02:30] rhizome: sdwrage: cap deploy:check
[22:02:30] toretore: there you go, now there's something to go on
[22:02:48] rushed: Rubba: validations usually don't require throwing errors, you might find this useful http://railscasts.com/episodes/211-validations-in-rails-3 (note it's for an older version of rails but it should provide a reasonable overview)
[22:03:25] toretore: you need to make whatever is supposed to send an email give you information
[22:03:25] sdwrage: ah okay :P git isn't installed lol
[22:03:25] sdwrage: guess that would be kind of important eh?
[22:03:25] elaptics: Apane: I'm assuming that the admin field is a field in your table
[22:03:34] Rubba: i'll have a look thanks
[22:05:01] Apane: elaptics, that's right
[22:05:15] Apane: let me gist the error one sec
[22:06:01] Apane: elaptics, https://gist.github.com/Apane/c565fca9e6e07b2a4e6d
[22:06:54] elaptics: Apane: well you need to end that if statement you've started on line 13
[22:07:46] elaptics: Apane: generally I just put those sort of if's at the end of the line
[22:08:31] elaptics: Apane: e.g. <%= link_to('Edit', edit_song_path(@song), class: "button small secondary") if can? :update, @song %>
[22:09:36] Apane: elaptics, Kk, that makes sense - going to try it
[22:10:28] melder: question: whenever i use a rails helper for path, i get "projects.test" instead of "projects/test". for some reason the slash is being replaced by a dot. anyone have an idea on how this could happen?
[22:12:16] sdwrage: luckyruby, ng command
[22:12:16] sdwrage: ** [ :: err] fatal: could not read Username for 'https://github.com': No such device or address
[22:12:24] sdwrage: that look familiar?
[22:12:31] Apane: elaptics, https://gist.github.com/Apane/d46e9ed142b6efdbdb0b
[22:12:33] Apane: weird huh?
[22:16:13] t00r: someone knows about WYSIWYG editor with upload on rails?
[22:16:55] Paradox: bought a few of my friends this thing http://amzn.com/B000WATSQU as a gift
[22:16:58] Paradox: makes a nice desk ornament
[22:17:02] Paradox: was of a surprisingly high quality
[22:17:45] lethjakman: t00r: upload?
[22:18:13] t00r: lethjakman: image upload integrate with editor
[22:18:23] Burnninator: Can anyone recommend some open-source rails projects that would be good to read through and learn from?
[22:18:33] lethjakman: t00r: I think that's possible with tinymce...but I haven't figured out how yet.
[22:18:48] lethjakman: it's hard to find one with a permissive license
[22:19:09] t00r: lethjakman: tinymce is open source, but your file manager isn't free..
[22:19:26] bjorn_: toretore: so i found the issue
[22:19:31] Burnninator: Just looking for some crud stuff that follows best practices.
[22:19:38] bjorn_: toretore: i think sendgrid blocked my ip
[22:20:02] lethjakman: t00r: my file manager?
[22:20:36] Paradox: there's a really good editor i saw the other day
[22:20:37] t00r: lethjakman: sry, tinymce's file manager
[22:20:38] Paradox: its not tinymce
[22:20:39] Paradox: its something else
[22:20:42] Paradox: can output markdown
[22:20:56] t00r: Paradox: ckeditor is cool
[22:21:11] Paradox: that was it
[22:21:18] Paradox: but i wouldnt use their built in image editors
[22:21:22] Paradox: i'd use aviary or similar
[22:21:27] t00r: but the file manager is payed too
[22:21:40] Apane: any idea as to why i'm getting this error? https://gist.github.com/Apane/d46e9ed142b6efdbdb0b
[22:22:05] Mikail__: Hi, I have a fundamental question. I'm trying to use an external module including some classes in that in my project. Basically I collect login creds in a form, and calls an external login method with those - returning an object with the login info, cookie etc. I need this object to call various methods that I display in my project. So It needs to be stored somewhere between models, controllers and various views. Is there some
[22:22:06] Mikail__: standard way to do this?
[22:22:27] lethjakman: Apane: is that everything?
[22:22:37] lethjakman: there aren't 29 lines in that file.
[22:26:13] Apane: lethjakman, that's everything
[22:26:48] davidcelis: Paradox: ordered one. had to.
[22:26:50] Apane: i moved it up line 29 is line 11
[22:27:19] Paradox: davidcelis, its really nice
[22:27:22] Paradox: its got some heft
[22:27:24] Paradox: and its glass
[22:27:28] davidcelis: Apane: break tags? what is this, the 90s
[22:27:28] Paradox: i got 3 red ones and a blue one
[22:28:15] Alkorn: Hey guys can you explain me some ruby feature http://lh4.ggpht.com/-bU1QmMsBAPs/UUmnK7LT5iI/AAAAAAAABoU/lLvuLaxKGQo/ruby-fails.png?imgmax=800
[22:28:25] Alkorn: It is not about rails but about ruby
[22:28:43] davidcelis: Apane: it looks like you have an extra <% end %> tag
[22:29:23] heba: hi, are there a gem which connect to graph orient-db ? I am search for something like neo4j gem but for orient-db
[22:29:23] davidcelis: Alkorn: #ruby
[22:30:00] davidcelis: heba: https://github.com/veny/orientdb4r ?
[22:30:11] Rubba: how should i route a POST form so that it reaches the desired controller?
[22:30:40] Apane: davidcelis, that end is for the songs.each do block above
[22:31:03] davidcelis: Apane: you have two
[22:31:07] davidcelis: Apane: you only need one
[22:31:20] davidcelis: Rubba: by routing it to the correct URL?
[22:33:39] Rubba: i'm pretty sure i am routing it rigt but i get "No route matches [POST] "/blah""
[22:33:50] Rubba: blah being the action in te controller
[22:34:46] davidcelis: then you didn't route it correctly
[22:35:17] Apane: davidcelis, see the new error when I remove one of the end https://gist.github.com/Apane/d46e9ed142b6efdbdb0b
[22:35:41] Rubba: would putting 'post "dir/blah"' in routes.rb not be the right way?
[22:36:49] davidcelis: post "dir/blah" ?
[22:37:26] davidcelis: what is dir/
[22:37:49] Rubba: dir is the 'controller directory' (not sure of the proper terminology) blah is the action
[22:37:58] Rubba: err i mean
[22:38:00] davidcelis: routes just take the desired URL path
[22:38:09] davidcelis: they dont have anything to do with filepaths, really
[22:38:34] davidcelis: if you want to route /blah to something, you need to do `post 'blah' => 'controller#action'` or some other routing syntax
[22:38:50] davidcelis: post '/blah', rather
[22:38:58] bjorn_: So Sendgrid is no longer allowing me to send email from localhost
[22:39:07] bjorn_: would anyone know a solution for this?
[22:39:22] davidcelis: why are you sending mail from localhost D:
[22:40:13] pontiki: bjorn_: not knowing your local situation, my carrier comcast has their entire consumer IP block in the banned hosts lists
[22:40:31] pontiki: should say blocks
[22:41:14] pontiki: it's their policy to not allow general outbound mail to any smtp server
[22:42:47] bjorn_: i too have comcast
[22:42:53] bjorn_: but i can use gmail to send email
[22:43:03] bjorn_: davidcelis: for confirmation emails
[22:43:20] lethjakman: bjorn_: gmail isn't local. that's a server on a different network.
[22:43:38] bjorn_: sorry for the incorrect wording
[22:43:49] bjorn_: i am using my app locally to send email through gmail and sendgrid
[22:44:02] bjorn_: sendgrid does not work
[22:44:08] Apane: https://gist.github.com/Apane/d46e9ed142b6efdbdb0b
[22:44:10] bjorn_: although it was working a couple days ago
[22:44:26] lethjakman: bjorn_: if you revert your app back to that state does it work?
[22:44:45] bjorn_: negative i found the error; the error is using sendgrid
[22:45:08] lethjakman: bjorn_: you mean sendgrid doesn't work right?
[22:45:19] bjorn_: the code hasnt changed i think maybe sendgrid blacklisted my ip address
[22:46:03] lethjakman: do you have a plan with them?
[22:46:13] bjorn_: yes on two accounts
[22:46:22] bjorn_: both accounts are not working locally
[22:46:27] bjorn_: so on heroku they work fine
[22:46:33] bjorn_: but on localhost they do not work
[22:46:35] lethjakman: are they payed? or the demo?
[22:46:45] davidcelis: Apane: are you omitting parts of the template?
[22:46:47] Criten: Would you guys say it's good practice to always put forms in partials?
[22:47:02] davidcelis: Criten: if you're gonna use it more than once
[22:48:05] Criten: davidcelis, yeah.. i think it's good if you put them in partials because it gives you that flexability later if you decide you do want it elsewhere
[22:48:23] davidcelis: or you could just move it into a partial when you actually _do_ need to use it elsewhere
[22:48:54] Criten: yeah.. true. but it does clean up your views when they are in partials too.
[22:49:26] lethjakman: Criten: it also makes it more of a pain to edit if you keep having to look for a partial
[22:49:43] Criten: i guess with some editors it does.
[22:50:14] lethjakman: Criten: do you have an editor that pulls the code from the partial into your view or something?
[22:50:16] Criten: Yeah.. it makes it so you have to open more files.
[22:50:28] Apane: thanks davidcelis!
[22:50:39] Criten: lethjakman, with vim and ctrl-p finding files is as easy as hitting ctrl-p and typing part of the file name
[22:50:51] Rubba: what's the easiest way to loop through numbers in ruby - 1..10.each do |n| ?
[22:50:53] lethjakman: Criten: that's exactly what I do, still more keystrokes though.
[22:50:53] Criten: but yes, it makes you need to open more files
[22:50:55] Criten: which is annoying
[22:51:22] lethjakman: Criten: I agree, how do you close your files when you're done?
[22:51:30] lethjakman: I use :bp | bd# and I find that to be a pain
[22:51:45] Criten: i normaly just reuse the pain for a new file
[22:52:42] pontiki: Rubba: if you use a range, bound it with parens: (1..10).each
[22:52:59] pontiki: i tend to do the 1.upto(10) though, but that's just taste
[22:53:22] Rubba: ah i see, just got an 'undefined method' error because of no parenthesis thanks :p
[22:54:03] pontiki: Rubba: just want to point out: [1..10] is not the same -- i see a lot of ppl make that mistake
[22:54:39] bzitzow_: What's the difference?
[22:54:41] Rubba: what would that be?
[22:55:09] davidcelis: Criten: I've never gotten ctrl-p for Vim to work as well as ctrl-p does in something like sublime.
[22:55:21] terrellt: Pop open irb and do [1..10].first
[22:55:23] davidcelis: sublime's fuzzy file finder just works. ctrl-p for vim consistently will return files i don't want as the best match.
[22:55:38] pontiki: yeah, play in irb, it will show it
[22:55:39] terrellt: It's an array with a range object stored in it.
[22:55:52] lethjakman: davidcelis: it works extremely well, what problem do you have with it?
[22:56:10] davidcelis: it doesn't give me the files i want.
[22:56:31] davidcelis: sublime usually will
[22:57:50] davidcelis: in vim: "amuser" gives app/controllers/admin/audits_controller.rb
[22:57:55] davidcelis: app/models/user.rb doesn't even come up on the list
[22:58:01] davidcelis: sublime, "amuser" gives me the user model
[22:58:10] davidcelis: (as just one example)
[22:59:01] davidcelis: hell, even just a search for "user" in ctrl-p doesn't give a _single_ file that actually has "user" as a string
[22:59:20] davidcelis: sublime brings the model up right away, and other various files actually named "user"
[22:59:30] davidcelis: everything in ctrl-p is just.... well, too fuzzy i guess
[22:59:31] Apane: if you look at the new.html.erb the admin field isn't working, it's not changing the admin boolean value to true in the schema when I click the check box. What am i doing wrong? https://gist.github.com/Apane/bbb7f74fdd64801cc04c
[22:59:31] eladmeidar: davidcelis: conclusion. ctrl-p is broken!
[22:59:53] davidcelis: eladmeidar: I didn't say that. I said it doesn't work as well as sublime's fuzzy matcher for me.
[23:00:08] davidcelis: eladmeidar: but thanks for putting words into my mouth anyway
[23:00:27] eladmeidar: davidcelis: i admit, i don't use vim. but just in case. maybe your "ctrl-p" package is the blame?
[23:00:40] eladmeidar: Apane: what?
[23:00:45] eladmeidar: yeah, split. thanks/
[23:00:49] davidcelis: eladmeidar: that's what i'm saying
[23:01:00] eladmeidar: davidcelis: is.. there another one you can check?
[23:01:12] davidcelis: i'm using "the" ctrl-p plugin
[23:01:24] davidcelis: https://github.com/kien/ctrlp.vim
[23:02:26] eladmeidar: davidcelis: here you go https://github.com/kien/ctrlp.vim/issues/418
[23:02:54] Apane: if you look at the new.html.erb the admin field isn't working, it's not changing the admin boolean value to true in the schema when I click the check box. What am i doing wrong? https://gist.github.com/Apane/bbb7f74fdd64801cc04c
[23:02:58] eladmeidar: davidcelis: follow that report - it leads to report 110.
[23:03:06] eladmeidar: davidcelis: seems like they have a solution
[23:04:01] eladmeidar: Apane: i didn't understand the firm time you wrote that. can you elaborate a bit more?
[23:04:40] Apane: if you go to https://gist.github.com/Apane/bbb7f74fdd64801cc04c and look at new.html.erb, you'll see an admin label
[23:04:53] Apane: when I click that checkbox i'd like the value in the schema under admin to be true
[23:05:19] Apane: right now it isn't working, it stays nil after clicking the checkbox
[23:05:37] eladmeidar: Apane: f.check_box :admin, true
[23:05:54] Apane: eladmeidar, Kk
[23:07:20] Apane: undefined method `merge' for true:TrueClass
[23:07:52] helpa: Apane: Rails: http://api.rubyonrails.org/ Ruby: http://www.ruby-doc.org/core/
[23:07:52] eladmeidar: Apane: !docs checkbox
[23:08:08] eladmeidar: Apane: check the right syntax.
[23:08:21] davidcelis: eladmeidar: oh heeeelllll yeah
[23:08:33] eladmeidar: davidcelis: congrats
[23:08:36] davidcelis: https://github.com/JazzCore/ctrlp-cmatcher
[23:08:39] eladmeidar: davidcelis: the power of google. :)
[23:09:00] davidcelis: i had googled it a while back but when i was busy at work and i ended up not actually doing anything
[23:09:03] davidcelis: but i like complaining, so...
[23:09:07] eladmeidar: davidcelis: yo dog, i heard you like packages so here is a package that fixes another package
[23:22:13] f0ster: http://i.imgur.com/c9Q28po.jpg
[23:25:44] bzitzow_: I am having a hard time figuring out how to get a collection of model objects and related objects inside of it.
[23:26:00] bzitzow_: I have levels which correspond to floor levels in a building and units which are building units
[23:26:03] bzitzow_: a level has many units
[23:26:38] skyjumper: bzitzow_: step 1 - provide code sample
[23:27:23] lectrick: I am trying to require action_view/helpers/tags/base, but I can't seem to get it to load that with that path and I don't know why
[23:27:43] lectrick: We have an expiring monkeypatch backport that I need to apply AFTER that file is loaded
[23:27:52] lectrick: So I am trying to require it first
[23:28:16] Radar: lectrick: code please
[23:28:35] bzitzow_: http://pastebin.com/mZu9wpva
[23:28:41] Radar: ACTION hugs helpa
[23:29:00] bzitzow_: haha okay helpa ;)
[23:29:05] bzitzow_: will that work *for now*?
[23:29:20] davidcelis: move it to gist plz kthx
[23:30:27] bzitzow_: https://gist.github.com/bzitzow/672ec18a335c7ba9c489
[23:30:33] lectrick: Radar! Hello! Here it is. But note that it depends on a custom Patcher (monkeypatch manager) class I wrote (which I need to gem out, but I digress): https://gist.github.com/pmarreck/e6b62c8f4be6e6ba5f63
[23:30:57] bzitzow_: So on line 30 I've also tried: @units = UnitLevel.joins(:units).where(:units => conditions).where(:level => params[:floor])
[23:30:58] lectrick: Radar: Line 21 is the one I can't get to not throw
[23:31:35] bzitzow_: because UnitLevel has many units, but that join does not include the units results in it either. Sorry if my approach is whacky, I'm really looking for guidance
[23:32:44] Rubba: is there any advantage to using rails form helpers vs typing them out myself?
[23:33:15] lectrick: Radar: Basically, the way this works is you define a method called "relevant?" which actually tests whether the monkeypatch is necessary by running code (this part can get complex unfortunately), and the Patcher class will run that asserting true, then run the patch block, then re-call relevant? asserting false, and if something goes wrong it handles
[23:33:37] Radar: lectrick: that code is insane.
[23:33:45] Radar: I can't help with code that insane unless I'm being paid to do it.
[23:34:10] bzitzow_: Radar would you take a peek at mine? ;)
[23:34:17] lectrick: Radar: To oversimplify it: I just want to require 'action_view/helpers/tags/base'. That's it.
[23:34:24] Radar: lectrick: then do that.
[23:34:33] davidcelis: lectrick: holy fuck WTF IS THAT
[23:35:11] Rubba: is there any advantage to using rails form helpers vs typing them out myself?
[23:35:16] Apane: Radar, I'm sure you've worked with CanCan before. what am i doing wrong here? http://stackoverflow.com/questions/17799159/assistance-with-cancan-gem-admin-boolean
[23:35:17] lectrick: it's an on the fly patcher that checks whether it should even monkeypatch before it actually monkeypatches :O
[23:35:35] davidcelis: Rubba: if you need to pass it a block
[23:35:40] Radar: bzitzow_: step 1) Don't use Rails built-in stuff to generate an API response. Use ActiveModel::Serializers, Rabl or (ew) jbuilder
[23:35:47] Radar: bzitzow_: once you're doing that, then we can help :)
[23:35:51] lectrick: Radar: Do you take Bitcoin? lol
[23:35:53] Rubba: davidcelis what dyou mean?
[23:35:54] davidcelis: ActiveModel::Serializers ++
[23:35:57] Radar: Rubba: they automatically fill in
[23:36:16] Radar: Apane: I actually volunteered to maintain CanCan this weekend. Ryan hasn't gotten back to me yet.
[23:36:19] bzitzow_: Radar / davidcelis okay that's good advice
[23:36:51] Apane: Radar, perfect!
[23:37:11] Radar: Apane: why is the admin field inside a fields_for?
[23:37:21] bzitzow_: I'm kind of looking for a quick solution today
[23:37:30] Radar: bzitzow_: that is the quick solution.
[23:37:31] Apane: Radar, was following the rails api but might not be applicable here
[23:37:33] bzitzow_: and I'm hearing my whole approach is wrong
[23:37:39] Apane: Radar, what should it be like
[23:38:05] Radar: Apane: <%= f.check_box :admin %^>
[23:38:07] Radar: without the ^
[23:38:18] Radar: *ahem* FUCK PAYPAL
[23:38:25] Radar: @message="The totals of the cart item amounts do not match order amounts.",
[23:38:35] Radar: Without indication of what the cart item amount is compared with the order amount/
[23:39:20] Radar: lectrick: no I don't accept imaginary money./
[23:39:43] davidcelis: Radar: curl -H 'Accept: application/json' http://foaas.herokuapp.com/you/paypal/Ryan%20Bigg
[23:40:08] lectrick: Radar: the value of all money is based on belief, otherwise it'd just be pieces of paper, but we digress
[23:40:30] Radar: lectrick: my main problem is that nobody I do business with accepts Bitcoin as a payment.
[23:40:32] davidcelis: or, better, yet... curl -H 'Accept: application/json' http://foaas.herokuapp.com/paypal/Ryan%20Bigg
[23:41:02] Apane: Radar, giving it a shot
[23:41:19] bzitzow_: I'm new to rails and ruby and was getting familiar with ActiveRecord. There is no way to embed the associated model data in a query response?
[23:41:24] lectrick: Radar: That is hopefully coming :) But I get your point.
[23:41:57] davidcelis: bzitzow_: do you mean like eager loading an association?
[23:42:13] bzitzow_: is it necessary to eager load it?
[23:42:26] Apane: Radar, admins still nil in the db. what am I doing wrong
[23:42:49] davidcelis: bzitzow_: if you want to avoid N+1 queries
[23:42:55] Radar: Apane: Shrug. Going to need more context than a form and a schema.
[23:43:14] Radar: Apane: what do the logs show for that action?
[23:43:40] bzitzow_: Yeah it's fine to eager load
[23:46:47] bzitzow_: davidcelis: would you mind helping me with an eager loading example that would give me units with the related unit_level data?
[23:46:55] Apane: Radar, logs aren't showing anything that stands out. take a look at www.github.com/leap/apane
[23:47:06] davidcelis: Unit.includes(:unit_levels)
[23:47:23] davidcelis: lol did you just include the www. subdomain on github.com
[23:47:24] Radar: 5 points from Gryffindor for a broken GH URL
[23:47:44] Radar: Apane: real link please
[23:48:16] Apane: Radar, www.github.com/apane/leap
[23:48:22] Apane: wrong order
[23:48:26] eladmeidar: ACTION cleans glasses
[23:48:40] Radar: Apane: steps to reproduce plzkthx
[23:48:54] freedrull: did logging change in rails 4? I don't see the request params hash in my log anymore....
[23:49:33] eladmeidar: freedrull: what is your log level?
[23:50:05] freedrull: eladmeidar: debug
[23:50:20] eladmeidar: freedrull: funky, can you paste a part of your log?
[23:50:28] bzitzow_: davidcelis: that did not include the unit_level data in the result set, only the unit_level_id is included
[23:50:34] Apane: Radar, any help is appreciated my man, thx in advanced
[23:50:48] davidcelis: bzitzow_: you call `unit_levels` on returned records
[23:50:55] davidcelis: that's how you access data for associations. load the associations
[23:51:04] freedrull: eladmeidar: https://gist.github.com/mcfiredrill/6058696
[23:51:24] freedrull: i think maybe this rails_12factor gem is overriding some log settings
[23:51:27] bzitzow_: davidcelis: is that why you told me to use ActiveModel::Serializeer
[23:51:29] eladmeidar: freedrull: and on your real logs? log/env.log ?
[23:51:35] davidcelis: bzitzow_: No
[23:51:40] davidcelis: oh this is for an API response
[23:51:42] davidcelis: i forgot who that was
[23:52:04] eladmeidar: davidcelis: have you been drinking sir?
[23:52:26] freedrull: eladmeidar: ah it shows up in log/development.log ... :\
[23:52:35] eladmeidar: freedrull: taa daa
[23:53:04] eladmeidar: freedrull: actually here it shows on the thin output as well. don't know dafuk why
[23:53:15] Radar: Apane: [09:48:40] <Radar> Apane: steps to reproduce plzkthx
[23:53:18] freedrull: eladmeidar: your thin output shows the params?
[23:53:19] eladmeidar: freedrull: but i usually tail the real log. not the web server output.
[23:53:23] Radar: Apane: Can't help if I don't know what I'm doing.e
[23:53:25] eladmeidar: freedrull: yap
[23:53:26] Radar: eladmeidar: hihi
[23:53:35] eladmeidar: Radar: having fun?
[23:53:41] Radar: eladmeidar: no
[23:53:55] Radar: about to give up on paypal and do something more productive like sticking rusty nails through my hands
[23:53:56] eladmeidar: Radar: you were too quite in the past couple of days - i knew something is going on
[23:54:21] freedrull: eladmeidar: yeah it was the 12factor gem that was the problem. can't remember why i installed that, probably because heroku told me to :\
[23:54:26] eladmeidar: Radar: you too? rsl was fighting the money laundering gods too
[23:54:40] eladmeidar: Radar: paypal sucks balls.
[23:54:43] davidcelis: eladmeidar: its only 5pm
[23:54:51] eladmeidar: davidcelis: legal
[23:54:53] Radar: eladmeidar: trying to get Spree and PayPal express to play nicely. I have no idea how I'm supposed to indicate tax amounts to a user.
[23:54:56] davidcelis: but, no, im not
[23:55:07] eladmeidar: freedrull: yeah, sounds like an heroku thing
[23:55:17] Radar: Apane: Still waiting. Radar is not a patient man.
[23:55:24] eladmeidar: Radar: nothing in the documentation of course.
[23:55:38] eladmeidar: Radar is a man?!
[23:55:39] Radar: eladmeidar: of course
[23:55:43] freedrull: so are most people just overriding RegistrationsController in devise to work with strong params? or is there a better solution out there
[23:55:54] Radar: freedrull: most of us are using Devise 3.0 :)
[23:56:01] eladmeidar: Radar: i think my old fiverr code may have something about it, want me to have a quick look?
[23:56:06] Radar: eladmeidar: sure thing
[23:56:15] eladmeidar: ACTION brings a shovel
[23:56:31] Radar: Apane: ok I'm giving up now. glhf.
[23:56:44] adizam: Oh fiverr
[23:57:35] Radar: Apane: there is no users_controller code in your app
[23:57:38] freedrull: ah i see, devise 3 has a mechanism for handling strong params
[23:57:38] Radar: :(((((((((((((((((((((
[23:57:48] jabagawee: just joined two tables A and B, both with a "name" column. search_results = search_results.where("name LIKE 'foo'") gives an ambiguous name error, but search_results = search_results.where("A.name LIKE 'foo'") is giving me a missing FROM clause error
[23:58:10] jabagawee: is there a "correct" way to go about things
[23:58:57] eladmeidar: Radar: didn't find the code yet, but on the task board theres a comment that says this
[23:58:57] Apane: Radar, i didn't know i needed one i'm using devise
[23:59:22] eladmeidar: Radar: "express checkout taxes - on DoExpressCheckoutPayment, use PAYMENTREQUEST_0_TAXAMT"
[23:59:28] Radar: Apane: then where is this magical form of yours?
[23:59:52] eladmeidar: adizam: oh fiverr yourself