« Back to channel list

#RubyOnRails - 08 October 2015

« Back 1 day Forward 1 day »
[00:00:08] sevenseacat: has joined #RubyOnRails
[00:00:14] nya: has joined #RubyOnRails
[00:00:20] VeryBewitching: has joined #RubyOnRails
[00:00:26] speakingcode: has joined #RubyOnRails
[00:00:27] nickenchuggets: has joined #RubyOnRails
[00:00:46] hadees: has joined #RubyOnRails
[00:03:07] ericjphillips: has joined #RubyOnRails
[00:03:57] RockLee: has joined #RubyOnRails
[00:06:41] Moonlight-Angel: has joined #RubyOnRails
[00:06:53] SteenJobs_: has joined #RubyOnRails
[00:13:37] diegoviola: has joined #RubyOnRails
[00:14:04] sypheren: has joined #RubyOnRails
[00:14:22] neanderslob_: has joined #RubyOnRails
[00:16:09] chouhoulis: has joined #RubyOnRails
[00:16:10] diegoviola: has joined #RubyOnRails
[00:17:25] nickenchuggets: has joined #RubyOnRails
[00:18:08] dopamean_: has joined #RubyOnRails
[00:18:47] losvedir: has joined #RubyOnRails
[00:24:36] havenwood: has joined #RubyOnRails
[00:24:42] sethetter: has joined #RubyOnRails
[00:28:07] aaronr: has joined #RubyOnRails
[00:28:32] loglaunch: has joined #RubyOnRails
[00:28:33] Scient: has joined #RubyOnRails
[00:29:00] northfurr: has joined #RubyOnRails
[00:29:55] nickyd: has joined #RubyOnRails
[00:30:00] jenrzzz: has joined #RubyOnRails
[00:31:37] Joufflu: has joined #RubyOnRails
[00:32:40] Silex: has joined #RubyOnRails
[00:37:42] siddart: has joined #RubyOnRails
[00:38:34] Contigi: has joined #RubyOnRails
[00:45:14] FailBit: https://i.imgur.com/oCHD82i.jpg
[00:45:20] Swappticon: has joined #RubyOnRails
[00:46:15] xcv: has joined #RubyOnRails
[00:48:41] User458764: has joined #RubyOnRails
[00:50:17] pydave6367: has joined #RubyOnRails
[00:51:12] diegoviola: has joined #RubyOnRails
[00:51:44] bkulbida: has joined #RubyOnRails
[00:52:39] nya: has joined #RubyOnRails
[00:54:49] FailBit: my client is being weird...
[00:54:58] Lytol: has joined #RubyOnRails
[00:57:55] EminenceHC: has joined #RubyOnRails
[00:58:29] lxkm__: has left #RubyOnRails: ()
[01:00:46] lxkm: has joined #RubyOnRails
[01:05:18] twilling: has joined #RubyOnRails
[01:05:36] weaksauce: has joined #RubyOnRails
[01:07:16] hadees: has joined #RubyOnRails
[01:08:45] sankaber: has joined #RubyOnRails
[01:08:46] jenrzzz: has joined #RubyOnRails
[01:08:54] mloy_: has joined #RubyOnRails
[01:08:59] fedexo: has joined #RubyOnRails
[01:11:44] EminenceHC: has joined #RubyOnRails
[01:12:39] losvedir: has joined #RubyOnRails
[01:13:08] chills42: has joined #RubyOnRails
[01:13:26] baweaver: has joined #RubyOnRails
[01:15:31] Guest81258: has joined #RubyOnRails
[01:16:38] EminenceHC: has joined #RubyOnRails
[01:18:32] pydave6367: has joined #RubyOnRails
[01:19:02] stardiviner: has joined #RubyOnRails
[01:20:06] jesterfraud: has joined #RubyOnRails
[01:22:42] hadees: has joined #RubyOnRails
[01:25:57] wildlander: has joined #RubyOnRails
[01:27:19] Pharaoh2: has joined #RubyOnRails
[01:31:10] rhizome: good times
[01:32:02] ritic: has joined #RubyOnRails
[01:33:40] riotjones: has joined #RubyOnRails
[01:35:25] Rin: has joined #RubyOnRails
[01:37:14] Sebas1509: has joined #RubyOnRails
[01:37:34] Sebas1509: has left #RubyOnRails: ()
[01:38:08] Sebas1509: has joined #RubyOnRails
[01:38:18] RockLee: has joined #RubyOnRails
[01:38:28] Sebas1509: has left #RubyOnRails: ()
[01:39:56] nopajjj: has joined #RubyOnRails
[01:40:29] workmad3: has joined #RubyOnRails
[01:41:13] User458764: has joined #RubyOnRails
[01:43:22] jtperreault: has joined #RubyOnRails
[01:45:28] Scripore: has joined #RubyOnRails
[01:47:24] dopamean_: has joined #RubyOnRails
[01:47:53] Pharaoh2: has joined #RubyOnRails
[01:49:34] beauby_: has joined #RubyOnRails
[01:50:32] lessless: has joined #RubyOnRails
[01:53:52] borodin: has joined #RubyOnRails
[01:58:50] RegulationD: has joined #RubyOnRails
[01:59:59] babykosh: has joined #RubyOnRails
[02:00:55] circ-user-u7TFZ: has joined #RubyOnRails
[02:01:22] mices: has joined #RubyOnRails
[02:04:25] lynchd2: has joined #RubyOnRails
[02:06:17] DanKnox: has joined #RubyOnRails
[02:06:21] yfeldblum: has joined #RubyOnRails
[02:07:34] pydave6367: has joined #RubyOnRails
[02:08:11] mices: if i join the users table with the messages table on the id field of the users table what would be the right name to give the foreign key in the messages table
[02:08:35] mices: user_id ?
[02:08:44] mices: is that what rails would expect?
[02:08:56] |T_T|: has joined #RubyOnRails
[02:09:12] craysiii: why dont you look in your schema?
[02:09:35] mices: the tables haven't been created yet
[02:09:41] smathy: mices, !associations
[02:09:41] helpa: mices: http://guides.rubyonrails.org/association_basics.html - Active Record Association Basics by Mike Gunderloy
[02:10:24] hadees: has joined #RubyOnRails
[02:11:06] moeabdol: In Rails, I want to learn how to invoke ajax to call a controller action and then modify the view according to the ajax response. Can anyone point me to a good thorough read? Thanks
[02:11:59] hadees: has joined #RubyOnRails
[02:12:06] sevenseacat: http://guides.rubyonrails.org/working_with_javascript_in_rails.html
[02:12:47] mices: it says what i said, the answer is user_id
[02:12:53] mices: but it's a great guide
[02:12:55] sevenseacat: mices: so do it!
[02:13:08] Flyy7: has joined #RubyOnRails
[02:13:29] sevenseacat: if you stuff it up, then you fix it
[02:15:24] EminenceHC: has joined #RubyOnRails
[02:15:36] mices: am i supposed to create it or the has_many statement's gonna create it for me?
[02:16:21] helpa: Why don't you try it and find out for yourself?
[02:16:45] sevenseacat: it is *always* quicker for you to try something than formulate a question and ask us
[02:17:48] ishikawa91: has joined #RubyOnRails
[02:18:01] nickenchuggets: has joined #RubyOnRails
[02:18:01] nickenchuggets: has joined #RubyOnRails
[02:18:11] sevenseacat: 99.999999999% of the time.
[02:18:27] sevenseacat: especially when the questions are 'if i write this line of code, what happens'
[02:21:14] baweaver: Really, if you tend to ask those types of questions repeatedly you're going to get ignored
[02:22:02] baweaver: there's only a certain level of tolerance for hand-holding, and it wears thin when people don't do some legwork of their own.
[02:22:03] ruby-lang045: has joined #RubyOnRails
[02:22:30] tubbo: baweaver: i'd rather hold your legs ;-*
[02:23:10] baweaver: tubbo: buy me dinner first
[02:26:14] smathy: ACTION does his best to make it quicker to just try
[02:28:16] lynchd2: has left #RubyOnRails: ()
[02:28:34] shmilan: has joined #RubyOnRails
[02:28:52] bruno-: has joined #RubyOnRails
[02:29:01] tubbo: you ever try just answering
[02:29:27] craysiii: does rails 4 not have group_by? i ask because i am being instructed to use it and using rails 4 and apidock says its been moved or deprecated, but i don't know what is analogous.
[02:30:23] tubbo: craysiii: i think it's `group` if you want to do a GROUP BY query
[02:30:29] Radar: baweaver: I think we can advise people to try it when they ask questions like that
[02:30:35] Radar: just keep saying "try it" again and again
[02:30:39] tubbo: http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-group
[02:30:54] tubbo: craysiii: like i think group_by will still "work" but it will use Enumerable's group_by
[02:31:37] craysiii: thats the thing, it did work, but when i inspected it in my view, it's not grouped lol.
[02:32:00] craysiii: so it didn't work but it didn't 'not work'
[02:32:18] Pharaoh2: has joined #RubyOnRails
[02:32:43] baweaver: SQL group by is a much different concept
[02:33:42] baweaver: you may want to read through how SQL works with it
[02:33:57] baweaver: as it can be very beneficial to your AR knowledge to know how it's shuffling queries
[02:34:58] tubbo: wow, looking through the rails docs just now...noticed this class: ActiveRecord::QueryMethods::WhereChain
[02:34:59] baweaver: http://www.sqlcourse2.com/groupby.html and http://blog.jooq.org/2014/12/04/do-you-really-understand-sqls-group-by-and-having-clauses/
[02:35:23] tubbo: so if you were to, say, decorate that class with .or(), .within(), etc....
[02:35:30] baweaver: tubbo: probably so it knows how to evaluate all of those
[02:35:33] tubbo: .matches()
[02:35:39] baweaver: handy that it's lazy
[02:35:47] tubbo: baweaver: yeah, it's basically so you can do Model.where.not()
[02:35:58] tubbo: originally where() was just another query method, i guess it returns a WhereChain now
[02:36:27] baweaver: or some association chain
[02:36:27] tubbo: i feel like you could do a lot with that though
[02:36:28] sevenseacat: so happy that or() is finally coming in rails 5 - welcome to the 21st century rails
[02:36:50] baweaver: tubbo: http://baweaver.com/blog/2015/05/04/sublime-scoping-with-rails/ oh you can
[02:36:50] tubbo: Model.where.greater_than(Time.now).or.less_than(3.days.ago)
[02:36:58] ruby-lang045: What's the easiest way to create an endpoint where I can allow the user to look something up by name? So say there's a Post model which has an attribute name.
[02:37:10] tubbo: i forgot about ranges
[02:37:12] baweaver: I _really_ need to fix that dang typo
[02:37:12] Radar: ruby-lang045: rails g controller
[02:37:17] Radar: ruby-lang045: What have you tried?
[02:37:19] shmilan: Is there a general consensus here that Hartl's Ruby on Rails tutorial is the best overall introduction to Rails?
[02:37:20] ruby-lang045: Instead of /post/2, could I get something like /post/hello working?
[02:37:34] craysiii: checkout has_permalink gem
[02:37:36] tubbo: ^ classic rails
[02:37:52] Radar: shmilan: I disagree that it is the best. I disagree _so much_ that I wrote a book about it: http://manning.com/bigg2 TWICE.
[02:37:58] ruby-lang045: Radar: I was trying to create a new method in the controller show_by_name
[02:37:59] rhizome: shmilan: google "rails slugs"
[02:38:01] Radar: Second time was with the help of sevenseacat.
[02:38:15] Radar: who tbf, wrote pretty much at least the last half of the book
[02:38:21] tubbo: rhizome: wat lol
[02:38:24] ruby-lang045: where I did @post.find_by_name(params[:name])
[02:38:32] tubbo: oh i think you meant to post that to ruby-lang045
[02:38:37] Radar: ruby-lang045: and what are you having trouble with?
[02:38:41] shmilan: :Radar Thanks!
[02:38:43] sevenseacat: the book is a lot different than it would have been without my input, thats for sure.
[02:38:46] tubbo: rhizome: incidentally that would be a great name for a book
[02:38:49] sevenseacat: I think it's for the better.
[02:39:01] ruby-lang045: Radar: I'm not sure how to set up the routes, I guess
[02:39:10] Radar: ruby-lang045: can you show us what you have currently?
[02:39:11] tubbo: i think the best introduction to rails is `rails new`.
[02:39:24] shmilan: :rhizome Will do
[02:39:25] rhizome: ruby-lang045: google "rails slugs"
[02:39:27] ruby-lang045: Radar: what's the best way to post code here?
[02:39:33] Radar: ruby-lang045: !gist
[02:39:33] helpa: ruby-lang045: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[02:39:44] Radar: tubbo: You mean to say the best way to learn how to build Rails apps is to keep building Rails apps? :O
[02:40:06] CheckYourSix: has joined #RubyOnRails
[02:40:06] tubbo: Radar: i know, i know, it's a popular opinion in a channel run by book authors
[02:40:11] tubbo: s/popular/unpopular
[02:40:21] tubbo: god dammit i fucked the whole joke up :(
[02:40:25] sevenseacat: I agree with it 100%, but you need to know the basics first
[02:40:30] sevenseacat: otherwise you run `rails new` and go 'ok, what now'
[02:40:38] Radar: tubbo: This despotic dictatorship we've got going is really fun!
[02:40:44] ruby-lang045: cool, thanks. I think I'll just stick to the endpoint accepting a parameter for name instead of putting the name in the URL
[02:40:52] tubbo: yeah that's true
[02:40:56] tubbo: i used railscasts to give me inspiration
[02:41:04] tubbo: but you can't really do that as much as you used to
[02:41:11] sevenseacat: tubbo: how is that going to help when you don't know the difference between a model and a view
[02:41:45] ngscheurich: has joined #RubyOnRails
[02:43:12] jun_: has joined #RubyOnRails
[02:43:36] craysiii: ruby-lang045 check out has_permalink gem.
[02:43:39] tubbo: yeah true
[02:44:02] Radar: ruby-lang045: Do you want this so that people access posts at like /posts/hello-world instead of /posts/1?
[02:44:05] tubbo: but like, anything that's telling you "this is teaching you rails" is going to teach you that, right?
[02:44:17] tubbo: vs. a book like rails recipes which was more like "here's a bunch of things you can do with rails"
[02:48:57] ruby-lang045: craysiii: Radar: thanks, I think I'm all set. I originally wanted it for something completely different (not SEO or remapping, but an endpoint to retrieve data externally), but I settled on just having the client pass the name as a param
[02:49:10] ruby-lang045: what does on: :collection do for routes?
[02:49:26] User4587_: has joined #RubyOnRails
[02:50:12] Radar: ruby-lang045: Could you show us the context of that please?
[02:51:00] ruby-lang045: If I have something like
[02:51:15] ruby-lang045: resources :posts do
[02:51:19] helpa: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[02:51:32] ruby-lang045: get 'show_by_name', on: :collection
[02:51:33] nej: how do I log to a special log file from within an ActiveJob::Base subclass?
[02:51:42] Aeyrix: ruby-lang045: !code
[02:51:42] helpa: ruby-lang045: 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.
[02:51:44] Aeyrix: Also !fake
[02:51:48] Aeyrix: fuck i knew that wouldn't work
[02:52:16] ruby-lang045: I think I figured it out that. It'll recreate a route thats /posts/show_by_name vs. /posts/:id/show_by_name
[02:52:55] zoidfarb: has joined #RubyOnRails
[02:53:17] helpa: We're not all guys here - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
[02:53:21] zoidfarb: Can somebody help me understand this SO answer? https://stackoverflow.com/questions/6748168/changing-rails-3-apps-layout-based-on-the-hostname-domain-for-branding And is that still valid for Rails 4?
[02:53:45] drupald: has joined #RubyOnRails
[02:53:54] zoidfarb: What is a Proc, and how do I make it actually change the layout?
[02:53:57] sevenseacat: zoidfarb: seems like a legit, albeit basic, approach
[02:54:06] Radar: zoidfarb: That goes in your controller, inside the class but outside any actions.
[02:54:09] sevenseacat: `layout` is a controller method that sets the layout
[02:54:15] sevenseacat: so that would set the layout to be the current hostname
[02:54:31] sevenseacat: eg. it would use foo.com layout instead of application layout
[02:54:31] zoidfarb: And then you define a layout that matches that hostname?
[02:55:02] zoidfarb: Is there a better approach to this? One thing that occurs to me is it will make testing difficult, since the hostname will be different
[02:55:16] craysiii: im stupid. they wanted me to use Ruby's group_by, not rails.
[02:55:17] Radar: You can set the host in tests.
[02:55:18] sevenseacat: set the hostname in your tests
[02:55:38] jesterfraud: has joined #RubyOnRails
[02:55:39] zoidfarb: Basically, I want the same codebase to power two different sites, with different skins
[02:55:50] Aeyrix: do we have
[02:55:51] helpa: Multitenancy With Rails - https://leanpub.com/multi-tenancy-rails-2 - An excellent book that teaches you about building a Multitenanted Rails application. Written by Ryan Bigg.
[02:55:54] zoidfarb: And some minor differences in the controllers ( hiding certain categories)
[02:55:59] Aeyrix: IT'S ON THE BOARD
[02:56:12] zoidfarb: ah, that sounds nice
[02:56:23] tubbo: i was gonna get multitenancy for rails but then i just did gem 'apartment' ;)
[02:56:35] Aeyrix: tubbo: That's all that book is
[02:56:36] Aeyrix: it's just one page
[02:56:38] Aeyrix: linking to that gem
[02:56:57] tubbo: "why did i pay $35 for this??"
[02:57:00] tubbo: "god dammit Radar"
[02:57:08] Radar: tubbo: ;)
[02:57:08] havenwood: has joined #RubyOnRails
[02:57:11] Aeyrix: It's like r4ia
[02:57:14] Aeyrix: was just a link to the rails guides
[02:57:15] Radar: It's more than that, but sure :P
[02:57:23] craysiii: you just saved me $$$!! :P
[02:57:23] zoidfarb: I'm not sure I really need a true "multi-tenancy" solution. I'm going to have the same database driving both sites
[02:58:00] zoidfarb: The two separate domains are really just a marketing ploy that will highlight different products and features
[02:58:01] tubbo: ah, so you really want to serve up a different view layer based on the domain, zoidfarb.
[02:58:21] stardiviner: has joined #RubyOnRails
[02:58:29] tubbo: you can do that with different layouts
[02:58:37] zoidfarb: Different view layer, and different featured products on the home page
[02:59:07] tubbo: right, well with some metaprogramming you can probably use the same controller
[02:59:14] zoidfarb: I'm imagining a different set of view templates, and some minor if statements in the controller
[02:59:18] zoidfarb: oh, that's intriguing
[02:59:28] tubbo: zoidfarb: but what you might need to take advantage of is a method to define what layout you want.
[02:59:56] zoidfarb: I'm coming from a Python background, so I'm less familiar with the Ruby approach to metaprograming
[03:00:11] zoidfarb: Any resources you can link me to would be greatly appreciated
[03:00:28] tubbo: zoidfarb: http://guides.rubyonrails.org/layouts_and_rendering.html
[03:00:43] User458764: has joined #RubyOnRails
[03:00:43] tubbo: zoidfarb: search on that page for " Choosing Layouts at Runtime"
[03:00:46] tubbo: that's what you want.
[03:01:10] tubbo: i use that a lot to conditionally not show a layout if the request is XHR...so that my ajax requests respond without layouts included.
[03:01:13] zoidfarb: tubbo: Thanks. Ruby lets you modify existing object instances on the fly, right? Is that what I'd want to do with my controller?
[03:01:14] tubbo: i only get the markup that i need
[03:01:24] tubbo: zoidfarb: nah, you shouldn't need to do that.
[03:01:39] `based_pdev`: has joined #RubyOnRails
[03:02:09] zoidfarb: What's the difference between a "layout" and a "view"?
[03:04:08] roshanavand: has joined #RubyOnRails
[03:04:38] krz: has joined #RubyOnRails
[03:04:49] craysiii: is it worth it to write a model spec for a model that doesn't have any real validations?
[03:04:59] craysiii: or is there a point?
[03:06:09] tubbo: zoidfarb: you can think of views as analogous to pages
[03:06:19] tubbo: zoidfarb: but a layout is applied to every page
[03:07:27] zoidfarb: tubbo: That sounds perfect for me.
[03:09:05] zoidfarb: tubbo: Yeah, this looks like exactly what I need. You mentioned I can maybe use the same controller? Is there any more clever/better approach than just `if request.host == ... else ... `
[03:09:57] tubbo: zoidfarb: you could make a scope on Product that takes a domain as the argument, then query where domain: passed_in_domain in the scope
[03:10:39] nej: how do I parallelize my active jobs so they run simultaneously? use multiple queues?
[03:10:40] tubbo: or you could just do it right in the controller like Product.where(domain: request.host)
[03:11:01] tubbo: nej: multiple workers, i think
[03:11:04] braincrash: has joined #RubyOnRails
[03:11:11] sarink: has joined #RubyOnRails
[03:11:12] nej: tubbo: oh, right, of course ??? it's late here ^_^ I'll try that at once
[03:11:19] tubbo: multiple queues if you want to prioritize certain things i suppose
[03:11:22] nej: I hope my log will still look neat
[03:11:23] tubbo: or you want to control RAM usage
[03:12:19] freedrul1: has left #RubyOnRails: ()
[03:14:16] jun_: has joined #RubyOnRails
[03:14:52] yfeldblum: has joined #RubyOnRails
[03:17:07] nej: hrmm???
[03:17:17] nej: tubbo: do you have experience with backburner and beanstalkd?
[03:17:58] bobbobbins: has joined #RubyOnRails
[03:18:41] hadees: has joined #RubyOnRails
[03:19:44] dopie: has joined #RubyOnRails
[03:20:15] nej: can it really be true that I have to start multiple instances of backburner? I could've sworn I saw some --number-of-works flag or something somewhere, but I don't think so
[03:20:33] nej: s/start/manually start
[03:24:33] jesterfraud: has joined #RubyOnRails
[03:24:40] Lytol: has joined #RubyOnRails
[03:25:53] ElSif: has joined #RubyOnRails
[03:28:34] workmad3: has joined #RubyOnRails
[03:29:37] zoidfarb: has joined #RubyOnRails
[03:31:49] northfurr: has joined #RubyOnRails
[03:31:51] nej: yeeeah, I should really get more l33t at understanding threading???
[03:32:53] ngscheurich: has joined #RubyOnRails
[03:33:04] nej: ???You may have encountered a bug in the Ruby interpreter or extension libraries??? ??? cool
[03:34:08] riotjones: has joined #RubyOnRails
[03:41:24] willardg: has joined #RubyOnRails
[03:42:27] moeabdol: has joined #RubyOnRails
[03:43:20] jesterfraud: has joined #RubyOnRails
[03:49:46] eliasbagley: has joined #RubyOnRails
[03:53:48] bricker: has joined #RubyOnRails
[03:56:29] Pharaoh2: has joined #RubyOnRails
[03:57:35] fre: has joined #RubyOnRails
[03:59:38] RegulationD: has joined #RubyOnRails
[04:00:26] pawnbox: has joined #RubyOnRails
[04:01:31] ivanskie: has joined #RubyOnRails
[04:02:31] towski_: has joined #RubyOnRails
[04:02:42] jso-: has joined #RubyOnRails
[04:02:50] ivanskie: has joined #RubyOnRails
[04:03:18] ivanskie: so what do you guys think... wave or xero?
[04:03:49] northfurr: has joined #RubyOnRails
[04:04:37] prestorium: has joined #RubyOnRails
[04:05:51] pawnbox_: has joined #RubyOnRails
[04:06:08] jesterfraud: has joined #RubyOnRails
[04:07:03] armyriad: has joined #RubyOnRails
[04:07:18] chrisarcand: has joined #RubyOnRails
[04:07:19] cjk101010: has joined #RubyOnRails
[04:10:27] nibbo: has joined #RubyOnRails
[04:15:54] rubyonrails605: has joined #RubyOnRails
[04:25:24] youngbaks: has joined #RubyOnRails
[04:25:55] RockLee: has joined #RubyOnRails
[04:31:35] Pharaoh2: has joined #RubyOnRails
[04:31:58] _djbkd: has joined #RubyOnRails
[04:36:05] chouhoulis: has joined #RubyOnRails
[04:40:55] idd2d: has joined #RubyOnRails
[04:42:59] nibbo: has joined #RubyOnRails
[04:43:29] Cervajz: has joined #RubyOnRails
[04:44:01] jenrzzz: has joined #RubyOnRails
[04:45:33] Cervajz_: has joined #RubyOnRails
[04:46:02] joshkovach: has joined #RubyOnRails
[04:46:19] sysx1000: has joined #RubyOnRails
[04:47:15] EminenceHC: has joined #RubyOnRails
[04:47:40] willardg: has joined #RubyOnRails
[04:48:05] sysx1000: Hello! Rails4 questions. I would like that rake assets:precompile will move all precompiled assets to another path (for example /srv/site/assets, which is memoryfs backed stuff), Same time, I'd like to have some robots.txt, error pages, other things stay in app's public folder.
[04:48:13] yfeldblum: has joined #RubyOnRails
[04:48:17] jesterfraud: has joined #RubyOnRails
[04:48:25] xcv: has joined #RubyOnRails
[04:49:51] kiloreux_: has joined #RubyOnRails
[04:50:24] bePolite: has joined #RubyOnRails
[04:50:33] User458764: has joined #RubyOnRails
[04:52:00] Ropeney: did you work out your solution?
[04:52:36] sysx1000: not yet, I've torned among two solutions: 1) local storage 2) some sort of cloud storage like Fog
[04:52:59] Ropeney: sysx1000: That seems different to your question, but what about sym linking your assets folder to /srv/site/assets ?
[04:53:52] chipotle: what is teh service called in AWS that runs a rails server for you? or do you use ec2 and then set it up as a vps?
[04:54:05] chipotle: because that's what heroku and engineyard are for...?
[04:54:40] sysx1000: chipotle: at the moment I have vanilla VPS
[04:54:46] sysx1000: with no specific services
[04:55:04] chipotle: that's what i've always had
[04:55:08] chipotle: but i want to learn "cloud"
[04:55:25] chipotle: so i'm trying out the free tier
[04:55:34] sysx1000: Ropeney: symlinking is not yet good
[04:56:04] rushed: ya another few years and maybe they'll get those symlinks working~
[04:57:03] Ropeney: sysx1000: What do you mean `not yet good` ?
[04:58:20] Ropeney: you cant just do `sudo ln -s /directory/public/assets/ /srv/site/assets/` ?
[04:58:56] sysx1000: I do not want to handle or deal with symlinks. I want: 1) Assets on memory backed fs 2) Carrierwave uploads elsewhere 3) Static stuff from codebase inside application hier
[05:00:05] sysx1000: delivery backend is nginx, so rails only should know, where to put files
[05:01:01] rhizome: you mean like ramdisk?
[05:01:09] pawnbox: has joined #RubyOnRails
[05:01:50] Ropeney: i don't get why your discarding symlinks though
[05:01:58] sysx1000: tbh, it would be file to move assets away to s3 or something, but at the moment, I have no s3 and I won't have or won't go for it in near future
[05:02:07] sysx1000: file = fine
[05:02:33] sysx1000: Ropeney, it's hard to track and maintain
[05:03:08] rhizome: capistrano symlinks are very easy to understand
[05:03:40] l_tonz: has joined #RubyOnRails
[05:04:40] sysx1000: I understand that symlinks is supermagic ultra-hyper-power rod 70th level, but I asked for Rails way initially :)
[05:05:11] Ropeney: just put it in fstab and be done with it :)
[05:05:26] sysx1000: Isn't that hard to make precompilation tbd in another folder?
[05:05:52] sysx1000: Ropeney, fstab is dark occult magic
[05:05:57] rhizome: rails doesn't care. it's happy to let you precompile from scratch into public/assets every time you deploy
[05:08:50] willardg: has joined #RubyOnRails
[05:09:00] pawnbox: has joined #RubyOnRails
[05:09:07] Shoutsid: has joined #RubyOnRails
[05:09:39] krz: has joined #RubyOnRails
[05:13:10] dopie: hey Radar hows life these days
[05:13:16] arup_r: has joined #RubyOnRails
[05:13:21] Radar: it is good
[05:13:42] dopie: How is it good?
[05:13:50] Radar: Just got approved for a new rental.
[05:14:01] dopie: You in Australia?
[05:14:16] Radar: And this is the first day I feel like I'm operating at above 75% capacity since getting back from my holiday last week.
[05:14:58] rushed: has joined #RubyOnRails
[05:15:30] RegulationD: has joined #RubyOnRails
[05:15:56] Radar: But I am still looking at this CoffeeScript-converted-to-JS and going "DUHHH"
[05:16:08] dopie: I'm having a problem with capistrano It's a weird error I'm getting with bundler and it's a brand new project, do you mind looking at the error and helping me diagnose whats going on?
[05:16:24] sevenseacat: CoffeeScript will do that to qanyone.
[05:16:29] craysiii: no, what is it
[05:16:29] Radar: I'm about to head out but I think sevenseacat is free :P
[05:16:34] Radar: craysiii: !unworthy
[05:16:34] helpa: craysiii: You are not worthy of this bot!
[05:16:41] workmad3: has joined #RubyOnRails
[05:16:47] dopie: https://gist.github.com/staycreativedesign/275e7120dfe20ab065ab
[05:17:22] sevenseacat: dopie: you didnt bundle before trying to precompile?
[05:17:23] Radar: dopie: config/deploy.rb and Capfile please
[05:18:02] sysx1000: has left #RubyOnRails: ()
[05:18:07] htmldrum: has joined #RubyOnRails
[05:18:15] dhjondoh: has joined #RubyOnRails
[05:19:07] dopie: https://gist.github.com/staycreativedesign/275e7120dfe20ab065ab
[05:19:19] adefa: has joined #RubyOnRails
[05:21:22] sanjayu: has joined #RubyOnRails
[05:22:54] chrissonar: has joined #RubyOnRails
[05:22:56] zerocool: has joined #RubyOnRails
[05:24:00] tsujp: has joined #RubyOnRails
[05:25:11] iliketurtles: has joined #RubyOnRails
[05:26:07] trautwein: has joined #RubyOnRails
[05:26:24] fre: has joined #RubyOnRails
[05:26:55] adefa: Is it possible to add computed columns to an eager_loaded query? I"m using PSQL and joins with subqueries to aggregate averages from an association.
[05:27:28] mrburied: adefa: show your code please
[05:27:34] riotjones: has joined #RubyOnRails
[05:29:20] Pharaoh2: has joined #RubyOnRails
[05:30:16] adefa: mrburied: https://gist.github.com/TrevorS/fee53e2c51d240a775b7
[05:30:56] dopie: Radar, sevenseacat thank you for showing interest in my question I have figured it out and it ws a server issue
[05:31:27] Lightsword: has joined #RubyOnRails
[05:31:46] adefa: mrburied: im trying to get avg_overall to be attached to listings. overall is correctly attached to listing_reviews.
[05:32:50] mrburied: adefa: Your query is like a story.. Let me read slowly.. seems you got very complex business logic .. :D
[05:33:40] riotjones: has joined #RubyOnRails
[05:36:11] mrburied: well. I read it 3 times, and didn't get what you meant.
[05:36:25] mrburied: correctly attached means ?
[05:37:24] chouhoulis: has joined #RubyOnRails
[05:38:17] adefa: mrburied: if i do Listings.for_search.first.booking_requests.listing_review.overall, i get that computed overall field without an additional query to the DB. if i try to do Listing.for_search.first.avg_overall, there is no method defined.
[05:39:53] A124: has joined #RubyOnRails
[05:39:56] Spami: has joined #RubyOnRails
[05:40:12] moeabdol: has joined #RubyOnRails
[05:41:29] krz: has joined #RubyOnRails
[05:43:05] mrburied: adefa: ok. You have to explicitly select the column then outside of the query. The selects have in SQL level used inside the inner query
[05:43:48] mrburied: after the 2 .joins do like .joins(..).joins(..).select("<fields you want to see>")
[05:44:33] adefa: mrburied: tried that, didnt work
[05:44:37] joshkovach: has joined #RubyOnRails
[05:45:50] adefa: mrburied: updated gist: https://gist.github.com/TrevorS/fee53e2c51d240a775b7
[05:48:18] mrburied: adefa: Really dunno how your first long chain worked that way. Generally I hoped it wouldn't work.
[05:48:59] jesterfraud: has joined #RubyOnRails
[05:49:13] mrburied: Because no idea how it got attached there.
[05:50:01] mrburied: do you have a overall field in the model listing_review ?
[05:50:08] mrburied: explicit field ?
[05:50:34] adefa: no, only computed
[05:53:07] lessless: has joined #RubyOnRails
[05:54:18] rvanlieshout: adefa: what should this for_search method return? array of that lr2.avg_overall?
[05:54:45] SteenJobs: has joined #RubyOnRails
[05:55:41] tagrudev: has joined #RubyOnRails
[05:55:43] Lytol: has joined #RubyOnRails
[05:56:40] adefa: rvanlieshout: listings with all of the associations preloaded, with 'overall' attached to each listing review and 'avg_overall' attached to each listing
[05:57:20] rvanlieshout: if you want to add additional attributes you'll have to select listings.* too
[05:57:33] rvanlieshout: and i would consider just using includes and not eager loads
[05:57:40] rvanlieshout: you're not using all those tables in conditions
[05:58:01] rvanlieshout: so explicitly using a left join is a bad approach compared to one separate query per association
[05:58:25] EminenceHC: has joined #RubyOnRails
[05:58:36] adefa: rvanlieshout: this is just the base query, where clauses will be dynamically added to it
[05:59:35] rvanlieshout: and those conditions would affect thins like lising_photos? or listing_blackout_dates?
[05:59:46] adefa: yeah probably not
[05:59:54] rvanlieshout: then don't use a left join
[05:59:59] rvanlieshout: it's the slowest join possible
[06:00:08] rvanlieshout: well.. maybe a right join is a bit slower
[06:00:28] rvanlieshout: so change the eager_loadto includes
[06:00:29] adefa: if i switch the eager_load to includes, then my joins further down dont work
[06:00:43] rvanlieshout: well.. you need to eager load the one you need in your own joins
[06:01:08] rvanlieshout: and add listings.* to your select
[06:01:22] rvanlieshout: or consider an approach where the avg_overall is a method on listing that gets caluclated on a per instance base
[06:02:13] adefa: rvanlieshout: would prefer to avoid hitting the database for that computation for each listing returned
[06:02:31] rvanlieshout: that's not a bad thing per se
[06:03:58] mrburied: adefa: If that query is a frquent one.. build a _view_
[06:04:11] krz: has joined #RubyOnRails
[06:04:12] rvanlieshout: or consider using a cached value in listings
[06:04:19] xcv: has joined #RubyOnRails
[06:04:43] mrburied: The query you wrote, each time when you will hit it.. It is expensive, IMO
[06:04:51] mrburied: check out the query plan.
[06:05:00] mrburied: go with the other options..
[06:05:41] mrburied: You have 4-5 tables.. and inner join.. and inner query.. what not.. You have everything there.
[06:05:48] Shoutsid: has joined #RubyOnRails
[06:05:49] rvanlieshout: inner joins are ok
[06:05:56] rvanlieshout: but completely different from left
[06:12:35] giantoctopus: has joined #RubyOnRails
[06:13:41] eGGsha: has joined #RubyOnRails
[06:14:39] giantoctopus: has joined #RubyOnRails
[06:15:06] aganov: has joined #RubyOnRails
[06:16:41] rvanlieshout: and left joins are ok if you really need them
[06:16:53] rvanlieshout: but rails chooses to perform a separate query if possible when using .includes for a good reason
[06:18:42] montagesoftware: has joined #RubyOnRails
[06:19:32] norc: has joined #RubyOnRails
[06:19:41] havenwood: has joined #RubyOnRails
[06:20:10] Guest52252: has left #RubyOnRails: ()
[06:20:37] norc: has joined #RubyOnRails
[06:21:31] bricker: has joined #RubyOnRails
[06:22:47] norc: Hi. I have a model City that I want bulk operations on (say delete a bunch of them at once, or edit a flag on a group). For this I pass a parameter to my controller, to help identify the model instances.
[06:23:05] hephaestus_rg: has joined #RubyOnRails
[06:23:20] montagesoftware: has joined #RubyOnRails
[06:23:34] norc: My question is: What is the right place to parse that parameter, identify the model instances and operate on them. Should I do this as usual, find the models in the controller, and move the editing logic in the model?
[06:23:50] dEPy: has joined #RubyOnRails
[06:24:27] sevenseacat: sounds like a decent approach.
[06:24:46] jas02: has joined #RubyOnRails
[06:25:13] norc: sevenseacat: I remember you saying this about my last question. Guess I should start listening to my instincts. :-)
[06:26:19] sevenseacat: remember, the controller is responsible for deciphering the request, including its params, then delegating to other things like models to do the work
[06:28:05] norc: sevenseacat: Aren't routes a large part of that deciphering part though?
[06:28:06] xcv: has joined #RubyOnRails
[06:28:43] sevenseacat: routes are taking a request's URL and delegating that to a controller
[06:30:10] tetraktys: has joined #RubyOnRails
[06:31:55] arBmind: has joined #RubyOnRails
[06:32:22] User458764: has joined #RubyOnRails
[06:33:34] EminenceHC: has joined #RubyOnRails
[06:34:12] discounted: has joined #RubyOnRails
[06:37:14] pydave6367: has joined #RubyOnRails
[06:38:07] chouhoulis: has joined #RubyOnRails
[06:38:51] yardenbar: has joined #RubyOnRails
[06:41:36] pawnbox: has joined #RubyOnRails
[06:41:38] comrad: has joined #RubyOnRails
[06:43:23] nickfausnight: has joined #RubyOnRails
[06:43:47] freezevee: has joined #RubyOnRails
[06:44:00] lessless: has joined #RubyOnRails
[06:44:37] simkessy: does the procfile run on dev mode?
[06:45:33] Rin: has left #RubyOnRails: ("WeeChat 0.4.2")
[06:46:40] giantoctopus: has joined #RubyOnRails
[06:49:25] Spami: has joined #RubyOnRails
[06:49:36] pawnbox: has joined #RubyOnRails
[06:50:29] dionysus69: has joined #RubyOnRails
[06:51:14] simkessy: I can't seem to get daemon working http://stackoverflow.com/questions/33008567/running-delayed-jobs-with-daemon
[06:54:06] adefa: mrburied: i was wrong about the first 'overall' working, i had written an overall method for listing review which was getting in called instead :)
[06:54:32] mrburied: adefa: cool!
[06:54:49] adefa: so at least its consistently not doing what i want, haha
[06:55:24] mrburied: means not working
[06:55:25] Linuus: has joined #RubyOnRails
[06:55:41] adefa: mrburied: yes, not working, but at least both of them are not working now, which makes more sense
[06:55:50] adefa: mrburied: im benchmarking a different way of doing it right now
[06:55:57] mrburied: yes, that is expected.
[06:59:49] nya: has joined #RubyOnRails
[07:00:04] DoubleMalt: has joined #RubyOnRails
[07:02:17] jvanbaarsen: has joined #RubyOnRails
[07:03:26] inoter: has joined #RubyOnRails
[07:04:46] workmad3: has joined #RubyOnRails
[07:07:23] norc: What do people here use to forge HTTP request to develop and interactively test their routes/controllers?
[07:08:53] Linuus: has joined #RubyOnRails
[07:09:04] squiercaster: has joined #RubyOnRails
[07:11:30] pawnbox: has joined #RubyOnRails
[07:11:50] Flyy7: has joined #RubyOnRails
[07:11:54] Mchl: has joined #RubyOnRails
[07:11:54] rushed: norc: integration/feature/request tests?
[07:12:02] nya: has joined #RubyOnRails
[07:15:01] Miron_: has joined #RubyOnRails
[07:15:09] norc: rushed: For testing features I'm currently building in (not unit tests or the like). For example I'm working on a controller, and want to just verify the code I have written by triggering a request.
[07:15:43] norc: Mostly for the API, where I don't have html views.
[07:16:07] rushed: norc: ya, tests work great for that case :)
[07:16:16] RegulationD: has joined #RubyOnRails
[07:16:32] norc: rushed: rspec even during the development phase?
[07:16:39] FailBit: norc: the default test framework has controller tests set up in your scaffolds
[07:16:42] agit0: has joined #RubyOnRails
[07:16:47] srinidhi: has joined #RubyOnRails
[07:16:56] FailBit: look in spec/controllers for rspec, or test/controllers for minitest
[07:17:28] rushed: norc: some people *gasp* write tests with... or even (horror) before~
[07:18:14] norc: rushed: I've always been used to write code, then test it. You make me feel like I have been doing it wrong....
[07:19:37] rushed: norc: some people would tell you that you've been doing it wrong... I'd say if you're happy with your results do what works.. but also it sounds like you're dealing with a case that testing during development is handy for :)
[07:19:52] Mchl: has joined #RubyOnRails
[07:20:08] norc: rushed: You are right. It would even save me work down the road, since I will already have at least a portion of the tests done by then. :)
[07:20:13] Shoutsid: has joined #RubyOnRails
[07:20:52] norc: Rather than manually testing something, that will again be tested by rspec in the next step.. now that you made me think about it..
[07:21:34] murzik: has joined #RubyOnRails
[07:22:36] bePolite: has joined #RubyOnRails
[07:22:36] bePolite: has joined #RubyOnRails
[07:23:33] robbyoconnor: has joined #RubyOnRails
[07:24:53] aganov: has joined #RubyOnRails
[07:27:13] FailBit: testing stuff manually is still testing
[07:27:52] hephaestus_rg: has joined #RubyOnRails
[07:27:55] robbyoconnor: has joined #RubyOnRails
[07:34:19] mrbubbles: has joined #RubyOnRails
[07:34:44] TomyWork: has joined #RubyOnRails
[07:36:17] TomyWork: i want to do api calls against an api of a ruby application (gitlab). is there some generic ruby entity api adapter that will help me or should i rather look out for some gitlab-specific thing?
[07:38:50] chouhoulis: has joined #RubyOnRails
[07:42:25] pawnbox: has joined #RubyOnRails
[07:43:15] mikecmpbll: has joined #RubyOnRails
[07:43:43] kitsuneyo: has joined #RubyOnRails
[07:44:01] lessless: how to get current 'per_page' value for kaminari inside view template?
[07:44:04] lalalaaa: has joined #RubyOnRails
[07:45:48] dhjondoh: has joined #RubyOnRails
[07:47:16] mikecmpbll: lessless: copy and paste it? :p
[07:47:25] rvanlieshout: lessless: inspect the object you have
[07:47:30] rvanlieshout: it most likely contains that
[07:47:50] ewilliam: does anyone have an idea why this wont work?
[07:47:54] ewilliam: https://www.irccloud.com/pastebin/ZckzEwmx/
[07:48:05] ewilliam: i cant display the error in a flash message
[07:48:16] ewilliam: @wallet.errors comes up empty
[07:48:33] rvanlieshout: ewilliam: consider using the uniqueness validation?
[07:48:57] ewilliam: rvanlieshout: well this actually limits the number of records with a specific field
[07:48:59] mikecmpbll: ewilliam: what's the condition? :/
[07:49:12] mikecmpbll: that would error on every new Wallet
[07:49:26] ewilliam: mikecmpbll: yes, i removed the condition to test it
[07:49:30] w0rd-driven: has joined #RubyOnRails
[07:49:31] ewilliam: because i thought i had the wrong condition
[07:49:33] mikecmpbll: right, and what's happening
[07:49:35] ewilliam: but its not showing up AT ALL
[07:49:42] ewilliam: no errrors at all
[07:49:45] nya: has joined #RubyOnRails
[07:49:50] ewilliam: wallet.errors comes up with an empty hash
[07:50:01] mikecmpbll: you have to try and save it first
[07:50:05] mikecmpbll: or call .valid?
[07:50:31] noodle: has joined #RubyOnRails
[07:50:38] weaksauce: has joined #RubyOnRails
[07:50:40] ewilliam: in command line, things work
[07:50:46] mikecmpbll: of course they do.
[07:50:52] mikecmpbll: ewilliam: !code
[07:50:52] helpa: ewilliam: 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.
[07:51:35] big|bad|wolf: has joined #RubyOnRails
[07:52:07] mikecmpbll: brb me ???? work
[07:52:16] n008f4g_: has joined #RubyOnRails
[07:52:19] craysiii: me caveperson.
[07:52:48] pawnbox_: has joined #RubyOnRails
[07:52:56] FailBit: hopefully not nodded off while driving
[07:53:11] drptbl: has joined #RubyOnRails
[07:53:30] ewilliam: rvanlieshout: https://gist.github.com/ewilliam/22a98a7c3d398cf82c8e
[07:54:36] ewilliam: wondering why this bit doesnt work https://www.irccloud.com/pastebin/ZckzEwmx/
[07:54:55] rvanlieshout: why not just make a user has_one wallet?
[07:55:59] ewilliam: because users typically have 2 wallets. i plan to implement limits on specific kind of wallets, i.e., customer_account and merchant_account
[07:56:00] nya: has joined #RubyOnRails
[07:56:15] ewilliam: the method name is just a placeholder. im trying to test it
[07:56:33] ewilliam: rvanlieshout: ^^
[07:56:38] rvanlieshout: so use the uniqueness validator?
[07:56:48] rvanlieshout: validates_uniqueness_of :wallet_kind, scope: :user_id
[07:57:03] jojo__: has joined #RubyOnRails
[07:57:09] ngr: has joined #RubyOnRails
[07:57:21] ewilliam: that's interesting rvanlieshout will try that
[07:57:29] ewilliam: but do you undertand why this doesnt work?
[07:57:34] ewilliam: it should, its simple enough
[07:57:43] craysiii: you never call save in your create controller method
[07:57:45] User458764: has joined #RubyOnRails
[07:57:52] rvanlieshout: no.. but i'm not well enough to focus :)
[07:58:22] darutoko: has joined #RubyOnRails
[07:58:34] craysiii: oh nevermind
[07:58:36] MartinElvar: has joined #RubyOnRails
[07:58:47] ewilliam: craysiii: the resource is created in StripeCustomerService.create_customer
[07:59:40] ewilliam: rvanlieshout: rest well
[08:00:19] craysiii: why dont you have create_customer return wallet, and then call valid? on create_customer_account in the create controller method
[08:01:04] craysiii: er i guess it might pass it anyway, but try calling valid? manually
[08:01:20] mikecmpbll: has joined #RubyOnRails
[08:01:46] ngr: I have a nested model and want to give it an 'id' that is incremented in parent scope. I want to achieve a hierarchy like this: 1.1, 1.2, 1.3, 2.1, 2.2, 3.1 where currently it is: 1.1, 1.2, 1.3, 2.4, 2.5, 4.6. I'm looking for a Gem that handles it but any hints are welcome :)
[08:02:32] mikecmpbll: safe and sound, thanks
[08:04:57] nhhagen: has joined #RubyOnRails
[08:05:32] nfk|laptop: has joined #RubyOnRails
[08:05:45] marr: has joined #RubyOnRails
[08:06:05] artto: has joined #RubyOnRails
[08:06:29] blackhuey: has joined #RubyOnRails
[08:07:34] pawnbox: has joined #RubyOnRails
[08:08:50] ewilliam: craysiii: hmm that wouldnt work, because the wallet resource isnt saved? wallet = Wallet.create would fail already
[08:09:42] ewilliam: return wallet || Wallet.new?
[08:09:49] jsrn_: has joined #RubyOnRails
[08:09:50] craysiii: from my understanding, create will return a model even if it doesn't pass validation. i could be wrong though
[08:10:03] jenrzzz: has joined #RubyOnRails
[08:10:19] workmad3: has joined #RubyOnRails
[08:10:48] ewilliam: you're right. let me investigate why its returning false
[08:11:18] pawnbox: has joined #RubyOnRails
[08:11:43] habitullence: has joined #RubyOnRails
[08:11:49] nya: has joined #RubyOnRails
[08:13:01] qejk: has joined #RubyOnRails
[08:13:43] craysiii: source must be returning nil or something
[08:15:57] gaussblurinc1: has joined #RubyOnRails
[08:16:03] w0rd-driven: has joined #RubyOnRails
[08:16:03] craysiii: this isn't for a webhook is it? it's for your site? can we see the view which calls this controller method?
[08:16:13] ewilliam: ah duh craysiii its because of the wallet.charge_cards.create relation
[08:16:34] ewilliam: no, not webhook
[08:16:39] mikecmpbll: ngr: set your new id = "#{parent.id}.#{the max of the previous ids in this scope + 1}"
[08:17:21] craysiii: wallet.charge_cards.create should still return something truthy
[08:24:52] ewilliam: craysiii even after wallet.create fails? hmm
[08:24:59] ewilliam: https://www.dropbox.com/s/l7as7lxdegbkr7u/Screenshot%202015-10-08%2001.21.30.png?dl=0
[08:25:11] ewilliam: https://www.dropbox.com/s/325t2o3qiru2qof/Screenshot%202015-10-08%2001.24.34.png?dl=0
[08:25:13] craysiii: yes because wallet.create doesn't raise an error, wallet.create! would.
[08:25:35] ewilliam: yeah but parent needs to be saved to create an association on its behalf, no?
[08:25:58] craysiii: youre right
[08:26:22] quazimodo: has joined #RubyOnRails
[08:26:25] quazimod1: has joined #RubyOnRails
[08:26:28] AzaToth: has joined #RubyOnRails
[08:27:11] yfeldblum: has joined #RubyOnRails
[08:27:58] Macaveli: has joined #RubyOnRails
[08:28:03] ewilliam: this is so weird. i'm going to try the uniqueness validator and see. sigh
[08:28:09] tetraktys: has joined #RubyOnRails
[08:29:11] craysiii: look at this
[08:29:29] craysiii: in create, you say @wallet = Wallet.new
[08:29:44] craysiii: then you do create_customer_account, which has no bearing on @wallet in the scope of the method
[08:30:06] craysiii: and then create_customer_account returns false because create raises and error
[08:30:16] craysiii: and @wallet.errors is nothing because you never affected it in the first place
[08:31:17] RTG`: has joined #RubyOnRails
[08:31:34] w0rd-driven: has joined #RubyOnRails
[08:32:54] ewilliam: craysiii: that makes sense. so i gotta try move the create method to the controller, or have @wallet be assigned to the returned wallet value of create_customer_account
[08:34:11] acidburn: has joined #RubyOnRails
[08:34:40] craysiii: i would do something like, pass @wallet into create_customer_account, and modify it inside that method, that way even though you don't store the return value of create_customer_account in a variable, you can still access @wallet.errors in your else statement.
[08:35:07] workmad3: has joined #RubyOnRails
[08:36:28] baweaver: has joined #RubyOnRails
[08:36:32] ewilliam: yeah, that's more elegant - trying that. thanks craysiii
[08:36:47] craysiii: let me know if it works :)
[08:39:40] chouhoulis: has joined #RubyOnRails
[08:40:06] herbst: has joined #RubyOnRails
[08:41:38] DoubleMalt: has joined #RubyOnRails
[08:41:44] mikecmpbll: it's that time again where i need to hack something open source and am forced to use rspec
[08:41:52] mikecmpbll: does it stop execution when an expect fails?
[08:42:01] craysiii: so much gripe with rspec in this channel lol
[08:42:23] mikecmpbll: it's like learning a new language everytime i come to it.
[08:42:41] craysiii: i feel the same way, it just doesn't stick
[08:42:49] FailBit: what's wrong with Test::Unit
[08:42:57] mikecmpbll: it should never be so difficult to get from a code snippet that doesn't in the rails console, to writing a failing test
[08:43:04] mikecmpbll: doesn't work*
[08:50:12] norc: I have a model 'SAI' (short for 'Serving Area Interface') - should I just add an acronym inflection and work with that, or write it out to get a sensible inflection? Which do you guys consider cleaner?
[08:50:33] norc: My feeling tells me to just write it out, but I don't want to be annoyed over and over again by typing out that model name.
[08:52:28] rvanlieshout: norc: full names
[08:52:29] tbuehlmann: mikecmpbll, there's a configuration for that: https://www.relishapp.com/rspec/rspec-core/v/3-3/docs/configuration/fail-fast
[08:53:13] norc: rvanlieshout: Why? Just for conventions sake, or is there a more detailed reason?
[08:53:24] rvanlieshout: because SAI makes no sense to a new person
[08:53:40] rvanlieshout: and it gets worse if that sai has a relationship and you add it's acronym to the var name
[08:54:38] mikecmpbll: tbuehlmann: ah, thanks that's useful too. i actually meant whether the 'example' or whatever continues to execute beyond the failed expectation
[08:54:54] workmad3: has joined #RubyOnRails
[08:55:40] norc: rvanlieshout: That is a good argument.
[08:56:40] tbuehlmann: mikecmpbll, ah. yes, I think that's the case
[08:57:04] mikecmpbll: tbuehlmann: oki thanks :)
[08:58:31] mark2: has joined #RubyOnRails
[08:59:24] nhhagen: has joined #RubyOnRails
[09:00:13] mrburied: has joined #RubyOnRails
[09:00:16] ewilliam: craysiii: oh wow. it now shows up in logs with Rails.logger but flash no go
[09:00:17] ewilliam: https://gist.github.com/ewilliam/22a98a7c3d398cf82c8e
[09:00:23] voker57: has joined #RubyOnRails
[09:00:41] ewilliam: tested it in pry, @wallet.errors showed up all right
[09:01:02] ewilliam: https://www.dropbox.com/s/myjft9kyj0xf89v/Screenshot%202015-10-08%2002.00.55.png?dl=0
[09:01:31] craysiii: dont you have to do flash[:error] ?
[09:01:59] subshad: has joined #RubyOnRails
[09:02:01] craysiii: or flash[:alert] rather
[09:02:32] ewilliam: craysiii: just tried that, doesnt work still
[09:02:46] arBmind: has joined #RubyOnRails
[09:03:06] ewilliam: tried flash.now.alert, flash.alert, flash[:alert], redirect_to page, alert: message, render etc
[09:04:56] idefine: has joined #RubyOnRails
[09:05:36] alexhartley: has joined #RubyOnRails
[09:05:38] tbuehlmann: first: flash.now is for the same request, don't use that when redirecting. second: iirc, redirect_to does not support "alert" as flash key, only error. this should do: `flash[:alert] = 'foo'`, then redirect
[09:06:22] craysiii: http://api.rubyonrails.org/classes/ActionController/Redirecting.html says that you can use alert in redirect_to, but maybe its outdated? i dunno.
[09:06:36] craysiii: but yes i would explicitly assign to flash before doing the redirect
[09:06:44] ngr: mikecmpbll: yeah, that's the obvious solution. I was hoping for something more sophisticated. thanks anyway :)
[09:07:08] ewilliam: craysiii: ah this is stupid
[09:07:20] ewilliam: its because i didnt do @wallet.errors.full_messages.to_sentence
[09:07:24] norc: How can I define a foreign key relationship that does not follow the rails convention in a create_table block inside ActiveRecord::Schema.define?
[09:07:27] mikecmpbll: ngr: why is more sophistication required? :)
[09:07:27] sevenseacat: has joined #RubyOnRails
[09:07:27] ewilliam: even @wallet.errors.full_messages didnt work
[09:07:37] blackmesa: has joined #RubyOnRails
[09:07:42] tbuehlmann: or am I mixing things up and alert is allowed and error is not? not sure. the one bootstrap wants is not allowed :)
[09:07:46] craysiii: didn't even give you string representation of the class?
[09:07:50] lipoqil: has joined #RubyOnRails
[09:07:53] ewilliam: anyways, thanks for your help!
[09:08:13] norc: Or is this the same as Migrations?
[09:09:35] ewilliam: craysiii: not sure what u mean. these are the results of .errors https://www.dropbox.com/s/js1bxcpm9a3iqq9/Screenshot%202015-10-08%2002.09.13.png?dl=0
[09:10:43] fifi-v: has joined #RubyOnRails
[09:10:49] craysiii: well if you're rendering @wallet.errors in your view, it should have shown the hash/object/whatever
[09:11:01] craysiii: anyway i gotta sleep, 2am here.
[09:11:24] ngr: mikecmpbll: are you KISSing me? ;)
[09:11:26] craysiii: one more thing
[09:11:29] ewilliam: craysiii: yeah, right that's why i was so confused
[09:12:00] ewilliam: nothing showed up AT ALL
[09:12:02] craysiii: by explicitly assigning the flash, you can actually factor out all those redirect_to's into a single one outside of your if else
[09:12:31] ewilliam: mhmm yes thanks for pointing that out
[09:12:44] craysiii: ALSO you have an elsif without an else
[09:12:48] craysiii: okay night ! :)
[09:13:18] ngr: mikecmpbll: my nesting is multiple levels deep so I'm gonna put that code in a concern. I was just thinking "maybe someone did this already"
[09:13:40] jgt: has joined #RubyOnRails
[09:15:05] Senjai: has joined #RubyOnRails
[09:15:07] ewilliam: hmm i need ELSE in IF statements that involve ELSIF?
[09:15:56] rvanlieshout: you need wut?
[09:16:59] RegulationD: has joined #RubyOnRails
[09:17:29] mikecmpbll: ngr: heh. it's like 4 lines of code, you spent more time wondering if someone did it already than it would've taken to write!
[09:19:46] tetraktys: has joined #RubyOnRails
[09:19:46] Ropeney: has joined #RubyOnRails
[09:27:59] mrburied: WTF, I am getting error as NoMethodError: undefined method `model_name_from_record_or_class' for #<User:0xc7f88b4> , when doing
[09:28:06] mrburied: User.first.model_name_from_record_or_class
[09:28:22] mrburied: what am I missing here -- http://api.rubyonrails.org/classes/ActionView/ModelNaming.html#method-i-model_name_from_record_or_class ?
[09:28:50] mrburied: They use it.. why not me ?
[09:30:42] norc: mrburied: Who uses it?
[09:31:14] mrburied: Rails core people inside the form_for source code.
[09:32:38] Ergo: has joined #RubyOnRails
[09:33:45] Miro___: has joined #RubyOnRails
[09:34:58] mrbubbles: has joined #RubyOnRails
[09:37:18] norc: mrburied: Can you be a bit more specific? Got a link to a source code with a line?
[09:38:03] Palsson: has joined #RubyOnRails
[09:38:04] norc: mrburied: Oh nevermind I see it now. It is easy, you are trying to call it on an instance of class that is inherited from ActiveRecord::Base most likely
[09:38:18] mrburied: Yes, I saw also :)
[09:38:57] norc: mrburied: You definitely need to practice your copy and paste skills.
[09:39:19] mrburied: thanks... I'll remember.. your advise :)
[09:40:02] drptbl: has joined #RubyOnRails
[09:40:19] chouhoulis: has joined #RubyOnRails
[09:43:28] Flyy7: has joined #RubyOnRails
[09:45:36] mrburied: norc: that method is nice.
[09:46:11] w0rd-driven: has joined #RubyOnRails
[09:46:29] mrburied: I can get the class of A AR object, in a Ruby way : User.first.class # User . Does Rails gives any other method to get the object class name?
[09:47:08] mrburied: In this journey I went to ActiveModel::Name .. but it is not what I want. Do we have any alternatives ?
[09:47:20] tetraktys: has joined #RubyOnRails
[09:48:19] norc: mrburied: What are you trying to do?
[09:49:31] norc: mrburied: Rails is nothing but a collection of classes and modules, so really - this is just Ruby. And the way to get the class of an object, is by invoking .class (which is implemented in Object#class)
[09:49:32] nettoweb: has joined #RubyOnRails
[09:49:36] mrburied: norc: On runtime I am trying to collect the enum keys. but user.class.link_types.keys is what I used and it workrf
[09:49:55] mrburied: worked.. nvm. I am happy
[09:50:04] roshanavand: has joined #RubyOnRails
[09:50:21] norc: mrburied: Why not just use User.link_types.keys?
[09:50:36] mrburied: norc: I know Rails is fancy Ruby. They have excellent APIs.. so always looks for if any cool stuff they have or not
[09:51:12] mrburied: No, idea. I might be avoiding the hardcode
[09:51:41] mrburied: norc: No, really there is a reason not to hard code
[09:51:50] norc: Which might be?
[09:52:07] mrburied: two model have same enum field names.. so I have a helper, and there I want to get runtime.
[09:52:14] mrburied: so I have to use .class
[09:52:28] mrburied: you got me now?
[09:52:34] norc: mrburied: Put the functionality into a module, mix it into both classes - and call it on user directly then.
[09:53:13] norc: classes meaning model classes here of course.
[09:54:07] mrburied: I was using a helper. Because things I am using in views. So i put a method as I described inside the ApplicationHelper
[09:54:44] mrburied: passing the object to the helper. and inside the helper doing that object.class.
[09:57:13] norc: mrburied: A mixin does the exact same thing, except you dont mimic what Ruby does internally anyway.
[09:57:35] squiercaster: has joined #RubyOnRails
[09:57:49] mrburied: I got what you meant
[09:57:52] norc: mrburied: When you call a method, what Ruby really does is look up the method table of the objects class.
[09:59:20] sajinmp: has joined #RubyOnRails
[09:59:43] kitsuneyo: has joined #RubyOnRails
[09:59:46] sajinmp: has left #RubyOnRails: ("Leaving")
[10:01:29] bricker: has joined #RubyOnRails
[10:02:35] darrencauthon: has joined #RubyOnRails
[10:05:08] brazenbraden: has joined #RubyOnRails
[10:05:42] brazenbraden: can i have custom groups in my gemfile (ie. group :engines do) and use them in bundler like 'bundle install --without engines' ?
[10:06:26] rvanlieshout: BrazenBraden: !try
[10:06:26] helpa: BrazenBraden: Why don't you try it and find out for yourself?
[10:06:34] brazenbraden: rvanlieshout, i am
[10:06:49] brazenbraden: rvanlieshout, getting ' The command '/bin/sh -c bundle install --without engines' returned a non-zero code: 13'
[10:06:57] brazenbraden: and google not being clear
[10:07:10] ddv: anyone using active_record_union and why this doesn't work (the sql generated seems to be wrong): https://gist.githubusercontent.com/ddevaal/f8e090854aa1af1e6cb6/raw/d21bd0b5ffdb04b990c01fe889970962f72efe75/sql
[10:08:29] rvanlieshout: i would not use a union for that
[10:08:59] rvanlieshout: where advisor: 999 or pattern_id in (select pattern_id from patterns where company: 9399)
[10:09:13] ddv: rvanlieshout: I will try thanks
[10:09:13] w0rd-driven: has joined #RubyOnRails
[10:09:45] norc: imho it should not spit out syntactically wrong sql either way. :p
[10:09:46] rvanlieshout: and what's wrong with the union?
[10:10:17] ddv: it appends dbo.products at the end
[10:10:48] rvanlieshout: it just tries to give the virtual table a name
[10:11:04] rvanlieshout: but you've got the table aliased to dbo.products?
[10:11:05] ddv: rvanlieshout: so you have an activerecord example for me to achieve the same result?
[10:11:18] rvanlieshout: are you even required to use dbo. with mssql here?
[10:11:41] ddv: rvanlieshout: the mssql gem append dbo to everything
[10:11:46] ddv: appends*
[10:11:58] rvanlieshout: ah right.. so that gem breaks this
[10:12:32] rvanlieshout: and what gem added the union support?
[10:12:40] ddv: rvanlieshout: do you have an example with activerecord to achieve the same result without a union? basically I want to select products via patterns and also include other products (with 999 or another advisor id)
[10:13:03] ddv: rvanlieshout: active_record_union couldn't find anything on the github page about it tho
[10:13:28] rvanlieshout: does pattern have a product_id or does product have a pattern_id?
[10:14:14] ddv: rvanlieshout: pattern
[10:14:37] ddv: rvanlieshout: pattern has a product_id column
[10:15:03] rvanlieshout: then something like Product.where('advisor = :advisor OR product_id IN (SELECT product_id FROM patterns WHERE company = :company)', advisor: 999, company: 9399)
[10:15:44] ddv: rvanlieshout: Cool I will try
[10:16:14] w0rd-driven: has joined #RubyOnRails
[10:16:23] srinidhi: has joined #RubyOnRails
[10:20:16] stamina: has joined #RubyOnRails
[10:21:56] dhjondoh: has joined #RubyOnRails
[10:22:02] ddv: rvanlieshout: I'm getting ActiveRecord::StatementInvalid: TinyTds::Error: Invalid column name 'product_id'. tried prefixing it with patterns.product_id didn't work
[10:24:06] Peg-leg: has joined #RubyOnRails
[10:24:10] rodfersou: has joined #RubyOnRails
[10:26:26] MrMaynes: has joined #RubyOnRails
[10:27:15] w0rd-driven: has joined #RubyOnRails
[10:28:18] ddv: rvanlieshout: had to replace product_id with id
[10:31:42] it_tard: has joined #RubyOnRails
[10:36:00] jenrzzz: has joined #RubyOnRails
[10:39:53] ddv: rvanlieshout: thanks again
[10:40:18] chridal: I have a Building model, that has_many :rooms. The Room has_one :residency. I want to make a scope that only returns buildings that have rooms with residencies. Thoughts?
[10:40:59] yfeldblum: has joined #RubyOnRails
[10:41:05] chouhoulis: has joined #RubyOnRails
[10:41:49] roshanavand: has joined #RubyOnRails
[10:43:43] tvw: has joined #RubyOnRails
[10:44:15] artto: has joined #RubyOnRails
[10:44:22] roshanavand: has joined #RubyOnRails
[10:45:05] herbst: has joined #RubyOnRails
[10:46:06] sininen: has joined #RubyOnRails
[10:46:20] artto: has joined #RubyOnRails
[10:48:11] Wolland: has joined #RubyOnRails
[10:49:02] spkprav: has joined #RubyOnRails
[10:49:03] skroon_: has joined #RubyOnRails
[10:51:11] jenrzzz: has joined #RubyOnRails
[10:53:14] Miron_: has joined #RubyOnRails
[10:53:14] dEPy: has joined #RubyOnRails
[10:53:57] mrburied: has joined #RubyOnRails
[10:54:10] alexhart_: has joined #RubyOnRails
[10:55:06] jojo__: chridal: can give some details ?
[10:55:31] kitsuneyo: has joined #RubyOnRails
[10:55:41] pydave6367: has joined #RubyOnRails
[10:55:57] Jasaka: has joined #RubyOnRails
[10:56:27] jojo__: chridal: building is already linked to residency
[10:57:53] chridal: jojo__: It is linked to Residency through Room, yes. But I need to create a scope so that I can do Building.with_residency. The reason I need it is for search with the pg_search gem.
[10:57:58] n008f4g_: has joined #RubyOnRails
[10:58:11] chridal: I just want to search the buildings that have residencies, because really they're searching residencies, and not buildings.
[10:58:47] chridal: The use case is this: A user is supposed to be able to search for residencies by the name of the building, but the Residency does not know the name of the Building. It can only get it through Room.
[11:00:20] chridal: The thing is though, that if I am to resolve the building name for every residency, that will not be very efficient, so I use a gem called `pg_search` that creates a searchable text for every single item in every model with polymorphism. This way I will search this table only, and then if you find your result, I can reverse resolve the residencies connected to that building, instead of doing it the other
[11:00:20] subshad: has joined #RubyOnRails
[11:00:22] chridal: way around
[11:00:46] glundgren: has joined #RubyOnRails
[11:01:53] spkprav: chridal: Residencies is the name of person or something else living in that room or building?
[11:02:52] tetraktys: has joined #RubyOnRails
[11:03:19] chills42: has joined #RubyOnRails
[11:03:38] bricker: has joined #RubyOnRails
[11:03:46] Linuus: has joined #RubyOnRails
[11:05:05] jojo__: use counter cache on building every time when u add a residency to room
[11:07:22] herbst: has joined #RubyOnRails
[11:07:34] pawnbox: has joined #RubyOnRails
[11:09:40] Miro___: has joined #RubyOnRails
[11:15:34] chridal: jojo__: That's not really what I am looking for.
[11:15:54] chridal: spkprav: Residencies is a join table between a user and a room.
[11:16:13] chridal: and the Residency has a Building through the Room
[11:17:00] chridal: A user will have to be able to write the Building.name into a search form, and get back only residencies that belong to a Room of the Building which name the user searched for.
[11:17:12] rvanlieshout: what's wrong with a simple inner join?
[11:17:39] RegulationD: has joined #RubyOnRails
[11:17:40] chridal: I was hoping to be able to do it without resorting to writing SQL
[11:17:48] rvanlieshout: that doesn't mean you have to write sql
[11:17:50] ddv: let the ORM handle it
[11:18:25] chridal: Let me elaborate a bit.
[11:19:29] rvanlieshout: Residencies.joins(room: :building).where(buildings: { name: 'foo' })
[11:19:54] losvedir: has joined #RubyOnRails
[11:20:08] chridal: There is a search form. Into the search form you must be able to search for: Room number (Residency.room.room_no), Access Point Number (Residency.room.access_point.ap_no), Building Name and address (Residency.room.building.name)
[11:20:42] chridal: You must also be able to combine something like: "Huxton Avenue 203A" which combines the Building.name and Room.room_no into the same search field at the same time.
[11:21:08] rvanlieshout: chridal: hold on for a min
[11:22:14] Linuus: has joined #RubyOnRails
[11:22:24] gaussblurinc1: hi! I have troubles with custom devise session controller. http://pastie.org/private/sqlbktrvifqzga45ai8gg I want to create new session ( reset stored one ) in create method ( so, I want to be sure that devise doesn't cache session after SessionController#new method called ). Also, cookies should be reset. Any ideas how to accomplish this?
[11:23:51] rvanlieshout: chridal: https://gist.github.com/anonymous/25554ab941ee1460a3c7
[11:25:00] mrburied: chridal: I was reading your all lines. I feel like, you should have a look to this Gem: https://github.com/activerecord-hackery/ransack
[11:25:07] dici: has joined #RubyOnRails
[11:25:20] mrburied: read the readme and see if exactly that you are looking for.
[11:25:47] chridal: Thanks all. Will have a look at the suggestions.
[11:25:59] mrburied: It handles search from a single table to its far associations smoothly..
[11:28:58] doodlehaus: has joined #RubyOnRails
[11:33:35] noodle: has joined #RubyOnRails
[11:34:16] artto: has joined #RubyOnRails
[11:34:33] spkprav: has joined #RubyOnRails
[11:36:29] jgt: has joined #RubyOnRails
[11:36:33] AxonetBE: has joined #RubyOnRails
[11:36:34] mrburied: To use jsonb datatype in Rails, should I need to enable any extension or it just work in Rails 4.2+
[11:36:41] i56yards: has joined #RubyOnRails
[11:36:54] AxonetBE: How to make a variable accessible from all the controllers?
[11:37:01] AxonetBE: like @current_user
[11:37:16] tbuehlmann: AxonetBE, define it in the ApplicationController (as other controllers should inherit from that)
[11:37:17] jvanbaarsen: Place it inside the basecontroller as a method?
[11:37:32] jvanbaarsen: What tbuehlmann is saying :D
[11:37:51] syath: has joined #RubyOnRails
[11:38:24] tbuehlmann: mrburied, no rails extension needed
[11:38:29] jojo___: has joined #RubyOnRails
[11:38:31] spkprav_: has joined #RubyOnRails
[11:38:42] prestorium: has joined #RubyOnRails
[11:38:49] mrburied: ok. Actually they didn't mention that they support JSONB http://edgeguides.rubyonrails.org/active_record_postgresql.html#json
[11:38:56] mrburied: that is why I asked
[11:39:25] jenrzzz: has joined #RubyOnRails
[11:39:26] tbuehlmann: http://nandovieira.com/using-postgresql-and-jsonb-with-ruby-on-rails
[11:40:32] ldnunes: has joined #RubyOnRails
[11:40:33] Flyy7: has joined #RubyOnRails
[11:40:36] mrburied: Yes, I saw in blogpost, but not in the guide, so I was confused.
[11:40:39] jojosiao: has joined #RubyOnRails
[11:40:43] Peg-leg: has joined #RubyOnRails
[11:41:09] Pupeno_: has joined #RubyOnRails
[11:41:16] dEPy: has joined #RubyOnRails
[11:41:27] nandx64: has joined #RubyOnRails
[11:41:27] atomical: has joined #RubyOnRails
[11:41:51] chouhoulis: has joined #RubyOnRails
[11:42:49] defsdoor: has joined #RubyOnRails
[11:45:02] jgt: has joined #RubyOnRails
[11:45:48] bitkiller: has joined #RubyOnRails
[11:46:17] defsdoor: has joined #RubyOnRails
[11:50:13] chridal: rvanlieshout: But won't that implementation require you to write the search term in a specific order? "Huxton Av 203A" would not be equal to "203A Huxton Avenue", or?
[11:50:32] chridal: I meant "Huxton Avenue 203A" in the first example.
[11:51:27] sankaber: has joined #RubyOnRails
[11:51:57] Pupeno: has joined #RubyOnRails
[11:52:08] kitsuneyo: i'm stumped by this: https://gist.github.com/kitsuneyo/ed6476205b8efe171904
[11:52:20] kitsuneyo: it's a hash, i can't get date out of it
[11:52:32] rvanlieshout: chills42: that would give the same result
[11:52:37] kitsuneyo: the gist is from rails console
[11:52:42] rvanlieshout: kitsuneyo: ['name']
[11:52:45] rvanlieshout: :name != 'name'
[11:52:46] kitsuneyo: data, not date
[11:52:53] chridal: It seems that it will be possible to do directly through https://github.com/Casecommons/pg_search this though
[11:53:03] chridal: https://github.com/Casecommons/pg_search#searching-through-associations
[11:53:11] kitsuneyo: rvanlieshout, thanks
[11:53:29] rvanlieshout: chridal: it most likely does something similar
[11:53:36] rvanlieshout: use whatever solution makes you happy :)
[11:54:26] chridal: rvanlieshout: Just so I understand correctly; your implementation would require the user to search in a specific pattern, or?
[11:54:54] chridal: I mean, you have to supply the fields that you're searching against in the same order they are in the search term?
[11:54:59] spkprav: has joined #RubyOnRails
[11:55:23] chridal: Oh. Then I must be misunderstanding your implementation
[11:55:58] rvanlieshout: so it seems :)
[11:57:16] gardhauge: has joined #RubyOnRails
[11:57:17] dhainlin: has joined #RubyOnRails
[11:59:07] jkamenik: has joined #RubyOnRails
[11:59:53] A124: has joined #RubyOnRails
[12:00:25] roshanavand: has joined #RubyOnRails
[12:00:26] mlangenberg: has joined #RubyOnRails
[12:00:43] chridal: rvanlieshout: Aha! So you add one ILIKE for each search term, for each attribute included. So if you searched for "Huxton Avenue 203A" you would add `rooms.room_no ILIKE `Huxton Avenue` OR access_point.ap_no ILIKE `Huxton Avenue` OR building.name ILIKE `Huxton Avenue`` etc.?
[12:00:58] chridal: and that would be done for "203A" in the same manner?
[12:02:50] rvanlieshout: "Huxton Avenue 203A" would result in (A ilike huxton or b ilike huxton or c ilike huxton) AND (a ilike avenue or b ilike avenue or c ilike avenue) AND (a ilike 203a or b ilike 203a ...)
[12:03:28] chridal: Ok. Gotya. Thank you! This works.
[12:05:09] bricker: has joined #RubyOnRails
[12:05:10] Flyy7: has joined #RubyOnRails
[12:06:27] kitsuneyo: has joined #RubyOnRails
[12:08:58] simplyianm: has joined #RubyOnRails
[12:09:15] doodlehaus: has joined #RubyOnRails
[12:12:16] MrMaynes: has joined #RubyOnRails
[12:13:07] acidburn: has joined #RubyOnRails
[12:13:19] mase-chatter: has joined #RubyOnRails
[12:14:37] lxsameer: has joined #RubyOnRails
[12:16:38] nzst: has joined #RubyOnRails
[12:19:30] HenriettaSalt: has joined #RubyOnRails
[12:20:05] mostlybadfly: has joined #RubyOnRails
[12:21:12] noodle: has joined #RubyOnRails
[12:22:50] beauby: has joined #RubyOnRails
[12:23:27] jtb__: has joined #RubyOnRails
[12:24:51] mary5030: has joined #RubyOnRails
[12:24:52] apneadiving: has joined #RubyOnRails
[12:30:15] kshitizshakya: has joined #RubyOnRails
[12:30:47] Peg-leg: has joined #RubyOnRails
[12:32:13] davispuh: has joined #RubyOnRails
[12:32:48] Miron_: has joined #RubyOnRails
[12:33:06] roshanav_: has joined #RubyOnRails
[12:35:37] yfeldblum: has joined #RubyOnRails
[12:35:51] borkdude_: has joined #RubyOnRails
[12:36:31] lea: has joined #RubyOnRails
[12:36:45] markelite: has joined #RubyOnRails
[12:37:51] artto: has joined #RubyOnRails
[12:40:31] n1lo: has joined #RubyOnRails
[12:41:12] kshitizshakya: has joined #RubyOnRails
[12:41:33] simplyianm: has joined #RubyOnRails
[12:41:45] futilegames: has joined #RubyOnRails
[12:42:35] chouhoulis: has joined #RubyOnRails
[12:42:41] agit0: has joined #RubyOnRails
[12:42:58] rubyonrails033: has joined #RubyOnRails
[12:43:23] joshkovach: has joined #RubyOnRails
[12:43:39] jgt: has joined #RubyOnRails
[12:45:06] futilegames_: has joined #RubyOnRails
[12:46:50] dhjondoh: has joined #RubyOnRails
[12:47:36] Guest53: has joined #RubyOnRails
[12:47:37] paolodoors: has joined #RubyOnRails
[12:47:41] kshitizshakya: has joined #RubyOnRails
[12:47:46] mary5030: has joined #RubyOnRails
[12:49:47] nya: has joined #RubyOnRails
[12:49:57] kshitizshakya: has joined #RubyOnRails
[12:50:24] Psy-Q: has joined #RubyOnRails
[12:50:29] tetraktys: has joined #RubyOnRails
[12:50:39] Palsson: has joined #RubyOnRails
[12:51:29] bkulbida: has joined #RubyOnRails
[12:51:31] sevenseacat: has joined #RubyOnRails
[12:51:41] Lytol: has joined #RubyOnRails
[12:53:39] lytol_: has joined #RubyOnRails
[12:54:35] zoro: has joined #RubyOnRails
[12:55:41] ramortegui: has joined #RubyOnRails
[12:58:03] dopamean_: has joined #RubyOnRails
[12:58:11] Flyy7: has joined #RubyOnRails
[12:58:12] Lytol: has joined #RubyOnRails
[12:58:39] quazimodo: has joined #RubyOnRails
[12:58:39] quazimod1: has joined #RubyOnRails
[12:59:22] NodeNagant: has joined #RubyOnRails
[12:59:32] spkprav: has joined #RubyOnRails
[12:59:34] NodeNagant: has joined #RubyOnRails
[13:00:03] Icey: has joined #RubyOnRails
[13:00:46] Lightsword: has joined #RubyOnRails
[13:00:52] lessless: has joined #RubyOnRails
[13:00:59] spkprav: has joined #RubyOnRails
[13:01:59] dhainlin: has left #RubyOnRails: ()
[13:02:21] Psy-Q: i have a problem calling an ActionMailer method, it raises "wrong number of arguments, 0 for n" even if all three arguments are passed. https://github.com/zhdk/leihs/blob/rca/mail_task/script/mail.rb#L35
[13:02:57] Psy-Q: i can also pass things like mail(to: "foo@bar.com") and it will still complain with 0 for 3 missing arguments
[13:03:13] roshanavand: has joined #RubyOnRails
[13:03:37] kshitizshakya: has joined #RubyOnRails
[13:04:26] DEA7TH: has joined #RubyOnRails
[13:05:22] Psy-Q: script/mail.rb:4:in `message': wrong number of arguments (0 for 3) (ArgumentError)
[13:05:58] zoro: has joined #RubyOnRails
[13:06:40] Psy-Q: i'm not sure if i'm supposed to be able to use a mailer like that from an outside script, but i thought i'd try. the reason i'm doing this is that they want to email from the command line but using the ActionMailer config of the rails app, which gets configured from settings in the DB
[13:07:23] dhainlin: has joined #RubyOnRails
[13:07:55] sevenseacat: wondering is message is a reserved word
[13:08:02] victortyau: has joined #RubyOnRails
[13:08:11] sevenseacat: can you try Mailer.method(:message).source_location and see what it says?
[13:08:38] northfurr: has joined #RubyOnRails
[13:09:48] Psy-Q: sevenseacat: maybe you're on to something: *** NameError Exception: undefined method `message' for class `Class'
[13:09:52] Psy-Q: in Mailer.methods it's not listed either
[13:10:11] Psy-Q: i'll call it "nyarlathotep", that won't be reserved
[13:10:55] Psy-Q: if i call it nyarlathotep, it works
[13:11:06] Psy-Q: moral of the story, don't call things "message"
[13:11:14] sevenseacat: good to know!
[13:11:54] doodlehaus: has joined #RubyOnRails
[13:12:02] chrislotix: has joined #RubyOnRails
[13:12:28] roshanavand: has joined #RubyOnRails
[13:13:49] Psy-Q: or we could just call everything nyarlathotep insted
[13:13:59] Psy-Q: +a i mean. -s. god, the keyboard today...
[13:14:16] DEA7TH: What's the point of testing routes?
[13:14:49] sevenseacat: to ensure they work?
[13:15:22] DEA7TH: Least of all, other tests would visit each route and go red if a route doesn't work. Also, how could a route ever go wrong
[13:16:01] sevenseacat: if it doesnt point to the controller you think it does
[13:16:03] gaussblurinc1: has joined #RubyOnRails
[13:16:15] glundgren: has joined #RubyOnRails
[13:16:18] sevenseacat: or it names the params differently than you're expecting
[13:18:03] DEA7TH: I guess that makes sense. I have a really vague idea of how much testing to do.
[13:18:06] tetraktys: has joined #RubyOnRails
[13:18:23] RockLee: has joined #RubyOnRails
[13:18:29] RegulationD: has joined #RubyOnRails
[13:19:05] zoro: is refinerycms good?
[13:19:12] chills42: has joined #RubyOnRails
[13:20:10] beauby_: has joined #RubyOnRails
[13:20:42] rvanlieshout: zoro: for who? for what? developers mostly don't like to use a cms
[13:20:57] zoro: as a cms
[13:21:03] zoro: for developers
[13:21:18] rvanlieshout: why would a developer have the need to use a cms?
[13:21:26] darutoko: has joined #RubyOnRails
[13:21:28] zoro: i didnt find any support for shortcodes
[13:21:45] rvanlieshout: i wouldn't know
[13:25:19] nerium: has joined #RubyOnRails
[13:26:42] nerium: Is there a way to make a small copy of the production db into the testing environment? I need to pre-populate the db in my tests, and I need quite a lot of data
[13:27:58] rvanlieshout: gem capistrano-db-tasks
[13:28:09] rvanlieshout: oh wait. like that. that would just copy the db
[13:28:47] tknz: has joined #RubyOnRails
[13:29:08] newdan: has joined #RubyOnRails
[13:29:45] yfeldblum: has joined #RubyOnRails
[13:30:30] Ropeney: has joined #RubyOnRails
[13:30:41] spkprav: has joined #RubyOnRails
[13:30:53] ischwartz: has joined #RubyOnRails
[13:31:37] mdel: has joined #RubyOnRails
[13:32:16] ischwartz: /msg NickServ VERIFY REGISTER ischwartz tipicxwgwbhs
[13:32:16] ischwartz: /msg NickServ VERIFY REGISTER ischwartz tipicxwgwbhs
[13:32:17] ischwartz: /msg NickServ VERIFY REGISTER ischwartz tipicxwgwbhs
[13:33:02] fryguy: time for a new password
[13:33:03] Rodya_: has joined #RubyOnRails
[13:33:35] jenrzzz: has joined #RubyOnRails
[13:33:42] nerium: I hope there is some way. I don't really need a plain copy of the production db, just parts of it
[13:33:49] acti0nman: has joined #RubyOnRails
[13:34:17] tbuehlmann: that's amazing, I got the same combination on my luggage
[13:34:31] orolo: has joined #RubyOnRails
[13:34:36] chills42: has joined #RubyOnRails
[13:34:39] mrchris: has joined #RubyOnRails
[13:34:50] ischwartz: funny, you don't look Druish
[13:34:51] diegobiavati: has joined #RubyOnRails
[13:35:40] diegobiavati: has joined #RubyOnRails
[13:38:45] devdazed: has joined #RubyOnRails
[13:38:58] Ropeney: has joined #RubyOnRails
[13:39:32] riskish: has joined #RubyOnRails
[13:40:54] treehug88: has joined #RubyOnRails
[13:41:18] atomical: has joined #RubyOnRails
[13:42:52] jon1: has joined #RubyOnRails
[13:42:54] momomomomo: has joined #RubyOnRails
[13:43:42] chridal: I am using Active Model Serializer. I've listed relationships for all of them, but some of them share relationships, so the multiple relationships that are all interrelated create a lot of redundant data
[13:43:48] chridal: Anyone have some thoughts on combating this?
[13:44:11] chridal: https://gist.github.com/christiandalsvaag/9ac6c98a5514c92a9c65
[13:44:14] chridal: here are some examples
[13:45:12] chridal: The Residency serializer has `has_one :user;has_one :room`, but the User also does `has_one :room;has_one :building`, and the Room has `has_one :building` etc.
[13:45:38] chridal: I have a lot of examples where some endpoints want that sort of ouput, and others that kind
[13:45:55] roshanavand: has joined #RubyOnRails
[13:46:16] chridal: All with their own minor changes. What do you think about creating a serializer for each case?
[13:47:28] Dopagod: has joined #RubyOnRails
[13:47:28] Dopagod: has joined #RubyOnRails
[13:48:46] darrencauthon: has joined #RubyOnRails
[13:49:38] dopie: has joined #RubyOnRails
[13:51:02] glundgren: has joined #RubyOnRails
[13:51:10] axl_: has joined #RubyOnRails
[13:54:25] roshanavand: has joined #RubyOnRails
[13:57:32] Flyy7: has joined #RubyOnRails
[13:58:03] alexhartley: has joined #RubyOnRails
[13:58:58] habitullence: Anyone know how to use * in squeel?
[13:59:39] ChanServ: +o sevenseacat
[13:59:44] sevenseacat: -q glundgren!*@*
[13:59:47] krz: has joined #RubyOnRails
[13:59:58] sevenseacat: there we go! figured it out
[14:00:03] sevenseacat: ACTION not an IRC expert
[14:00:14] ChanServ: -o sevenseacat
[14:02:21] The_Phoenix: has joined #RubyOnRails
[14:02:29] hiuery: has joined #RubyOnRails
[14:02:42] stannard: has joined #RubyOnRails
[14:02:59] sarink: has joined #RubyOnRails
[14:03:50] hiuery: I've noticed some comments like this in my structure.sql file after upgrading to rails 4.2 and run a migration: http://pastie.org/private/yg3o8we79tbo6vrfo7dnw
[14:03:55] hiuery: are those expected in 4.2?
[14:04:36] habitullence: select * in squeel... anybody?
[14:05:45] habitullence: rvanlieshout: so string? doesn't seem very squeelish
[14:05:58] habitullence: oh! hit and run :P
[14:06:14] jenrzzz: has joined #RubyOnRails
[14:06:20] Macaveli: has joined #RubyOnRails
[14:06:20] bricker: has joined #RubyOnRails
[14:07:14] Macaveli: has joined #RubyOnRails
[14:08:34] nopajj: has joined #RubyOnRails
[14:10:48] pawnbox: has joined #RubyOnRails
[14:11:46] umgrosscol: has joined #RubyOnRails
[14:15:51] nerium: has joined #RubyOnRails
[14:15:56] nerium: Is there a way to partially copying the production database into the test environment?
[14:17:56] northfurr: has joined #RubyOnRails
[14:18:09] darutoko: has joined #RubyOnRails
[14:18:46] darutoko: has joined #RubyOnRails
[14:19:09] RegulationD: has joined #RubyOnRails
[14:19:12] chridal: I have a seriously WEIRD issue. If I run all my tests with `rspec` then two tests fail. If I run just that single file, the tests pass.
[14:19:47] chridal: The error is due to a validation error in a factory.
[14:19:47] paolodoors: has joined #RubyOnRails
[14:20:04] tubbo: chridal: that is somewhat common, actually. is it a uniqueness error?
[14:20:09] nerium: chridal: Try to clear the table/db before running the test
[14:20:17] sonofdirt: has joined #RubyOnRails
[14:20:27] chridal: Done that.
[14:20:32] tubbo: make the factory work properly
[14:20:34] highcup: has joined #RubyOnRails
[14:20:43] chridal: No, it's not uniqueness. It's a regex validator.
[14:20:49] tubbo: chridal: post zee code
[14:20:51] nerium: chridal: Before running that particular failing test?
[14:21:00] chridal: At least I believe. It might be uniqueness...
[14:21:25] glundgren: has joined #RubyOnRails
[14:21:29] tubbo: Nerium: the test db is gonna get wiped all the time, so copying prod to it would be pointless.
[14:21:39] tubbo: chridal: post the code and the error
[14:22:00] nerium: tubbo: Which is why it has to be populated each time
[14:22:13] tubbo: Nerium: "each time"...what does that mean?
[14:22:43] nerium: tubbo: Each time the suit is ran
[14:22:53] nerium: it's reset
[14:23:27] nKulo: has joined #RubyOnRails
[14:23:31] tubbo: Nerium: well, fundamentally by doing that you may be opening yourself up to a lot of problems. it's why we have fixtures and factories, so we don't make our code dependent on some data.
[14:23:51] yfeldblum: has joined #RubyOnRails
[14:24:11] jvanbaarsen: has joined #RubyOnRails
[14:24:37] nerium: tubbo: I'm using Selenium on an app with over 400 models, using factories is a hell (to say the least)
[14:24:42] tubbo: i don't see why you couldn't load a sql file into the db on a `before :suite` block, but i think that creates more problems than it solves.
[14:24:56] tubbo: Nerium: then don't use factories, use fixtures.
[14:25:11] nerium: tubbo: http://stackoverflow.com/questions/33018324/partially-copying-the-production-database-into-the-test-environment
[14:26:46] havenwood: has joined #RubyOnRails
[14:27:08] voker57: has joined #RubyOnRails
[14:27:21] tubbo: Nerium: i'm not saying this isn't possible, just that it isn't a really good idea. if it were, more people would do it, we'd all be testing with real data, and there would be a tool that just runs SELECT * LIMIT <whatever> on every table in your DB to produce the data
[14:27:37] tubbo: which you could do yourself, save to a sql file, and then load it into the database with a SQL queyr
[14:27:57] nerium: tubbo: the production db is over 10gb
[14:28:09] chridal: tubbo: https://gist.github.com/christiandalsvaag/c43d75777f3eafafa691
[14:28:17] tubbo: Nerium: right, but if you only SELECT'ed like 10 rows from each table, the sample sql file wouldn't be as large
[14:28:26] alexhartley: has joined #RubyOnRails
[14:28:43] nerium: tubbo: Way to much manual work
[14:29:03] chridal: tubbo: I just realized there's missing some code there. Give me one sec.
[14:29:13] nerium: tubbo: And way to error prone.
[14:29:16] tubbo: not if you know sql
[14:29:47] tubbo: chridal: yeah the 'Mac address is invalid' error...which translation is that coming from? just so i know what's triggering this
[14:29:56] dsimon: has joined #RubyOnRails
[14:30:02] tubbo: Nerium: it's not error prone if you only have to do it once. also, the query should work every time.
[14:30:06] nerium: tubbo: that's like saying that complex regexp isn't error prone if you know regexp
[14:30:32] chridal: tubbo: Updated the Gist with two files.
[14:30:50] nerium: tubbo: The relations are very complex with over 400 models/tables. Defining something like that would also need tests
[14:31:47] The_Phoenix1: has joined #RubyOnRails
[14:32:11] tubbo: Nerium: i don't know what to tell you. you asked whether there was a way to do this, i told you, you said it wasn't good enough. :P
[14:32:11] dsimon: hey all; i'm interested to see if there's any modern or at least actively-maintained alternatives to hobofields
[14:32:14] chridal: Nerium: 400 models. What is this beast you are building? :D
[14:32:37] dsimon: that little subproject was really useful for me, but hobo seems to be dying and that along with it :-\
[14:32:38] tubbo: Nerium: but no, there's no gem you can just install to do this because it's not common to need something like that
[14:33:25] tubbo: Selenium, fwiw, is also kinda slow imho...ever think of using poltergeist? just make sure you don't install phantomjs 2.0 :P
[14:33:34] tubbo: i always hated how it opened up the browser a million times
[14:34:04] Wixy: has joined #RubyOnRails
[14:34:09] nerium: tubbo: It feels a bit strange to introduce a complex solution and another layer of insecurity by introducing pure sql and the possibility of missing a relation. Why not use the already existing model and relations to do this?
[14:34:46] benlieb: has joined #RubyOnRails
[14:35:07] Wixy: Hello there! I have this association 'belongs_to :source, class_name: "Page"' but when I use it, rails uses table "source" and crashes with error missing: missing FROM-clause entry for table "source"
[14:35:14] nerium: tubbo: Can we use poltergeist to record the browser?
[14:35:23] Wixy: the table is "pages", not "source" (not even "sources". What is wrong?
[14:35:24] tubbo: Nerium: well, most people don't allow outside connections to their production database for security reasons. it's normally firewalled within the production envrionment and can only be accessed by servers inside that environment.
[14:35:48] tubbo: Nerium: you can save screenshots and open pages in your browser if that's what you mean
[14:35:55] dsimon: basically, it lets you define your fields in the model; it then can generate appropriate migrations for you (asking questions when necessary to e.g. distinguish renaming a field from dropping and adding different fields)
[14:36:02] tubbo: Nerium: go check it out, see if you can use it. i like it because it's totally headless
[14:36:02] nerium: tubbo: yes, that's the case here as well. Im not sure why that is relevant
[14:36:23] tubbo: Nerium: well think about it, what if you accidentally posted database.yml in here and i saw your production IP
[14:36:28] tubbo: i could psql into it and DROP DATABASE everything;
[14:36:43] tubbo: but if it's firewalled, i can't do that even if you post database.yml here
[14:36:54] nerium: tubbo: You still need to access it using an ssh tunnel
[14:37:10] tubbo: i'm not saying you can go ahead and post credentials everywhere but it's just another hoop to jump through
[14:37:22] NodeNagant: has joined #RubyOnRails
[14:37:56] tubbo: Nerium: right, it's firewalled...so even if i somehow got those credentials i still couldn't get to it.
[14:38:26] nerium: tubbo: If they had ssl access they would
[14:38:39] mary5030: has joined #RubyOnRails
[14:38:57] nerium: I'm not sure why all this is relevant :p
[14:39:27] chridal: Yea, I was actually trying to read the conversation and figure out how you guys got to this point
[14:39:36] mary5030: has joined #RubyOnRails
[14:40:13] tubbo: Nerium: you asked why you can't just use the existing model and relations to do this locally. i suppose you could make a rake task on the server that does it, but i'm not sure how you'd just export that to SQL.
[14:40:19] tubbo: from active_record i mean
[14:40:40] tubbo: chridal: https://gist.github.com/christiandalsvaag/c43d75777f3eafafa691#file-accesspoint-rb-L11
[14:40:41] nerium: tubbo: The problem we're facing atm is that the full stack tests has a tendency to be way to complex. Which leads to people avoding writing/running them. We need a mimimal effort, test suit that is as title error prone as possible.
[14:41:00] tubbo: Nerium: do you have a CI server?
[14:41:08] TPBallbag: has joined #RubyOnRails
[14:41:10] chridal: tubbo: What about it? I need to perform that check.
[14:41:34] chridal: The factory uses a sequence
[14:41:37] nerium: tubbo: Yes. Dont mind the production <-> test connection. That's already solved.
[14:41:40] tubbo: chridal: just saying that's your uniqueness validation.
[14:41:46] tubbo: chridal: oh really? hmm
[14:42:01] chridal: it's in the gist as well
[14:42:02] joshkovach: has joined #RubyOnRails
[14:42:03] mrchris: atomical pm?
[14:42:20] BrazenBraden_: has joined #RubyOnRails
[14:42:23] tubbo: Nerium: yeah i mean, i don't typically run the entire test suite on my machine either. i might do it maybe once right before i make a pull request just to make sure i don't break anything
[14:42:32] tubbo: the rule around here is you can't merge the PR until it passes the build
[14:42:46] chridal: tubbo: I just assumed it was because of the mac address validation. Any how, there still is something weird going on here, because it works just fine when I run that one file in isolation.
[14:42:59] chridal: When I run all the tests in sequence, it breaks.
[14:43:03] chridal: That's the weird part.
[14:43:08] alexhart_: has joined #RubyOnRails
[14:43:23] chouhoulis: has joined #RubyOnRails
[14:43:31] brazenbraden: i have two Gemfiles. I run 'bundle install --gemfile=gemfile2' after running bundle install (which installs from the main gemfile) however it seems like the original gems are "disappearing" and im only left with the gems from the second gemfile. how can i get all of them installed?
[14:43:53] tubbo: chridal: crazy...i've never seen that before
[14:43:59] beauby: has joined #RubyOnRails
[14:44:06] RegulationD: has joined #RubyOnRails
[14:44:28] chridal: tubbo: Indeed.
[14:44:37] tubbo: Nerium: i write feature tests sparingly and mostly deal with unit testing...controller/request/etc. tests are all included in that
[14:45:51] nerium: tubbo: Here we're talking about writing unit tests and recoding the browser. Everything else wont happend
[14:45:58] eggie5: has joined #RubyOnRails
[14:46:02] nerium: tubbo: We're to lazy
[14:46:24] tubbo: Nerium: sounds like a shitty plcae
[14:46:39] RegulationD: has joined #RubyOnRails
[14:46:42] roshanavand: has joined #RubyOnRails
[14:46:46] Wixy: hwo do you rename a belongs_to association? I have a table "pages" and a model that belongs to pages, but I want to call the association "source"
[14:46:47] nerium: tubbo: It's personal project which I've a some friends
[14:46:57] tubbo: oh well that's not too bad
[14:47:07] tubbo: i thought you worked there or something
[14:47:12] nerium: tubbo: The user base exploded a while back so we need more then unit tests
[14:47:20] roshanavand: has joined #RubyOnRails
[14:47:39] lessless: folks, there is some strange trouble with namespaced concerns - they're just not accessible: `Concerns::Relationships::Utils` => `LoadError: Unable to autoload constant Concerns::Relationships, expected /Users/lessless/Code/blah/app/controllers/concerns/relationships.rb to define it`
[14:47:41] armyriad: has joined #RubyOnRails
[14:47:44] nerium: tubbo: We're serving over 15M req/month
[14:47:54] chridal: These sort of errors are fucked up. I'm thinking about dropping FactoryGirl, RSpec. Everything.
[14:47:58] tubbo: Nerium: well, if i were dealing with your problem i'd just suck it up and write fixtures.
[14:48:08] chridal: And just write Minitest
[14:48:15] chridal: No factories no nothing. Just do it all manually.
[14:48:23] chridal: Problem with that is the insane amounts of time it will take.
[14:48:28] chridal: But these sort of bugs make me go insane.
[14:48:57] nerium: tubbo: That wont happend when we can have half the securety with only 1% of the effort
[14:49:10] tubbo: chridal: that's not going to solve your problem of writing tests that depend on one another
[14:49:13] nerium: even less. 0.001%
[14:49:16] tubbo: chridal: which *is* the problem here
[14:49:26] chridal: tubbo: None of the tests are supposed to depend on one another.
[14:49:37] chridal: All my tests are isolated.
[14:49:43] chridal: the only thing they share are the factories.
[14:49:50] nerium: chridal: Do they write to the db?
[14:50:14] chridal: Not as far as I know. I thought factorygirl rolled everything back?
[14:50:19] chridal: It's all FactoryGirl.
[14:50:25] willardg: has joined #RubyOnRails
[14:52:06] nerium: chridal: No it doesn't
[14:52:15] Guest53: has joined #RubyOnRails
[14:52:19] nerium: chridal: Can you repost you code?
[14:52:30] chridal: Nerium: https://gist.github.com/christiandalsvaag/c43d75777f3eafafa691
[14:53:04] chridal: Nerium: Added one more file that might be of interest. Refresh.
[14:53:52] Linuus: has joined #RubyOnRails
[14:54:46] VeryBewitching: has joined #RubyOnRails
[14:56:12] nerium: chridal: Have you tried catching the error and and start the debugger?
[14:56:42] chridal: Nerium: Yes, I have been poking around a bit, but..
[14:57:00] chridal: It's just so fucked up. Because it works just fine when I run just that file.
[14:57:09] chridal: That means that it's because of some other spec file
[14:57:15] nerium: chridal: That's b/c the db is already populated
[14:57:16] chridal: Which means that the DB isn't being cleaned up properly
[14:57:24] chridal: which means that this is an issue with FactoryGirl
[14:57:28] tubbo: chridal: nope, factory_girl does *not* roll anything back. you'd need something like database_cleaner to run everything in a transaction
[14:57:36] tubbo: chridal: fixtures do, though
[14:57:41] tubbo: but that's another story
[14:57:41] nerium: what tubbo said
[14:58:16] chridal: I have database_cleaner in my Gemfile.
[14:58:33] chridal: but haven't configured it..
[14:58:47] tubbo: yeah you have to tell it to clean the DB, which i think you do in config.after
[14:59:15] nerium: chridal: Try this in you spec_helper https://gist.github.com/oleander/e239d988e1a4730f1315
[14:59:18] chridal: tubbo: How much slower are we talking?
[14:59:34] nerium: Start with that and move backwards until it works
[14:59:49] nerium: chridal: Way slower
[15:00:16] tubbo: this is why it's slower: https://gist.github.com/oleander/e239d988e1a4730f1315#file-clear-rb-L5
[15:00:37] tubbo: you can also use transactions
[15:01:00] aaronr: has joined #RubyOnRails
[15:01:04] nerium: tubbo: Which is why I told him to start with it and move backwards :)
[15:01:07] chridal: Nerium: do you keep that file in spec/clear.rb?
[15:01:21] nerium: chridal: No, that's my spec_helper
[15:01:29] riotjones: has joined #RubyOnRails
[15:02:06] _el_fer_: has joined #RubyOnRails
[15:02:24] riotjones: has joined #RubyOnRails
[15:02:29] Dadi: has joined #RubyOnRails
[15:02:39] chridal: trying with only config.after first
[15:02:49] chridal: I reckon transactions are default strategy?
[15:04:03] nerium: tubbo: Heading for a swim. Thanks for you help
[15:04:07] tubbo: i feel like that's the best strategy if you use a database which supports transactions
[15:04:23] mrburied: has joined #RubyOnRails
[15:04:40] chridal: it still didn't work with those three lines added.
[15:04:43] chridal: For db cleaner.
[15:04:58] nerium: chridal: Run :each not :first
[15:05:15] nerium: chridal: Look at my gist
[15:05:16] chridal: I've copied yoru code.
[15:05:19] workmad3: tubbo: it's the preferred strategy, as long as your tests don't require data to cross transaction boundaries
[15:05:24] nerium: chridal: I've updated it
[15:05:36] chridal: That's the one I am using Nerium
[15:05:39] tubbo: chridal: also maybe read some examples for how it's implemented? https://github.com/DatabaseCleaner/database_cleaner
[15:05:50] nerium: chridal: With :each ?
[15:06:20] chridal: Nerium: I am using each, indeed.
[15:06:24] ror15: has joined #RubyOnRails
[15:06:35] chridal: tubbo: will have to start looking at this again tomorrow. I'm mentally exhausted.
[15:06:46] chridal: just doing some desperate attempts before heading home from the office.
[15:07:03] ror15: How do I write/run a rails console command in a method
[15:07:26] nerium: chridal: Lycka till!
[15:07:35] chridal: Nerium: Takk!
[15:07:45] chridal: Tack ** :-)
[15:08:22] workmad3: chridal: if it's of any use, I normally set up database cleaner by dropping https://gist.github.com/workmad3/068303504358de3494b6 into `spec/support/database_cleaner.rb`
[15:08:49] codeurge: has joined #RubyOnRails
[15:09:15] greengriminal: has joined #RubyOnRails
[15:10:08] chridal: Will have to see if I can make any sense of this tomorrow. Any more banging at this will cause a headache
[15:10:13] chridal: Have a good one people! Thanks.
[15:11:19] hobodave: has joined #RubyOnRails
[15:12:28] bricker: has joined #RubyOnRails
[15:14:55] iliketurtles: has joined #RubyOnRails
[15:15:35] towski_: has joined #RubyOnRails
[15:18:01] yfeldblum: has joined #RubyOnRails
[15:18:33] thelastinuit: has joined #RubyOnRails
[15:18:42] chills42: has joined #RubyOnRails
[15:20:33] sankaber: has joined #RubyOnRails
[15:21:47] eGGsha: has joined #RubyOnRails
[15:24:22] EminenceHC: has joined #RubyOnRails
[15:26:12] Kayyow: has joined #RubyOnRails
[15:26:17] idd2d: has joined #RubyOnRails
[15:26:57] jas02: has joined #RubyOnRails
[15:29:45] greenarrow: has joined #RubyOnRails
[15:30:00] pwnd_nsfw: has joined #RubyOnRails
[15:30:02] Kayyow: has joined #RubyOnRails
[15:30:32] simplyianm: has joined #RubyOnRails
[15:30:51] greenarrow: How do i get '&amp;' in my string to output as html
[15:30:53] shmilan: has joined #RubyOnRails
[15:30:57] isjaylee1: has joined #RubyOnRails
[15:31:08] ascarter: has joined #RubyOnRails
[15:31:13] disgrntld: has joined #RubyOnRails
[15:31:23] isjaylee1: has left #RubyOnRails: ()
[15:31:29] blackmesa: has joined #RubyOnRails
[15:31:39] roshanavand: has joined #RubyOnRails
[15:31:47] EminenceHC: has joined #RubyOnRails
[15:32:17] jenrzzz: has joined #RubyOnRails
[15:33:49] workmad3: greenarrow: don't escape it again
[15:34:20] greenarrow: example: <%= strip_tags("&").html_safe %>
[15:34:33] greenarrow: gives &amp; in a string
[15:35:41] willardg: has joined #RubyOnRails
[15:38:44] beauby: has joined #RubyOnRails
[15:40:51] ankhers: has joined #RubyOnRails
[15:41:15] idd2d: has joined #RubyOnRails
[15:41:46] lessless: has joined #RubyOnRails
[15:42:54] n008f4g_: has joined #RubyOnRails
[15:43:00] NodeNagant: has joined #RubyOnRails
[15:43:14] drptbl: has joined #RubyOnRails
[15:43:28] gardhauge: has joined #RubyOnRails
[15:45:11] gardhauge: has left #RubyOnRails: ()
[15:45:16] momomomomo: has joined #RubyOnRails
[15:45:47] DEA7TH: has joined #RubyOnRails
[15:46:13] benlieb: has joined #RubyOnRails
[15:48:11] roshanavand: has joined #RubyOnRails
[15:48:45] treehug88: has joined #RubyOnRails
[15:49:19] artto: has joined #RubyOnRails
[15:50:36] nandx64: has joined #RubyOnRails
[15:52:19] jenrzzz: has joined #RubyOnRails
[15:54:50] diegobiavati: has joined #RubyOnRails
[15:56:01] jsrn_: has joined #RubyOnRails
[15:56:56] pawnbox: has joined #RubyOnRails
[15:57:48] sah_usmc: has joined #RubyOnRails
[15:57:50] EminenceHC: has joined #RubyOnRails
[15:57:59] allcentury: has joined #RubyOnRails
[15:58:35] jtb___: has joined #RubyOnRails
[15:58:37] gard_almighty: has joined #RubyOnRails
[16:01:04] gard_almighty: has joined #RubyOnRails
[16:01:48] michaeldeol: has joined #RubyOnRails
[16:02:03] towski_: has joined #RubyOnRails
[16:03:09] wuiiuam: has joined #RubyOnRails
[16:03:12] riotjones: has joined #RubyOnRails
[16:03:41] northfurr: has joined #RubyOnRails
[16:03:44] crystal77: has joined #RubyOnRails
[16:04:04] EminenceHC: has joined #RubyOnRails
[16:04:07] riotjones: has joined #RubyOnRails
[16:04:23] ishikawa91: has joined #RubyOnRails
[16:05:59] michaeldeol: has joined #RubyOnRails
[16:06:00] wuiiuam: anyone suggest a good starting point after the Hartl tutorial?
[16:07:08] [Butch]: has joined #RubyOnRails
[16:07:09] arooni: has joined #RubyOnRails
[16:10:02] mrbubbles: has joined #RubyOnRails
[16:10:05] MarkTR: has joined #RubyOnRails
[16:10:17] lessless: has joined #RubyOnRails
[16:10:31] ahmgeek: has joined #RubyOnRails
[16:12:08] ahmgeek: hey folks, if I have this: https://gist.github.com/ahmgeek/2727e8cf7cb43da75b83
[16:12:20] yfeldblum: has joined #RubyOnRails
[16:12:22] EminenceHC: has joined #RubyOnRails
[16:12:22] ahmgeek: and I want to assign another params if this is nil, how can I do it ?
[16:12:24] The_Phoenix: has joined #RubyOnRails
[16:12:51] ahmgeek: as I do it with: friend = b || a and doesn't got assigned
[16:12:58] chouhoul_: has joined #RubyOnRails
[16:13:31] The_Phoenix: has joined #RubyOnRails
[16:14:22] smathy: has joined #RubyOnRails
[16:14:42] The_Phoenix: has joined #RubyOnRails
[16:14:42] mices: anyone have any thoughts on what the largest amount processable for credit cards is or should be
[16:15:04] roshanavand: has joined #RubyOnRails
[16:15:27] alexhartley: has joined #RubyOnRails
[16:15:42] tbuehlmann: ahmgeek, you want the value for the key :friend_id, and if that is not set, get another value?
[16:15:45] The_Phoenix: has joined #RubyOnRails
[16:16:40] ahmgeek: tbuehlmann: yep, get another value from another param actually, send two forms for this action, so if the first is not nil, it's the first form, if nil, then it's the second, and it should grab the value from the second param
[16:17:12] agit0: has joined #RubyOnRails
[16:17:37] tbuehlmann: but still get the user for that value/id?
[16:17:51] tbuehlmann: a bit more context/code would be nice
[16:19:02] Joufflu: has joined #RubyOnRails
[16:19:23] Guest66992: has joined #RubyOnRails
[16:19:44] Joufflu: has joined #RubyOnRails
[16:20:07] ahmgeek: tbuehlmann: it's just like I want to assign a value if not nil, if nil assign another value.
[16:20:11] fedexo: has joined #RubyOnRails
[16:20:20] ahmgeek: || operator don;t work
[16:20:48] tbuehlmann: like that? https://gist.github.com/tbuehlmann/260dc338436414c25fc3
[16:21:36] northfurr: has joined #RubyOnRails
[16:21:38] lea: has joined #RubyOnRails
[16:21:56] ahmgeek: will I was thinking that it's only a matter of || or |= for instance without using if or else.
[16:22:18] ishikawa91: why don't you use another variable?
[16:22:30] tbuehlmann: User.find(params[:friend_id] || other_value)?
[16:22:33] ishikawa91: params[:friend_id] || params[:other_var]
[16:22:44] tbuehlmann: User.find(params.fetch(:friend_id, other_value))?
[16:23:02] srinidhi: has joined #RubyOnRails
[16:23:21] dawkirst: has joined #RubyOnRails
[16:23:41] ahmgeek: well, thanks folks gonan test those. ishikawa91: I am sending to that action from two forms, so I just wanted to make sure to set the values for any forms if it was the caller.
[16:23:43] dawkirst: Hello. In RSpec, is there a way to stub out the request object?
[16:24:10] youngbaks: has joined #RubyOnRails
[16:24:29] Maletor: has joined #RubyOnRails
[16:24:35] elaptics: dawkirst: what are you testing?
[16:24:52] dawkirst: A method on my ApplicationController
[16:25:44] roshanavand: has joined #RubyOnRails
[16:25:54] dawkirst: elaptics: pretty much trying to do what this OP is trying: http://stackoverflow.com/questions/29400657/rspec-rails-stub-request-path-for-helper-spec
[16:26:00] elaptics: dawkirst: !gist your code
[16:26:00] helpa: dawkirst: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[16:26:45] elaptics: is it a helper method you're trying to test?
[16:26:53] Palsson: has joined #RubyOnRails
[16:27:16] nandx64: has joined #RubyOnRails
[16:28:44] ericjphillips: has joined #RubyOnRails
[16:29:57] dawkirst: So in the method I'm checking whether request.path is equal to something, and I need to stub that out to force the test into a certain context.
[16:30:18] nandx64_: has joined #RubyOnRails
[16:32:02] RockLee: has joined #RubyOnRails
[16:32:32] CheckYourSix: has joined #RubyOnRails
[16:33:12] wuiiuam: has joined #RubyOnRails
[16:34:17] manfrin: has joined #RubyOnRails
[16:34:45] jenrzzz: has joined #RubyOnRails
[16:35:57] mrburied: has joined #RubyOnRails
[16:36:05] blackmes1: has joined #RubyOnRails
[16:36:09] mices: keep security secret questions and answers in the users table and make a separate table with the user_id foreign key
[16:36:21] ngscheurich: has joined #RubyOnRails
[16:36:21] mices: i mean or not and
[16:36:51] mices: any reason not to put secret questions in the users table?
[16:37:38] elaptics: dawkirst: I'd just do something like allow(request).to_receive(:path).and_return("/your-fake-path")
[16:38:11] dawkirst: elaptics: that doesn't work, I tried that.
[16:38:23] elaptics: dawkirst: what version of rails and rspec?
[16:38:36] tbuehlmann: could it be controller.request?
[16:38:39] elaptics: dawkirst: also gist your actual code and specs and output?
[16:39:11] elaptics: try what tbuehlmann says too, I think it varies with rails version and rspec version
[16:39:53] Dopagod: has joined #RubyOnRails
[16:39:53] Dopagod: has joined #RubyOnRails
[16:39:54] arBmind: has joined #RubyOnRails
[16:40:05] michaeldeol: has joined #RubyOnRails
[16:40:06] youngbaks: has joined #RubyOnRails
[16:41:15] habitullence: has joined #RubyOnRails
[16:41:40] dawkirst: Sure, I'll try and feed back
[16:43:25] cnk: has joined #RubyOnRails
[16:44:42] towski_: has joined #RubyOnRails
[16:44:44] herbst: has joined #RubyOnRails
[16:45:23] mehwork: say i add <%= link_to 'Home', welcome_path %> to views/articles/index.html.erb. Clicking on that link will try to take me to the 'show' action of WelcomeController (which doesn't exist). Can i make it go to the index action instead?
[16:45:45] mehwork: or do i have to make a show action?
[16:46:15] ishikawa91: you can update your routes.rb
[16:46:51] nobitanobi: has joined #RubyOnRails
[16:47:25] arBmind: has joined #RubyOnRails
[16:48:37] jtb__: has joined #RubyOnRails
[16:48:51] nobitanobi: Hello guys, I'm trying to test that my link headers have a set of 'rel' with proper values using rspec. Right now in my controller spec, if I do response.headers["link"] - I see "<http://www.example.com/users?page=1&per_page=1>; rel=\"first\", <http://www.example.com/users?page=3&per_page=1>; rel=\"last\", <http://www.example.com/users?page=2&per_page=1>; rel=\"next\""
[16:49:01] nobitanobi: Is there any matcher that will help me dealing with headers/rels?
[16:49:03] smathy: mehwork, look in rake routes and use the path helper for index.
[16:50:01] ericjphillips1: has joined #RubyOnRails
[16:50:38] chipotle: has joined #RubyOnRails
[16:52:04] safety_c_: has joined #RubyOnRails
[16:53:22] djbkd: has joined #RubyOnRails
[16:54:19] atomical: has joined #RubyOnRails
[16:55:10] Fire-Dragon-DoL: has joined #RubyOnRails
[16:55:32] podman: has joined #RubyOnRails
[16:56:03] smathy: nobitanobi, looks like the string output of an array, take a look at what class each element is, eg: response.headers["link"].first.class - then look that up and see how you can access the attributes.
[16:56:22] elaptics: nobitanobi: there's nothing built in but it's easy enough to create your own custom matcher
[16:56:39] Miron_: has joined #RubyOnRails
[16:56:43] nobitanobi: elaptics: yep, I will do that thanks. Never created a custom matcher, will have to research
[16:56:45] nobitanobi: thank you guys
[16:57:30] shmilan: has joined #RubyOnRails
[16:57:41] elaptics: nobitanobi: https://www.relishapp.com/rspec/rspec-expectations/v/3-3/docs/custom-matchers and an example that you should be able to adjust accordingly https://gist.github.com/jcf/917903
[16:57:52] mehwork: smathy: oh yeah i tried welcome_index but that just said 'undefined local variable welcome_index' even though rake routes says welcome_index GET /welcome(.:format) welcome#index
[16:58:38] kara_sweets: has joined #RubyOnRails
[16:59:08] mehwork: same error for both of these <%= link_to 'Home', welcome_index %> and <%= link_to 'Home', controller: welcome %>
[16:59:28] smathy: mehwork, those strings in the rake routes output are prefixes, you need to add _path or _url to the end of that to make the method, depending on whether you want just the path or the full URL.
[16:59:54] mehwork: aha, that worked. Thanks
[17:00:14] mehwork: rake routes is killing me with that missing _path stuff
[17:00:19] mehwork: hopefully i'll remember now
[17:00:34] smathy: mehwork, :)
[17:01:01] Shoutsid: has joined #RubyOnRails
[17:01:11] diegoviola: has joined #RubyOnRails
[17:01:57] nobitanobi: thanks elaptics
[17:02:45] ankhers: has joined #RubyOnRails
[17:03:56] jenrzzz: has joined #RubyOnRails
[17:04:54] giantoctopus: has joined #RubyOnRails
[17:04:55] riotjones: has joined #RubyOnRails
[17:06:27] giantoctopus: has joined #RubyOnRails
[17:07:46] Cache_Money: has joined #RubyOnRails
[17:07:47] dhjondoh: has joined #RubyOnRails
[17:08:19] giantoctopus: has joined #RubyOnRails
[17:08:29] RegulationD: has joined #RubyOnRails
[17:08:40] ankhers: has joined #RubyOnRails
[17:11:21] eggie5: I want to rebuild a view cache every night. My idea was to ping the specific url w/ curl, but it's cookie protected (devise), but I don't want to worry about updating cookies (expiry) on the curl task
[17:11:53] eggie5: How can I cause rails to run the view (rebuild the cache) in a rake task?
[17:12:48] nzst: has joined #RubyOnRails
[17:13:17] wuiiuam: has joined #RubyOnRails
[17:13:18] nandx64: has joined #RubyOnRails
[17:14:01] petricore: has joined #RubyOnRails
[17:14:39] mices: should intiger data type only be used for fields that are gonna be used in calculations
[17:14:40] sanjayu: has joined #RubyOnRails
[17:15:00] eggie5: reword: I invalidate my view cache every night w/ a rake task: `Note.all.each{|n|n.touch}` now I???d like to pre-cache it for the day. All this requires is a request to the url. How can I hit the URL form my rake task (not doing a HTTP request)?
[17:15:02] agit0: has joined #RubyOnRails
[17:15:09] mices: what about let's say credit card number, it can only be a number but does that mean i should use integer data type
[17:15:35] mices: i can use validations to make sure they're numbers if i use string
[17:15:55] beauby: has joined #RubyOnRails
[17:16:33] nobitanobi: elaptics can I get your suggestion on the matcher. I ideally would want to write an expectation that checks that the rel exists with a particular value. So, something like it_has_rel_with_value('rel_name', 'expected_value')
[17:16:39] jhass: mices: only is strong, but think about what the common operations on the data will be
[17:16:50] nobitanobi: but we usually write expectation with just one value. Do you have any suggestions?
[17:16:58] roshanavand: has joined #RubyOnRails
[17:17:01] mices: jhass: no calculations whatsover
[17:17:03] snowy: mices I would treat cc numbers as a string to avoid integer overflow. but seriously, don't store cc numbers.
[17:17:05] jhass: will you add two credit card numbers? or does doing eg cvv validation rather require it in a certain datatype
[17:17:55] smathy: mices, it's not about whether you do calculations, it's about - semantically - what the field represents. A CC number is really just a unique code (that happens to be digits only).
[17:18:21] smathy: ...but what snowy says too, don't store CC numbers.
[17:18:28] mices: so from what i'm getting from you guys i'm going with string
[17:19:04] mices: got a point, no need to, people can keep whipping it out
[17:19:04] smathy: mices, no, from what you get from we guys, don't store CC numbers.
[17:19:16] mices: yea i agree, no need to, thanks
[17:19:27] alexhartley: has joined #RubyOnRails
[17:19:34] mices: i'll just let them keep reaching for their wallets every time they wanna use my site
[17:19:44] Miro___: has joined #RubyOnRails
[17:19:48] mices: i dunno, that doesn't really sound great either, ya know?
[17:20:24] Lincee: has joined #RubyOnRails
[17:20:36] snowy: mices there are services available (such as stripe.com) that will store cc numbers for you. only they are up to certified standards of security that we will likely never reach, and they are then liable for any loss
[17:20:54] rakm: has joined #RubyOnRails
[17:21:03] mices: snowy: cool thanks
[17:21:26] shoutsid06: has joined #RubyOnRails
[17:21:36] mices: and i can keep whatever portion of the cc data on my server and off theirs that i want?
[17:21:49] mices: like i keep the name on the card and give them the number
[17:22:13] mices: i give them all the card info minus the name which i swap for user_id
[17:22:14] EminenceHC: has joined #RubyOnRails
[17:22:19] ahmgeek: any help ? https://gist.github.com/ahmgeek/544f4006aec6051d1e41
[17:22:57] wldcordeiro: has joined #RubyOnRails
[17:23:50] smathy: I'm really not going to sleep well knowing that mices is working with CC numbers.
[17:23:58] chills42: has joined #RubyOnRails
[17:24:23] smathy: ahmgeek, let's work through this together. Which line is the error coming from?
[17:24:37] ahmgeek: users = usrs_ids.split(',').map(&:to_i)
[17:24:40] workmad3: mices: the way stripe generally works is via a bit of JS in their page, and they pass you back just the bits that you're absolutely required to keep for your own records
[17:25:06] workmad3: mices: if the CC numbers even *pass through* your server, you need PCI compliance for your servers
[17:25:41] acti0nman: compliance is just good hygiene
[17:26:25] northfurr: has joined #RubyOnRails
[17:27:33] smathy: ahmgeek, funny because you just showed that the code in your gist is not the code you're running :)
[17:28:10] ahmgeek: https://gist.github.com/ahmgeek/544f4006aec6051d1e41#file-ids-rb-L3 :(
[17:28:15] ahmgeek: smathy: https://gist.github.com/ahmgeek/544f4006aec6051d1e41#file-ids-rb-L3 :(
[17:28:36] ahmgeek: smathy: ouch :D sorry
[17:28:37] smathy: ahmgeek, but that's not what you just wrote in the chat.
[17:28:39] ahmgeek: sooooorrrry
[17:28:40] smathy: ahmgeek, :)
[17:28:42] mikecmpbll: has joined #RubyOnRails
[17:29:12] ahmgeek: smathy: https://gist.github.com/ahmgeek/544f4006aec6051d1e41 discard the puts, debugging purposes :D
[17:29:34] ahmgeek: last line is the error
[17:29:46] messine: has joined #RubyOnRails
[17:29:53] havenwood: has joined #RubyOnRails
[17:31:09] `based_pdev`: has joined #RubyOnRails
[17:32:03] messine: Hi, im using devise and am going to create a status object that is associated with the user model. User has_one status. I kind of need the status object to be created when the user is would it be bad to create a status in the user create action? I'm trying to think of scenarios where somehow status validation fails and a bunch of unintended stuff happens
[17:32:06] safety_cut: has joined #RubyOnRails
[17:33:43] tbuehlmann: messine, the controller (or a service object being called there) sounds good to me
[17:34:02] elaptics: nobitanobi: that's what the fluent interface would be used for https://www.relishapp.com/rspec/rspec-expectations/v/3-3/docs/custom-matchers/define-matcher-with-fluent-interface
[17:34:03] DEA7TH: ahmgeek: you're using map on a dictionary, how do you expect it to behave? I think you need to do dict.map { |e| e.map { |inner| (...) } }
[17:34:08] DEA7TH: a nested map
[17:34:13] atomical_: has joined #RubyOnRails
[17:34:20] nfk|laptop: has joined #RubyOnRails
[17:34:20] elaptics: nobitanobi: so you could have has_rel("foo").with_value("bar")
[17:34:32] pwnd_nsfw: has joined #RubyOnRails
[17:35:13] messine: tbuehlmann, thanks mate I dont know what a service object is but im looking into it
[17:35:14] DEA7TH: but you're also calling split on a dictionary, that also doesn't work. I don't know what you're trying to do
[17:35:39] DEA7TH: I don't see anything in params which needs .split(',')
[17:35:41] toastercup: has joined #RubyOnRails
[17:35:49] eggie5: has joined #RubyOnRails
[17:35:49] tbuehlmann: messine, that's a simple object doing something very specific, like creating a user (and its status)
[17:36:13] messine: nice! that sounds useful
[17:36:19] ahmgeek: DEA7TH: I need to got the list of IDs in an integer array
[17:37:06] DEA7TH: oh, I misread the params.
[17:37:21] diegobiavati: has joined #RubyOnRails
[17:37:43] DEA7TH: ahmgeek: actually you're not calling anything on a dictionary, hold on...
[17:38:32] DEA7TH: ahmgeek: line 4 does nothing. And line 7 needs to be users = usrs_ids.map(&:to_i)
[17:39:19] netzfisch: has joined #RubyOnRails
[17:42:01] bmalum: has joined #RubyOnRails
[17:42:07] dionysus69: has joined #RubyOnRails
[17:42:19] hobodave: has joined #RubyOnRails
[17:42:33] sarink: has joined #RubyOnRails
[17:43:02] diegobiavati: has joined #RubyOnRails
[17:43:07] rapha: has joined #RubyOnRails
[17:43:48] rapha: When I have a "scope "/:locale", locale: /de|en/ do" in routes.rb, and I want to have something like "get 'sign_up', to: 'users#new', as: :sign_up", does the latter thing go *inside* the scope or *outside* of it?
[17:44:40] andrew-l: has joined #RubyOnRails
[17:44:58] eggie5: has joined #RubyOnRails
[17:45:54] sonofdirt: has joined #RubyOnRails
[17:46:29] wuiiuam: has joined #RubyOnRails
[17:46:34] jgt: has joined #RubyOnRails
[17:47:02] jtb___: has joined #RubyOnRails
[17:47:07] ahmgeek: DEA7TH: https://gist.github.com/ahmgeek/544f4006aec6051d1e41
[17:47:30] northfurr: has joined #RubyOnRails
[17:48:34] andrew-l: hi, in a rack middleware on a rails app, is there a way to access the Request object for the IP address directly? whenever I try: env['action_dispatch.remote_ip'], the result is: [#<ActionDispatch::RemoteIp::GetIp:0x0000000a55a6e0 @env={"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>fa...
[17:48:38] EminenceHC: has joined #RubyOnRails
[17:48:43] based_pdev: has joined #RubyOnRails
[17:48:51] DEA7TH: ahmgeek: you're printing usrs_ids instead of users
[17:49:38] ahmgeek: DEA7TH: ouch. :*
[17:50:10] cac: has joined #RubyOnRails
[17:50:32] LambdaSo_: has joined #RubyOnRails
[17:50:47] elaptics: rapha: depends if you want that scope to apply to the route or not
[17:50:57] meoblast001: has joined #RubyOnRails
[17:53:24] rapha: elaptics: I want both /sign_in and /de/sign_in to work. Right now (with the get inside the scope) I get "no such route" errors which are not entirely clear to me (trying to figure out when it works and when not)
[17:56:59] elaptics: rapha: you need to make the scope optional then, like so: scope "(:locale)", locale: /de|en/ do
[17:57:33] n1lo: has joined #RubyOnRails
[17:58:00] eggie5: has joined #RubyOnRails
[17:58:54] Linuus: has joined #RubyOnRails
[17:59:38] wildlander: has joined #RubyOnRails
[18:00:34] Shoutsid: has joined #RubyOnRails
[18:00:43] Lightsword: has joined #RubyOnRails
[18:01:03] yaymukund: has joined #RubyOnRails
[18:01:34] agit0: has joined #RubyOnRails
[18:02:10] rapha: elaptics: Hmm. Okay, so inside + optional it is. Thank you!
[18:02:34] bap1313: has joined #RubyOnRails
[18:04:35] MartinElvar: has joined #RubyOnRails
[18:04:41] jenrzzz: has joined #RubyOnRails
[18:05:07] eggie5: has joined #RubyOnRails
[18:05:45] riotjones: has joined #RubyOnRails
[18:06:00] agit0: has joined #RubyOnRails
[18:06:19] User458764: has joined #RubyOnRails
[18:06:40] riotjones: has joined #RubyOnRails
[18:08:26] dikaio: has joined #RubyOnRails
[18:08:53] northfurr: has joined #RubyOnRails
[18:11:26] michaeldeol: has joined #RubyOnRails
[18:11:49] allcentury: has joined #RubyOnRails
[18:13:01] EminenceHC: has joined #RubyOnRails
[18:13:48] Coldblackice_: has joined #RubyOnRails
[18:14:20] eggie5: has joined #RubyOnRails
[18:14:47] baweaver: has joined #RubyOnRails
[18:15:28] craysiii: ewilliam you don't NEED an else to accompany an elsif, but if does leave a condition unmet (params[:wallet][:wallet_type_id] != 1 or 2)
[18:15:49] discounted: has joined #RubyOnRails
[18:15:51] craysiii: if you're sure you will only get 1 or 2, there's no real reason to use an elsif, a plan else would suffice.
[18:16:21] craysiii: though i would account for the possibility that the wallet_type_id falls outside the acceptable range.
[18:18:27] havenwood: has joined #RubyOnRails
[18:19:02] nogic: has joined #RubyOnRails
[18:19:22] wuiiuam: has joined #RubyOnRails
[18:21:26] jon1: has joined #RubyOnRails
[18:22:35] mwlang: has joined #RubyOnRails
[18:23:30] mwlang: my google-fu is failing me: Where do I turn off new line and indentation for XML generation when using Builder::XmlMarkup via a *.builder view template file?
[18:23:30] eggie5: has joined #RubyOnRails
[18:24:25] hephaestus_rg: has joined #RubyOnRails
[18:25:15] dideler: has joined #RubyOnRails
[18:25:51] speakingcode: has joined #RubyOnRails
[18:25:55] jvanbaarsen: has joined #RubyOnRails
[18:26:37] mwlang: oh, wow. gotta monkey patch actionview to do it.
[18:26:50] futilegames: has joined #RubyOnRails
[18:27:00] _wldcordeiro: has joined #RubyOnRails
[18:28:08] michaeldeol: has joined #RubyOnRails
[18:28:20] manfrin: has joined #RubyOnRails
[18:28:27] chrissonar: has joined #RubyOnRails
[18:29:10] chrissonar: which syntax highlightning gem do you advise for Heroku hosted application?
[18:29:28] siddart: has joined #RubyOnRails
[18:29:34] _wldcordeiro: has joined #RubyOnRails
[18:29:59] n008f4g_: has joined #RubyOnRails
[18:30:01] chrissonar: I think I don't want to rely on externals like python then.
[18:30:20] chrissonar: is codera the best option?
[18:31:19] aquiles: has joined #RubyOnRails
[18:31:28] mrburied: can you point me to the documentation of "submit.rails" where I can see it
[18:31:49] User458764: has joined #RubyOnRails
[18:32:25] elaptics: chrissonar: probably, or there are some JS solutions
[18:32:34] elaptics: mrburied: what is submit.rails?
[18:32:54] wldcordeiro: has joined #RubyOnRails
[18:32:58] chrissonar: elaptics, I think I want backend parsing.
[18:33:14] mrburied: It is JS function which submits your form. But no idea where it is documented
[18:33:22] mrburied: I see it in my codebase
[18:33:43] elaptics: mrburied: that's likely to be just standard javascript to just submit a form
[18:34:06] mrburied: no. It is Rails stuff.
[18:34:18] elaptics: mrburied: !code then
[18:34:18] helpa: mrburied: 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.
[18:34:19] mrburied: $(".links-share").trigger('submit.rails');
[18:34:29] elaptics: mrburied: what version of rails?
[18:34:38] alexhartley: has joined #RubyOnRails
[18:35:42] chrissonar: what about rouge? coderay does not seem to be maintained anymore
[18:35:47] hahuang65: has joined #RubyOnRails
[18:36:02] simplyianm: has joined #RubyOnRails
[18:36:15] elaptics: mrburied: is it upgraded from an older version of rails?
[18:36:35] mrburied: No.. building from a scratch.
[18:37:04] mrburied: Well, I recall tubbo has shown me a code where he used it. tubbo where it is documented ?
[18:37:13] michaeldeol: has joined #RubyOnRails
[18:37:25] elaptics: mrburied: this is all I know about https://github.com/rails/jquery-ujs/wiki/ajax
[18:37:48] mrburied: Yes, I read it from first to last, I didn't see it.
[18:38:04] elaptics: I don't know what else would be triggering that unless you have some gem that's doing it?
[18:38:20] elaptics: mrburied: who wrote that code in your app? Does the commit message explain it at all?
[18:38:34] tubbo: mrburied: oh it is not documented. :)
[18:38:36] tubbo: hold on a sec
[18:38:43] mrburied: see he knows
[18:39:19] mrburied: elaptics: nothing in commit .. it just works
[18:39:34] tubbo: mrburied: here's where i found it https://github.com/rails/jquery-ujs/blob/master/src/rails.js#L446
[18:39:43] tubbo: and i just triggered it on the form
[18:39:59] tubbo: mrburied: it has to be a form fwiw...are you trying to do that on a link or something?
[18:40:25] toretore: has joined #RubyOnRails
[18:40:33] simplyianm: has joined #RubyOnRails
[18:40:55] mrburied: No it is form. It works. I have to do another thing. I want to add a key/value in params hash before form submit using Jquery.
[18:41:00] mrburied: any idea how to do it /
[18:41:15] craysiii: hidden field
[18:41:19] mrburied: I am using this wizard http://getfuelux.com/javascript.html#wizard
[18:41:45] mrburied: yes, that is one option. I am checking if on the fly I can do insert or not
[18:41:47] eggie5: has joined #RubyOnRails
[18:41:49] Palsson: has joined #RubyOnRails
[18:42:06] tubbo: mrburied: why before the form submission?
[18:42:28] tubbo: usually when i need to populate data in a form outside of the user's control i do it on the server side in my controller
[18:42:34] tubbo: that way the user can't forge the parameters
[18:42:53] mrburied: I meant once I will click on last step of the wizard, form getting submit using the rails.submit
[18:43:24] carlosd: has joined #RubyOnRails
[18:43:32] mrburied: But in that time, I want to add one more key/value to the params
[18:43:47] elaptics: tubbo: why do you use undocumented methods? Isn't it just simpler and safer to use jquery or whatever to find the form you want to submit and just trigger it?
[18:43:48] mrburied: because in 3rd step i have some other data
[18:43:49] havenn: has joined #RubyOnRails
[18:44:30] carlosd: is it possible to use activejob with an activerecord object that has virtual attributes?
[18:45:26] mrburied: hidden field one idea, but I am looking for a way where I can add it directly to the params while submitted
[18:46:04] mrburied: another choice is: http://stackoverflow.com/a/17749538/2767755
[18:46:31] Sou|cutter: has joined #RubyOnRails
[18:46:53] Synthead: I have an app that will work well with MySQL and PostgreSQL. Is there a way I can dynamically require either the mysql2 gem or the pg gem depending on what's in database.yml?
[18:47:06] tubbo: elaptics: i honestly can't remember off the top of my head why i needed that, but 'submit.rails' is the event that's fired on a remote form when you submit it.
[18:47:25] tubbo: but it does all the other things like fire ajax:success, ajax:complete events, etc.
[18:47:36] HD: has joined #RubyOnRails
[18:47:44] tvon: has joined #RubyOnRails
[18:47:51] Sou|cutter: It seems a common railtie pattern to have an `initialize "mygem.init" { ActiveSupport.on_load(:action_controller) { include Mygem::Extensions } }`
[18:48:24] portiad: has joined #RubyOnRails
[18:48:47] Sou|cutter: I had a problem where my Gemfile was sensitive to ordering because one Railtie caused another to execute after it, and the 2nd one's on_load never triggered
[18:49:12] Sou|cutter: Presumably that's because ActionController had already gotten loaded by something I think?
[18:49:47] Sou|cutter: So my question is, would it be a better pattern for gems sensitive to on_load events to register those in `config.before_configuration` blocks rather than in initializer blocks?
[18:51:02] eggie5: has joined #RubyOnRails
[18:51:15] tubbo: Sou|cutter: i usually just do it in the Engine class level directly
[18:51:27] tubbo: for example, here's how decent_exposure does it: https://github.com/hashrocket/decent_exposure/blob/master/lib/decent_exposure.rb
[18:51:28] Sou|cutter: I don't think this comes up very much, because AFAICT a ton of gems use the `initialize` pattern, so I'm not sure the combination of initializers that is creating this situation in my app
[18:51:38] tubbo: Sou|cutter: if it's in an initializer, i feel like ActionController is already loaded
[18:52:28] havenwood: has joined #RubyOnRails
[18:52:36] Sou|cutter: That does seem better
[18:52:52] Sou|cutter: I guess a lot of people have just cargo-culted the initialize pattern
[18:53:51] Sou|cutter: The only time it might make sense to throw into a railtie is where a gem may or may not be used in conjunction with rails
[18:54:31] yfeldblum: has joined #RubyOnRails
[18:55:41] yfeldblum: has joined #RubyOnRails
[18:56:13] Sou|cutter: tubbo: thanks
[18:56:18] agit0: has joined #RubyOnRails
[18:57:08] jessemcgilallen: has joined #RubyOnRails
[18:57:53] smathy: Synthead, you're worried about the memory taken by having both required?
[18:57:58] yfeldblum: has joined #RubyOnRails
[18:58:45] jvanbaarsen: has joined #RubyOnRails
[19:01:11] baweaver: has joined #RubyOnRails
[19:03:41] sankaber: has joined #RubyOnRails
[19:03:41] Pharaoh2: has joined #RubyOnRails
[19:05:58] wuiiuam: "bin/rails g controller welcome index" Do I have to run this in bin?
[19:06:24] FailBit: you in fact should not
[19:06:38] wuiiuam: FailBit, ty
[19:06:49] MartinElvar: has joined #RubyOnRails
[19:07:29] riotjones: has joined #RubyOnRails
[19:08:41] inoter: has joined #RubyOnRails
[19:09:24] eggie5: has joined #RubyOnRails
[19:09:46] jenrzzz: has joined #RubyOnRails
[19:10:23] blackmesa: has joined #RubyOnRails
[19:12:04] netzfisch: has joined #RubyOnRails
[19:12:46] portiad: has joined #RubyOnRails
[19:13:08] Akuma: has joined #RubyOnRails
[19:14:02] Linuus: has joined #RubyOnRails
[19:14:28] tvon: has joined #RubyOnRails
[19:15:30] ngr: mikecmpbll: you were right. i ended implementing it myself.
[19:16:39] mrburied: FailBit: bundle exec <then the shit> ?
[19:16:55] FailBit: I don't even bother
[19:16:56] mrburied: instead of bin/rails
[19:17:07] FailBit: I just run rails g controller foo
[19:17:10] mrburied: I do.. :) not sure why I do that
[19:17:38] mikecmpbll: ngr: what was your implementation like
[19:18:01] Pharaoh2: has joined #RubyOnRails
[19:18:31] eggie5: has joined #RubyOnRails
[19:19:42] aquiles: has joined #RubyOnRails
[19:20:04] jeremy: has joined #RubyOnRails
[19:20:05] rromanchuk: has joined #RubyOnRails
[19:20:09] Otterpocket: has joined #RubyOnRails
[19:20:36] Guest24491: has left #RubyOnRails: ()
[19:20:54] mehwork: anyone know why this is saying "articles_controller.rb:30: syntax error, unexpected end-of-input, expecting keyword_end" http://pasted.co/88cfcd7e
[19:21:08] mehwork: i copy and pasted that code directly from my tutorial so i know i didn't type anything wrong
[19:21:09] drim: has joined #RubyOnRails
[19:21:25] mehwork: plus it looks like it would only need 3 'ends' to me, but clearly something is wrong
[19:21:56] mehwork: i've tried adding an extra <% end %> and taking one out too, same error
[19:22:14] mehwork: the end is near.
[19:22:20] drim: Im trying to use form_for with a non model class, but when submitting the form, there is no errors displayed. Here the code https://gist.github.com/jeremymarc/f71aafc8810830377a64 thank you
[19:22:24] andatche: has joined #RubyOnRails
[19:22:59] cornerma1: has joined #RubyOnRails
[19:23:39] djbkd: has joined #RubyOnRails
[19:24:23] djbkd: has joined #RubyOnRails
[19:25:02] nogic: has joined #RubyOnRails
[19:25:15] mices: i'm working on a sellers platform and i'm trying to figure out how i would extract my fees from digital payments sent between users
[19:25:34] netzfisch: has joined #RubyOnRails
[19:25:42] mices: so one person pays another with paypal, how will i get my fee
[19:26:03] smathy: mehwork, !gist your articles_controller
[19:26:03] helpa: mehwork: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:26:03] tubbo: mices: you don't! ever wonder how bandcamp works?
[19:26:49] mices: tubbo: what's bandcamp?
[19:27:17] drim: any ideas guys about why the form is not displaying any validation errors https://gist.github.com/jeremymarc/f71aafc8810830377a64 ?
[19:27:40] eggie5: has joined #RubyOnRails
[19:27:43] tubbo: mices: its a music hosting platform. if you buy from paypal directly through an artist on bandcamp, they don't take any of their fees out of the deal because you're paying someone directly. as soon as you start selling merch, though, they will basically take as much of their cut as they can (even entire purchase orders) before paying you out.
[19:28:09] tubbo: mices: problem is, bandcamp doesn't really have much of a way of knowing what's going on as soon as you go off-site to paypal..
[19:28:27] tubbo: but now i think it might be different
[19:29:09] tubbo: mices: if you're building a platform for sellers, you might want to go with a merchant service like stripe or something
[19:29:15] mices: tubbo: i sell phones on swappa sometimes, people send me paypals for the amount they paid for the phone minus the swappa fee, how do they do that
[19:29:18] mehwork: thanks smathy that was why. I was missing an 'end' in my article controller
[19:29:55] drim: mices take a look on that https://github.com/jeremymarc/active_payment
[19:30:02] mehwork: at least the error message told me which file, i was just too dumb to read it clearly and assumed it was talking about the view
[19:30:15] drim: i have done that handle paypal payments like swappa (with a marketplace fees)
[19:30:29] smathy: drim, you mean it's not being wrapped in a div.field_with_errors ?
[19:30:45] drim: smathy > there is no error displayed if I submit the form
[19:31:10] tubbo: mices: hmm, i don't know. i'd have to look more into it. but i think bandcamp's one difference is you don't necessarily need an account to checkout.
[19:31:16] smathy: drim, form_for doesn't display errors automagically.
[19:31:25] tubbo: i assume with swappa you need an account to buy/sell for various other reasons
[19:31:36] mices: ebay bills for the fees after
[19:32:03] smathy: drim, it will wrap the fields with the errors in a <div class="field_with_errors"> - but that's it.
[19:33:03] drim: i dont see that either
[19:33:43] Miron_: has joined #RubyOnRails
[19:33:58] tubbo: mices: yeah i forgot about that one :)
[19:34:04] nfk: has joined #RubyOnRails
[19:34:30] mices: tubbo: account doesn't matter, unless i wanna hold everyone's money and issue checks on request
[19:34:45] mrburied: drim: https://www.ruby-forum.com/topic/217871
[19:35:05] mrburied: I thin that class is by default display: none
[19:35:14] mrburied: that is why you don't see it.
[19:35:23] nzst: has joined #RubyOnRails
[19:35:25] smathy: drim, !gist the HTML source of the page rails renders after you submit a form with an invalid field
[19:35:25] helpa: drim: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:35:41] tubbo: mices: might require you to dive into the paypal documentation for that one.
[19:35:49] Otterpocket: has joined #RubyOnRails
[19:35:52] tubbo: i know it's possible because paypal can pretty much do whatever you want
[19:35:53] drim: mices: checkout the lib I sent you
[19:36:05] Otterpocket: Hello, I'm looking for some help with how ActionCable works. I would like to trigger an actioncable event but from a post request outside of the application. What do I need to do because I think that it relies on a user session
[19:36:13] smathy: mrburied, that's crazy, if it was display:none then the whole field would be hidden from display.
[19:36:16] baweaver: has joined #RubyOnRails
[19:36:35] willardg: has joined #RubyOnRails
[19:36:42] mrburied: smathy: Yes, I was wrong. I just felt it
[19:36:42] Otterpocket: Any help, including links to documentation would be a great
[19:36:53] eggie5: has joined #RubyOnRails
[19:37:29] tubbo: otterpocket: not much is around right now unfortunately, as it hasn't been officially released. i would check the readme
[19:37:41] SteenJobs: has joined #RubyOnRails
[19:37:52] drim: smathy https://gist.github.com/jeremymarc/36469a6c13e42e03bfd3 (after form submitted)
[19:38:59] tvon: has joined #RubyOnRails
[19:39:17] drim: (keep in mind my model is a PORO and not an activemodel)
[19:39:37] smathy: drim, yeah, you must be missing something there to trigger the validation wrappers.
[19:40:07] drim: yes I guess lol
[19:41:04] sankaber: has joined #RubyOnRails
[19:41:48] andrew-l: has left #RubyOnRails: ("ERC Version 5.3 (IRC client for Emacs)")
[19:41:51] smathy: drim, try including ActiveModel::Model instead of the selective things you're doing.
[19:42:04] drim: I tried also
[19:42:57] mlangenberg: has joined #RubyOnRails
[19:43:10] cac: has joined #RubyOnRails
[19:43:18] doodleha_: has joined #RubyOnRails
[19:44:31] FCser: has joined #RubyOnRails
[19:44:33] drim: smathy its doing the same thing
[19:44:47] FailBit: https://twitter.com/ericwastl/status/588084288756850688
[19:44:52] HAL2328: has joined #RubyOnRails
[19:45:02] bruno-: has joined #RubyOnRails
[19:46:01] eggie5: has joined #RubyOnRails
[19:46:05] EminenceHC: has joined #RubyOnRails
[19:46:06] mrburied: has joined #RubyOnRails
[19:48:23] mices: drim: from what i could tell i would have to set up multiple sales for each sale a payment to the seller and a payment to the house
[19:48:40] drim: right this is what I did
[19:48:55] drim: sales ActivePayment::Models::Sales.new([sale, tips])
[19:49:55] eggie5: has joined #RubyOnRails
[19:50:55] drim: smathy when I inspect my object, object.errors contains all the errors
[19:50:57] hephaestus_rg: has joined #RubyOnRails
[19:53:10] sudiptamondal: has joined #RubyOnRails
[19:53:48] baweaver: has joined #RubyOnRails
[19:54:11] Ergo: has joined #RubyOnRails
[19:55:04] mices: drim: i don't see how rails is supposed to know the field and the value contained in the field for the amount of the payment just by sale=Phone.find(1)
[19:56:48] drim: mices check the concern
[19:56:57] drim: you can override that in your model
[19:57:37] n1lo: has joined #RubyOnRails
[19:57:37] ellisTAA: has joined #RubyOnRails
[19:57:59] ellisTAA: if i call update on an active record object, do i need to call save on it? no right?
[19:58:24] drim: mices > https://github.com/jeremymarc/active_payment/blob/master/lib/active_payment/models/concerns/payable.rb
[19:58:32] mrburied: update SAVE it
[19:59:43] youngbaks: has joined #RubyOnRails
[20:00:32] smathy: drim, depending on where you have your Partner file, perhaps you need to restart your server (and spring) to reload the class, because including ActiveModel::Model works.
[20:01:08] drim: trying...
[20:01:08] shinnya: has joined #RubyOnRails
[20:01:52] drim: (its in my model folder and it didn't change anything :(
[20:02:32] HAL2328_: has joined #RubyOnRails
[20:05:05] barhum2013: has joined #RubyOnRails
[20:05:10] barhum2013: has left #RubyOnRails: ()
[20:05:34] codeurge: has joined #RubyOnRails
[20:07:12] DanKnox: has joined #RubyOnRails
[20:07:13] agit0: has joined #RubyOnRails
[20:07:19] bruno-: has joined #RubyOnRails
[20:07:23] havenwood: has joined #RubyOnRails
[20:07:34] siaW: has joined #RubyOnRails
[20:07:38] siaW: i have my css as this: https://gist.github.com/siaw23/84eeb4ab71bd2ccc1437 and i want the header and the button element to be inline, but it???s not working. it???s showing like this still: https://gyazo.com/a497cc4b8b7df9e6aaef19f0014dd579 any help? please?
[20:09:08] HAL2328: has joined #RubyOnRails
[20:09:31] eggie5: has joined #RubyOnRails
[20:10:31] sonofdirt: has joined #RubyOnRails
[20:11:41] smathy: drim, so just to confirm where that HTML came from, you load the /project/new page, click the submit button, the response is rendered, and then you viewed source and copied/pasted it to the gist?
[20:11:59] michaeldeol: has joined #RubyOnRails
[20:12:03] smathy: */partner/new
[20:13:01] Gmi: has joined #RubyOnRails
[20:15:22] diegobiavati: has joined #RubyOnRails
[20:16:37] yaymukund: has joined #RubyOnRails
[20:16:40] drim: smathy> exactly
[20:16:56] drim: its rendering the fields with the values I have submitted
[20:17:01] joshkovach: has joined #RubyOnRails
[20:17:17] Radar: GOOD MORNING
[20:17:20] simkessy: I have a question regarding jobs. I put the details here: https://www.reddit.com/r/rails/comments/3o0d3h/i_want_to_create_a_job_to_change_the_state_of_a/
[20:17:20] drim: but no errors
[20:17:53] simkessy: Basically I'm trying to find out if having a job to change the state of records is a bad idea
[20:18:03] baweaver: has joined #RubyOnRails
[20:18:47] eggie5: has joined #RubyOnRails
[20:19:29] wldcordeiro: has joined #RubyOnRails
[20:22:52] rhizome: why do they need their states change?
[20:24:03] nzst: has left #RubyOnRails: ("ERC (IRC client for Emacs 24.5.1)")
[20:25:14] atmosx: has joined #RubyOnRails
[20:25:46] safety_cut: has joined #RubyOnRails
[20:26:51] simkessy: rhizome: for me, it's kind of an organization thing. I can quickly just run Availability.missed Availability.open Availability.sold
[20:27:02] simkessy: If I'm in the db it's clear what's what
[20:27:18] safety_c_: has joined #RubyOnRails
[20:27:20] mices: drim: so in the example i just edit "amount: amount.to_i" anyway i want in def to_paypal_hash to subtract my fees from amount?
[20:27:54] eggie5: has joined #RubyOnRails
[20:28:36] simkessy: rhizome: I'm also thinking it's easier to query the state column then to check booking and date column
[20:30:02] mehwork: how come if i add .foo { color: yellow; } to articles.scss it doesn't overrid application.css's .foo { color: red; } ? Shouldn't specific stylesheets override general ones?
[20:30:26] djbkd: has joined #RubyOnRails
[20:30:50] FailBit: ACTION breathless "the cascade"
[20:31:01] MartinElvar: has joined #RubyOnRails
[20:32:03] erich: has joined #RubyOnRails
[20:32:26] eggie5: has joined #RubyOnRails
[20:32:28] mehwork: if i add font-weight: bold to articles.scss it adds it but doesn't let me overwrite color unless i add !important (which i don't want to do)
[20:34:38] arBmind: has joined #RubyOnRails
[20:34:52] rhizome: simkessy: marking missed appointments i can see, not sure about the rest
[20:34:53] jon1: has joined #RubyOnRails
[20:34:53] based_pdev_: has joined #RubyOnRails
[20:34:53] mehwork: i'm not a css expert so i'm sure i'm doing something wrong. Maybe i should just be more specific in the css and add do something like form[action='/articles'].field_with_errors or whatever it'd be
[20:35:28] rhizome: mehwork: google "css specificity"
[20:37:08] Maletor: has joined #RubyOnRails
[20:37:16] mehwork: rhizome: rails doesn't name my forms so i imagine i have to try to do it based on the action path
[20:38:11] tubbo: mehwork: rails gives your forms class names if you use form_for i think
[20:38:21] rhizome: mehwork: can't do that
[20:38:32] FailBit: (??????????????????? ?????????
[20:38:35] rhizome: form_for will give you an id and a class
[20:38:56] mehwork: body form[action="/articles"] .field_with_errors { seems to work though
[20:39:29] rhizome: but even 'form .foo { color: $red }' is more specific than just .foo{}
[20:39:38] simkessy: rhizome: what's you're reason? Are you thinking differentiating between sold / open is not necessary?
[20:39:46] hephaestus_rg: has joined #RubyOnRails
[20:39:48] mehwork: i'm using form_for but inspecting the form just says <form action="/articles" accept-charset="UTF-8" method="post">
[20:39:50] rhizome: simkessy: i don't know your business
[20:41:10] rhizome: if it's anything like the iBrothel it sounds like, you can get open and sold whenever they're displayed, i don't know why you'd need to mark them otherwise
[20:41:20] mehwork: ah, it was because i was using <%= form_for :article, url: articles_path do |f| %> which doesn't add an id to the form
[20:41:36] mehwork: <%= form_for @article do |f| %> does though
[20:43:09] subshad: has joined #RubyOnRails
[20:43:31] simkessy: rhizome: haha iBrothel
[20:43:49] willardg: has joined #RubyOnRails
[20:44:00] simkessy: rhizome: yea, It seems like it's just simpler to use named scopes to represent the states
[20:44:20] simkessy: and just not use a job for this
[20:45:42] mehwork: why does rails 4.2 even still support "form_for :blah, url: blah_path"? Backwards compat?
[20:46:14] rhizome: because it lets you control the object and the url being operated on/with
[20:46:19] FailBit: no, because :blah is treated as namespace
[20:46:26] FailBit: part of the args to polymorphic_path
[20:46:31] alexhartley: has joined #RubyOnRails
[20:46:33] havenwood: has joined #RubyOnRails
[20:46:50] nettoweb: has joined #RubyOnRails
[20:47:31] mehwork: how would you an add id to the form using the :blah version?
[20:48:06] mehwork: looks like :html { id: 'foo' } nm
[20:48:26] mehwork: rather :html { :id => 'foo' }
[20:49:15] yfeldblum: has joined #RubyOnRails
[20:50:24] mehwork: <%= form_for :article, url: articles_path, :html => { :id => 'whatever' } do |f| %>
[20:50:32] mehwork: yeah i'll stick to @article :/
[20:51:36] arthurix: has joined #RubyOnRails
[20:53:44] mehwork: then all i have to do is form#new_article .field_with_errors
[20:55:03] bruno-: has joined #RubyOnRails
[20:55:28] craysiii: which http code should i return if a model fails to save in my controller?
[20:57:01] edwinvdgraaf: has joined #RubyOnRails
[20:59:09] waseem_: craysiii: Probably 400. See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes and decide.
[20:59:41] craysiii: yes i was looking here http://billpatrianakos.me/blog/2013/10/13/list-of-rails-status-code-symbols/ , i just want to be as semantically accurate as possible
[20:59:45] mehwork: doesn't it depend on what you're doing? E.g. if it's a form validation error then just allowing the 200 and showing an error message is fine isn't it?
[21:00:06] waseem_: mehwork: In case of an API.
[21:00:29] craysiii: it is an API controller
[21:01:21] simplyianm: has joined #RubyOnRails
[21:01:22] mehwork: then 400 yeah
[21:01:29] wethu: has joined #RubyOnRails
[21:01:39] waseem_: craysiii: This has good use cases listed http://www.restapitutorial.com/httpstatuscodes.html
[21:01:55] rhizome: don't forget https://twitter.com/stevelosh/status/372740571749572610
[21:02:10] craysiii: wouldn't model not saving be a server error and not client? i guess that depends on why the model didn't save huh.
[21:02:34] mehwork: in that case 501?
[21:02:59] craysiii: ah that restapi site is awesome.
[21:03:17] craysiii: thanks everyone, ill just stick with 500 for now
[21:03:34] rhizome: https://www.google.com/search?q=rails+validation+error+http+code lots there
[21:05:20] neanderslob: has joined #RubyOnRails
[21:06:20] riotjones: has joined #RubyOnRails
[21:07:19] havenwood: has joined #RubyOnRails
[21:10:12] pwnd_nsfw: has joined #RubyOnRails
[21:10:25] eggie5: I'm able to render my partial to a string, but if it contains any `link_to` code, it gives this error: `ActionView::Template::Error: arguments passed to url_for can't be handled. Please require routes or provide your own implementation`
[21:10:29] eggie5: anyone know how to use `link_to` w/ `render_to_string` ?
[21:12:00] `based_pdev`: has joined #RubyOnRails
[21:12:56] simkessy: Can scope shave and / or? scope :open, -> {where{(start_time >= Time.now.localtime) & (booking: nil)}}
[21:13:47] rhizome: protip: look at the screen before hitting enter
[21:15:20] neanderslob: Hi all , I have a get method that allows me to access a file on an s3 server via a presigned_url
[21:15:49] mehwork: eggie5: is that like https://stackoverflow.com/questions/30019043/link-to-url-helper-not-working-in-render-to-string-for-rails-4
[21:15:51] neanderslob: this works very well with a redirect but I would like to trigger the client to download the file that is being accessed
[21:16:09] devdazed_: has joined #RubyOnRails
[21:16:12] neanderslob: how might I accomplish this with a presigned_url?
[21:16:43] neanderslob: code is here: https://gist.github.com/BigMcLargeHuge/923f8eef924de7fdfa1e as it stands with the redirect
[21:17:53] eggie5: mehwork: yeah, same idea, I want to take the string and then put that into partial cache (pre-warming), but if the partial uses `link_to` it gives that error
[21:18:31] lxsameer: has joined #RubyOnRails
[21:18:35] lxsameer: has joined #RubyOnRails
[21:19:29] ellisTAA: has joined #RubyOnRails
[21:21:02] erich: has joined #RubyOnRails
[21:21:33] diego3: has joined #RubyOnRails
[21:21:39] roshanavand: has joined #RubyOnRails
[21:21:40] youngbaks: has joined #RubyOnRails
[21:21:40] diego3: has joined #RubyOnRails
[21:22:00] allcentury: has joined #RubyOnRails
[21:23:55] dstarh: has joined #RubyOnRails
[21:25:06] dstarh: Over the past few days we've seen a few errors when a reqeust comes in very close to when we're doing log rotation. Rails seems to serve the request just fine but apache/passenger return a 500.
[21:25:36] dstarh: The reason only the last few days is it's an api endpoint that wasn't normally being hit at that time of day and we added pingdom to hit it once a minute
[21:26:25] diego3: has joined #RubyOnRails
[21:26:27] dstarh: in all the cases, rails serves the request just fine however the timestamp on the rails request is about 10 seconds ater the apache timestamp, where it's normally in the same second
[21:26:31] diego3: has joined #RubyOnRails
[21:27:30] willardg: has joined #RubyOnRails
[21:29:01] rhizome: dstarh: it's been awhile since i looked into it, but my impression is that rotation under rails is dependent on stack and is not just throwing the path into logrotate.conf
[21:29:20] izc: has joined #RubyOnRails
[21:29:45] dstarh: I think i may have figured it out actually, for some reason we touch tmp/restart.txt in postrotate
[21:29:52] dstarh: that explains what's going on with the 10 seconds
[21:31:26] htmldrum: has joined #RubyOnRails
[21:32:23] Tuxero: has joined #RubyOnRails
[21:34:42] smathy: dsimon, rhizome, just use copytruncate
[21:34:51] mary5030: has joined #RubyOnRails
[21:35:07] smathy: (then you don't need to restart Rails)
[21:35:08] rhizome: or whatever their name is
[21:35:57] smathy: I guess they left.
[21:36:22] DEA7TH: has joined #RubyOnRails
[21:38:10] benlieb: has joined #RubyOnRails
[21:39:33] sar1nk: has joined #RubyOnRails
[21:41:27] rhizome: i hate my computar
[21:42:16] FailBit: http://bost.ocks.org/mike/algorithms/
[21:42:27] rhizome: i think i need a new cpu, also i have network issues that i blame on computar
[21:43:46] FailBit: https://twitter.com/ericwastl/status/474589035155841025
[21:43:50] rhizome: the images on that site are too tablet
[21:44:06] simplyianm: has joined #RubyOnRails
[21:44:54] baweaver: has joined #RubyOnRails
[21:45:08] craysiii: i did an internship for a company that used PHP primarily, took a few days to convince the boss that we should use something 'better'
[21:45:09] FailBit: https://twitter.com/ericwastl/status/445239921495011328
[21:45:19] jessemcgilallen: has joined #RubyOnRails
[21:46:40] FailBit: OH: "This software system uses the 'Onion' pattern. There are endless layers, and peeling all of them back makes you cry."
[21:46:40] shinnya: has joined #RubyOnRails
[21:46:52] alexhartley: has joined #RubyOnRails
[21:47:10] Synthead: is there a way I can tell bundle to update all gems in Gemfile, test my app, then version all the gems in Gemfile?
[21:47:22] Radar: bundle update, test it yourself, revert if you need to
[21:47:33] Radar: bundle updating everything all at once is generally seen as a bad idea
[21:47:42] Synthead: Radar: what if there aleady are versions specified for the gems?
[21:47:45] rhizome: you could script all of that for CI
[21:47:47] Synthead: Radar: why is that?
[21:48:09] tweeeaks: Synthead: harder to find bugs from the updates
[21:48:18] Radar: Synthead: "I updated 46 dependencies in my application and now Feature X broke and now I need to work out which of the 46 dependencies broke it."
[21:48:36] Synthead: yeah for sure
[21:48:42] tweeeaks: listen to him...i've learned the hard way
[21:49:22] willardg: has joined #RubyOnRails
[21:49:48] Synthead: what about not versioning gems? is this a bad idea as well?
[21:50:28] lsone: imo you should always version gems .. always
[21:50:40] smathy: ACTION always gives a big update a shot first
[21:50:41] Synthead: lsone: all of them?
[21:50:46] lsone: i have hit that "lulz updated all the things now project is dead" moment a few too many times.
[21:50:54] giantoctopus: has joined #RubyOnRails
[21:50:57] Radar: Synthead: Versioning them... how?
[21:51:03] Synthead: Radar: yeah
[21:51:19] Radar: Synthead: Bundler is fantastic for that.
[21:51:21] lsone: your Gemfile is your friend
[21:51:25] Synthead: well sounds like a good idea to me
[21:52:15] FailBit: https://www.youtube.com/watch?v=ZSFDm3UYkeE
[21:53:25] Radar: Bundler is good _because_ it generates a Gemfile.lock which means that you and Other Developer and Production Machine all have the same dependencides.
[21:53:27] Radar: dependencies*
[21:55:24] smathy: I think Synthead is talking about versions in Gemfile, not the .lock stuff.
[21:55:36] Radar: I'm not too strict about that.
[21:55:56] Radar: gem 'sidekiq' will install the latest version of Sidekiq at the moment that I insert that into the Gemfile and run bundle instal..
[21:56:06] Radar: Gemfile.lock worries about the version that is used there :)
[21:56:30] moeabdol: has joined #RubyOnRails
[21:56:31] smathy: I do, but always with ~> I do: ~> x.y for things that say they're semver, and ~> x.y.z for others.
[21:56:33] alexhartley: has joined #RubyOnRails
[21:58:21] jgpawletko: has joined #RubyOnRails
[21:58:22] EminenceHC: has joined #RubyOnRails
[21:58:32] pwnd_nsfw: https://gist.github.com/SirUncleCid/0025f41c7df8d93506e6
[21:58:36] pwnd_nsfw: What do y'all think?
[21:58:48] smathy: pwnd_nsfw, I don't care.
[21:59:02] pwnd_nsfw: But surely you must choose one
[21:59:10] smathy: ...actually, in that the only thing I'd change is a comma following the last element.
[21:59:31] pwnd_nsfw: You put commas after every element? :P
[21:59:33] rhizome: first one will get you laughed at less
[21:59:34] pwnd_nsfw: out of habit?
[21:59:37] smathy: I do the first one.
[21:59:56] pwnd_nsfw: rhizome, is there an unlaughable version? :p
[22:00:02] smathy: pwnd_nsfw, no, so that when another element is added there's only one line of diff.
[22:00:12] diego3: has joined #RubyOnRails
[22:00:18] diego3: has joined #RubyOnRails
[22:00:19] Or1on: has joined #RubyOnRails
[22:00:32] Spami: has joined #RubyOnRails
[22:00:35] pwnd_nsfw: smathy, was figurin' as much. That's a good idea
[22:00:37] nettoweb: has joined #RubyOnRails
[22:01:02] smathy: pwnd_nsfw, also it's easier to just add another line in an editor, rather than append to the last line, add a comma, then the new line. Too much thinking.
[22:01:08] rhizome: https://en.wikipedia.org/wiki/Indent_style#Placement_of_braces
[22:01:12] baweaver: First, second is psuedo-haskell style
[22:01:19] baweaver: real haskell is (wait for comment)
[22:02:04] rhizome: i waver between lisp and k&r
[22:02:44] FailBit: gnu style irritates me
[22:02:53] baweaver: Straight K&R here.
[22:03:11] FailBit: I use K&R for everything except function definitiosn
[22:03:13] rhizome: however, it appears you're doing CSS over JSON so you should just set yourself on fire
[22:03:15] yfeldblum: has joined #RubyOnRails
[22:03:23] smathy: pwnd_nsfw, caveat, if this is actually a JSON string then you can't do the trailing comma thing.
[22:03:27] craysiii: omg hahahaha
[22:03:28] pwnd_nsfw: rhizome, talk to Radar about that
[22:03:35] pwnd_nsfw: It's from R4IA
[22:03:43] pwnd_nsfw: and it's actually
[22:03:47] pwnd_nsfw: just for seeding the db
[22:03:50] Radar: pwnd_nsfw: option 1
[22:04:02] baweaver: except I'm a forever right bracer
[22:04:16] baweaver: breaks crap in JS for left brace
[22:04:32] pwnd_nsfw: Thanks for the input
[22:04:47] pwnd_nsfw: Radar, will it be a couple of years before R5IA?
[22:04:56] Radar: pwnd_nsfw: no R5IA
[22:05:01] Radar: Manning can fuck right off :)
[22:05:17] craysiii: ACTION is out of the loop
[22:05:40] hobodave: has joined #RubyOnRails
[22:05:41] arBmind: has joined #RubyOnRails
[22:05:47] baweaver: I'm doing a book on ActiveRecord later, that'll be fun.
[22:05:48] FailBit: woah holy crap
[22:05:56] FailBit: I've been doing sockets wrong all my life
[22:06:04] FailBit: ACTION changes everything to set TCP_NODELAY
[22:06:20] craysiii: does Manning own "in action" or something?
[22:06:28] Radar: craysiii: they own the rights to the book
[22:06:29] baweaver: how in the world do you make that mistake FailBit?
[22:06:36] baweaver: ACTION looks up tcp_nodelay
[22:06:38] craysiii: ah i see that now
[22:07:23] baweaver: they also own a quarter of the shares on Radar's soul
[22:07:31] FailBit: baweaver: actually it's for a really specific project that involves a wii, a router, a computer, and 300ms of lag
[22:07:39] mehwork: just call the book Radar In Action
[22:07:42] FailBit: TCP_NODELAY skips that lag part
[22:07:53] craysiii: "Rails 5: 4 life"
[22:07:54] baweaver: FailBit: I'm yanking your chain
[22:08:06] FailBit: is that a euphemism
[22:08:21] pwnd_nsfw: Just call it Ruby on Rails Tutorial
[22:08:21] baweaver: everything is in the right context
[22:08:22] Radar: craysiii: And I have a non-compete clause in the contract which says that I can't publish a competing book within 3 years of Rails 4 in Action being published.
[22:08:27] FailBit: ( ???? ???? ????)
[22:08:32] rushed: has joined #RubyOnRails
[22:08:48] mehwork: radar but you can still blog at least. Burn all the books
[22:08:56] pwnd_nsfw: Is that about the time it took you to do R3 -> R4?
[22:08:57] craysiii: so multi-tenancy rails doesn't compete?
[22:09:05] Radar: craysiii: if ANYTHING, I would rather write small Ruby/Rails/Elixir tutorials
[22:09:06] craysiii: (honest question)
[22:09:14] baweaver: Radar: Video tutorials
[22:09:15] craysiii: i guess its pretty specific.
[22:09:18] Avon: has joined #RubyOnRails
[22:09:20] Radar: baweaver: hard to keep updated :)
[22:09:37] baweaver: that and don't want a Bates burnout
[22:09:53] baweaver: avdi has a pretty sweet thing going with Tapas
[22:10:03] tubbo: ryan bates should totally start a motel
[22:10:04] mehwork: i personally hate videos. Can't skim fast enough, can't search inside them for key words, horrible for google searches, etc
[22:10:24] mehwork: and they take longer to produce, so you get less material
[22:10:39] pwnd_nsfw: Plus if your voice is shit...
[22:10:43] pwnd_nsfw: and not engaging
[22:10:44] baweaver: but there's a certain lazy demographic that pays through the nose for them
[22:10:44] Radar: mehwork: ^
[22:10:50] Radar: You have an excellent point :D
[22:10:53] mehwork: you get 500 comments talking about how the video creator says 'uh' too much
[22:11:02] mehwork: which really adds to the conversation, not
[22:11:09] alexhart_: has joined #RubyOnRails
[22:11:12] mehwork: i'm bringing postfix 'not' back
[22:11:12] Radar: I am way more eloquent in text than I am in person :)
[22:11:56] pwnd_nsfw: "sniffs snot back into nose"
[22:12:18] baweaver: pwnd_nsfw: ./me action
[22:12:26] pwnd_nsfw: ACTION has a huge boner.
[22:12:38] Radar: pwnd_nsfw: no
[22:12:41] pwnd_nsfw: ACTION only perceives it as such though....
[22:12:48] Radar: pwnd_nsfw: Don't say that kinda shit in this channel, thanks.,
[22:13:02] Radar: First and only warning. Next time is a mute for a day.
[22:13:07] FailBit: https://i.imgur.com/wnoVg.jpg
[22:13:08] pwnd_nsfw: I do apologize
[22:13:14] FailBit: hey it's in his name :P
[22:13:26] pwnd_nsfw: Not an excuse :(
[22:13:40] pwnd_nsfw: Plus, I have to be careful because sometimes it's nfsw
[22:14:02] baweaver: There's some really awesome stuff you can do with joins in SQL
[22:14:16] mehwork: like joining two tables together
[22:14:24] lalalaaa: has joined #RubyOnRails
[22:14:25] Radar: Cold and flu tablets are kicking in. Time is an illusion to me.
[22:14:45] ericjphillips: has joined #RubyOnRails
[22:14:49] mehwork: or even more than 2 if you're up for it
[22:15:18] baweaver: you laugh but I have made a dating site in Rails
[22:15:18] bornpilot: has joined #RubyOnRails
[22:15:19] lalalaaa: Hi! I got this thing here: `after_filter :set_timestamp, only: [:index, :show]` for `def set_timestamp; fresh_when last_modified: @topics.first.published_at; end`
[22:15:22] lalalaaa: But, how do I prevent it from going `NoMethodError (undefined method `published_at' for nil:NilClass)` if :show is empty and doesn't have any topics?
[22:15:24] baweaver: more of a joke honestly.
[22:15:27] mehwork: the only thing that scares me about sql is how i'm just trusting that my query is returning the results back right
[22:15:42] tubbo: `scope :easy`
[22:15:52] Radar: lalalaaa: Show us how show is defined please.
[22:16:11] pwnd_nsfw: Reading code inline is a little brutal
[22:16:32] tubbo: mehwork: what do you mean? also are you talking about using sql dbs in general or using actual SQL instead of arel?
[22:17:02] mehwork: it's why slack is so popular i imagine. Can actually paste formatted code snippets without flooding
[22:17:14] lalalaaa: Radar: its pretty much the basic forem one i think: https://gist.github.com/dt1973/53a74cdf4766c3fa424e
[22:17:24] mehwork: tubbo: just talking about hoping that i'm using it right
[22:17:26] lalalaaa: Radar: dont forget them hot showers if u got the flu yeah?
[22:17:28] idefine_: has joined #RubyOnRails
[22:17:53] lalalaaa: not a big fan of pills
[22:18:05] tubbo: mehwork: i've never found a reason not to trust it
[22:18:36] pwnd_nsfw: using rescue to manage state is not the best of ideas
[22:18:44] pwnd_nsfw: or to use it to control flow
[22:18:46] gitphone: has joined #RubyOnRails
[22:19:06] mehwork: i'm sure it's stable, i'm just always a little worried that my complex sql that queries millions of rows was properly queried to give me the results properly
[22:19:06] baweaver: use an if instead
[22:19:13] baweaver: or find_by(id: val)
[22:19:18] baweaver: which won't crash on not found
[22:19:28] mehwork: tubbo: i just started learning activerecord, is arel better for relational db's?
[22:19:42] pwnd_nsfw: is there a reason for that, btw? Like, I feel find should return nil...
[22:20:04] idefine: has joined #RubyOnRails
[22:20:50] FailBit: in mongoid it does
[22:20:53] FailBit: which is nice
[22:21:00] tubbo: mehwork: no that's what i meant, just abbreviated. arel is the "language" that AR uses to build queries
[22:22:08] mehwork: thankfully, one thing i've been liking about rails is how there's usually one right way to do things
[22:22:28] mehwork: i can't even choose between coke and pepsi
[22:22:42] craysiii: theres a gem for that
[22:23:03] mehwork: did you know that gem spelled backward is 'meg'?
[22:23:12] mehwork: trying finishing the rest of your day now
[22:23:19] craysiii: i don't know whats real anymore.
[22:23:28] tvw: has joined #RubyOnRails
[22:23:31] lalalaaa: coke and pepsi makes my teeth hurt
[22:23:55] lalalaaa: a much better choice would be between weed and water lol
[22:24:00] mehwork: that's just the acid wearing your enamel and the diabetes loosening your gums. Nothing to worry about
[22:24:17] mehwork: the important thing is that olympians drink it
[22:24:25] Radar: lalalaaa: Ah, so @topics here might be empty.
[22:24:30] darrencauthon: has joined #RubyOnRails
[22:24:34] Radar: lalalaaa: I would just wrap the fresh_when check with an if @topics.any?
[22:24:46] Radar: Thanks for using Forem btw :)
[22:24:54] lalalaaa: Radar: ah excellent, exactly what i was looking for thank you
[22:25:14] lalalaaa: Forem is awesome
[22:25:26] safety_cut: has joined #RubyOnRails
[22:25:57] lalalaaa: wouldn't surprise me if even Twitter uses it as their base
[22:26:06] Radar: Not that I am aware of :)
[22:26:09] beauby: has joined #RubyOnRails
[22:26:10] havenwood: has joined #RubyOnRails
[22:26:12] quazimodo: has joined #RubyOnRails
[22:26:16] quazimod1: has joined #RubyOnRails
[22:26:53] safety_c_: has joined #RubyOnRails
[22:27:07] gitphone: I have used forem too and I found the interface easy :)
[22:27:29] quazimod1: anyone know how to check if a div has visibility: hidden in capybara?
[22:27:34] quazimod1: i can't seem to
[22:28:14] dopie: has joined #RubyOnRails
[22:28:39] craysiii: http://stackoverflow.com/questions/15618598/is-it-possible-to-interact-with-hidden-elements-with-capybara maybe this?
[22:29:15] lalalaaa: gitphone: The idea is to make your own interface i think.. Forem is more about the core stuff
[22:29:42] lalalaaa: (ie. the stuff that really matters)
[22:30:20] Radar: Yeah, that's the direction I'm leaning towards more recently.
[22:30:23] gitphone: Haha yeah that's what I meant
[22:31:22] jenrzzz: has joined #RubyOnRails
[22:32:03] northfurr: has joined #RubyOnRails
[22:32:38] quazimod1: craysiii: i don't know
[22:32:57] craysiii: did you try it?
[22:33:12] quazimod1: it seems like capybara with poltergeist(phantomjs) gives you no simple way to figure out if a div has visibility: hidden or not
[22:33:24] quazimod1: to poltergeist, it's visible unless display: none
[22:33:43] Radar: isn't it just an attribute on the elemnet?
[22:33:51] Radar: If so, doesn't that mean that you can find the element, and check the attribute?
[22:33:51] lalalaaa: Radar: glad to hear that. your direction is all that matters :)
[22:34:01] lalalaaa: once im done with my app i promise to submit a ton of PRs
[22:34:13] lalalaaa: a lot of stuff has to go and the views need to be cleaned up..
[22:34:15] jaequery: has joined #RubyOnRails
[22:34:23] codeurge: has joined #RubyOnRails
[22:34:38] Radar: That'd be excellent :)
[22:34:45] Radar: I've been neglecting it because I've been writing instead.
[22:35:25] jaequery: has joined #RubyOnRails
[22:35:50] wldcordeiro: has joined #RubyOnRails
[22:35:55] lalalaaa: ACTION checks ryanbigg.com for the latest :)
[22:36:01] yfeldblum: has joined #RubyOnRails
[22:37:56] quazimod1: Radar: style="blabla" where style would be an attribute
[22:38:13] Radar: lalalaaa: https://leanpub.com/multi-tenancy-rails-2
[22:38:16] quazimod1: but i don't think it composes the css into 1 thing
[22:39:44] Jasaka: has joined #RubyOnRails
[22:39:59] acti0nman: has joined #RubyOnRails
[22:40:04] jessemcgilallen: has joined #RubyOnRails
[22:40:09] siaW: has left #RubyOnRails: ()
[22:42:01] codeurge: has joined #RubyOnRails
[22:43:04] rickmasta: has joined #RubyOnRails
[22:43:57] northfurr: has joined #RubyOnRails
[22:45:34] mary5030: has joined #RubyOnRails
[22:46:15] lalalaaa: Radar: me and robert bringhurst go way back, would love to give some feedback on the typography
[22:46:43] Radar: I had to look up who that was :P
[22:46:52] lalalaaa: awesome sample pdf though, make sure you dont give away too much lol
[22:47:07] Radar: lalalaaa: I don't think I can change much of it because it's leanpub's template. However if you want to look at https://leanpub.com/ddr and give me feedback on _that_, then I can change that.
[22:48:25] simplyianm: has joined #RubyOnRails
[22:48:43] EminenceHC: has joined #RubyOnRails
[22:49:14] Ropeney: has joined #RubyOnRails
[22:49:15] lalalaaa: wow.. another one? yeah ill see what i can do, maybe i should contact leanpub directly as well
[22:49:16] northfurr: has joined #RubyOnRails
[22:49:54] zendrix: has joined #RubyOnRails
[22:50:47] djbkd: has joined #RubyOnRails
[22:51:56] Avon: has joined #RubyOnRails
[22:51:56] Avon: has joined #RubyOnRails
[22:51:58] Pharaoh2: has joined #RubyOnRails
[22:52:53] lalalaaa: you'd probably change everything i would if you could
[22:52:55] nettoweb: has joined #RubyOnRails
[22:53:05] lalalaaa: no comment on http://ryanbigg.com/ddr_book/ looks like you got that covered!
[22:53:27] baweaver: has joined #RubyOnRails
[22:53:39] giantoctopus: has joined #RubyOnRails
[22:53:50] lalalaaa: anyway im out big day tomorrow. hoping you can come back to Forem soon Radar! been nice catching up
[22:54:09] moeabdol: has joined #RubyOnRails
[22:55:29] otacon-: has joined #RubyOnRails
[22:55:35] seank_: has joined #RubyOnRails
[22:56:57] sudiptamondal: has joined #RubyOnRails
[22:57:59] sanjayu: has joined #RubyOnRails
[22:59:56] rhizome: a flowchart can help you figure out that you're missing 20 tests
[23:03:43] rhizome: well, it's only for part of one controller action
[23:05:40] rhizome: not quite true, it's for one state change. the method is indeed heinous, tho. first step in refactoring!
[23:07:04] riotjones: has joined #RubyOnRails
[23:07:08] NodeNagant: has joined #RubyOnRails
[23:07:53] NodeNagant: has joined #RubyOnRails
[23:08:01] hephaestus_rg: has joined #RubyOnRails
[23:08:26] diego1: has joined #RubyOnRails
[23:08:40] diego1: has joined #RubyOnRails
[23:08:46] hephaestus_rg: im wondering how to redirect to the root domain. i tried x_ys_path(x, {subdomain: false})
[23:08:56] hephaestus_rg: but that still preserves the subdomain
[23:09:01] oflannabhra: has joined #RubyOnRails
[23:09:01] NodeNagant: has joined #RubyOnRails
[23:09:04] hephaestus_rg: am i doing it wrong?
[23:09:29] highcup: has joined #RubyOnRails
[23:09:47] pwnd_nsfw: hephaestus_rg, take out hash
[23:09:48] atomical: has joined #RubyOnRails
[23:10:11] hephaestus_rg: lets see if it work
[23:10:53] hephaestus_rg: hey it worked!
[23:10:57] hephaestus_rg: thanks pwnd_nsfw
[23:11:02] pwnd_nsfw: I didn't expect that
[23:12:19] hephaestus_rg: i had to change *_path to *_url
[23:12:26] pydave6367: has joined #RubyOnRails
[23:12:49] smathy: _path will only ever produce a path, so can never affect anything in the hostname portion.
[23:14:56] fre: has joined #RubyOnRails
[23:17:33] KensoDev: has joined #RubyOnRails
[23:17:57] portiad: has joined #RubyOnRails
[23:20:12] manfrin: has joined #RubyOnRails
[23:20:36] Synthead: If I have a m2m between Authors and Books, I can do something like author.book_ids to return an array of related books. Is there a way I can check if the "book_ids" attribute relates to another table (without knowing that there's a m2m relationship)?
[23:21:41] tvon: has joined #RubyOnRails
[23:21:43] Synthead: author.book_ids.class returns Array, which isn't very descriptive
[23:24:02] smathy: Synthead, what do you mean "without knowing that there's a m2m relationship"?
[23:24:35] dopamean_: has joined #RubyOnRails
[23:25:39] Synthead: smathy: book_ids could be a (poorly-named) attribute of "authors" instead of a way to access the AuthorBook m2m table, for example
[23:25:52] jamgood96: has joined #RubyOnRails
[23:26:44] jamgood96: Does Rails not manage the closing of DB connections, or do I have to explicitly close connections myself?
[23:29:36] smathy: Synthead, right, that's true of every method.
[23:30:16] smathy: jamgood96, Rails uses a connection pool, it doesn't close connections AFAIK.
[23:30:27] discounted: has joined #RubyOnRails
[23:30:31] Synthead: smathy: yeah. So I'm trying to find a de-facto way of telling that the "book_ids" attribute is actually performing m2m tasks, and preferably, to which table
[23:30:46] Spami_: has joined #RubyOnRails
[23:31:04] Synthead: smathy: .reflections doesn't list it, and .attributes doesn't either
[23:31:11] northfurr: has joined #RubyOnRails
[23:31:42] jamgood96: smathy: that's what a figured. so not an issue that my DB always shows active connections even at idle?
[23:32:22] alexhartley: has joined #RubyOnRails
[23:32:41] smathy: Synthead, why? Just don't override the book_ids method in your Author class.
[23:33:55] Synthead: smathy: I'm not overriding any _ids methods. I'm handling cache. When a *_ids method is used on a method, I want to update the related tables' cache
[23:35:03] smathy: Synthead, you're caching an array of IDs?
[23:35:21] smathy: jamgood96, definitely not, they're just waiting for another request on that process/thread.
[23:35:25] yaymukund: has joined #RubyOnRails
[23:35:28] ericjphillips: has joined #RubyOnRails
[23:35:43] Synthead: smathy: ultimately, probably something closer to a hundred thousand arrays, but that's besides the point
[23:35:50] manfrin: has joined #RubyOnRails
[23:36:00] lessless: has joined #RubyOnRails
[23:36:10] ruby-lang045: has joined #RubyOnRails
[23:36:53] FailBit: the world says naught
[23:38:14] ruby-lang045: I want to create a custom error class for generating custom json messages. Would I place that under /models even though it has no database items?
[23:38:17] Synthead: smathy: if I could tell that (what is expected to be) *_ids fields is related to another table, I can update that other tables' cache
[23:38:33] fschuindt: has joined #RubyOnRails
[23:38:34] Spami: has joined #RubyOnRails
[23:38:49] ruby-lang045: I wouldn't consider it an asset
[23:38:50] smathy: Synthead, if it's besides the point, then no - there's no way to go back from the return value of `book_ids` to learn anything about the method that was called, or anything about the association that was used to retrieve those ids.
[23:38:56] jamgood96: that's what i figured, smathy. i've just had several people question it as afaik it's not an issue
[23:39:03] craysiii: lib/assets i mean
[23:39:23] Synthead: smathy: hm, ok. I suppose it's the only attribute that will return an array, so I could test for that.
[23:39:48] smathy: jamgood96, people from the non-framework world are used to opening a connection, making a query, closing a connection. Which is terribly inefficient, they may as well use sqlite
[23:39:56] ruby-lang045: it would map things like user.errors which returns {:last_name => "can't be blank" }-> to more like { message: "Last name can't be blank", param: last_name }
[23:40:17] ruby-lang045: I want to do something like CustomErrorMessage.generate_for_user(user)
[23:40:27] ruby-lang045: where's the best place to put the CustomErrorMessage class?
[23:40:53] ruby-lang045: what is lib/assets usually used for? my directory is empty there
[23:41:02] smathy: ruby-lang045, generate_for_user means it's only going to be used for the User model?
[23:41:25] craysiii: oh, actually i put mine directly under lib. sorry about that. then included it in the controller class
[23:41:37] ruby-lang045: smathy: I plan on having different generate messages for each type of model
[23:42:45] rushed: has joined #RubyOnRails
[23:45:00] brunoalano: has joined #RubyOnRails
[23:45:03] Lightsword: has joined #RubyOnRails
[23:45:15] smathy: ruby-lang045, hmm, I'd recommend probably having a different class for each model instead, and just put them in like app/models/model_name and then you can have them in the model's namespace/class, all inheriting from a single base class if there's an interface or common function you want to abstract.
[23:46:11] discounted_: has joined #RubyOnRails
[23:47:16] smathy: ruby-lang045, so something like: class User; class CustomError < ::CustomError; def self.call user; "User specific stuff for #{super}"; end; end; end.
[23:47:26] smathy: ...or no super and no baseclass if that's how you want to go.
[23:48:04] rhizome: "ERROR <- it me"
[23:49:21] banister: has joined #RubyOnRails
[23:50:12] ellisTAA: has joined #RubyOnRails
[23:50:39] northfurr: has joined #RubyOnRails
[23:50:44] Radar: expected "<span class=\"Price-sale\">Now From <span itemprop='price'>$20</span></span> <span class=\"Price-was\">$44.55</span>" to include "<span class=\"Price-was\">$44.45</span>"
[23:50:46] Pharaoh2: has joined #RubyOnRails
[23:50:49] ruby-lang045: smathy: I don't quite understand. So there's no separate file for the custom errors?
[23:50:51] Radar: Uh, it does.
[23:52:22] rhizome: ruby-lang045: maybe you're looking for i18n stuff, which can be used like that
[23:53:45] Radar: Oh, the price is different.
[23:55:08] one_zero: has joined #RubyOnRails
[23:55:21] mices: is there such a thing as keeping user names and passwords in separate tables or secret security questions and answers in separate tables
[23:56:19] mices: if a hacker can get one column he can get all and if he can get one table he can get all?
[23:56:21] idefine: has joined #RubyOnRails
[23:56:54] FailBit: if x mysterious hacker has access to one table, he has access to all
[23:57:11] mikecmpbll: all your tables are belong to us
[23:57:12] rubyonrails108: has joined #RubyOnRails
[23:57:13] FailBit: luckily you're using bcrypt for passwords (right?) and don't do stupid things with the data you store
[23:57:15] ruby-lang045: rhizome: I looked at the i18n stuff and while it's interesting, these errors are actually going to be served from an API endpoint, so it has to be structured in a certain way.
[23:57:25] FailBit: as well as locking down your production server thoroughly
[23:57:29] smathy: ruby-lang045, I was telling you to put them in separate files.
[23:57:42] FailBit: 22, 25, 80, 443 are the only ports that should accept incoming traffic
[23:57:46] ruby-lang045: smathy: where would you put the CustomError file?
[23:57:54] izc: has joined #RubyOnRails
[23:57:56] rhizome: mices: probably not the way you're thinking. essentially "yes" on the get some, get all
[23:58:08] smathy: ruby-lang045, I'm assuming, based on you saying things about CustomErrorMessage.generate_for_user that you were writing your own class to do some sort of error message stuff.
[23:58:11] FailBit: more than that
[23:58:18] ruby-lang045: yes exactly, smathy
[23:58:20] rhizome: ruby-lang045: i18n works for apis
[23:58:24] FailBit: key-based auth only
[23:58:32] FailBit: use 4096-bit keys
[23:58:36] mikecmpbll: and/or whitelist
[23:58:40] Aeyrix: >inb4 someone mentions changing the SSH port
[23:58:42] FailBit: restrict ciphersuites
[23:58:42] Aeyrix: if anyone mentions that
[23:58:44] smathy: ruby-lang045, ok, so I did mention this above too: "and just put them in like app/models/model_name"
[23:58:45] mikecmpbll: ip tables yo
[23:58:45] Aeyrix: i will disconnect you from freenode
[23:59:02] smathy: ruby-lang045, ie, the filename for user would be: app/models/user/custom_error.rb
[23:59:02] FailBit: instead of changing the ssh port, install fail2ban
[23:59:14] ruby-lang045: oh, sorry, smathy: I completely missed your entire first message
[23:59:17] FailBit: and set it up with zero tolerance for ssh
[23:59:20] ruby-lang045: I think it scrolled off screen
[23:59:36] Aeyrix: >people moving the port
[23:59:39] Aeyrix: laughinglions.png
[23:59:48] smathy: ruby-lang045, get a nick alert ;)