« Back to channel list

#RubyOnRails - 08 March 2016

« Back 1 day Forward 1 day »
[00:01:04] _Tariq: has joined #RubyOnRails
[00:02:19] enitiz: has joined #RubyOnRails
[00:06:33] ensyde__: has joined #RubyOnRails
[00:09:02] pvertenten: has joined #RubyOnRails
[00:09:06] andatche: has joined #RubyOnRails
[00:11:26] snowy: has joined #RubyOnRails
[00:11:47] uglybandersnatch: has joined #RubyOnRails
[00:12:43] fpedroso: has joined #RubyOnRails
[00:12:48] ModusPwnens: has joined #RubyOnRails
[00:13:01] ModusPwnens: Has anyone been able to get poltergeist/capybara to scroll to the bottom of the page?
[00:13:45] banister: has joined #RubyOnRails
[00:15:00] mivv: has joined #RubyOnRails
[00:15:31] mivv: Anyone familiar enough with Resque Mailer to help me out? I have it working with the Devise mailers but can't get it working with custom mailers, yet
[00:15:58] Ropeney: has joined #RubyOnRails
[00:16:14] ebbflowgo: has joined #RubyOnRails
[00:16:21] mivv: https://gist.github.com/mvarrieur/f8520d2a79657f3e86e2 here's what I have so far for the custom one
[00:17:20] rubyonrailed: has joined #RubyOnRails
[00:18:49] bronson: has joined #RubyOnRails
[00:19:27] rickmasta: has joined #RubyOnRails
[00:20:55] kies: has joined #RubyOnRails
[00:25:07] makerop: has joined #RubyOnRails
[00:25:32] cnk: ModusPwnens: I vaguely think you may have to execute some JS in your test to make the browser scroll down
[00:25:49] cnk: but can't really recall and don't think I have example code to look for it
[00:26:16] makerop: has joined #RubyOnRails
[00:27:59] flashpoint9: has joined #RubyOnRails
[00:30:33] axl_: has joined #RubyOnRails
[00:33:09] uglybandersnatch: has joined #RubyOnRails
[00:33:23] bronson: has joined #RubyOnRails
[00:34:23] baweaver: has joined #RubyOnRails
[00:37:02] ModusPwnens: cnk: Yeah, i know. I'm trying that but it's not working properly. I'm printing screenshots and the viewport doesn't seem to change either.
[00:37:39] cnk: even if you sleep to give it time ?
[00:37:59] ModusPwnens: cnk: sleeping doesn't help. However, printing a screenshot does, for some strange reason
[00:38:02] creature: has joined #RubyOnRails
[00:38:02] creature: has joined #RubyOnRails
[00:38:40] cnk: that is odd - and annoying
[00:38:52] AntiSpamMeta: has joined #RubyOnRails
[00:38:55] baweaver: Not sure how in the world this one happened. So it appears that we had merge conflicts on the db/schema at some point and branch migrations made it into the master db/schema or certain ones were lost in the aether. How would one hunt down orphaned migrations like that?
[00:39:13] baweaver: Nasty piece of work for sure, still looking through git branches for anything with a migration in it...
[00:39:36] baweaver: also, would GUID be recommended over Date timestamps for migrations?
[00:41:24] uglybandersnatch: has joined #RubyOnRails
[00:41:58] cnk: baweaver: so do you have a database with the schema you actually want?
[00:42:19] baweaver: dump the schema from there?
[00:42:35] baweaver: would like to, but I need the migrations to match up
[00:42:36] cnk: if so you could do a schema dump and compare with the dump you get from a clean db + migrations - and then just make the migrations that would match
[00:42:49] baweaver: yeah, which'll be a trip for sure.
[00:43:03] baweaver: but still, possible is better than hopelessly broken.
[00:43:34] cnk: Right - and for most things, code is just to support the greater god of correct data so, bow to the db and move on
[00:43:57] Kryptonical: has joined #RubyOnRails
[00:44:17] dalbusch1t: has joined #RubyOnRails
[00:44:35] DLSteve: has joined #RubyOnRails
[00:45:08] _Tariq: has joined #RubyOnRails
[00:46:49] LowTemplar: has left #RubyOnRails: ("Leaving")
[00:47:50] Krypt: has joined #RubyOnRails
[00:48:04] delgiudices: has joined #RubyOnRails
[00:49:00] Synthead: has joined #RubyOnRails
[00:49:00] Kryptonical: has joined #RubyOnRails
[00:52:04] pawnbox: has joined #RubyOnRails
[00:52:42] lemur: has joined #RubyOnRails
[00:53:02] lyoshajapan: has joined #RubyOnRails
[00:54:33] Devalo: has joined #RubyOnRails
[00:56:36] josephkokenge: has joined #RubyOnRails
[00:56:48] sevenseacat: has joined #RubyOnRails
[00:56:49] lyoshaja_: has joined #RubyOnRails
[00:58:55] robbyoconnor: has joined #RubyOnRails
[00:59:37] ModusPwnens: I'm seriously at my wit's end here. I'm trying to get poltergeist to scroll to the bottom of the page so I can test infinite scrolling, but nothing works unless I take a screenshot after the execute_script command. Anyone have any experience with this?
[01:01:32] gbgdev: has joined #RubyOnRails
[01:02:57] ivanskie_work_: has joined #RubyOnRails
[01:09:04] bronson: ModusPwnens: yeah, headless stuff is always a little weird.
[01:09:12] bronson: can you just trigger the event manually?
[01:09:51] boontdustie: has joined #RubyOnRails
[01:10:08] n008f4g_: has joined #RubyOnRails
[01:11:26] boontdustie: has joined #RubyOnRails
[01:16:14] alphaatom: has joined #RubyOnRails
[01:16:25] RegulationD: has joined #RubyOnRails
[01:19:20] baweaver: has joined #RubyOnRails
[01:19:30] Synthead: has joined #RubyOnRails
[01:19:43] dandaman: has joined #RubyOnRails
[01:20:23] lyoshajapan: has joined #RubyOnRails
[01:21:03] timdotrb: has joined #RubyOnRails
[01:21:37] ModusPwnens: bronson: Actually, i figured out the problem.
[01:21:45] bronson: oh good, what was it?
[01:23:30] ModusPwnens: bronson: It's because I needed more 'expect' calls to wait for things. I only had an expect for the original page load as well as the elements that I was waiting to be inserted on the page.
[01:23:48] bronson: ah, that makes sense. glad it was easy.
[01:24:04] ModusPwnens: bronson: However, on page load, I'm populating a hidden div with prefetched results that I insert into the DOM when the user scrolls to the bottom, and I was not waiting for that to happen
[01:24:23] ModusPwnens: bronson: so the headless browser was scrolling to the bottom of the page before there was anything ready to actually append to the list of items.
[01:30:11] cnk: ModusPwnens: Ahh so in a way your test was giving you the right answer - just not your expected answer
[01:31:48] ModusPwnens: cnk: Yep. It was doing exactly what it was supposed to. My assumptions were wrong. If I only had a dollar for every time that happened...
[01:36:42] arBmind: has joined #RubyOnRails
[01:38:31] Mia: has joined #RubyOnRails
[01:38:31] Mia: has joined #RubyOnRails
[01:40:50] Depili: has joined #RubyOnRails
[01:41:18] Rodya_: has joined #RubyOnRails
[01:41:50] pawnbox: has joined #RubyOnRails
[01:48:04] zave: has joined #RubyOnRails
[01:48:08] statelesscode: has joined #RubyOnRails
[01:48:18] ebbflowgo: has joined #RubyOnRails
[01:54:09] jenrzzz: has joined #RubyOnRails
[02:01:17] greghoggard: has joined #RubyOnRails
[02:01:35] polyidus: has joined #RubyOnRails
[02:03:49] bronson: has joined #RubyOnRails
[02:06:04] Surt_Q: has joined #RubyOnRails
[02:06:23] DoubleMalt: has joined #RubyOnRails
[02:08:41] DoctorMonocular: has joined #RubyOnRails
[02:09:36] flashpoint9: has joined #RubyOnRails
[02:11:55] flashpoint9: has joined #RubyOnRails
[02:12:44] greghoggard: Hi, im having a little trouble with one of my controllers in my rails app. I recently upgraded from 3.2 to 4.0 and everything seems to be working fine except for when I try edit or destroy a record in my database. For some reason the app is now assigning the name as the id and the controller is not able to find the corresponding record
[02:12:47] makerops: has joined #RubyOnRails
[02:12:49] greghoggard: any help greatly appreciat
[02:15:19] bronson: greghoggard: you could try manipulating your models from the console.
[02:15:22] greghoggard: https://gist.github.com/anonymous/628817be243d38ea7d06
[02:15:29] greghoggard: sorry forgot to post the gist
[02:15:40] trosborn: has joined #RubyOnRails
[02:16:02] bronson: greghoggard: um... isn't that the whole point of friendly_id?
[02:16:27] sevenseacat: I'd be looking closely at friendly_id
[02:16:45] sevenseacat: as it appears to not be doing what you expect
[02:17:17] boontdustie: has joined #RubyOnRails
[02:17:36] havenwood: disagreeable_id
[02:18:45] tjbiddle: has joined #RubyOnRails
[02:18:46] makerops: greghoggard, did you resave the record?
[02:20:46] greghoggard: NoMethodError at /parents
[02:20:46] greghoggard: undefined method `each' for #<ActiveRecord::QueryMethods::WhereChain:0x007fbce8518900>
[02:20:48] greghoggard: i also forgot that it wont let me save new records.
[02:21:02] greghoggard: - @parents.each do |parent|
[02:21:02] greghoggard: = content_tag_for :li, parent do
[02:21:06] greghoggard: %h4= link_to parent.name, parent_path(parent)
[02:21:08] greghoggard: %h6= link_to "Click for more information", parent_path(parent)
[02:21:14] sevenseacat: !gist don't spam the channel!
[02:21:14] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[02:21:52] tjbiddle: Anyone here using DatabaseCleaner and seeding their database prior? It seems to work; and isn't re-seeding every time (I believe so at least - as grabbing the last record of some seeded models always has the same ID) - but it's insanely slow! https://gist.github.com/thomasbiddle/626c1e458d2bd1ce132a
[02:22:10] tjbiddle: I just don't see why it'd be so slow apart from maybe an extra 5 seconds on the initial load - but every individual test is running slower
[02:22:52] tjbiddle: @greghoggard How are you getting @parents? Unfamiliar with WhereChain
[02:23:09] sevenseacat: http://sevenseacat.net/2015/02/01/use_database_cleaners_deletion_strategy.html seems relevant
[02:23:27] greghoggard: they are defined in my parents controller
[02:24:17] techsethi: has joined #RubyOnRails
[02:24:38] bonhoeffer: has joined #RubyOnRails
[02:24:53] DoctorMonocular: has joined #RubyOnRails
[02:25:04] tjbiddle: greghoggard: Yes, but how
[02:26:17] baweaver: has joined #RubyOnRails
[02:26:20] tjbiddle: @greghoggard http://stackoverflow.com/questions/29887829/how-to-convert-activerecordquerymethodswherechain-to-activerecord-relation
[02:26:26] greghoggard: i changed the find(:all) to where() because i saw a deprecation notice and that ruined it
[02:26:37] tjbiddle: WhereChain doesn't have an each method - you want relation. So however you're getting @parents should be changed
[02:26:43] greghoggard: thank you @tjbiddle
[02:26:55] greghoggard: that makes sense
[02:26:58] sevenseacat: well to be fair find(:all) fell out of fashion about five years ago
[02:27:00] greghoggard: thank you again
[02:27:16] greghoggard: what should i replace find(:all) with?
[02:27:18] sevenseacat: actually, longer now
[02:27:37] Radar: greghoggard: "all"
[02:27:43] sevenseacat: either `all` or nothing
[02:27:47] sevenseacat: depending on the rest of the line
[02:27:53] Radar: Yeah, depends on the ... I'll let sevenseacat talk
[02:28:09] tjbiddle: sevenseacat: No luck =\ Still insanely slow
[02:28:21] boontdustie: has joined #RubyOnRails
[02:28:22] sevenseacat: tjbiddle: define "insanely slow"
[02:28:46] norc_: has joined #RubyOnRails
[02:30:03] tjbiddle: sevenseacat: Just running my models (Which are the lightest part of my test suite, very short currently and about 1/8th of the test count as well) - With seeds: 41 seconds, without: 1.11seconds
[02:30:16] sevenseacat: so the seeds are the slow part, not the db cleaner?
[02:30:31] tjbiddle: sevenseacat: Correct - But I don't know why. Shouldn't it only add to the initial first few seconds?
[02:30:38] tjbiddle: If I run them by hand it probably takes 3 seconds to load
[02:30:41] Radar: Are you running the seeds per test?
[02:30:48] tjbiddle: @Radar before(:suite)
[02:30:53] tjbiddle: https://gist.github.com/thomasbiddle/626c1e458d2bd1ce132a
[02:31:03] sevenseacat: so whats in these seeds?
[02:31:16] sevenseacat: because it apparently takes 40 seconds
[02:31:17] tjbiddle: sevenseacat: Loading 216 records of a single model, that has one column
[02:31:28] pawnbox: has joined #RubyOnRails
[02:31:35] tjbiddle: sevenseacat: rake db:seed 2.94s user 0.81s system 95% cpu 3.912 total
[02:32:01] tjbiddle: sevenseacat: Because I have other records that use them as a relation; I can't think of another design that would do better
[02:32:05] Radar: tjbiddle: anything standing out in test.log? Like long queries?
[02:32:41] matthewd: tjbiddle: Time when running a single test?
[02:33:00] rattatmatt: has joined #RubyOnRails
[02:33:38] tjbiddle: Okay - I think I see it
[02:34:05] tjbiddle: When I create a certain record, I have it create 2 records for each of this other model that's referenced
[02:34:25] tjbiddle: I'll see what I can do to optimize it; so guess the seeds and dbcleaner are working right - just false flag on my bad design :)
[02:34:37] tjbiddle: Thanks guys @Radar - test.log was key on that one ;)
[02:34:52] tjbiddle: Will add it to my notes; hadn't even though about logs for tests
[02:37:20] chouhoulis: has joined #RubyOnRails
[02:37:43] tjbiddle: If I could gather some design advice: I have 2 records being created when a user is created - Basically example records so the user can delete/edit or just create new ones in addition - but so that they aren't seeing an empty selection when they first start. Would there be a better way to go about this?
[02:38:44] sevenseacat: not enough info to say, for me
[02:38:49] Radar: same here
[02:39:04] dandaman: has joined #RubyOnRails
[02:40:34] Tempesta: has joined #RubyOnRails
[02:40:35] boontdustie: has joined #RubyOnRails
[02:44:45] norc-2: has joined #RubyOnRails
[02:46:19] lyoshajapan: has joined #RubyOnRails
[02:46:59] chouhoulis: has joined #RubyOnRails
[02:50:28] hnanon: has joined #RubyOnRails
[02:50:39] tjbiddle: So there are "Services" that the user can create that they say they offer. These services have a title and description. They can have as many of these as they way want. When the user is created, I create two of these automatically as a placeholder so when they go to /services they see them - and it gives them a bit of a feel for what they can do with the application.
[02:51:01] uglybandersnatch: has joined #RubyOnRails
[02:51:21] hnanon: If I have a blog post that I want to classify as article, video, audio, etc, what do you suggest as an attribute instead of "type," Category is already used for something else.
[02:53:27] baweaver: has joined #RubyOnRails
[02:53:39] boontdustie: has joined #RubyOnRails
[02:55:51] sevenseacat: tjbiddle: sounds like seed data.
[02:56:09] tjbiddle: sevenseacat: The record belongs to the user though; user's are created dynamically
[02:56:16] techsethi: has joined #RubyOnRails
[02:56:59] sevenseacat: okay, so you create two records when you create a user record
[02:57:00] tjbiddle: hnanon: Classification sounds good
[02:57:01] tjbiddle: https://www.google.com/search?q=synonym+category&gws_rd=ssl
[02:57:02] sevenseacat: whats the issue?
[02:57:09] Devalo: has joined #RubyOnRails
[02:57:27] tjbiddle: sevenseacat: I don't know if there is an issue; that's why I was asking for design advice :) Wasn't sure if that was a messy way or not
[02:57:49] tjbiddle: hnanon: Also, may be a case for polymorphic association.
[02:57:50] delgiudices: I want to render 3 products per row in a products page
[02:58:08] delgiudices: I want to do something like <% products.each3 do |product %>
[02:58:21] sevenseacat: delgiudices: in_groups_of might be your friend
[02:58:32] tjbiddle: delgiudices: http://railscasts.com/episodes/28-in-groups-of
[02:58:37] delgiudices: tjbiddle thanks
[02:58:51] tjbiddle: sevenseacat: Beat me to it :p
[02:58:59] hnanon: Rail is so awesome. I never knew about in_groups_of either.
[02:59:24] hnanon: It's so well thought-out.
[02:59:55] boontdustie: has joined #RubyOnRails
[03:00:25] chagel: has joined #RubyOnRails
[03:00:44] delgiudices: hnanon indeed
[03:01:11] pawnbox: has joined #RubyOnRails
[03:01:21] delgiudices: So how am i supposed to know about these kinds of stuff
[03:01:30] delgiudices: Should i read the entire documentation before developing an app?
[03:01:43] delgiudices: In order to avoid reinventing the wheel
[03:01:44] jottr: has joined #RubyOnRails
[03:02:06] DmitryBochkarev: has joined #RubyOnRails
[03:02:24] tjbiddle: delgiudices: I didn't know about in-groups-of until you asked
[03:02:29] tjbiddle: Took me about 10 seconds to Google
[03:02:40] delgiudices: i tried googling and didn't find
[03:02:45] delgiudices: So how did yo ugoogle it
[03:02:48] tjbiddle: Just need to know the right kinds of keywords
[03:03:08] delgiudices: Yes so how did you google it
[03:03:29] tjbiddle: delgiudices: https://www.google.com/search?q=rails+each+3&gws_rd=ssl was my first one https://www.google.com/search?q=rails+each+in+groups+of&gws_rd=ssl was my second
[03:03:33] sevenseacat: there's no shame in asking people if you can't find things in google
[03:03:36] tjbiddle: Both of which lead me to in-groups-of
[03:03:42] tjbiddle: Yeah, no shame
[03:03:52] rattatmatt: has joined #RubyOnRails
[03:03:59] sevenseacat: I probably only knew about it becuase I've seen someone ask the question before
[03:04:00] tjbiddle: I'm just saying - You don't need to read the entire documentation (Although totally useful if you spend extra time on it)
[03:04:00] boontdustie: has joined #RubyOnRails
[03:04:04] delgiudices: Yeah i know i just want to improve my googling skills
[03:04:13] delgiudices: But you actually googled in groups of
[03:04:33] tjbiddle: delgiudices: Got lucky on that one that it matches
[03:04:40] tjbiddle: You said 3 per page - my immediate thought was a group
[03:04:48] tjbiddle: Couldn't think of another word
[03:04:49] tjbiddle: Let's try collection
[03:05:12] _Tariq: has joined #RubyOnRails
[03:05:33] sevenseacat: there is shame in asking people if you can't be bothered to google first (IMO), but that's not the case here
[03:05:35] tjbiddle: delgiudices: https://www.google.com/search?q=rails+each+collection&gws_rd=ssl#q=rails+each+collection+at+a+time lead me to it
[03:05:51] westoque: has joined #RubyOnRails
[03:06:11] tjbiddle: Yeah - definitely no harm in asking. Just in your googling try to think of different ways to phrase a question. A lot of the time my first few attempts are terrible wording, but then I'll learn of some terminology along the way
[03:06:19] tjbiddle: And then I'll throw that in the search - and then winnner
[03:06:29] delgiudices: http://stackoverflow.com/questions/2851915/rails-each-loop-insert-tag-every-6-items
[03:06:33] DoctorMonocular: has joined #RubyOnRails
[03:06:39] rubyonrailed: has joined #RubyOnRails
[03:06:39] tjbiddle: Makes it a lot harder if you don't know what to ask; so you have to learn that along the way
[03:06:56] delgiudices: Thanks tjbiddle :)
[03:07:11] tjbiddle: Plenty of times I can't find anything and ask in here :)
[03:09:03] quazimodo: has joined #RubyOnRails
[03:09:46] flashpoint9: has joined #RubyOnRails
[03:11:14] IFrank00: has joined #RubyOnRails
[03:12:18] neilfse: has joined #RubyOnRails
[03:15:35] Surt_Q: has joined #RubyOnRails
[03:17:06] norc_: has joined #RubyOnRails
[03:17:20] jottr: Hi all. Could there be a valid reason to declare `has_many :foo` more than once in a model?
[03:18:30] DoctorMonocular: has joined #RubyOnRails
[03:18:41] jottr: sevenseacat: That's what I thought. I was reading someone else's code and was scratching my head over the possible reasons...
[03:19:08] sevenseacat: I believe the second would just overwrite the first.
[03:19:17] Limix: has joined #RubyOnRails
[03:19:17] sevenseacat: but to be honest that's not something I've ever seen.
[03:19:27] HalcyonicStorm: has joined #RubyOnRails
[03:19:48] boontdustie: has joined #RubyOnRails
[03:19:48] zave: has joined #RubyOnRails
[03:21:14] zarubin: has joined #RubyOnRails
[03:23:43] treaki_: has joined #RubyOnRails
[03:26:08] dandaman: has joined #RubyOnRails
[03:27:24] Radar: jottr: might've been left over from a merge conflict.
[03:27:32] Radar: jottr: `git blame` one of the two lines
[03:27:44] alex88: has joined #RubyOnRails
[03:27:49] jottr: Radar: Ah, that might be the reason.
[03:29:01] Radar: If it's the codebase that I'm working on then I would `git blame` and go back through the history and then end up finding a commit with a message like "derp"
[03:29:07] Radar: Ah, legacy.
[03:30:17] AntiSpamMeta: has joined #RubyOnRails
[03:31:22] Arcaire: http://www.commitlogsfromlastnight.com/
[03:31:34] sevenseacat: lol ive seen that
[03:32:13] smoitra: has joined #RubyOnRails
[03:32:22] sevenseacat: https://www.dropbox.com/s/fdyxwvam0k34tsl/errororor.png
[03:32:27] sevenseacat: from an actual project i worked on
[03:32:33] sevenseacat: (not my commits)
[03:32:47] Arcaire: >this will surely fix it
[03:32:49] Arcaire: famous last words
[03:33:07] Arcaire: now rails won't even start and ruby appears to have been removed from ~/.rubies
[03:34:01] sevenseacat: > only get first event result because fuck heroku
[03:34:07] sevenseacat: amen, mcrundo, amen
[03:37:04] tjbiddle: 😂 That's why my personal commits look like - But I always merge --squash before submitting the real thing ;)
[03:37:17] SteenJobs: has joined #RubyOnRails
[03:37:33] jottr: So, I have this annoyingly slow query, which takes ~60 seconds to complete, generating a timeout on heroku. I've been trying to improve it, by adding includes() to the query. That improved the query a little bit: https://git.io/vaepv
[03:38:36] ivanskie: has joined #RubyOnRails
[03:38:57] Arcaire: ... How big is your DB?
[03:39:09] Arcaire: Alternatively: What breed of hamster are you using to power the CPU?
[03:39:58] adavia: has joined #RubyOnRails
[03:40:50] adavia: is there any alternative to remotipart?
[03:41:26] jottr: Here's some more info on the queries: https://git.io/vaveM
[03:42:05] Graphettion: has joined #RubyOnRails
[03:42:28] Pazician: has joined #RubyOnRails
[03:42:43] lyoshajapan: has joined #RubyOnRails
[03:43:00] jottr: Wish.find(43).users is especially slow, since it iterates over all the users. I have no hunch how I could improve the query speed. Maybe someone in here has a few pointers?
[03:43:21] sevenseacat: iterating seems bad
[03:44:27] sevenseacat: does wish 43 have 2538 users or just one?
[03:44:37] sevenseacat: are you actually rendering a json feed for 2538 users?
[03:44:52] jottr: to all the above
[03:45:22] Sigma00: jottr: sounds like you're missing indexes on your table
[03:45:27] sevenseacat: I think you might want something like Wish.includes(users: [:chances, :payments]).find(43)
[03:45:36] sevenseacat: payment sorry, not payment
[03:45:58] sevenseacat: oh right I missed the .first in the second query
[03:46:06] Arcaire: Have you tried just
[03:46:15] Arcaire: But for real I'm with Sigma00 here.
[03:46:22] sneakerhax: has joined #RubyOnRails
[03:46:56] sevenseacat: nah try the includes like i listed above, it looks like theyre being done at the wrong part
[03:48:22] chipotle: has joined #RubyOnRails
[03:49:36] jottr: Ok. Let me try changing the includes.
[03:50:44] krz: has joined #RubyOnRails
[03:51:22] pawnbox: has joined #RubyOnRails
[03:53:35] rubyonrailed: has joined #RubyOnRails
[03:54:04] jayp: has joined #RubyOnRails
[03:56:55] jottr: sevenseacat: Hm. I'm a bit unsure where I should place order(avatar: :desc) , as is done in the original query: https://git.io/vaepv
[03:57:22] sevenseacat: where it is there is fine
[03:57:38] sevenseacat: you'll still need to call the .users.order(avatar: :desc)
[03:59:08] rubyonrailed: has joined #RubyOnRails
[03:59:31] dandaman: has joined #RubyOnRails
[04:02:06] jottr: sevenseacat: Ok. I'm seeing a significant improvement: 26790.3ms Sadly still too slow for heroku...
[04:02:15] treaki_: has joined #RubyOnRails
[04:02:24] sevenseacat: what queries are being run now?
[04:03:25] sevenseacat: to be honest, it should be doing something like Chances.where(user_id: [array of 2500 IDs]) which is *never* going to be fast, but indexing might help now
[04:04:58] duncannz: has joined #RubyOnRails
[04:06:05] jottr: Hm. Bullet claims that I have another N+1 query. Let me test that first...
[04:06:15] Rodya_: has joined #RubyOnRails
[04:07:25] n1lo: has joined #RubyOnRails
[04:08:29] CBX: has joined #RubyOnRails
[04:09:17] chagel: has joined #RubyOnRails
[04:10:22] DoubleMalt: has joined #RubyOnRails
[04:11:55] stardiviner: has joined #RubyOnRails
[04:13:07] djbkd: has joined #RubyOnRails
[04:15:29] pawnbox: has joined #RubyOnRails
[04:15:32] braincrash: has joined #RubyOnRails
[04:15:54] Rodya_: has joined #RubyOnRails
[04:17:42] lyoshajapan: has joined #RubyOnRails
[04:17:52] jottr: Ok, adding :wishes to the includes statement made it worse...
[04:18:27] jottr: sevenseacat: Here's the complete trace of the query https://gist.github.com/jottr/4ce19cf6eae0d3a5ebf0
[04:19:12] sevenseacat: so its doing the eager loading... but then not using it
[04:19:13] jottr: ^ Wish.includes(users: [:chances, :payment]).find(params[:id]).users.order(avatar: :desc) is the query I now use in the controller.
[04:19:15] boontdustie: has joined #RubyOnRails
[04:19:36] lyoshajapan: has joined #RubyOnRails
[04:19:48] ace05: has joined #RubyOnRails
[04:20:10] matthewd: jottr: Do you have a custom as_json in play?
[04:21:19] jottr: matthewd: Nope. That method is not used anywhere in the app.
[04:21:29] lyoshajapan: has joined #RubyOnRails
[04:21:55] matthewd: Then why is chances getting called at all?
[04:22:50] dandaman: has joined #RubyOnRails
[04:23:18] lyoshajapan: has joined #RubyOnRails
[04:23:22] lyoshaja_: has joined #RubyOnRails
[04:23:26] tjbiddle: has joined #RubyOnRails
[04:24:17] mines999: has joined #RubyOnRails
[04:24:37] jottr: matthewd: I have no clue...
[04:25:37] matthewd: .. are you *using* the chances data in the response?
[04:28:06] zave: has joined #RubyOnRails
[04:28:19] pawnbox: has joined #RubyOnRails
[04:28:24] techsethi: has joined #RubyOnRails
[04:28:29] rubyonrailed: has joined #RubyOnRails
[04:29:03] sevenseacat: matthewd will know more about this than I do, all I know is that its very easy to eager load data and then have AR decide that no, it wants to refetch it all instead :sparkles:
[04:30:12] jottr: matthewd: I am not sure tbh. I'm still trying to grasp what the app is actually doing...
[04:30:14] polyidus: has joined #RubyOnRails
[04:31:00] jottr: What it is doing seems to not necessarily correlate with what it should be doing...
[04:31:05] matthewd: The danger there is normally some more subtle spelling of Model.includes(:foo).load.order(:bar).each -- order gives you a new relation, so bye-bye loaded data
[04:31:30] sevenseacat: I think thats exactly whats happened
[04:31:31] matthewd: Or similar-but-differently, Model.includes(:foo).each {|m| m.foo.where(true) }
[04:31:40] sevenseacat: jottr: wanted to eager load users, and then order them also
[04:31:55] matthewd: Should be fine as long as the load doesn't happen early
[04:32:32] sevenseacat: oh so maybe order(users: [:avatar]).users instead of users.order(:avatar) ?
[04:32:38] matthewd: jottr: No to_json methods defined?
[04:33:01] Radar: just use mongo
[04:33:04] Radar: :trollface:
[04:33:14] matthewd: Nah, it looks fine as written afaics
[04:33:36] sevenseacat: Radar: now you have 99 problems
[04:33:44] matthewd: jottr: Does bullet tell you where the N+1 call is happening?
[04:33:55] matthewd: sevenseacat: But soon you'll have 0, so it all balances out
[04:34:01] Radar: sevenseacat: my mongodb backed IRC client has told me that you sent me a message, but it has forgotten what it was.
[04:34:04] sevenseacat: i'll also have 0 data... related? <_<
[04:34:08] Eswar: has joined #RubyOnRails
[04:34:20] Radar: Now it's claiming you sent me 3 messages
[04:34:26] Radar: But on my other computer it's telling me 1 message
[04:35:26] jottr: matthewd: No to_json method defined. Here's what bullet complains about: https://gist.github.com/jottr/eb73c1793f0239135ee9
[04:35:59] jottr: I've tried with Wish.includes(users: [:chances, :payment, :wishes]).find(params[:id]).users.order(avatar: :desc)
[04:36:08] jottr: ...which made it even slower.
[04:36:23] matthewd: Am I completely misremembering the default AR#to_json behaviour? I thought it included attributes but not associations
[04:37:00] sevenseacat: I don't think I've ever used the default behaviour, so i have no idea
[04:38:09] matthewd: If it automatically included associations, you'd get a big infinitely recursive mess, surely
[04:38:56] matthewd: jottr: Can you please `User.first.to_json` in a console?
[04:39:29] treaki__: has joined #RubyOnRails
[04:39:53] nicnilov: has joined #RubyOnRails
[04:40:36] tjbiddle: has joined #RubyOnRails
[04:41:21] jottr: Arcaire: https://gist.github.com/jottr/f07ac1c21a8a020c453c
[04:42:18] jottr: sorry. wrong nick. ^ matthewd
[04:42:47] matthewd: Okay, so no chances in there
[04:43:53] matthewd: Something must be getting involved in the JSONification
[04:44:15] qejk: has joined #RubyOnRails
[04:45:38] Megamos: has joined #RubyOnRails
[04:46:33] krz: has joined #RubyOnRails
[04:48:00] jottr: Could some serializer be the culprit?
[04:48:47] matthewd: If there is "some serializer" involved, then yes, that seems very likely
[04:49:12] Macaveli: has joined #RubyOnRails
[04:50:12] jottr: matthewd: https://github.com/jottr/meingrundeinkommen/blob/develop/app/serializers/user_serializer.rb
[04:50:43] jottr: There seem to be a whole bunch of them: https://github.com/jottr/meingrundeinkommen/tree/develop/app/serializers
[04:51:26] matthewd: Yeah, so https://github.com/jottr/meingrundeinkommen/blob/develop/app/serializers/user_serializer.rb#L30 is an instance of the second bad example I showed
[04:52:02] matthewd: The order breaks the includes, because we can't apply the order to the already-loaded-at-that-point data; we have no choice but to re-query
[04:52:32] djellemah: has joined #RubyOnRails
[04:52:49] matthewd: Oh, but it'll be taking the else path
[04:54:00] josephkokenge: has joined #RubyOnRails
[04:58:44] Devalo: has joined #RubyOnRails
[04:59:01] jottr: Hm. When I look at the db query, it is also loading State and Tandem. I really don't get why this is all showing up in the query.
[05:00:04] jottr: matthewd: snip: https://gist.github.com/jottr/f9066f9344ee74fdd5fd
[05:01:40] jottr: ...and even more: https://gist.github.com/jottr/f9066f9344ee74fdd5fd
[05:03:07] rafaelfranca: has joined #RubyOnRails
[05:06:00] jottr: ACTION headdesks
[05:07:52] sp1rs: has joined #RubyOnRails
[05:12:29] jottr: Hm. What else could I do? Move the query task to a worker maybe?
[05:13:59] rafaelfranca: has joined #RubyOnRails
[05:16:31] baweaver: has joined #RubyOnRails
[05:16:43] _Tariq: has joined #RubyOnRails
[05:17:57] RegulationD: has joined #RubyOnRails
[05:18:15] statelesscode: has joined #RubyOnRails
[05:19:28] ace05: has joined #RubyOnRails
[05:21:55] Eswar: has joined #RubyOnRails
[05:22:42] krz: has joined #RubyOnRails
[05:22:54] techsethi: has joined #RubyOnRails
[05:23:21] chagel: has joined #RubyOnRails
[05:28:04] hashtd: has joined #RubyOnRails
[05:28:21] DmitryBochkarev: has joined #RubyOnRails
[05:30:18] lxsameer: has joined #RubyOnRails
[05:35:04] kp666: has joined #RubyOnRails
[05:36:37] darkxploit: has joined #RubyOnRails
[05:37:07] techsethi: has joined #RubyOnRails
[05:42:10] scoot: has joined #RubyOnRails
[05:43:48] Pazician: has joined #RubyOnRails
[05:44:28] arup_r: has joined #RubyOnRails
[05:45:02] timdotrb: has joined #RubyOnRails
[05:46:16] mines999: has joined #RubyOnRails
[05:48:05] djbkd: has joined #RubyOnRails
[05:48:42] rubyonrailed: has joined #RubyOnRails
[05:50:40] moeabdol3: has joined #RubyOnRails
[05:50:46] Eswar: has joined #RubyOnRails
[05:50:59] quazimodo: has joined #RubyOnRails
[05:51:15] tetraktys: has joined #RubyOnRails
[05:51:57] IFrank00: has joined #RubyOnRails
[05:53:27] tjbiddle: Is there a way to inject arguments into all ActiveRecord calls? #last #find #where, etc? I have ClassB and ClassC inheriting from ClassA which is an ActiveRecord model. I want to ensure if I call .all() etc. on B or C that it includes some_attribute: a
[05:53:32] tjbiddle: Unless I'm just going about this the wrong way anyways
[05:53:45] tjbiddle: Without overriding all methods - is there a way *
[05:54:38] arup_r: tjbiddle: is your model a STI set up?
[05:54:44] tjbiddle: arup_r: Yes
[05:54:53] tjbiddle: ClassB and ClassC both refer to ClassA's table
[05:55:23] arup_r: ok. so B.all will take all A records, for which type is "A".. that's it. All attributes are there..
[05:55:40] arup_r: the records are filtered by type..
[05:56:04] arup_r: so now what wrong you see in this outcome ?
[05:56:07] tjbiddle: arup_r: Doesn't seem to be doing that. When you say type - is that a specific attribute?
[05:56:26] arup_r: without that column, STI is incomplete
[05:56:26] tjbiddle: I'm doing STI incorrectly then - Will check
[05:56:35] arup_r: tjbiddle: yes, you are
[05:56:59] arup_r: tjbiddle: http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html read
[05:57:06] arup_r: you will see what is `type`
[05:57:20] arup_r: Active Record allows inheritance by storing the name of the class in a column that by default is named “type” (can be changed by overwriting Base.inheritance_column). This means that an inheritance looking like this:
[05:57:54] crankharder: has joined #RubyOnRails
[05:58:13] tjbiddle: arup_r: That's funny. I originally had "type" in my table completely by coincidence; and I was wondering why it was saving as the Class name. So I changed it to something else. I had the idea of doing STI without actually reading about it heh, only knew the name since I've seen it come up a few times in the past half hour of googling
[05:58:17] tjbiddle: Perfec tthen, thanks!
[05:58:25] Chagel_: has joined #RubyOnRails
[05:59:06] Sawbones: has joined #RubyOnRails
[05:59:07] arup_r: sevenseacat: hi.. good morning.
[05:59:16] sevenseacat: arup_r: howdy.
[05:59:50] arup_r: fixing merge conflicts this morning,,, and they are so huge..! haha
[06:01:48] nicnilov: has joined #RubyOnRails
[06:01:54] abhi_rsd: has joined #RubyOnRails
[06:02:24] Palsson: has joined #RubyOnRails
[06:05:23] roshanavand: has joined #RubyOnRails
[06:08:03] chagel: has joined #RubyOnRails
[06:12:25] Devalo: has joined #RubyOnRails
[06:15:36] chagel: has joined #RubyOnRails
[06:16:32] codelahoma: has joined #RubyOnRails
[06:16:50] Radar: Should've merged more often ;)
[06:18:49] mines999: has joined #RubyOnRails
[06:19:30] darutoko: has joined #RubyOnRails
[06:20:37] chagel: has joined #RubyOnRails
[06:25:37] nicnilov: has joined #RubyOnRails
[06:26:55] p8m: has joined #RubyOnRails
[06:28:46] tjbiddle: has joined #RubyOnRails
[06:30:11] bronson: has joined #RubyOnRails
[06:32:01] KensoDev: has joined #RubyOnRails
[06:34:44] hashtd: has joined #RubyOnRails
[06:37:11] boontdustie: has joined #RubyOnRails
[06:38:41] pixelhandler: has joined #RubyOnRails
[06:39:07] fernandomm: has joined #RubyOnRails
[06:44:08] chagel: has joined #RubyOnRails
[06:44:50] thor_: has joined #RubyOnRails
[06:47:12] dede: has joined #RubyOnRails
[06:49:14] jstransky: has joined #RubyOnRails
[06:49:35] ace05: has joined #RubyOnRails
[06:51:47] solars: has joined #RubyOnRails
[06:51:55] sp1rs: has joined #RubyOnRails
[06:53:56] rvanlieshout: has joined #RubyOnRails
[06:54:25] dandaman: has joined #RubyOnRails
[06:55:36] TinkerTyper: has joined #RubyOnRails
[06:56:46] Sawbones: has joined #RubyOnRails
[06:57:16] pawnbox: has joined #RubyOnRails
[07:00:09] ayoros: has joined #RubyOnRails
[07:01:31] krz: has joined #RubyOnRails
[07:03:21] crdpink2: has joined #RubyOnRails
[07:04:55] TinkerTyper: has joined #RubyOnRails
[07:05:18] aganov: has joined #RubyOnRails
[07:05:41] Kryptonical: has joined #RubyOnRails
[07:08:47] siaW: has joined #RubyOnRails
[07:09:01] tjbiddle: has joined #RubyOnRails
[07:10:08] quazimodo: has joined #RubyOnRails
[07:11:53] TinkerTyper: has joined #RubyOnRails
[07:16:57] krz: has joined #RubyOnRails
[07:17:30] jstransky: has joined #RubyOnRails
[07:18:17] sandstrom: has joined #RubyOnRails
[07:18:32] scope: has joined #RubyOnRails
[07:20:04] chagel: has joined #RubyOnRails
[07:20:13] Pazician: has joined #RubyOnRails
[07:23:01] krzkrz: has joined #RubyOnRails
[07:23:09] d0nn1e: has joined #RubyOnRails
[07:23:15] Pazician: has joined #RubyOnRails
[07:23:29] defsdoor: has joined #RubyOnRails
[07:25:09] jstransky: has joined #RubyOnRails
[07:29:15] uglybandersnatch: has joined #RubyOnRails
[07:30:08] boontdustie: has joined #RubyOnRails
[07:31:42] chagel: has joined #RubyOnRails
[07:34:39] jottr: has joined #RubyOnRails
[07:35:52] mrbubbles: has joined #RubyOnRails
[07:36:01] copperb0lt: has joined #RubyOnRails
[07:36:22] hahuang61: has joined #RubyOnRails
[07:38:56] chagel: has joined #RubyOnRails
[07:38:59] jas02: has joined #RubyOnRails
[07:42:32] arup_r: has joined #RubyOnRails
[07:46:55] Macaveli: has joined #RubyOnRails
[07:47:45] konsolebox: has joined #RubyOnRails
[07:48:54] sandstrom: has joined #RubyOnRails
[07:48:57] darkmug: has joined #RubyOnRails
[07:49:26] arup_r: has joined #RubyOnRails
[07:51:01] krzkrzkrz: has joined #RubyOnRails
[07:52:18] pawnbox: has joined #RubyOnRails
[08:01:09] arthurix: has joined #RubyOnRails
[08:02:07] uglybandersnatch: has joined #RubyOnRails
[08:05:24] jeanlinux: has joined #RubyOnRails
[08:10:14] Ergo: has joined #RubyOnRails
[08:10:29] copperb0lt: has joined #RubyOnRails
[08:11:20] dixpac_: has joined #RubyOnRails
[08:12:26] artto: has joined #RubyOnRails
[08:13:34] ayoros: has joined #RubyOnRails
[08:14:37] mrbubbles: has joined #RubyOnRails
[08:18:26] comrad: has joined #RubyOnRails
[08:21:29] dixpac__: has joined #RubyOnRails
[08:21:36] neanderslob: has joined #RubyOnRails
[08:22:03] jeanlinux: has joined #RubyOnRails
[08:23:11] ace05: has joined #RubyOnRails
[08:25:30] tvw: has joined #RubyOnRails
[08:27:26] pawnbox: has joined #RubyOnRails
[08:29:00] sandstrom: has joined #RubyOnRails
[08:29:26] arup_r: has joined #RubyOnRails
[08:30:29] copperb0lt: has joined #RubyOnRails
[08:31:39] bronson: has joined #RubyOnRails
[08:34:02] tjbiddle: I have an STI relation for 3 of my models. They're used in a cascading way, so if C has a value, then B and A are ignored. But if C does not have a value it will fall back to B, if B doesn't - then it falls to A (Which always does). I'm doing this this way: https://gist.github.com/thomasbiddle/1c6038bc6fbfc2bed400
[08:34:50] tjbiddle: However it ends up making ~5 different SELECT statements this way. Is there a pattern that would follow this already in place to get this down?
[08:35:07] rvanlieshout: in like 105% of the cases i've seen people use STI they would be better of not using it
[08:35:22] tjbiddle: rvanlieshout: It's actually cleaned up my code quite a bit
[08:35:34] rvanlieshout: you can use concerns for that
[08:36:02] gbgdev: has joined #RubyOnRails
[08:36:24] arup_r1: has joined #RubyOnRails
[08:37:41] hahuang61: has joined #RubyOnRails
[08:39:42] tjbiddle: rvanlieshout: Well, if I wasted all day moving to this, then c'est la vie haha. I'll read more up on Concerns next work day, thanks
[08:40:32] jeanlinux: has joined #RubyOnRails
[08:41:28] rvanlieshout: moving back will eventually save you more time :)
[08:42:13] tjbiddle: rvanlieshout: Hopefully :) I am checking though - I'm seeing some reasons not to use STI on one part of my app; but the one I mentioned I'm not so sure. The one mentioned above all share the exact same columns (Price & duration) and will *always* stay in sync
[08:42:30] tjbiddle: They're basically ways to scope down to more specific settings; but the settings will never have different options
[08:43:18] tjbiddle: The other thing I have definitely should be changed from STI though I think; I'll check into that later though
[08:43:34] rvanlieshout: tjbiddle: and even then, why is it bad to have multiple tables?
[08:44:22] tjbiddle: rvanlieshout: I guess needing to maintain multiple tables?
[08:45:21] electriv: has joined #RubyOnRails
[08:45:32] tjbiddle: I'll play around with it. Thanks for reminding me of Concerns :)
[08:47:32] rvanlieshout: :) do that! maintaining multiple tables is way way way easier then STI
[08:48:02] alfie_max15: has joined #RubyOnRails
[08:48:16] dixpac: has joined #RubyOnRails
[08:49:15] alfie_max15: i'm using a query like this : User.select("DISTINCT ON (email, domain, ip_address) *")
[08:49:41] alfie_max15: how should i index my fields so that this query wont be so expensive in the long run
[08:50:04] rvanlieshout: add an index for those 3 columns?
[08:50:17] rvanlieshout: also you could just make sure the set is unique using a validation
[08:50:27] rvanlieshout: and prevent double entries in the db. then you don't have to distict it on query
[08:50:50] alfie_max15: i dont want them to be uniq
[08:51:18] rvanlieshout: then why distinct them?
[08:51:18] sevenseacat: then what do you want returned? >_>
[08:51:23] alfie_max15: but i would also want to get the count and show in in the index, which is still something i dont know what to do
[08:51:36] gr3yR0n1n: has joined #RubyOnRails
[08:51:47] alfie_max15: sevenseacat, hope you get the idea
[08:51:55] rvanlieshout: the count of what?
[08:53:42] alfie_max15: there can be many users with the same email + domain + ip, so i want to list them in a table, (for which i use distinct)
[08:54:03] rvanlieshout: why would you want to list them unique if you don't want them to be unique?
[08:54:05] alfie_max15: and in the table i want a column which shows the count of that user based on email, ip, domain
[08:54:34] rvanlieshout: make a query that returns 4 values, email, domain, ip-address and count(*)
[08:54:36] rvanlieshout: User.pluck that
[08:54:36] alfie_max15: instead of showing duplicate entries i would show the count
[08:54:37] rvanlieshout: use the array
[08:55:42] alfie_max15: could you help me out with that, plucking the three fields is fine, but what about count? (no idea about that)
[08:56:23] arup_r1: alfie_max15: seems like you want group by
[08:57:11] arup_r: "there can be many users with the same email + domain + ip, so i want to list them in a table," ... if so, group by and then count the result in each group will do it..
[08:57:27] arup_r: with distinct on, you can't take the count
[08:57:48] alfie_max15: let me try that
[08:58:15] rvanlieshout: alfie_max15: User.group('email, domain, ip_address').pluck('email, domain, ip_address, COUNT(*)')
[08:58:18] tetraktys: has joined #RubyOnRails
[08:58:24] arup_r: alfie_max15: ^^
[08:58:24] rvanlieshout: don't count them in ruby
[08:58:27] rvanlieshout: that would be slow :)
[08:58:36] rvanlieshout: and, add an index on the users table for those 3 columns
[08:58:38] arup_r: ready made solution.. provided by rvanlieshout :)
[08:58:39] nocontrol: has joined #RubyOnRails
[08:59:39] arup_r: rvanlieshout: one question, why are you interested to get an Array, instead of AR wrapper object around them, as we get when we `.select`?
[08:59:54] nocontrol: I am running a simple post/create controller test with rails embedded test engine and it fails simply with "didn't change by 1" or "expected 2, got 1". Is there any chance I may get more information ? This doesn' help at all
[09:00:25] alfie_max15: rvanlieshout, yeah, having an array wont work, as i want it to be an AR object
[09:00:27] arup_r: nocontrol: yes, use a Gist, add test code and exception there
[09:00:31] finnnnnnnnnnn: has joined #RubyOnRails
[09:00:51] rvanlieshout: arup_r: because the count isn't part of the model and you just want to present a list. no need to create objects in memory for them
[09:00:51] nocontrol: arup_r: can I get a more verbose output ? I tried with --verbose but nothing changed
[09:01:28] rvanlieshout: alfie_max15: why?
[09:01:48] arup_r: because he want to iterate over in view?
[09:02:21] rvanlieshout: and you're unable to iterate over an array?
[09:02:46] johnflux: has joined #RubyOnRails
[09:02:52] arup_r: doesn't look good as it does while iterating over an AR.. hehe..
[09:03:21] rvanlieshout: it's just an .each
[09:03:22] arup_r: anyway, in this case I might use `.select` .. not liking `.pluck`.. but that's me.
[09:03:30] alfie_max15: yeah, is there a way i can get AR objects instead
[09:03:31] rvanlieshout: select makes it slower :) but hey
[09:04:01] arup_r: alfie_max15: just replace the .pluck with .select in rvanlieshout solution...
[09:04:16] yxejamir: has joined #RubyOnRails
[09:04:16] yxejamir: has joined #RubyOnRails
[09:04:35] rvanlieshout: that won't work
[09:04:36] arup_r: nothing big deal. but I appreciate the explanation of using .pluck .. thanks for that
[09:04:42] alfie_max15: yeah, i tried that
[09:04:49] rvanlieshout: then you'll have to to name them
[09:04:56] arup_r: why.. umm
[09:05:08] rvanlieshout: just use pluck
[09:05:13] pawnbox: has joined #RubyOnRails
[09:05:16] rvanlieshout: or give them a name in your select
[09:05:30] alfie_max15: give them a name in select like?
[09:05:47] arup_r: like COUNT(*) AS user_count
[09:05:54] arup_r: or some good name..
[09:06:08] arup_r: I thought Rails give it for us..
[09:06:35] mrbubbles: has joined #RubyOnRails
[09:06:41] rvanlieshout: really. why not pluck?
[09:07:04] rvanlieshout: it's faster and doesn't require that fictive attribute
[09:07:11] rvanlieshout: als your result isn't a user
[09:07:17] rvanlieshout: it's just the combination of those 3 values
[09:07:22] rvanlieshout: why threat it as a user?
[09:07:22] drptbl: has joined #RubyOnRails
[09:07:34] alfie_max15: well the real reason is that i am using active admin, and i'm trying to write my own scoped_collection
[09:07:49] alfie_max15: so it has to be a AR wrapper object
[09:08:02] arup_r: ah,, game is over.
[09:08:29] helpa: *makes a cross with fingers and says a prayer*
[09:08:46] krzkrzkrz: has joined #RubyOnRails
[09:08:46] zave: has joined #RubyOnRails
[09:09:06] alfie_max15: but what else to do if you need a admin panel in a day
[09:09:42] rvanlieshout: you might have it in a day, but spend weeks and weeks in trying to add simple stuff
[09:09:51] rvanlieshout: where if you would spend 2 days you would have something extensible
[09:09:51] wldcordeiro: has joined #RubyOnRails
[09:09:54] rvanlieshout: cause an admin panel just isn't that hard
[09:10:15] sevenseacat: lol, active admin
[09:10:24] arup_r: alfie_max15: can you show the rails console, so that I see what is not working with `.select`
[09:10:32] FooMunki: has joined #RubyOnRails
[09:10:44] alfie_max15: yeah, one sec
[09:11:30] artto: has joined #RubyOnRails
[09:11:34] gugl: has joined #RubyOnRails
[09:13:02] nerium: has joined #RubyOnRails
[09:14:33] alfie_max15: http://pastebin.com/ZEuaPHYg
[09:14:42] mark2: has joined #RubyOnRails
[09:16:01] arup_r: what you meant by not working then? not seeing any broken code tehere
[09:16:31] tetraktys: has joined #RubyOnRails
[09:16:45] alfie_max15: i was looking at the SQL query generated `SELECT COUNT(*) AS count_all, email, domain, ip_address`
[09:16:55] lipoqil: has joined #RubyOnRails
[09:16:58] alfie_max15: and used 'count_all' to display the count
[09:17:01] alfie_max15: that didn't work
[09:17:08] jsrn: has joined #RubyOnRails
[09:17:10] alfie_max15: but specifying one for myself worked
[09:18:25] sergey_makagon: has joined #RubyOnRails
[09:18:53] alfie_max15: thanks for all your help
[09:19:04] neanderslob_: has joined #RubyOnRails
[09:19:09] rvanlieshout: i would expect it to be possible if you create 1 user instance per this combination and have a custom method returning the count
[09:19:11] alfie_max15: i really have alot to learn :(
[09:19:12] rvanlieshout: but that's ugly
[09:19:14] rvanlieshout: fits active admin though :)
[09:19:34] RegulationD: has joined #RubyOnRails
[09:20:21] sp1rs: has joined #RubyOnRails
[09:21:09] malcolmva: has joined #RubyOnRails
[09:21:17] snowy: has joined #RubyOnRails
[09:25:25] srinidhi: has joined #RubyOnRails
[09:28:11] techsethi: has joined #RubyOnRails
[09:28:49] chagel: has joined #RubyOnRails
[09:31:41] sandstrom: has joined #RubyOnRails
[09:32:43] ace05: has joined #RubyOnRails
[09:36:00] techsethi: has joined #RubyOnRails
[09:38:10] ql6wlld: has joined #RubyOnRails
[09:40:21] chagel: has joined #RubyOnRails
[09:45:00] mfaeh: has joined #RubyOnRails
[09:46:04] baweaver: has joined #RubyOnRails
[09:52:52] Eswar: has joined #RubyOnRails
[09:53:35] M-shine: has joined #RubyOnRails
[09:56:50] lele: has joined #RubyOnRails
[09:57:38] ferr1: has joined #RubyOnRails
[09:57:55] uglybandersnatch: has joined #RubyOnRails
[10:00:21] snowy: has joined #RubyOnRails
[10:04:49] krzkrzkrz: has joined #RubyOnRails
[10:05:42] ace05: has joined #RubyOnRails
[10:06:19] chagel: has joined #RubyOnRails
[10:06:21] arup_r: has joined #RubyOnRails
[10:07:08] artto_: has joined #RubyOnRails
[10:10:28] marr: has joined #RubyOnRails
[10:10:47] techsethi: has joined #RubyOnRails
[10:10:53] sandstrom: has joined #RubyOnRails
[10:11:15] DaniG2k: has joined #RubyOnRails
[10:12:06] marr: has joined #RubyOnRails
[10:17:22] yardenbar: has joined #RubyOnRails
[10:18:13] lxsameer: has joined #RubyOnRails
[10:18:36] tonetank_: has joined #RubyOnRails
[10:20:38] workmad3: has joined #RubyOnRails
[10:20:58] DaniG2k: I'm having a problem with an rspec test which I cannot figure out why it's erring
[10:21:01] DaniG2k: my gist is here: https://gist.github.com/DaniG2k/d5f5a314636dd818658a
[10:21:16] DaniG2k: the error happens on the line: Failure/Error: expect(page).to have_content(article.title)
[10:21:19] blackhuey: has joined #RubyOnRails
[10:21:37] DaniG2k: i basically am trying to ensure I can find the title on the page
[10:21:39] alfie_max15: and what might be the error?
[10:21:52] arBmind: has joined #RubyOnRails
[10:21:57] DaniG2k: "Viewing article listings by month displays articles for valid month"
[10:22:10] DaniG2k: I don't know
[10:22:17] DaniG2k: I have ~80 tests that are all passing except this one
[10:22:20] finnnnnnnnnnn: has joined #RubyOnRails
[10:22:23] DaniG2k: its really odd
[10:22:38] Guest34101: has joined #RubyOnRails
[10:22:49] alfie_max15: can you provide the rspec stack trace
[10:23:20] alfie_max15: for the error i mean
[10:25:02] xardion_: has joined #RubyOnRails
[10:25:15] sevenseacat: DaniG2k: so what have you done to start debugging it
[10:25:23] DaniG2k: alfie_max15: https://gist.github.com/DaniG2k/d5f5a314636dd818658a#file-stack_trace-txt
[10:25:25] gbgdev: has joined #RubyOnRails
[10:26:18] DaniG2k: sevenseacat: I've checked my views, controller, routes...I even tested manually (from the browser) and it seems fine
[10:26:30] gbgdev: has joined #RubyOnRails
[10:26:44] sevenseacat: checked your views, controllers, routes, when running the test?
[10:26:57] sevenseacat: to see which of your assumptions is incorrect
[10:28:01] thebastl: has joined #RubyOnRails
[10:28:12] jeanlinux: has joined #RubyOnRails
[10:28:17] DaniG2k: I'll try with pry
[10:28:24] Ergo^: has joined #RubyOnRails
[10:28:36] finnnnnnnnnnn: has joined #RubyOnRails
[10:28:52] sandstrom: has joined #RubyOnRails
[10:30:01] pawnbox: has joined #RubyOnRails
[10:32:29] n008f4g_: has joined #RubyOnRails
[10:32:44] scope: has joined #RubyOnRails
[10:33:50] ql6wlld: has joined #RubyOnRails
[10:33:58] moeabdol3: has joined #RubyOnRails
[10:34:53] EdwardIII: hrm with turbolinks 5, clicking the back button in the browser seems to trigger 'turbolinks:request-start' but not any of 'turbolinks:render turbolinks:load turbolinks:request-end'?
[10:37:09] pawnbox: has joined #RubyOnRails
[10:37:20] EdwardIII: this isn't to do with turbolinks events not firing, it's because when you click 'back' the old page content includes the spinner heh hrm
[10:37:42] Wobni: has joined #RubyOnRails
[10:37:47] EdwardIII: but it doesn't seem to fire 'turbolinks:render' or ':load'
[10:38:02] matthias_: has joined #RubyOnRails
[10:38:06] EdwardIII: and they don't say there's an event for 'history.back-type-thing:end'
[10:39:35] hahuang61: has joined #RubyOnRails
[10:39:46] finnnnnnnnnnn_: has joined #RubyOnRails
[10:40:12] EdwardIII: it looks a bit like 'turoblinks:load' gets triggered before the reload of the previous page in the buffer has finished? is that possible?
[10:41:45] lxsameer: I have a broken "require" statement in a css manifest in my project, but i didn't use that manifest in my layout, but I get an sprokects::FileNotFound, is that normal ?
[10:42:17] DaniG2k: hmm there might be a bug with the by_star gem
[10:42:28] DaniG2k: regarding my previous comments about failing tests in rspec
[10:42:40] DaniG2k: because @articles.by_section(@section).by_year(year) works fine
[10:42:49] jeanlinux: has joined #RubyOnRails
[10:42:59] DaniG2k: but adding the by_month(12) returns nothing despite having a created date of December
[10:43:45] sevenseacat: so what does by_month do ?
[10:43:48] DaniG2k: im quite sure this is a bug
[10:43:56] EdwardIII: hrm this is confusing heh
[10:44:01] universa1: what does by_month(11) return
[10:44:01] EdwardIII: i've looked at pretty much every event
[10:44:10] DaniG2k: sevenseacat: by_month should just get the articles by month creation date
[10:44:24] sevenseacat: should, or does?
[10:44:25] DaniG2k: universa1 I've tried by_month with every number from 1 to 12 and they all return []
[10:44:33] EdwardIII: turbolinks:before-cache and turbolinks:render both fire when you click 'back', but $('body').remove('.spinner-wrap') does nothing on both
[10:44:54] EdwardIII: i thought if i put it in turbolinks:before-cache that would ensure no page ever gets stored with a spinner in it, but that doesn't work
[10:45:01] DaniG2k: sevenseacat: and I'm looking on github, it seems the normalization.rb for the by_star gem was updated recently
[10:45:06] DaniG2k: so this might be a bug
[10:45:18] DaniG2k: sevenseacat: https://github.com/radar/by_star/blob/master/lib/by_star/normalization.rb
[10:45:23] crdpink2: has joined #RubyOnRails
[10:45:42] sevenseacat: im not sure what that has to do with my question
[10:46:06] DaniG2k: it should, but it is not doing so
[10:46:38] sevenseacat: so what is the month of the article you've created?
[10:47:09] jenrzzz: has joined #RubyOnRails
[10:47:11] DaniG2k: sevenseacat: created_at: Wed, 12 Dec 2012 00:00:00 UTC +00:00
[10:47:22] sevenseacat: thats not a month
[10:47:23] DaniG2k: 2012-12-12
[10:47:31] Ergo: has joined #RubyOnRails
[10:47:32] sevenseacat: neither is that
[10:47:43] EdwardIII: the before-cache event seems like the perfect solution: https://github.com/turbolinks/turbolinks#preparing-the-page-to-be-cached
[10:50:18] wethu: has joined #RubyOnRails
[10:51:08] universa1: DaniG2k: look at the generated sql for by_month.
[10:52:58] mfaeh: has joined #RubyOnRails
[10:53:05] krzkrzkrz: has joined #RubyOnRails
[10:53:54] universa1: DaniG2k: Post.by_month(3, year: 2014)
[10:53:57] Eswar: has joined #RubyOnRails
[10:54:01] DaniG2k: universa1: "SELECT \"articles\".* FROM \"articles\" WHERE \"articles\".\"published\" = 't' AND \"articles\".\"section\" = 'tibet' AND (articles.created_at >= '2012-01-01 00:00:00.000000' AND articles.created_at <= '2012-12-31 23:59:59.999999') AND (articles.created_at >= '2016-12-01 00:00:00.000000' AND articles.created_at <= '2016-12-31 23:59:59.999999') ORDER BY \"articles\".\"created_at\" DESC"
[10:54:30] universa1: DaniG2k: yeah... no record can match those conditions.
[10:55:03] DaniG2k: universa1: thats interesting....Article.by_month(12, year: 2012) returns the correct result but Article.by_month(12).by_year(2012) does not
[10:55:10] universa1: DaniG2k: first is: in 2012, second is: in december 2016 ...unless you can bend space-time this seems fairly impossible to me.
[10:55:26] DaniG2k: yea deffo a bug
[10:56:15] universa1: looks more like a design decision, else you would have to pass context between by_month and by_year ...
[10:56:29] rodfersou: has joined #RubyOnRails
[10:58:53] siaW: has joined #RubyOnRails
[11:00:40] dideler: has joined #RubyOnRails
[11:01:39] nicnilov: has joined #RubyOnRails
[11:02:29] drptbl: has joined #RubyOnRails
[11:05:32] y2mq37: has joined #RubyOnRails
[11:08:09] dangerousdave: has joined #RubyOnRails
[11:09:21] n008f4g_: has joined #RubyOnRails
[11:10:32] EdwardIII: i've replicated the issue here if anyone is interested: https://github.com/EdwardIII/turbolinks-events
[11:11:39] Fernando-Basso: has joined #RubyOnRails
[11:13:11] srinidhi: has joined #RubyOnRails
[11:15:51] mines999: has joined #RubyOnRails
[11:17:06] artto: has joined #RubyOnRails
[11:20:31] chouhoulis: has joined #RubyOnRails
[11:21:49] ace05: has joined #RubyOnRails
[11:26:51] ebbflowgo: has joined #RubyOnRails
[11:31:08] c355E3B: has joined #RubyOnRails
[11:32:11] trosborn: has joined #RubyOnRails
[11:32:13] ldnunes: has joined #RubyOnRails
[11:32:48] johnflux: has joined #RubyOnRails
[11:34:06] mikeiniowa: has joined #RubyOnRails
[11:36:14] trinaldi: has joined #RubyOnRails
[11:36:42] openstruct: has joined #RubyOnRails
[11:36:49] ql6wlld: has joined #RubyOnRails
[11:38:05] crdpink2: has joined #RubyOnRails
[11:40:45] smoitra: has joined #RubyOnRails
[11:44:46] rrawlins: has joined #RubyOnRails
[11:46:41] mostlybadfly: has joined #RubyOnRails
[11:46:54] tetraktys: has joined #RubyOnRails
[11:47:09] baweaver: has joined #RubyOnRails
[11:47:37] rrawlins: Authoring a gem which I want to add callbacks into the host applications ApplicationController. What's the best way to inject callbacks like this?
[11:50:41] ebbflowgo: has joined #RubyOnRails
[11:51:39] sp1rs: has joined #RubyOnRails
[11:53:54] lxsameer: has joined #RubyOnRails
[11:57:19] moeabdol3: has joined #RubyOnRails
[11:57:46] tetraktys: has joined #RubyOnRails
[11:59:36] arup_r: has joined #RubyOnRails
[12:01:24] jeanlinux: has joined #RubyOnRails
[12:03:09] srinidhi: has joined #RubyOnRails
[12:05:36] pawnbox_: has joined #RubyOnRails
[12:06:55] dgncn: has joined #RubyOnRails
[12:07:45] DmitryBochkarev: has joined #RubyOnRails
[12:09:41] srinidhi: has joined #RubyOnRails
[12:10:42] sandstrom: has joined #RubyOnRails
[12:11:25] dgncn: has joined #RubyOnRails
[12:15:22] pawnbox: has joined #RubyOnRails
[12:15:37] delgiudices: has joined #RubyOnRails
[12:15:46] electriv: has joined #RubyOnRails
[12:16:26] banister: has joined #RubyOnRails
[12:17:12] pawnbox: has joined #RubyOnRails
[12:20:22] Macaveli: has joined #RubyOnRails
[12:21:45] chouhoulis: has joined #RubyOnRails
[12:21:59] yanix: has joined #RubyOnRails
[12:22:20] wxdk: has joined #RubyOnRails
[12:23:03] helpa: has joined #RubyOnRails
[12:25:29] jeanlinux: has joined #RubyOnRails
[12:25:45] DEA7TH: has joined #RubyOnRails
[12:32:39] n008f4g_: has joined #RubyOnRails
[12:32:49] diegoviola: has joined #RubyOnRails
[12:33:23] bronson: has joined #RubyOnRails
[12:34:21] scope: has joined #RubyOnRails
[12:35:15] snowy: has joined #RubyOnRails
[12:37:40] trinaldi: has joined #RubyOnRails
[12:38:46] jeanlinux: has joined #RubyOnRails
[12:40:19] hahuang61: has joined #RubyOnRails
[12:44:31] Fernando-Basso: has joined #RubyOnRails
[12:46:16] jsrn: has joined #RubyOnRails
[12:47:22] artto: has joined #RubyOnRails
[12:48:12] jvanbaarsen: has joined #RubyOnRails
[12:50:28] Fernando-Basso: has joined #RubyOnRails
[12:51:20] yanix: has joined #RubyOnRails
[12:56:13] jottr: has joined #RubyOnRails
[12:57:47] RegulationD: has joined #RubyOnRails
[12:58:25] ruler_: has joined #RubyOnRails
[12:59:59] ruler__: has joined #RubyOnRails
[13:03:49] rickmasta: has joined #RubyOnRails
[13:04:14] Sigfrid: has joined #RubyOnRails
[13:04:46] mfaeh: has joined #RubyOnRails
[13:05:18] moeabdol3: has joined #RubyOnRails
[13:06:40] gbgdev: has joined #RubyOnRails
[13:06:57] Sigfrid: has joined #RubyOnRails
[13:08:45] ruler_: has joined #RubyOnRails
[13:11:39] JulienITARD: has joined #RubyOnRails
[13:12:14] jottr: has joined #RubyOnRails
[13:13:20] finnnnnnnnnnn_: has joined #RubyOnRails
[13:14:30] rafaelfranca: has joined #RubyOnRails
[13:17:44] apotry: has joined #RubyOnRails
[13:18:15] arup_r: I have 2 models Event and Lead. Any kind of activities on this page, I will be saving in a table called `History`. I want to build it as a polymorphic table. But not sure, what should be good name. historyable not sounds like good.. :) Any advise.
[13:18:42] Eswar: has joined #RubyOnRails
[13:19:21] alfie_max15: thats an ok name :)
[13:19:31] alfie_max15: there's even a gem in that name
[13:19:47] _Tariq: has joined #RubyOnRails
[13:19:53] yellow5: has joined #RubyOnRails
[13:19:55] flashpoint9: has joined #RubyOnRails
[13:20:07] alfie_max15: i think it's similar to papertrail
[13:21:20] arup_r: alfie_max15: I hate gems for this. :)
[13:22:36] smoitra: has joined #RubyOnRails
[13:22:45] chouhoulis: has joined #RubyOnRails
[13:25:46] foxmask: has joined #RubyOnRails
[13:26:53] johnflux: has joined #RubyOnRails
[13:27:17] solars: has joined #RubyOnRails
[13:28:34] IFrank00: has joined #RubyOnRails
[13:28:51] ruler_: guys im just a quick question. lets say im using mongodb with rails, does the ORM behaves the same like im using postgresql?
[13:30:33] tbuehlmann: no, it does not
[13:33:14] _bogus_: can i have some help to revert migrations? I tried to use a gem but I got some errors while installing it and probably helped messing it more
[13:34:39] _bogus_: i created a new branch to install this gem, Im thinking of reverting it to the previous branch, deleting all the tables created by the gem and removing the schema_migration table's rows with migrations of this gem, is that right ?
[13:35:11] Ropeney: has joined #RubyOnRails
[13:35:31] passick: has joined #RubyOnRails
[13:35:45] theblang: has joined #RubyOnRails
[13:36:35] Spami: has joined #RubyOnRails
[13:37:50] hive-mind: has joined #RubyOnRails
[13:38:16] passick: Hi there. I am writing a small project, and I want to have a model for events, and for each event I want users to be able to upload their pictures, using Paperclip.
[13:38:24] rietta: has joined #RubyOnRails
[13:38:40] passick: How do I do that?
[13:39:24] passick: I know that I can have nested resources, but how would I be able to check that user does not change some information about the event?
[13:39:33] smoitra: has joined #RubyOnRails
[13:39:54] arup_r: has joined #RubyOnRails
[13:39:59] rrawlins: has joined #RubyOnRails
[13:40:16] rvanlieshout: passick: a nested resource just uses a single controller
[13:40:19] rvanlieshout: with an extra param
[13:40:57] artto: has joined #RubyOnRails
[13:41:51] Megamos: has joined #RubyOnRails
[13:42:04] rietta: passick, what do you mean?
[13:42:27] rietta: Specifically by “chantge some information about the event”?
[13:42:38] rietta: Sounds like access control, you can still use something like cancancan for that.
[13:42:40] Detch: has joined #RubyOnRails
[13:44:57] passick: I have two models: Event and Picture, Event has many Pictures. I also have users, and I want them to be able to upload their pictures for events. As far as I understand, when I do a nested resource, I will have to submit pictures through a form for editing the event, but wouldn’t the user then have the ability to modify the information about the event itself?
[13:45:45] rvanlieshout: passick: your nested resource assumption is wrong
[13:45:58] rvanlieshout: you should just create a controller for those pictures
[13:46:10] rvanlieshout: make it a nested resource so you can use /events/123/pictures/new over /pictures/new?event_id=123
[13:46:22] thebastl: has joined #RubyOnRails
[13:46:48] passick: And if I want to be able to upload several new pictures at once?
[13:46:55] rietta: passick, you will have a controller actian that has a event_id along with the :id of the picture (for actions other than index and create)
[13:47:20] aaronr: has joined #RubyOnRails
[13:48:00] rietta: I find it useful to include pry-rails and then throw a binding.pry in the controller create or update controller action. Then inspect the params hash to see what’s there. It becomes clear quickly what magic is going on.
[13:48:45] SteenJobs: has joined #RubyOnRails
[13:48:47] rietta: Multiple uploads is supported by HTTP, but the nicest upload interfaces always seem to use JavaScript posting AJAX.
[13:48:50] leventix_: has joined #RubyOnRails
[13:48:57] rietta: Might want to stay away from that for the first pass.
[13:49:12] passick: Rietta, ok, thank you.
[13:49:15] baweaver: has joined #RubyOnRails
[13:49:19] leventix_: has left #RubyOnRails: ()
[13:50:38] CodaBrink: has joined #RubyOnRails
[13:51:52] hive-mind: has joined #RubyOnRails
[13:54:18] alfie_max15: has joined #RubyOnRails
[13:54:25] ramortegui: has joined #RubyOnRails
[13:54:58] leventix_: has joined #RubyOnRails
[13:55:50] dstarh: has joined #RubyOnRails
[13:57:46] _bogus_: does anybody knows a good gem to manage the already existing content on the views of my app ??
[13:58:06] alfie_max15: manage existing content on view???
[13:59:10] snowy: has joined #RubyOnRails
[13:59:29] _bogus_: yeah, like if I could set portions of my view to be edited by admin
[13:59:51] _bogus_: I was searching for CMS engines but I cant find a satisfatory solution...
[13:59:52] SeanLazer: has joined #RubyOnRails
[14:02:40] _bogus_: any ideas?
[14:03:13] zworks: has joined #RubyOnRails
[14:03:49] tsujp: has joined #RubyOnRails
[14:04:58] SteenJobs: has joined #RubyOnRails
[14:05:11] zworks: I am using nokogiri to extract URLs from a set of pages, i use threads to make the process faster, but it seems like nothing happens when i run this script
[14:05:15] zworks: https://gist.github.com/haswow/d542a3b780c288837ac3
[14:07:19] drbayer: has joined #RubyOnRails
[14:07:55] johnflux: has joined #RubyOnRails
[14:09:03] arup_r: has joined #RubyOnRails
[14:10:22] c0defeed: has joined #RubyOnRails
[14:11:10] arup_r: codabrink: helo
[14:11:19] arup_r: opps! sorry
[14:11:29] arup_r: c0defeed: hello
[14:11:37] sp1rs: has joined #RubyOnRails
[14:11:47] rietta: has joined #RubyOnRails
[14:12:01] Macaveli: has joined #RubyOnRails
[14:12:41] c0defeed: I've got a 'Player' model that has two foreign keys into the same table, one for 'previous zone' and one for 'current zone'. How can I setup the belongs_to relationship on the model so that I can access each of them from my controller?
[14:13:24] arup_r: you need to mention the foreign_key: option explicitly while declaring belongs_to
[14:13:54] c0defeed: arup_r, Ok, that makes sense. Thank you.
[14:13:57] drptbl: has joined #RubyOnRails
[14:14:03] arup_r: what is the name of the foreign key columns ?
[14:14:12] c0defeed: previous_zone_id, current_zone_id
[14:14:35] dima_: has joined #RubyOnRails
[14:14:54] _bogus_: please, does anybody knows a good gem to manage the content from already existing views of my app ??
[14:14:58] arup_r: model name?
[14:15:43] c0defeed: arup_r, the model having the foreign key is 'Player', the model being referenced is 'Zone'
[14:15:46] tetraktys: has joined #RubyOnRails
[14:16:07] arup_r: ok.. then belongs_to :previuos_zone, class_name: "Zone"
[14:16:16] trinaldi: has joined #RubyOnRails
[14:16:25] arup_r: same for the other
[14:16:43] CustosLimen: has joined #RubyOnRails
[14:17:16] thebastl: has joined #RubyOnRails
[14:17:19] c0defeed: arup_r, Oh, ok. That's not what I expected it to be. Thanks
[14:19:41] c0defeed: arup_r, When you said that I needed to mention the foreign_key explicitely, my intuition was -> "belongs_to: zone, foreign_key: :previous_zone_id"
[14:19:58] arup_r: yeah, but that will not work
[14:20:10] arup_r: because last zone will override the first one
[14:20:25] arup_r: you need to have different names
[14:20:31] c0defeed: That makes sense.
[14:20:43] c0defeed: Thanks again
[14:21:04] Sigfrid: has joined #RubyOnRails
[14:21:09] bmalum: has joined #RubyOnRails
[14:23:30] chouhoulis: has joined #RubyOnRails
[14:24:20] unl0ckd: has joined #RubyOnRails
[14:25:53] nobitanobi: has joined #RubyOnRails
[14:27:09] nobitanobi: What is the suggested way of validating presence in Rails 4? `validates :field, presence: true` or `validates_presence_of :field`?
[14:28:01] arup_r: i used both...
[14:28:35] kristofferR: has joined #RubyOnRails
[14:28:42] arup_r: only one thing, is if a field has plain straight more than 1 validations, then first one I use..
[14:28:48] tbuehlmann: I always use the former
[14:30:35] n008f4g_: has joined #RubyOnRails
[14:31:15] arup_r: tbuehlmann: when you have some custom method with like `if:` and `unless:` ?
[14:31:15] rietta: has left #RubyOnRails: ()
[14:31:30] arup_r: you still use the former?
[14:31:47] rietta: has joined #RubyOnRails
[14:31:54] tbuehlmann: yes, I always use the former
[14:32:00] arup_r: oh.. nice
[14:32:07] n1lo: has joined #RubyOnRails
[14:32:17] dandaman: has joined #RubyOnRails
[14:32:24] flashpoint9: has joined #RubyOnRails
[14:34:30] tetraktys: has joined #RubyOnRails
[14:36:03] finnnnnnnnnnn: is there a way to perform an action after a property of a model updates? something like after_property_update :do_something
[14:37:29] yanix: has joined #RubyOnRails
[14:38:20] aegis3121: has joined #RubyOnRails
[14:38:33] shanemcd: has joined #RubyOnRails
[14:38:48] mary5030: has joined #RubyOnRails
[14:39:41] sp1rs: has joined #RubyOnRails
[14:39:51] sandstrom: has joined #RubyOnRails
[14:41:04] hahuang61: has joined #RubyOnRails
[14:42:20] Guest34101: has joined #RubyOnRails
[14:43:00] arup_r: finnnnnnnnnnn: some people write their own https://github.com/jch/as_callbacks_tutorial/blob/master/example.rb ..
[14:46:44] finnnnnnnnnnn: arup_r: think that’s better than using ActiveModel::Dirty
[14:47:11] leventix_: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[14:47:16] arup_r: no,, dirty much better to track it though
[14:47:31] finnnnnnnnnnn: cool, will try usng dirty then
[14:47:33] chouhoulis: has joined #RubyOnRails
[14:47:36] arup_r: but may be there will some more nicer way.. wait and watch
[14:47:51] arup_r: if, I were you, I may use the dirty
[14:49:04] c0defeed: I am working in development mode, and I have configured nginx to only allow connections into my server from my local network. How can I permit rails to let me use the rails console from my network machine?
[14:50:26] jscheel: has joined #RubyOnRails
[14:50:31] chagel: has joined #RubyOnRails
[14:52:26] delgiudices: has joined #RubyOnRails
[14:52:34] rvanlieshout: c0defeed: you start a rails console in a ssh session?
[14:52:34] artto: has joined #RubyOnRails
[14:52:38] rvanlieshout: it's not related to nginx
[14:52:44] c0defeed: has left #RubyOnRails: ("Leaving")
[14:52:50] delgiudices: I just found out that a migration suddenly changed my schema a lot
[14:52:53] c0defeed: has joined #RubyOnRails
[14:53:00] delgiudices: It added limit and precision to all fields, why did that happen?
[14:53:12] rvanlieshout: delgiudices: !debug
[14:53:12] helpa: delgiudices: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[14:53:27] rvanlieshout: including the output of your rake db:migrate
[14:53:36] c0defeed: rvanlieshout, I mean from the web browser, for situations when I hit exceptions. That said, I think I figured it out
[14:54:08] delgiudices: rvanlieshout the thing is i just found out by looking at the last commit in bitbucket
[14:54:17] workmad3: delgiudices: sounds like you recently updated rails
[14:54:26] delgiudices: Do you think it has to do with the fact that i updated from sqlite to mysql2?
[14:54:47] emilkarl: has joined #RubyOnRails
[14:55:08] workmad3: delgiudices: that could also do it... it may not be that anything actually 'changed' in your database, simply that the schema dumper picked up more details from db introspection and reflected them in schema.rb
[14:55:55] rvanlieshout: delgiudices: i don't think anything based on no information
[14:56:46] emilkarl: hi, anyone using Stripe for a subscription service? I come across this gem but it seems a bit outdated, I wonder if I would be a better choice to build something new based upon the latest Stripe API? https://github.com/andrewculver/koudoku
[14:57:19] delgiudices: workmad3 so rake db:schema:load can actually alter the schema file
[14:58:38] HalcyonicStorm: has joined #RubyOnRails
[14:58:44] workmad3: delgiudices: no... but you said it happened after running a migration, which implies you ran it
[14:58:49] workmad3: delgiudices: and that would change the schema file
[14:59:00] delgiudices: workmad3 makes sense
[14:59:02] snowy: has joined #RubyOnRails
[14:59:10] delgiudices: So why would it pick up that information after mysql and not with sqlite3
[14:59:18] workmad3: delgiudices: because it's a different database?
[14:59:21] RegulationD: has joined #RubyOnRails
[15:00:35] solars: has joined #RubyOnRails
[15:01:30] gbgdev: has joined #RubyOnRails
[15:01:50] Rodya_: has joined #RubyOnRails
[15:01:50] finnnnnnnnnnn: is attribute_changed? available in rails 4.2.5? I want to do `before_update :do_summat, if: name_changed?` in a model
[15:01:57] finnnnnnnnnnn: http://api.rubyonrails.org/classes/ActiveModel/Dirty.html#method-i-changed-3F
[15:02:19] griffindy: has joined #RubyOnRails
[15:02:47] adavia: has joined #RubyOnRails
[15:03:14] uglybandersnatch: has joined #RubyOnRails
[15:03:19] greghoggard: has joined #RubyOnRails
[15:04:35] greghoggard: Hi, i am having trouble with my app not saving a record to the database. not sure what i am doing wrong
[15:04:36] greghoggard: https://gist.github.com/anonymous/51e57ba5674f46818595
[15:05:27] arup_r: finnnnnnnnnnn: that will not work..I think
[15:05:29] rvanlieshout: greghoggard: "Couldn't find Parent with id=greg
[15:05:34] rvanlieshout: what more do you want to know? :)
[15:05:50] mag42c: has joined #RubyOnRails
[15:06:08] stannard: has joined #RubyOnRails
[15:06:10] Surt_Q: has joined #RubyOnRails
[15:06:13] acetoxy: how would one preferrably deal with sessions in an API-only app?
[15:06:41] finnnnnnnnnnn: arup_r: I was using this as a guide - http://craftingruby.com/posts/2014/01/13/callbacks-and-dirty-objects-in-rails.html
[15:06:45] greghoggard: i just dont understand why the record isnt saving?
[15:07:17] arup_r: finnnnnnnnnnn: I see..
[15:07:26] rvanlieshout: greghoggard: the error doesn't say that
[15:07:32] rvanlieshout: it also doesn't include a stack trace
[15:07:37] rvanlieshout: but please just read the error
[15:07:40] rvanlieshout: it's not even trying to save anything
[15:07:50] josephkokenge: has joined #RubyOnRails
[15:08:00] arup_r: greghoggard: show the error stack from begining..
[15:08:40] arup_r: finnnnnnnnnnn: if you try that, what happened ?
[15:09:05] finnnnnnnnnnn: arup_r undefined method `name_changed?' for #<Class:0x007ffc7e528758> (NoMethodError)
[15:09:17] greghoggard: https://gist.github.com/greghoggard/2ccca994a67a787262f6
[15:09:39] rvanlieshout: greghoggard: you're trying to find a record with id 'greg'
[15:09:41] rvanlieshout: that doesn't exist
[15:09:51] rvanlieshout: app/controllers/parents_controller.rb, line 49
[15:09:53] arup_r: before_update :do_summat, if: "name_changed?"
[15:10:01] arup_r: finnnnnnnnnnn: ^^
[15:10:32] gremly: has joined #RubyOnRails
[15:11:00] finnnnnnnnnnn: arup_r: that seems to work
[15:11:09] finnnnnnnnnnn: why do I need to quotes?
[15:11:16] ikarius: has joined #RubyOnRails
[15:11:36] hnanon: has joined #RubyOnRails
[15:11:39] arup_r: You can also use a string that will be evaluated using eval and hence needs to contain valid Ruby code. You should use this option only when the string represents a really short condition:
[15:11:51] arup_r: http://guides.rubyonrails.org/active_record_callbacks.html#using-if-and-unless-with-a-string
[15:11:53] jhass: send, not eval
[15:12:03] zave: has joined #RubyOnRails
[15:12:07] hnanon: In a cards controller I have this line: render edit_user_path(@user)
[15:12:14] arup_r: jhass: i quoted from doc.. :D
[15:12:34] hnanon: However, I'm getting the error: Missing template users/1/edit with...
[15:13:03] hnanon: I definitely have a user edit view.
[15:13:06] arup_r: I just know when to use string approach. I never went to so deep to see how it works.. haha. I should dig
[15:13:17] chouhoulis: has joined #RubyOnRails
[15:13:31] jhass: hnanon render takes an action name of the same control or a template path, it does not take a route
[15:13:41] jhass: *same controller
[15:14:00] hnanon: What's an example of a template path?
[15:14:13] SteenJobs: hnanon: try redirect_to
[15:14:17] jhass: a path relative to app/views
[15:14:28] jhass: you can also omit the extension of the file
[15:14:40] SteenJobs: unless you explicitly want to render and not redirect
[15:15:06] hnanon: SteenJobs, jhass: Thanks.
[15:15:20] SteenJobs: subtle differences, but different nonetheless
[15:15:33] jhass: not that subtle tbh
[15:17:24] SteenJobs: subtle doesn’t mean not profound
[15:17:42] arup_r: has joined #RubyOnRails
[15:18:01] SteenJobs: just for a lot of people they may mistakenly presume they do very similar things
[15:18:40] arup_r: finnnnnnnnnnn: try this also before_update :do_summat, if: :name_changed?
[15:19:31] finnnnnnnnnnn: arup_r: that works too
[15:20:00] hnanon: jhass: So I tried edit_user_card_path(@user) and I'm getting the same error. Card is a nested resource under users.
[15:20:17] SteenJobs: then you need to pass @card as well
[15:20:26] hnanon: There is no card object.
[15:20:27] SteenJobs: check rake routes and make sure you know what the route expects
[15:20:52] jhass: how is that different from.... nvm I'll bail
[15:20:53] hnanon: edit_user_card GET /users/:user_id/card/edit(.:format) cards#edit
[15:21:00] B1n4r10: has joined #RubyOnRails
[15:21:31] SteenJobs: jhass: haha don’t bail now!
[15:21:45] SteenJobs: hnanon: what’s the error, template error? did you try redirect_to?
[15:21:47] jhass: I had that fun yesterday already
[15:22:03] SteenJobs: hnanon: or did you follow jhass’ rec and change the path youre passing to render?
[15:22:16] hnanon: Template error. I followed jhass' advice.
[15:22:37] hnanon: Previously it was edit_user_path(@user)
[15:22:51] SteenJobs: hnanon: if the controller action that’s being routed to is cards#edit
[15:22:57] sp1rs: has joined #RubyOnRails
[15:23:03] SteenJobs: then you need an edit.html.erb in the cards directory
[15:23:04] n008f4g_: has joined #RubyOnRails
[15:23:15] hnanon: I have one there.
[15:23:46] SteenJobs: then i need to see more code, but humor me and use redirect_to your_path_helper
[15:24:23] jhass: and give up preserving what the user entered previously...
[15:24:58] jhass: that's typically the reason you render instead of redirect
[15:25:04] SteenJobs: but that would be in the update action
[15:25:13] SteenJobs: edit is just presenting a new edit view
[15:25:23] jhass: hnanon: you should read http://guides.rubyonrails.org/layouts_and_rendering.html
[15:25:28] jhass: lacking some basic understanding there
[15:25:33] rietta: has joined #RubyOnRails
[15:25:34] SteenJobs: generally you would “re”-render in an update/create action, not in an edit action
[15:25:34] techsethi: has joined #RubyOnRails
[15:25:47] EdwardIII: hey i don't suppose anyone else has seen this issue in turbolinks 5? https://github.com/EdwardIII/turbolinks-events#issue
[15:25:50] jhass: they never said they're inside an edit action
[15:25:57] jhass: they try to "render" an edit action
[15:26:00] arup_r: the reason is to display the data you enetered
[15:26:27] arup_r: while error
[15:26:29] SteenJobs: jhass: very valid point
[15:26:40] SteenJobs: i mistakenly read that in
[15:26:44] SteenJobs: arup_r: ha we know..
[15:27:07] arup_r: yeah, I was just adding my understand with you..
[15:27:09] jhass: no worries, hnanon has an amazing talent to not clearly present their issues without you noticing
[15:27:49] SteenJobs: hnanon: after you’ve read the very important link jhass sent, try render :edit, or really any of the various CORRECT syntax options for render
[15:28:07] SteenJobs: let us know if it still doesn’t work
[15:28:16] tetraktys: has joined #RubyOnRails
[15:29:04] SteenJobs: jhass: this is bringing up an awful memory from a few days ago while trying to override some of devise’s code when a user signup fails
[15:29:08] jhack: has joined #RubyOnRails
[15:29:19] jhass: hehe yeah
[15:29:20] hnanon: jhass: Thanks. That link was hekpful.
[15:29:26] Fly80: has joined #RubyOnRails
[15:29:33] jhass: trying to override devise always feels like reimplementing half of it
[15:29:35] hnanon: It's working now.
[15:29:48] arup_r: do we have a gem which stores all holidays across the glob ?
[15:29:54] SteenJobs: haha i know, and i never learn, and i always end up spending more time hacking it than swinging my own auth
[15:29:56] hnanon: SteenJobs: Thanks too for following through.
[15:30:09] roqo: has joined #RubyOnRails
[15:30:31] arup_r: I got one https://github.com/holidays/holidays, any more good one?
[15:30:45] SteenJobs: they have some weird jazz going on. it would render some mysterious registration#create template i couldn’t find anywhere, and i could only display my original login/signup view if i used a redirect, thus losing the user input.
[15:32:17] pawnbox: has joined #RubyOnRails
[15:33:31] pawnbox: has joined #RubyOnRails
[15:34:11] herpless: has joined #RubyOnRails
[15:36:25] tubbo: tbh i've found that most of the time, if you're overriding devise's most basic features, you probably don't want to be using devise.
[15:36:54] tubbo: and even more frequently, what you're overriding in devise is pointless anyway
[15:37:16] tubbo: BUT I WANT IT ROUTED UNDER /DICKBUTT INSTEAD OF /USERS GRR DEVISE SUCKS
[15:38:00] finnnnnnnnnnn_: has joined #RubyOnRails
[15:38:10] configged: has joined #RubyOnRails
[15:38:15] configged-: has joined #RubyOnRails
[15:38:47] delgiudices: So i have to write tests for models, controllers and features?
[15:39:00] sandstrom: has joined #RubyOnRails
[15:39:11] The_Phoenix: has joined #RubyOnRails
[15:39:19] delgiudices: Why do i have to test model if it's being tested in the controller
[15:39:31] delgiudices: And why do i have to test the controller if it's being tested in the feature
[15:39:46] SteenJobs: tubbo: haha it’s true. i wonder why i haven’t migrated away from it. more often than not you’re overriding the views, overriding the routing, and very often overriding some controller actions. so there’s not much left...
[15:40:30] tubbo: SteenJobs: see i've had the polar opposite experience, only had to ever override views.
[15:41:11] SteenJobs: tubbo: honestly part of it is really my fault. i could’ve designed things to avoid having to override any controllers by just moving some user attributes to a separate model
[15:41:25] tubbo: delgiudices: they all test different parts of the application logic. your unit tests won't catch issues with user input, your controller tests won't catch rendering problems.
[15:41:46] tubbo: delgiudices: your feature tests will be too slow and "high-level" to be of any use when the issue is deep within your models.
[15:41:52] ace05_: has joined #RubyOnRails
[15:42:13] SteenJobs: tubbo: like i wanted a user bio to be part of the user model, and since the bio was being updated with ajax, i needed to handle the response in the registrations controller. but that could’ve just been abastracted to a separate user_info table or what not
[15:42:14] ferr1: I get json response https://gist.github.com/Fercell/fda15d458532899747bc and how would I turn it into hash so I could work with entries?
[15:42:22] tubbo: SteenJobs: or a Profile :)
[15:42:28] SteenJobs: ferr1: JSON.parse
[15:42:30] tubbo: many people use the User / Profile abstraction for that
[15:43:24] SteenJobs: tubbo: yea was pretty stupid. and then as i added more bio like attributes, i just kept at it..i’m gonna migrate everything to a profile table eventually, when i get the courage to sift thru the db migrations and make sure there are no conflicts
[15:43:47] artto: has joined #RubyOnRails
[15:43:49] tubbo: SteenJobs: i thought there was a method you could override somewhere that let devise deal with more attrs though..
[15:43:51] ferr1: thanks SteenJobs
[15:44:01] SteenJobs: tubbo: yea there is
[15:44:08] gbgdev: has joined #RubyOnRails
[15:44:16] SteenJobs: but the attributes are edited in-place on the user profile
[15:44:30] SteenJobs: so it’s a JSON reeq
[15:44:56] SteenJobs: so i needed to squeeze a response into the appropriate controller action
[15:45:59] SteenJobs: tubbo: most things there are straightforward ways to customize, like updating profile w/o password, etc. but with routing, i wanted my login/signup views to be on the same page (using tabs)
[15:48:43] tubbo: well there are two solutions to that problem
[15:48:44] openstruct: has joined #RubyOnRails
[15:48:51] tubbo: #1 - just copy/paste the two forms side by side
[15:48:58] rubyonrailed: has joined #RubyOnRails
[15:48:59] tubbo: #2 - use tabs and request each form via ajax
[15:49:16] tubbo: make sure you have a means of turning off the layout on any XHR request in ApplicationController.
[15:49:39] Alejandro15: has joined #RubyOnRails
[15:49:52] Alejandro15: has left #RubyOnRails: ()
[15:49:58] baweaver: has joined #RubyOnRails
[15:50:37] SteenJobs: tubbo: even if side by side, which i did, i needed to edit the routing so that both the sessions and registrations controller pointed to the same view, and to get rid of the sessions/registration route that wasn’t being used
[15:50:55] tubbo: SteenJobs: you didn't _need_ to do that.
[15:51:56] techsethi_: has joined #RubyOnRails
[15:51:57] SteenJobs: tubbo: in what sense?
[15:52:11] mag42c: has joined #RubyOnRails
[15:54:16] solars: has joined #RubyOnRails
[15:57:37] gambl0re: has joined #RubyOnRails
[15:57:48] scope: has joined #RubyOnRails
[15:58:43] techsethi: has joined #RubyOnRails
[16:00:31] Rodya_: has joined #RubyOnRails
[16:02:24] jhack: has joined #RubyOnRails
[16:02:53] Rubie: has joined #RubyOnRails
[16:02:53] Rodya_: has joined #RubyOnRails
[16:03:49] timdotrb: has joined #RubyOnRails
[16:07:47] jayp: has joined #RubyOnRails
[16:07:55] tubbo: SteenJobs: well, why did you need to do that?
[16:08:04] tubbo: what problem does that solve?
[16:08:30] trinaldi_: has joined #RubyOnRails
[16:09:22] SteenJobs: tubbo: yea i guess i could’ve just had a few extraneous routes
[16:10:54] rafaelfr_: has joined #RubyOnRails
[16:11:11] Devalo: has joined #RubyOnRails
[16:14:52] aegis3121: has joined #RubyOnRails
[16:15:26] jayp: has left #RubyOnRails: ("Using Circe, the loveliest of all IRC clients")
[16:16:23] tubbo: there y ago
[16:16:48] tubbo: i find many people's frustrations with this kind of abstraction stems from a "need" that wasn't necessary at all
[16:17:11] tubbo: if nothing links to a route on your application, does it exist? :)
[16:18:45] boontdustie: has joined #RubyOnRails
[16:19:16] shinnya: has joined #RubyOnRails
[16:20:04] _bogus_: has joined #RubyOnRails
[16:21:45] jhack: has joined #RubyOnRails
[16:22:09] IFrank00: has joined #RubyOnRails
[16:22:34] akshat: has joined #RubyOnRails
[16:22:59] yellow5: has joined #RubyOnRails
[16:23:05] techsethi: has joined #RubyOnRails
[16:24:40] B1n4r10: has joined #RubyOnRails
[16:24:54] barajasfab: has joined #RubyOnRails
[16:26:40] Macaveli: has joined #RubyOnRails
[16:27:22] Macaveli: has joined #RubyOnRails
[16:28:16] disgrntld: has joined #RubyOnRails
[16:28:39] AzaToth: has joined #RubyOnRails
[16:31:38] ElSif: has joined #RubyOnRails
[16:33:49] pixelhandler: has joined #RubyOnRails
[16:34:42] momomomomo: has joined #RubyOnRails
[16:35:23] bronson: has joined #RubyOnRails
[16:35:36] momomomomo: Morning rubyists
[16:38:09] HalcyonicStorm: momomomomo: how rude
[16:39:41] momomomomo: HalcyonicStorm: ?
[16:41:48] hahuang61: has joined #RubyOnRails
[16:43:07] HalcyonicStorm: I don't identify as a rubyist
[16:43:11] HalcyonicStorm: even if i write it all day
[16:43:16] HalcyonicStorm: for the past few years
[16:43:23] HalcyonicStorm: ACTION might be a rubyist
[16:43:44] finnnnnnnnnnn: has joined #RubyOnRails
[16:43:50] momomomomo: I haven't written ruby in a good year or two
[16:44:49] arup_r: momomomomo: then what you are using now-a-days ?
[16:45:06] momomomomo: unfortunately, more analytics than engineering atm
[16:45:13] momomomomo: lots of etl, some API stuffs with Go
[16:45:25] arup_r: ah.. :) cool
[16:45:27] piwi: has joined #RubyOnRails
[16:45:50] siaW: has joined #RubyOnRails
[16:45:53] HalcyonicStorm: oo I've been doing Go on the side
[16:46:02] arup_r: means you touch most of the things that exist..
[16:46:16] HalcyonicStorm: go is delicious
[16:46:29] arup_r: and Elixir ? HalcyonicStorm
[16:46:29] HalcyonicStorm: I can't wait til im fully productive in it
[16:46:35] HalcyonicStorm: arup_r: I tried it
[16:46:46] HalcyonicStorm: arup_r: I have a full time job, a contracting job
[16:46:48] HalcyonicStorm: not much time left over
[16:46:51] momomomomo: Go's fun and simple, HalcyonicStorm easiest way to get proficient is to go through effective go
[16:46:55] momomomomo: and just start using it
[16:47:02] piwi: hi. i'm quite new to rails and i try to change the default interpreter of the rails-latex gem. where do i need to place the command so that i gets executed at the start?
[16:47:12] momomomomo: tbh though, you do have to write a lot of sql for APIs, so that's a common complaint
[16:47:17] HalcyonicStorm: momomomomo: yessir, I'm converting one of my existing ruby/sinatra services to Golang
[16:47:41] arup_r: nice nice
[16:48:13] HalcyonicStorm: arup_r: I'll give elixir another go sometime in teh future
[16:48:35] HalcyonicStorm: i love that you go deploys w/ an executable
[16:48:36] momomomomo: Radar: is all about it, I've played with Erlang, but never really dug into elixir
[16:48:43] arup_r: Me here only stuck in ruby/rails.. haha
[16:48:51] momomomomo: HalcyonicStorm: yeah, but the BEAMvm is incredible
[16:49:07] momomomomo: arup_r: nothing wrong with that
[16:49:07] HalcyonicStorm: i belive it but im spread a bit thin
[16:49:11] zave: has joined #RubyOnRails
[16:49:14] shanemcd: has joined #RubyOnRails
[16:49:18] HalcyonicStorm: i have to focus on one thing to have any results
[16:49:41] momomomomo: focus is good
[16:51:25] passick: has joined #RubyOnRails
[16:53:15] rietta: has left #RubyOnRails: ()
[16:53:42] bmalum: has joined #RubyOnRails
[16:53:54] passick: Could anyone tell what I am doing wrong here? http://pastie.org/private/dc4jksycamwogwdjyamq
[16:54:21] _bogus_: please, does anybody knows a nice gem to manage content inside my views ?
[16:54:41] passick: I can’t understand:
[16:54:48] passick: > params.permit(:picture)
[16:54:59] passick: Unpermitted parameters: … picture
[16:56:30] SteenJobs: has joined #RubyOnRails
[16:56:48] roshanavand: has joined #RubyOnRails
[16:59:23] wxdk2: has joined #RubyOnRails
[17:00:31] pwnd_nsfw`: has left #RubyOnRails: ()
[17:00:43] pwnd_nsfw: has joined #RubyOnRails
[17:00:51] pwnd_nsfw: So, if I receive a layout from a designer, and chances are it is subject to change.. What is an easy way for a developer and a designer to interact with each other to make sure necessary updates to asset code are handled correctly?
[17:01:34] momomomomo: has joined #RubyOnRails
[17:04:16] mfaeh: has joined #RubyOnRails
[17:04:16] sp1rs: has joined #RubyOnRails
[17:05:18] tubbo: pwnd_nsfw: you can call them on their cell phooooone
[17:05:24] tubbo: late night when you neeeeed theiiiir help
[17:06:43] tubbo: pwnd_nsfw: what do you mean by that? i mean, a designer usually sends over a photoshop or illustrator file with the changes and you just find them and apply them
[17:07:32] pwnd_nsfw: I'm mostly worried about hacking up, at this very moment, the css files to work correctly in rails
[17:07:46] pwnd_nsfw: and then having to receive a heavily modified update to the file
[17:07:46] vipaca: has joined #RubyOnRails
[17:08:58] edwinvdgraaf: has joined #RubyOnRails
[17:09:07] pwnd_nsfw: And then have to go at it to have it play with rails again.
[17:09:22] pwnd_nsfw: Oh and replacing image tags for everything is incredibly annoying lol
[17:09:23] tubbo: pwnd_nsfw: your designer made those CSS files?
[17:09:48] pwnd_nsfw: We'll say hypothetically, because I believe this layout was bought tbh
[17:10:19] tubbo: pwnd_nsfw: then why not just ask him to make the changes? :)
[17:10:37] Macaveli_: has joined #RubyOnRails
[17:10:54] pwnd_nsfw: I suppose that could work
[17:10:58] pwnd_nsfw: "I've never used git before....."
[17:11:04] pwnd_nsfw: That's what I'm worried about
[17:11:37] tubbo: pwnd_nsfw: fwiw designers don't write code, so when you said "designer" i immediately assumed that you had control over the code.
[17:11:50] shanemcd_: has joined #RubyOnRails
[17:11:54] pwnd_nsfw: Ah, I see what you're saying.
[17:12:02] pwnd_nsfw: The dude that wrote the initial css/html
[17:12:15] tubbo: well fuck it just make him do it and tell him to go to git-scm.com
[17:12:22] tubbo: and stop being a god damn luddite
[17:12:27] edwinvdgraaf: has joined #RubyOnRails
[17:12:59] cabinB: Question re: dynamic forms. I have a form that has fields dynamically generated by js (when certain conditions are selected). For one series of fields, there's no limit of how many can be generated. What's a common practice in rails to handle/store data created in this way? And what's a common practice when the data needs to be edited? Load the form and normalized data first, and then ajax retrieve the dynamic data and re-render
[17:12:59] cabinB: it? Is there a gem that simplifies this process?
[17:13:00] roshanavand: has joined #RubyOnRails
[17:13:34] pwnd_nsfw: nested forms cabinB
[17:13:56] sandstrom: has joined #RubyOnRails
[17:13:58] cabinB: ok, i'll look into nested forms. it's part of core rails, right?
[17:14:50] greenhat: has joined #RubyOnRails
[17:19:31] Maletor: has joined #RubyOnRails
[17:20:20] rakm: has joined #RubyOnRails
[17:20:27] a1fa: anybody uses ransack with will_paginate
[17:20:48] a1fa: https://github.com/activerecord-hackery/ransack/issues/80
[17:20:52] baweaver: has joined #RubyOnRails
[17:21:59] a1fa: the search parameters are not being passed to will_paginate
[17:22:07] ivanskie: has joined #RubyOnRails
[17:22:11] mines999: has joined #RubyOnRails
[17:23:00] chridal: I want to do some rate limiting on an API. Does anyone have any experience with doing something like that with using middleware + Redis or anything like that?
[17:24:04] neanderslob_: has joined #RubyOnRails
[17:24:05] fox_mulder_cp: chridal: ratelimit for requests? may be nginx help u
[17:24:06] Asuna: has joined #RubyOnRails
[17:24:11] Asuna: has left #RubyOnRails: ()
[17:25:55] chridal: fox_mulder_cp: Yea, but I am sort of trying to avoid that since that would either mean having to scale up separate instances that function as reverse proxies or adding an extra container to each instance which in turn means losing syncronization of rate limits across instances
[17:26:03] chridal: it needs to be vertically scalable
[17:26:06] chridal: horizontally *
[17:27:12] a1fa: i dont see how it CAN work without modifying will_paginates links to include param[:q]
[17:27:17] fox_mulder_cp: whe u ratelimit api calls?
[17:31:27] roshanavand: has joined #RubyOnRails
[17:32:52] delgiudices: has joined #RubyOnRails
[17:37:27] flashpoint9: has joined #RubyOnRails
[17:39:05] sneakerhax: has joined #RubyOnRails
[17:39:50] roshanavand: has joined #RubyOnRails
[17:39:52] Pazician: has joined #RubyOnRails
[17:42:06] IFrank00: has joined #RubyOnRails
[17:42:37] boontdustie: has joined #RubyOnRails
[17:42:41] erts: has joined #RubyOnRails
[17:43:17] AnoHito: has joined #RubyOnRails
[17:44:03] dangerousdave: has joined #RubyOnRails
[17:44:20] scope: has joined #RubyOnRails
[17:45:08] erts: has joined #RubyOnRails
[17:46:36] hahuang61: has joined #RubyOnRails
[17:50:14] SteenJobs: anyone here use Administrate?
[17:50:51] RegulationD: has joined #RubyOnRails
[17:51:25] fox_mulder_cp: SteenJobs: wow. thanks. seems intrested
[17:52:06] fox_mulder_cp: Administrate gem
[17:52:14] treehug88: has joined #RubyOnRails
[17:52:25] allcentury: has joined #RubyOnRails
[17:52:40] SteenJobs: oh yea, it’s good stuff. allows pretty much full flexibility and customization
[17:52:50] SteenJobs: i’m just running into a mysterious issue that i haven’t been able to figure out yet
[17:53:31] akshat: has joined #RubyOnRails
[17:54:13] Ergo^: has joined #RubyOnRails
[17:54:31] dstarh: has joined #RubyOnRails
[17:55:18] alexclink: has joined #RubyOnRails
[17:55:59] adavia: how can i check if a param like "attachments"=>{"file"=>[""]} is present?
[17:59:25] Pazician: has joined #RubyOnRails
[17:59:33] KensoDev: has joined #RubyOnRails
[17:59:53] tweeeaks: adavia: .present? doesn't work?
[18:00:08] bronson: has joined #RubyOnRails
[18:00:09] meoblast001: has joined #RubyOnRails
[18:01:00] Macaveli: has joined #RubyOnRails
[18:02:14] srinidhi: has joined #RubyOnRails
[18:02:16] adavia: neither with any?
[18:02:19] arup_r: has joined #RubyOnRails
[18:04:23] fox_mulder_cp: .count, .length?
[18:04:32] tweeeaks: unless .blank?
[18:05:40] adavia: in this case nil? will be always false
[18:06:08] tweeeaks: .present? is the winner
[18:06:17] sleungcy: has joined #RubyOnRails
[18:06:44] adavia: if params[:attachments]["file"].present? still pass
[18:06:50] jscheel: has joined #RubyOnRails
[18:07:14] kdough: has joined #RubyOnRails
[18:07:43] tweeeaks: try params[:attachments][:file].present?
[18:09:04] tweeeaks: is this a paperclip attachment?
[18:09:33] adavia: carrierwave
[18:10:38] rakm: has joined #RubyOnRails
[18:11:27] adavia: for an empty attachment i am getting "attachments"=>{"file"=>[""]}
[18:11:28] arthurix_: has joined #RubyOnRails
[18:11:42] zave: any suggestions on how to resolve this? 2016/03/08 17:54:50 [error] 28#0: *2 open() "/app/public/assets/tmp/test.vsdx" failed (2: No such file or directory), client: xxx.xx.xx.xx, server: , request: "GET /assets/tmp/test.vsdx HTTP/1.1", host: "xx.xx.xx.xxx", referrer: "http://xx.xx.xx.xxx/"
[18:11:54] zave: sorry if that posted twice.
[18:12:43] B1n4r10: has joined #RubyOnRails
[18:13:20] Guest34101: has joined #RubyOnRails
[18:14:42] fox_mulder_cp: zave: i think, that no this file at disk
[18:14:53] fox_mulder_cp: ACTION captain today
[18:15:54] zave: fox_mulder_cp: would this be resolved if i did rake assets precompile?
[18:15:56] Ergo^: has joined #RubyOnRails
[18:16:22] roshanavand: has joined #RubyOnRails
[18:16:36] fox_mulder_cp: zave: i don't know your app logic, so try to do it
[18:17:14] fox_mulder_cp: it's a asset or uploaded into /public resource?
[18:17:18] naftilos76: has joined #RubyOnRails
[18:17:40] boontdustie: has joined #RubyOnRails
[18:17:56] wldcordeiro: has joined #RubyOnRails
[18:19:06] sergey_makagon: has joined #RubyOnRails
[18:19:40] shanemcd_: has joined #RubyOnRails
[18:20:18] tubbo: chridal: we use Rack::Attack iirc for rate limiting our API https://github.com/kickstarter/rack-attack
[18:20:33] tvw: has joined #RubyOnRails
[18:20:35] tubbo: SteenJobs: yes i use administrate.
[18:21:24] SteenJobs: tubbo: dude, we’re twinning wayyyy too much :D
[18:21:24] IFrank00: has joined #RubyOnRails
[18:21:54] chridal: tubbo: Cheers. Did you see a hit on your RPM when you started rate limiting in the app?
[18:22:07] SteenJobs: tubbo: i figured it out though…seems like if you create your own custom field it needs to be tied to a model attribute, which was why it wasn’t working for me.
[18:22:12] jhack: has joined #RubyOnRails
[18:22:26] Psy-Q: has joined #RubyOnRails
[18:22:31] SteenJobs: tubbo: but then looked through the source code and saw that they have Field::HasMany anyway, which i can use to show the association count, so all good.
[18:22:42] tubbo: chridal: we actually haven't deployed that version of the API yet so i don't know :)
[18:22:53] fox_mulder_cp: tubbo: and what u mean about your administrate using?
[18:23:09] tubbo: fox_mulder_cp: what part of "yes i use administrate" did you not understand?
[18:23:20] tubbo: i know that sounded harsh but i couldn't think of a better way to say it lol
[18:23:22] chridal: tubbo: Will have to have a look at it. Cheers.
[18:23:55] fox_mulder_cp: tubbo: u use it's customizing, or only this default table style views?
[18:24:12] fox_mulder_cp: tubbo: can post screens?
[18:24:29] pawnbox: has joined #RubyOnRails
[18:24:31] naftilos76: Hi everyone, i am facing an issue with an html a tag: <a style="text-decoration: none; color: white;" href="/lists/home">Home</a> and a js script : window.location.href = '/lists/home/'; The js script is causing a full page reload (js, images etc) but the a tag is (obviously) using turbolinks and the request is the only thing that is receiving a response. How can i get the same behavior using window.location.href ?
[18:24:35] tubbo: fox_mulder_cp: oh, yeah i've just used the table-style views for now. customized the forms pretty heavily.
[18:24:41] tubbo: well, i'm going to at least :D
[18:24:46] Psy-Q: when i save a record in an rspec test and then ask for foo.associated_thing.new_record? i still get "true" despite the associated record seeming to have been saved, and id is nil. when i use pry in the same spot and call foo.save by hand, id is 1 and new_record? is false, the associated record is saved. can i not save associated records and check for them with rspec?
[18:24:47] flashpoint9: has joined #RubyOnRails
[18:24:47] tubbo: but right now i just have a couple custom fields
[18:25:08] naftilos76: I am using rails 4.2
[18:25:10] Psy-Q: id of the associated thing i mean, of course
[18:25:21] SteenJobs: tubbo: it’s been great - i’ve been using it to allow us to download user image assets from the admin side, modify them, and then send it back to them in an ‘inbox'
[18:25:53] tubbo: fox_mulder_cp: there's a demo app at https://administrate-prototype.herokuapp.com/admin
[18:26:13] ModusPwnens: has joined #RubyOnRails
[18:26:38] fox_mulder_cp: tubbo: i viewed it, thanks, but think about why we need it, when we can write this panel for a some minutes
[18:26:50] t4nk190: has joined #RubyOnRails
[18:26:53] tubbo: naftilos76: don't use window.location.href, use Turbolinks.visit().
[18:27:01] ModusPwnens: I need to make some async calls in my before(:all) block of an rspec test to setup test data. Would it be bad practice to use capybara expectations in the before block just to use their implicit wait_until functionality?
[18:27:36] naftilos76: tubbo, use Turbolinks.visit() within js? is that a js func?
[18:28:28] tubbo: fox_mulder_cp: yeah, i was actually halfway through creating my own scalable admin implementation, but administrate is effectively what i was building anyway. i just didn't have dashboards.
[18:28:50] tubbo: fox_mulder_cp: so i used administrate because it was already there and did everything i needed to do.
[18:29:25] SteenJobs: tubbo: more like it didn’t do everything you didn’t need it to do :)
[18:29:28] tubbo: fox_mulder_cp: you can see the source of my site at https://github.com/waxpoetic/brotherly
[18:29:33] tubbo: yeah SteenJobs haha
[18:30:31] Sigfrid: has joined #RubyOnRails
[18:31:01] rietta: has joined #RubyOnRails
[18:31:26] naftilos76: tubbo, i get an error in js console saying that Turbolinks.visit is not a function . If i set Turbolinks.visit = "/lists/home"; i do not get an error but i do not see any activity in the network tab in FF
[18:32:19] tubbo: naftilos76: consult the README or other documentation, but it's definitely a method on the Turbolinks object.
[18:32:59] SteenJobs: there should just be an error that says “eff turbolinks” whenever the server senses turbolinks running
[18:33:05] naftilos76: tubbo, Turbolinks is definitely an object , i get that . Let see what i can find. Thanks
[18:33:37] fox_mulder_cp: tubbo: seems good. not all flyers from http://www.brother.ly/episodes showed
[18:33:41] arup_r: has joined #RubyOnRails
[18:34:38] tubbo: fox_mulder_cp: haha wait a minute for /artists, images load slow. trying to work that out.
[18:34:50] tubbo: but /episodes has one that doesn't include a flyer image, and that's just a placeholder
[18:35:04] tubbo: that episode was a happy accident
[18:35:13] solars: has joined #RubyOnRails
[18:36:26] Rubie: has joined #RubyOnRails
[18:36:33] sp1rs: has joined #RubyOnRails
[18:36:36] zave: what does it mean if the rails app is looking in the public/ directory for a fingerprinted version of a file, but only a non-fingerprinted version is in there?
[18:36:39] wxdk: has joined #RubyOnRails
[18:36:47] zave: wait, no the other way around.
[18:38:06] zave: it's looking for a non-fingerprinted version, but only fingerprinted version is in public/
[18:38:27] tubbo: zave: you're not using an asset path helper somewhere
[18:38:44] tubbo: like if you do <script src="/assets/application.js"></script> rather than using <%= javascript_include_tag 'application' %>
[18:39:09] zave: tubbo: ah ha! thank you.
[18:39:25] yuung: has joined #RubyOnRails
[18:39:27] yuung: i'm trying to use VCR in my rails app, and in the method i'm trying to test, i use Hash#transform_keys which is a Rails method. it seems that when i test with VCR, this method isn't added. how can i amend this?
[18:39:39] siaW: has joined #RubyOnRails
[18:39:41] edwinvdg_: has joined #RubyOnRails
[18:41:09] DoctorMonocular: has joined #RubyOnRails
[18:41:42] yuung: has joined #RubyOnRails
[18:42:07] yellow5: has joined #RubyOnRails
[18:42:52] maxx88: has joined #RubyOnRails
[18:43:56] uxp: has joined #RubyOnRails
[18:44:25] flashpoint9: has joined #RubyOnRails
[18:44:42] Rubie: has joined #RubyOnRails
[18:44:45] kies: has joined #RubyOnRails
[18:47:27] naftilos76: tubbo, thanks Turbolinks.visit() works fine
[18:47:59] jstransky: has joined #RubyOnRails
[18:48:05] [Butch]: has joined #RubyOnRails
[18:49:24] chipotle: has joined #RubyOnRails
[18:49:32] robbyoconnor: has joined #RubyOnRails
[18:49:46] rrawlins: has joined #RubyOnRails
[18:50:20] finnnnnnnnnnn: has joined #RubyOnRails
[18:51:22] baweaver: has joined #RubyOnRails
[18:51:49] shanemcd_: has joined #RubyOnRails
[18:52:17] intrigueD: has joined #RubyOnRails
[18:52:57] yuung: is anyone familiar with using the VCR gem and Rails?
[18:53:17] adre: has joined #RubyOnRails
[18:54:13] bbrowning: has joined #RubyOnRails
[18:54:43] yuung: it's complaining about a Rails-implemented method
[18:54:50] yuung: but still records the http request o_O
[18:55:07] momomomomo: has joined #RubyOnRails
[18:56:44] tubbo: yuung: !code
[18:56:45] helpa: yuung: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[18:57:00] theblang: has joined #RubyOnRails
[19:00:39] gousuto: has joined #RubyOnRails
[19:00:51] sp1rs: has joined #RubyOnRails
[19:05:56] edwinvdgraaf: has joined #RubyOnRails
[19:08:22] dopie: has joined #RubyOnRails
[19:08:27] roshanavand: has joined #RubyOnRails
[19:08:49] Psy-Q: for some reason it doesn't save my associated records even though they're valid
[19:09:54] Psy-Q: if i have a belongs_to and a has_one :configuration and a belongs_to :vulnerability, if i save a configuration with an associated vuln, it should save the vuln as well, no?
[19:10:19] ldnunes: has joined #RubyOnRails
[19:10:49] Psy-Q: oooh, i guess nowadays i need a "Active Record Autosave Association" as described here? http://api.rubyonrails.org/classes/ActiveRecord/AutosaveAssociation.html
[19:11:16] manfrin: has joined #RubyOnRails
[19:12:02] shanemcd_: has joined #RubyOnRails
[19:12:03] snowy: has joined #RubyOnRails
[19:12:24] Psy-Q: hm, nope, that won't work either
[19:12:44] yuung: https://gist.github.com/johnmarinelli/0e72a3ffc72c6aed648a <--- link to VCR/Rails problem
[19:13:43] neanderslob_: has joined #RubyOnRails
[19:16:04] rietta: has left #RubyOnRails: ()
[19:16:55] aegis3121: has joined #RubyOnRails
[19:17:32] Palsson: has joined #RubyOnRails
[19:19:58] B1n4r10: has joined #RubyOnRails
[19:21:28] Psy-Q: fuckin ell, i had to reverse the association. now it works.
[19:21:53] Pazician: has joined #RubyOnRails
[19:22:15] jgpawletko: has joined #RubyOnRails
[19:24:03] mdw: has joined #RubyOnRails
[19:25:15] draig: has joined #RubyOnRails
[19:25:42] trosborn: has joined #RubyOnRails
[19:26:27] mdw7: has joined #RubyOnRails
[19:26:43] delgiudices: has joined #RubyOnRails
[19:26:58] delgiudices: When you're working on your own project
[19:27:04] delgiudices: How do you stop from coding without testing
[19:27:16] delgiudices: It's too tempting to keep coding without spending time on testing to me
[19:27:55] Palsson: has joined #RubyOnRails
[19:29:00] theery: has joined #RubyOnRails
[19:30:06] momomomomo: has joined #RubyOnRails
[19:30:29] finnnnnnnnnnn: has joined #RubyOnRails
[19:32:57] jottr: has joined #RubyOnRails
[19:33:10] tubbo: delgiudices: i don't.
[19:33:17] tubbo: code first, test later.
[19:33:23] tubbo: but "later" means "before you push"
[19:33:29] tubbo: not "eventually" :\
[19:34:18] tubbo: delgiudices: the issue is you never really know whether something works until you run tests
[19:34:31] tubbo: so i use tests to verify 99% of the way and then real-life QA to get me the other 1% there
[19:34:40] delgiudices: How do you make sure you don't push without writing test
[19:34:49] delgiudices: Personal will?
[19:34:57] tubbo: delgiudices: run tests before you push
[19:35:03] tubbo: just make it a habit
[19:35:12] delgiudices: It has to be a habit i guess
[19:35:46] jenrzzz: has joined #RubyOnRails
[19:35:50] tubbo: delgiudices: yeah i mean at work, we have a CI server and our git hosting service is configured not to *let* you push to master until tests pass.
[19:36:06] tubbo: delgiudices: so tests are run at a minimum about 3 times before making it to the staging server, and finally to production.
[19:36:17] n008f4g_: has joined #RubyOnRails
[19:36:18] tubbo: so even if i don't remember, the CI server will :)
[19:36:33] sp1rs: has joined #RubyOnRails
[19:36:41] delgiudices: I know CI make sure test pass
[19:36:45] delgiudices: But it doesn't make sure you write the tests
[19:37:47] wxdk2: has joined #RubyOnRails
[19:39:16] djbkd: has joined #RubyOnRails
[19:40:18] SteenJobs: has joined #RubyOnRails
[19:40:47] yxejamir: has joined #RubyOnRails
[19:40:48] yxejamir: has joined #RubyOnRails
[19:41:22] finnnnnnnnnnn: has joined #RubyOnRails
[19:42:02] baweaver: has joined #RubyOnRails
[19:44:29] Trogones: has joined #RubyOnRails
[19:45:13] Radar: [06:27:04] <delgiudices> How do you stop from coding without testing
[19:45:31] Radar: When my client calls me at weird hours and in a very angry tone tells me that their site is broken
[19:45:52] Radar: http://ryanbigg.com/2010/02/congratulations/
[19:46:32] tubbo: delgiudices: yeah it's really more for your sanity than anyone else's
[19:46:49] delgiudices: Well makes sense
[19:46:54] tubbo: example -> my company deployed a redesign of a legacy coldfusion project today. they started deploy at 6:30am EST. they finished deploy 45 minutes ago. for those playing the home game, it took 8 hours.
[19:47:08] shanemcd_: has joined #RubyOnRails
[19:47:09] jottr_: has joined #RubyOnRails
[19:47:21] tubbo: i've never deployed a site and had it take more than 15-30 minutes. mostly waiting for DNS.
[19:48:20] openstruct: has joined #RubyOnRails
[19:49:59] mary5030: has joined #RubyOnRails
[19:50:32] rrawlins: has joined #RubyOnRails
[19:52:18] fox_mulder_cp: in hiload - 15 minutes - bvery biig time
[19:52:48] fox_mulder_cp: but if down node in balancer before deplay - seems ok
[19:52:56] _bogus_: has joined #RubyOnRails
[19:54:11] Palsson: has joined #RubyOnRails
[19:54:13] dopie: has joined #RubyOnRails
[19:56:54] sp1rs: has joined #RubyOnRails
[19:58:15] delgiudices: Really nice article
[19:58:58] roshanavand: has joined #RubyOnRails
[20:00:16] manfrin: has joined #RubyOnRails
[20:01:20] mib_mib: has joined #RubyOnRails
[20:01:31] mib_mib: is there any way to pass a scope into an association?
[20:01:49] mib_mib: i.e. has_one :blah, scope: unscoped
[20:02:00] mib_mib: whats the easiest way to unscope an association if not?
[20:04:58] shanemcd: has joined #RubyOnRails
[20:05:42] roshanavand: has joined #RubyOnRails
[20:06:42] lemur: has joined #RubyOnRails
[20:06:55] siaW: i’m trying to use a rails callback that will capitalize the name of an account after creation. this is what i have tried to do https://gist.github.com/siaw23/0f4923ac48711d1793e0. My account has a name attribute of type string. but this is not working. any ideas?
[20:07:10] IFrank00: has joined #RubyOnRails
[20:07:16] baweaver_: has joined #RubyOnRails
[20:07:38] trosborn: has joined #RubyOnRails
[20:08:07] GreatDanton: has joined #RubyOnRails
[20:10:30] jottr_: has joined #RubyOnRails
[20:11:34] flashpoint9: has joined #RubyOnRails
[20:11:45] rickmasta: has joined #RubyOnRails
[20:11:48] trosborn: has joined #RubyOnRails
[20:12:27] dshoreman: has left #RubyOnRails: ("Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life.")
[20:14:32] arup_r: mib_mib: you may have a conditional test, inside the scope. And based on scope, you can apply it or not.
[20:15:07] greenhat: siaw: after_create will run after the object is saved to the database, so the capitalization is not persisted.
[20:15:18] greenhat: siaw: Try using before_create
[20:15:40] siaW: greenhat: ok
[20:15:43] siaW: let’s me try
[20:16:12] siaW: not working
[20:16:26] siaW: and honestly i have no idea why
[20:17:35] sp1rs: has joined #RubyOnRails
[20:20:49] futilegames: has joined #RubyOnRails
[20:20:51] trosborn: has joined #RubyOnRails
[20:22:25] Coldblackice: has joined #RubyOnRails
[20:22:36] greenhat: You need to assign the results of the capitalization back to name.
[20:22:51] rickmasta: has joined #RubyOnRails
[20:23:06] passick: Where do I start adding tests? I already have a project with some functionality, but no tests. What should I read?
[20:23:12] passick: Any suggestions?
[20:23:17] enitiz: has joined #RubyOnRails
[20:23:23] delgiudices: http://guides.rubyonrails.org/testing.html
[20:23:33] delgiudices: passick that link has an introduction to testing
[20:23:41] delgiudices: I read it today :P
[20:23:47] fryguy: passick: that, and "working effectively with legacy code" by michael feathers for approaches about how to get legacy code under test
[20:24:07] ivanskie_work: has joined #RubyOnRails
[20:24:08] passick: Ok, thank you.
[20:24:09] pawnbox: has joined #RubyOnRails
[20:25:13] nullwarp: has joined #RubyOnRails
[20:25:58] rattatmatt: has joined #RubyOnRails
[20:26:12] sp1rs: has joined #RubyOnRails
[20:26:21] cabinB: I have a form w/ a multiple checkboxes, grouped for a single concern ("features"... 4wd, air conditioning, bluetooth, etc). The HTML for each checkbox is the same name ("car_features"). QUESTION: what should my activerecord data type be for this? I don't think it should be string, but I don't see anything else that's a good fit. It couldn't be just an integer, since there may be multiple selections.
[20:26:21] pawnbox: has joined #RubyOnRails
[20:27:10] mdw: has joined #RubyOnRails
[20:27:16] uglybandersnatch: has joined #RubyOnRails
[20:27:17] neohunter: has joined #RubyOnRails
[20:27:22] arup_r: cabinB: Array
[20:27:32] arup_r: array of strings if you Postgresql
[20:27:55] Cohedrin: has joined #RubyOnRails
[20:27:56] arup_r: or use text field with AR's serialize scheme
[20:27:59] cabinB: yes arup_r I should have specified... activerecord w/ mysql
[20:28:15] arup_r: Yes, I covered that too in my answer.. :p
[20:29:24] arup_r: passick: what framework you have chosen ?
[20:29:45] passick: arup_r: I haven’t yet.
[20:30:14] passick: arup_r: which one would you recommend?
[20:30:18] Megamos: has joined #RubyOnRails
[20:30:33] siaW: greenhat: this works https://gist.github.com/siaw23/0f4923ac48711d1793e0 but why couldn’t i directly apply the manupulation on self.name
[20:30:34] arup_r: ok, so if you are like me , start with https://leanpub.com/everydayrailsrspec .. read it
[20:30:39] arup_r: passick: ^^
[20:30:51] siaW: def method self.name.split… end
[20:32:35] arup_r: or, if you sit between experts, ask them... follow them.. what not.. to learn.
[20:32:45] pawnbox: has joined #RubyOnRails
[20:33:45] sandstrom: has joined #RubyOnRails
[20:33:46] mdw: has joined #RubyOnRails
[20:34:01] shanemcd: has joined #RubyOnRails
[20:34:44] greenhat: siaw: That isn't possible with those methods.
[20:35:03] siaW: but with some methods it’s possible?
[20:35:29] passick: arup_r: thanks, but it costs 15 dollars =|
[20:36:43] passick: arup_r: I am a student, so that’s too much for me right now =/
[20:38:02] shanemcd: has joined #RubyOnRails
[20:38:14] arup_r: well, I have the book in my other laptop. And that laptop is not with me, or will be in next 2 months.. Otherwise I might help you
[20:39:55] alaing: has joined #RubyOnRails
[20:39:56] aegis3121: has joined #RubyOnRails
[20:40:07] alaing: has joined #RubyOnRails
[20:40:13] delgiudices: has joined #RubyOnRails
[20:41:49] FernandoBasso: has joined #RubyOnRails
[20:43:06] rickmasta: has joined #RubyOnRails
[20:43:38] siaW: i have that book
[20:43:53] d0nn1e: has joined #RubyOnRails
[20:44:41] Radar: imo the best book on testing with Rails is Rails 4 in Action. I am slightly biased, admittedly.
[20:45:49] intrigueD: has joined #RubyOnRails
[20:45:49] intrigueD: has joined #RubyOnRails
[20:46:06] uglybandersnatch: has joined #RubyOnRails
[20:47:06] alaing: hi I need help with arrays
[20:47:36] alaing: i called .to_s on it and its adding square brackets around the values
[20:47:40] passick: Another question: how do you deploy? Capistrano? Because now I log into the server over ssh every time I want to deploy, pull the changes, restart the server.
[20:47:42] alaing: here is a gist of it
[20:47:42] alaing: https://gist.github.com/aliuk2012/0b8c1017e1fa2c8efa4a
[20:48:05] ciree: alaing: what do you want the result to be?
[20:48:10] alaing: should I maybe use like .join? instead
[20:48:23] ciree: alaing: that will work
[20:48:36] alaing: ciree: I would like it to not include the square brackets or "\"
[20:49:00] ciree: u want, all the values from checkVisible.uniq, to be in actual_result?
[20:49:39] alaing: so it should be "should" or "should not, should"
[20:49:50] alaing: its part of a larger cucumber step
[20:50:27] alaing: also just one other question whats the best way to compare two arrays?
[20:51:26] alaing: because once thats done I want to make sure that @expected_results = @actual_results
[20:51:51] rodferso1: has joined #RubyOnRails
[20:52:24] ciree: https://gist.github.com/elech/4e4757982ef485b21bf7
[20:52:30] momomomomo: has joined #RubyOnRails
[20:53:57] Pulp: has joined #RubyOnRails
[20:54:08] josephkokenge: has joined #RubyOnRails
[20:54:46] jenrzzz: has joined #RubyOnRails
[20:55:43] SteenJobs: any idea why Stripe’s API responds with something like “"text":"{\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"message\”:….”? as opposed to clean JSON
[20:55:49] lightheaded: has joined #RubyOnRails
[20:56:06] alaing: ciree: is that to compare the arrays?
[20:56:43] alaing: ciree: i tried .join and thats given me the result i was looking for in terms of should/should not
[20:57:05] arup_r: has joined #RubyOnRails
[20:57:45] alaing: I'm thinking @expected_results.to_s = @actual_results.to_s to check if the arrays are the same
[20:58:38] alaing: they actual result should be in the same order as the expected results because its built up in the same orders the expected results are looped through
[21:01:24] manfrin: has joined #RubyOnRails
[21:01:57] Radar: SteenJobs: Gist the full output please
[21:02:06] KnownSyntax: has joined #RubyOnRails
[21:02:08] KnownSyntax: has joined #RubyOnRails
[21:03:05] SteenJobs: Radar: i was going to but just realized it won’t matter, it’s not a rails thing - the post req is being placed from Parse cloud code, and even the response there is messed up JSON, and the entire second tier in the JSON response is a string for some reason. i presume it’s a parse issue so i’m gonna look into it now that i’ve isolated it.
[21:04:11] SteenJobs: Radar: thanks though, sorry for the disturbance ha.
[21:05:07] rattatmatt: so I have a bunch of different has_many associations on an object that I need to be able to list in order of the date created in a "timeline" style - with links to the "event" (read: associated instance/record). I was thinking of some kind of log or timeline_events table using sti to denote what type of event it was with a foreign key column for each possible type of event pointing to the record in that table, but I'm
[21:05:08] rattatmatt: curious if anyone has any better ideas
[21:05:36] shanemcd: has joined #RubyOnRails
[21:07:31] bronson: has joined #RubyOnRails
[21:07:48] fox_mulder_cp: wooow. I'm a slowpoke. r5b3, and site change a design
[21:08:57] arup_r: rattatmatt: not getting your question, here.
[21:09:28] siaW: how do i parse json nice (human readable) in the terminal?
[21:09:32] siaW: any gem for that?
[21:09:37] Radar: rattatmatt: I think an events table with STI would be fine.
[21:09:41] siaW: or trick?
[21:09:56] arup_r: JSON has pretty_print method
[21:10:01] arup_r: check that out?
[21:10:49] siaW: arup_r: cool
[21:10:51] siaW: let me see
[21:11:43] thebastl: has joined #RubyOnRails
[21:14:41] mpowers: has joined #RubyOnRails
[21:15:11] DylanJ: has joined #RubyOnRails
[21:15:56] shanemcd: has joined #RubyOnRails
[21:17:08] rattatmatt: arup_r: I'll be a bit more explicit. I have a Person model that has_many emails (as in, emails sent to that person), form_submissions, and various other such associations. when the user clicks on a person, it should display a timeline of all of these associations in the order that they happened (eg. emailed 2 days ago, form submitted 2 weeks ago), with links to view the actual association (click "emailed 2 days ago" t
[21:17:09] rattatmatt: o view the email that was sent, etc)
[21:17:55] rattatmatt: Radar: thanks, I figured it would work, just making sure I'm not overlooking a better solution
[21:19:10] arup_r: i was thinking to be like polymorphic, but I was reading the question wrong it seems
[21:19:16] shanemcd: has joined #RubyOnRails
[21:19:23] aaronang: has joined #RubyOnRails
[21:19:24] shanemcd_: has joined #RubyOnRails
[21:20:05] momomomomo: has joined #RubyOnRails
[21:20:27] fox_mulder_cp: siaw: apt-get install jq :)
[21:20:44] siaW: fox_mulder_cp: what makes you think i’m using linux :p
[21:21:01] arup_r: point point... hehe
[21:21:31] cabinB: is there a gem or other rails add-on that is similar to phpmyadmin? It would be great to have a gui into my development db instead of rails console
[21:22:48] aaronang: Hi there, I have don't want to spam this IRC channel but are there any Rails core developers present?
[21:23:39] yuung: has joined #RubyOnRails
[21:25:16] bronson: has joined #RubyOnRails
[21:25:39] mpowers: Hello. I am trying to implement something very similar to Locking::Optimistic, but i'm seeing some weird behavior in my app. I have bascially copy-pasted optimistic.rb and made a few changes, and wired it into ActiveRecord::Base using 'include' but it seems like somehow the functionality that makes relationships like has_many work, is not working when my custom thing is used. Is there a better way to get this b
[21:25:39] mpowers: ehavior into ActiveRecord? Or some functions I could call that will fix this weirdness I am seeing?
[21:26:04] Hates_: cabinB: there are loads of gui tools.
[21:26:14] akshat: has joined #RubyOnRails
[21:26:28] Hates_: cabinB: don't know of any gem ones
[21:26:46] cabinB: was just going to ask that, Hates_
[21:27:25] arup_r: aaronang: yes, matthew-d. I used the dash, so that he get the ping. Except him there are many though..
[21:27:28] cabinB: can you name one or two you know of? I'm using cloud 9 (c9.io), so it may or may not be possible to install into that environment
[21:28:23] arup_r: he don't get**
[21:28:48] gbgdev: has joined #RubyOnRails
[21:29:37] aaronang: arup_r: I am a student at the Delft University of Technology and together with some fellow students we are following an awesome course where we have to analyze a GitHub project. We would, therefore, like to get in touch with one of the core developers to ask some questions :)
[21:29:43] Hates_: cabinB: ahhh, that makes things complicated then
[21:29:54] Hates_: cabinB: their docs say you can use phpmyadmin
[21:29:57] aaronang: arup_r: By the way, we chose Rails ;)
[21:30:01] cabinB: Hates_, yeah i know :-/
[21:30:09] fox_mulder_cp: cabinB: yes. use system wide phpadmin, if u want use mysql or pgadmin even pgsql
[21:30:18] arup_r: aaronang: you ask here anything, all smart people around you..
[21:30:20] Hates_: aaronang: what questions in particular?
[21:30:24] arup_r: you will get the help
[21:30:49] aaronang: arup_r: That's really nice of you :)
[21:31:11] rrawlins: has joined #RubyOnRails
[21:31:15] cabinB: fox_mulder_cp, I can do that, was just hoping not to have to install & config PHP. but if that's the way most people do it... was hoping for a magic gem :-)
[21:31:16] sp1rs: has joined #RubyOnRails
[21:31:42] trosborn: has joined #RubyOnRails
[21:32:01] fox_mulder_cp: cabinB: install apache2 + php + phpmyadmin - task for a 3 minutes
[21:32:14] fox_mulder_cp: and setup acl for htaccess
[21:32:35] cabinB: fox_mulder_cp: for you, b/c you probably know what you're doing very well
[21:33:06] aaronang: Well, arup_r you are right, we actually ask you guys. So for our course we are required to demonstrate that we are able to contribute to Rails. We did some documentation-related contributions but would really like to do some more challenging tasks.
[21:33:16] aaronang: we can actually*
[21:33:18] fox_mulder_cp: cabinB: two first google links by 'mylinux distro phpmyadmin install' ))
[21:33:53] Hates_: or just follow the cloud9 docs on it https://docs.c9.io/docs/setting-up-phpmyadmin
[21:34:27] ivanskie_work_: has joined #RubyOnRails
[21:34:37] aaronang: So for now, we don't really need to core developers but would like to know what issues we could fix. By the way, we are a team of four students and have about 1 weeks left to work on this
[21:34:39] Hates_: aaronang: that's a strange requirement
[21:34:58] aaronang: Hates_: Although it is strange, we really like it :)
[21:35:03] Hates_: aaronang: well you can start with the rails issue list :) https://github.com/rails/rails/issues
[21:35:39] aaronang: Hates_: We already had a look at it but it is kind of difficult for us to estimate what is actually doable in one week (note, we cannot spend one week full time)
[21:36:01] aaronang: Hates_: Thanks for your suggestion though :)
[21:36:07] mpowers: I guess basically what I am asking is, is there any documentation or support for adding ones own locking strategy besides Optimistic and Pessimistic?
[21:36:34] Sawbones: has joined #RubyOnRails
[21:37:44] n008f4g_: has joined #RubyOnRails
[21:38:20] aaronang: By the way, does anyone know what Rails used before GitHub? If we understood correctly, Rails started using GitHub from release 2.1, and, therefore, we are wondering what Rails used before that.
[21:38:21] SteenJobs: Radar: all figured out, somewhere along the line the json response wasn’t parsed properly, and for whatever reason some of it remained stringified
[21:39:28] puff: has joined #RubyOnRails
[21:41:05] Hates_: aaronang: it used to be on subversion and issues tracked in Lighthouse
[21:41:30] aaronang: Hates_: Thank you :)
[21:42:13] ner0x: has joined #RubyOnRails
[21:43:01] peterppp: has joined #RubyOnRails
[21:43:20] hangelo: has joined #RubyOnRails
[21:43:45] aaronang: Hates_: Do you happen to know what issue isn't too difficult to fix but not documentation related? We will definitely try to keep an eye on the issue tracker ;)
[21:46:29] futilegames: has joined #RubyOnRails
[21:46:57] Hates_: aaronang: sadly not. the list is pretty long
[21:47:25] aaronang: Hates_: Thanks for your kindness :)
[21:47:44] Hates_: aaronang: np. good luck :)
[21:48:32] aaronang: Hates_: Thanks, if you are interested, we will probably publish a chapter about Rails. The course is called Software Architecture and I think it has been on HackerNews. It is called DESOSA: https://delftswa.github.io/
[21:49:00] tubbo: aaronang: have you considered analyzing a project that was a little smaller than rails?
[21:49:42] aaronang: tubbo: We haven't. We found Rails an amazing project because it was one of the first successful full-stack web frameworks and it is also one of the biggest repos on GitHub.
[21:50:29] uglybandersnatch: has joined #RubyOnRails
[21:50:55] aaronang: tubbo: I mean, it is one of the projects that many many pull requests on GitHub, if not the most.
[21:51:42] finnnnnnnnnnn: has joined #RubyOnRails
[21:52:24] drbayer: has joined #RubyOnRails
[21:53:00] tubbo: can't argue with that
[21:54:59] fox_mulder_cp: has joined #RubyOnRails
[21:56:04] crankharder: has joined #RubyOnRails
[21:56:15] replay: has joined #RubyOnRails
[22:00:31] djbkd: has joined #RubyOnRails
[22:01:55] aaronang: has joined #RubyOnRails
[22:01:59] moeabdol4: has joined #RubyOnRails
[22:02:13] shanemcd: has joined #RubyOnRails
[22:02:38] kdough: has joined #RubyOnRails
[22:05:25] quazimodo: has joined #RubyOnRails
[22:05:39] aaronang: has joined #RubyOnRails
[22:05:44] alexclink: has left #RubyOnRails: ()
[22:07:29] bbrowning: has joined #RubyOnRails
[22:08:03] aaronang_: has joined #RubyOnRails
[22:08:26] aaronang: has joined #RubyOnRails
[22:11:37] aaronang: has joined #RubyOnRails
[22:11:50] aaronang_: has joined #RubyOnRails
[22:14:53] soule: has joined #RubyOnRails
[22:18:10] Ergo: has joined #RubyOnRails
[22:20:35] CodaBrink: has joined #RubyOnRails
[22:21:12] trinaldi: has joined #RubyOnRails
[22:22:35] Jasaka: has joined #RubyOnRails
[22:26:07] shanemcd: has joined #RubyOnRails
[22:29:34] chipotle: has joined #RubyOnRails
[22:33:10] jarinux: has joined #RubyOnRails
[22:33:20] SteenJobs: has joined #RubyOnRails
[22:33:33] jarinux: has left #RubyOnRails: ()
[22:33:38] jarinux: has joined #RubyOnRails
[22:34:42] wethu: has joined #RubyOnRails
[22:34:43] _bogus_: has joined #RubyOnRails
[22:35:53] jarinux: has joined #RubyOnRails
[22:35:54] cabinB: fox_mulder_cp & hates_ : thanks guys.
[22:36:06] cabinB: I'll take a look at what you suggested
[22:37:11] finnnnnnnnnnn: has joined #RubyOnRails
[22:40:22] voidDotClass: has joined #RubyOnRails
[22:40:39] mostlybadfly: has joined #RubyOnRails
[22:41:17] voidDotClass: Question. I'm doing a query like this: Product.includes(:manufacturer, :extra_details).where(...).order(...)
[22:41:41] voidDotClass: Here product belongs_to manufacturer, and has_many extra_details. But, sometimes extra_details are not present.
[22:41:47] voidDotClass: In those cases, the query returns 0 results
[22:42:18] voidDotClass: How can I get it to still return results when it doesn't have extra_details, and just provide extra_details as an array?
[22:42:29] voidDotClass: (empty array)
[22:42:47] rattatmatt: has joined #RubyOnRails
[22:42:51] voidDotClass: oops, I'm doing joins() and not includes()
[22:42:58] voidDotClass: actually, i'm doing both
[22:43:17] voidDotClass: Product.joins(:manufacturer, :extra_details).includes(:manufacturer, :extra_details)
[22:44:13] htmldrum: has joined #RubyOnRails
[22:48:13] htmldrum: has joined #RubyOnRails
[22:48:14] boontdustie: has joined #RubyOnRails
[22:53:11] robbyoconnor: has joined #RubyOnRails
[22:53:21] rietta: has joined #RubyOnRails
[22:53:50] Devalo: has joined #RubyOnRails
[22:57:26] jstransky: has joined #RubyOnRails
[23:04:30] delgiudices: has joined #RubyOnRails
[23:04:58] siaW: hello good people
[23:05:00] siaW: it’s me again
[23:05:10] delgiudices: If i wanted to learn by coding .. what would be a good open source project i could contribute to
[23:05:15] siaW: this is what i have, i can successfully read from twitter API
[23:05:20] siaW: but how can i post to it?
[23:05:25] siaW: i’d appreciate any help at all
[23:05:26] siaW: https://gist.github.com/siaw23/191f1c5f9385d1af4cda
[23:05:47] shanemcd: has joined #RubyOnRails
[23:07:57] jjturner: has joined #RubyOnRails
[23:13:57] cac: has joined #RubyOnRails
[23:17:56] shanemcd: has joined #RubyOnRails
[23:19:20] finnnnnnnnnnn: has joined #RubyOnRails
[23:20:24] DEA7TH: has joined #RubyOnRails
[23:20:29] superlou: has joined #RubyOnRails
[23:21:08] hahuang61: has joined #RubyOnRails
[23:22:11] alphaatom: has joined #RubyOnRails
[23:23:10] Pazician: has joined #RubyOnRails
[23:24:38] jarinux: has joined #RubyOnRails
[23:24:55] cac: has joined #RubyOnRails
[23:24:57] alphaatom: has joined #RubyOnRails
[23:25:18] siaW: figured it out ;)
[23:25:49] delgiudices: has joined #RubyOnRails
[23:27:28] crystal77: has joined #RubyOnRails
[23:29:31] gousuto: has joined #RubyOnRails
[23:31:27] [Butch]: has joined #RubyOnRails
[23:36:20] trosborn: has joined #RubyOnRails
[23:41:23] IFrank00: has joined #RubyOnRails
[23:41:59] DoctorMonocular: has joined #RubyOnRails
[23:42:43] alphaatom: has joined #RubyOnRails
[23:48:09] gbgdev: has joined #RubyOnRails
[23:52:03] uglybandersnatch: has joined #RubyOnRails
[23:52:35] Sawbones: has joined #RubyOnRails
[23:53:04] k1t: has joined #RubyOnRails
[23:53:13] DoctorMonocular: has joined #RubyOnRails
[23:54:11] nfk|laptop: has joined #RubyOnRails
[23:54:25] AgentSpyname: has joined #RubyOnRails
[23:55:24] AgentSpyname: is there a way to have a User input HTML code and have that directly applied in a .html.erb file
[23:55:30] Devalo: has joined #RubyOnRails
[23:55:56] AgentSpyname: for example: user types in <h1>Hi</h1> and on the resulting show page the text comes out as Hi with h1 applied
[23:56:00] weaksauce: AgentSpyname html_safe I think
[23:56:12] weaksauce: be careful though
[23:56:35] AgentSpyname: weaksauce: k i will
[23:57:31] AgentSpyname: weaksauce: any good page with documentation/example?
[23:57:42] weaksauce: i mean really careful. user input is smarter than most of us. ;)
[23:58:06] AgentSpyname: any extra measures i should use?
[23:58:09] one_zero: has joined #RubyOnRails
[23:58:28] weaksauce: rethink what you are doing
[23:58:30] weaksauce: http://api.rubyonrails.org/classes/String.html#method-i-html_safe
[23:59:03] weaksauce: it's basically carte blanche on a given string so if you have a malicious user it can really be easy to muck things up.
[23:59:18] weaksauce: what are you trying to accomplish?
[23:59:47] AgentSpyname: weaksauce: basically I want an logged in user to be able to put a <img>/<h1> throughout a string of tet
[23:59:57] AgentSpyname: so it can then render on the show page