« Back to channel list

#RubyOnRails - 29 May 2015

« Back 1 day Forward 1 day »
[00:00:17] iamse7en: spits out 4 numbers from 4 different comments. want to average them together. so i need to put them in an array first right? not sure how
[00:01:26] weaksauce: you want the average rating?
[00:01:26] kinduff: iamse7en, oh my god, what's that (@@star + @@star + @@star + @@star + @@star) thing
[00:01:39] iamse7en: lol i have no idea what i'm doing
[00:01:48] iamse7en: it just turns them into stars
[00:01:53] weaksauce: iamse7en you can use "star" * 5
[00:02:00] kinduff: --verbose=false
[00:02:02] weaksauce: to make "starstarstarstarstar"
[00:02:02] iamse7en: that'd be better, thank you
[00:02:21] iamse7en: im' very very new as you can tell :)
[00:02:46] weaksauce: put an average_rating method inside the place class
[00:02:48] kinduff: iamse7en: Rating 101
[00:03:06] iamse7en: oh okay. instead of comment class
[00:03:29] iamse7en: i can access comment.rating from place class?
[00:03:36] iamse7en: if i set up correct assocations i guess
[00:03:48] weaksauce: what is @place?
[00:03:54] weaksauce: http://guides.rubyonrails.org/active_record_querying.html#average
[00:03:56] kinduff: Use an integer rating:integer for rating, in comment model: validates_inclusion_of :rating, :in => 1..5
[00:04:08] rickmasta: has joined #RubyOnRails
[00:04:49] crevax: has joined #RubyOnRails
[00:05:06] kinduff: if you want all the avg ratings from all the comments related to a restaurant
[00:05:14] iamse7en: yeah thats what i want
[00:05:16] kinduff: @restaurant.avg_rating
[00:05:37] GPrime: has joined #RubyOnRails
[00:05:45] moretti: has joined #RubyOnRails
[00:06:33] SeriousMatters: need has_many: comments?
[00:06:33] kinduff: restaurant.rb => def avg_rating; (comments.sum(:rating)/5); end
[00:06:43] kinduff: something like that
[00:06:54] kinduff: lol -> @@star = '&#9733'.html_safe
[00:07:04] kinduff: that goes in a helper, not in the model
[00:07:13] iamse7en: oh okay, good to know!
[00:07:54] iamse7en: but the average rating goes in model not helper right
[00:08:36] kinduff: def print_stars(integer); [*1..integer].map{'&#9733'}.join(';').html_safe; end
[00:08:40] kinduff: something like that could be
[00:08:45] weaksauce: kinduff you need to div by count not by the number of possible stars
[00:08:53] weaksauce: I'd do it in an AR query though
[00:09:05] leafac: has joined #RubyOnRails
[00:09:12] kinduff: weaksauce, true that.
[00:09:19] iamse7en: weaksauce: ah okay. thanks for that link on AR querying
[00:09:26] kinduff: iamse7en: restaurant.rb => def avg_rating; (self.comments.sum(:rating)/self.comment.count); end
[00:09:33] scottmatheina: has joined #RubyOnRails
[00:09:38] weaksauce: and I'd just use avg anyway
[00:10:21] sevenseacat: has joined #RubyOnRails
[00:10:32] kinduff: iamse7en, yes, avg_rating goes in the model
[00:10:36] scottmatheina: has joined #RubyOnRails
[00:13:24] weaksauce: def avg_rating; self.comments.average(:rating); end
[00:13:37] smathy: [*1..integer].map{'&#9733'}.join(';') is some weird ass code.
[00:14:35] kinduff: >> [*1..5].map{'&#9733'}.join(';')
[00:14:39] kinduff: > [*1..5].map{'&#9733'}.join(';')
[00:14:44] kinduff: don't we have a bot here?
[00:14:49] johntrails: has joined #RubyOnRails
[00:14:51] kinduff: oh, it's on #ruby
[00:14:55] weaksauce: "★".html_safe * 5
[00:15:28] smathy: kinduff, why wouldn't you want the `;` on the last entity?
[00:15:43] iamse7en: If i move the stars to the helper, how do I reference it? this was my old code when I got it from the model: <%= f.input :rating, :as => :select, :collection => Comment::RATINGS %>
[00:15:48] kinduff: didn't saw that until now
[00:16:41] iamse7en: now Comment::RATINGS is an uninitalized constant since i moved it
[00:16:45] smathy: ...not to mention that a Range is Enumerable too.
[00:16:48] leafac: has joined #RubyOnRails
[00:17:26] kinduff: Comment::RATINGS should really not exist. You need to pass an integer to your comment model, from 1 to 5 in order to rate that comment. All the other work is frontend related.
[00:18:02] smathy: iamse7en, update your gist with what you're trying now.
[00:20:17] iamse7en: thanks for the help guys, i gotta run though. work on it later
[00:20:24] smathy: Btw weaksauce, you need html_safe to be the last thing you do, a string operation on a SafeBuffer produces a string, not another SafeBuffer.
[00:20:48] kies: has joined #RubyOnRails
[00:21:31] zorak8: has joined #RubyOnRails
[00:21:47] weaksauce: smathy I don't think that's correct
[00:21:57] weaksauce: ("&#9733;".html_safe * 5).class
[00:21:57] weaksauce: => ActiveSupport::SafeBuffer < String
[00:22:10] weaksauce: just ran that
[00:22:14] k3b0: has joined #RubyOnRails
[00:22:19] ismaelga: has joined #RubyOnRails
[00:24:02] smathy: weaksauce, oh, sorry, you're right. But it's still not html_safe?: ("&#9733;".html_safe * 5).html_safe? # => nil
[00:24:27] smathy: weaksauce, ("&#9733;" * 5).html_safe.html_safe? # => true
[00:25:01] weaksauce: yeah... technically correct is best correct :D
[00:27:29] nj_: has joined #RubyOnRails
[00:27:30] delianides: has joined #RubyOnRails
[00:29:04] chipotle: has joined #RubyOnRails
[00:29:40] doodlehaus: has joined #RubyOnRails
[00:32:06] bawNg: has joined #RubyOnRails
[00:32:32] kinduff: has joined #RubyOnRails
[00:32:53] nthj: has joined #RubyOnRails
[00:33:00] yaymukund: has joined #RubyOnRails
[00:33:38] nthj: Hi, I'm trying to automatically include a :slug for url_for where a slug is required, but Rails is throwing extra query params in my URLs. I have a gist: https://gist.github.com/nthj/f74acfc423e9216d3e69
[00:34:00] thebatu1: has joined #RubyOnRails
[00:34:01] nthj: Is there a way to get url_for to include the current_store as the slug in paths underneath my :slug scope, but not elsewhere?
[00:35:48] shuber_: has joined #RubyOnRails
[00:35:58] commondream: has joined #RubyOnRails
[00:38:15] nobitanobi: has joined #RubyOnRails
[00:40:28] RegulationD: has joined #RubyOnRails
[00:41:53] chipotle_: has joined #RubyOnRails
[00:42:06] pjammer: has joined #RubyOnRails
[00:43:13] rubyonrailed: has joined #RubyOnRails
[00:43:59] maz-dev: has joined #RubyOnRails
[00:45:03] commondream: has joined #RubyOnRails
[00:45:07] twilling: has joined #RubyOnRails
[00:46:30] chipotle: has joined #RubyOnRails
[00:47:20] goodcodeguy: has joined #RubyOnRails
[00:47:53] meat147: has joined #RubyOnRails
[00:49:05] ivanskie: has joined #RubyOnRails
[00:50:10] commondream: has joined #RubyOnRails
[00:50:47] moretti: has joined #RubyOnRails
[00:53:37] goodcodeguy: has joined #RubyOnRails
[00:54:43] robustus|Off: has joined #RubyOnRails
[00:56:02] repinel: has joined #RubyOnRails
[00:56:38] zorak8: has joined #RubyOnRails
[00:58:40] rushed: has joined #RubyOnRails
[00:59:19] prereflect: has joined #RubyOnRails
[00:59:24] sonofdirt: has joined #RubyOnRails
[01:00:14] shuber__: has joined #RubyOnRails
[01:00:28] workmad3: has joined #RubyOnRails
[01:03:49] MEATCHICKEN: has joined #RubyOnRails
[01:04:20] momomomomo: has joined #RubyOnRails
[01:04:44] jrnkr: has joined #RubyOnRails
[01:05:57] MEATCHICKEN: Database schema advice -> How would I models "thanks" for articles?
[01:06:08] MEATCHICKEN: I was thinking of a thanks table with a user_id and article_id
[01:06:20] MEATCHICKEN: to ensure a user can only thank an article once
[01:07:16] smathy: nthj, is that really your routes.rb?
[01:08:37] smathy: meatchicken, assuming it's many:many (ie. that a user can thank many articles, and that many users can thank the same article) then you'll have to have a new table, no choice.
[01:08:51] nthj: *facepalm* copy-paste error, my bad
[01:09:39] MEATCHICKEN: smathy: Yeah that's what I was thinking
[01:09:59] MEATCHICKEN: The current setup built by contractors is...a thanks_count integer column on the articles table lol
[01:10:36] bronson: has joined #RubyOnRails
[01:10:58] nthj: I think I got it, though... I can set default_url_options to: { params: { slug: nil }, slug: current_store }
[01:11:25] nthj: now that'll strip any query params I need elsewhere, I can whitelist or blacklist specific ones easy enough
[01:12:08] smathy: nthj, why don't you just move the default_url_options method to your ListingsController?
[01:12:27] ismaelga: has joined #RubyOnRails
[01:12:36] taka_oyama: has joined #RubyOnRails
[01:12:46] GriffinHeart: has joined #RubyOnRails
[01:13:34] sankaber: has joined #RubyOnRails
[01:13:55] nthj: hmm, I could, but it would still add the ?slug=nthj query string to non-slug urls (like "sign out")
[01:14:26] nthj: only on the /listings urls, that might be a marked improvement actully
[01:15:41] smathy: nthj, oh it will too, yeah.
[01:16:04] mello: has joined #RubyOnRails
[01:16:10] greenride: has joined #RubyOnRails
[01:16:32] greenride: has left #RubyOnRails: ()
[01:16:57] macmartine: has joined #RubyOnRails
[01:17:06] michael_mbp: has joined #RubyOnRails
[01:17:38] thiagovsk: has joined #RubyOnRails
[01:18:56] zorak8: has joined #RubyOnRails
[01:24:13] meat147: Hey Guys i am currently thinking about buying a laptop for Development Rails, is there anything agianst a Thinkpad t420 ?
[01:24:33] fryguy: meat147: it's quite old, but otherwise no
[01:24:33] sevenseacat: apart from it being a lenovo?
[01:24:37] fryguy: i'm on a T530 right now
[01:24:49] doodlehaus: has joined #RubyOnRails
[01:24:58] sevenseacat: ACTION pet hate of lenovo
[01:25:01] fryguy: I think lenovos are pretty good right now in general (except for the latest gen, but that's intel's fault, not lenovo)
[01:25:28] Lytol: has joined #RubyOnRails
[01:25:32] meat147: Well i dont need a top machine i have a old macbook that has destroyed display so ssd memory and stuff i will take from there
[01:25:58] sevenseacat: dont know if you'll be able to do that, most apple stuff is very custom isnt it
[01:26:23] meat147: well the ssd and ram looks pretty standard
[01:27:03] sevenseacat: i dunno, my tastes nowadays tend to run to ultrabooks
[01:27:19] sevenseacat: though my mbp doesnt fit in that category, but eh
[01:27:33] ValicekB: has joined #RubyOnRails
[01:27:33] meat147: fryguy what os are you running ?
[01:27:37] fryguy: meat147: linux
[01:27:50] rubyonrailed: has joined #RubyOnRails
[01:27:55] meat147: Well yeah i spend like 3500 ? on my MBP and well it fall one time.. :(
[01:28:03] meat147: so i will not spend so much this time. :D
[01:28:13] meat147: fryguy wich linux? Ubuntu ?
[01:28:17] fryguy: meat147: archlinux
[01:29:10] sevenseacat: i miss ubuntu
[01:30:33] meat147: I saw never a big benefit on Mac OSX to win or ubuntu
[01:31:18] rushed: meat147: great, maybe try not to start an OS rantfest in here :)
[01:32:50] bratsche: I used to work on Ubuntu at Canonical, and almost everyone at the time used Thinkpads. They tend to stick to Intel components which are well supported in Linux.
[01:33:41] bratsche: I still use a Thinkpad when I'm working on Linux.
[01:34:15] meat147: Well thanks everyone for your Feedback! I think i will stick to my Idea with the Thinkpad !
[01:34:29] jschoolcraft: has joined #RubyOnRails
[01:34:30] bratsche: Mine is quite old though, I have a T61. :)
[01:35:04] charliesome: has joined #RubyOnRails
[01:35:04] sevenseacat: i purchased a thinkpad x1 carbon once.
[01:35:28] bratsche: Is that the one where they switched the keyboard to something more like a Mac and everyone was pissed?
[01:35:29] sevenseacat: technically i owned it for about six months, even though i had physical possession of it for two days
[01:35:40] sevenseacat: the rest was lenovo dicking around
[01:35:57] fryguy: sevenseacat: that's unfortunate
[01:36:14] bratsche: That sucks.
[01:36:29] sevenseacat: after two days i sent it back because the display was absolutely horrendous
[01:36:52] goodcodeguy: has joined #RubyOnRails
[01:37:18] dmz: has joined #RubyOnRails
[01:37:19] dmz: has joined #RubyOnRails
[01:37:36] bratsche: I mostly use Macs now, but I kind of want to get a Surface Pro also.
[01:37:38] joaomdmoura: has joined #RubyOnRails
[01:37:58] sankaber: has joined #RubyOnRails
[01:37:59] bratsche: I'm everything I used to hate.
[01:38:02] sevenseacat: before my work bought me this MBP, my main machine was a samsung series 9. lovely ultrabook.
[01:39:42] David_H_Smith: has joined #RubyOnRails
[01:40:34] bratsche: The one thing I miss about Ubuntu is that their package manager worked well and wasn't brittle the way homebrew is.
[01:42:00] sevenseacat: apt-get is awesome.
[01:42:31] sevenseacat: also, finder is one of the most annoying apps ive ever used on any OS. nautilus much better.
[01:42:51] bratsche: I like Nautilus.
[01:44:04] bratsche: I haven't tried the Windows 10 beta yet, but I hear they've got some kind of official package management system now.
[01:44:37] sevenseacat: that would be good
[01:44:50] edwinrozario: has joined #RubyOnRails
[01:46:19] SalexW: has joined #RubyOnRails
[01:48:44] doodlehaus: has joined #RubyOnRails
[01:49:05] jrnkr: has joined #RubyOnRails
[01:49:47] lampshades: has joined #RubyOnRails
[01:50:10] duderonomy: has joined #RubyOnRails
[01:51:18] vmarcetic: has joined #RubyOnRails
[01:51:28] twilling: has joined #RubyOnRails
[01:51:53] cswelin: has joined #RubyOnRails
[01:52:07] annlewis: has joined #RubyOnRails
[01:53:58] tejasmanohar: has joined #RubyOnRails
[01:54:15] tejasmanohar: has anyone here used cloudflare + heroku w/ rails app? i keep having cloudflare overridem y SSL
[01:54:19] tejasmanohar: *the SSL i bought
[01:54:31] tejasmanohar: https://autolotto.com/ (i bought an EV, its showing a DV)
[01:54:41] tejasmanohar: (and it doesnt match the SSL certs on my heroku domain)
[01:55:34] moretti: has joined #RubyOnRails
[01:55:47] sonofdirt: has joined #RubyOnRails
[01:56:37] m0r0n: has joined #RubyOnRails
[01:58:06] RegulationD: has joined #RubyOnRails
[01:58:31] k3b0: has joined #RubyOnRails
[01:58:36] asheinfeld: has joined #RubyOnRails
[01:59:12] merryfett: has joined #RubyOnRails
[02:00:50] x44x45x41x4E: has joined #RubyOnRails
[02:03:16] rushed: tejasmanohar: free couldflare uses their cert not yours
[02:08:54] cjlarose: has joined #RubyOnRails
[02:10:12] highcup: has joined #RubyOnRails
[02:12:32] Ismael: has joined #RubyOnRails
[02:12:45] doodlehaus: has joined #RubyOnRails
[02:12:54] sonofdirt: has joined #RubyOnRails
[02:13:30] Lightsword: has joined #RubyOnRails
[02:20:23] gaboesquivel: has joined #RubyOnRails
[02:20:43] baweaver: has joined #RubyOnRails
[02:21:43] TheNet: has joined #RubyOnRails
[02:21:52] brendan-_: has joined #RubyOnRails
[02:22:53] thebatu1: has joined #RubyOnRails
[02:23:51] ismaelga: has joined #RubyOnRails
[02:26:37] dseitz: has joined #RubyOnRails
[02:27:50] johntrails: has joined #RubyOnRails
[02:32:48] maz-dev: has joined #RubyOnRails
[02:35:21] ismaelga: has joined #RubyOnRails
[02:38:10] GriffinH_: has joined #RubyOnRails
[02:40:07] ismaelga: has joined #RubyOnRails
[02:40:45] RegulationD: has joined #RubyOnRails
[02:41:18] tejasmanohar: rushed: doesn't production.rb ONLY run in production?
[02:41:29] Limix: has joined #RubyOnRails
[02:41:43] tejasmanohar: everytime i do rails s on my computer its trying to do things w/ SSL
[02:41:56] tejasmanohar: because config.force_ssl = true is in production.rb
[02:47:23] TinkerTyper: has joined #RubyOnRails
[02:47:37] chagel: has joined #RubyOnRails
[02:50:27] rushed: tejasmanohar: does the console agree that it's in production? ie "Rails 4.2.1 application starting in development on http://localhost:3000" what does "trying to do things w/ SSL" mean?
[02:50:40] repinel: has joined #RubyOnRails
[02:50:41] tejasmanohar: i got a bit farther
[02:50:50] tejasmanohar: its not rails its that i have another rails server running in the background that im trying to kill
[02:50:56] tejasmanohar: lsof -wni tcp:3000 doesnt show it
[02:51:18] tejasmanohar: ps aux | grep rails says that rails is proc running but it shows binding to port 0
[02:51:32] asheinfeld: has joined #RubyOnRails
[02:52:01] bruno-: has joined #RubyOnRails
[02:52:29] chagel: has joined #RubyOnRails
[02:54:08] SeriousMatters: has left #RubyOnRails: ()
[02:54:50] lessless: has joined #RubyOnRails
[02:54:57] sonofdirt: has joined #RubyOnRails
[02:55:00] existensil: has joined #RubyOnRails
[02:58:24] momomomomo: has joined #RubyOnRails
[02:58:28] scottmatheina: has joined #RubyOnRails
[02:58:41] DoctorMonocular: has joined #RubyOnRails
[03:04:01] renechz: has joined #RubyOnRails
[03:04:44] mello: has joined #RubyOnRails
[03:07:34] cjlarose: has joined #RubyOnRails
[03:09:27] beauby: has joined #RubyOnRails
[03:14:56] braincrash: has joined #RubyOnRails
[03:19:37] gambl0re: has joined #RubyOnRails
[03:21:46] cleopatra: Radar, there?
[03:21:48] rubyonrailed: has joined #RubyOnRails
[03:22:53] cleopatra: can told me the name of your new book
[03:23:08] shuber_: has joined #RubyOnRails
[03:23:40] Radar: cleopatra: leanpub.com/ddr
[03:24:14] baweaver: has joined #RubyOnRails
[03:26:58] jrnkr: has joined #RubyOnRails
[03:27:00] surrealanalysis: has joined #RubyOnRails
[03:29:51] tejasmanohar: has joined #RubyOnRails
[03:29:57] cleopatra: Radar, thanks, I'll put in my bookmarks
[03:30:32] delianides: has joined #RubyOnRails
[03:30:33] ProLoser: has joined #RubyOnRails
[03:31:46] charliesome: has joined #RubyOnRails
[03:33:36] maz-dev: has joined #RubyOnRails
[03:34:36] b0nn1e|2: has joined #RubyOnRails
[03:37:29] eggoez: has joined #RubyOnRails
[03:37:44] Scripore: has joined #RubyOnRails
[03:38:50] growlove: has joined #RubyOnRails
[03:41:36] RegulationD: has joined #RubyOnRails
[03:42:56] TinkerTyper: has joined #RubyOnRails
[03:44:22] Etriaph: tejasmanohar: Are you running on Windows?
[03:44:38] tejasmanohar: i had to just kill processes that woudlnt stop
[03:44:43] Etriaph: tejasmanohar: Excellent, we can be friends.
[03:44:53] tejasmanohar: ps aux | grep rails
[03:45:02] scottmatheina: has joined #RubyOnRails
[03:48:12] renechz: has joined #RubyOnRails
[03:50:08] bronson: has joined #RubyOnRails
[03:52:51] Limix: has joined #RubyOnRails
[03:53:09] rubyonrailed: has joined #RubyOnRails
[03:53:24] renechz: has left #RubyOnRails: ("WeeChat 1.1.1")
[03:57:41] momomomomo: has joined #RubyOnRails
[03:58:36] jenrzzz: has joined #RubyOnRails
[03:58:41] shuber_: has joined #RubyOnRails
[04:01:05] asheinfeld: has joined #RubyOnRails
[04:02:11] shyshy: has joined #RubyOnRails
[04:03:32] gambl0re: do people just use a gem for authentication?
[04:03:51] pipework: gambl0re: !toolbox
[04:03:51] helpa: gambl0re: http://ruby-toolbox.com - See lists of the most popular gems for common tasks in Ruby and Rails.
[04:04:36] gambl0re: i did a tutorial where i hand coded everything to create authentication and it's fairly complicated process.
[04:04:48] pipework: I do have another idea that's more objective, I just need to write it up.
[04:04:52] sevenseacat: and you probably only scratched the surface.
[04:04:59] sevenseacat: wrong channel pipework :P
[04:05:17] mary5030: has joined #RubyOnRails
[04:05:23] gambl0re: true. i probably only did the minimum.
[04:05:28] pipework: Thank you, sir.
[04:05:33] pipework: sevenseacat: ^
[04:06:09] merryfett: has joined #RubyOnRails
[04:06:20] baweaver: ACTION grabs popcorn
[04:07:07] baweaver: pipework: Fair warning, sevenseacat is female
[04:07:16] pipework: baweaver: I've known sevenseacat for longer than you. :d
[04:07:22] pipework: sevenseacat is my bro.
[04:07:27] baweaver: Making sure
[04:07:44] rhizome: ell oh ell
[04:07:51] pipework: baweaver: It's also not really always nice to out someone's gender for them.
[04:08:04] pipework: Some people, even if they share it elsewhere or at times, don't always want it said.
[04:08:13] baweaver: ACTION shrugs
[04:08:18] baweaver: Can't win, can you
[04:08:23] rhizome: you really can't
[04:08:40] pipework: baweaver: 0 for 2, but I'm sure you'll make a comeback worth seeing. :D
[04:09:13] baweaver: pipework: https://www.youtube.com/watch?v=Dj5qpmYlLMI
[04:09:31] pipework: baweaver: That's a fantastic clip.
[04:09:33] baweaver: Probably bad that's the first thing that came to mind
[04:11:43] thebatu1: has joined #RubyOnRails
[04:12:07] macmartine: has joined #RubyOnRails
[04:14:23] iamjarvo: has joined #RubyOnRails
[04:16:02] vanne: has joined #RubyOnRails
[04:16:25] cjlarose: has joined #RubyOnRails
[04:24:16] Spami: has joined #RubyOnRails
[04:29:52] charliesome: has joined #RubyOnRails
[04:31:07] fedexo: has joined #RubyOnRails
[04:32:58] SuMo_D: has joined #RubyOnRails
[04:35:55] Feyn: has joined #RubyOnRails
[04:37:44] workmad3: has joined #RubyOnRails
[04:40:37] skiz: has joined #RubyOnRails
[04:41:24] bruno-: has joined #RubyOnRails
[04:43:00] tjbiddle: has joined #RubyOnRails
[04:49:22] maz-dev: has joined #RubyOnRails
[04:52:37] michael_mbp: has joined #RubyOnRails
[04:53:16] lele: has joined #RubyOnRails
[04:53:30] mello: has joined #RubyOnRails
[04:53:50] towski_: has joined #RubyOnRails
[04:55:58] krz: has joined #RubyOnRails
[05:00:33] user121212: has joined #RubyOnRails
[05:00:47] maddox__: has joined #RubyOnRails
[05:01:41] user121212: Is there command like rake db:schema:load, But without deleting data in the table?
[05:02:08] maddox__: has left #RubyOnRails: ()
[05:02:17] rickmasta: has joined #RubyOnRails
[05:03:44] sevenseacat: if you're loading a schema, the table wont exist to have data in it
[05:03:49] sevenseacat: what are you actually trying to do?
[05:04:36] maddox__: has joined #RubyOnRails
[05:06:44] user121212: sevenseacat: the migration files are little bit hacky, so, I was trying something instead of rake db:migrate with out deleting the data, data is not that imporratnt, I can just seed it
[05:08:30] sevenseacat: well rake db:migrate shouldnt delete any data
[05:08:38] sevenseacat: unless you have migrations that specifically delete data
[05:10:38] lampshades: has joined #RubyOnRails
[05:10:53] hahuang65: has joined #RubyOnRails
[05:11:06] user121212: sevenscat: This looks ineteresting https://github.com/rroblak/seed_dump
[05:11:23] sevenseacat: if thats what you want to do
[05:11:59] chrissonar: has joined #RubyOnRails
[05:12:48] macmartine: has joined #RubyOnRails
[05:13:53] zorak8: has joined #RubyOnRails
[05:14:20] macmarti_: has joined #RubyOnRails
[05:15:37] shuber_: has joined #RubyOnRails
[05:15:50] jenrzzz: has joined #RubyOnRails
[05:16:23] givanse: has joined #RubyOnRails
[05:17:13] jrnkr: has joined #RubyOnRails
[05:20:53] surrealanalysis: has joined #RubyOnRails
[05:21:30] riotjones: has joined #RubyOnRails
[05:22:24] riotjones: has joined #RubyOnRails
[05:23:25] SuMo_D: has joined #RubyOnRails
[05:24:12] kies^: has joined #RubyOnRails
[05:24:44] aganov: has joined #RubyOnRails
[05:24:45] tdy: has joined #RubyOnRails
[05:24:53] Radar: user121212: rake db:reset
[05:25:05] Radar: user121212: that'll run rake db:drop, db:create, db:schema:load + db:seed
[05:25:47] mary5030: has joined #RubyOnRails
[05:25:54] SuMo_D_: has joined #RubyOnRails
[05:27:40] taka_oyama: has joined #RubyOnRails
[05:30:25] RegulationD: has joined #RubyOnRails
[05:31:28] jenrzzz: has joined #RubyOnRails
[05:32:05] tagrudev: has joined #RubyOnRails
[05:32:06] towski_: has joined #RubyOnRails
[05:34:36] tautvydas: has joined #RubyOnRails
[05:35:09] sandelius: has joined #RubyOnRails
[05:40:18] chagel: has joined #RubyOnRails
[05:41:19] sandstrom: has joined #RubyOnRails
[05:42:17] rogaps: has joined #RubyOnRails
[05:45:03] cjlarose: has joined #RubyOnRails
[05:46:10] jrnkr: has joined #RubyOnRails
[05:46:12] User458764: has joined #RubyOnRails
[05:47:57] SalexW: has joined #RubyOnRails
[05:50:48] gaboesquivel: has joined #RubyOnRails
[05:50:55] _blizzy_: has joined #RubyOnRails
[05:52:45] riotjones: has joined #RubyOnRails
[05:55:00] arBmind: has joined #RubyOnRails
[05:55:07] drale2k: has joined #RubyOnRails
[05:58:20] netzfisch: has joined #RubyOnRails
[06:00:37] thebatu1: has joined #RubyOnRails
[06:00:53] metus_violarium: has joined #RubyOnRails
[06:03:02] Cache_Money: has joined #RubyOnRails
[06:03:12] asheinfeld: has joined #RubyOnRails
[06:07:00] rubyonrailed: has joined #RubyOnRails
[06:09:40] sinequanon: has joined #RubyOnRails
[06:10:52] bruno-: has joined #RubyOnRails
[06:11:27] sandstrom: has joined #RubyOnRails
[06:11:39] lapide_viridi: has joined #RubyOnRails
[06:12:10] tvw: has joined #RubyOnRails
[06:13:56] sandelius: has joined #RubyOnRails
[06:15:01] kerunaru: has joined #RubyOnRails
[06:15:17] ndrei: has joined #RubyOnRails
[06:18:44] jrnkr: has joined #RubyOnRails
[06:20:09] maz-dev: has joined #RubyOnRails
[06:21:23] redmenace: has joined #RubyOnRails
[06:21:26] joaomdmoura: has joined #RubyOnRails
[06:22:48] sinkensabe: has joined #RubyOnRails
[06:23:57] jrnkr: has joined #RubyOnRails
[06:26:53] charliesome: has joined #RubyOnRails
[06:27:32] gauke: has joined #RubyOnRails
[06:32:31] user121212: Is that right way to use nested attributes? https://eval.in/private/811226d7fa6224 I'm getting undefined method `save' for nil:NilClass
[06:32:32] sandstrom: has joined #RubyOnRails
[06:32:41] lapide_viridi: has joined #RubyOnRails
[06:33:34] sevenseacat: user121212: where are you defining @comment ?
[06:34:53] user121212: sevenseacat: oops I missed that :(
[06:35:07] sevenseacat: user121212: reading the error message helps :)
[06:36:04] aufi: has joined #RubyOnRails
[06:37:14] futilegames: has joined #RubyOnRails
[06:37:31] roolo: has joined #RubyOnRails
[06:37:44] user121212: sevenseacat: @comment = Post.comments.new(post_params), Is that correct?
[06:38:01] sevenseacat: user121212: no. why are you passing something called post_params to a new comment?
[06:38:11] sevenseacat: also, Post has no method called comments
[06:39:44] arup_r: has joined #RubyOnRails
[06:39:57] bronson: has joined #RubyOnRails
[06:40:10] user121212: sevenseacat: @comment = Comment.new will do? Can you see the params here? https://eval.in/private/811226d7fa6224
[06:40:34] sevenseacat: yes, they're params for a post, not for a comment. what are you trying to do?
[06:41:14] Lytol: has joined #RubyOnRails
[06:41:53] freezevee: has joined #RubyOnRails
[06:42:12] user121212: sevenseacat: I'm trying to post something like this https://eval.in/private/84dc5b0ee4af81 , I want save post and comments.
[06:42:16] mello: has joined #RubyOnRails
[06:42:44] sevenseacat: ok, have you configured your Post model to accept nested attributes for comments?
[06:42:49] xcesariox: has joined #RubyOnRails
[06:43:02] sevenseacat: i dont think that format will work out of the box, but we can try
[06:43:04] nso95: has joined #RubyOnRails
[06:44:31] user121212: sevenseacat: I'm trying to use nested attributes, I guess it works in the similar way
[06:45:10] arup_r: Guys ,,, tell me some names of opensource Rails projects except Spree.. I would like to read there codebase to understand some Railish things.. I already reading Spree..
[06:46:50] user121212: @arup_r How about diaspora?
[06:47:11] arup_r: Cool.. First time I heard the name..
[06:47:41] TvL2386: has joined #RubyOnRails
[06:48:05] hahuang65: has joined #RubyOnRails
[06:48:34] arup_r: bookmarked https://wiki.diasporafoundation.org/An_introduction_to_the_Diaspora_source user121212:
[06:49:06] toretore: has joined #RubyOnRails
[06:49:23] sevenseacat: user121212: ok cool, so can you answer the question now?
[06:50:22] gauke: has joined #RubyOnRails
[06:51:32] user121212: sevenseacat: @comment = @post.comment.new ? still not sure
[06:51:46] sevenseacat: [14:42:43] sevenseacat: ok, have you configured your Post model to accept nested attributes for comments?
[06:52:39] solars: has joined #RubyOnRails
[06:53:36] nso95: K, so validating that some field is greater_than_or_equal 0.01 ??? my book says since it???s possible to enter 0.001 into this field, and the db stores just two digits after the decimal, it would end up being 0.00, why is this, doesn???t the model verify _before_ entering it into the db?
[06:53:39] skroon: has joined #RubyOnRails
[06:54:11] user121212: sevenseacat: yes
[06:54:28] ndrei: has joined #RubyOnRails
[06:54:43] sevenseacat: user121212: then you don't need to deal with comments at all in your controller - if you do Post.create with parameters in the right format, it will automatically create the post with any associated comments
[06:54:53] sevenseacat: thats the beauty of nested resources
[06:56:50] Radar: nso95: steps to reproduce in a new app plzkthx
[06:57:06] futilegames: has joined #RubyOnRails
[07:03:56] coin3d: has joined #RubyOnRails
[07:03:59] erikh: has joined #RubyOnRails
[07:04:02] asheinfeld: has joined #RubyOnRails
[07:07:35] User458764: has joined #RubyOnRails
[07:07:51] neutrino: has joined #RubyOnRails
[07:08:58] Sylario: has joined #RubyOnRails
[07:10:19] David_H_Smith: has joined #RubyOnRails
[07:10:29] comrad: has joined #RubyOnRails
[07:10:43] alex88: has joined #RubyOnRails
[07:11:55] futilegames: has joined #RubyOnRails
[07:11:59] Rubie: has joined #RubyOnRails
[07:14:00] sandstrom: has joined #RubyOnRails
[07:15:11] dideler: has joined #RubyOnRails
[07:19:19] RegulationD: has joined #RubyOnRails
[07:20:38] artto: has joined #RubyOnRails
[07:22:09] cornerma1: has joined #RubyOnRails
[07:22:15] Trefex: has joined #RubyOnRails
[07:22:26] dhjondoh: has joined #RubyOnRails
[07:24:37] DaniG2k: has joined #RubyOnRails
[07:25:02] thebatu1: has joined #RubyOnRails
[07:28:14] Ergo: has joined #RubyOnRails
[07:28:51] x-light: has joined #RubyOnRails
[07:33:10] jarr0dsz: has joined #RubyOnRails
[07:34:28] User458764: has joined #RubyOnRails
[07:36:06] karimb: has joined #RubyOnRails
[07:36:40] workmad3: has joined #RubyOnRails
[07:38:38] ProLoser: has joined #RubyOnRails
[07:38:48] apeiros: question about the inner working of rails, specifically validations - how does the lookup for the validation class happen?
[07:38:48] apeiros: I.e. if I have `validate :email_address, email: true`, I know that :email is matched against EmailValidator.kind (which returns :email). But how does it find the classes? Via ActiveModel::Validator.subclasses?
[07:39:26] livathinos: has joined #RubyOnRails
[07:41:56] ddv: apeiros: you could byebug to step through the code
[07:41:58] duderonomy: has joined #RubyOnRails
[07:41:58] apeiros: actually probably .descendants, not .subclasses
[07:42:33] elia: has joined #RubyOnRails
[07:42:42] apeiros: ddv: yeah, until I get a response here, I'll do that.
[07:43:10] mello: has joined #RubyOnRails
[07:44:15] darutoko: has joined #RubyOnRails
[07:44:49] queequeg1: has joined #RubyOnRails
[07:46:15] apeiros: well, actually I think that deviates too much from what I should do :<
[07:48:00] ur5us: has joined #RubyOnRails
[07:48:31] Ergo: has joined #RubyOnRails
[07:48:56] SalexW: has joined #RubyOnRails
[07:49:26] edwinvdgraaf: has joined #RubyOnRails
[07:50:51] vanne: has joined #RubyOnRails
[07:51:04] n008f4g_: has joined #RubyOnRails
[07:51:41] DoctorMonocular: has joined #RubyOnRails
[07:53:40] sinkensabe: has joined #RubyOnRails
[07:54:19] gerardc: has joined #RubyOnRails
[07:54:30] charliesome: has joined #RubyOnRails
[07:55:21] vanne: has joined #RubyOnRails
[07:55:58] darutoko: has joined #RubyOnRails
[07:56:38] michael_mbp: has joined #RubyOnRails
[07:57:17] noodman: has joined #RubyOnRails
[07:57:50] arBmind: has joined #RubyOnRails
[07:58:06] edwinvdgraaf: has joined #RubyOnRails
[07:58:20] mikecmpbll: has joined #RubyOnRails
[08:00:11] Forgetful_Lion: has joined #RubyOnRails
[08:00:50] apeiros: ACTION ponders writing ProcValidator??? validate :foo, proc: ->(???) { ??? } (or actually anything which supports .call)
[08:01:27] zcreative: has joined #RubyOnRails
[08:02:20] edwinvdg_: has joined #RubyOnRails
[08:03:19] jsrn_: has joined #RubyOnRails
[08:04:51] asheinfeld: has joined #RubyOnRails
[08:07:15] kies: has joined #RubyOnRails
[08:08:51] krz: has joined #RubyOnRails
[08:08:58] maz-dev: has joined #RubyOnRails
[08:09:39] universa1: apeiros: validate do; ... ; end ? ;)
[08:10:18] universa1: apeiros: would have to try: validate -> {|instance| ...}
[08:10:31] universa1: apeiros: most likely without the stabby lambda
[08:10:45] apeiros: oh right! that one exists too
[08:11:13] olistik: has joined #RubyOnRails
[08:11:57] apeiros: ah, but that one doesn't work with attribute names
[08:12:07] apeiros: i.e. it's for full record validation
[08:12:32] apeiros: (I'm aware I can pass attribute names in the block itself)
[08:12:56] universa1: apeiros: yeah, but then custom procs are usually needed when you need more than one attribute
[08:13:38] gaussblurinc1: has joined #RubyOnRails
[08:14:21] apeiros: universa1: ah, validates_each does that
[08:14:23] ndrei: has joined #RubyOnRails
[08:14:40] granthatcher: has joined #RubyOnRails
[08:14:50] apeiros: for some reason I have never read up on what validates_each does. fascinating how I managed to skip that one for years.
[08:15:14] apeiros: that simplifies things quite considerably.
[08:15:27] jrails: has joined #RubyOnRails
[08:17:03] Macaveli: has joined #RubyOnRails
[08:19:46] Macaveli: invalid %-encoding (pn%R2%80%N6) -> Anyone have an idea what the things between the brackets are ?
[08:21:51] universa1: escape sequeneces?!
[08:22:36] MrMaynes: has joined #RubyOnRails
[08:22:50] marr: has joined #RubyOnRails
[08:23:42] queequeg1: has joined #RubyOnRails
[08:23:54] noodman_: has joined #RubyOnRails
[08:26:02] User458764: has joined #RubyOnRails
[08:27:27] maz-dev: has joined #RubyOnRails
[08:28:05] jarr0dsz: has joined #RubyOnRails
[08:28:45] freezevee: I am trying to enter some data by using fixtures (lat, long) latitude: rand(-90.0...90.0) and unfortunately in the database only "0" is saved. What could be the fault ?
[08:28:59] freezevee: In the database, both fields are set as float
[08:29:01] commondream: has joined #RubyOnRails
[08:29:29] olistik: has joined #RubyOnRails
[08:29:52] DLSteve: has joined #RubyOnRails
[08:30:03] aditya432: has joined #RubyOnRails
[08:30:11] aditya432: Hi, Is the solution mentioned here the best possible? http://stackoverflow.com/questions/3965564/rails-3-ajax-response-js-how-to-handle-errors
[08:30:31] futilegames: has joined #RubyOnRails
[08:30:46] nhhagen: has joined #RubyOnRails
[08:30:54] queequeg1: has joined #RubyOnRails
[08:32:01] merryfett: has joined #RubyOnRails
[08:33:03] MrMaynes: has joined #RubyOnRails
[08:33:49] User458764: has joined #RubyOnRails
[08:34:02] aditya432: Hi, Is the solution mentioned here the best possible? http://stackoverflow.com/questions/3965564/rails-3-ajax-response-js-how-to-handle-errors
[08:35:16] mikecmpbll: aditya432: what do you want to do in the error case?
[08:35:28] DLSteve: has joined #RubyOnRails
[08:35:36] aditya432: I want to display it with the form.
[08:35:58] mikecmpbll: and in the success?
[08:36:12] aditya432: remove the form and display success message
[08:37:16] mikecmpbll: meh, it's neither here nor there really. i'd probably favour one file
[08:37:39] mikecmpbll: unless the success and failure views are reusable throughout the app in some way
[08:38:25] aditya432: mikecmbll yea. I have a contact form which I am displaying on multiple pages throughout my app
[08:38:29] aditya432: so it can be reused
[08:38:30] mikecmpbll: but most would say that returning json is the best way.
[08:39:28] Hates_: has joined #RubyOnRails
[08:39:41] Hates_: has joined #RubyOnRails
[08:39:55] GriffinHeart: has joined #RubyOnRails
[08:40:31] aditya432: something like this: http://stefan.haflidason.com/simpler-handling-of-ajax-form-errors-in-rails-4/
[08:41:44] thebatu1_: has joined #RubyOnRails
[08:43:11] mikecmpbll: yep, although i wouldn't use jbuilder probably but yeah.
[08:44:05] mikecmpbll: and if you need partials and stuff to render an obj, you can render your html in to the json response.
[08:44:24] aditya432: okay. I will look into it. thanks
[08:44:30] karimb: has joined #RubyOnRails
[08:44:58] mikecmpbll: tbh i'm not against using .js.erb views as long as your app isn't super JS heavy because it can get a bit messy
[08:45:42] mikecmpbll: we have a couple of ajax components where it's just simpler to return JS, but the app isn't front-end heavy.
[08:47:09] freezevee: I am trying to get a random float with Random.new.rand(-90.0...90.0) and in rails console it works but in a fixture it doesn't. Any ideas ?
[08:49:33] mikecmpbll: freezevee: !didntwork
[08:49:33] helpa: freezevee: What "didn't work"? Did your server not start? Did your computer explode? Did your webpage turn bright pink? Did your client not pay your bill on time? You may have to be more specific. A Gist (http://gist.github.com) of the code that doesn't work (and the error you are getting) will be helpful.
[08:50:01] arup_r: has joined #RubyOnRails
[08:51:04] mikecmpbll: freezevee: you could just use rand*180-90, though.
[08:51:47] thsig: has joined #RubyOnRails
[08:51:49] mikecmpbll: ah no, rand(-90.0..90.0) is better
[08:51:52] darrencauthon: has joined #RubyOnRails
[08:52:48] Spami_: has joined #RubyOnRails
[08:53:00] freezevee: mikecmpbll: it worked with <%= %>
[08:53:25] mikecmpbll: freezevee: right yeah, it needs to be evaluated as ruby ;)
[08:53:32] freezevee: but I am not sure why integers work with just rand(100) and floats you have to use <%= rand(0.0...100.0) %>
[08:54:00] GriffinHeart: has joined #RubyOnRails
[08:54:10] sandstrom: has joined #RubyOnRails
[08:55:02] Glyphik: has joined #RubyOnRails
[08:55:24] mikecmpbll: freezevee: yeah it's odd, a quirk of implementation i guess. it's mentioned in the docs.
[08:55:54] mikecmpbll: Negative or floating point values for max are allowed, but may give surprising results. rand(-100) # => 87; rand(-0.5) # => 0.8130921818028143; rand(1.9) # equivalent to rand(1), which is always 0
[08:55:59] freezevee: mikecmpbll: thanks, I checked them out and couldn't find anything similar, just to use Random.new
[08:56:01] aditya432: is there a way to ensure user is signed in before submitting form via ajax.
[08:56:27] aditya432: I am using devise for sign in
[08:56:29] mikecmpbll: aditya432: why before?
[08:56:54] rushed: aditya432: don't show them the form you don't want them to complete?
[08:57:02] aditya432: mikecmpbll i want only signed in users to fill the form. but I want to show the form to everyone
[08:57:17] mikecmpbll: aditya432: check it server side on submission?
[08:57:56] aditya432: yea i added before_action. but the problem is that it is redirecting to devise signin.js
[08:58:34] mikecmpbll: you can probably write your own before_action to just check for current_user
[08:58:45] mikecmpbll: but i don't know the specifics of devise.
[08:58:56] aditya432: okay. let me see if this works.
[09:00:08] mikecmpbll: aditya432: a quick google tells me there's a user_signed_in? helper, you should probably use that.
[09:00:37] ndrei: has joined #RubyOnRails
[09:00:40] olistik: has left #RubyOnRails: ()
[09:01:10] aditya432: yea - i did that - but as i mentioned it sends request to .js file
[09:01:13] aditya432: which doesnt exist
[09:01:24] edwinvdgraaf: has joined #RubyOnRails
[09:01:26] mikecmpbll: what exactly did you do?
[09:01:48] tianyi: has joined #RubyOnRails
[09:01:51] DoctorMonocular: has joined #RubyOnRails
[09:01:54] kp666: has joined #RubyOnRails
[09:01:57] aditya432: checked if user is signed in before action create in my controller.
[09:02:14] aditya432: if user isn't signed in then devise redirects user to sign in page
[09:02:17] mikecmpbll: that's not very /exactly/
[09:02:31] mikecmpbll: exactly would be you showing me the code.
[09:03:31] aditya432: before_action :authenticate_user!, :only => [:create]
[09:03:49] aditya432: this is the only thing I need to add! After this devise redirects on its own.
[09:04:03] mikecmpbll: yeah, at which point did i suggest you do that?
[09:04:34] aditya432: the request going to /users/sign_in.js
[09:04:44] mikecmpbll: hello, anybody there?
[09:05:01] aditya432: yea - should i check it in my create action?
[09:05:06] edwinvdg_: has joined #RubyOnRails
[09:05:15] mikecmpbll: i remember explicitly suggesting you write your own before_action method, which uses `user_signed_in?` to check if the user is signed in
[09:05:32] asheinfeld: has joined #RubyOnRails
[09:05:42] aditya432: okay - i was doing that. wait give me a minute. I thought you were asking about the previous thing i did
[09:08:00] mikecmpbll: anybody know which takes precedence if i have both a secret_key_base specified in my secrets.yml and an old secret_token.rb initializer setting Application.config.secret_key_base ?
[09:08:11] RegulationD: has joined #RubyOnRails
[09:08:30] sarink: has joined #RubyOnRails
[09:09:16] aditya432: mikecmpbll - https://gist.github.com/anonymous/b85fe52905e990184129 This is my code. Still I am getting response Processing by Devise::SessionsController#new as JS
[09:09:27] aditya432: I think this is because i am submitting via ajax.
[09:09:54] mikecmpbll: yeah, that's to be expected, what do you want to happen?
[09:11:48] darrencauthon: has joined #RubyOnRails
[09:12:42] disperso: has joined #RubyOnRails
[09:13:23] _blizzy_: has joined #RubyOnRails
[09:13:47] aditya432: I want to send the user to sign in page
[09:13:53] aditya432: so it has to be html request
[09:14:04] aditya432: is it possible?
[09:14:34] mikecmpbll: aditya432: okay, you could do a JS redirect.
[09:14:37] user121212: has joined #RubyOnRails
[09:15:57] nixter1029: has joined #RubyOnRails
[09:16:01] user121212: I want to upload a base64 image using paperclip, I can see different methods to do it, Which will be better for that? http://stackoverflow.com/questions/27234065/how-to-upload-a-base-64-image-to-rails-paperclip
[09:17:06] Lightsword: has joined #RubyOnRails
[09:18:40] konsolebox: has joined #RubyOnRails
[09:19:02] aditya432: mikecmpbll - Thanks man. worked1
[09:19:34] GriffinHeart: has joined #RubyOnRails
[09:22:47] charliesome: has joined #RubyOnRails
[09:26:01] merryfett: has joined #RubyOnRails
[09:26:16] sevensea_: has joined #RubyOnRails
[09:26:44] bobbobbins: has joined #RubyOnRails
[09:28:04] jenrzzz: has joined #RubyOnRails
[09:29:30] juni0r: has joined #RubyOnRails
[09:30:00] gaboesquivel: has joined #RubyOnRails
[09:31:50] mello: has joined #RubyOnRails
[09:34:43] noodman: has joined #RubyOnRails
[09:35:31] doublemalt__: has joined #RubyOnRails
[09:35:59] neutrino: has left #RubyOnRails: ()
[09:37:16] lessless: has joined #RubyOnRails
[09:40:41] ndrei: has joined #RubyOnRails
[09:43:23] x-light: has joined #RubyOnRails
[09:45:49] joaomdmoura: has joined #RubyOnRails
[09:47:50] bruno-: has joined #RubyOnRails
[09:49:40] SalexW: has joined #RubyOnRails
[09:49:49] joaomdmoura: has joined #RubyOnRails
[09:49:50] thebatu1_: hello when I try to sign_out using devise I get no route err! what can be the problem ? https://gist.github.com/thebatu/5dd7b63e71270198d89a
[09:50:36] garyserj: has joined #RubyOnRails
[09:51:14] rushed: thebatu1_: get instead of post, maybe due to js issues?
[09:51:46] joaomdmoura: has joined #RubyOnRails
[09:54:00] GriffinHeart: has joined #RubyOnRails
[09:54:12] karimb: has joined #RubyOnRails
[09:54:16] joaomdmoura: has joined #RubyOnRails
[09:58:16] darrencauthon: has joined #RubyOnRails
[09:59:06] thebatu1_: rushed: dont get it
[09:59:24] joaomdmoura: has joined #RubyOnRails
[09:59:32] mclee: has joined #RubyOnRails
[10:00:50] thebatu1_: rushed: what js has to do with devise ?
[10:01:17] joaomdmoura: has joined #RubyOnRails
[10:01:28] darrenca_: has joined #RubyOnRails
[10:01:39] thebatu1_: sevenseacat: here is an idea, maybe its cursed :)
[10:02:02] sevenseacat: sign out is not a GET request. thats why you have a routing error.
[10:02:15] sevenseacat: the output of your rake routes shows this.
[10:02:41] sevenseacat: however, you have not shown anything that demonstrates why your request is a GET request.
[10:03:16] thebatu1_: sevenseacat: sign_out is a destroy request, correct ?
[10:03:25] sevenseacat: no. it's a DELETE request.
[10:03:47] joaomdmoura: has joined #RubyOnRails
[10:04:07] ndrei: has joined #RubyOnRails
[10:04:33] intinig: has joined #RubyOnRails
[10:05:01] thebatu1_: sevenseacat: oh ok well I have this as route destroy_user_session_path DELETE /users/sign_out(.:format) sessions#destroy
[10:05:09] sevenseacat: yep, and you're not calling it.
[10:05:19] joaomdmoura: has joined #RubyOnRails
[10:05:20] sevenseacat: show us how you're calling this sign out link.
[10:05:24] chipotle: has joined #RubyOnRails
[10:05:40] thebatu1_: sevenseacat: http://localhost:3000/users/sign_out
[10:05:48] sevenseacat: and that makes a GET request.
[10:05:53] redmaverick: has joined #RubyOnRails
[10:05:56] sevenseacat: where are you making it a DELETE request?
[10:06:15] asheinfeld: has joined #RubyOnRails
[10:06:35] thebatu1_: sevenseacat: in the resources :users in the routes.rb
[10:06:43] sevenseacat: no. show the view with the sign out link in it.
[10:07:03] sevenseacat: you're completely misunderstanding how this works.
[10:07:24] thebatu1_: sevenseacat: shit. :(
[10:07:26] joaomdmoura: has joined #RubyOnRails
[10:08:00] thebatu1_: sevenseacat: in the view:- %li=link_to 'Sign out', destroy_user_session_path
[10:08:35] sevenseacat: ok, so you need to add the `method: :delete` option to the end of that link_to, to tell rails to make it a DELETE link
[10:09:20] joaomdmoura: has joined #RubyOnRails
[10:09:49] srinidhi: has joined #RubyOnRails
[10:10:18] MrMaynes: has joined #RubyOnRails
[10:10:37] thebatu1_: sevenseacat: oh ok, because browsers dont support delete, I have to explicitly declare it. correct ?
[10:11:10] joaomdmoura: has joined #RubyOnRails
[10:12:02] mikecmpbll: thebatu1_: pretty much but even if they did you'd have to explicitly tell them it was a delete anyway ...
[10:12:11] sevenseacat: well no, because the default link makes a GET request
[10:12:17] sevenseacat: so you have to specify it if its not GET
[10:13:09] thebatu1_: sevenseacat: ok its clearer now. thanks man
[10:13:13] thebatu1_: mikecmpbll: ty
[10:13:16] sevenseacat: I'm not a man, but yw.
[10:14:55] thebatu1_: sevenseacat: oh sry.
[10:15:34] thebatu1_: sevenseacat: didn't know you were an intelligent bot :p
[10:15:55] sevenseacat: please take your foot out of your mouth now.
[10:15:57] creature: has joined #RubyOnRails
[10:16:21] mello: has joined #RubyOnRails
[10:17:23] thebatu1_: sevenseacat: it's Friday gimme a break :)
[10:18:14] drale2k: has joined #RubyOnRails
[10:18:25] helpa: http://youtu.be/kfVsfOSbJY0
[10:19:17] n008f4g_: has joined #RubyOnRails
[10:19:22] elia: has joined #RubyOnRails
[10:20:26] rickmasta: has joined #RubyOnRails
[10:20:32] vanne: has joined #RubyOnRails
[10:20:51] bruno-: has joined #RubyOnRails
[10:22:49] sandelius: has joined #RubyOnRails
[10:22:59] doodlehaus: has joined #RubyOnRails
[10:23:49] User458764: has joined #RubyOnRails
[10:24:13] chagel: has joined #RubyOnRails
[10:24:36] user121212: I want to upload a base64 image using paperclip, I can see different methods to do it, Which will be better for that? http://stackoverflow.com/questions/27234065/how-to-upload-a-base-64-image-to-rails-paperclip
[10:25:49] pyemkey: has joined #RubyOnRails
[10:26:21] srinidhi: has joined #RubyOnRails
[10:28:30] quazimodo: has joined #RubyOnRails
[10:29:41] pyemkey: Hello peeps. Anyone can help me figure out why function is not executing inside setTimeout https://gist.github.com/pyemkey/195e998360778f1034ba I am getting error saying that policy_insurer_loader is not a function
[10:30:32] doodlehaus: has joined #RubyOnRails
[10:30:32] sp1rs: has joined #RubyOnRails
[10:30:54] nfk: has joined #RubyOnRails
[10:31:28] pyemkey: this is part of backbone
[10:32:38] gorsg_: has joined #RubyOnRails
[10:34:24] gorsg_: has joined #RubyOnRails
[10:36:22] Glyphik: has joined #RubyOnRails
[10:36:26] gorsg_: has joined #RubyOnRails
[10:37:24] lapide_viridi: has joined #RubyOnRails
[10:38:28] goodcodeguy: has joined #RubyOnRails
[10:39:41] gorsg_: has joined #RubyOnRails
[10:40:59] gorsg_: has left #RubyOnRails: ()
[10:42:11] tvw: has joined #RubyOnRails
[10:47:00] Lightsword: has joined #RubyOnRails
[10:47:22] neutrino: has joined #RubyOnRails
[10:47:28] gorsg_: has joined #RubyOnRails
[10:48:16] alex3f: has joined #RubyOnRails
[10:48:58] aditya432: User has to login before submitting a form. but, after login it is going to root url. I want it to go to the page which referred it. What can I do?
[10:49:32] alex3f: Hello, I'm a beginner to ruby and I'm looking for a way to disable Tire indexing in a Docker container
[10:49:56] alex3f: because i just want to compile the assets, and don't have an elasticsearch set up
[10:50:46] DEA7TH: has joined #RubyOnRails
[10:52:23] gorsg__: has left #RubyOnRails: ()
[10:54:00] gorsg_: has joined #RubyOnRails
[10:54:19] SalexW: has joined #RubyOnRails
[10:55:44] stamina: has joined #RubyOnRails
[10:55:58] platzhirsch: has joined #RubyOnRails
[10:56:20] platzhirsch: My model has a DateTime attribute, but in my form I let the user select time and date
[10:56:42] platzhirsch: To handle that I am doing the following in the controller: params[:event][:local_starts_at] += " " + params[:event].delete(:local_starts_on)
[10:56:47] platzhirsch: how can I move this into the model?
[10:57:02] RegulationD: has joined #RubyOnRails
[10:57:08] mrbubbles: has joined #RubyOnRails
[10:58:51] rodfersou: has joined #RubyOnRails
[10:58:55] mikecmpbll: platzhirsch: bunch of different ways
[10:59:28] mikecmpbll: you could create a UserDate concern, for instance, which adds a attr_accessor for your user date attributes, and a before_save which sets the database attributes correctly.
[10:59:50] pyemkey: Hello peeps. Anyone can help me figure out why function is not executing inside setTimeout https://gist.github.com/pyemkey/195e998360778f1034ba I am getting error saying that policy_insurer_loader is not a function
[11:00:07] mikecmpbll: pyemkey: doesn't sound like i has anything to do with rails, to me.
[11:00:14] platzhirsch: mikecmpbll: yes? Currently I make a call to events.build(params[:event]), wonder if it clashes there
[11:00:23] thebatu1: has joined #RubyOnRails
[11:00:25] mikecmpbll: platzhirsch: nope, that's fine.
[11:00:34] platzhirsch: ok :) great, thanks
[11:00:55] pyemkey: mikecmpbll: you are wrong :) it's part of a rails project :)
[11:01:23] mikecmpbll: pyemkey: that's irrelevant
[11:02:29] edwinvdgraaf: has joined #RubyOnRails
[11:02:43] workmad3: has joined #RubyOnRails
[11:03:58] annlewis: has joined #RubyOnRails
[11:04:00] mikecmpbll: platzhirsch: btw this is the kind of thing I meant: https://gist.github.com/mikecmpbll/e476b2b4a31db4455490
[11:04:34] platzhirsch: mikecmpbll: did you just write this?
[11:04:53] mikecmpbll: platzhirsch: nah it's an old gist of something that i used in a project
[11:05:04] drale2k: has joined #RubyOnRails
[11:05:13] platzhirsch: ah good :) yeah thanks' for pointing that out, especially the rescue clause, haven't thought about that
[11:05:19] mikecmpbll: according to gist :p
[11:06:10] thebatu1: has joined #RubyOnRails
[11:06:36] platzhirsch: oh North Yorkshire, nice.. I want to to a trip there at some point
[11:06:47] ndrei: has joined #RubyOnRails
[11:07:05] Papierkorb: has joined #RubyOnRails
[11:07:09] asheinfeld: has joined #RubyOnRails
[11:07:15] platzhirsch: sorry for stalking
[11:07:45] edwinvdg_: has joined #RubyOnRails
[11:08:12] User458764: has joined #RubyOnRails
[11:09:08] edwinvdg_: has joined #RubyOnRails
[11:10:03] User458764: has joined #RubyOnRails
[11:10:18] User458764: has joined #RubyOnRails
[11:10:45] hahuang65: has joined #RubyOnRails
[11:12:11] thebatu1: has joined #RubyOnRails
[11:13:17] thebatu1: has joined #RubyOnRails
[11:15:17] tomaszbalon: has joined #RubyOnRails
[11:15:18] surrealanalysis: has joined #RubyOnRails
[11:17:34] Ergo: has joined #RubyOnRails
[11:18:27] erich: has joined #RubyOnRails
[11:19:50] johntrails: has joined #RubyOnRails
[11:21:25] tagrudev: has joined #RubyOnRails
[11:26:33] maz-dev: has joined #RubyOnRails
[11:29:45] Caius: has joined #RubyOnRails
[11:32:26] rikkipitt: has joined #RubyOnRails
[11:39:00] edwinvdgraaf: has joined #RubyOnRails
[11:41:25] k4nd4lf: has joined #RubyOnRails
[11:41:36] edwinvdg_: has joined #RubyOnRails
[11:43:05] user121212: has joined #RubyOnRails
[11:43:05] rikkipitt: has joined #RubyOnRails
[11:46:05] nhhagen: has joined #RubyOnRails
[11:46:09] SalexW_: has joined #RubyOnRails
[11:46:13] sp1rs: has joined #RubyOnRails
[11:48:09] nhhagen_: has joined #RubyOnRails
[11:48:58] kp666: has joined #RubyOnRails
[11:49:25] shyshy: has joined #RubyOnRails
[11:52:38] thsig: has joined #RubyOnRails
[11:54:18] ur5us: has joined #RubyOnRails
[11:56:55] nettoweb: has joined #RubyOnRails
[11:59:21] ldnunes: has joined #RubyOnRails
[12:01:03] griffindy: has joined #RubyOnRails
[12:01:09] grn: has joined #RubyOnRails
[12:03:06] repinel: has joined #RubyOnRails
[12:04:26] ekain: has joined #RubyOnRails
[12:05:09] rikkipitt: has joined #RubyOnRails
[12:05:20] mbuf: has joined #RubyOnRails
[12:05:43] nettoweb: has joined #RubyOnRails
[12:06:20] bronson: has joined #RubyOnRails
[12:06:22] mase-chatter: has joined #RubyOnRails
[12:06:29] mbuf: what is the recommended way to import large files through POST (?) requests to a Rails API?
[12:07:30] mostlybadfly: has joined #RubyOnRails
[12:07:47] asheinfeld: has joined #RubyOnRails
[12:07:56] AzaToth: has joined #RubyOnRails
[12:08:04] Scripore: has joined #RubyOnRails
[12:08:29] elia: has joined #RubyOnRails
[12:09:31] edwinvdgraaf: has joined #RubyOnRails
[12:10:44] wethu: has joined #RubyOnRails
[12:11:47] alex3f: has joined #RubyOnRails
[12:12:34] Trefex1: has joined #RubyOnRails
[12:14:59] goodcodeguy: has joined #RubyOnRails
[12:15:21] edwinvdg_: has joined #RubyOnRails
[12:15:47] thebatu1: has joined #RubyOnRails
[12:17:50] alex3f: has joined #RubyOnRails
[12:18:46] alex3f: has left #RubyOnRails: ()
[12:19:15] pjammer: has joined #RubyOnRails
[12:19:42] ndrei: has joined #RubyOnRails
[12:19:48] jkamenik: has joined #RubyOnRails
[12:21:29] grn: has joined #RubyOnRails
[12:27:19] maz-dev: has joined #RubyOnRails
[12:28:02] krz: has joined #RubyOnRails
[12:31:14] chagel: has joined #RubyOnRails
[12:32:21] sandelius: has joined #RubyOnRails
[12:33:20] SalexW: has joined #RubyOnRails
[12:35:18] maz-dev: has joined #RubyOnRails
[12:36:24] xcesariox: has joined #RubyOnRails
[12:36:49] goodcodeguy: has joined #RubyOnRails
[12:37:10] user121212: hey, I'm getting nomethod error while trying to decode base64, what be the issue behind it? http://stackoverflow.com/questions/30528969/update-rating-and-base-64-decoding
[12:39:19] tbuehlmann: user121212, "NoMethodError in MoviesController#create" tells us that the error emerges from the controller. can you paste the controller and the full error?
[12:39:41] fgo: has joined #RubyOnRails
[12:40:58] tomaszbalon: has joined #RubyOnRails
[12:42:39] greengriminal: has joined #RubyOnRails
[12:43:16] user121212: tbuehlmann: the create method is here https://eval.in/private/d922162816bdb5, But the create action is working fine if I comment out the base64 decoder
[12:44:07] dionysus69_: has joined #RubyOnRails
[12:44:16] tbuehlmann: user121212, can you paste the full stack trace as well?
[12:45:56] RegulationD: has joined #RubyOnRails
[12:46:03] mello: has joined #RubyOnRails
[12:46:56] allcentury: has joined #RubyOnRails
[12:47:54] user121212: tbuehlmann: https://eval.in/private/6677fdbb902193 Is that what you mean?
[12:50:33] tbuehlmann: yes, but that's part of it. can you gist the complete stack trace? also, can you gist the complete model and controller? it's hard to compare line numbers when the files are not complete
[12:51:29] user121212_: has joined #RubyOnRails
[12:52:21] livathinos: has joined #RubyOnRails
[12:55:54] Detch: has joined #RubyOnRails
[12:55:56] ismaelga: has joined #RubyOnRails
[12:56:09] hahuang65: has joined #RubyOnRails
[12:57:54] vasilakisFiL: can I get milliseconds resolution from DateTime.now ?
[12:58:44] sankaber: has joined #RubyOnRails
[13:00:06] ejnahc: has joined #RubyOnRails
[13:00:11] Overand: has joined #RubyOnRails
[13:00:40] mary5030: has joined #RubyOnRails
[13:00:43] bmurt: has joined #RubyOnRails
[13:00:51] erich: has joined #RubyOnRails
[13:01:11] Joshmfrankel: has joined #RubyOnRails
[13:01:16] Joshmfrankel: has left #RubyOnRails: ()
[13:02:28] mary5030: has joined #RubyOnRails
[13:02:34] user121212_: tbuehlmann: here is the model and controller https://eval.in/private/5f2ccdc59d8854
[13:04:24] tbuehlmann: and the complete stack trace, please. you can copy that from the server terminal
[13:04:32] sonofdirt: has joined #RubyOnRails
[13:05:07] asheinfeld: has joined #RubyOnRails
[13:06:45] qwertme: has joined #RubyOnRails
[13:07:27] maxshelley: has joined #RubyOnRails
[13:09:43] ndrei: has joined #RubyOnRails
[13:09:57] jokke: hi, i'm working on an engine and i'm trying to customize the layout of it in my application
[13:10:03] ismaelga: has joined #RubyOnRails
[13:10:06] jokke: for this i use the decorators gem
[13:10:23] jokke: i class evaled the engine controller
[13:10:32] jokke: and added layout 'admin'
[13:10:51] jokke: so far so good. problem is, my path helpers don't seem to work
[13:11:08] jokke: undefined local variable or method `admin_pages_path'
[13:11:14] tbuehlmann: jokke, is the engine namespaced?
[13:11:26] tbuehlmann: I think you have to prefix the path helpers then
[13:11:47] cleopatra: hello people
[13:11:59] jokke: tbuehlmann: that won't work, because that would mean prefixing the helpers in my app
[13:12:01] cleopatra: who has used this plugin https://github.com/dnasir/jquery-cascading-dropdown on rails
[13:12:55] repinel: has joined #RubyOnRails
[13:12:55] tbuehlmann: jokke, I'm referring to this: http://guides.rubyonrails.org/engines.html#routes
[13:13:38] user121212_: tbuehlmann: here is the log https://eval.in/private/32a50ba2ed7d88
[13:14:17] chagel: has joined #RubyOnRails
[13:14:42] gerardc: has joined #RubyOnRails
[13:15:12] mrbubbles: I???m trying to write a custom initializer which includes a method. I???m currently getting ???undefined method??? for my method, do I need to wrap it in class Application < Rails::Application ?
[13:15:49] czerasz: has joined #RubyOnRails
[13:15:58] user121212_: tbuehlmann: I doubt this portion, Id I commentout this, everything work smoothly https://eval.in/private/6cd60a1cde02f4
[13:16:32] user121212_: tbuehlmann: *If I comment this portion
[13:16:34] gerardc_: has joined #RubyOnRails
[13:17:28] TinkerTyper: has joined #RubyOnRails
[13:18:12] _blizzy_: has joined #RubyOnRails
[13:19:46] Chagel_: has joined #RubyOnRails
[13:19:57] tbuehlmann: user121212_, I can't follow. this is too confusion
[13:20:24] tbuehlmann: mrbubbles, where do you want to include a method?
[13:20:29] mrbubbles: in the same file
[13:21:01] tbuehlmann: in a class? module? global scope?
[13:21:07] mrbubbles: tbuehlmann: I haven???t wrapped the listener in anything though
[13:21:20] mrbubbles: Should a listener be in it???s own module?
[13:21:35] tbuehlmann: what listener?
[13:21:51] jokke: tbuehlmann: any idea what to do with something like polymorphic_path([:admin, @resource])?
[13:21:59] griffindy: has joined #RubyOnRails
[13:22:03] mrbubbles: tbuehlmann I???m writing a custom listerner
[13:22:10] czerasz: has joined #RubyOnRails
[13:22:11] jokke: polymorphic_path([:main_app, :admin, @resource])?
[13:22:16] jokke: doesn't work
[13:22:25] jokke: maybe main_app.polymorphic_path...
[13:22:38] tbuehlmann: jokke, the last one sounds good to me
[13:22:51] tbuehlmann: mrbubbles, show some code and the error, please
[13:23:17] GriffinHeart: has joined #RubyOnRails
[13:23:48] DigitallyBorn: has joined #RubyOnRails
[13:24:13] surrealanalysis: has joined #RubyOnRails
[13:24:27] doodlehaus: has joined #RubyOnRails
[13:24:55] Scripore: has joined #RubyOnRails
[13:25:22] workmad3: has joined #RubyOnRails
[13:25:26] arathald: has joined #RubyOnRails
[13:25:31] mrbubbles: tbuehlmann: https://gist.github.com/anonymous/5abd0f90d0d2eeaa706a undefined method `process_file_array' for main:Object (NoMethodError)
[13:27:32] tbuehlmann: I don't see how this is a listener, and I don't know what you are doing. importing stuff when the application boots up?
[13:27:38] paulcsmith: has joined #RubyOnRails
[13:28:04] mrbubbles: sorry I meant an initializer :)
[13:28:14] mrbubbles: it???s an initializer that starts up an instance of listen to watch a folder
[13:28:54] delianides: has joined #RubyOnRails
[13:29:12] tbuehlmann: an initializer is the wrong place for that. I think you want an external process for that. an easy way is to use a rake task
[13:29:26] user121212_: tbuehlmann: I fixed that, that was due to a mistake in attr_accessor, I was using image_data and image like this https://eval.in/private/6cd60a1cde02f4
[13:30:20] thebatu1_: has joined #RubyOnRails
[13:33:27] ericchernuka: has joined #RubyOnRails
[13:33:56] tbuehlmann: user121212_, great
[13:35:15] chagel: has joined #RubyOnRails
[13:35:30] MrMaynes: has joined #RubyOnRails
[13:36:40] charliesome: has joined #RubyOnRails
[13:37:40] umdstu: has joined #RubyOnRails
[13:38:31] tejasmanohar: has joined #RubyOnRails
[13:38:54] tejasmanohar: in what situation, could l#52 `place` be different from l#59 `place`?
[13:38:56] tejasmanohar: https://gist.github.com/tejasmanohar/ed20e48b6f64fdde5341#file-gistfile1-rb-L52
[13:39:18] marcusalmeida: has joined #RubyOnRails
[13:39:24] erich: has joined #RubyOnRails
[13:39:45] DLSteve: has joined #RubyOnRails
[13:39:48] mwlang: has joined #RubyOnRails
[13:40:13] tejasmanohar: in what situation, could `place` here https://gist.github.com/tejasmanohar/ed20e48b6f64fdde5341#file-gistfile1-rb-L52 be different from place here- https://gist.github.com/tejasmanohar/ed20e48b6f64fdde5341#file-gistfile1-rb-L82
[13:40:18] IrishGringo: has joined #RubyOnRails
[13:40:29] marcusalmeida: hi guys! Is there another way to clear view paths cache without use view_paths.each(&:clear_cache) ?
[13:40:43] earthquake: has joined #RubyOnRails
[13:41:08] tejasmanohar: because... im getting users who are getting texts saying theyre like 2000th in line and then on the site it says something like 5000th
[13:41:35] tejasmanohar: @place is used here in the templaitng https://gist.github.com/tejasmanohar/ed20e48b6f64fdde5341#file-gistfile2-erb-L4
[13:41:36] Depili: well, anything can happen between two method calls to your data
[13:41:49] arup_r: has joined #RubyOnRails
[13:41:52] Depili: what your .index is sorting the db with?
[13:41:57] tejasmanohar: nd this is the model https://gist.github.com/tejasmanohar/ed20e48b6f64fdde5341#file-user-rb-L6
[13:42:28] tejasmanohar: Depili: is the counter_cache a problem here?
[13:42:42] tejasmanohar: im growing fast, like 400 users a day
[13:42:53] mwlang: I???m integrating a Rails app with an external SOAP server (Microsoft Navivision). Navision can generate PDF invoices, but you have to retrieve it with a SOAP call. Additionally, that server is accessible by the webservice via the LAN, but not available publicly (i.e. a user on the Internet couldn???t just click a link in the Rails app and get at the Navision server). So the question I have, what???s the *easiest* way to proxy the S
[13:42:53] mwlang: call so that PDF invoices could be seamlessly served to the customers?
[13:42:58] krz: has joined #RubyOnRails
[13:43:22] tejasmanohar: but not 1k users a day and this problem is consistent so its more a problem... not a thing bout the data changing in between the two calls
[13:43:42] darrencauthon: has joined #RubyOnRails
[13:43:42] gaboesquivel: has joined #RubyOnRails
[13:43:42] marcusalmeida: hi guys! Is there another way to clear view paths cache without use view_paths.each(&:clear_cache) ?
[13:43:44] mwlang: my thought is to use Faraday or RestClient and fetch the PDF and immediately serve it to the client as the response.
[13:43:51] tejasmanohar: Depili: im trying to just get the literal index in the array like arr[0] is first element
[13:44:18] tejasmanohar: Depili: users = User.order(referrals_count: :desc, created_at: :asc) should sort first by referrals count and then by created_at so users who have the most referrals are at the top and then its prioritized b signing up early
[13:44:27] rikkipitt: has joined #RubyOnRails
[13:45:23] Depili: tejasmanohar: why are you doing array operations when you could just order the db and count the rows before your user?
[13:46:00] Depili: and write tests for code like that where you add and remove users and see if its stable :)
[13:46:47] mello: has joined #RubyOnRails
[13:46:51] RegulationD: has joined #RubyOnRails
[13:47:00] mrbubbles: tbuehlmann: so which bit would you move to the rake task? the bit where I set up the listener? or the entire processing of the CSVs?
[13:47:13] Depili: and yeah, sorting with multiple columns makes the in-db solution little harder
[13:47:26] sonofdirt: has joined #RubyOnRails
[13:47:47] darrenca_: has joined #RubyOnRails
[13:48:37] Guest7458: has joined #RubyOnRails
[13:49:09] garrypolley: has joined #RubyOnRails
[13:49:17] tbuehlmann: mrbubbles, the code that has to do with listening and doing something with the listening's results
[13:49:52] posixpascal: has joined #RubyOnRails
[13:49:58] mrbubbles: tbuehlmann: okay. so I can set up the listener in a rake task and then call a method defined on the main rails app with the things that arrive?
[13:50:08] mrbubbles: or are the two separate?
[13:50:30] tbuehlmann: why not have that method also in the rake task?
[13:50:40] tbuehlmann: and could you describe what exactly you are trying to do?
[13:50:55] mrbubbles: okay. i???m watching a directory for CSV uploads
[13:51:04] mrbubbles: when the CSVs arrive it reads each row
[13:51:26] mrbubbles: a row contains a number of readings for a given meter
[13:51:38] byprdct: has joined #RubyOnRails
[13:51:51] mrbubbles: a reading consists of a number of parameters (volts, amps, etc) but the name of the column differs from CSV to CSV depending on which meter
[13:52:17] maxshelley: has joined #RubyOnRails
[13:52:19] tejasmanohar: Depili: how would i count rows before user?
[13:52:20] mrbubbles: so the voltage, for example, for meter 1 it???s called meter-1-v but for meter 2 it???s called incomer-3-v
[13:52:40] tejasmanohar: Depili: and User.order(referrals_count: :asc) - how does this differ from User.order(referrals_count: :desc, created_at: :asc) ?
[13:52:41] Depili: tejasmanohar: count where some_column > somevalue
[13:52:47] tbuehlmann: mrbubbles, okay, whatever. important thing is you want to process the upload, right?
[13:53:01] chinmay_dd: has joined #RubyOnRails
[13:53:03] drale2k: has joined #RubyOnRails
[13:53:11] tejasmanohar: Depili: but do you know answer to my other question? how each order() is different
[13:53:17] tbuehlmann: mrbubbles, that sounds to me like a background job, right?
[13:53:43] tejasmanohar: which one first sorts by referrals_count highest at front of list and then it ranks whoever signups up first next in line
[13:53:49] mrbubbles: tbuehlmann i guess my question is??? in order to process the upload i???m going to need to write rows to the DB. but I???m also going to need to read rows from the DB to resolve the field names
[13:53:51] tejasmanohar: i thought both... :\
[13:54:08] mrbubbles: so if the rake file has to be independent from the main rails app then it may cause issues
[13:54:23] mrbubbles: I thought maybe use the initializer to start the listener, then when a file arrives use sidekiq to process
[13:54:35] bobbobbins: has joined #RubyOnRails
[13:54:57] tbuehlmann: mrbubbles, I wouldn't do that. but bringing in a background worker sounds right to me. why not just start the job after the upload has finished?
[13:55:02] jacor_m: has joined #RubyOnRails
[13:55:13] tbuehlmann: sidekiq could then read the file and do the job
[13:55:27] mrbubbles: because we don???t know when the files will arrive
[13:55:51] tbuehlmann: they come in via a POST request or something?
[13:56:22] mrbubbles: the meters connect via 3g to an ftp server and upload a csv ~ every 5 mins
[13:57:17] gaboesquivel: has joined #RubyOnRails
[13:57:20] tejasmanohar: hey guys im having trouble finding out whats wrong with my query
[13:57:44] tbuehlmann: mrbubbles, okay. so, I'm not a fan of using listen here. if it's not running you might miss uploads. why not have a loop running, checking every n seconds for new files, if so, process them?
[13:58:03] tbuehlmann: you could also do a mix of both, but I think I would go with checking every n seconds
[13:58:08] mrbubbles: yeh that could work
[13:58:10] tejasmanohar: User.order(referrals_count: :desc, created_at: :asc) should order users 1) by highest # of referrals and 2) as a tie-breaker by earliest created_at (signup time)
[13:58:21] tejasmanohar: its a waiting list where you can jump ahead by referring people
[13:58:29] tejasmanohar: does that seem right? it seems to work correctly sometimes
[13:58:39] Lightsword: has joined #RubyOnRails
[13:58:49] mrbubbles: tbuehlmann: and you???d still do this in a rake task or...?
[13:59:37] gfedel: has joined #RubyOnRails
[14:00:07] superflat: has joined #RubyOnRails
[14:01:12] tejasmanohar: does anyone find issue in my query logic?
[14:01:32] tbuehlmann: mrbubbles, yes
[14:01:53] mrbubbles: okay cool. so I???ll just use ???whenever??? to schedule a rake task to run every 30 seconds
[14:01:57] mrbubbles: sounds like a good plan :)
[14:02:06] tbuehlmann: also, you'd need to somehow remember what the last read file was in order to know which files are new
[14:02:06] mrbubbles: thanks mate
[14:02:16] tbuehlmann: or simply move the files from the directory, might be easier
[14:02:22] mrbubbles: i???ll archive the files once they???re done
[14:03:32] mrbubbles: so, sorry to ask something so simple sounding but I???ve never written a rake task, does a rake task operate in isolation to the rest of the app? I.e. can I access the database at all and write/read from it?
[14:04:33] rushed: has joined #RubyOnRails
[14:04:56] ddv: mrbubbles: you can call Rails models just fine
[14:05:37] mrbubbles: banging. cheers
[14:05:56] tbuehlmann: well, that depends. you can decide whether or not the application shall be loaded. example: https://gist.github.com/tbuehlmann/6c187713b9b1a7ed6843
[14:06:27] Scripore: has joined #RubyOnRails
[14:06:45] mrbubbles: okay :) cheers. do rake tasks run in background by default? or should I still use sidekiq?
[14:07:56] tbuehlmann: they does not run in background by default, but they run independently from your webserver process
[14:08:11] tbuehlmann: but you don't need sidekiq
[14:08:37] allcentury: has joined #RubyOnRails
[14:09:27] mrbubbles: as long as it won???t block the main app then all good
[14:11:14] maz-dev: has joined #RubyOnRails
[14:12:22] ferr: has joined #RubyOnRails
[14:12:24] tbuehlmann: mrbubbles, yeah, it won't
[14:13:27] neutrino: has joined #RubyOnRails
[14:14:28] DLSteve: has joined #RubyOnRails
[14:15:07] Hates_: has joined #RubyOnRails
[14:15:43] tjbiddle: has joined #RubyOnRails
[14:16:10] sarink: has joined #RubyOnRails
[14:16:34] Zadrel: has joined #RubyOnRails
[14:16:42] nobitanobi: has joined #RubyOnRails
[14:16:57] RegulationD: has joined #RubyOnRails
[14:17:14] Joshmfrankel: has joined #RubyOnRails
[14:17:43] Zadrel: hello here! anyone could please explain this line to me? i know what it results but i can't 'see into it'. --<%= check_box_tag 'product[recommended_ids][]', product.id, @product.recommendeds.include?(product) %>--
[14:19:12] rubyonrailed: has joined #RubyOnRails
[14:19:40] sonOfRa: has joined #RubyOnRails
[14:20:09] tbuehlmann: Zadrel, that's a checkbox for a "recommend". it's either checked or not, depending on whether it's associated with the product or not
[14:21:08] baweaver: has joined #RubyOnRails
[14:21:29] dstarh: has joined #RubyOnRails
[14:21:33] Zadrel: tbuehlmann: right, i need to do something exactly the same with other models (subcategories related with itself through related_catefories), any tips where i should look into, how do i do it or anything?
[14:22:20] tbuehlmann: I don't have a resource for that at hand, no
[14:22:29] tbuehlmann: do it.. like the other example? :)
[14:22:59] Zadrel: tbuehlmann: i tryed, didn't work. i'll investigate. ty
[14:25:22] sonofdirt: has joined #RubyOnRails
[14:26:19] sankaber: has joined #RubyOnRails
[14:26:30] sonofdirt: has joined #RubyOnRails
[14:26:44] gambl0re: has joined #RubyOnRails
[14:27:24] bluish: has joined #RubyOnRails
[14:27:33] charliesome: has joined #RubyOnRails
[14:28:26] xcesariox: has joined #RubyOnRails
[14:29:18] Xiti: has joined #RubyOnRails
[14:31:45] ferr: has joined #RubyOnRails
[14:31:45] maz-dev: has joined #RubyOnRails
[14:36:15] bronson: has joined #RubyOnRails
[14:37:28] bratsche: has joined #RubyOnRails
[14:37:59] nettoweb: has joined #RubyOnRails
[14:40:14] GriffinHeart: has joined #RubyOnRails
[14:42:24] karimb: has joined #RubyOnRails
[14:43:36] livathinos: has joined #RubyOnRails
[14:44:05] dru`: has joined #RubyOnRails
[14:44:57] hahuang65: has joined #RubyOnRails
[14:47:07] riotjones: has joined #RubyOnRails
[14:47:37] hutch78: has joined #RubyOnRails
[14:47:53] powersurge: has joined #RubyOnRails
[14:48:09] hutch78: once again the asset pipeline is giving me trouble??? why the hell does it not find my asset in app/assets/videos when i give it an absolute path !?!?!?!?!?!?
[14:48:14] powersurge: anyone ever do AVS with activemercent? address verification with authorize.net in specific
[14:48:24] powersurge: I'm having an awful time figuring out if I can even do it through activemerchant's api
[14:48:29] aamax: has joined #RubyOnRails
[14:48:42] hutch78: whatever precompiling the video is doing seems to be making it perform like shit
[14:48:44] umgrosscol: has joined #RubyOnRails
[14:49:12] Hates_: hutch78: in dev or in production?
[14:49:25] hutch78: im in dev currently
[14:49:41] gaboesquivel: has joined #RubyOnRails
[14:50:07] premera: has joined #RubyOnRails
[14:50:43] joelataylor: has joined #RubyOnRails
[14:51:21] Hates_: hutch78: does video_path not give you the path you want?
[14:52:56] Spami_: has joined #RubyOnRails
[14:55:43] Hates_: has joined #RubyOnRails
[14:56:34] tubbo: has joined #RubyOnRails
[14:58:23] Trefex: has joined #RubyOnRails
[14:58:24] foucist: has joined #RubyOnRails
[14:59:31] wasp__: has joined #RubyOnRails
[14:59:56] foucist: i have a method that basically checks the value of a key in memcache and then decrements it based on that.. the rspec fails because it's too fast for memcache.. anyone encounter this issue?
[15:00:00] rickmasta: has joined #RubyOnRails
[15:00:07] dopie: has joined #RubyOnRails
[15:00:35] voker57: has joined #RubyOnRails
[15:00:37] karmatronic: has joined #RubyOnRails
[15:00:47] jkamenik1: has joined #RubyOnRails
[15:01:46] disgrntld: has joined #RubyOnRails
[15:02:45] sevenseacat: you'd stub out memcache in the spec, no?
[15:02:59] hutch78: the path is working when i dont give it the full name - i think it was encoding that was causing poor browser performance ,not the precompiling
[15:03:13] pjammer: has joined #RubyOnRails
[15:03:59] aamax: I am deploying a rails app (4.x) to heroku (the app is redmine) and I'm getting an error that the database doesn't exist in the asset precompile. anyone know how to get around this on the first compile?
[15:04:38] edwinvdgraaf: has joined #RubyOnRails
[15:05:27] delianides: has joined #RubyOnRails
[15:06:56] uris: has joined #RubyOnRails
[15:08:28] watchtheblur: has joined #RubyOnRails
[15:10:53] chouhoul_: has joined #RubyOnRails
[15:11:56] chouhoul_: has joined #RubyOnRails
[15:12:15] maz-dev: has joined #RubyOnRails
[15:14:17] vanne: has joined #RubyOnRails
[15:14:22] maxshelley: has joined #RubyOnRails
[15:15:16] aamax: has anyone had problems with deploying a project in rails4 to heroku like this?
[15:15:53] tbuehlmann: aamax, you might want to run `$ heroku run bin/rake db:create db:migrate`
[15:16:06] sinkensabe: has joined #RubyOnRails
[15:18:08] annlewis: has joined #RubyOnRails
[15:19:02] aamax: i can't deploy the initial deploy to heroku so there is no bin/rake... and there's not config/database.yml either.
[15:19:19] aamax: when the push fails, heroku cleans all the files out
[15:19:46] edwinvdg_: has joined #RubyOnRails
[15:20:38] czerasz: has joined #RubyOnRails
[15:22:43] ismaelga: has joined #RubyOnRails
[15:23:00] tbuehlmann: aamax, no database.yml?
[15:23:45] aamax: no, there are no files at all (yet) and the datbase.yml is not in the repo anyway
[15:24:18] aamax: I think I have to add it back in now that I think of it... ;)
[15:25:06] aamax: I'm working from a redmine repo that wasn't specific for heroku and that probably won't work unless I manually add it later - and can't do that because of this compile problem
[15:25:36] zorak8: has joined #RubyOnRails
[15:26:35] snockerton: has joined #RubyOnRails
[15:28:15] givanse: has joined #RubyOnRails
[15:28:59] chouhoulis: has joined #RubyOnRails
[15:29:43] wasp__: has joined #RubyOnRails
[15:30:18] workmad3: has joined #RubyOnRails
[15:30:22] aamax: Radar, I see that you've dealt with this in the past with Spree. any input/help?
[15:31:19] chouhoulis: has joined #RubyOnRails
[15:32:19] Fire-Dragon-DoL: has joined #RubyOnRails
[15:33:07] sevenseacat: i dont think he's awake
[15:33:27] aamax: I forgot where he lives :)
[15:33:54] Axilla: has joined #RubyOnRails
[15:33:55] aamax: been a while since I've been in here. Doing too much admin/management stuff these days and not enough code. that's why I haven't been playing with rails 4 much
[15:34:01] intinig: has joined #RubyOnRails
[15:34:27] Axilla: hi all, i'm trying to slice some post_params in rails 3, as a private method and getting the following error.. any ideas why? I'm a bit stumped https://gist.github.com/travisdmathis/9856530d9cb383ebd82b
[15:34:52] Cache_Money: has joined #RubyOnRails
[15:35:44] aamax: axilla, what is the route for the post?
[15:35:50] sevenseacat: axilla: surely it would take an array of elements to slice?
[15:35:51] mello: has joined #RubyOnRails
[15:36:32] aamax: wow - I got past the error on my push. had to add the pg add-on to the heroku instance before pushing. never had to do that before. weird
[15:36:57] sevenseacat: aamax: well, how were you going to connect to a database before precompiling if you didnt have one?
[15:37:39] aamax: sevenseacat, makes sense now but I can't remember having to do that in any heroku apps I've pushed before - but it has been a while and I am old and feeble so maybe I just forgot. ;)
[15:37:56] moretti: has joined #RubyOnRails
[15:38:16] Axilla: aamax: updated the gist refresh with the route
[15:38:26] Axilla: sevenseacat: its json
[15:39:06] sevenseacat: you say that like it's going to change my answer
[15:40:10] Axilla: http://api.rubyonrails.org/classes/ActiveSupport/JSON.html#method-c-decode
[15:40:23] Axilla: maybe you should recognize what the json_params method I listed does..
[15:41:09] Axilla: why so snarky?
[15:41:20] sevenseacat: I did recognize
[15:41:28] havenn: has joined #RubyOnRails
[15:41:33] sevenseacat: but what does that have to do with what slice does???
[15:42:00] Lytol: has joined #RubyOnRails
[15:42:35] Axilla: http://apidock.com/rails/Hash/slice
[15:42:46] __butch__: has joined #RubyOnRails
[15:43:19] MartinElvar: has joined #RubyOnRails
[15:43:59] myddler: has joined #RubyOnRails
[15:44:22] aamax: axilla, have you tried slicing it in IRB?
[15:44:42] kallisti5: has joined #RubyOnRails
[15:44:53] kallisti5: is there a way to "label" an image asset?
[15:45:21] nettoweb: has joined #RubyOnRails
[15:45:35] kallisti5: aka, instead of ugly case statements in my view, I wanted to image_tag("#{somevalue}.png")
[15:46:09] MrMaynes: has joined #RubyOnRails
[15:46:43] aamax: axilla, I'd probably break or print the players prior to the slice call and make sure everything is what I'm expecting. json_params...
[15:47:14] aamax: axilla, and I'd play with it in IRB to see if it breaks there..
[15:49:36] Axilla: aamax i figured out the issue..
[15:49:50] Axilla: thanks, didn't go your route, but it gave me an idea to try
[15:49:55] Axilla: since i'm working against our API
[15:50:01] Axilla: i'm using RESTClient
[15:50:07] Axilla: it was that i had my json data wraped in []
[15:50:09] jacor: has joined #RubyOnRails
[15:50:12] lessless: has joined #RubyOnRails
[15:50:15] Axilla: removed it and it slices just fine
[15:50:33] Axilla: :thumbs up:
[15:50:56] aamax: glad to help (sort of)
[15:51:37] bronson: has joined #RubyOnRails
[15:52:24] __butch__: has joined #RubyOnRails
[15:53:33] melter: has joined #RubyOnRails
[15:53:39] Axilla: first time i've used this hand little tool to do posts :)
[15:54:01] myddler: has left #RubyOnRails: ()
[15:54:57] neutrino: has joined #RubyOnRails
[15:55:51] delianides: has joined #RubyOnRails
[15:55:59] smathy: has joined #RubyOnRails
[15:56:18] EXCHGR: has joined #RubyOnRails
[15:57:41] arta82: has joined #RubyOnRails
[15:57:45] philcrissman: has joined #RubyOnRails
[15:58:57] commondream: has joined #RubyOnRails
[15:59:04] leslie: If I need to store configuration data in an app (site-wide but needs to be editable by users), what's the convention? Having a database table just for a handful of configuration variables seems excessive to me.
[15:59:56] maz-dev: has joined #RubyOnRails
[16:01:57] aamax: leslie, db tables are pretty cheap and easy. if users have to edit them then I'd go that way.
[16:05:04] paulcsmith: has joined #RubyOnRails
[16:05:32] lathiat: has joined #RubyOnRails
[16:05:40] gaboesquivel: has joined #RubyOnRails
[16:07:33] Rubie: has joined #RubyOnRails
[16:08:17] Maletor: has joined #RubyOnRails
[16:10:22] dudedudeman: has joined #RubyOnRails
[16:11:03] dudedudeman: could i ask a active record question of you guys? it's not rails specific, sinatra actually, but i figured this would be the best place to ask as activerecord is pretty popular among the rails folks
[16:11:18] ProLoser: has joined #RubyOnRails
[16:12:06] hmsimha: has joined #RubyOnRails
[16:12:15] jenrzzz: has joined #RubyOnRails
[16:12:59] leslie: aamax, alright, thanks :)
[16:15:42] Pumukel: has joined #RubyOnRails
[16:16:14] bricker: has joined #RubyOnRails
[16:16:33] thiagovsk: has joined #RubyOnRails
[16:16:52] The_Phoenix: has joined #RubyOnRails
[16:17:40] Doddlin: has joined #RubyOnRails
[16:18:53] Doddlin: Hi all! Used to using form_for but trying to use form_tag, the parameters are correct but nothing is being saved, anyone with a great tutorial, alternatively with some time to explain? :)
[16:19:06] jkamenik: has joined #RubyOnRails
[16:19:20] dudedudeman: i have two models/tables. Monitors, that has_many calibrations, where calibrations belongs_to Monitors. The Monitors table just has a column for what I call Tag, and the Calibration table hooks in to that table with a monitor_id. I want to retrieve all records from a table in my database that are over 80 days old. i can get the records that are in that time stamp range, but it shows me the ID from Calibration table for each of the recor
[16:20:23] cac: has joined #RubyOnRails
[16:20:44] IrishGringo: has joined #RubyOnRails
[16:21:05] cnk: has joined #RubyOnRails
[16:22:04] jhass: dudedudeman: cut off at "the recor"
[16:23:26] gfedel: has joined #RubyOnRails
[16:24:12] DoctorMonocular: has joined #RubyOnRails
[16:24:15] dopie: has joined #RubyOnRails
[16:24:35] christop_: has joined #RubyOnRails
[16:24:57] dudedudeman: from a table in my database that are over 80 days old. i can get the records that are in that time stamp range, but it shows me the ID from Calibration table for each of the records, instead of the actual tag number. How can I access that tag number using the monitor_id?
[16:25:07] k4nd4lf: has joined #RubyOnRails
[16:25:08] rubyonra_: has joined #RubyOnRails
[16:25:25] dudedudeman: This is what i'm doing: https://gist.github.com/anonymous/670cdc5d07696eeaee1b
[16:25:49] shinnya: has joined #RubyOnRails
[16:26:13] baweaver: has joined #RubyOnRails
[16:26:33] gaustin: has joined #RubyOnRails
[16:26:51] ismaelga: has joined #RubyOnRails
[16:27:19] christop_: Hi All, I'm having a problem with some Postgres errors. Deatils posted here: https://groups.google.com/forum/#!topic/rubyonrails-talk/_e6UN0yg42Q. If anyone has any ideas on how to fix this, I would appreciate it :)
[16:27:31] rubyonrailed: has joined #RubyOnRails
[16:27:41] MartinElvar: has joined #RubyOnRails
[16:28:27] jhass: dudedudeman: what's your current query?
[16:28:58] patie: has joined #RubyOnRails
[16:29:40] Trefex1: has joined #RubyOnRails
[16:29:41] jkamenik: has joined #RubyOnRails
[16:31:14] intinig: has joined #RubyOnRails
[16:32:52] gaboesquivel: has joined #RubyOnRails
[16:33:23] towski_: has joined #RubyOnRails
[16:33:51] intinig: has joined #RubyOnRails
[16:33:52] hahuang65: has joined #RubyOnRails
[16:34:16] sonOfRa: has joined #RubyOnRails
[16:40:38] mikecmpbll: has joined #RubyOnRails
[16:41:16] Hates_: has joined #RubyOnRails
[16:41:58] zorak8: has joined #RubyOnRails
[16:42:16] allcentury: has joined #RubyOnRails
[16:43:52] zorak8: has joined #RubyOnRails
[16:44:16] dudedudeman: jhass: y = x.where(["created_at > ?", 7.days.ago])
[16:44:38] jhass: dudedudeman: what's x?
[16:44:40] smathy: dudedudeman, show your actual queries here, foo doesn't help us understand what you're doing.
[16:44:41] wasp__: has joined #RubyOnRails
[16:45:39] jkamenik: has joined #RubyOnRails
[16:46:52] jamgood96: has joined #RubyOnRails
[16:48:02] jsrn_: has joined #RubyOnRails
[16:48:17] rcm: has joined #RubyOnRails
[16:48:41] jamgood96: How does one set Nginx client_max_body_size and have Rails properly handle the 413 error? Everything I read has Rails doing validation on file uploads *after* they are uploaded, at which point Nginx would toss an error before ever going through Rails validation.
[16:48:44] bmalum: has joined #RubyOnRails
[16:49:35] ismaelrb: has joined #RubyOnRails
[16:51:48] dudedudeman: jhass, smathy, this is what currently in my app.rb: https://gist.github.com/anonymous/652b8b8f0bce60676164
[16:51:56] dudedudeman: sorry for the delay, i was pulled away at work
[16:52:13] rubyonra_: has joined #RubyOnRails
[16:52:44] paulcsmith: has joined #RubyOnRails
[16:52:47] vsaroha: has joined #RubyOnRails
[16:52:52] rcm: Hey there! Was hoping someone can give me some directions to cope an ember-cli app with a rails app. Basically I put them together using gem "ember-cli-rails", but I don't want to use coffee-script. So I removed coffee-script from Gemfile. The problem I'm getting when trying to run rake assets:precompile is "LoadError: cannot load such file --coffee_script".
[16:53:06] jhass: dudedudeman: Calibration.includes(:monitor).where("created_at < ?", 2.days.ago) and then you can access calibration.monitor.tag without overhead
[16:53:40] juanda: has joined #RubyOnRails
[16:53:47] smathy: dudedudeman, you want only the tag number?
[16:53:57] dudedudeman: for this instance, yes
[16:54:19] dudedudeman: it currently returns the entire calibrations, with the monitor_id which points to hte monitors table, which is where the tag numbers are housed
[16:54:25] vsaroha: has left #RubyOnRails: ()
[16:54:46] jhass: oh, then .joins(:monitor).where(...).pluck("monitors.tag")
[16:55:04] dudedudeman: wizardry. let me try that
[16:55:35] jhass: might need to remove dupes
[16:55:40] smathy: Or come the other way, from Monitor - that'd be clearer for me.
[16:56:07] dudedudeman: i'm assuming that .join(:monitor) is the full name of my table?
[16:56:11] smathy: Same issue with dupes though.
[16:56:20] smathy: dudedudeman, no, the name of the association in your model.
[16:56:26] jhass: .joins(:monitor) and it's the name of the association there
[16:56:36] dudedudeman: the belongs_to
[16:56:50] ghr: has joined #RubyOnRails
[16:57:12] jhass: might need to calibrations.created_at in the where, I don't remember
[16:57:50] x44x45x41x4E: has joined #RubyOnRails
[16:58:39] arup_r: has joined #RubyOnRails
[16:59:15] mrbubbles: If I want to split a rake task up into different methods, do I just include the methods at the top of the file (under the namespace declaration)?
[16:59:23] mrbubbles: I wouldn???t make them separate tasks or anything???
[16:59:45] snockerton: has joined #RubyOnRails
[16:59:50] maz-dev: has joined #RubyOnRails
[17:02:18] joelataylor: has joined #RubyOnRails
[17:02:56] jhass: or make it a nice class that your task just calls
[17:03:37] Spami: has joined #RubyOnRails
[17:03:39] Spami: has joined #RubyOnRails
[17:04:14] dudedudeman: jhass: i get an undefined method 'join' when running the code you gave me earlier
[17:04:20] dudedudeman: here's exactly what i plugged in
[17:04:27] jhass: dudedudeman: attention
[17:04:29] jhass: it's joins
[17:06:05] dudedudeman: now I get this: PG::UndefinedTable: ERROR: missing FROM-clause entry for table "dream_color_monitor"
[17:07:31] jhass: dream_color_monitors ?
[17:07:55] dudedudeman: well, it's singular in my model
[17:08:08] dudedudeman: wait. doesn't it make it plural?
[17:08:08] jhass: doesn't matter
[17:08:22] jhass: it needs to be the table name
[17:08:30] jhass: AR won't touch it at that point
[17:08:44] Scripore: has joined #RubyOnRails
[17:08:54] dudedudeman: when adding the s, i get the configuration error and AR telling me it wasn't found, maybe I mispelled it?
[17:08:56] djbkd: has joined #RubyOnRails
[17:09:19] jhass: too vague
[17:09:29] dudedudeman: ActiveRecord::ConfigurationError: Association named 'dream_color_monitors' was not found on Calibration; perhaps you misspelled it?.
[17:09:37] christop_: Hi All, I'm having a problem with some Postgres errors. Deatils posted here: https://groups.google.com/forum/#!topic/rubyonrails-talk/_e6UN0yg42Q. If anyone has any ideas on how to fix this, I would appreciate it :)
[17:09:38] jhass: in the pluck
[17:09:50] jhass: dudedudeman: the s is missing the pluck I bet, not in the .joins
[17:10:19] jhass: dudedudeman: .joins adds stuff to the FROM clause, so if it would be missing there, that previous error made no sense
[17:10:25] commondream: has joined #RubyOnRails
[17:11:17] dudedudeman: if i add the s to both the joins and the pluck, it asks me if i mispelled it. if i add it only to the pluck, i get: ActiveRecord::StatementInvalid: PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous
[17:11:52] sonOfRa: has joined #RubyOnRails
[17:13:07] cac: has joined #RubyOnRails
[17:14:15] dudedudeman: i have to go to lunch. i'll swing back by on this afterwards
[17:14:23] dudedudeman: thanks for the help! This is getting me in a good direction
[17:16:19] n008f4g_: has joined #RubyOnRails
[17:17:15] paulcsmith: has joined #RubyOnRails
[17:17:26] Lytol: has joined #RubyOnRails
[17:18:11] juanda: has joined #RubyOnRails
[17:20:37] skiz: has joined #RubyOnRails
[17:21:26] Scient: anyone here familiar with cucumber/watir?
[17:21:36] Scient: i cant seem to reset the session between scenarios...
[17:21:48] andhof-mt: has joined #RubyOnRails
[17:21:53] Scient: its as if the before hook for scenarios is not fired at the right time
[17:21:57] Scient: i.e before the scenario
[17:22:31] andhof-mt: Guys, I'm trying to increment a number in my model based on the highest number assigned previously
[17:22:37] andhof-mt: it's not working!
[17:22:38] andhof-mt: https://gist.github.com/andhof-mt/6665540abc835dc8c924
[17:22:41] thebatu1: has joined #RubyOnRails
[17:22:59] andhof-mt: basically, each "tutorial" has many lessons. I want to number the lessons per tutorial. Would love help!
[17:23:31] rhizome: do they really have to be numbered within the model?
[17:23:57] rhizome: i guess order is a position numbering
[17:24:05] andhof-mt: rhizome, sadly yes. Because it effects position of how they load
[17:24:19] andhof-mt: e.x. tutorial: Ruby on Rails -> ep1 -> ep2 -> ep3
[17:24:39] mello: has joined #RubyOnRails
[17:25:02] jhass: dudedudeman: that's what I meant earlier, that you might have to do calibrations.created_at in the where
[17:25:38] tubbo: has joined #RubyOnRails
[17:25:48] rhizome: validate uniqueness with scope and look up drag and drop type reordering methods
[17:26:04] andhof-mt: could you explain that?
[17:26:30] rhizome: explain what?
[17:26:33] andhof-mt: My migration was this basically: add_column :lessons, :number, :integer, :null => false, :default => 1
[17:26:38] andhof-mt: validating uniqueness with scope
[17:28:24] arta82: has joined #RubyOnRails
[17:29:42] rhizome: you are new to ruby. you should have Lessons belong_to Tutorial (or whatever), then you can validate the position's uniqueness, scoped to tutorial_id
[17:30:00] rhizome: scoped == restricted to, essentially
[17:30:14] joelataylor: has joined #RubyOnRails
[17:31:37] annlewis_: has joined #RubyOnRails
[17:32:47] kies: has joined #RubyOnRails
[17:33:09] nettoweb: has joined #RubyOnRails
[17:34:08] benjwadams: has joined #RubyOnRails
[17:34:25] hahuang65: has joined #RubyOnRails
[17:34:57] benjwadams: I inherited a legacy rails project (2.x series) and don't do a ton of rails development. Is this snippet vulnerable to injection?
[17:35:05] benjwadams: @sensors = Sensor.find(:all, :include => [:station, {:parameter => :unit}, {:variation => :unit}], :order => "#{sort_column} #{sort_order}")
[17:35:12] andhof-mt: rhizome, lessons does belong_to Tutorial and Tutorial has_many lessons
[17:35:19] benjwadams: The key here being the raw string interpolation
[17:35:25] andhof-mt: can't seem to find an example for it though
[17:35:42] benjwadams: coming from other frameworks/languages it has me a little worried
[17:35:42] jgpawletko: has joined #RubyOnRails
[17:36:10] benjwadams: this guy didn't write it, but now I have to maintain the project
[17:36:39] jhass: benjwadams: sounds fishy for sure, no clue about ancient 2.x stuff though
[17:37:19] ProLoser: has joined #RubyOnRails
[17:37:31] lathiat: has joined #RubyOnRails
[17:38:26] jhass: :order - An SQL fragment like "created_at DESC, name".
[17:38:31] dllama: has joined #RubyOnRails
[17:38:32] jhass: suggests no further escaping is done
[17:38:53] jhass: so if sort_column and sort_order is user input, whitelist it
[17:38:59] juanda: has joined #RubyOnRails
[17:39:40] cnk: benjwadams: I think yes - unless yo udo something that sanitizes sort_column and sort_order
[17:39:59] cnk: does the controller check those for rational values? like ASC or DESC?
[17:40:30] cnk: uh what jhass said
[17:41:03] dllama: hey guys, quick question about active model serializer, if i have an association like user.bank_accounts => statements => transactions, can i set it up to show all the nested associations for index#bank_accounts?
[17:41:10] jamiely: has joined #RubyOnRails
[17:41:24] joaomdmoura: has joined #RubyOnRails
[17:41:26] polyrob: has left #RubyOnRails: ("Leaving")
[17:41:29] qejk: has joined #RubyOnRails
[17:44:11] pjammer: has joined #RubyOnRails
[17:44:32] annlewis: has joined #RubyOnRails
[17:44:43] dudedudeman: jhass: THAT WORKED
[17:44:54] rhizome: andhof-mt: can't find https://www.google.com/search?q=rails+drag+and+drop+reordering ?
[17:45:15] artto: has joined #RubyOnRails
[17:47:30] bmurt: has joined #RubyOnRails
[17:50:00] garrypolley: has joined #RubyOnRails
[17:50:46] gauke: has joined #RubyOnRails
[17:51:00] sandelius: has joined #RubyOnRails
[17:51:24] garrypolley: has joined #RubyOnRails
[17:51:52] edgarjs: has joined #RubyOnRails
[17:53:03] hutch78: has joined #RubyOnRails
[17:53:22] SeriousMatters: has joined #RubyOnRails
[17:55:43] SeriousMatters: how to set a DB date duration default value? say for 6 months
[17:55:58] ndrei: has joined #RubyOnRails
[17:57:30] Lytol: has joined #RubyOnRails
[17:57:36] jhass: uh, there's such a thing as a duration db type?
[17:58:51] axl_: has joined #RubyOnRails
[17:59:00] DoctorMonocular: has joined #RubyOnRails
[17:59:04] SeriousMatters: trying db:migrate - t.date :duration_field, null: false, default: "0000-06-00"
[17:59:09] ghr: has joined #RubyOnRails
[17:59:29] jhass: uh, don't store a duration as a date
[17:59:37] jhass: store it as an integer of seconds or something
[17:59:48] SeriousMatters: jhass: but that doesn't work.
[17:59:54] jhass: sure it does
[17:59:57] tbuehlmann: yeah, I'd also store seconds as integers
[18:00:14] SeriousMatters: client needs calendar month.
[18:01:13] SeriousMatters: adding x seconds to a Jan date and adding to a Feb date would give different result.
[18:01:40] drale2k: has joined #RubyOnRails
[18:01:41] jhass: so it's no duration?
[18:02:13] tbuehlmann: do you want a start and end date by any chance?
[18:02:18] jhass: it's a deadline? or...?
[18:02:28] rhizome: lots of unanswered questions
[18:02:39] SeriousMatters: jhass: it's a voucher kind of thing, valid for x months
[18:02:48] jhass: so a deadline, target date
[18:02:55] rhizome: expiration
[18:03:03] tbuehlmann: deadspiration
[18:03:17] jhass: yeah, expires_at is what I would call the field
[18:03:56] SeriousMatters: jhass: but I don't know the expiration date. the duration is to be added onto a date.now
[18:04:13] jhass: at record creation, right?
[18:04:36] Vendella: has joined #RubyOnRails
[18:04:53] rhizome: you should use more words to describe what you have and need to do
[18:05:02] SeriousMatters: say i have 2 objects, voucher_offers and vouchers_purchases.
[18:05:08] jhass: then your unit is months? Why do you have to ask you all the details, why don't you provide them?
[18:05:12] erich: has joined #RubyOnRails
[18:05:41] SeriousMatters: voucher_offers is valid for x months, when someone buys it, a voucher_purchase is created with expiration date = voucher_offer.duration + date.now
[18:06:19] jhass: so the unit is always months?
[18:06:34] SeriousMatters: it's up to the business to set their own duration.
[18:06:51] rhizome: so when a purchase is made you set the expiration. i'm not sure where the complication is here.
[18:07:37] SeriousMatters: businesses can create their own voucher_offers. and I need a field to represent the duration they wanted
[18:07:43] havenwood: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[18:07:57] asheinfeld: has joined #RubyOnRails
[18:08:21] jhass: I think the most sane way is to use two fields, an integer and a string, duration, duration_type, which type being an enum for days, months, years
[18:08:30] jhass: *with type
[18:08:41] rhizome: num_months on Voucher
[18:09:14] jhass: or do you need to support combinations, 2 months and 15 days or something?
[18:09:17] juanda: has joined #RubyOnRails
[18:09:18] pjammer: has joined #RubyOnRails
[18:09:33] rhizome: 46 and a half hours
[18:09:39] SeriousMatters: hm... good question.
[18:09:51] siemprefresco: has joined #RubyOnRails
[18:13:27] SeriousMatters: I didn't consider what if someone want to set duration as y days where y > 31
[18:13:32] Tashi_: has joined #RubyOnRails
[18:14:32] SeriousMatters: say, if they want duration to be 180 days rather than 6 months
[18:14:37] jhass: yeah, seems like you need to spec out better what you want here
[18:14:51] jhass: anyway, date is the wrong data type in any case
[18:14:51] gfedel: has joined #RubyOnRails
[18:15:01] bronson: has joined #RubyOnRails
[18:15:11] jhass: date is for a fixed point in time, not for a time span
[18:15:54] NiVanc: has joined #RubyOnRails
[18:17:07] eoy_: has joined #RubyOnRails
[18:20:32] dionysus69: has joined #RubyOnRails
[18:21:54] Joshmfrankel: has joined #RubyOnRails
[18:22:44] zorak8: has joined #RubyOnRails
[18:22:44] tubbo: ehh, duration_type?
[18:22:57] tubbo: hours/minutes are a view-level abstraction. it's all in seconds since the unix epoch anyway
[18:23:22] skiz: has joined #RubyOnRails
[18:23:35] jhass: not quite, say you want to store "1 month" with no fixed starting date, that can't be accurately be represented in seconds
[18:23:44] tubbo: yes it can. 31 days in seconds.
[18:23:49] jhass: that's wrong
[18:23:59] tubbo: well, i guess depending on what month it is)
[18:24:02] SeriousMatters: tubbo: some months have more days than others
[18:24:03] jhass: if you add it to February 1 you get the wrong result
[18:24:10] Rubie: has joined #RubyOnRails
[18:24:24] jhass: you want March 1, not March 4 or whatever
[18:24:28] tubbo: but regardless, this is *not* the job of the data model. it's the job of a service object whose only goal is to produce a "seconds since unix epoch" duration, regardless of what input you throw at it.
[18:24:35] kylebusch: has joined #RubyOnRails
[18:24:49] fedexo: has joined #RubyOnRails
[18:24:50] rhizome: nerd alert
[18:24:51] dionysus69: has joined #RubyOnRails
[18:24:53] jhass: no, seconds since epoch again is no duration
[18:24:57] jhass: it's a fixed point in time
[18:25:02] tubbo: yeah you're right
[18:25:03] kylebusch: has left #RubyOnRails: ()
[18:25:05] tubbo: what i meant was seconds
[18:25:07] tubbo: just seconds
[18:25:17] tubbo: the amount of seconds that the time span will take.
[18:25:18] jhass: sigh, see above
[18:25:29] tubbo: you're missing the point
[18:25:34] jhass: I think you are
[18:25:55] SeriousMatters: lol, do I have to copy and paste my question again?
[18:26:11] jhass: no, you have to spec out what you want to support
[18:26:12] tubbo: jhass: what if i want a duration of "1 month, 3 days, 1 hour, 3 minutes and 2 seconds"?
[18:26:30] jhass: then you have to store each component
[18:26:33] tubbo: laaaaaaaaaaaaaaaaaaaame
[18:26:35] rhizome: then you have a shitty product because nobody wants to buy a coupon with that kind of expiration criteria
[18:26:44] tubbo: rhizome wins
[18:27:22] bricker: seconds can't be converted into months, is that what we're arguing about?
[18:27:30] jhass: well, yo ucan simplify days, hour, minutes and seconds into seconds if you disregard leap seconds etc
[18:28:10] tubbo: which in this case doesn't matter too much, but in the case of a television schedule...
[18:28:19] tubbo: leap seconds are a pain in the dick
[18:28:25] SeriousMatters: I got the correct answer to my question already. why are we still discussing?
[18:28:32] notakid: has joined #RubyOnRails
[18:28:35] maz-dev: has joined #RubyOnRails
[18:28:47] rhizome: forget it jake, it's irc
[18:29:01] tubbo: i didn't jump into this argument to help you, SeriousMatters, i jumped into it to argue with jhass. duh. ;)\
[18:29:11] notakid: anybody know the json schema used for signup/signin with devise token auth gem?
[18:29:28] SeriousMatters: lol, enjoy your debate.
[18:29:46] SeriousMatters: notakid: devise removed it
[18:30:14] SeriousMatters: :token_authenticatble has been removed from devise a few months ago.
[18:30:19] notakid: SeriousMatters: this one https://github.com/lynndylanhurley/devise_token_auth
[18:31:08] tubbo: notakid: https://github.com/lynndylanhurley/devise_token_auth/blob/master/app/controllers/devise_token_auth/sessions_controller.rb#L40-L42
[18:31:13] SeriousMatters: that's a different gem. seems like you need to implement your own RegistrationController
[18:31:27] Doddlin: has joined #RubyOnRails
[18:31:33] tubbo: that might be a first start
[18:31:50] gauke: has joined #RubyOnRails
[18:33:03] __butch__: has joined #RubyOnRails
[18:33:05] Lightsword: has joined #RubyOnRails
[18:33:21] commondream: has joined #RubyOnRails
[18:33:36] adavia: has joined #RubyOnRails
[18:35:05] SeriousMatters: is it possible to route requests to DeviseTokenAuth::SessionsController ?
[18:35:43] adavia: has left #RubyOnRails: ()
[18:35:48] sandstrom: has joined #RubyOnRails
[18:36:08] lindii_: has joined #RubyOnRails
[18:36:26] lindii_: anyone tried cloud9?
[18:36:45] SeriousMatters: oh, it has routes. I must be thinking about a different gem
[18:37:30] davidrox: has joined #RubyOnRails
[18:38:13] hahuang65: has joined #RubyOnRails
[18:39:05] hahuang65: has joined #RubyOnRails
[18:39:37] DigitallyBorn: Is it possible to write out a server-side value into coffeescript?
[18:39:56] jhass: DigitallyBorn: check the gon gem
[18:40:58] tubbo: hah, not a bad idea
[18:41:32] DigitallyBorn: That's nice that it's automatic, but probably more functionality than I need. Good thing to know about, though. Thanks.
[18:42:02] tubbo: if i really want to share a bunch of data with JS i typically just shmoosh it into a <meta> tag: %meta{ name: 'data', content: page_data.to_json }
[18:42:16] tubbo: then in my JS: var data = $('meta[name="data
[18:42:18] jhass: use it, even for the simple case, it has some things encapsulated that you don't want to risk doing wrong
[18:42:31] tubbo: but i try never to do that lol
[18:42:50] nettoweb_: has joined #RubyOnRails
[18:43:09] jhass: tubbo: looks prone to XSS if page_data contains user data
[18:43:18] rails098: has joined #RubyOnRails
[18:43:33] tubbo: yeah i definitely never include anything that needs to be secure in there...
[18:43:37] rails098: hello there, I can't figure out how i set subcategories related to other subcategories, they're in the model Category wich have father_id. i tryed this gist : https://gist.github.com/rmatuoka/3fdf4a075f2ee3f6da3d but i had no success, anyone can help me, point me to a direction or tell me what's my mistake? please tell me if there's something missing :)
[18:43:47] doodlehaus: has joined #RubyOnRails
[18:43:51] tubbo: jhass: typically i use that to pass stuff like the RAILS_ENV to my JS
[18:44:29] jhass: I like gon, saves me from the XSS stuff and it's one thing that will extend into pretty much all further usecases
[18:44:30] rhizome: rails098: use awesome_nested_set or closure_tree
[18:44:34] rhizome: don't roll your own
[18:44:46] rhizome: or if you must roll your own, use the nested set pattern
[18:44:50] rails098: rhizome, are they gems?
[18:45:05] commondream: has joined #RubyOnRails
[18:45:15] tubbo: also you have a ton of syntax issues here
[18:45:22] tubbo: you need to use more has_many's! :D
[18:45:39] rhizome: the form partial thingy is written in rails 2.x syntax
[18:45:43] advorak: has joined #RubyOnRails
[18:45:50] gusrub: has joined #RubyOnRails
[18:46:00] dionysus69: has joined #RubyOnRails
[18:48:08] arup_r: has joined #RubyOnRails
[18:48:36] tubbo: https://gist.github.com/rmatuoka/3fdf4a075f2ee3f6da3d#file-subcategories_controller-rb-L3 is also unnecessary since you already have @subcategory = @category.children.build
[18:48:41] tubbo: which implicitly sets the father-id
[18:48:46] rails098: rhizome: sry, i wasn't clear enough in my question becouse of my lack o mastery in English language. the relationship is 1 to n and its a module that, when i'm in categories's|c| show, i have a sidebar that shows a "se also: c1,c2,c3"
[18:50:50] __butch__: has joined #RubyOnRails
[18:51:12] rhizome: right. "see also: #{c.children}" ...you'd expand the c.children part to link, get just the name, etc.
[18:52:25] gauke: has joined #RubyOnRails
[18:52:27] axl_: has joined #RubyOnRails
[18:52:32] RegulationD: has joined #RubyOnRails
[18:53:07] rails098: sorry for making it hard to help me, i'll try to improve my question and ask it again in a while
[18:53:22] hrendalf: has joined #RubyOnRails
[18:54:39] dionysus69: has joined #RubyOnRails
[18:55:44] stylus: has joined #RubyOnRails
[18:56:31] bruno-: has joined #RubyOnRails
[18:56:53] sandelius: has joined #RubyOnRails
[18:59:04] ghr: has joined #RubyOnRails
[18:59:54] coderhs: has joined #RubyOnRails
[18:59:55] Scripore: has joined #RubyOnRails
[19:01:31] Etriaph: has joined #RubyOnRails
[19:03:22] User458764: has joined #RubyOnRails
[19:03:36] snockerton: has joined #RubyOnRails
[19:04:20] drale2k_: has joined #RubyOnRails
[19:04:21] tubbo`: has joined #RubyOnRails
[19:04:45] platzhirsch: has joined #RubyOnRails
[19:05:58] assembledbits: has joined #RubyOnRails
[19:07:46] sarink: has joined #RubyOnRails
[19:07:50] Rubie: has joined #RubyOnRails
[19:08:41] assembledbits: Is 'project' or 'projects' a reversed term in Ruby on rails
[19:09:16] assembledbits: I am using it for my backend and it seems to not recognize the methods for that controller
[19:09:24] lindii_: has joined #RubyOnRails
[19:09:27] assembledbits: portfolio backend*
[19:09:39] assembledbits: LOL reserved***
[19:09:41] jhass: yeah, name your stuff tcejorp and stcejorp. j/k I have no idea :P
[19:09:49] rhizome: no, it's not a reserved word
[19:10:41] assembledbits: when it says "undefined method `projects' for nil:NilClass", what file is referring to
[19:10:45] assembledbits: I'm very new to ruby as of a couple weeks ago
[19:11:00] stamina: has joined #RubyOnRails
[19:11:31] thebatu1: has joined #RubyOnRails
[19:11:33] barnex: has joined #RubyOnRails
[19:13:21] mello: has joined #RubyOnRails
[19:15:07] assembledbits: oh great, it was a misspelling of a variable, but now I'm getting a no method of id
[19:15:08] tubbo`: assembledbits: should tell you in the backtrace
[19:15:43] elia: has joined #RubyOnRails
[19:15:46] sandstrom: has joined #RubyOnRails
[19:16:15] assembledbits: it's all good, figured it out.. it was an issue with my categories controller, fixed that. now it's getting that reference but doesn't see ID as a method
[19:16:36] djbkd: has joined #RubyOnRails
[19:16:43] Cache_Money: has joined #RubyOnRails
[19:17:28] smathy: assembledbits, very unlikely for ID to be a method on a model.
[19:18:17] assembledbits: I did the lynda.com RoR essentials 4, created a basic CMS and it works
[19:18:30] assembledbits: but now I'm converting it (renaming subjects to categories, pages to projects)
[19:18:38] meoblast001: has joined #RubyOnRails
[19:19:19] Joshmfrankel: has left #RubyOnRails: ()
[19:21:23] dllama: guys, can someone point me in the right direction please, when working with nested associations and active model serializer, how do i get deep nesting of assocations? for example user has_many bank accounts, bank_accounts has_many statements and statement has_many tranactions, i'm trying to get it all in 1 transaction, . it only gives me bank_account[id].statements , not the transactions for each statement
[19:22:08] rhizome: what is the "it" in "it only gives me..."?
[19:22:15] dllama: bank_account sorry
[19:22:29] dllama: 1 sec, i'll gist the json responseof bank_accounts
[19:22:49] rhizome: bank_account appears to maybe be a variable or something that you give to, not that gives you anything.
[19:23:57] barnex: My pretty simple nested form refuses to work: https://gist.github.com/barnaba/da920772c12732999fd1
[19:24:03] dllama: rhizome: https://gist.github.com/mvoloz/b314470a5c6f2dc0fa0f
[19:24:09] dllama: its dummy data/testing info so i'm not worried about sharing it :)
[19:24:21] barnex: What happens is I'm not seeing any nested fields, although the Role record I'm checking has two Permissions associated with it.
[19:24:36] duderonomy: has joined #RubyOnRails
[19:25:02] __butch__: has joined #RubyOnRails
[19:26:10] barnex: I've checked 'popular mistakes when using nested forms', some ~10 google results for fields not showing up and can't figure this out
[19:26:59] User458764: Hi Rails generator create a stylesheet and javascript per controller, it's fine but what is the benefits if it loads all the assets globally? I don't find a simple method to load only the related asset to a controller
[19:27:08] dllama: rhizome: i updated the gist to show index#statements
[19:27:23] smathy: barnex, <% should be <%= here: https://gist.github.com/barnaba/da920772c12732999fd1#file-role-_form-erb-L22
[19:27:41] dllama: should i add my serializers to the gist?
[19:27:47] barnex: haha, thanks smathy
[19:27:53] smathy: barnex, you're welcome.
[19:27:57] __butch__1: has joined #RubyOnRails
[19:28:12] barnex: that's the dumbest thing I did today
[19:28:30] smathy: barnex, that's a good day then :) It's pretty simple thing to overlook.
[19:28:59] barnex: smathy: yeah, but then I've lost an hour overlooking it more :D
[19:29:06] smathy: User458764, it's especially tricky if you're using turbolinks. It's more a legacy thing from when Rails was different.
[19:29:07] dllama: updadted it to add the serailizers to id
[19:29:17] smathy: User458764, feel free to delete them if they're not useful to you.
[19:30:02] maz-dev: has joined #RubyOnRails
[19:30:34] centrx: has joined #RubyOnRails
[19:30:35] Zadrel: has joined #RubyOnRails
[19:30:51] smathy: barnex, FWIW, I find that you make less mistakes like these with a less noisy template language (like haml or slim) because those important little operators are more obvious when they're on their own.
[19:31:05] dllama: would it possibly help if i eager load the all the associations from index#bank_accounts
[19:32:16] __butch__: has joined #RubyOnRails
[19:32:36] aZtec_: has joined #RubyOnRails
[19:33:03] User458764: smathy, thanks for your answer I think I will use this hack http://stackoverflow.com/a/6795533/4918824
[19:33:11] aZtec_: i have a fixture record that i want to modify before testing (using shoulda)
[19:33:24] aZtec_: so in the setup block, i call update!...but in the test, it doesn't have the modified value
[19:33:41] asheinfeld: has joined #RubyOnRails
[19:34:19] ur5us: has joined #RubyOnRails
[19:34:29] asheinfe_: has joined #RubyOnRails
[19:35:37] dllama: this is very frustrating, added includes() to my bank_accounts serializer and i see the query in the logs, but not in the json :(
[19:38:06] ur5us: has joined #RubyOnRails
[19:39:47] __butch__: has joined #RubyOnRails
[19:39:48] bruno-: has joined #RubyOnRails
[19:39:48] griffindy: has joined #RubyOnRails
[19:40:55] TheNet: has joined #RubyOnRails
[19:41:10] dllama: nice, managed to crash my vagrant lol
[19:41:13] x-light: has joined #RubyOnRails
[19:41:23] Lytol: has joined #RubyOnRails
[19:41:50] mase-chatter: has joined #RubyOnRails
[19:42:39] Zadrel: hello there! i have this Category model, with father_id to tell if a table row is a child. childe are subcategories, and when i open subcategories' show i need to set a sidebar to include 3 other subcategories(they're in the same tree level) that are alike of each other (its "settable" by a checkbox in the CMS's form). i already asked this question earlier with other nickname, and i'm feeling really dumb becouse both i can't mak
[19:42:44] Zadrel: the answers
[19:43:00] Didrik: has joined #RubyOnRails
[19:43:47] chinmay_dd: has joined #RubyOnRails
[19:43:47] barnex: can I get all the possible values from ActiveRecord::Enum field?
[19:46:35] barnex: nvm, got it. You can and it's Model::YOUR_ENUM_NAME
[19:49:18] Spami: has joined #RubyOnRails
[19:49:29] allcentury: has joined #RubyOnRails
[19:49:59] k4nd4lf: has joined #RubyOnRails
[19:50:10] yaymukund: has joined #RubyOnRails
[19:52:33] borodin: has joined #RubyOnRails
[19:58:38] bronson: has joined #RubyOnRails
[19:58:39] ghr: has joined #RubyOnRails
[19:58:45] arup_r: has joined #RubyOnRails
[19:58:50] jacor: has joined #RubyOnRails
[19:58:50] leafac: has joined #RubyOnRails
[19:59:16] srinidhi: has joined #RubyOnRails
[20:01:10] barnex: dllama: that's not that bad. I'm maintaining C code that crashes GDB :P
[20:01:20] andhof-mt: has joined #RubyOnRails
[20:01:27] andhof-mt: guys I am literally going nuts
[20:01:35] edwinvdgraaf: has joined #RubyOnRails
[20:01:44] andhof-mt: for what reason could I not compare params[:id] in my create method to an integer
[20:01:46] cornerma1: has joined #RubyOnRails
[20:02:16] barnex: well, maybe it's not an integer? Are you getting an error?
[20:02:27] andhof-mt: no error, just broken site
[20:02:37] kenndel: has joined #RubyOnRails
[20:02:58] andhof-mt: https://gist.github.com/andhof-mt/fe945ca8fe6ca6fae6b5
[20:03:07] hernan23: has joined #RubyOnRails
[20:03:13] andhof-mt: its such a simple algorithm, it breaks on this line
[20:03:18] allcentury: has joined #RubyOnRails
[20:03:18] andhof-mt: if lesson_params[:tutorial_id] == 1
[20:03:21] andhof-mt: is where it fails
[20:03:27] iliketurtles: has joined #RubyOnRails
[20:03:50] noodman: has joined #RubyOnRails
[20:03:54] DigitallyBrn: has joined #RubyOnRails
[20:04:14] edwinvdg_: has joined #RubyOnRails
[20:04:51] dllama: my vagrant had the right idea though, i wish i can just crash lol
[20:05:19] dllama: this is seriously annoying & frustrating??? i can't seem to find the syntax anywhere to included deep nesting on assocaitions for a serializer
[20:05:45] pjammer: has joined #RubyOnRails
[20:05:48] kropotkin__: has joined #RubyOnRails
[20:05:55] tjbiddle: has joined #RubyOnRails
[20:06:01] bmulholland: has joined #RubyOnRails
[20:06:12] hernan23: has left #RubyOnRails: ()
[20:06:20] borodin: has joined #RubyOnRails
[20:06:26] andhof-mt: so rails was TELLING me it was an int but wasn't comparing unless it had explicit cast
[20:06:28] andhof-mt: how does that work
[20:08:00] bmulholland: I've hit a bit of a snag with the asset pipeline. Skipping lots of details (short version: CKEditor), I have a directory that has assets that I compile into application.js, assets that I need a compiled and digested version of, and assets that need to be served without digests. sprockets-rails recommends putting non-digest files in public/assets, but then the asset pipeline won't find and compile the other files.
[20:08:13] bmulholland: Is this the right place to seek help for that?
[20:09:13] andhof-mt: bmuholland asset pipeline is on rails docs
[20:09:25] andhof-mt: it is confusing tho, some may recommend using the public folder instead
[20:09:28] andhof-mt: although its a 'bad practice'
[20:10:35] bmulholland: andhof-mt: This isn't addressed in the asset pipeline docs. The problem is this: I can't put the folder in public/assets because my application.js uses it. I also can't put it in app/ or vendor/ because I need non-digest versions of the files.
[20:10:52] bmulholland: I can use https://github.com/alexspeller/non-stupid-digest-assets, but that doesn't support rails 4.2
[20:11:04] baweaver: has joined #RubyOnRails
[20:11:33] andhof-mt: can you reference it in application.js?
[20:12:34] dhosterman: has joined #RubyOnRails
[20:12:43] eoy_: has joined #RubyOnRails
[20:13:06] bmulholland: For simplicity, let's say there's three files: folder/used-in-application.js, folder/dynamically-loaded-no-digest.js and folder/dynmically-loaded-with-digest.js
[20:13:33] bmulholland: And that's really the best I can do. See http://stackoverflow.com/questions/30536594/ckeditor-modifications-to-dynamic-loading-to-allow-fingerprinting for more details
[20:14:40] andhof-mt: Yeah, asset pipeline has it's problems.
[20:14:48] andhof-mt: One of the worst implemented rails features IMO
[20:15:26] bmulholland: There was an issue in sprockets-rails on this topic that resorted to personal attacks :\
[20:15:29] workmad3: has joined #RubyOnRails
[20:15:34] juanda: has joined #RubyOnRails
[20:15:35] sandstrom: has joined #RubyOnRails
[20:15:59] andhof-mt: bmuholland, check this out: http://webpack.github.io/
[20:16:08] andhof-mt: its an alternative to the asset pipeline on sprockets.
[20:16:10] andhof-mt: may or may not help
[20:17:39] bmulholland: That looks cool, but feels like a lot of work for a small problem
[20:19:42] sinkensabe: has joined #RubyOnRails
[20:20:05] andhof-mt: bmuholland, every line of code I have written this week has been a big fix for small problems
[20:20:08] bmurt: has joined #RubyOnRails
[20:21:22] bmulholland: I think the least amount of work here might be to use non-stupid-digest-assets and do the 4.2 upgrade work myself
[20:21:53] k4nd4lf_: has joined #RubyOnRails
[20:23:15] TheNet: is "link_to 'link' record" or "link_to 'link' record_path" preferred?
[20:23:22] TheNet: with a comma in there...
[20:23:32] tubbo: bmulholland: you can't have it both ways
[20:23:41] tubbo: bmulholland: either use the asset pipeline for CKE, or don't. but not both.
[20:25:01] bmulholland: tubbo: Yeah I'm really annoyed at the project and all their dynamic linking
[20:25:05] kallisti5: uugh. I have a bunch of data points I want to graph. Storing each metric as a row. [{:counter => "thinga", :time => timestamp, :value => 0}, {:counter => "thingb, :time => timestamp, :value => 0}]. Anyone know an easy way to reformat that data for chartkick? {:name => "thinga", :data => [[:time, :value], [:time, :value]]},{:name => "thingb", :data => [[:time, :value], [:time, :value]]}
[20:25:20] bmulholland: lots of downsides to non-digest assets
[20:25:21] tubbo: bmulholland: heh, CKEditor has always been a pain in the dick for me
[20:25:29] bmulholland: Don't get me started :)
[20:26:11] Zadrel: hello, i have this RelatedCategories(RCat) model that relates childs of Category(Cat) with other childs of the same Cat, RCat have 3 fields, cat_id, rel_id and order(to limit and order the number of related "subcategories" displayed ), i'm slamming my head against the wall to figure out hao do i save the "main subcategory" in the cat_id field and the related subcategories in the rel_id field. and if there is more than 1 related
[20:26:17] skiz: has joined #RubyOnRails
[20:26:39] tubbo: there's also tinyMCE or http://xing.github.io/wysihtml5/ if you want alternatives
[20:27:07] bmulholland: Unfortunately CK is the best of the worst :)
[20:27:10] yaymukund: has joined #RubyOnRails
[20:27:12] tubbo: Zadrel: so first of all, did you try using awesome_nested_set
[20:27:15] bmulholland: It's pretty baked in now
[20:27:27] tubbo: Zadrel: and second of all, the "top-level" Category is just a Category with a father_id of NULL
[20:27:45] Coldblackice: has joined #RubyOnRails
[20:27:50] tubbo: understand why? it's a category with no parent, that is implicitly a top-level category.
[20:28:17] nettoweb: has joined #RubyOnRails
[20:28:19] Zadrel: tubbo: first, sry, no, i forgot the name of the gem while i was slammin :p. and second yes :)
[20:28:54] tubbo: Zadrel: i'd definitely use that because who wants to bullshit around with writing a nested set implementation when one already exists?
[20:29:07] Zadrel: tubbo: but only the categories with father id!=null are related to each other in this case;
[20:29:10] tubbo: Zadrel: you don't need a model to represent the collection
[20:29:16] eoy_: has joined #RubyOnRails
[20:29:31] leafac: has joined #RubyOnRails
[20:29:32] tubbo: Zadrel: yeah, the item in a nested set can't be the item that it is nested under, that is a validation with awesome_nested_set.
[20:29:33] Zadrel: tubbo: ok, i'll try the gem, sry and ty
[20:29:35] tubbo: you don't even have to think about it
[20:29:38] tubbo: no worries
[20:29:58] tubbo: Zadrel: just trying to help you get back to the app you're really making, and not reinventing nested sets ;)
[20:30:30] delianides: has joined #RubyOnRails
[20:32:29] kalusn: has joined #RubyOnRails
[20:34:17] bendangelo: has joined #RubyOnRails
[20:35:45] paulcsmith: has joined #RubyOnRails
[20:36:18] Synthead: can I require a gem and do {}.to_query outside of a rails script/console?
[20:36:20] DigitallyBorn: has joined #RubyOnRails
[20:36:43] Zadrel: tubbo: i went to rubygems.org to check the dependencies and seems like activerecord<4.0.0 isn't supported. and mine is 3.2.13. can't upgrade becouse of my agency limitations so this gem is nogo
[20:37:26] garrypolley_: has joined #RubyOnRails
[20:38:12] tubbo: Zadrel: however, i'd like to bring to your attention https://github.com/collectiveidea/awesome_nested_set/releases/tag/v1.2.0
[20:38:15] Lytol: has joined #RubyOnRails
[20:38:26] tubbo: how is it that awesome_nested_set wrote a rubygem for a version of rails that wouldn't be released for another 3 years? :)
[20:38:27] skkeeper: has joined #RubyOnRails
[20:39:09] pipework: tubbo: They've got some next-level prestidigitation going on.
[20:39:26] rhizome: gold-star spelling
[20:39:51] Zadrel: tubbo: sry, didn't see the "show all 23 versions" wrote in the rubygems.org
[20:40:11] commondream: has joined #RubyOnRails
[20:40:27] tubbo: Zadrel: so now it's up to you to compare gem versions and go back in the github repo to see what the latest gem version that supports rails 3.2.x was
[20:41:06] Zadrel: tubbo: i know, ty for your attention
[20:42:30] dr_watson: has joined #RubyOnRails
[20:42:34] sinkensabe: has joined #RubyOnRails
[20:44:36] rhizome: from the readme, anything in v2 is rails 3
[20:44:49] shuber_: has joined #RubyOnRails
[20:47:15] asheinfeld: has joined #RubyOnRails
[20:47:18] cac: has joined #RubyOnRails
[20:49:45] SalexW: has joined #RubyOnRails
[20:55:29] commondream: has joined #RubyOnRails
[20:55:43] erich: has joined #RubyOnRails
[20:56:05] codezomb: has joined #RubyOnRails
[20:58:43] _blizzy_: has joined #RubyOnRails
[20:59:00] TheNet: has joined #RubyOnRails
[20:59:01] ghr: has joined #RubyOnRails
[20:59:13] mello: has joined #RubyOnRails
[20:59:15] erich: has joined #RubyOnRails
[21:00:18] paulcsmith: has joined #RubyOnRails
[21:00:25] thebatu1: has joined #RubyOnRails
[21:00:41] erich: has joined #RubyOnRails
[21:02:46] edgarjs: has joined #RubyOnRails
[21:03:07] doublemalt__: has joined #RubyOnRails
[21:03:23] MartinElvar: has joined #RubyOnRails
[21:03:53] alyyy: has joined #RubyOnRails
[21:05:29] tfittsy: has joined #RubyOnRails
[21:05:36] dllama: has joined #RubyOnRails
[21:05:39] garrypolley: has joined #RubyOnRails
[21:06:32] DEA7TH: has joined #RubyOnRails
[21:07:23] Frem: has joined #RubyOnRails
[21:08:03] sinkensabe: has joined #RubyOnRails
[21:08:56] garrypolley: has joined #RubyOnRails
[21:11:15] nettoweb: has joined #RubyOnRails
[21:11:47] Lytol: has joined #RubyOnRails
[21:13:06] kadoppe: has joined #RubyOnRails
[21:14:21] cece: has joined #RubyOnRails
[21:15:57] cece: has joined #RubyOnRails
[21:16:52] baweaver: has joined #RubyOnRails
[21:17:07] delianides: has joined #RubyOnRails
[21:17:10] TheNet: has joined #RubyOnRails
[21:17:47] delianides: has joined #RubyOnRails
[21:17:51] workmad3: has joined #RubyOnRails
[21:18:25] juanda: has joined #RubyOnRails
[21:18:41] devsigner: has joined #RubyOnRails
[21:18:50] maz-dev: has joined #RubyOnRails
[21:19:22] Scripore: has joined #RubyOnRails
[21:20:11] devsigner: has joined #RubyOnRails
[21:20:16] smathy: Synthead, yes: require 'active_support/core_ext/object/to_query'
[21:20:43] Synthead: smathy: wow, thanks!
[21:20:57] smathy: Synthead, you're welcome :)
[21:21:24] DoctorMonocular: has joined #RubyOnRails
[21:22:14] barnex: Hmm, I'm having an issue with select in a nested form??? It always has one option as 'selected', when I change the options and save the form it's ok in the database???
[21:22:25] barnex: <%= fp.select(:permission, options_for_select(Permission.list_all_with_translation()), {:selected => :option}, class: "form-control")%>
[21:22:47] barnex: This is the select, and permission.permission is ActiveRecord::Enum
[21:23:07] ur5us: has joined #RubyOnRails
[21:23:18] rhizome: any reason not to use collection_select?
[21:23:35] barnex: rhizome: well, how would I do that?
[21:23:58] barnex: virtual field that translates the enum value to my language, and then use the field?
[21:24:19] barnex: I could try that I guess.
[21:24:36] smathy: barnex, take out `options_for_select` - you don't need that, `select()` understands the list itself.
[21:25:08] smathy: barnex, if you use options_for_select() then you need to put the selected value in there, that's what's generating the <option> tags.
[21:25:42] barnex: smathy: thanks, you were right that it's not needed, but it's still not working correctly
[21:26:08] barnex: aaand I took out the 'selected' option and it's fine
[21:26:51] smathy: barnex, y/w
[21:27:03] devsigner: has joined #RubyOnRails
[21:27:06] mello: has joined #RubyOnRails
[21:27:50] Synthead: if I have ParentModel and ChildModel related via belongs_to/has_many, and ParentModel uses :that_child_model as its attribute, how can I tell what model ParentModel.that_child_model is referencing?
[21:27:51] fxgallego: has joined #RubyOnRails
[21:28:15] edgarjs: has joined #RubyOnRails
[21:28:22] commondream: has joined #RubyOnRails
[21:29:21] x-light: has joined #RubyOnRails
[21:29:44] bmalum: has joined #RubyOnRails
[21:30:25] asteros: has joined #RubyOnRails
[21:30:50] asteros: has joined #RubyOnRails
[21:31:47] workmad3: has joined #RubyOnRails
[21:31:48] smathy: Synthead, "as its attribute" makes no sense, :that_child_model is either an attribute, or it's an association.
[21:32:18] smathy: Synthead, !gist might make this easier to understand
[21:32:18] helpa: Synthead: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[21:32:47] Scripore: has joined #RubyOnRails
[21:33:56] Synthead: helpa: http://pastie.org/10214348
[21:34:08] doublemalt_: has joined #RubyOnRails
[21:34:24] smathy: Synthead, using the actual symbol?
[21:34:33] dseitz: has joined #RubyOnRails
[21:34:34] Synthead: smathy: yeah, just the symbol
[21:34:36] smathy: Synthead, like you have: some_variable = :that_child_model ?
[21:35:01] Synthead: smathy: more or less
[21:35:20] smathy: Synthead, parent_instance.send var_with_that_symbol_in_it
[21:35:48] gambl0re: has joined #RubyOnRails
[21:35:53] smathy: Synthead, better be sure you know where that var came from though.
[21:36:26] Synthead: smathy: can I do this on the model itself and not an instance?
[21:36:27] smathy: Ie. don't have: parent_instance.send params[:someone_just_set_this_to_delete]
[21:36:42] sarink_: has joined #RubyOnRails
[21:36:53] Synthead: smathy: yeah, I'm kind of thinking something like ParentModel.reflections or what not
[21:36:55] smathy: Synthead, "the model itself" is an instance of the model btw, but no - how could you call it on the class?
[21:37:22] smathy: Synthead, what's your real question here?
[21:37:25] Synthead: smathy: yeah, that's what I mean: the class
[21:37:35] smathy: You want a list of all children that have parents or something?
[21:38:06] smathy: Oh, wait.
[21:38:12] smathy: You want to know the class of the associated?
[21:38:16] smathy: *association
[21:38:50] Synthead: smathy: I'm allowing users to pass AR-like where clauses to an API, and I'm thumbing through the .attribute_names and .reflect_on_all_associations to ensure that the attributes are valid
[21:39:29] Synthead: smathy: so this would be a way to check the related model to ensure that the params are safe
[21:39:59] smathy: Synthead, ParentModel.reflect_on_association(:that_child_model).klass
[21:40:06] GnuYawk: has joined #RubyOnRails
[21:40:18] Synthead: smathy: I was doing .classify.constantize on the name, but I realize that it doesn't work on renamed attributes
[21:41:07] qwertme: has joined #RubyOnRails
[21:41:22] Synthead: smathy: aaahhhh, there we go, that works great :)
[21:41:26] Synthead: smathy: thanks a lot!
[21:41:36] smathy: Synthead, you're welcome.
[21:42:45] devsigner: has joined #RubyOnRails
[21:42:49] Etriaph: Anyone know of a gem for the asset path that will only include assets for application and the controller handling the request?
[21:43:38] Etriaph: Example: application.js, accounts.coffee
[21:44:16] commondream: has joined #RubyOnRails
[21:45:43] momomomomo: has joined #RubyOnRails
[21:46:19] eggoez: has joined #RubyOnRails
[21:50:16] Etriaph: Ah, found something, nvm
[21:51:23] mary5030_: has joined #RubyOnRails
[21:51:37] Voxxit: has joined #RubyOnRails
[21:52:16] allcentury: has joined #RubyOnRails
[21:53:59] Scripore: has joined #RubyOnRails
[21:56:02] bronson: has joined #RubyOnRails
[21:58:41] ghr: has joined #RubyOnRails
[21:58:51] stevednd: has joined #RubyOnRails
[21:58:55] moretti_: has joined #RubyOnRails
[21:59:05] bronson: has joined #RubyOnRails
[21:59:40] moretti_: has joined #RubyOnRails
[22:01:08] b0nn1e: has joined #RubyOnRails
[22:01:29] garrypolley: has joined #RubyOnRails
[22:02:28] Lytol: has joined #RubyOnRails
[22:02:42] moretti: has joined #RubyOnRails
[22:06:10] steven: has joined #RubyOnRails
[22:06:27] smathy: Watch out for turbolinks.
[22:08:35] krz: has joined #RubyOnRails
[22:08:40] zeknox: has joined #RubyOnRails
[22:09:21] zeknox: hey fellas, im leveraging the trumbowy_rails gem, all works great, except for when i deploy into production mode the icons in the navbar go missing, any idea what i can do to get assets from this gem to serve up properly?
[22:09:37] one_zero: has joined #RubyOnRails
[22:12:35] smathy: zeknox, do you have the vendor/assets/images in your repo/deploy?
[22:12:46] asteros: has joined #RubyOnRails
[22:13:05] stevednd: has joined #RubyOnRails
[22:13:30] zeknox: smathy: no, i have a vendor/assets/ but no images folder in there
[22:13:42] smathy: zeknox, sounds like your problem then.
[22:13:55] zeknox: smathy: do i just need to create the folder, or actually move images into it?
[22:14:11] Ainieco: has joined #RubyOnRails
[22:14:13] dllama: guys, still having issues with serializers :( anytime i specify a serializer ot use, it keep throwing errors of undefined method 'id' for #???..relation
[22:14:14] smathy: zeknox, https://github.com/TikiTDO/trumbowyg_rails says to copy various things into those vendor/assets folders.
[22:14:51] zeknox: smathy: yes it does, but it says to do that for upgrade purposes
[22:14:57] dllama: anyone have any experience with that?
[22:15:04] Ainieco: what kind of class documentation comment is a best practice to put on your models?
[22:15:20] smathy: zeknox, oh right, the gem has two icons already: https://github.com/TikiTDO/trumbowyg_rails/tree/master/vendor/assets/images/trumbowyg/images
[22:15:26] smathy: zeknox, so, which icons are missing in production?
[22:15:44] zeknox: smathy: every icon on the navbar
[22:15:52] axl_: has joined #RubyOnRails
[22:15:56] smathy: Ainieco, # I don't need no stinkin' comments!
[22:16:06] smathy: zeknox, pick one, and give me an example URL.
[22:16:30] shuber_: has joined #RubyOnRails
[22:16:34] zeknox: smathy: screenshot: https://github.com/TikiTDO/trumbowyg_rails/issues/2
[22:17:19] smathy: zeknox, see, I'm looking at https://github.com/Alex-D/Trumbowyg/tree/master/src/ui/images and there are a lot more icons in there than in https://github.com/TikiTDO/trumbowyg_rails/tree/master/vendor/assets/images/trumbowyg/images - so I'm confused how the gem is working.
[22:17:54] zeknox: smathy: yes, you bring up a very good point
[22:18:23] smathy: zeknox, much fewer in https://github.com/Alex-D/Trumbowyg/tree/e6cdc17a8c3ee341e724153ecb3da2bd9c845060/src/ui/images which is the change that the gem's README says it's tracking.
[22:19:11] zeknox: smathy: ah, i c what your throwing down
[22:21:21] zeknox: smathy: is it worth trying to follow the upgrade procedure by moving the files into vendor/assets ?
[22:21:57] smathy: zeknox, not sure what option you're comparing it to.
[22:22:25] Duckily: has joined #RubyOnRails
[22:22:54] zeknox: smathy: icons show up fine in dev mode, so its gotta be missing a folder for compilation?
[22:23:09] Duckily: whats the best way to dynamically count assocations (no using counter cache)
[22:23:32] Duckily: i need to do it dynamically because i want to only count assocations in a certain time period
[22:23:55] smathy: zeknox, maybe, or maybe in dev you've installed the npm and tainted your env somehow.
[22:24:16] zeknox: smathy: nah, didn't install npm or any of that jazz
[22:24:51] smathy: Duckily, not sure what "count associations" means, like you have: has_many :foos and you want to know how many foos there are? bar.foos.count
[22:25:14] smathy: zeknox, so what URL is one of those icons at in your dev?
[22:25:30] Duckily: smathy: exactly but doing so on an index page of bars without creating an n+1 query for foos
[22:25:47] davidhq: has joined #RubyOnRails
[22:27:35] smathy: Duckily, Foo.group(:bar_id).count
[22:28:28] Duckily: smathy: that will give you one count
[22:28:47] Duckily: Organization.joins(' LEFT OUTER JOIN orders ON orders.organization_id = organizations.id).select(???organizations.*, COUNT(*) AS orders_count').group(???organizations.id')
[22:28:51] zeknox: smathy: icon url in dev mode: http://imgur.com/pv7Tmq5
[22:28:54] Duckily: im thinking it will have to be something like that
[22:29:31] smathy: Duckily, maybe you should try it before asserting that it doesn't work.
[22:30:23] smathy: zeknox, that's CSS, I asked for one of the icons.
[22:30:46] zeknox: smathy: there is no link to any of the icons in dev mode, let me give you an example
[22:31:03] smathy: zeknox, how are they being displayed if there's no link to them?
[22:31:30] Duckily: smathy: heh thats pretty neat, didn???t know you could do that
[22:31:49] Duckily: smathy: doesn???t exactly solve the issue though, i still need a list of bar objects
[22:32:05] Duckily: with where clauses on them
[22:32:08] kropotkin__: has joined #RubyOnRails
[22:32:54] smathy: Duckily, so, ahem, add the where before the group.
[22:32:58] zeknox: smathy: looks like they are being applied via css classes and the css is attaching the images
[22:33:32] zeknox: smathy: here is what the html looks like when in inspect an icon http://imgur.com/zP1VXND
[22:33:34] Duckily: smathy: how do i get bar objects returned though? this seems to only be returning a hash of values
[22:34:00] smathy: Duckily, you just get your Bars normally, then do that query for the count of foos on each bar.
[22:34:01] shuber_: has joined #RubyOnRails
[22:34:08] smathy: Duckily, two queries, not n+1
[22:34:14] smathy: ...just 1+1
[22:34:56] Duckily: so i would iterate through both arrays simultaneously to populate a table?
[22:35:11] smathy: zeknox, right, so dig in, find out where those images are, are they base64 URIs in the CSS? Or does the CSS point to a URL?
[22:35:24] zeknox: smathy: http://localhost:3000/assets/trumbowyg/images/icons.png
[22:35:48] Synthead: In this (http://pastie.org/10214419) example, why does :that_child_model have an issue when :child_model doesn't?
[22:36:08] smathy: Duckily, well what's returned by the group is a hash, so you'd just do like: "Count = #{your_hash[the_bar.id]}"
[22:37:02] roolo: has joined #RubyOnRails
[22:37:36] Duckily: hmm, do you think thats a better approach than doing a join?
[22:38:03] smathy: zeknox, right, so that maps to the path in the gem, you're saying that even that image doesn't work in production?
[22:38:15] smathy: zeknox, eg. if you request that same path on your production host you get a 404?
[22:38:46] Duckily: Organization.where(???name ILIKE ????, params[:search]).joins(' LEFT OUTER JOIN orders ON orders.organization_id = organizations.id AND orders.created_at < ????, 30.days.ago).select(???organizations.*, COUNT(*) AS orders_count').group('employees.id')
[22:39:03] smathy: Duckily, I think it's much clearer - yes. I'd say it'll be about the same in execution time.
[22:39:15] Duckily: i need conditions on both bars and foos
[22:39:39] Duckily: i like your approach better, but how would i do that?
[22:40:14] Duckily: so i only want to count orders with a specific datetime and i only want organizations that match a search query and other clauses
[22:40:18] Duckily: for instance, limit
[22:40:23] zeknox: smathy: in production it looks like this is my url and im getting a 200 ok http://localhost:3000/assets/images/icons.png
[22:40:46] smathy: Duckily, well, you'd have to join back anyway for those conditions, so you may as well join from organizations to employees as you have it.
[22:41:11] zeknox: zeknox: but if I try to browse that location with the browser I get a 404 file not found
[22:41:15] twilling: has joined #RubyOnRails
[22:41:18] smathy: Duckily, in your original question I hadn't realized you wanted to use conditions on the "Bar" (ie. Organization) table.
[22:41:49] smathy: zeknox, wait a second, what do you mean "in production .... localhost:3000" ?
[22:41:50] Duckily: smathy: ah i should have mentioned that, the table is a list of organizations so it needs pagination and stuff
[22:42:07] zeknox: smathy: well sure, im testing locally here on my laptop right now, rails s -e production
[22:42:11] Duckily: smathy: i really like your approach though and will keep it in mind thanks
[22:44:14] commondream: has joined #RubyOnRails
[22:44:16] weaksauce: has joined #RubyOnRails
[22:44:26] steven: has joined #RubyOnRails
[22:45:24] moretti: has joined #RubyOnRails
[22:45:38] smathy: Duckily, np.
[22:46:26] smathy: zeknox, so in future, when you do that, don't describe it as "in production".
[22:46:32] jenrzzz: has joined #RubyOnRails
[22:46:49] smathy: zeknox, say, "on my dev box in the production environment" or "production mode" or something which makes it clear that actually, the app isn't in production.
[22:47:01] lorn: has joined #RubyOnRails
[22:48:01] smathy: zeknox, Rails only serves static files/assets in development env, or when config.serve_static_files is set, see your config/environments/production.rb file.
[22:48:08] zeknox: smathy: my bad man, yes running locally here, icons work great in dev env and dont show up in prod mode because of the 404 to the images
[22:48:38] smathy: zeknox, what value do you think there is in using production mode on your dev box?
[22:49:14] zeknox: smathy: because the issue is present on the prod system, so im troubleshooting it here locally because im able to recreate the same issue, once i figure out how to compile the icons as well ill be good in prod
[22:49:19] thebatu1: has joined #RubyOnRails
[22:49:36] smathy: zeknox, there's very little value in doing it locally in `rails s` - it's nothing like what an actual prod setup will be.
[22:49:55] zeknox: smathy: understood but i've got the same issue on both environments
[22:50:50] smathy: zeknox, hopefully for very different reasons - did you run your production environment on webrick too?
[22:51:15] zeknox: smathy: no, please dont go down this path about details, ive got a specific issue because assets are not precompiling in prod mode for this gem
[22:51:30] Duckily: smathy: this doesn???t seem to be returning the orders_Count though Organization.joins('LEFT OUTER JOIN orders ON orders.organization_id = organizations.id').where('orders.created_at < ?', 30.days.ago).select('organizations.*, COUNT(*) AS orders_count').group('organizations.id')
[22:51:58] smathy: zeknox, I don't know what "down this path about details" means.
[22:52:56] Duckily: smathy: i needed to use orders.id instead of * for count
[22:53:04] Duckily: i think this should work
[22:53:15] Scriptonaut_: has joined #RubyOnRails
[22:53:15] zeknox: smathy: its an apache passenger server in production, now that i mentioned that your going to say why are you troubleshooting an issue with different variables blah blah blah
[22:55:57] qwertme: has joined #RubyOnRails
[22:56:35] davpet77: has joined #RubyOnRails
[22:58:49] shuber_: has joined #RubyOnRails
[22:59:08] ghr: has joined #RubyOnRails
[22:59:12] zeknox: smathy: getting a 404 when requesting icons.png with the following path /assets/images/icons.png in prod mode but not dev mode, any ideas why would be awesome
[23:00:20] Duckily: smathy: ok i have a little caveat i need to do the same for another model locations, (get the count) which is joined to organiizations through orders
[23:00:47] Duckily: but i don???t want to constrain orders in that join by the same conditions as the orders count
[23:02:52] SalexW: has joined #RubyOnRails
[23:03:59] smathy: zeknox, you're still asking why this is happening on your development box? I told you already, because Rails doesn't serve static files in non-development mode unless you set config.serve_static_files
[23:04:27] smathy: zeknox, ie. when Rails runs in dev mode the static files are served by the httpd NOT by rails (ie. NOT by webrick).
[23:05:06] zeknox: smathy: understood, i have set the serve_static_files to true and still have the issue in prod mode
[23:05:37] Duckily: simpler: https://gist.github.com/anonymous/46320da3ebeab418f55e
[23:05:49] DigitallyBorn: has joined #RubyOnRails
[23:05:53] ghr: has joined #RubyOnRails
[23:05:57] Duckily: will this only return locations for which their order was created in the last 30 days?
[23:06:15] zeknox: i have add this config.assets.precompile += %w(trumbowyg/*) to my application.rb and now it will precompile additional assets, but still prod mode is requesting /assets/images/icons.png and getting 404 still...grumble
[23:06:27] smathy: zeknox, right because in production mode the gem expects the icons.png to be somewhere else because it's not being served by Rails anymore.
[23:06:52] smathy: zeknox, notice that your dev mode path was /assets/trumbowyg/images/icons.png whereas your production mode path was /assets/images/icons.png (with no "trumbowyg/")
[23:07:26] zeknox: smathy: yup, i see the diffences, but how do I get some actuall images to serve up when requesting /assets/images/icons.png
[23:07:35] maz-dev: has joined #RubyOnRails
[23:07:56] zeknox: smathy: are you saying that apache should be serving these up and thats why im not seeing it here locally with webrick?
[23:07:59] smathy: zeknox, because in production the assets should be moved into `public/assets/images` by the assets:precompile task.
[23:08:30] kayloos: has joined #RubyOnRails
[23:08:40] commondream: has joined #RubyOnRails
[23:08:51] zeknox: smathy: sure, i ran assets:precompile rake task obviously but have no public/assets/images folder
[23:09:40] powersurge: getting "`<' for nil:NilClass" when I call '2017-08'.to_date
[23:09:51] powersurge: guess '2017-08' is not a format #to_date likes?
[23:10:05] rhizome: that's not a date, it's a string
[23:10:30] bricker: it's not a date format
[23:10:37] powersurge: oh, I see, I misunderstood what #to_date did, I suppose
[23:11:07] powersurge: I'll just do it the ever so slightly more manual way
[23:11:15] jenrzzz: has joined #RubyOnRails
[23:11:19] bricker: powersurge: it just passes the string into Date.parse()
[23:11:20] Scripore: has joined #RubyOnRails
[23:11:30] bricker: so if Date.parse() can't parse it then .to_date() won't
[23:11:34] dllama: ok, i'm raelly losing it with this serializer stuff , most of today has been spent on it :(
[23:12:33] dllama: i just created a new rails-api app, with nothing in it, (except used same db as actual app tahat i'm working on), point ot the serializer and immediatley get undefined method 'id' for activerecord relation
[23:14:12] m0r0n: has joined #RubyOnRails
[23:14:13] cnk: dllama: how can you even have an AR relation at all?
[23:14:15] dllama: it works fine in console when i do SomeSerializer.new(foo)
[23:14:18] cnk: if yoru app is empty
[23:14:20] ramirio: has joined #RubyOnRails
[23:14:29] dllama: same db as another app and i inserted a few models
[23:14:31] dllama: and 2 routes
[23:14:50] cnk: but don't you have to have a model file of some sort to even be reading the db
[23:15:20] barnex: How do I tell fields_for that's it should make nested fields?
[23:15:22] dllama: yes i craeted a few models
[23:15:26] cnk: or does the rails-api stuff do even more instrospectin that the regular rails
[23:15:45] dllama: i just dont even know what to do anytmore
[23:15:47] dllama: this is insane
[23:15:57] barnex: When I have fields_for as a method called on form builder it knows right away, but I need to add some fields with js templates
[23:16:04] barnex: and those get wrong names
[23:16:27] barnex: leading to incorrect params string, leading to everything not working
[23:16:32] dllama: are there any known issues with AMS 0.10 & rails 4.2.1 ?
[23:17:07] rhizome: isn't there an issues page on the AMS github?
[23:17:20] Rubie: has joined #RubyOnRails
[23:18:53] dllama: looked through there, didn't find what i was looking ofr
[23:19:12] Radar: dllama: Perhaps file a new issue with steps to reproduce?
[23:19:28] Radar: dllama: Complaining about it without providing information for others to help you isn't going to get the problem solved
[23:19:38] Radar: If you can isolate it down to a test app, others can look at it and investigate with you
[23:21:14] davidhq: has joined #RubyOnRails
[23:21:25] barnex: I'm doing: <% fields_for :role, @permission do |f| %> and I'd expect fields for the @permission which is nested in the :role model
[23:22:06] barnex: But I'm getting something like this instead: "role"=>{"name"=>"leszcze", "permission"=>"read_reports", "id"=>"", "_destroy"=>"0"}
[23:22:23] Radar: barnex: Show us the fields_for within the context of the full form please
[23:22:59] dllama: Radar: thats exactly what i'm trying to do, which is why i started a new test app, only thing i'm thinking is that there could be a missing value somehwere in my model, or something sort of association could be skewed, though it should be with this new app as i've removed all associations and only have 2 models. I noticed when i first started using AMS that unless all of the associated models had serializers as well, it would error, h
[23:24:47] barnex: Radar: https://gist.github.com/barnaba/78e5b0e78885040b07d1
[23:25:17] skiz: has joined #RubyOnRails
[23:25:42] barnex: What I'm trying to accomplish here is to add new nested fields for the roles form with js template (first file)
[23:27:52] m0r0n: has joined #RubyOnRails
[23:28:34] yaymukund: has joined #RubyOnRails
[23:29:57] barnex: basically I'm trying to do the equivalent of this (from apidock): person_form.fields_for :projects, @active_projects do |project_fields|
[23:30:03] barnex: without having to define the person_form
[23:30:10] barnex: since I already have it on the page
[23:30:45] Vendella: has joined #RubyOnRails
[23:30:58] djbkd: has joined #RubyOnRails
[23:31:02] stevednd: has joined #RubyOnRails
[23:31:04] Scripore: has joined #RubyOnRails
[23:35:28] smathy: zeknox, the gem was broken: https://github.com/TikiTDO/trumbowyg_rails/pull/3
[23:35:30] mikecmpbll: has joined #RubyOnRails
[23:36:45] bronson: has joined #RubyOnRails
[23:37:59] asheinfeld: has joined #RubyOnRails
[23:42:53] baweaver: has joined #RubyOnRails
[23:43:38] moretti: has joined #RubyOnRails
[23:46:07] zorak8: has joined #RubyOnRails
[23:46:27] yaymukund: has joined #RubyOnRails
[23:47:06] zeknox: smathy: MOTHER OF GOD!
[23:47:35] smathy: zeknox, yeah, it's just not been updated for the new asset pipeline stuff (newish really, it's been a while).
[23:48:08] pyface: has joined #RubyOnRails
[23:49:56] zeknox: smathy: where can I wire the beer money?
[23:50:22] smathy: zeknox, heh :) You're welcome man.
[23:50:30] asteros: has joined #RubyOnRails
[23:52:01] zorak8: has joined #RubyOnRails
[23:52:14] zeknox: smathy: whats the best way to test, point the Gemfile to your repo / fork ?
[23:52:42] smathy: zeknox, yeah, that'll work.
[23:53:03] Scripore: has joined #RubyOnRails
[23:53:25] zeknox: smathy: what docs would you recomend to learn about gem structure and how to write my own?
[23:53:58] assembledbits: has joined #RubyOnRails
[23:54:45] assembledbits: Hey guys.. I have a project that has a "PagesController" with @pages and page for it's variables. Can those be renamed to Categories/Category without any significant problem?
[23:55:12] philcrissman: zeknox: http://guides.rubygems.org/ and/or http://howistart.org/posts/ruby/1
[23:55:48] RegulationD: has joined #RubyOnRails
[23:57:42] zeknox: philcrissman: thanks bro
[23:58:47] ProLoser: has joined #RubyOnRails
[23:59:26] ghr: has joined #RubyOnRails