« Back to channel list

#RubyOnRails - 30 June 2014

« Back 1 day Forward 1 day »
[00:35:12] volk_: can anybody tell me thats expiereinced with devise whether i would actually need to use sign_in or sign_out if i???m dealing with purely a token authenticated API from a mobile app?
[00:42:20] tewlz: volk_: sign_in and out will create and destroy sessions on the server side, if you're only validating with the token I don't think it would matter unless you're using the session to validate something server side
[00:42:40] hypnosb: Ugh, when is google going to get rid of ruby forge links
[00:44:26] crankharder: rubyforges memories shall live on forever!
[00:45:00] tewlz: thanks to the internet archive
[00:46:05] tewlz: until AI takes over and finds the information obsolete, kills us all and deletes the internet in favor for local storage and quantum teleporting information
[00:48:47] tewlz: kies: sorry, should have said [spoiler alert]
[00:56:48] Radar: admin ban tewlz plz
[00:57:34] tewlz: mistakes were made.
[00:58:09] Radar: OFF WITH HIS HEAD
[01:00:22] tewlz: sunday is better than friday tho...
[01:00:31] sevenseacat: except its monday
[01:00:42] tewlz: ACTION brain explodes
[01:01:13] tewlz: it's almost like you're from the future.
[01:01:21] sevenseacat: stop living in the past, man.
[01:01:50] tewlz: do you ever acidentally hit on younger versions of your parents over there?
[01:02:06] Radar: Everyone knows that the past is read-only
[01:02:25] Radar: Anything you attempt to do in the past is prevented somehow
[01:02:30] Radar: or has no real consequence
[01:02:49] Radar: Do you even time travel, bro?
[01:03:26] tewlz: unless this isn't reality and the past is constantly being manipulated but it's not reflected in our dream world simiulated by lizard people
[01:03:53] Sirele: hello friends
[01:03:56] Radar: those damn lizard people
[01:04:33] sevenseacat: the argonians, again!?
[01:06:43] tewlz: the iksar laugh at the thought of argonians existing
[01:15:59] kies: the excerpts from the lusty argonian maid were lol
[01:17:01] neruda: rails server wont start, throws this msg: `require': cannot load such file -- action_dispatch (LoadError)
[01:17:30] neruda: railties and rails are both v4.0.5
[01:17:58] neruda: been at this all day, came someone walk me thru a proper uninstall/re-install
[01:19:08] andll: If a join table has no primary key, what's the best way to delete the join table record? Should a primary key be added?
[01:20:46] Radar: neruda: what's the stacktrace on that?
[01:21:03] Radar: andll: Define a model for the join table, then find by the two keys
[01:21:48] neruda: Radar: https://gist.github.com/anonymous/726e6f7230af98f5a193
[01:22:02] Radar: neruda: Oh, Windows.
[01:22:13] Radar: neruda: What does gem list show?
[01:22:16] sevenseacat: missing some gems insatalled?
[01:22:38] neruda: sevenseacat: which ones though?
[01:22:49] sevenseacat: whatever includes action_dispatch? :)
[01:23:10] sevenseacat: have you bundled?
[01:23:51] neruda: sevenseacat: been bundling all day
[01:23:59] neruda: Radar: gem list: https://gist.github.com/anonymous/46ad42ed9f8d9b63461b
[01:24:17] Radar: neruda: Sorry, I meant the actual command "gem list"
[01:24:36] sevenseacat: action_dispatch appears to be part of actionpack
[01:25:03] neruda: gem list cmd: https://gist.github.com/anonymous/dfded553787816c1eff0
[01:25:40] neruda: sevenseacat: am i expecting too much from bundler that i think it should tell me that when i type 'bundle check'?
[01:25:51] sevenseacat: tell you what?
[01:25:54] neruda: its says all deps met for project/bundle
[01:26:07] sevenseacat: that doesnt mean you have them all installed
[01:27:28] neruda: installed actionpack and re-bundled, same msg when i try to start server
[01:27:39] sevenseacat: well actionpack was already installed
[01:28:05] neruda: is there a 'nuke the world and start from scratch' option?
[01:28:10] crankharder: just install vbox and ubuntu.
[01:28:19] sevenseacat: crankharder: no
[01:28:35] neruda: crankharder: actually have 14.04 in a vm, just getting ready to migrate later in the month
[01:28:54] neruda: crankharder: just dont think i should have to abandon the platform for something so simple
[01:29:25] crankharder: just do it. <swoosh>
[01:29:28] sevenseacat: permissions issue? http://stackoverflow.com/questions/8857458/rails-no-such-file-to-load-action-dispatch does windows have those?
[01:30:06] crankharder: any lessons learned you gain from banging your head against this windows setup will be useless to you in the long run
[01:30:38] neruda: crankharder: haha, a real nihilist....i learned how to push a boulder up a hill, that counts for something right?
[01:30:58] Radar: neruda: Everything checks out here. I don't understand what could be going wrong.
[01:31:03] crankharder: if you're sisyphus
[01:31:07] sevenseacat: crankharder: if he has an issue with setting stuff up under ubuntu, will you tell him to just delete it and go buy a macbook?
[01:31:32] neruda: crankharder: hold on, my boulder's gone....whered it go?
[01:31:35] crankharder: sevenseacat: no. issues setting up on ubuntu are a solve problem that people in the rails community *actually* care about
[01:31:57] sevenseacat: we dont care about making the framework work?
[01:32:21] Radar: neruda: Ok, here's the steps to removing it
[01:32:29] crankharder: rails, by itself, may be intended to run on windows.. but who cares. what happens when he needs real libraries?
[01:32:29] neruda: sevenseacat: gimme a second to triple check perms
[01:32:43] Radar: neruda: Delete C:/Ruby193 completely
[01:32:47] Radar: neruda: Close down command prompt.
[01:32:48] sevenseacat: crankharder: well guess what, its not working for neruda
[01:32:51] neruda: crankharder: actually until now the entire windows experience has been sooooo smoooth
[01:32:54] Radar: neruda: Re-install using: http://railsftw.bryanbibat.net/
[01:40:58] microdex: What are some possible things which could be modifying the params between Rack and the Controller Action ?
[01:41:23] sevenseacat: all the rails middleware? :)
[01:41:39] microdex: are there any default middle ware in rails which imports model names ?
[01:41:49] sevenseacat: are you having a specific problem we can help with?
[01:42:09] sevenseacat: great, tell us about that
[01:42:25] microdex: I am getting a key which appears in my params, but that key doesn't exist when the browser makes the request
[01:42:46] microdex: I double checked it in every browser and I also logged the params from inside Rack and the param also doesn't exist
[01:42:58] microdex: its a key called 'tab' which gets appended to the params
[01:43:05] microdex: 'tab' is the name of my Tab model
[01:43:05] sevenseacat: show us the logs?
[01:43:13] sevenseacat: show us the request?
[01:43:28] microdex: i"m gonna create a ulti part gist
[01:46:58] helpa: Clearly explain what is happening and create a Gist (http://gist.github.com) or Pastie (http://pastie.org) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces. A "Full Trace" as opposed to the default "Application Trace" is preferred. NO FAKE CODE. If you're under an NDA, we cannot help you with your problem. Go hire a consultant.
[01:48:01] crankharder: whats rule 1 and 2?
[01:48:08] helpa: https://gist.github.com/996779
[01:48:35] neruda: brb, gonna reboot and follow Radars advice
[01:48:53] crankharder: helpa gets really upset about pastie
[01:49:16] sevenseacat: no, about pastebin
[01:49:51] crankharder: swore he hates on pastie too
[01:51:21] helpa: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[01:51:35] Radar: Shortened it, added a link to using-gist guide and removed pastie link
[01:51:44] Radar: You give people choice and their brains just freak the fuck out
[01:53:18] helpa: A "Full Trace" as opposed to the default "Application Trace" is preferred.
[01:53:20] helpa: NO FAKE CODE. If you're under an NDA, we cannot help you with your problem. Go hire a consultant.
[01:53:43] dwaynemac: new here, where can i read these rules?
[01:53:55] helpa: https://gist.github.com/996779
[01:54:19] andll: Radar, on deleting a join table entry do you happen to know why the DELETE call is replaced by [[nil, nil]] in these Pry logs? http://pastie.org/private/ki4nlz6nyuhx6wuqp9rww
[01:55:11] Radar: Topic is 4.1.2 has been released! http://goo.gl/HsefiY | Newest releases: 4.1.2, 4.0.6, 3.2.18, 3.1.12 | Guides: http://goo.gl/Drh96 | API Docs: http://goo.gl/ErSVb | Mailing List: http://is.gd/3Euc | Rules: http://goo.gl/dgSj5 | MINASWAN (Matz is nice and so we are nice) | You are being logged. Logs are at http://goo.gl/e9X9X
[01:55:34] sevenseacat: andll: what is @closet_item ?
[01:56:01] Radar: andll: no clue
[01:56:10] sevenseacat: is it a HABTM table that has a primary key when it shouldnt?
[01:56:34] sevenseacat: need some context here
[01:56:40] andll: sevenseacat: : create_table "closets_items", id: false,
[01:57:06] andll: I don't believe it has a primary key, only closet_id and item_id
[01:57:07] sevenseacat: so is it not a HABTM table that should have a PK and doesnt?
[01:57:19] sevenseacat: if you have a model for it, its not HABTM
[01:57:26] lilVaratep: my ruby on rails app works on my local machine but when I try to deploy to heroku, it gives me a NoMethodError ???block in singleton class??? in an html.erb file that im using for pdf generation with PDFKit. any suggestions?
[01:58:25] andll: sevenseacat: I will add more context
[01:58:26] Radar: andll: Can you repro this in a new app?
[01:58:45] Radar: lilVaratep: No logs? No stacktrace? That's literally all the information you've got to go on?
[01:58:51] sevenseacat: andll: i think you just need to have a PK on the table, as that is what its trying to destroy by
[01:59:26] andll: sevenseacat: Alright, I'll try that. I read some article elsewhere AGAINST primary keys -- but I forget the circumstances
[01:59:40] sevenseacat: on a HABTM table.
[02:02:13] andll: sevenseacat: Here are my model relationships http://pastie.org/private/lavpoyjfofgxyk0i8uqkrq . I have both a HABTM and a has_many through
[02:02:57] lilVaratep: Radar: http://f.cl.ly/items/2W1T1Y0b3U0S0t0A2B2U/Image%202014-06-29%20at%206.59.12%20PM.png is what i get returned when i try to deploy
[02:02:59] sevenseacat: right, so ClosetsItem shouldnt exist as a model if its a HABTM
[02:03:16] Radar: lilVaratep: Is copying and pasting broken on your computer?
[02:03:33] Radar: lilVaratep: No code from pdftemplate.html.erb?
[02:03:39] andll: sevenseacat: thanks you, i'll try deleting the model
[02:04:11] sevenseacat: and in your destroy action you would just do something like @closet.items.delete(@item)
[02:04:18] sevenseacat: or destroy or something
[02:04:30] lilVaratep: Radar: http://pastebin.com/96ixydNn
[02:05:03] microdex: Here it is: https://gist.github.com/anonymous/8f725d6ed19251c161e8
[02:05:16] microdex: Just trying to figure out HOW that 'tab' key is being added to the params[]
[02:05:26] andll: sevenseacat: Thanks. I'll have to research HABTM further to figure out the creation/deletion
[02:05:43] microdex: When I Log it from Rack it also doesn't exist. Just appears in Rails
[02:05:48] Radar: microdex: You're missing the form.
[02:05:50] lilVaratep: Radar: https://gist.github.com/varatep/b439a780901774bf6a48
[02:06:04] Radar: lilVaratep: https://gist.github.com/varatep/b439a780901774bf6a48#file-pdftemplate-html-erb-L34
[02:06:11] Radar: lilVaratep: @a_retailer on your production server is returning nil
[02:06:14] sevenseacat: what doesnt exist, where?
[02:06:24] microdex: Radar: when its logged from Rack the params doesn't have 'tab'
[02:06:33] Radar: microdex: proof?
[02:07:22] sevenseacat: i'm not seeing the param tab anywhere
[02:07:36] Radar: sevenseacat: scroll right in the JSON_IN_PARAMS part, it's there
[02:08:11] sevenseacat: i had scrolled but lack of syntax highlighting wasnt making it stand out
[02:08:12] lilVaratep: Radar: i checked the database via pgadmin3 and there are records in that table. my localdb is also a copy/backup with same data from the production db
[02:08:35] Radar: lilVaratep: No, you're not understanding that at all. In your controller, @a_retailer is nil.
[02:08:51] Radar: Nothing to do with the data IN your database, more to do with what you're (not) fetching from your database.
[02:08:59] Radar: microdex: Can you repro in a new app?
[02:09:09] microdex: I logged it from Rack Request while inside RubyMine Fast Debugger
[02:09:40] microdex: Reproduce this in a new app ? Noep
[02:09:57] microdex: just trying to figure out HOW that 'tab' is getting in there
[02:10:01] Radar: nothing that I can see is adding that tab
[02:10:09] Radar: All your middlewares are normal
[02:10:15] sevenseacat: how is only half the data in that tab hash
[02:10:25] Radar: logs don't indicate anything funny happening
[02:10:26] sevenseacat: how exactly are you making this post request?
[02:10:32] microdex: sevenseacat exactly , HOW
[02:10:37] Radar: At a guess, https://gist.github.com/anonymous/8f725d6ed19251c161e8#file-tabs_controller-L55 is doing it
[02:10:48] Radar: But I don't know for certain because I can't reproduce it within a new app ;)
[02:11:04] microdex: The request is being made by backbone.js
[02:11:10] Radar: load_overview_data is mysteriously missing too
[02:11:24] sevenseacat: ACTION runs really far away from conversation
[02:11:30] microdex: sevenseacat what? backbone sucks ?
[02:11:35] Radar: microdex: I am not sure if anyone here can really help you then... given it's such a complex problem. This would be better solved by someone who can work with the code with you.]
[02:11:40] Radar: i.e. over a google hangout or something
[02:13:09] microdex: because backbone.js isn't doing it , the JSON in the gist is the exact same request from POST body right out of DevTools Network panel and I get the same when I log it from Rack::Request
[02:13:23] microdex: Its only when it hits Rails that the 'tab' param appears
[02:14:55] microdex: I am so stuck on this one
[02:15:30] sevenseacat: sorry, i havent seen rails mysteriously splitting params in half and deciding to nest half of them, before.
[02:15:33] microdex: not even sure how to proceed next, was going to use FastDebugger and step-through a bunch of breakpoints in Rack::Request until I hit the controller
[02:16:05] sevenseacat: suspect its something to do with the request being made.
[02:16:55] microdex: Yeah thats what I thought , but its totally not in the request, as evidenced by the gist and Rack::Request
[02:17:25] sevenseacat: 'as evidenced by Rack::Request'?
[02:17:29] Radar: microdex: Hire someone to look over the code with you.
[02:18:08] microdex: sevenseacat , yes when I add breakpoints to Rack Request I can see the request before it hits Rails , and the param is not in POST body.
[02:18:24] microdex: Radar good idea but I don't have that kind of cheese right now.
[02:18:28] sevenseacat: why is that not in the gist :(
[02:19:05] kies: i hope those arent your real keys microdex D:
[02:19:08] microdex: sevenseacat , because the FastDebugger has a realtime tree view of the local methods and vars and isn't cut and pastable text
[02:19:23] microdex: kies they are not real keys , thanks
[02:20:05] microdex: I can try to print it to the log real fast
[02:42:16] Sirele: |Hola|Hello|
[02:45:43] Sirele: rails-4.1.2 O.o is good idea upate now?
[02:46:48] kies: nothing dramatic changed if youre already on 4.1 so yes
[02:47:35] zrl: what's the best way to represent an arbitrary duration of time in rails?
[02:47:48] sevenseacat: a time field?
[02:48:08] zrl: as an int of seconds? or as a time? when i used :duration as the type in my migration, it made it time
[02:48:18] zrl: but the http://stackoverflow.com/questions/1051465/using-a-duration-field-in-a-rails-model
[02:48:32] swemoney: I???ve never done an admin/moderator user before. Is just adding a ???is_admin??? attribute to the user model good/secure enough?
[02:48:34] zrl: *but the top answer in http://stackoverflow.com/questions/1051465/using-a-duration-field-in-a-rails-model recommends an integer field, so i'm wondering if there are any advantages of that
[02:48:47] zrl: swemoney: yeah
[02:49:04] zrl: if your roles become more complex, you may want to look into a more flexible way of handling roles
[02:49:09] sevenseacat: zrl: it deiends on your use case
[02:49:38] zrl: swemoney: i've enjoyed https://github.com/elabs/pundit, but it may be overkill for what you need
[02:50:26] sevenseacat: i mean, 'representing a time' is best time with a time field, but depending on what that time means, how precise it needs to be, and what calculations may need to be done to it, will affect the answer
[02:50:29] swemoney: zrl: cool. right now it???s pretty simple. figured i???d set the is_admin from the console on a very limited basis and they just need access to be able to delete stuff that doesn???t belong.
[02:50:53] zrl: swemoney: yeah, i'd just go with an is_admin field then
[02:51:14] zrl: sevenseacat: alright
[02:51:20] swemoney: zrl: thanks
[02:51:29] zrl: so, to give a bit more background, i have an event model that represents an event at a venue (like a concert)
[02:51:30] Sirele: I see @kies
[02:51:42] zrl: the event has a datetime field for date that stores when the event starts
[02:51:51] zrl: it then has a field for duration, that specifies how long the event is
[02:52:01] Sirele: ILl update I am use rails 4.1.1 xD
[02:52:18] FifthWall: lilVaratep, it's not hitting your DB or your controller. You have that template in `app/assets/` so it's being precompiled. Move that template - and anything else you want to be dynamic - out of `app/assets/`
[02:52:25] zrl: i'm not sure if a time field or if an integer field would make the most sense for this. i'm leaning towards integer, but i'm not sure if there are any repercussions of that.
[02:52:27] sevenseacat: personally i'd store a separate end_time
[02:52:44] sevenseacat: and not worry about a duration
[02:53:05] sevenseacat: but a time field for a duration would work just fine
[02:53:26] zrl: sevenseacat: i would too, but the backend is just an api and the frontend contractor has already been given a spec that i don't have a say in changing
[02:53:49] zrl: the spec doesn't specify what type it needs to be and the frontend person hasn't gotten to the stage where they need it yet
[02:53:54] sevenseacat: i'm not sure what that has to do with the problem
[02:54:07] sevenseacat: if the frontend requires you to send a duration field, you can do that no matter how its stored
[02:54:55] Sirele: I think I should improve my English
[02:55:31] zrl: sevenseacat: ah, that's a good point.
[02:56:30] sevenseacat: start/end times can make sense and start/durations can make sense too
[02:56:44] sevenseacat: much easier to do scheduling and the like with a start/end time
[02:57:08] sevenseacat: much easier to do validations etc. with a start time + duration
[03:10:17] microdex: hey sevenseacat
[03:10:20] microdex: I figured it out
[03:10:26] microdex: its params_wrapper.rb
[03:10:52] microdex: request.request_parameters.merge! wrapped_hash
[03:11:34] microdex: I put breakpoints in Rack and arrived at this little beauty
[03:12:23] mubi: Hey guys, anyone have any suggesstions on where I can find my first dev job for RoR in Canada?
[03:12:57] mubi: besides craigslist, bestjobs4grads workopolis, monster, linkedin, the usual
[03:37:38] microdex: I figured it out everybody its params_wrapper.rb
[03:37:55] microdex: it appends keys to params based on model properties
[03:38:58] Radar: microdex: oh right, because it's a JSON request.
[03:43:36] kies: mubi, you could try going to meet ups or find local dev shops in your area with apprenticeship programs
[03:44:05] mubi: yea ill do the meetups thing in Toronto, cool thanks
[03:47:04] microdex: Radar: so what does that mean , if its a JSON request ?
[03:47:17] Radar: microdex: It means that ParamsWrapper comes into play
[03:47:31] microdex: why and how does the params wrapper come into play ?
[03:47:32] Radar: I should've noticed earlier but I was hungry and not paying that much attention
[03:48:01] sevenseacat: ive seen the params wrapper impact json output - not so much parsing input
[03:48:19] microdex: well , thats whats doing it
[03:48:55] microdex: i can see it coming into Rack without the extra params, and then the params_wrapper gets involved and suddenly there is a partial copy of the params within the params.
[03:49:50] microdex: Its misleading that log level 0 writes the params to the logs AFTER they have been adulterated. You guys think so?
[03:50:17] sevenseacat: well no, it prints the params as rails has interpreted them
[03:50:51] microdex: yeah but it says Starting POST --- params
[03:51:01] microdex: that means , here are some parameters coming in
[03:51:35] sevenseacat: i dont know what youre looking at
[03:51:42] microdex: the Rails logs say Starting POST then the URL and then Params , which are actually not the params coming in.
[03:51:54] microdex: Thats misleading
[03:52:06] sevenseacat: well no, because rails has done a whole heap of shit before it even gets to that point
[03:52:15] microdex: no it hasn't
[03:52:23] sevenseacat: its decided what method the request is, its decided the params, etc.
[03:52:32] sevenseacat: its decided the route to hit, etc.
[03:52:47] microdex: right ,all I'm saying its misleading
[03:52:57] Radar: # Wraps the parameters hash into a nested hash. This will allow clients to submit
[03:52:57] Radar: # POST requests without having to specify any root elements.
[03:53:03] Radar: top comment of ParamsParser
[03:53:04] sevenseacat: just because you misinterpreted it, doesnt mean its misleading :P
[03:53:08] Radar: Oh wait nobody reads docs sorry my bad
[03:53:12] sevenseacat: just means you didnt know what it meant
[03:53:28] Radar: microdex: btw, those params coming in are the params arriving at the controller, not at the routing level.
[03:54:34] microdex: All I'm saying is that the Rails logs don't tell you what request is arriving
[03:55:09] microdex: to me showing the URL and the params and saying "starting POST" is misleading
[03:55:18] microdex: its not 'misinterpreting' anything
[03:55:42] microdex: to get whats arriving at the gate of your webserver requires spelunking in Rack::Request
[03:55:54] microdex: maybe I'm an exception , but to me that simply does not make sense
[03:56:00] microdex: its a misleading assumption, I apologize
[03:56:01] sevenseacat: it is if you think that that output means 'this is the very start of rails processing the request'
[03:56:02] Radar: Or understanding that wrap_parameters is a feature of Rails.
[03:56:22] microdex: radar , yep
[03:56:24] sevenseacat: its the start of *your code* processing the request
[03:56:51] Radar: https://github.com/rails/rails/blob/455678550a8af96f25b2e779d0c3e977d2c7b32e/actionpack/lib/action_controller/log_subscriber.rb#L6-L16
[03:57:22] microdex: If it were up to me I would vote to immediately change that functionality
[03:57:56] sevenseacat: good thing its not up to you
[03:58:01] microdex: hAHHAHA HAHAH
[03:58:35] microdex: sevenseacat , I'm gonna talk to Dave and make my case
[03:58:43] sevenseacat: if you really feel strongly about it, file an issue about it
[03:58:48] sevenseacat: see what core team says
[03:59:24] sevenseacat: i think what you want will make debugging a boatload harder fort everyone
[03:59:44] microdex: anyway, sevenseacat Radar thanks for the help
[03:59:51] sevenseacat: 'oh, what you see in the logs isnt necessarily what your code can use'
[04:00:22] microdex: sevenseacat , i'm not suggesting anything be taken away , only added for clarity so you can immediately rule out stuff like backbone.js malforming requests etc.
[04:00:27] Radar: microdex: bro
[04:00:32] Radar: wrap_parameters.rb
[04:00:39] sevenseacat: 'your logs say its a post request but your routes will actually interpret it as a delete request'
[04:00:48] Radar: ActiveSupport.on_load(:action_controller) do
[04:00:48] Radar: wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
[04:00:50] Radar: Comment out ^
[04:01:25] microdex: :) hHAHAHAHH , thanks
[04:01:34] microdex: I'm more just bantering philosophically
[04:02:33] microdex: Now that I know the functonality I don't care that much, it just wouldn't hurt to have access to the raw request in the logs, thats all I'm saying
[04:02:46] microdex: How would it hurt to have access to raw reqeust data in the logs ?
[04:03:23] Radar: Add another middleware to do it.
[04:03:24] microdex: Then you could see exactly whats coming in over the network
[04:03:25] sevenseacat: depends how you would present it
[04:03:49] sevenseacat: i think it has the potential to be very misleading
[04:04:18] microdex: Radar , totally
[04:05:16] microdex: SO, long story short is POST requests with JSON body get appended to the params with name of path and keys in model ?
[04:05:19] microdex: how does the whole thing work
[04:05:36] microdex: is there a short answer or do I have to go through the source ?
[04:06:02] microdex: it looks like its using the PATH to determine which model it is and copy the properties of that model out of params into a sub key
[04:06:15] Radar: Documentation is your friend.
[04:06:19] Radar: params_parser.rb
[04:06:28] Radar: Uh, not that one.
[04:07:03] Radar: params_wrapper
[04:07:15] Radar: https://github.com/rails/rails/blob/4-0-stable/actionpack/lib/action_controller/metal/params_wrapper.rb#L7-L70
[04:07:24] microdex: Thanks Radar
[04:07:44] microdex: Ruby is such a weird and cool language
[04:08:23] microdex: have you guys notice that => hash rockets are going away lately ?
[04:08:34] microdex: I see them less and less in other peoples code
[04:09:20] sevenseacat: if by lately you mean the last couple years, then yes
[04:09:26] sevenseacat: since ruby 1.9 came out
[04:09:46] microdex: because they are still valid right? but this: is just cleaner or what?
[04:09:59] microdex: yeah I feel that
[04:10:21] microdex: I wasn't feeling => that much anyway, looks too much like greater than or equal to
[04:11:14] sevenseacat: well you still need it in some cases
[04:11:21] microdex: like when ?
[04:11:26] sevenseacat: well yes, if your hash keys are not symbols
[04:12:50] microdex: it would be nice to just be able to do "key":"val" like JS
[04:13:18] microdex: instead of "key"=>"val" or key: val
[04:13:57] microdex: besides the memory managment stuff , whats the utility of :symbols over "strings" ?
[04:14:37] microdex: and how is that useful ?
[04:14:48] microdex: like whats the example of that being useful
[04:15:14] microdex: if I may ask
[04:15:47] sevenseacat: prevents developer mistakes, ive found
[04:16:49] microdex: prevents mistakes ? hmmm
[04:17:14] microdex: wasn't it originally a memory management strategy a la C+ pointers ?
[04:17:33] microdex: it was supposed to supplant pointers from C , no ?
[04:17:34] sevenseacat: i have no idea.
[04:18:19] kies: yeah symbols dont get garbage collected i believe
[04:20:39] microdex: no symbols ever get garbage collected ?
[04:20:50] sevenseacat: as far as i know
[04:21:02] microdex: that sounds like a bad idea
[04:21:12] sevenseacat: has worked well so far.
[04:21:27] microdex: everyone uses those things like they're going out of style , as hash keys , inside methods
[04:21:41] microdex: yeah but so has Java
[04:21:51] microdex: Java has 'worked so far' doesn't mean there isn't a better way to do it
[04:22:04] sevenseacat: by all means, file an issue with ruby core team too.
[04:22:18] sevenseacat: 'the way youve been using symbols for 20 years is bad and you should feel bad'
[04:22:25] microdex: hAHAHAFHhahhaah
[04:23:01] microdex: I think they feel SO bad about it they won't admit it
[04:23:24] microdex: like , whats the clear reason to use symbols over strings , other than 'thats just the way we've always done it'
[04:24:32] sevenseacat: of course. you are right, everyone else is wrong.
[04:24:57] microdex: well , i'm googling around about it and its all about memory management and performance
[04:25:14] microdex: there isn't any published reasons WHY they are better with regards to efficient representation of logic
[04:25:36] sevenseacat: and those first two arent reason enough for you?
[04:25:36] microdex: plus I'm not trying to 'be right' I just want answers
[04:25:47] microdex: Thats machine level stuff
[04:25:51] sevenseacat: arent you a special snowflake then
[04:26:02] sevenseacat: what a waste of a morning this conversation has been
[04:26:16] microdex: well , that is the SAME reason were moving towards dynamically typed languages
[04:26:19] microdex: its machine level
[04:26:57] microdex: sevenseacat I appreaciate your input, I'm not trying to waste your time or anything like that, I'm just curious and want answers to what may appear to you as obvious questions
[04:27:47] microdex: if no one asked these kinds of basic questions we would still be using C pointers or strict typing instead of offloading that to a machine and focusing on human logic
[04:28:41] microdex: garbage collectors were invented for precisely this reason
[04:29:05] microdex: taking explicit memory deallocation out of the programmers itinerary of worries
[04:29:14] microdex: just like dynamic typing
[04:29:30] microdex: and if symbols are a memory management strategy then I wonder
[04:31:18] kies: usually you would use symbols for as an identifier for keys that dont change, a string would be for dynamic keys
[04:32:05] microdex: what are dynamic keys ?
[04:32:28] kies: maybe you generate hash keys like "custom_33929"
[04:32:51] kies: those things you would want garbage collected
[04:33:24] microdex: while hard coded hash keys you would want to never garbage collect?
[04:33:42] kies: right because its going to be more expensive to reinitialize a string and have to garbage collect it
[04:33:57] kies: whereas you can just grab the symbol object from memory
[04:36:32] microdex: Do you guys use Step-Through debuggers ?
[04:37:10] microdex: or can recommend any good ones ?
[04:37:44] microdex: In Java et al there are some pretty awesome debug socket apps which really let you dive into the app at runtime
[04:38:01] microdex: Just wondering if there is somethign like that for Ruby / Rails ?
[04:39:17] kies: i think theres addon for pry called pry-debugger for that but im not sure how up to date it is
[04:39:27] k776: Hey. I'm looking for a a bunch 3rd party services to compare that handles user uploads, like transloadit.com
[04:39:37] k776: Anyone use one that is really good?
[04:39:48] codesoda: k776: tried CORS posts to s3?
[04:40:23] k776: codesoda: We're using rackspace cloud files, so ideally the uploader service supports rackspace cloud export
[04:49:02] andll: I'm trying to create a relationship between my models similar to that of the service Pinterest. I've outlined my problem here if anyone can help: http://pastie.org/private/yka99pgcczxmgiuaf2xg
[04:50:18] sevenseacat: what is the point of the AlbumPhoto model?
[04:50:50] andll: the only point would be for a controller. Otherwise I don't know the best way to create/destroy the album-photo relationship
[04:51:19] sevenseacat: well models are independent from controllers
[04:51:40] sevenseacat: why have you elected to have a has_many through as opposed to a has_and_belongs_to_many ?
[04:51:50] andll: so perhaps I could to HABTM relationship with an album-photo controller
[04:52:21] andll: my main confusion surrounds the album-photo create/destroy relationship
[04:52:47] sevenseacat: well thats also independent of your controllers
[04:52:52] sevenseacat: rails provides methods to do that for you
[04:54:22] andll: The problem I see is that I would either have to add more complex logic to an existing CRUD action. Or to create an action outside of CRUD. Or to simply create a new controller for create/destroy of album-photo
[04:54:37] sevenseacat: the last one would make more sense
[04:55:32] andll: Alright, that's the method that feels most intuitive to me as well. I'll run with that. Can you see any problems with the setup?
[04:55:37] sevenseacat: in the past ive done that by nesting controllers inside namespaces, eg. for this scenario you might have an Albums::PhotosController
[04:56:04] andll: I'll have to look that up
[04:56:11] pipework: Why aren't controllers namespaced in the application, that's what I pretend to want to know, but am really just skeptical about.
[04:57:16] sevenseacat: and the controller would take an album ID and a photo ID, and have two actions - create and destroy
[04:57:18] andll: the only reason is I'm not very familiar with namespacing. I'll look into it
[04:57:40] sevenseacat: but then again im one of those people who dislikes using HMT for the sake of it
[04:58:48] pipework: andll: module AConstant; class MyController < ApplicationController; end
[04:58:53] pipework: You dun namespaced, bru
[04:59:05] andll: thanks sevenseacat & pipework
[05:37:07] hypnosb: how can I generate a controller from a template? I try generate (:controller, "home") but get: unexpected ',', expecting ')' (SyntaxError) ?
[05:40:15] helpa: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[05:43:36] hypnosb: jesus christ thats all there is
[05:44:12] sevenseacat: ACTION shrugs
[05:53:35] speakingcode: how does one do a simple select_year for a nested form model?
[05:54:28] speakingcode: i've tried using :prefix but it doesn't seem to take the form of nested_submodels_attributes[n][field_name]
[05:57:30] pipework: hypnosb: then it's a pebkac error.
[05:59:09] hassanshaikley: So there are profiles that have a field as null, the fields name is additional info
[05:59:09] hassanshaikley: Profile.where(:additional_info => nil).count returns 0
[05:59:09] hassanshaikley: but there are profiles on the servers with additional_info as null. I am perplexed.
[05:59:25] hassanshaikley: I need to iterate through all of them to change additional_info to a value, because or else it causes a ton of issues
[06:05:43] sevenseacat: are they null, or empty?
[06:06:31] digitalknight: if i want to set a callback for a function that should always be called when a session is destroyed,how can i do that?
[06:06:57] sevenseacat: where are you destroying sessions?
[06:13:22] digitalknight: sevenseacat: i am not explicitly destroying them, but i need a calback when they are automatically destroyed
[06:13:30] hassanshaikley: sevenseacat they are nil
[06:13:45] hassanshaikley: so like profile.additional_info
[06:14:02] hassanshaikley: but Profile.where(:additional_info => nil) doesnt bring it up
[06:14:14] sevenseacat: hassanshaikley: and yet Profile.where(additional_info: nil) is empty
[06:14:31] sevenseacat: what sql is that command generating?
[06:14:31] hassanshaikley: I don't understand = (
[06:14:55] hassanshaikley: "SELECT \"profiles\".* FROM \"profiles\" WHERE \"profiles\".\"additional_info\" IS NULL"
[06:15:12] rvanlieshout: what part of that don't you undestand?
[06:15:20] sevenseacat: are you running the command on the right database? :)
[06:15:44] hassanshaikley: Profile.all.count
[06:15:47] rvanlieshout: profile.methos(:additional_info).source_location
[06:16:01] sevenseacat: that doesnt mean its the right one with null additional_info records
[06:17:06] rvanlieshout: what does profile.method(:additional_info).source_location return?
[06:17:21] sevenseacat: show us you finding a record that you think should be matched by that query, and then that query not working?
[06:17:29] hassanshaikley: ["/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.5/lib/active_record/attribute_methods/read.rb", 58]
[06:17:47] rvanlieshout: just to check that method hasn't been changed
[06:17:59] sevenseacat: making sure you havent overridden the method to return nil or something silly :P
[06:18:44] digitalknight: sevenseacat: i just checked,i need the callback when the user closes the tab/window
[06:18:46] rvanlieshout: now a SELECT id, additional_info FROM profiles WHERE additional_info IS NULL
[06:18:49] rvanlieshout: in a sql console
[06:19:06] hassanshaikley: a.additional_info
[06:19:06] sevenseacat: digitalknight: on the server? you're not going to get it
[06:19:28] hassanshaikley: when I manually make additional_info nil it works
[06:19:43] rvanlieshout: run that sql statement...
[06:19:57] hassanshaikley: but people keep emailing saying edit profile doesnt work (which means that additional info is nil)
[06:20:03] hassanshaikley: or that reset password doesnt owrk
[06:20:06] sevenseacat: at best you might be able to fire off a js request on page unload but no guarantees
[06:20:10] hassanshaikley: so I keep discovering profiles with that field that is nil
[06:20:18] sevenseacat: hassanshaikley: still waiting to see it
[06:20:19] hassanshaikley: but it doesn't show up when I explicitly set it to nil in console
[06:20:40] hassanshaikley: bc when I changed it for one profile and did validate => false, it came up in the where thing is nil
[06:21:02] hassanshaikley: but I am almost certain there are profiles with that field as nil
[06:21:05] rvanlieshout: i really don't follow you
[06:21:11] rvanlieshout: then run that sql statement...
[06:21:19] sevenseacat: well if you cant demonstrate it, we cant help you
[06:22:32] digitalknight: sevenseacat: so no way to set a callback when a window is closed?
[06:22:32] sevenseacat: (14:20:04) sevenseacat: at best you might be able to fire off a js request on page unload but no guarantees
[06:22:32] digitalknight: oh,sorry,missed that
[06:22:32] digitalknight: ohk,let me try that,thanks!
[06:22:36] sevenseacat: its not reliable
[06:22:41] sevenseacat: i would question why you need this
[06:23:07] digitalknight: sevenseacat: if the user accidentally closes a tab, i want to store the data in session to a table
[06:23:10] hassanshaikley: Profile.all.pluck(:additional_info).to_s.include?'nil'
[06:23:28] sevenseacat: the fuck, hassanshaikley
[06:23:37] hassanshaikley: sorry, man. my mind is fucked rn.
[06:23:40] hassanshaikley: I will get some rest.
[06:23:42] sevenseacat: you were given a simple command to run
[06:24:00] rvanlieshout: hassanshaikley: several times
[06:24:02] rvanlieshout: RUN THAT SQL COMMAND
[06:24:31] hassanshaikley: oh i'll run it now
[06:24:38] sevenseacat: digitalknight: why are you not just using db-backed sessions then?
[06:24:56] sevenseacat: if normal browser sessions are not persistent enough for you
[06:25:18] digitalknight: sevenseacat: me never knew of that,thanks!
[06:26:37] hassanshaikley: the query didnt return anything = (
[06:26:49] sevenseacat: then there are no records with additional_info null
[06:26:52] hassanshaikley: it returns something when I go in and change my additional_info to nil, forcefully
[06:27:20] sevenseacat: thus the Profile.where(additional_info: nil) query being empty is correct
[06:27:24] hassanshaikley: but people are emailing me about a bug they get, and it is because additional_info is nil, so I go in and it says additional_info is nil = ( but it's k I'll forget about it...I give up
[06:27:31] hassanshaikley: it won't happen to new users at least...
[06:27:41] sevenseacat: i'm still waiting for you to post an example of a profile with the nil data
[06:28:04] hassanshaikley: whenever it has come up I have fixed it right away! next time we get an email I will let you know >.<
[06:28:19] sevenseacat: you just said there were heaps in your database! cmon
[06:28:32] hassanshaikley: but I have already fixed them!
[06:28:38] hassanshaikley: the ones that I know about..
[06:28:42] sevenseacat: why do you expect Profile.where(additional_info: nil) to not be empty then!?
[06:28:56] hassanshaikley: because I accidently removed validation
[06:28:59] hassanshaikley: for a small period of time
[06:29:12] sevenseacat: 'i have absolutely no proof of there being a data integrity problem BUT I SWEAR ITS THERE'
[06:50:36] ksinkar: anyone here using the debugger with passenger?
[06:56:53] rvanlieshout: ksinkar: have a look at better_errors
[06:58:06] ksinkar: rvanlieshout: will it work with the multiprocess environment of passenger?
[06:58:28] sevenseacat: are you using passenger in dev or trying to debug stuff in production?
[06:58:34] sevenseacat: either scenario sounds a bit odd
[07:01:02] ksinkar: sevenseacat: on the staging server, not production. The problem is that I am building something that needs a public facing DNS entry which is accessible from the internet outside our intranet. It is a configuration with an API service that needs the URL endpoints on both the sides. I am trying to make it work and hence I need a debugger on my staging environment which is running phusion passenger builtin as apache module
[07:01:25] hassanshaikley: IT IS AN EMPTY STRING
[07:01:54] Macaveli: Morning all :)
[07:02:40] sevenseacat: the mystery is solved :) its not actually nil
[07:02:41] sevenseacat: afternoon Macaveli
[07:02:41] sevenseacat: lol bye Macaveli
[07:02:44] duyleekun_: I'm having problem with rake routes
[07:03:07] duyleekun_: Executing rake routes will output empty prefix :(
[07:03:11] duyleekun_: main_homepage_report POST /report(.:format) main/reports#create new_main_homepage_report GET /report/new(.:format) main/reports#new edit_main_homepage_report GET /report/edit(.:format) main/reports#edit GET /report(.:format) main/reports#show
[07:03:41] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[07:06:07] duyleekun_: https://gist.github.com/duyleekun/f86638fef90e4d7210df
[07:06:48] duyleekun_: Therefore, if i'm looking for main/reports#show prefix
[07:07:39] duyleekun_: I have to look up and get new_main_homepage_report instead of main_homepage_report
[07:07:39] sevenseacat: what exactly is the problem
[07:08:14] duyleekun_: What would be the prefix for GET /report(.:format) main/reports#show ??
[07:11:46] sevenseacat: not sure what you mean by prefix, but you should be able hit the route with the named routes `main_homepage_report_path`
[07:12:51] duyleekun_: But I'm wondering why named path for main/reports#show is empty
[07:13:08] duyleekun_: And look up 1 row above doesnt help
[07:13:58] duyleekun_: I'm writing gem to generate path in javascript that suits my needs
[07:13:59] duyleekun_: https://github.com/EnoLabs/rails-routes-js-utils
[07:14:23] duyleekun_: And I just discovered this now
[07:15:02] sevenseacat: fun - what kind of use case does that gem serve?
[07:15:50] sevenseacat: coupling JS to a backend implementation seems kinda risky
[07:16:07] duyleekun_: It will generate this
[07:16:08] duyleekun_: https://gist.github.com/duyleekun/ef94eecc10434090b30b
[07:16:26] sevenseacat: not what i asked
[07:16:46] duyleekun_: I'm using angularjs
[07:16:58] duyleekun_: And I need to generate path and do routing manually in javascript
[07:17:27] duyleekun_: Rails is a json backend only
[07:17:59] sevenseacat: its more than just a json backend if you're coupling it to your frontend with these route helpers
[07:18:09] duyleekun_: Therefore, I need all the regex goodies from rails routers :)
[07:19:07] duyleekun_: This gem's been usable for us until we need the 'new' route
[07:21:40] duyleekun_: What I'm asking is whether https://gist.github.com/duyleekun/f86638fef90e4d7210df is a buggy output from rake routes
[07:22:58] sevenseacat: not really. the route has the same prefix as the other route with the same URL - they could be ordered better though
[07:23:25] duyleekun_: IMO, ordering is quite important in this case
[07:23:51] sevenseacat: only if youre trying to scrape the output :P
[07:24:02] sevenseacat: reordering those two routes makes zero difference to your app
[07:27:47] quazimodo: ACTION prods the kitty
[07:28:23] sevenseacat: good afternoon
[07:28:52] duyleekun_: I'm not scraping the output
[07:29:22] duyleekun_: I'm accessing Rails.Application.routes
[07:29:29] sevenseacat: so whats the problem then? :/
[07:29:39] sevenseacat: are you suggesting there's a bug in there?
[07:30:08] duyleekun_: Not sure if it's important
[07:30:22] duyleekun_: But it's critical to my gem
[07:30:29] duyleekun_: The the like that uses Rails.Application.routes :)
[07:30:43] sevenseacat: so... what bug are you suggesting? i have no idea, all you've shown is rake routes output
[07:31:19] duyleekun_: I'm just wondering why some routes have empty named route
[07:31:59] sevenseacat: because they have the same name as the other routes with the same URL
[07:32:30] duyleekun_: So, when I use rake routes
[07:32:44] duyleekun_: And I want to get the name for reports#show
[07:33:02] duyleekun_: I have to look around
[07:33:15] duyleekun_: Instead of look up one row above
[07:33:26] duyleekun_: Or right at that row
[07:34:01] duyleekun_: Quite a bad convention imo
[07:36:10] rushed: duyleekun_: it???s not usually like that (in my experiance routes that share the named helper are together), perhaps a product of your overlapping prefixes
[07:36:15] sevenseacat: yes, we established that the ordering for this case is a bit weird, like most things with singular routing
[07:37:13] rushed: duyleekun_: you might consider investigating and improving it???s behavior for this case :)
[07:38:43] duyleekun_: @rushed: It's broken even in simple case https://gist.github.com/duyleekun/f86638fef90e4d7210df
[07:38:55] duyleekun_: I will fix my gem
[07:39:33] duyleekun_: Just wondering the idea behind its ordering :)
[07:40:50] rushed: duyleekun_: well, they???re alpha in the examples you???re complaining about :)
[07:42:18] duyleekun_: So its group by something and do the alpha :D
[07:48:53] hadifarnoud: I'm using mysql. should I have socket: ? my socket is not the same as the code I'm trying to use
[07:50:21] rvanlieshout: hadifarnoud: it all depends on your settings and what you want
[07:50:54] hadifarnoud: rvanlieshout: I have issues with db:migrate with this code https://github.com/nutamito/persianpreneur
[07:51:55] pipework: lol, nice project name.
[07:52:01] hadifarnoud: can't migrate rvanlieshout. it says Duplicate column name 'profile_picture'
[07:52:25] rvanlieshout: and what about that error needs explanation?
[07:52:37] rushed: hadifarnoud: or suggests a socket issue :P
[07:53:20] hadifarnoud: rushed: I have no idea why this is not working. sometimes crazy stuff do happen :D
[07:53:31] rushed: hadifarnoud: no
[07:53:36] rushed: hadifarnoud: crazy is rare
[07:53:47] hadifarnoud: rushed: but it's not never
[07:53:50] opus: Quick question about rails naming conventions. I have a hard time thinking up adequate names for polymorphic associations. Some make sense like "imageable" etc. How do you guys handle this when you have a table that is named something like 'coordinates'. Coordinateable is just weird but I always have a hard time thinking up a proper name for that relationship.
[07:54:00] rushed: hadifarnoud: ask yourself what 20140624105822_create_people.rb line 9 does, then ask yourself what 20140627060855_add_profile_picture_to_people.rb does
[07:54:14] rushed: hadifarnoud: also http://en.wikipedia.org/wiki/Occam's_razor
[07:54:16] opus: locationable doesn't make sense as a location is not always exactly one coordinate and could denote other things
[07:58:49] opus: Is there any convention that should be followed when that type of naming convention isn't as fluid?
[08:01:24] rushed: opus: mappable? locatable?
[08:02:30] opus: Hm... those make sense if not for the fact that I have multiple mappable or locatable objects. Let me provide some background. Also, thanks for helping!
[08:02:50] opus: In the system I'm building. There are polygons, radial objects, and specific coordinates.
[08:03:04] xshivan: hello. May I have a quick Active Record related question?
[08:03:14] opus: so, a polygon could be mapped, a circle could be mapped, or just a specific location (lat/lng)
[08:03:36] opus: right now, polygon has many coordinates. Not sure how to name them when everything that is generic doesn't seem to cover it in my head.
[08:03:52] opus: xshivan: go for it! No idea if I'll be able to help but better to just ask =)
[08:04:13] xshivan: Thanks, opus. I'm preparing a gist for you with a piece of code
[08:05:46] xshivan: https://gist.github.com/mcywinski/240b0478448f74a4ba26
[08:05:49] xshivan: here are my definitiosn
[08:06:07] xshivan: The idea is that project has members, it's has_many relation
[08:06:16] xshivan: It also has an owner
[08:06:25] xshivan: Now that makes a problem for me in code
[08:07:18] xshivan: I've been trying to add a new member this way: some_user.projects << p
[08:07:36] xshivan: And it was cool, it added him, but also overwritten an owner
[08:07:37] Macaveli: Is it ok to do this in a test Scenario.create! :internal => "EMPLOYEE2POSTING", :external => "UNREGISTERED2POSTING"
[08:08:02] Macaveli: Or do I have to put data in the DB via a fixtures?
[08:08:18] xshivan: I thought about this workaround: p.users << some_user
[08:08:28] opus: looking into the gist now xshivan
[08:08:34] xshivan: but that's a little tricky and I guess there are much mor elegant ways to do this
[08:08:49] xshivan: The question is what's an elegant way?
[08:11:20] poporul: xshivan: "but also overwritten an owner" ??? what do you mean?
[08:11:52] xshivan: in a database in projects table user_id (an owner ID) was overwritten
[08:12:02] opus: just to make sure, user -> project -> users
[08:12:24] xshivan: many users belong to many projects
[08:12:40] xshivan: and one user may be an owner of many projects
[08:14:00] xshivan: So I don't know how to specify that I want to add user ONLY to members of a project, not to add a new owner
[08:14:19] xshivan: or how to specify that I want to add a new owner, not a new project member
[08:14:24] rushed: xshivan: you can???t have two relationships defined under the same property name, call one something else :)
[08:14:53] sevenseacat: Project belongs_to :owner ? :)
[08:15:21] xshivan: that's it?
[08:15:28] xshivan: Will it work in such simple way?
[08:15:36] xshivan: just a change in project model? :)
[08:15:39] opus: Yeah, but you'll have to add one piece on that belongs_to
[08:15:43] opus: if I understand correctly
[08:15:46] sevenseacat: well you'll need to specify the class of that association
[08:15:51] sevenseacat: otherwise it will look for an Owner model
[08:15:57] opus: belongs_to :owner, class_name: "User"
[08:16:13] xshivan: that's brilliant and stupid simple!
[08:16:32] xshivan: Let me test it
[08:16:36] xshivan: ACTION goes to test it
[08:17:00] opus: sevenseacat: any suggestions as it pertains to my naming convection for polymorphic associations?
[08:17:15] sevenseacat: i wasnt paying attention - what was your problem?
[08:17:15] opus: If you wish to continue to spread joy
[08:17:40] sevenseacat: not knowing what to call polymorphic associations?
[08:17:43] opus: Basically, with polymorphic associations there is the naming convention of calling something -able, such as "imageable" etc.
[08:17:53] opus: when you have multiple objects that share a generic ... for example
[08:18:02] opus: I have polygons, circles and points that can be "mapped" onto something
[08:18:06] sevenseacat: yeah i think that -able syntax gets stupidly overused
[08:18:14] xshivan: I'm going to thank you in a moment
[08:18:21] xshivan: let me just rewrite a bit of my code
[08:18:35] opus: agreed... I've been lazy and just put -able to whatever my object is but it reads horribly
[08:18:36] sevenseacat: so theyre... mappable? >_>
[08:18:42] opus: all of them are though.
[08:18:54] opus: Whereas coordinate is the one that is polymorphic
[08:18:56] sevenseacat: (sometimes it does work, though)
[08:18:58] opus: but so is polygon
[08:19:10] xshivan: I've changed my model to: belongs_to :owner, class_name: "User"
[08:19:32] xshivan: In my controller: p.owner << some_user
[08:19:46] universa1: xshivan: p.owner = some_user
[08:19:47] opus: owner in that case is a singular object not an array
[08:19:53] xshivan: Okay, sorry for newbie stuff
[08:20:11] universa1: xshivan: User has_many :owned_projects, foreign_key: :owner_id, inverse_of: :owner ;)
[08:21:14] xshivan: How do I specify it to be owner_id field in database? By default when I type user:references in migration it makes user_id
[08:21:39] sevenseacat: owner:references ?
[08:21:59] xshivan: yeah, but it doesn't point to user class then
[08:22:29] sevenseacat: no, you will have to edit your model to add the class name
[08:22:38] sevenseacat: generators wont build your entire app for you :P
[08:22:45] xshivan: okay, I get it
[08:22:47] xshivan: thank you guys
[08:24:20] wasamasa: generators are just good to give you some foundation
[08:24:24] Macaveli: sevenseacat: if you need data in the database for a test is it ok to just do this in the line before you need it Scenario.create! :internal => "EMPLOYEE2POSTING", :external => "UNREGISTERED2POSTING"
[08:24:34] wasamasa: so you won't fudge up creating the base files necessary :P
[08:24:54] sevenseacat: Macaveli: i would rather use factories, but sure
[08:25:05] Macaveli: sevenseacat: I have factory girl
[08:25:11] Macaveli: and I've set the correct data
[08:25:36] Macaveli: I'll gist it!
[08:25:44] sevenseacat: what for? just use the factory
[08:30:04] Macaveli: sevenseacat: as you can see I need Scenario.first.external for this test and I have a factory but how to "launch" the factory to put the data in the DB https://gist.github.com/YOUConsulting/2eb2d3f78f3d1809c5cc
[08:30:34] sevenseacat: what do you mean, how to "launch" the factory? do you know how to use factory girl? you likely do, given you've commented it out there
[08:32:59] xshivan: universal, your example is perfect
[08:33:15] xshivan: Now after re-implementing it directly in my app I've fully understood it
[08:33:24] xshivan: Once again, thank you guys
[08:33:27] Macaveli: sevenseacat: you probaly talking about the scenario = build(:scenario) -> i'm getting NoMethodError: undefined method `build'
[08:33:36] Macaveli: that's why I've commented it
[08:33:42] rushed: Macaveli: FactoryGirl.create(:scenario)
[08:33:46] sevenseacat: because you havent included FactoryGirl's helpers into your spec configuration
[08:34:15] sevenseacat: https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#configure-your-test-suite
[08:34:47] Macaveli: sevenseacat: rushed method worked :)
[08:34:47] opus: glad you got it figured out xshivan
[08:35:02] Macaveli: 52 tests, 66 assertions, 0 failures, 0 errors, 0 skips
[08:35:05] sevenseacat: do you even know why?
[08:35:13] sevenseacat: or are you just copying and pasting code blindly
[08:35:32] Macaveli: I've read the factory getting started
[08:35:55] Macaveli: https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#using-factories
[08:36:07] Macaveli: but that's different from FactoryGirl.create
[08:36:42] sevenseacat: its the exact same thing
[08:36:59] xshivan: opus I come from asp.net world so Rails is a little different for me
[08:37:47] opus: Understandable, I came from the world of C and Java. Love Ruby, took me a while to -get- rails though.
[08:38:32] xshivan: It's much more convenient
[08:39:18] opus: Just depends on what you're doing. Right tool for the job and all that!
[08:56:53] tagrudev: I need an algorithm for generating access_tokens any suggestions ?
[09:00:42] hadifarnoud: should I gitignore /public folder
[09:02:19] sevenseacat: why would you want to do that?
[09:03:20] hadifarnoud: sevenseacat: I don't want precompiled files to get into github
[09:03:36] sevenseacat: why are you precompiling in development?
[09:03:37] hadifarnoud: it's annoying to see them popup everytime as uncommited changes
[09:03:44] sevenseacat: and then why are you checking in precompiled files?
[09:04:00] hadifarnoud: :D sevenseacat. I shouldn't precompile
[09:04:16] hadifarnoud: thanks sevenseacat
[09:04:34] sevenseacat: also, precompiled things arent the only thing in public, y'know
[09:04:50] hadifarnoud: sevenseacat: I know. that's why I asked
[09:05:01] sevenseacat: so you'd be ignoring all of them
[09:05:01] poporul: tagrudev: SecureRandom.uuid ?
[09:05:17] tagrudev: that's what I was looking for
[10:22:39] opus: Is there a way to have multiple has_one polymorphic relationships on the same model by overriding what _type is saved for that relationship?
[10:22:53] opus: I can't see anything to indicate it in the documentation but wanted to make sure I'm not missing anything.
[10:31:54] dangerousdave: wheres the best place to run rails, once only, startup code?
[10:37:42] lgarvey: dangerousdave: once only per boot of the rails server?
[10:38:30] dangerousdave: lgarvey, abut to use an initialiser, is that best?
[10:38:43] lgarvey: dangerousdave: then an initializer is best
[10:38:56] lgarvey: dangerousdave: that or in one of the environment files.
[10:39:27] lgarvey: dangerousdave: application.rb, environment.rb, environments/*.rb all get executed at boot
[10:40:44] dangerousdave: lgarvey, any guidelines as to which is more appropriate for what?
[10:41:45] wasamasa: https://github.com/bbatsov/rails-style-guide#configuration
[10:41:55] lgarvey: dangerousdave: things that are specific for a feature or gem you've got in your app should go in initializers, application configuration in application.rb, environment specific app config goes in environment/*.rb
[10:42:30] Cork: in a serializable_hash i includes a sub model, is there a way to have serializable_hash sort the association before it builds the list?
[10:42:42] dangerousdave: lgarvey, thanks
[10:42:46] helpa: Cork: 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.
[10:42:46] lgarvey: Cork: !code
[10:43:11] Cork: serializable_hash(include: :other_model)
[10:47:23] lgarvey: Cork: I don't see the issue though? you're not asking to sort the keys in a hash are you?
[10:48:03] Cork: lgarvey: basically i want records here to be sorted https://github.com/rails/rails/blob/6e2d35df3c4ca2b639fa4ed800a8eb2a3742bc58/activemodel/lib/active_model/serialization.rb#L114
[10:48:48] Cork: lika an .order("position DESC, id DESC")
[10:49:04] lgarvey: Cork: right you could do that as a default_scope on the :other_model
[10:49:19] Cork: that might work
[10:49:22] Cork: lgarvey: thx
[10:49:38] lgarvey: Cork: or you can include a proc on the association which you should be able to sort with.. I think
[10:50:16] Cork: lgarvey: nice ideas, will try them out; thx again
[10:53:48] Macaveli: you make 1 rspec file per page or per model / controller?
[10:56:09] sevenseacat: per thing you're testing
[10:56:59] workmad3: ^^ a.k.a. per unit or per component :)
[11:19:40] mozzarella: sevenseacat: what's the difference between format.js {} and format.json {}?
[11:19:52] sevenseacat: one is for javascript, one is for json.
[11:20:12] mozzarella: why would you want to return javascript?
[11:25:25] mozzarella: I??don't understand the server-side example: http://guides.rubyonrails.org/working_with_javascript_in_rails.html
[11:25:26] mozzarella: (????;____;)
[11:25:53] Macaveli: tagrudev: is this a good test for example? https://gist.github.com/YOUConsulting/5ad64919e0eadb2323fc
[11:30:11] sevenseacat: mozzarella: what server-side example? its a big document.
[11:30:49] sevenseacat: Macaveli: errrr.... whats the point of creating a scenario and where are you defining @jobs ?
[11:31:17] sevenseacat: mozzarella: which part dont you understand?
[11:31:32] Macaveli: sevenseacat: that scenario is needed everytime I get jobs, and @jobs is defined in the jobs#index
[11:31:45] DaniG2k: anyone know of a company in London hiring junior Rails devs?
[11:31:50] mozzarella: they're using both format.js and format.json, not sure which one is called when you have a remote:??true form
[11:31:52] sevenseacat: Macaveli: jobs#index is not your test - @jobs will be nil.
[11:31:58] sevenseacat: mozzarella: try it and see.
[11:32:11] Macaveli: sevenseacat: but it tries to visit the jobs_path?
[11:32:18] sevenseacat: yes, completely separately.
[11:32:45] sevenseacat: your test runs completely separately from the server serving your app.
[11:33:19] Macaveli: So I should first manually fill the @jobs?
[11:33:39] sevenseacat: Macaveli: in a request spec you are testing the interface of your webapp - what are you expecting to see on the screen
[11:34:20] Macaveli: I'm expecting to see jobs on the screen
[11:34:34] sevenseacat: what jobs? there are none in the system
[11:34:48] Macaveli: there are when you normally visit the page ?
[11:35:08] sevenseacat: remember you're running in your test environment here - different database
[11:35:13] sevenseacat: empty database
[11:35:21] Macaveli: sevenseacat: they are from the webservice?
[11:35:24] Macaveli: not from a DB
[11:35:51] sevenseacat: uhh..... well okay there might be more to your app than i know about
[11:36:12] sevenseacat: but typically you would stub out any external services - youre not testing them, youre testing your app
[11:37:22] Macaveli: sevenseacat: the app relies on the webservice for 90% all the data is saved their
[11:37:42] Macaveli: you need to have interaction via the app
[11:38:25] sevenseacat: you want your tests to be making requests to external services when you run them a hundred times? and when you write specs that do things like modify and destroy data?
[11:39:04] mozzarella: sevenseacat: calls format.js
[11:39:57] mozzarella: what's format.json for, then?
[11:40:00] mozzarella: in that example
[11:40:22] sevenseacat: for if you were making a request from an api, for example
[11:40:33] sevenseacat: that would return you a json response
[11:45:47] tagrudev: I don't test I improvise
[11:47:44] nettoweb: guys, sometimes I get this error: ???ArgumentError: invalid byte sequence in UTF-8??? at this line: https://gist.github.com/osnysantos/77cff976408fc5cd31d2#file-application_controller-rb-L1
[11:48:11] nettoweb: is it a bug in ruby 1.9.3p455?
[11:49:27] sevenseacat: you just have stuff that cant be converted to utf8.
[11:50:55] nettoweb: so I cant fix that error?
[11:51:27] nettoweb: that user-agent string is this: Mozilla/5.0 (Linux; U; Android 2.3.6; pt-br; XT321 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Vers??o/4.0 Mobile Safari/533.1
[11:52:07] sevenseacat: stop trying to force it to be utf8?
[11:52:33] nettoweb: I put that to try fix.. but cant
[11:52:50] nettoweb: if I remove, it will continue with error
[11:59:44] Macaveli: not to self don't write user tests anymore for an app that already exists
[11:59:59] sevenseacat: Macaveli: more fool you.
[12:00:00] Macaveli: start writing tests when creating a new app
[12:00:28] nettoweb: sevenseacat: ???ArgumentError: invalid byte sequence in UTF-8???
[12:00:39] nettoweb: sevenseacat: ops
[12:00:47] nettoweb: sevenseacat: Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8
[12:00:54] sevenseacat: start writing tests, all the time.
[12:01:13] pipework: Protip: Don't modify legacy applications that have no tests. If this isn't possible, add tests before modifying.
[12:04:22] tagrudev: machete don't test, machete improvise
[12:06:02] smiler: I need some help setting up a test with rspec. I have a 3rd party lib, Foo, and a worker. The worker will create an instance on of a class in this 3rd party lib using Foo::Bar.new, set some properties on it and then call a method on it. How do I mock this Lib::Bar class/instance so that I can verify that the correct properties are set and that the method is called?
[12:06:33] wasamasa: brochete: http://youtu.be/o6Fhkzc7M9w
[12:06:51] helpa: smiler: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[12:06:51] universa1: smiler: !fake
[12:07:01] helpa: smiler: 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.
[12:07:01] universa1: smiler: !code ??? lalso
[12:07:17] wasamasa: tagrudev: unfortunately it's not out for linux yet
[12:07:37] tagrudev: damn please do inform when it is :D
[12:11:05] Sylario: Today, in "crazy loops from rails" here is the period overlap validation used with a nested form : self.discounts.reject(&:marked_for_destruction?)[0..-2].each_with_index do |discount,index|
[12:11:32] smiler: https://gist.github.com/smiler/a59399bb696a9ad4cbec This is my code.
[12:12:12] universa1: smiler: your spec?
[12:12:34] smiler: universa1: I don't have a working spec, that's what I need help with
[12:12:42] universa1: smiler: what have you right now?!
[12:13:02] smiler: I can't figure out how to mock the instance Streamio::Video.new returns
[12:13:26] universa1: smiler: you certainly have a spec file, where you have tried things.
[12:13:45] universa1: smiler: anyways: allow(Stremio::Video).to receive(:new).and_return(some - mock)
[12:13:58] mikecmpbll: [13:01:13] <pipework> Protip: Don't modify legacy applications that have no tests. If this isn't possible, add tests before modifying.
[12:14:37] tagrudev: you loose all the fun then
[12:14:46] smiler: universa1: https://gist.github.com/smiler/a59399bb696a9ad4cbec
[12:14:52] tagrudev: when it brakes and you don't know exactly where it broke
[12:15:14] smiler: This thing doesn't mock the instance and the real save method gets called
[12:16:49] universa1: smiler: https://gist.github.com/universal/f316bff2a395039eb9e7
[12:17:08] universa1: smiler: but tbh i???ve no clue how instance double works, since i never use that.
[12:17:30] mozzarella: how do I??make sure that a paperclip attachment has a geometry of exactly 300x100 px?
[12:17:55] smiler: Me niether, obviously
[12:18:33] universa1: smiler: but that code in my fork should work
[12:18:45] universa1: if not, please update your gist with the spec error / failure
[12:18:48] smiler: universa1: Why should I use allow(...).to rather than expect(...).to receive(:new)?
[12:19:07] universa1: smiler: allow is a stub, expect is an expectation.
[12:19:19] universa1: smiler: you could use expect in your case.
[12:19:41] smiler: Let me fiddle with this a bit
[12:21:54] Sylario: mozzarella:i do not remember exactly the syntax but by putting chars (> or # if i recall correctly) in your resolution in the class, you can ask for a forced resized (ratio destroyed) or a crop, look at the doc
[12:26:54] mozzarella: Sylario: yes, I??can create different "styles", but that's not exactly what I??want
[12:27:19] Sylario: mozzarella: what do you want?
[12:27:35] mozzarella: I want to only allow pictures that are exactly 300x100
[12:29:43] Sylario: mozzarella: what you want is a validator for the pixel size
[12:30:12] swemoney: is there any built in/easy method to validate that an object belongs to the logged in user before updating/destroying it? or just check in each controller action?
[12:30:20] Sylario: mozzarella: here is what a quick search return : http://agis.io/2012/09/14/validating-paperclip-image-dimensions-in-rails.html
[12:31:11] kanhaiya: I am getting error while implementing OmniAuthGoogleOAuth2 https://gist.github.com/6684133b5e315cf42a67.git
[12:34:25] Sylario: swemoney: i use a variant of the visible_to concern, here is the original on DHH's blog : https://signalvnoise.com/posts/3372-put-chubby-models-on-a-diet-with-concerns
[12:35:38] Sylario: swemoney: after that you can do PersonData.visible_to(user_id).all in controllers
[12:35:42] kanhaiya: hey the link is https://gist.githubusercontent.com/Pbasnal/6684133b5e315cf42a67/raw/4c79933ff2ae9b3dcb7b199aa2f35521a7a5149c/omniauth_error
[12:36:12] swemoney: Sylario: hm. interesting. thanks. i???ll take a look at that.
[12:59:47] tomoyuki28jp: I don't want to send email on development env. How can I do it?
[13:01:22] lgarvey: tomoyuki28jp: sure, just don't configure a mail server?
[13:01:41] tomoyuki28jp: lgarvey: Thanks for your reply. That's one way.
[13:01:49] tomoyuki28jp: Or I might use email intercepter?
[13:02:01] lgarvey: tomoyuki28jp: Or configure it to be localhost like: config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
[13:02:18] lgarvey: tomoyuki28jp: then you can use the execellent mailcatcher: http://mailcatcher.me/
[13:02:29] tomoyuki28jp: lgarvey: thanks a lot for your help!
[13:02:31] tomoyuki28jp: appreciate it.
[13:04:10] elaptics: lgarvey: didn't know about mailcatcher, I use something similar http://www.mocksmtpapp.com/
[13:04:40] elaptics: there's also another one that's good for staging environments too https://mailtrap.io/
[13:04:50] tomoyuki28jp: elaptics: thanks!
[13:04:52] lgarvey: elaptics: mailcatcher is a gem built on thin, eventhandler by a cool Aussie dev I know. So maybe I'm biased.
[13:06:07] tomoyuki28jp: I'm writing rake task to import devise user data from another app and when I run it to test, confirmation email sent to my users...
[13:06:12] tomoyuki28jp: That's why I'm here to ask.
[13:09:21] pyreal: +1 for Mailcatcher. I use it in Dev, and i use mailtrap.io on my Heroku staging env
[13:09:50] Macaveli: Is it possible to generate controller and view in a subfolder ?
[13:10:12] elaptics: Macaveli: with the rails generators?
[13:10:15] tomoyuki28jp: pyreal: thanks!
[13:14:29] sfb: Does anyone know of any good ways to structure your user module so that you don't have to sign in for every single freakin test?
[13:19:00] pyreal: sfb: try something like this? http://pastebin.com/tnAmKQJ9 call that login_helpers.rb and place it in spec/support folder if you???re using rspec/capybara
[13:20:15] sfb: pyreal: I want to bypass the actual signin process. In the past I've been fine with before(:each) { sign_in @user } but now I'm working on an app that has only LDAP auth and testing it is a huge PITA.
[13:20:29] sfb: pyreal: I just found this:
[13:20:32] sfb: pyreal: https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs
[13:21:19] sfb: pyreal: But I was trying to find some way to, maybe, put my devise logic in a module that I could stub out for tests where I don't explicitly need to test authentication.
[13:21:30] pyreal: sfb: cool understood
[13:27:31] cool: Hello, In rails guide example of has_many, through how do I get a list of patients for a doctor? http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association
[13:29:02] Criten: cool: doctorObject.patients
[13:31:29] cool: Criten: That's simple! thanks
[13:33:22] banisterfiend: tbuehlmann hey
[13:36:21] ecnalyr: I need to build a 'calendar widget' that will show the current month with all dates with the ability to click to the next month/previous month. Every day that has an event will be 'underlined' and act as a link to the events calendar for that day. I have created a similar calendar in the past but my code isn't the prettiest stuff in the world and this seems like a problem that has been solved numerous times. Does anyo
[13:36:21] ecnalyr: ne know of any open source solution to displaying a small calendar that would look something like this: http://imgur.com/nJ6XNws that I could easily modify for linking to specific events associated with the dates?
[13:36:22] pipework: banisterfiend: Hey chum
[13:37:15] banisterfiend: pipework yo, in practice i didn't like the passive controller approach, esp when you have a number of service objects (one for each action for example), and you have no idae you're definign callbacks unless you look into the code of the service objects
[13:37:22] banisterfiend: pipework so i used an explicit callback approach instead
[13:37:39] banisterfiend: pipework https://gist.github.com/b1301d48bf8a3fd4d423
[13:37:50] banisterfiend: pipework i prefer it, though it's a little more complicated to set up
[13:38:40] sathish: Hi guys I'm starting my saas application, I want to update the front website without pushing code or without affecting the application codebase, need a simple CMS solution, what do you guys/gals suggest
[13:39:21] pipework: banisterfiend: That makes me sad because now the controllers know a junk ton.
[13:39:53] pipework: sathish: Fixing your desire and just pushing the frontent as a separate project from the rest of the system.
[13:40:19] mozzarella: is there a faster/cleaner way to do that? I??just want to get a random id: Post.select(:id).all.collect(&:id).sample
[13:40:33] banisterfiend: pipework not really, it's exactly the same as the previous approach, i.e order.no_order { head :bad_request } is equivalent to the passive controller approach: def no_order; head :bad_request; end
[13:40:58] pipework: banisterfiend: I'd ideally like to find a balance where controller is concerned about HTTP and forming a response body from the data returned from the application (a service object)
[13:41:01] banisterfiend: the callbacks are still fired at the same point, it's just that this approach (IMO) makes it more explicit that you're defining callbacks and also makes it clear what the API is provided by the service object
[13:41:01] sathish: pipework sweet pushing to public/ will work fine right?
[13:41:12] pipework: sathish: even if it does, that sounds silly
[13:41:45] pipework: banisterfiend: It's just sugar though, not really decoupling.
[13:41:48] sathish: I dont know but you look like god to me :D
[13:41:52] pipework: I'm in it for decoupling.
[13:42:24] sathish: pipework, thanks a ton
[13:42:38] banisterfiend: pipework it's just as decoupled, it's just that IMO it's more explicit than defining magical methods that the service object knows about but someone reading your code would have to look inside it to know that it knows about it
[13:43:00] pipework: sathish: I'd personally set up something like a sinatra app for development of the app, and then probably include sprockets in that. The way you deploy the app would be to precompile your assets and push those to the place you serve the client from.
[13:43:13] pipework: banisterfiend: It's just as decoupled as the previous approach, which is to say not at all.
[13:43:21] pipework: It's a nicer sugar though.
[13:43:55] banisterfiend: pipework by previous approach you mean tbuehlmann's one? or you mean the normal rails approach?
[13:44:00] pipework: banisterfiend: tbuehlmann's.
[13:44:28] pipework: They're both coupled, but in the opposite direction.
[13:44:42] banisterfiend: but tbuehlmann's one is decoupled???that's the whole point of it afaict, and the purpose of the hexagonal architecture which the pattern came out of iirc
[13:45:05] mozzarella: is there a faster/cleaner way to do that? I??just want to get a random id: Post.select(:id).all.collect(&:id).sample
[13:45:10] pipework: It's not really that decoupled, because it depends on those success and fail methods, but I could see them becoming genericized.
[13:45:20] pipework: mozzarella: Look into #pluck
[13:45:21] elaptics: mozzarella: Post.pluck(:id).sample
[13:45:41] TheLarkInn: Hello and good morning all!
[13:45:43] pipework: sathish: Meaning, you push it to where your webserver serves up files.
[13:45:58] banisterfiend: pipework but those are just events that fire, and anything, not just the controller, could be listening to them
[13:46:03] elaptics: mozzarella: or better, do the random selection in the database if you just want one at random. Somewhat depends on how random it needs to be
[13:46:03] pipework: sathish: Assuming a pretty simple setup with a webserver, that is. You basically just compile your assets and put them on the webserver.
[13:46:34] mozzarella: elaptics: is there even a random sql function?
[13:46:55] TheLarkInn: RANDOM() i thought
[13:47:06] elaptics: depends on your db
[13:47:24] elaptics: RANDOM() is postgres, RAND() is mysql
[13:47:32] TheLarkInn: oh thats right
[13:47:48] pipework: banisterfiend: If every controller action used a(n) entrypoint to the application and passed the data from the request into it, I could see something like this: MyDomain.call(filtered_params).bind(self) as the controller interface.
[13:47:56] TheLarkInn: Hey would anyone sharing a bit of ruby insight in regards to refactoring these two scopes I have written for a class?
[13:48:04] mozzarella: why does activerecord not abstract that away? rand function or something
[13:48:15] TheLarkInn: https://gist.github.com/TheLarkInn/3f0ed7987c95c67b30a2
[13:48:15] elaptics: mozzarella: Post.order("RANDOM()").limit(1).pluck(:id)
[13:48:41] pipework: banisterfiend: Then the application would call back to the bound object with #success, #fail, and whatever else might be useful for a minimal api, passing a hash back for the controller to give to the view.
[13:48:49] TheLarkInn: Now I have heard that, using .order("RANDOM()") is quite inefficent though let me find the reason why
[13:48:59] pipework: The interface would be really minimal in that way, and the path would be clear and explicit.
[13:49:56] TheLarkInn: http://stackoverflow.com/questions/5342270/rails-3-get-random-record
[13:50:28] TheLarkInn: that might shed some more like on the issue with calling .order('random()'), if your not dealing with a huge dataset, and it won't ever get huge than I think you will be okay
[13:50:31] elaptics: TheLarkInn: yeah, a lot depends on your db size, etc
[13:50:35] pipework: Then controllers are responsible for taking the request and extracting params, and then taking the response from the application and handing it to your view objects for rendering. That would leave the controller with two small responsibilities. HTTP and routing requests to your application.
[13:50:53] elaptics: TheLarkInn, mozzarella I think this is the reason why there's no standard rails solution for it
[13:50:57] TheLarkInn: Anyone have any tips for refactoring this https://gist.github.com/TheLarkInn/3f0ed7987c95c67b30a2
[13:51:08] TheLarkInn: Yeah I see what you mean???create a pull request :-P
[13:51:27] banisterfiend: pipework can u show how that would look by refactoring this https://gist.github.com/banister/e5c6fd9438ad7541016f
[13:51:32] banisterfiend: cos i dont really follow u
[13:51:37] elaptics: TheLarkInn: yikes (to your gist)
[13:52:01] pipework: banisterfiend: Let me give it a go. I'm trying to set up openvpn as a client from both my router as well as individual machines to my openvpn server in le digital clouderoceans.
[13:52:18] TheLarkInn: yeah I know, tell me about it, I'm really new to rails and scopes, and arel_tables, but I need to join a crap ton of tables, and this is really clunky, I just want to refactor all the repetition that I have there
[13:52:29] mozzarella: I think I'm going to use Post.find(Post.pluck(:id).sample)
[13:54:56] elaptics: TheLarkInn: what is it that you're trying to do there? i.e. why all the joins?
[13:55:56] TheLarkInn: Well I need to join 4 models so that I can search and query through the entire collection of those models,
[13:56:44] TheLarkInn: that part is less relavant, that block of joins is necessary, however its the variable instansiation I want to refactor,
[13:56:52] TheLarkInn: so I don't have to declare twice in both scopes
[14:08:20] Macaveli: Is it possible to have zurb foundation5 with rails?
[14:09:46] lgarvey: Macaveli: yes. I believe zurb even provides a gem.
[14:10:11] Macaveli: lgarvey: there seems to be a zurb-foundation gem and a foundation-rails gem?
[14:11:41] Macaveli: lgarvey: I've added foundation-rails-5.3.0.1 now I want to do rails g foundation:install and I receive Could not find foundation-rails-5.3.0.1 in any of the sources -> yes I have done bundle install a dozen times
[14:14:04] ecnalyr: Macaveli I use gem 'foundation-rails' in all of my zurb/rails apps
[14:14:16] ecnalyr: Macaveli in case you were uncertain about something.
[14:14:36] Macaveli: I'm uncertain about why rails g foundation:install not working
[14:18:54] asdfaffo: do you know if webrick supports sha1 for access digest authentication?
[14:19:02] helpa: asdfaffo: Why don't you try it and find out for yourself?
[14:19:02] universa1: asdfaffo: !try
[14:19:41] universa1: asdfaffo: but anyways: webrick shouldn???t be used neither in production nor in development, keep the dev env close to the production env
[14:19:45] sfb: Macaveli: http://foundation.zurb.com/docs/applications.html
[14:20:16] Macaveli: sfb: I don't want to manually install it, I want the generator to work :s
[14:20:38] sfb: Macaveli: Are you using foundation-rails or zurb-foundation?
[14:20:38] asdfaffo: I am using webrick just for some tests
[14:20:41] universa1: Macaveli: the gem works, it???s something on your end that doesn???t
[14:21:19] asdfaffo: I am looking at some tutorial but I did not find out how to configure webrick in order to use sha1 for digest access auth
[14:21:35] Macaveli: sfb: universa1 I'm using foundation-rails
[14:22:18] universa1: Macaveli: cool! so you have gem ???foundation-rails??? in your gemfile? ran bundle and ran bundle exec rails g foundation:install
[14:23:01] universa1: asdfaffo: even though i???ve no real clue about what you???re trying. isn???t it the application???s job to handle authentication?
[14:23:02] Macaveli: universa1: yes, and I'm receiving Could not find foundation-rails-5.3.0.1 in any of the sources Run `bundle install` to install missing gems.
[14:23:21] universa1: Macaveli: show your Gemfile.
[14:23:33] universa1: Macaveli: and what you entered into the console
[14:23:37] universa1: Macaveli: and the error trace.
[14:23:37] Macaveli: https://gist.github.com/YOUConsulting/f3e295abdf86a7040533
[14:24:14] universa1: Macaveli: https://gist.github.com/YOUConsulting/f3e295abdf86a7040533#file-gemfile-L21 ??? you don???t need this for foundation
[14:25:07] Macaveli: There is no error trace just what I said above, I've entered this: rails g foundation:install and bundle exec rails g foundation:install but no difference
[14:25:22] universa1: Macaveli: ok: enter bundle into your console
[14:25:28] universa1: and copy everything that follows into your gist.
[14:25:52] Macaveli: universa1: hold on
[14:26:08] Macaveli: when I try to get in my console I keep getting the same error message as described above?
[14:26:24] universa1: Macaveli: what now?
[14:26:34] universa1: Macaveli: so run bundle update foundation-rails
[14:27:53] universa1: Macaveli: copy the line with the command you ran and the output and add it to the gist.
[14:28:27] pipework: banisterfiend: https://gist.github.com/Spaceghost/25b9ff8616b3d35f8d39
[14:28:56] pipework: banisterfiend: If you could actually pull that down and look at the commit message, that would help.
[14:29:45] Macaveli: universa1: it is working now
[14:30:05] Macaveli: it had something to do with sub folders moved the directory to desktop and now everything working file
[14:30:29] lgarvey: pipework: that's some pretty nifty code there.
[14:30:52] pipework: lgarvey: Thank you sir, it's rubbish for lack of tests and lack of response data decoupling, but thank you all the same.
[14:31:26] lgarvey: pipework: pfft you shouldn't write tests etc for something you're spitballing about in irc
[14:31:40] pipework: lgarvey, banisterfiend: https://gist.github.com/Spaceghost/25b9ff8616b3d35f8d39#file-commit_msg
[14:35:29] epochwolf: pipework: commit message: unfuck Dan's code.
[14:36:08] epochwolf: also, why do you have a sign off if there's already an author message?
[14:37:04] pipework: epochwolf: I sometimes author as myself and sign-off as a pair.
[14:37:41] pipework: Also, who the fuck is dan?
[14:37:41] epochwolf: so it is a seperate thing
[14:38:01] t00r: Hey guys! I'm using the Font Awesome icons, how can I use these icons if <% link_to ?
[14:38:31] epochwolf: pipework: the guy that originally wrote this clusterfuck of a group of interlinked rails applications. He didn't know ruby, rails, or common sense when he started
[14:38:34] pipework: epochwolf: Well, there's author, committer, and signoff. Signoff is usually used for attribution in case someone must change the code.
[14:38:44] pipework: epochwolf: Everyone then?
[14:39:14] epochwolf: pipework: when he was fired he hadn't learned anything
[14:39:16] pipework: Like if the code was emailed, and then someone had to author a real commit from it (in any VCS), and then there was a 'committer'
[14:39:37] epochwolf: He was a java guy that decided to misuse every ruby feature to implement java design patterns.
[14:39:41] pipework: epochwolf: Is this a particular Dan you had some kind of indirect or direct contact with or an abstract representation of an asshole?
[14:39:53] t00r: I tryied <%= link_to '<i class="icon-ok icon-white"></i> Do it@', new_vaga_path %> but nothing...
[14:40:12] epochwolf: pipework: he's a real guy that was fired along with the rest of his team two years before I started at this company
[14:40:14] pipework: t00r: I think #link_to takes a block
[14:40:17] pipework: epochwolf: lul
[14:41:34] t00r: pipework: I used this but doesn't work neither: <%= link_to(vaga) do %><i class='fa fa-info'></i><% end %>
[14:42:02] pipework: t00r: Did you read the docs?
[14:42:09] pipework: banisterfiend: What do you think?
[14:42:12] helpa: noric: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[14:42:12] pipework: noric: !ask
[14:42:37] t00r: pipework: I think so...
[14:44:35] noric: Starting a new rails project, I'm a newbie, and wondering about front end frameworks. How do projects normally combine rails as a back end + frontend framework such as ember.js? Why would they do this?
[14:45:20] pipework: A lot use the asset pipeline. Because they want one project directory and want to share stuff.
[14:45:37] pipework: noric: Which particular 'this' are you asking 'why?' about though?
[14:47:14] noric: I'm wondering about projects that use rails as an api, the site is served from a separate server, and front end libraries make requests to the rails api. Is this a thing? I have heard "make your api first". I believe this also avoids server-side html generation, as rails simply emits json which is interpreted by front-end frameworks.
[14:47:25] mjc_: noric: I've tried using asset pipeline and also making the ember app separate and deploying it to the public directory on our servers. For our uses separating them (and using ember-cli, despite its rough edges) turned out to be the most efficient method
[14:47:51] noric: I'm trying to decide if I should use "just rails" or rails + front end libraries. I know that either way I'll need some front-end stuff, such as jquery, but unsure how complicated my front end will be.
[14:47:53] mjc_: noric: and our rails app is just an api frontend in that case yeah
[14:47:56] pipework: noric: Sometimes people will put it on a wholly separate webserver with an application server behind it, but often they just serve the frontend client as static assets.
[14:48:18] pipework: noric: Just so you know, serving HTML over HTTP is an API like any other, be it JSON, or .m3u
[14:48:22] mjc_: noric: jquery is just a toolkit for making js easier to write, ember and whatnot are for building the whole page with javascript
[14:48:24] pipework: It's all HTTP, it's all APIs
[14:48:49] mjc_: noric: rails already uses jquery to some degree for things like simple ajaxed forms
[14:48:54] noric: So when would you want "just rails" vs rails-the-api + ember?
[14:49:00] pipework: Configurably.
[14:49:23] pipework: noric: It's already 'the api'. Your real question is about fat clients and server-rendered views.
[14:49:31] mjc_: noric: when you want to build a single-page app, something like ember is a good fit
[14:49:33] noric: right! thanks for clarifying.
[14:49:38] pipework: They aren't even mutually exclusive.
[14:50:03] pipework: mjc_: Regardless of whether you do or don't. It's just treating the browser as a runtime rather than a document parser when you use things like ember.
[14:50:16] mjc_: noric: http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html this may be enlightening about what things rails can already do using JS
[14:50:48] noric: thanks for link and ember-cli. Allow me to describe my project..
[14:51:09] pipework: It ranges between server-side and client-side. The closer to a fatter client you get, the more you treat the browser as a runtime and less as a document parser/renderer
[14:51:23] Guest58926: has anything changed from 4.0.5 to 4.0.6 that would prevent this bit of code from being hit?
[14:51:44] Guest58926: I had to run a patch on it, but it doesn't seem to get hit on 0.6
[14:51:45] noric: perhaps 90% of time on site will be from mobile, there'll be CRUD for worker shift scheduling, profiles with pics, a 5-star rating system a la amazon
[14:51:54] mjc_: Guest58926: what code?
[14:52:00] Guest58926: https://github.com/rails/rails/blob/4-0-6/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb#L33-L48
[14:52:48] pipework: Guest58926: You can check just as well as I could. It's osentibly versioned sane enough that a patch level version bump wouldn't break things, but perhaps a bug was introduced or fixed. Your best bet is to look at the diff between versions.
[14:53:07] Guest58926: I patched that so out of range dates don't throw an exception anymore.
[14:53:59] Guest58926: alright, I was just curious if there was anything known, perhaps dates are being set differently and this is used elsewhere or something.
[14:54:22] pipework: rubyonrails-talk would probably be where you want to go. It's the mailing list for this kind of thing.
[14:54:23] mjc_: Guest58926: what exact behavior change are you seeing? I don't follow
[14:54:25] Criten: noric: be sure to check out #emberjs if you end up using ember
[14:54:36] noric: Criten: thanks
[14:54:44] Guest58926: also there doesn't seem to be a 4-0-5 branch, do they not keep minor branches?
[14:55:31] mjc_: Guest58926: you can just use the tag to find all the relevant changes
[14:55:53] pipework: Or just use both tags to find the diff between the two.
[14:56:06] mjc_: diffing between v4.0.5 and v4.0.6 will give you what you want
[14:56:14] Guest58926: alright, thanks.
[14:56:54] mjc_: Guest58926: https://github.com/rails/rails/compare/v4.0.5...v4.0.6
[14:57:24] pipework: lgarvey: That kind of code is the sort of shit I write in between actually working on features. :D
[14:57:29] mjc_: Guest58926: you can similarly scope git log and git bisect this way on the commandline
[14:57:55] noric: could someone suggest a channel to inquire about limitations of mobile webapps vs native apps?
[14:58:19] pipework: noric: You can get a list of the channels on freenode, but I don't know of any that wouldn't be a bit biased to one side.
[14:58:41] noric: pipework: biased is fine, my questions are simple
[14:59:09] pipework: Then I'd either join ##web or the platform of your choice's channel.
[14:59:16] noric: pipework: thanks kindly
[14:59:18] speakingcode-wor: i need to put a select_year in a form for a nested model. the nested model is called jobs, so i need the field to be jobs_attributes[n][year].. i use the field_name and prefix name but i can't seem to get it in the right from. anyone done this before?
[14:59:38] pipework: Web being the circle-jerk it is, don't take them too seriously if they're not giving you the straight dick.
[15:00:36] speakingcode-wor: noric i've a blog post about it in general in the context of the hype that spurred when facebook switched to native app development vs html5/webapp
[15:00:36] banisterfiend: pipework i think it works fine if you have one service object, but if each action has its own service object with its own callbacks defined on teh controlle,r then the controller gets overloaded with small callback methods and it's hard to figure out which callback corredponds to which service object and which action
[15:00:52] banisterfiend: pipework that's the reason i defined the callbacks inline in the block associated with the service object, inside the action itself
[15:01:09] banisterfiend: pipework like so: https://gist.github.com/1046a8186c8a0fb1a268
[15:01:32] pipework: banisterfiend: But you already had those in your DSL.
[15:01:43] banisterfiend: pipework what?
[15:01:55] speakingcode-wor: anyone? no one done a select_year for a nested model form before?
[15:02:14] pipework: It's okay if you want to use those, I'm just saying that your API footprint is huge the way you wrote it. I'd extract data from a hash rather than call different methods.
[15:02:37] pipework: Data is easier to change and extend than code. This isn't lisp, not quite.
[15:03:48] pipework: banisterfiend: I could see passing a block to #call in mine and doing something not entirely the same, but somewhat different. Let me refactor again.
[15:04:00] slash_nick: speakingcode-wor: what's a nested model form got to do with select_year? what's your question?
[15:05:16] speakingcode-wor: slash_nick: the parent model can have multiple submodels (jobs). each job has a begin_year and end_year field. i need the parent models' form to have mutliple subforms for jobs each with the years...
[15:05:17] slash_nick: speakingcode-wor: if you've got a problem with a form, and it involves nested attributes, try gisting your model and form (http://gist.github.com)
[15:06:14] speakingcode-wor: the problem is the field and prefix options dno't seem able to put the neste year fields in the form of jobs_attributes[n][begin_year], etc
[15:06:59] slash_nick: speakingcode-wor: don't seem to be able to? show us the code you have
[15:07:15] lxsameer: hey guys, how can i found out that a model class is a HABTM model or not ?
[15:07:53] deathknight_: I'm up shit creek trying to convert .haml to .html.erb. I have two lines -> http://pastebin.com/bBpPGPcK
[15:08:04] speakingcode-wor: if i do :field_name => :begin_year, :prefix => :jobs_attributes it puts them in the form of jobs_attributes[begin_year]... needs to be jobs_attributes[n][begin_year] where n is the nth job assocaited with the parent..
[15:09:26] pipework: banisterfiend: I dislike how your controller delegates calls to itself over to the service object like that. I mean, the DSL might make some people happy, but it makes me sad.
[15:10:16] pipework: That instance_exec, rite
[15:11:14] banisterfiend: pipework doens't use instance_exec
[15:11:41] pipework: banisterfiend: How do you yield the block to the controller in the context of the block for the NewOrderService?
[15:12:20] speakingcode-wor: https://gist.github.com/speakingcode/266d7027fdf7815e152d
[15:12:24] banisterfiend: pipework: it yields itself, the 'self' inside teh block is the controller, tha'ts how i can call the methods like redirect_to etc
[15:12:47] pipework: banisterfiend: Wait, can you show me that? I'm not sure I get how.
[15:12:49] banisterfiend: pipework the service object yields itself, where the free_order and no_order methods are defined
[15:13:13] pipework: Right, so how do the blocks passed to those methods get called in the context of the controller?
[15:13:13] banisterfiend: pipework https://gist.github.com/c29c29bd8d1573ac4b1c
[15:14:58] pipework: Oh interesting use of #tap
[15:15:21] pipework: I think they should redocument it because I've seen maybe 5% of #tap use actually being used the way the documentation describes it.
[15:16:55] pipework: banisterfiend: If you got rid of those Callbacks methods and just had the controller extract data from the service object response, it'd be less frowny to me.
[15:17:25] pipework: You've got domain coupling in your controller. If you're happy with that, I'm okay with agreeing to disagree.
[15:17:26] slash_nick: banisterfiend: ^ that's my approach...
[15:17:49] slash_nick: that way you can use your service object wherever...package it up in a gem and use it across projects, in controllers or still, wherever
[15:19:11] banisterfiend: pipework but that's the whole point, i didn't want the controller to extract data/or query the service object, cos then you end up with comlicated if/then logic in the controller
[15:19:19] banisterfiend: using callbacks and i put all the if/then logic back into the service object
[15:19:20] pipework: banisterfiend: No you wouldn't.
[15:19:47] slash_nick: banisterfiend: no, you wrap the call to the service object in another service object whose sole purpose is to if/else what you need to if/else
[15:20:23] banisterfiend: slash_nick or i could just have the if/else in the original service object if it's not too much code, no? :)
[15:20:25] _lazarevsky: hello good people
[15:20:49] _lazarevsky: I'm relatively new to the world of Ruby and Rails
[15:21:01] _lazarevsky: I started getting more and more comfortable with the syntax and especially the sexy framework
[15:21:07] _lazarevsky: but now I've kind of hit a wall
[15:21:14] queequeg1: If I manually manipulate an enum's integer value will that break the state machine?
[15:21:35] mikecmpbll: _lazarevsky: smash it down!
[15:21:36] _lazarevsky: i'm experiencing performance issues. I wanted to check if Rails just does not scale well or if my serializers or sideloading of data are sub standard
[15:21:41] _lazarevsky: hey mikecmpbll ! howzit mate!!
[15:21:44] slash_nick: banisterfiend: i would s/if it's not too much code/if the logic ought not be extracted/
[15:21:45] mikecmpbll: haha. hello.
[15:21:54] mikecmpbll: what performance issues?
[15:22:01] pipework: @orders, @warnings, @messages = data.values_at(%i|orders warnings messages|);
[15:22:04] speakingcode-wor: solution was to just use date_select with :discard_month and :discard_day... that wasn't so hard. how does nobody know this???
[15:22:11] _lazarevsky: API calls take 13-14 seconds to execute!
[15:22:16] helpa: Ruby on Rails doesn't scale - nothing to see here - move along. http://twitter.com/
[15:22:20] pipework: Then you just form your response if there's no orders, or if there's other cases.
[15:22:32] banisterfiend: slash_nick well i dont think it ought to be extracted here, the original service should know what errors are and what success is, so it can just invoke the callbacks itself
[15:22:34] banisterfiend: anyway, no biggy
[15:22:36] mikecmpbll: _lazarevsky: benchmark the request, find out hwat's slow
[15:22:43] mozzarella: does twitter still use rails?
[15:22:46] banisterfiend: it was just an idea and i'm going to run with it at least until my colleagues -1 it :)
[15:22:47] pipework: Just extract the objects and tell them to render (or another object built for that purpose).
[15:22:48] mikecmpbll: mozzarella: nope
[15:23:03] pipework: banisterfiend: Well, it's unfortunate because I don't really see any benefits to it.
[15:23:04] wmoxam: mikecmpbll: I thought it's still used in some areas
[15:23:13] mikecmpbll: wmoxam: eh maybe, i don't know
[15:23:16] mr_foobar_baz: mikecmpbll: yes they do afaik
[15:23:16] mr_foobar_baz: mikecmpbll: just replaced some slow stuff with scala
[15:23:16] mr_foobar_baz: mikecmpbll: but still using rails
[15:23:38] banisterfiend: pipework the benefits are exactly the same as in tbuehlmann 's code, excpet it makes the callbacks explicit, and it keeps all the render/redirect_to/flash code in the action, rather than spread through the controller
[15:23:44] wmoxam: We're all writing Twitter scale apps here
[15:23:53] pipework: banisterfiend: Yes, but other than the explicitness, it's not better.
[15:23:54] mikecmpbll: _lazarevsky: first obvious thing is to look in your logs see if it's a slow query.
[15:23:55] _lazarevsky: mikecmpbll: I used profilers and examined the network tab to find out what took so long
[15:23:55] wmoxam: that's Rail's prime use case
[15:24:05] banisterfiend: pipework right, welll the explicitness was all i was going for ;)
[15:24:09] pipework: banisterfiend: Gotcha.
[15:24:11] _lazarevsky: the query takes milliseconds to execute mate..
[15:24:11] mikecmpbll: wmoxam: of course :D
[15:24:16] _lazarevsky: mikecmpbll: I suspect it may the be serializers
[15:24:19] mikecmpbll: _lazarevsky: then you need to find out what's slow
[15:24:26] mikecmpbll: add something like newrelic_rpm
[15:24:29] mikecmpbll: use it in dev mode.
[15:24:32] pipework: I prefer the decoupling with explicit and clear code path tracing.
[15:24:35] _lazarevsky: let me google that first
[15:24:43] _lazarevsky: but thanks for the starting point
[15:24:58] poporul: _lazarevsky: are you using rabl?
[15:25:07] mikecmpbll: i don't know if there's better performance tools but i don't do this stuff very often
[15:25:26] mikecmpbll: i usually find it quicker to just do deduction by subtraction :P
[15:25:44] _lazarevsky: poporul: nope
[15:25:58] _lazarevsky: poporul: let me google that
[15:28:30] sarink: what's the "rails g" syntax for create_join_table? the AR docs are misleading to me and i can't get it right
[15:29:02] mikecmpbll: bin/rails g migration CreateJoinTableFooBar
[15:29:17] mikecmpbll: bin/rails g migration CreateJoinTableFooBar foo bar
[15:30:40] _lazarevsky: poporul: have u ever experienced spike in latencies in the API calls
[15:31:43] poporul: _lazarevsky: what kind of api?
[15:32:03] poporul: _lazarevsky: local queries?
[15:32:35] _lazarevsky: have u ever had a problem with the default rails serializer
[15:32:45] _lazarevsky: I think I'm doing something wrong in my serializers
[15:32:53] _lazarevsky: because I kind of created my customs ones..
[15:33:24] wmoxam: _lazarevsky: ActiveModel serializers
[15:33:32] wmoxam: it's the way to go IMO
[15:33:52] _lazarevsky: wmoxam: is that the default one?
[15:34:25] workmad3: _lazarevsky: no
[15:37:53] _lazarevsky: mikecmpbll: the reason which lead me to believe that I've got something wrong with the serializers or with the way i'm sideloading data is that, when I'm querying the DB from the console it executes instantly but it returns in memory objects, whereas for the same call it takes 6-7 seconds to load when done through an API call
[15:38:25] mikecmpbll: _lazarevsky: no one can advise really without any clue where the slowness is occuring
[15:38:31] mikecmpbll: but that sounds like a reasonable deduction.
[15:38:45] _lazarevsky: i'm busy installing the gem you recommended
[15:38:48] _lazarevsky: I was like.. killing time
[15:38:54] _lazarevsky: please stick around for couplea more minutes
[15:39:13] _lazarevsky: you're golden
[15:41:06] pipework: banisterfiend: https://gist.github.com/Spaceghost/25b9ff8616b3d35f8d39#file-commit_msg-2
[15:41:15] pipework: slash_nick, lgarvey: ^ thoughts?
[15:41:19] poporul: _lazarevsky: looks like you are using big left outer joins
[15:41:57] pipework: banisterfiend: I think I got it a bit wrong though.
[15:42:06] banisterfiend: pipework haha, that code isn't valid ruby;)
[15:42:30] pipework: banisterfiend: I don't have a host environment for the code we're tossing back and forth.
[15:43:07] banisterfiend: pipework you're just defining naked blocks
[15:43:14] banisterfiend: you need to pass them into methods that's all ;)
[15:43:35] pipework: banisterfiend: Yeah. They also wouldn't have access to #data either.
[15:44:33] pipework: I can fix both.
[15:46:27] poporul: what is preferable way to assign development dependencies when developing gem? There are two ways: 1) in Gemfile, 2) in *.gemspec file (through add_development_dependency)
[15:47:16] pipework: poporul: You separate hard development dependencies from preferences and frippery. Frippery goes in the Gemfile and hard dependencies go in the gemspec.
[15:47:19] slash_nick: poporul: add_development_dependency
[15:49:06] Morkel: I have this line in my routes.rb ???resources :posts??? so the index is domain.com/posts/ is it possibel to change the url to domain.com/blog/
[15:49:14] Morkel: only for the index
[15:50:10] slash_nick: poporul: minitest would be a case for a hard development dependency (something required for building, running tests, or otherwise making the development environment work)... pry would be an example of "frippery" or preference, and would go in a Gemfile
[15:51:54] speakingcode-wor: can someone just show me how to have a year selection for a nested model?
[15:51:57] poporul: pipework, slash_nick ok, thnx
[15:53:16] slash_nick: speakingcode-wor: Third time I've asked, have you posted code?
[15:53:27] speakingcode-wor: IDONTH AVE ANY CODE BECAUSEN OTHIGN WORKS
[15:53:32] helpa: You haven't shown any code. You haven't shown the full error. You haven't shown any logs. You're making it really, really hard for us to help you.
[15:53:36] pipework: speakingcode: Then you have no problems.
[15:53:42] pipework: No code == no problems.
[15:53:49] pipework: Code or errors.
[15:54:35] _lazarevsky: mikecmpbll: almost done man. Let me just create 350 projects to simulate prod data
[15:55:00] mikecmpbll: _lazarevsky: so it doesn't happen with less data?
[15:55:20] _lazarevsky: of course it does
[15:55:25] _lazarevsky: but I wanna get the same latency
[15:55:29] _lazarevsky: basically wanna simulate prod data
[15:55:35] _lazarevsky: I'm creating 350 projects
[15:55:40] _lazarevsky: each project has got 10 teams associated
[15:55:48] mikecmpbll: ACTION is confused.
[15:55:48] _lazarevsky: that means i'll have 3500 project teams
[15:55:59] _lazarevsky: well I wrote a function to do it for me mate :)
[15:56:01] mikecmpbll: does it go slow without the production levels of data?
[15:56:14] mikecmpbll: or is the speed related to the volume of data?
[15:56:29] _lazarevsky: ya I believe it is straight proportional
[15:56:30] mikecmpbll: that's useful to know to debug this .. i'm not asking for no reason.
[15:56:33] mikecmpbll: right, okay.
[15:57:57] _lazarevsky: ya the latency is much less with less data
[15:59:02] masscrx: how should be something like this in HAML: = app.price == 0.0 ? "FREE" : app.price
[15:59:34] slash_nick: masscrx: what's wrong with that?
[15:59:35] mikecmpbll: masscrx: ? what are you asking.
[15:59:47] masscrx: slash_nick: still 0.0 on site
[16:00:12] slash_nick: masscrx: then app.price is not == 0.0
[16:00:16] masscrx: mikecmpbll: I want to display FREE if app.price == 0, else app. price
[16:00:22] mikecmpbll: it should do
[16:00:22] slash_nick: ie maybe it's equal to "0.0" or something
[16:00:52] mikecmpbll: slash_nick: good thought
[16:01:24] slash_nick: anyway... if app.price.to_f <= 0 ? "FREE" : app.price
[16:01:35] slash_nick: something like that
[16:02:09] Sigma00: maybe app.price is a string?
[16:02:21] masscrx: to_f resolved
[16:03:18] pipework: Damn, I'm trying to decide whether there's a nice way to memoize the return value for #call in the service object for the #bind object or whether I should move #bind to ::bind
[16:03:55] pipework: UserCreator.bind(self).call doesn't flow as nicely.
[16:04:14] pipework: UserCreator.bind(self).call(user_params) actually
[16:06:52] pipework: Ugh, won't work.
[16:10:11] _lazarevsky: mikecmpbll: hold on a little longer please.. having difficulties running newrelic
[16:10:38] mikecmpbll: _lazarevsky: what difficulties?
[16:11:00] _lazarevsky: The URL '/newrelic' did not match any routes in your application
[16:11:12] _lazarevsky: tried couple of the accepted answers on SO to no avail
[16:11:41] _lazarevsky: I can't have newrelic.yml
[16:11:47] mikecmpbll: have you created a config/newrelic.yml
[16:12:50] slash_nick: _lazarevsky: why can't you have a newrelic.yml?
[16:13:13] _lazarevsky: I thought it would be auto-=generated
[16:13:20] _lazarevsky: I thought it it included in the gem
[16:13:35] _lazarevsky: so as soon as I run the bundler I was expecting the installer to insert that file.. that's all
[16:14:24] slash_nick: ah, most gems don't do that on install... i think they typically provide generators or give you some instruction in the readme
[16:17:40] slash_nick: _lazarevsky: this one gives instructions in the readme :) "Once you receive the welcome e-mail with a license key and newrelic.yml file, copy the newrelic.yml file into your app config directory."
[16:18:18] _lazarevsky: slash_nick: but i never registered
[16:19:28] slash_nick: _lazarevsky: you'll have to...
[16:20:36] slash_nick: _lazarevsky: if you want to emit info to their app and then use their app to gain insight, you'll have to register... there are alternatives where you set up an APM server yourself and emit data to your own APM server
[16:25:40] slash_nick: _lazarevsky: at the very least you'll get a free t-shirt :)
[16:33:04] s2013: my rvm folder is 3 gigs is that normal
[16:34:00] mikecmpbll: _lazarevsky: you don't need to register with new relic by the way
[16:34:15] mikecmpbll: to use it in dev mode.
[16:34:58] _lazarevsky: mikecmpbll: yea.. I've been trying to get this thing working
[16:35:03] Sigma00: you need to register to get any sort of info out of it, and new relic has a free tier
[16:35:03] _lazarevsky: I cant seem to set it up properly
[16:35:15] mikecmpbll: Sigma00: no you don't.
[16:35:25] mikecmpbll: what is it with all the bad advice in here today :p
[16:35:31] mikecmpbll: kidding, of course
[16:35:56] kedric: Can someone please tell me I am doing this wrong and point me the right way? I have a leaderboard API that I want to render an HTML partial in the json response. How do I load a partial without calling render in the controller?
[16:35:57] mikecmpbll: but yeah, you can use the dev mode middleware to look at request performance info
[16:37:09] mikecmpbll: anyway, gotta go.
[16:37:10] workmad3: Sigma00: just adding 'newrelic_rpm' to your Gemfile gives you a '/newrelic' endpoint in dev mode that gives you dev-mode profiling info
[16:37:21] Sigma00: well... fuck me silly
[16:37:35] elaptics: preferably not :)
[16:37:36] Sigma00: this is what happens when you don't read all the documentation <_<
[16:37:48] roelof: if I add this "require 'app/models/member.rb' " to a cucumber file I see this error : cannot load such file -- app/models/member.rb (LoadError)
[16:37:49] slash_nick: ACTION lines up behind Sigma00 
[16:39:24] elaptics: roelof: are you trying to run cucumber separately or are you loading the rails env up first?
[16:40:14] _lazarevsky: sorry I got d/c
[16:40:15] roelof: elaptics: I think seperatly. Im working on the nitrious.io platform
[16:40:30] _lazarevsky: whoever said that using newrelic is as easy as adding the gem to the Gemfile
[16:40:36] _lazarevsky: i'm afraid is wrong.. :/
[16:41:39] elaptics: roelof: oh, don't really know about that. It's basically just a case of knowing what your load paths are. You might find it easier to use require_relative which will just expect the path to the file relative to the file you're using it in
[16:42:20] roelof: where can I find that rails env file ??
[16:43:08] elaptics: roelof: is it a rails app you're developing here?
[16:43:27] workmad3: _lazarevsky: ah yeah, sorry... you need to drop in a 'config/newrelic.yml' that has 'development: developer_mode: true' in it (normal yml)
[16:43:33] roelof: elaptics: yep
[16:44:13] _lazarevsky: gonna try it now
[16:44:16] workmad3: _lazarevsky: the gem doesn't auto-generate that as you typically download a version from newrelic with your API key already in-place
[16:44:31] _lazarevsky: but I'm not a user of new relic?
[16:44:34] elaptics: roelof: been a while since I used cucumber but there should be a support/env.rb that it'd be loading which usually loads the rails env so your models, etc would be available
[16:44:35] _lazarevsky: i'm not even a member of their website
[16:44:42] _lazarevsky: where can I download the newrelic.yml file?
[16:44:44] bricker`work: _lazarevsky: heh
[16:44:55] workmad3: _lazarevsky: you just write it with the line to turn on developer_mode ;)
[16:45:13] bricker`work: _lazarevsky: you should up for their service (there is a decent free version) and then download the YML file
[16:45:25] _lazarevsky: workmad3: were you trolling me?
[16:45:57] slash_nick: bricker`work: plus the free t-shirt, but i already told him about that :)
[16:45:59] workmad3: _lazarevsky: don't expect newrelic to document that though... if you aren't a user, they don't particularly care about you
[16:46:02] workmad3: _lazarevsky: and no
[16:46:11] bricker`work: slash_nick: WHAT!! I never got one
[16:46:12] roelof: elaptics: thanks, I will ask the nitrious people for help
[16:46:26] joshsmith: if I have an array of AR objects which have a has_many, for example Question has_many :skills, how would I get all the unique skills for those objects?
[16:46:29] bricker`work: slash_nick: then again, I haven't signed up for newrelic myself since 2008 or something
[16:46:33] workmad3: _lazarevsky: I just forgot that you need to turn on developer mode for NR... I've never bothered not having a downloaded newrelic.yml in place
[16:46:33] slash_nick: bricker`work: yeah me neither... something about the process was broken. i got a t-shirt when i visited their office though!
[16:46:50] _lazarevsky: workmad3: could I not reuse yours then?
[16:46:55] slash_nick: bricker`work: it says "Data nerd."... I wore it before a year before it dawned on me: "Date a nerd."
[16:46:56] workmad3: _lazarevsky: no
[16:47:00] workmad3: _lazarevsky: it has my API key in
[16:47:10] slash_nick: i wore it *for* a year
[16:47:10] _lazarevsky: let me reg with the god damn suckers then
[16:47:12] joshsmith: [#<Question id: 2>, #<Question id: 3>], for example
[16:47:17] workmad3: _lazarevsky: and I gave you the 2 lines you need to use it in dev mode
[16:47:31] mozzarella: anyone familiar with best_in_place?
[16:47:53] joshsmith: if I do questions.map(&:skills) that returns an array of ActiveRecord::Associations::CollectionProxy
[16:48:01] workmad3: _lazarevsky: you don't need to sign up... you just stick two lines in 'config/newrelic.yml'
[16:48:09] slash_nick: mozzarella: just to the exten that I've seen people ask questions about it... I personally would not use it. It's easier to write some jquery/javascript
[16:48:17] _lazarevsky: workmad3: ok added the line to newrelic.yml
[16:48:19] workmad3: _lazarevsky: not saying *don't* sign up... they're useful :)
[16:48:29] slash_nick: ahem, free t shirt
[16:48:30] workmad3: _lazarevsky: put a newline and indent after 'development:'
[16:48:40] _lazarevsky: what does "dont forget to turn on developer mode for NR"
[16:48:45] _lazarevsky: what's NR ? :/
[16:48:55] workmad3: ACTION facepalms
[16:49:01] _lazarevsky: um yea.. sorry fellows it's been a looong long day..
[16:49:43] mozzarella: slash_nick: I??get this error: http://i.imgur.com/4qAB4Kd.png
[16:51:41] slash_nick: mozzarella: so i see that the #best_in_place method is supposed to act like a *_path helper...it tries to create a "category_path" using the category held in the variable c... have you defined a route for category_path? paste the output from running `rake routes` at your command line into a gist (http://gist.github.com)
[16:52:39] _lazarevsky: workmad3: you beauty!! :*
[16:52:43] _lazarevsky: workmad3: thanks so much man!
[16:53:16] mozzarella: slash_nick: no, category is only available in the admin namespace, I??tried best_in_place [:admin, c], but it didn't work either
[16:53:33] mozzarella: http://paste.fedoraproject.org/114397/41471861/
[16:53:35] orolo: design question: i'm using a helper to add markup to list items. i'm implementing an infinite scroll. i can't access that helper method in the js. here comes the q:
[16:53:53] orolo: q: do i decorate that li in the controller and then return an array of li items?
[16:54:28] _lazarevsky: workmad3: actually I take that back.. I can see the newrelic console.. but it doesnt trace anything :/
[16:55:17] orolo: so, i from the mymodel.js.erb, i don't have access that the methods.
[16:55:25] _lazarevsky: workmad3: I would appreciate if you could help me out with this.. this thing should trace every controller requests by default, no?
[16:59:50] workmad3: _lazarevsky: it's been quite a while since I've used the dev-mode console tbh... that's what it's done when I've used it in the past though, but I don't think it live-reloads
[17:00:08] _lazarevsky: lol that's alright
[17:00:10] _lazarevsky: i refreshed..
[17:00:15] _lazarevsky: there's nothing there
[17:04:45] Sigma00: anything that depends on an initializer won't live-reload
[17:07:51] bricker`work: slash_nick: their whole "Data Nerd" campaign always seemed stupid to me
[17:08:32] bricker`work: slash_nick: like, "You want/have to know details about your website's performance? LOL NERD!!!!"
[17:16:59] pipework: banisterfiend: I'm playing with a couple pretty neat things I hope you'll like. but I'll try to get them to work outside of the context of a rails app. Who wants to set all that shit up? :D
[17:25:51] mr_foobar_baz: I need to add some static info pages to my project like TOS, site notice and help. What is the best practice to do that? A InfoPage scaffold with a content:text, so the pages are rows in the DB or a controller InfoPage that has an action and a view for each page?
[17:27:33] laudace: Getting a weird error when I try to use rspec3, capybara, and rails??? spec/support/helpers.rb:2:in `block in <top (required)>': uninitialized constant Features (NameError) more: http://pastie.org/9341062 any ideas?
[17:27:47] mr_foobar_baz: For the first approach I would have to create some kind of DB migration that adds the default info pages when the database is created..
[17:29:24] magnetica: need some help with the syntax please, <%= form_for [@profile, @portfolio], :html => { :multipart => true } do |f| %> multipart doesn't work ? can't figure out why
[17:29:34] rapha: Hi! Is there any way to validate a text field's format with more than one regexp?
[17:32:06] phat4life: rapha: just combine your regex into one
[17:32:47] phat4life: http://rubular.com/
[17:33:26] pipework: mr_foobar_baz: Static pages served by your webserver.
[17:33:43] pipework: No reason to involve rails if they're truly static.
[17:34:12] magnetica: Anyone, please <%= form_for [@profile, @portfolio], :html => { :multipart => true } do |f| %> multipart doesn't work ? can't figure out why
[17:34:36] mr_foobar_baz: pipework: So I just put some .html files in the /public folder?
[17:35:00] pipework: mr_foobar_baz: however you want your webserver to reach them for serving.
[17:35:21] pipework: assuming a single webserver is in front of your app and you're not offloading to a CDN, probably public/
[17:35:53] mr_foobar_baz: pipework: actually that wouldn't work because I do want those pages to be displayed within the usual application layout
[17:36:00] mr_foobar_baz: pipework: and I might want to use erb
[17:36:36] Sigma00: magnetica: multipart is only for form_tag
[17:36:45] mr_foobar_baz: pipework: although erb is optional
[17:37:03] pipework: mr_foobar_baz: Then in that case, just make views that get rendered and consider caching the whole page if there's nothing dynamic, otherwise you could cache parts.
[17:37:24] Sigma00: magnetica: no need to add it on a form_for
[17:37:28] pipework: It'd be a shame to waste time rendering a page that doesn't change or have dynamic data.
[17:37:31] lunks: mr_foobar_baz: take a look at high_voltage gem
[17:37:44] pipework: You don't need a gem for it, but if you like dependencies, go for it.
[17:37:46] mr_foobar_baz: pipework: oh yes I can create views without a controller.. been a while :P
[17:37:58] rapha: phat4life: i'm using Regex.union() now. Looks a little cleaner.
[17:38:03] lunks: pipework: That sounds a lot like premature optimisation
[17:38:05] pipework: mr_foobar_baz: You'd still need to route the request to a controller that just renders the html.
[17:38:20] phat4life: rapha: that is probably worse
[17:38:30] mr_foobar_baz: so basically "rails g controller info_page page1 page2"
[17:38:48] pipework: mr_foobar_baz: Pretty much.
[17:38:52] rapha: phat4life: should be the exact same thing, shouldn't it?
[17:38:54] lunks: mr_foobar_baz: take a look at high_voltage, it's intended to exactly what you want to do.
[17:38:58] pipework: My morning guffaw, provided lovingly by lunks.
[17:39:05] lunks: pipework: <3
[17:39:13] phat4life: yeah but maybe you should rethink your regex if you have to use uion
[17:39:18] pipework: lunks: If anything, it's just repeating code that someone may have written before.
[17:39:24] pipework: Not so much optimization.
[17:39:37] mr_foobar_baz: lunks: well, pipework is right.. I don't think I need a gem for that
[17:40:13] mr_foobar_baz: lunks: thanks for the suggestion though
[17:40:35] lunks: mr_foobar_baz: np
[17:40:37] mr_foobar_baz: pipework: and thank you for confirming my plans
[17:40:42] lunks: pipework: happy monday :)
[17:40:43] pipework: mr_foobar_baz: cheers, sir
[17:40:45] pipework: lunks: IKR!
[17:40:50] pipework: lunks: You like pretty things, right?
[17:41:06] lunks: who doesn't, pipework?
[17:41:13] pipework: lunks: Narcissists.
[17:41:28] mozzarella: "couldn't find file 'best_in_place'"
[17:41:31] mozzarella: (????;____;)
[17:41:44] pipework: mozzarella: Did you add the gem to your gemfile and bundle?
[17:41:59] lunks: restart server?
[17:42:09] mozzarella: I??can even call the best_in_place method
[17:42:21] pipework: https://github.com/bernat/best_in_place#rails-31-and-higher
[17:42:22] mozzarella: but I??can't require the javascript part of it
[17:42:46] mozzarella: that's what I did, man
[17:43:09] pipework: I'm looking, just wanted to link it here. Seems like an annoying thing to do.
[17:43:17] pipework: s/do/happen/
[17:44:14] antivert: I've got a form for foo has_and_belongs_to_many bars, I've got a list of bars when you create or edit foos. If you remove bars from the list, they don't get de-associated from foo on submit.
[17:44:30] antivert: Is best practice in this case to just clear any associated bars that aren't sent with the form?
[17:46:21] pipework: antivert: Rather than removing from the list, just add a 'destroy: true' attribute to the bar
[17:46:31] pipework: At least send the id of the bar and the destroy: true
[17:47:03] pipework: On the frontend you can hide it if you want, but you can also make an easy 'undo' button by just showing it and removing the 'destroy: true'.
[17:47:04] antivert: pipework: that destroys the record? I just want to destroy the association, not the record of bar itself
[17:47:07] magnetica: really need some help here please, <%= form_for [@profile, @portfolio], :html => { :multipart => true } do |f| %> multipart doesn't work ? can't figure out why
[17:47:23] pipework: antivert: Oh you want to disassociate. I'd probably do something similar.
[17:47:30] rhizome: magnetica: do we already know what "doesn't work" means?
[17:47:50] pipework: rhizome: it just dunt
[17:48:36] willbradley: hey, any idea why this route: `resources :tasks do member do post :complete end end` with this rake routes: `complete_task POST /tasks/:id/complete(.:format) tasks#complete` would fail on this line in a test: `url_for controller: :tasks, action: :complete` with this error: `No route matches {:controller=>"tasks", :action=>"complete"}`
[17:49:22] willbradley: i mean it pretty obviously points to tasks#complete... you'd think that'd be controller: :tasks, action: :complete
[17:49:28] pipework: willbradley: No id?
[17:49:28] bricker`work: willbradley: member routes need an ID
[17:49:46] pipework: /tasks/complete is what it tried to generate.
[17:49:54] antivert: pipework: cool, thanks for your input
[17:49:58] willbradley: my brain just wasn't in it
[17:50:09] pipework: willbradley: Why not just use a PUT to the task where the status or transition is 'complete'?
[17:50:11] willbradley: too much php lately :(
[17:50:47] willbradley: what's the diff between put and post again? these not-actually-supported-but-kinda-faked-by-rails methods make me wonder sometimes
[17:50:55] pipework: antivert: Your controller would have to map out the bars that should have their foo_id removed and then you'd remove it.
[17:50:56] willbradley: put is for existing resources?
[17:51:55] pipework: willbradley: Yeah, which you have if you have an id.
[17:52:06] antivert: pipework: yeah, what type of an element would you put that in the frontend to mark them?
[17:52:08] pipework: antivert: my_bars.map{|bar| bar.foo_id = nil}.each &:save
[17:52:28] pipework: antivert: A hidden attribute, since it's not really a secret, but a convenience.
[17:52:57] willbradley: thanks pipework <3
[17:53:01] pipework: willbradley: Anytime, chum.
[17:53:32] antivert: pipework: ah okay, so a hidden input like to_disassociate[] or something
[17:54:00] pipework: antivert: Yeah. I'd probably say disassociate_parent[1]
[17:54:02] pipework: or something like that.
[17:54:06] antivert: cool thanks man
[17:54:37] pipework: Because you could conceivably disassociate children or even disassociate siblings from the parent. Basically, orphan everything but you, and make yourself an only child.
[17:55:08] pipework: Fratricide?
[17:55:46] phat4life: nah, it just means you program with a popped coller
[17:55:54] pipework: phat4life: <333
[17:57:19] elaptics: antivert: I wasn't really paying much attention but if you're using habtm and accepts_nested_attributes_for then simply adding the allow_destroy key and sending a _destroy key in the form should do the disassociation you're looking for
[17:57:35] boblarrick: why does the precompile rake task generate different results depending on the rails environment, and how can I make it generate the same file regardless of environment?
[17:57:39] pipework: elaptics: But doesn't that destroy the record too?
[17:57:47] elaptics: pipework: not for habtm
[17:57:57] pipework: elaptics: oh neat. Same for HM:T?
[17:57:58] antivert: elaptics: oh cool, I'm not using accepts_nested_attributes_for though
[17:58:00] elaptics: pipework: at least I'm fairly sure :)
[17:58:55] elaptics: pipework: I would think that with a hm through if you're dealing with the join model then that would just destroy itself which is the joins
[17:59:10] willbradley: collars.each(&:pop)
[17:59:49] Rhainur: in minitest, how do I sign in a devise user?
[18:00:09] elaptics: pipework: according to docs for habtm calling delete or destroy on the collection with the objects just results in the association being removed - it doesn't destroy the objects
[18:00:27] pipework: willbradley: collars.map(&:pop).each(&:holler)
[18:00:36] pipework: elaptics: ooh neat
[18:00:41] FifthWall: So, I have an object I'd like to save - a trained Classifier::Bayes - but I'm assuming Madeline won't play well with Heroku. Is Marshaling it and saving that in an Amazon S3 bucket absolutely insane?
[18:00:42] pipework: Rhainur: devise test helpers.
[18:00:54] pipework: FifthWall: yes
[18:00:57] terrellt: Rhainur: https://github.com/plataformatec/devise#test-helpers
[18:00:58] pipework: serialize, don't marshall.
[18:02:58] elaptics: antivert: I don't blame you for not using accepts_nested... but if you're not doing anything clever it might suit your purposes to make use of it :)
[18:03:40] willbradley: this project is the best. task management app, in 'beta'. tasks aren't actually able to be completed yet. not even a db column for completion.
[18:03:59] willbradley: thank you, elance, for endless amounts of cleanup work
[18:04:19] terrellt: FifthWall: Why would you use S3 as the object store?
[18:04:19] pipework: willbradley: Might I suggest using the presence of timestamp columns to determine when something is in a certain state?
[18:04:22] Sigma00: hope this project is hourly then :P
[18:04:29] pipework: Rather than a boolean or a 'state' column.
[18:04:55] willbradley: oh yes. absolutely hourly.
[18:04:59] terrellt: willbradley: That's easy. "I made you a trello account."
[18:05:06] Sigma00: fucking lol
[18:05:28] willbradley: we take the entrepreneur's money and don't tell them that their ideas are dumb
[18:05:36] willbradley: because they're the idea people
[18:05:53] willbradley: also the idea would be kinda cool for a certain niche if programmed correctly
[18:05:59] Sigma00: he wants to sell this shit?
[18:06:18] willbradley: pipework: you mean just completed_at and if null it's not completed?
[18:06:41] Sigma00: willbradley: did your client ever talk about the system being auditable?
[18:06:42] pipework: willbradley: Yes sir.
[18:06:53] terrellt: That gives you a historical account if you use something like paper trail too.
[18:06:59] pipework: willbradley: I'd save the auditability for later using ^^^....
[18:07:12] terrellt: ACTION wins this round
[18:07:14] willbradley: i'd normally do that, i just have been out of the groove for too long cleaning up messes far worse than this one :(
[18:07:49] willbradley: it's not really that serious of an app but yeah having dates is nicer
[18:08:32] pipework: willbradley: If you're ever thinking of multiplayer todo lists, have a companion _by for each _at.
[18:08:55] pipework: Then to figure out the most current state, you could either store that, or just get the most recent date on the record.
[18:09:19] willbradley: that'll probably be the next feature
[18:09:34] terrellt: If you start getting that complicated it might be time to think about a ticket_states table.
[18:09:43] willbradley: they want me to get the app usable in a week tho, so completing tasks is priority #1 ;)
[18:10:01] willbradley: yeah i don't think we need a trello-ish task_logs table
[18:10:16] pipework: a states table couldn't be too bad if you wanted to store who transitioned something backwards in the flow.
[18:10:31] terrellt: Paper trail gives you whodunnit, which helps.
[18:10:33] pipework: willbradley: anyways, have fun! Simple projects are the most fun to flex those mental muscles on.
[18:10:52] terrellt: Indeed. That's where you get to make the fun design experiments.
[18:11:10] terrellt: Instead of the masses of code in large products which rear their huge test suites and laugh at your futile manipulations.
[18:15:05] bricker`work: terrellt: I've never used paper_trail, but this looks awful: https://github.com/airblade/paper_trail/blob/master/lib/paper_trail.rb#L61
[18:15:30] asteve: I would like to redirect in routes.rb and drop the parameters on the redirect
[18:17:41] Criten: bricker`work: talking about the name? haha
[18:18:11] bricker`work: Criten: well, that too, but I was more referring to how it stores the "current user" in a globally-accessible variable
[18:18:33] tubbo: so this is a little annoying...i'm trying to set up a rails app with upstart, and i feel like for each env var i need i have to put it in the upstart script
[18:18:45] terrellt: bricker`work: ?
[18:18:51] terrellt: bricker`work: Why would you not want that information?
[18:19:01] tubbo: anyone else have this issue? trying to store config in env vars but having your rails app being run as a different user than the one you connect on the box?
[18:19:12] tubbo: how do you solve that? /etc/profile.d/ is clearly not working at all for upstart jobs
[18:19:52] Criten: tubbo: I assume you have to set them for the user that runs the server
[18:19:58] bricker`work: terrellt: of course you want it, but storing it globally like that?
[18:20:04] terrellt: tubbo: I put it in my deploy user's bashrc and source that in my script.
[18:20:14] terrellt: bricker`work: What do you mean globally?
[18:20:25] tubbo: Criten: the files in /etc/profile.d/ should be run regardless of what user you're on
[18:20:25] bricker`work: terrellt: This is a better approach imo: https://github.com/SCPR/secretary-rails/blob/master/lib/secretary/has_secretary.rb#L45 Storing the current user on the version, via the object being updated
[18:20:27] terrellt: bricker`work: It's attached to a record in the database.
[18:20:32] tubbo: but i believe that's login shell only
[18:20:37] bricker`work: terrellt: PaperTrail.whodunnit = current_user
[18:20:39] tubbo: so i guess upstart isn't running the login shell :\
[18:20:55] tubbo: terrellt: since it's upstart, my "deploy user" is effectively root i believe
[18:20:59] terrellt: bricker`work: Oh! Yes, that's ridiculous. It makes configuring it for special cases a PITA too.
[18:21:02] pipework: tubbo: You have to source it.
[18:21:09] tubbo: that's lame :\
[18:21:12] pipework: tubbo: Egh, life.
[18:21:13] terrellt: tubbo: Well, that's a problem.
[18:21:24] tubbo: terrellt: seems to be common practice
[18:21:32] tubbo: i dunno, maybe i set this job up wrong
[18:21:38] tubbo: how do you configure the user in an upstart job though?
[18:21:40] Criten: I would make a new user for it
[18:21:45] tubbo: i have a new user for it
[18:21:54] tubbo: it's being run with upstart
[18:21:54] Criten: just pretty much as root creds?
[18:21:55] centrx: Best cloud provider for Rails?
[18:21:57] terrellt: tubbo: http://superuser.com/questions/213416/running-upstart-jobs-as-unprivileged-users
[18:22:18] tubbo: terrellt: ah, thanks man
[18:22:20] terrellt: tubbo: I had no idea it didn't have native support for user switching. That seems like a terrible way to run an app.
[18:22:21] tubbo: terrellt: "A future release of Upstart will have native support for that" HAHAH NOPE
[18:22:28] tubbo: ya, it is
[18:22:30] tubbo: fuck upstart
[18:22:32] Criten: centrx: I use DO and Heroku... Not sure how managed you want :P
[18:22:36] terrellt: Ah, upstart 1.4 has uid and guid
[18:22:39] tubbo: great idea, terrible execution.
[18:22:56] bricker`work: tubbo: agreed. It can't run nginx+passenger properly :(
[18:22:59] centrx: Heroku seems to have repeated reliability problems
[18:23:04] terrellt: God.rb ftw.
[18:23:16] terrellt: centrx: Huh? It's just run on AWS, it should be fine
[18:23:20] tubbo: centrx: define "cloud provider".
[18:23:20] Criten: centrx: yeah. it's been a bit iffy recently.. none of my apps have been affected afaik
[18:23:31] bricker`work: terrellt: upstart watches god watches everything else :)
[18:23:46] bricker`work: or can god watch itself
[18:23:53] tubbo: i'm actually more inclined to go with systemd since that seems to be where all the OS vendors are moving to
[18:24:03] bricker`work: God.rb needs a fairy in a bottle
[18:24:03] terrellt: bricker`work: It should be able to! I think I just hope it doesn't crash - CentOS.
[18:24:19] pipework: systemd is pretty neat, honestly. But that's because I love dbus and the such and systemd has a nicer crond and atd.
[18:24:36] tubbo: pipework: isn't systemd like launchd (for darwin/os x) in that it *replaces* crond and atd?
[18:24:48] pipework: tubbo: It does more than that by a shitload.
[18:24:54] tubbo: obviously
[18:25:03] terrellt: tubbo: There's a LOT of controversy around systemd.
[18:25:04] tubbo: i'm not talking about the whole project
[18:25:12] tubbo: i'm talking about just one part of it
[18:26:44] pipework: It's a greedy thing, honestly.
[18:27:54] terrellt: There was a great hate post on systemd, but I can't seem to find it.
[18:27:55] terrellt: Instead http://ewontfix.com/14/
[18:28:00] pipework: Why doesn't #respond_to? take a block? :((((((
[18:28:07] pipework: if it don't, do dis block plz
[18:28:48] terrellt: Because why not just use an if?
[18:29:18] bricker`work: terrellt: you could say the same thing about match()
[18:29:46] tubbo: terrellt: it can't possibly be worse than upstart
[18:29:54] tubbo: because upstart is a flaming piece of shit
[18:30:19] tubbo: terrellt: you know software is a piece of shit when the company that developed it abandons it within a year or so after reaching production
[18:30:24] pipework: terrellt: Because then I don't need to switch, I can just tell.
[18:31:02] terrellt: bricker`work: I'd be pretty happy if match returned a blank array.
[18:31:28] pipework: receiver.respond_to? :nope, &:another_method_on_reciever
[18:32:01] terrellt: pipework: It just seems like strange behavior.
[18:32:02] pipework: Or just a block whatever.
[18:32:06] pipework: terrellt: It'd save some lines.
[18:32:21] pipework: It's fetch for objects.
[18:32:28] pipework: that ain't hash-like, that is.
[18:32:30] Rhainur: terrellt, pipework: I can't seem to get the users to sign in
[18:32:34] Rhainur: I'm using the devise helper in minitest
[18:32:50] Rhainur: but it still triggers the redirect to the "access denied" page
[18:32:55] pipework: Rhainur: I'm not a devise kind of ginger, sorry.
[18:33:07] terrellt: Does the user you logged in with have access?
[18:33:54] terrellt: You suuurree?
[18:34:28] terrellt: (Also, this is a controller test, right?)
[18:35:03] Rhainur: the role that I have assigned to it in the fixture is the role that has access. That being said, I tried to access "current_user" within the controller test but I guess that Devise helper isn't available
[18:35:06] Rhainur: only sign_in and sign_out
[18:35:19] tubbo: Rhainur: did you follow *all* the instructions?
[18:35:56] Rhainur: I included the devise helpers, and added "sign_in users(:one)" to my setup
[18:36:09] tubbo: Rhainur: what about this line? `@request.env["devise.mapping"] = Devise.mappings[:user]`?
[18:36:24] tubbo: Rhainur: https://github.com/plataformatec/devise#test-helpers
[18:36:43] Rhainur: isn't that only if I'm doing this: "If you are testing Devise internal controllers or a controller that inherits from Devise's"
[18:37:35] phat4life: pipework: it doesn???t though doesn???t it?
[18:37:54] pipework: phat4life: whut?
[18:38:06] phat4life: technically every method in ruby accepts a block
[18:38:17] phat4life: implicitially
[18:38:20] deontologician: When creating a rails application template, is it possible to set the --skip-active-record behavior? It seems like the files are already generated by the time the template code is executed
[18:38:39] Rhainur: tubbo: that's not required to test a normal controller is it
[18:38:51] tubbo: Rhainur: define "normal controller"
[18:39:04] tubbo: Rhainur: no, you need to do that every time.
[18:39:40] Rhainur: well it says "devise internal controllers or controllers that inherit from Devise's"
[18:39:48] phat4life: deontologician: --skip-migration
[18:40:26] phat4life: deontologician: you mean for scaffolding right?
[18:40:36] phat4life: ie, rails generate scaffold
[18:41:06] deontologician: phat4life: I'm thinking like `rails new blog -m my_template.rb` and my_template.rb would do the --skip-active-record without the user needing to at the command line
[18:41:11] tubbo: Rhainur: i typically do this https://gist.github.com/tubbo/0de560ca2df70588d4d0
[18:41:33] tubbo: Rhainur: nah you gotta do that every time, it has to do with how devise figures out the session
[18:42:24] tubbo: when you don't use devise and do this stuff yourself, you have to write all of your requests like: `post :create, { model: { name: 'test' } }, { user_id: 123 }`, if you're checking session[:user_id] in the controller to authenticate
[18:42:38] tubbo: because the first hash is params, but the 2nd hash is session params
[18:49:04] Rhainur: tubbo: where does that MockAuthentication go?
[18:49:13] Rhainur: spec/support?
[18:49:29] Rhainur: I assume that's RSpec related
[19:01:05] magnetica: need help with the uploading an image with paperclip, please <%= form_for [@profile, @portfolio], :html => { :multipart => true } do |f| %> error: no handler found
[19:02:29] bricker`work: magnetica: gist the full error and stack trace
[19:04:48] magnetica: bricker`work: sure
[19:07:34] magnetica: bricker`work: here you go https://gist.github.com/Jaffery5/608ae02164752b040d11
[19:12:25] bricker`work: magnetica: Since you have an array of files, you need to loop through them and send them to paperclip
[19:13:21] rien: in Rails 4 how do I make a "route_missing" route that is a catch-all, but that when it calls its method, I can know from within the method the HTTP verb used and the route attempted?
[19:13:29] bricker`work: or I guess you could write an Array adapter, which does that for you... might be a bad idea, not sure
[19:14:06] poporul: rien: get '*path', to: 'application#routing_error' for example
[19:14:29] magnetica: bricker`work: i'm already looping through them here is updated gist: https://gist.github.com/Jaffery5/608ae02164752b040d11
[19:14:45] rien: poporul: Thank you for that, I found that on the web as well but I don't know how to find the HTTP verb used from that
[19:16:36] tubbo: Rhainur: that's where i put it
[19:16:41] rhizome: rien: read up on the request object
[19:17:40] rien: rhizome: oh wow so request.method was there all along?
[19:17:49] bricker`work: magnetica: yeah you're looping through but then you're just passing params[:images] into portfolio.create()
[19:17:51] rien: rhizome: I think that's it. thanks!
[19:18:13] bricker`work: magnetica: you should probably be passing your `image` local variable into that
[19:18:27] workmad3: rien: I'd suggest using request_method rather than method
[19:18:54] elaptics: magnetica: is each portfolio an image? so you're actually creating as many portfolio images as images that are selected?
[19:19:17] workmad3: rien: request_method is method that's intended (e.g. if a POST is made with a _method=patch param, that's meant as a PATCH... request_method would give you PATCH, method would give you POST)
[19:19:22] rien: workmad3: or request_method_symbol even!
[19:19:25] magnetica: bricker`work: yes, that's correct
[19:19:28] elaptics: magnetica: and also just +1 bricker`work for why it's not working :)
[19:19:47] rien: workmad3: gotcha, that makes sense!
[19:20:01] magnetica: elaptics: how do i do that?
[19:20:11] elaptics: magnetica: do what?
[19:20:44] bricker`work: +1000 brickercoins for bricker
[19:21:10] elaptics: 1000 brickercoins == $0.001 ?
[19:21:15] magnetica: oh oh ... i see once we find the solution to that sucker though
[19:21:16] bricker`work: elaptics: I wish :(
[19:21:31] bricker`work: elaptics: I'd be a very rich man
[19:21:36] elaptics: bricker`work: because then you'd have like $0.01
[19:21:47] bricker`work: elaptics: no see, because I can dole out as many brickercoins as I want
[19:21:51] bricker`work: elaptics: even to myself
[19:21:58] rails_nubyist: can someone possibly give me a few minutes on a problem I am having with a HABTM count query?
[19:22:11] helpa: rails_nubyist: Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
[19:22:11] elaptics: rails_nubyist: !ask2ask
[19:22:42] elaptics: magnetica: so, is your problem solved?
[19:22:55] magnetica: elaptics nope, not yet
[19:22:56] rails_nubyist: I have 3 models Trader/Location/Service where a Trader HABTM Locations and a Trader has many Services
[19:23:06] rails_nubyist: For a Location instance I am trying to return all of its traders in descending order of the count of services. I have managed to get 2 queries to actually return results
[19:23:16] rails_nubyist: l = Location.find_by_post_code("G1")
[19:23:16] rails_nubyist: l.traders.includes(:services).order('COUNT(services.id) DESC').group("services.id", "traders.id").references(:services)
[19:23:24] rails_nubyist: l = Location.find_by_post_code("G1")
[19:23:24] rails_nubyist: l.traders.includes(:services).select("services.id, count(services.id) as count").group("services.id", "traders.id").references(:services)
[19:23:31] helpa: rails_nubyist: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:23:31] elaptics: rails_nubyist: !gist
[19:23:33] rails_nubyist: They return the right Traders but in the wrong order
[19:24:02] magnetica: bricker`work: not getting what you mean by passing it through a local variable? please explain
[19:24:25] elaptics: magnetica: https://gist.github.com/Jaffery5/608ae02164752b040d11#file-portfolio_controller-rb-L6
[19:24:50] elaptics: magnetica: you're passing the whole images array from the form into a single object
[19:25:16] elaptics: magnetica: you probably want to be passing in the image variable you're working with in the #each since you're not doing anything else in the loop...
[19:25:16] magnetica: elaptics: ok
[19:25:28] elaptics: otherwise why else are you doing it
[19:26:27] bricker`work: magnetica: The blog post that you copied this code from is correct, you should double-check it
[19:27:09] elaptics: magnetica: hence my original question about what is "portfolio" - is it one image per portfolio object that you're trying to do here?
[19:27:48] poporul: magnetica: I think the paperclip expect kind of stringio, file, etc., but instead it accept array, then "No handler found for (array)"
[19:27:53] rails_nubyist: https://gist.github.com/JonleePeakman/be2450f6cf7f402ec519
[19:29:03] magnetica: poporul: even when i try it without an array, just a single image i get uploading error
[19:29:28] elaptics: magnetica: have you altered the create line as bricker`work suggested?
[19:29:29] poporul: same error?
[19:29:43] poporul: magnetica: same error?
[19:30:32] elaptics: rails_nubyist: the 2nd version - you haven't selected anything to order them by
[19:30:33] poporul: try to debug paperclip with pry
[19:30:47] magnetica: bricker`work: elaptics not sure what bricker`work suggests, here feel free to edit https://gist.github.com/Jaffery5/608ae02164752b040d11
[19:31:07] rapha: phat4life: i don't have to use union. i'm just using it so the two regexps remain visually separate.
[19:31:33] phat4life: rapha: is this in a validation?
[19:31:38] rails_nubyist: Can I say order('count')?
[19:31:51] elaptics: magnetica: https://gist.github.com/andyh/103d0d25bac8c81ae318#file-portfolio_controller-rb-L6
[19:32:13] elaptics: rails_nubyist: yep, should be able to
[19:33:25] rails_nubyist: adding .order('count DESC')
[19:34:28] elaptics: rails_nubyist: gotta go, but try it in a rails console and call #to_sql on it to see resulting sql. Create the raw sequel you're looking for which gives correct results and compare them
[19:35:49] rails_nubyist: My SQL is worse than my Ruby im afraid
[19:37:41] workmad3: rails_nubyist: btw, did you mean '.select("traders.id, count(services.id) as count")' instead of services.id repeated there twice?
[19:39:13] workmad3: rails_nubyist: and you most likely only want '.group("traders.id")'
[19:39:39] rails_nubyist: Nah I need services.id
[19:39:50] rails_nubyist: If I dont include it Postgresql moans about not having it in FROM clause
[19:39:51] workmad3: rails_nubyist: then you've got a very confusing query there
[19:39:58] rails_nubyist: sorry GROUP BY clause
[19:40:36] workmad3: rails_nubyist: try 'l.traders.joins(:services).select("traders.id, count(services.id) as count").group("traders.id").order("count DESC")
[19:40:59] workmad3: rails_nubyist: as I'm guessing you're trying to get the count of services for each trader id
[19:41:48] rails_nubyist: That is returning the correct stuff I think
[19:41:50] rails_nubyist: Gimmie 2 secs to test
[19:42:21] rails_nubyist: It only returns the IDs but its in the right order
[19:42:26] workmad3: rails_nubyist: if it was complaining previously, it was because you'd done '.select("services.id, count(services.id)")'
[19:42:44] workmad3: rails_nubyist: well yeah... the query tells it to return only ids ;)
[19:43:10] rails_nubyist: Honestly, thats been bugging me for 2 days
[19:43:38] rails_nubyist: Thank you so much!
[19:46:06] workmad3: rails_nubyist: just remember, when you use a .group, then you can only .select those columns directly
[19:46:36] workmad3: rails_nubyist: but you can use ungrouped columns in aggregate functions (sum, count, max... that sort of thing)
[19:48:54] rails_nubyist: thats what aggregate functions means
[19:49:52] rails_nubyist: But I can still select as many as I want right without having to mention them in the group?
[19:50:31] workmad3: rails_nubyist: if you use a group, you can't select anything ungrouped that isn't aggregated
[19:50:36] workmad3: rails_nubyist: as I just said :P
[19:51:03] workmad3: rails_nubyist: so if you use 'group("traders.id")' then you *can't* do '.select("traders.name")'
[19:51:50] workmad3: rails_nubyist: or, as the postgres manual puts it - 'When GROUP BY is present, it is not valid for the SELECT list expressions to refer to ungrouped columns except within aggregate functions, since there would be more than one possible value to return for an ungrouped column.'
[19:56:27] rails_nubyist: Honestly it's so hard to remember all this stuff
[19:59:30] workmad3: rails_nubyist: the postgres manual is pretty good IMO
[20:02:18] rails_nubyist: Yeah I am trying to wrap my head around Ruby/Rails
[20:02:27] rails_nubyist: I don't want to depend on OML alone though so will need to get to it
[20:03:10] rails_nubyist: Object Mapping Language right?
[20:03:32] terrellt: You're probably looking for ORM.
[20:03:55] rails_nubyist: My name isn't for laughs you know :)
[20:04:10] terrellt: Don't worry about it, coming to Rails and web development all at once is stifling to say the least.
[20:04:30] tubbo: rails_nubyist: i'm laughing
[20:04:48] rails_nubyist: I am good(ish) with schemas and data modelling
[20:04:49] tubbo: rails_nubyist: btw OML is a real thing as well http://en.wikipedia.org/wiki/OML
[20:05:04] rails_nubyist: But thats such a small part
[20:05:35] terrellt: We are not friends
[20:05:42] wasamasa: I have to admit the rails ORM is handy so far
[20:05:51] wasamasa: weren't it for the occasional, huge backtraces
[20:06:03] rails_nubyist: Totally but it seems SQLite lets you away with so much more than Postgresql
[20:06:05] wasamasa: let's hope I won't run into it soonish
[20:06:58] tubbo: rails_nubyist: one thing i've noticed with your code (and others who have experience in SQL) is that you're selecting out different pieces of the table rather than loading all of its content into an object
[20:07:15] tubbo: rails_nubyist: when you use an ORM, you sometimes forfeit control over performance cases such as this
[20:07:34] tubbo: until you actually need to fine-tune a query, i suggest NOT using the select() method in Arel anymore :P
[20:08:04] terrellt: Give up the millisecond. Rails is a bigger percentage anyways.
[20:08:04] tubbo: by telling rails "no, you're wrong, *I* know what I want out of the table", you're basically giving ActiveRecord (the ORM) the middle finger
[20:08:47] slash_nick: tubbo: does the ORM not like that?
[20:08:49] rails_nubyist: I would prefer to bring back the whole Trader objects
[20:09:09] rails_nubyist: But I have just hooked up that code to my controller it works perfectly
[20:09:14] sharpmachine: Hi there. I have a model with a column for "website". A user submits their sites address in the front end form. How do I store that url in the database without the http://?
[20:09:30] tubbo: rails_nubyist: you basically want a count of all traders in a specific location, correct?
[20:09:47] rails_nubyist: I want a count of all services a trader provides in a location
[20:09:54] rails_nubyist: So a user puts in the postcode G1
[20:10:07] rails_nubyist: It displays all of the traders who provide services there
[20:10:13] rails_nubyist: But orders it by who provides the most services
[20:11:02] rails_nubyist: At the end of the day someone from EH1 might provide only 1 service in G1 and I have a trader who is actually absed there with multiple but they were coming up in the order created
[20:11:08] tubbo: rails_nubyist: is there a has_many :services on Location?
[20:11:09] s2013: anyone here used dynamodb with rails?
[20:11:25] rails_nubyist: I use a range in the services
[20:11:54] rails_nubyist: Yeah a trader might go 5 miles to build a fence but 50 to convert a house etc.
[20:12:07] rails_nubyist: So I use the maximum range to identify all of the locations a trader trades in
[20:12:35] rails_nubyist: So I have some logic that if a service is created and changes the maximum range it updates the locations
[20:12:36] tubbo: that's a little more complicated
[20:12:43] rails_nubyist: same with changing a range on a current service that gets checked too
[20:13:00] rails_nubyist: I have hooked it all up and it works great
[20:13:02] rails_nubyist: but I couldnt get that last part
[20:13:07] mubi: hey guys, how can I force a file field to be named somethign specific like : validates_format_of :mlease, :with => /\A"master_lease"\z/, message: "Master lease pdf must be called master_lease"
[20:13:41] rails_nubyist: The biggest bugger is if a trader moves central location
[20:14:04] rails_nubyist: So I make sure to only add/remove the locations necessary
[20:14:06] tubbo: mubi: what's with the quotes in your regex?
[20:14:17] rails_nubyist: This way I keep the row count to a minimum
[20:14:36] rails_nubyist: I had it differently so the HABTM was on the Service-Location
[20:14:41] rails_nubyist: But the row count was getting a bit insance
[20:14:48] tubbo: mubi: it's not matching because those quotes are in there
[20:14:51] mubi: tubbo: I modified ???[0-9]+???, left the quotes in, yea think that???s it?
[20:15:03] tubbo: mubi: http://www.rubular.com find out for yourself :)
[20:15:13] rails_nubyist: I love rubular!
[20:15:14] mubi: AWESOME!
[20:15:14] tubbo: mubi: http://rubular.com/r/FvxQ0gecOn
[20:15:30] mubi: love this channel lol
[20:15:34] sharpmachine: Hi there. I have a model with a column for "website". A user submits their sites address in the front end form. How do I store that url in the database without the http://?
[20:15:41] tubbo: we're not nearly as cool as rubular tho
[20:15:58] workmad3: sharpmachine: I'd suggest storing it with the http://
[20:16:05] workmad3: sharpmachine: or https:// if it happens to be that
[20:16:11] tubbo: sharpmachine: you could add a before_validation that sets self.website to website.gsub(/\Ahttp:\/\//, '')
[20:16:39] workmad3: sharpmachine: if anything, I'd personally *add* the http:// if it was missing, rather than remove it if present :)
[20:16:41] sharpmachine: ok, how do I output it in the view without the http:// then?
[20:16:46] workmad3: sharpmachine: you don't
[20:16:56] workmad3: sharpmachine: at least, you don't link to it without the http://
[20:16:59] rails_nubyist: if you really have to shave off the first 7 characters
[20:17:34] sam452: My Windows fu is weak. To download a copy of my postgresql from Heroku, I enter curl -o latest.dump 'heroku pgbackups:url'
[20:17:35] tubbo: sharpmachine: your view presenter could just do model.website.gsub(/\Ahttp:\/\//, '') :D
[20:17:38] workmad3: sharpmachine: if you link to it without the scheme, you generate a relative link and the link then goes to '<url of your site>/whatever/www.theirwebsite.com/foobar'
[20:17:50] tubbo: gsub() will just return the same string if it doesn't find a match
[20:17:51] sharpmachine: I'll still use the http:// in the href but the text I'd like to display is the URL without the http://
[20:17:53] rails_nubyist: but then if you have an https:// your in a pickle
[20:18:24] workmad3: sharpmachine: as tubbo suggests, have a view presenter or view helper that strings the scheme off if present
[20:18:26] sam452: But the error is from curl: could not resolve host: 'heroku pgbackups
[20:18:48] sharpmachine: Let me try that.
[20:18:49] sam452: I've been reading up the curl pages and Google but this is throwing me.
[20:18:51] workmad3: sharpmachine: either with gsub or by parsing with URI and outputting stuff minus the scheme
[20:19:41] workmad3: sharpmachine: I'd suggest you do a validation with URI that ensures the URL is valid and is either http or https btw
[20:19:55] tubbo: it seems the best practice with data persistence is "save everything, present as you wish"
[20:20:11] tubbo: so save whatever the user typed in, but write code to always present it in the same manner regardless of how it started
[20:20:12] workmad3: sharpmachine: unless you fancy the idea of someone inserting a javascript: url in and potentially hitting your users with a XSS attack ;)
[20:20:50] tubbo: "GOD DAMMIT I CLICKED A GOPHER LINK"
[20:21:32] workmad3: tubbo: heh :) good point, it should also allow gopher links...
[20:23:33] tubbo: do people actually use that thing anymore?
[20:25:08] terrellt: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/uri/rdoc/URI.html Just sayin'.
[20:26:58] workmad3: tubbo: you never know... and besides, I'm sure some neckbeard will jump on a service that lets them put their old gopher link in as a website url...
[20:27:03] rails_nubyist: how do you break a line of code over multiple lines if its getting too long?
[20:27:26] marahin: Hey guys. I am having a lot of trouble install 'eventmachine' gem in Windows. I managed to install it (through patching project.h && building & installing it with --local flag), although now my rails app says that it cannot be loaded.
[20:27:32] terrell_t: rails_nubyist: Think real hard about what's going on first.
[20:27:37] marahin: LoadError: cannot load such file -- eventmachine
[20:27:43] workmad3: rails_nubyist: I cut my monitor in half and put the right-hand side underneath....
[20:28:03] marahin: I know Windows isn't the best platform to develop, but my Windows machine is the most powerful and the most desktopish..
[20:28:11] take_it_t: when i try using root_url in a mailer view i get ???Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true???
[20:28:33] rails_nubyist: yeah I figured thats what you meant
[20:28:43] webdestroya: take_it_t: yes, you need to set those options in your environment config
[20:28:46] workmad3: take_it_t: http://guides.rubyonrails.org/action_mailer_basics.html
[20:28:53] terrell_t: take_it_t: Um. You should probably provide the host option to default_url_options.
[20:29:00] workmad3: Tarential: http://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views specifically
[20:29:00] terrell_t: Just a thought though.
[20:29:14] workmad3: err, sorry Tarential, that was meant to take_it_t who vanished :)
[20:29:26] workmad3: take_it_t: http://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views
[20:29:29] take_it_t: sorry, colloquy crashed when i tried to click that link
[20:29:52] workmad3: take_it_t: heh
[20:31:57] take_it_t: workmad3: thanks, ???the mailer instance doesn't have any context about the incoming request???, i should have known better
[20:34:42] mtsmith85: Hi All ??? I???m curious about separating our workers from our main rails application. Been thinking about creating separate gems or little ruby script daemons for the workers separate from our Rails app. Does anyone mind sharing their thoughts on this being a bad idea or if there is virtue in spinning them out of the rails app?
[20:36:43] tubbo: mtsmith85: why do you want to do this? also, define "workers"...like, background job workers?
[20:38:38] mtsmith85: tubbo: We???re bringing in a approx 25 to 30k content items a day. They???re chucked in a queue (SQS). I want to have the backround workers (which are in a separate service environment from the main rails app), processing those content items (parsing and sending into different DBs). I was thinking that separating them from the rails app would allow those workers to be leaner.
[20:39:07] TheLarkInn: How would you generate a full path for a model object in rails
[20:39:10] TheLarkInn: including domain
[20:41:02] workmad3: TheLarkInn: what's a 'full path for a model object'?
[20:41:43] TheLarkInn: oh well lets say if I do url_for(@book)
[20:42:00] TheLarkInn: I want http://www.domain.com/books/1
[20:42:04] TheLarkInn: but I only get /books/1
[20:42:53] tubbo: mtsmith85: probably. i typically try not to load the whole rails app when i can (if i'm working on another program on the same system)
[20:42:53] workmad3: TheLarkInn: http://api.rubyonrails.org/classes/ActionDispatch/Routing/UrlFor.html
[20:44:08] tubbo: mtsmith85: that said, i've found that the overhead of launching the rails app is shadowed by the amount of time and energy you typically put into writing code that uses your app's resources but not the app itself
[20:49:00] profelm: Hey guys, I'm having issues with rails path. I have posted the problem here: https://gist.github.com/brettclanton-blinqmedia/e7208aabfa2ebd5b76c2
[20:49:18] profelm: I believe that it might be a namespacing issue.
[20:49:27] profelm: I'm running Rails 3.
[20:50:36] tubbo: profelm: in ApplicationController, `def auto_campaign_path; auto_lift_auto_campaign_path; end;`
[20:50:57] tubbo: profelm: the router is defining those methods for you. simply define 1 more method, and use that one.
[20:51:33] tubbo: profelm: alternatively, you can just do a project-wide find and replace for 'auto_campaign_path' => 'auto_lift_auto_campaign_path', which IMO looks weird but is a cleaner/safer approach
[20:51:52] tubbo: (actually it should be 'local_lift_auto_campaign_path')
[20:52:10] profelm: I think that you're right tubbo
[20:52:14] profelm: Thanks for the tips!
[21:06:49] rails_nubyist: Is it a bad idea to start using Ruby 2.1.2 and Rails 4.1.2
[21:07:16] rails_nubyist: Or too much of a security risk till its a bit more mature?
[21:11:14] tubbo: rails_nubyist: nah
[21:11:34] tubbo: rails_nubyist: i'm pretty sure you won't run into any of the performance problems that some users of the latest ruby/rails have been reporting
[21:12:02] tubbo: rails_nubyist: we've only run into it here because one app that uses ruby 2.1 is really heavy, and the other one is rendering graphics to the screen so GC gets all wonky.
[21:12:33] tubbo: we figured out a way to trigger the GC manually, so we do it every 20 or so times the main runtime loop executes
[21:21:27] rails_nubyist: @tubbo that sounds a bit hacky, does running the GC that much cause blocking?
[21:22:12] workmad3: rails_nubyist: it's not particularly hacky, and it's known as 'out-of-band GC'
[21:22:46] workmad3: rails_nubyist: when you tune the frequency, it means you can reduce or even remove GC runs in the middle of requests by moving them to between requests
[21:23:00] sharpmachine: Hi again. How do I use validates on a phone number that allows only numbers parenthesis and dashes?
[21:23:22] Sigma00: uh... use a regex?
[21:23:35] workmad3: mmmm, phone number regexp... always fun
[21:24:49] rails_nubyist: Cool, sounds like you could easily get in trouble though
[21:24:56] workmad3: rails_nubyist: not particularly
[21:25:00] sharpmachine: Yeah sorry Sigma00, I'm new to regex and rails.
[21:25:06] workmad3: rails_nubyist: it doesn't turn off normal GC runs if required
[21:25:17] rails_nubyist: Ah so you kind of top it up :)
[21:25:33] workmad3: rails_nubyist: more like you're telling it 'now is a good time to run'
[21:25:45] rails_nubyist: whats the average run-time on the GC?
[21:25:47] workmad3: rails_nubyist: so you don't end up with a GC run in the middle of a request
[21:25:49] rails_nubyist: Suppose it depends on the system?
[21:25:58] tubbo: rails_nubyist: not in a normal use case (for example, every web app ever). this is NOT a normal use case. in fact, i wouldn't even advise using Ruby at all for the use case i'm referring to
[21:25:59] workmad3: rails_nubyist: depends on the system and the amount of stuff in each generation
[21:27:07] tubbo: rails_nubyist: we've actually re-implemented this graphics engine in C and Lua in order to get around Ruby's deficiency in performance.
[21:27:09] rails_nubyist: I haven't heard of many Ruby graphics apps tbh
[21:27:17] workmad3: tubbo: have you tuned your GC settings with your ruby 2.1 app?
[21:27:20] tubbo: there's a good reason for that :)
[21:27:36] tubbo: workmad3: yes, that's when we needed to tune them...the RAM bloat would basically fuck the machine after about a day
[21:27:48] rails_nubyist: I have seen the Android implementation with some GL settings that have been impressive
[21:27:58] tubbo: rails_nubyist: android implementation of what?
[21:28:49] rails_nubyist: Ruboto it's called
[21:29:02] rails_nubyist: Theres an IRB and some examples with it
[21:29:24] rails_nubyist: One had a GL implementation, just some cubes rotating etc. but was impressive
[21:29:25] tubbo: yeah, that's based off JRuby, which is of course Ruby on the JVM
[21:29:37] workmad3: tubbo: hmm... did you hit the GC bug in 2.1.1? http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
[21:29:57] tubbo: workmad3: nah, we're on 2.1.0
[21:30:09] workmad3: tubbo: it was/is probably in that too :)
[21:32:57] rails_nubyist: I've heard good and bad things on JVM
[21:33:18] rails_nubyist: bad speed initially but over time running and optimised can be faster than MRI
[21:34:10] tubbo: workmad3: "the GC bug" is pretty vague :P
[21:34:38] tubbo: workmad3: on 2.1.0 we noticed a constant RAM climb until it timed out the process, so we hacked the GC by basically manually running it every 20 times the loop executed
[21:34:45] tubbo: that fixed it
[21:34:48] orolo: in Rails 3, how do i bind events (javascript) to HTML appended from a view helper?
[21:34:57] workmad3: tubbo: the one mentioned in the article I linked, where memory is growing beyond the GC limits
[21:34:59] tubbo: rails_nubyist: well, the JVM is really meant for production-level services that are always on.
[21:35:13] rhizome: orolo: nothing to do with rails
[21:36:00] orolo: rhizome, thanks. just checking if there was a convention
[21:36:20] rails_nubyist: It optimises over time right?
[21:36:21] workmad3: tubbo: or rather, the growth factors on the amount malloc allocates wasn't being constrainted correctly, causing memory use to grow much faster than it should
[21:36:33] workmad3: *constrained
[21:37:55] tewlz: orolo: you wouldn't do it from a helper, you just bind the javascript to the html that rails produces. The order of operations is request hits rails, rails makes html and sends html, client receives html and javascript loads. The helper would be done on rails side the javascript on the client side
[21:38:29] tubbo: rails_nubyist: no, it just loads the JVM before doing anything
[21:38:57] workmad3: orolo: the convention is that you should use UJS principles, so your javascript event binding shouldn't be mixed into your HTML at all
[21:39:07] tubbo: rails_nubyist: the spin-up time is caused by the need to load the JVM and loading your ruby code into the ruby interpreter within the JVM
[21:39:35] orolo: i'll read up on ujs. thank you
[21:39:54] workmad3: tubbo: I think rails_nubyist was making an oblique reference to JIT compilation of methods :)
[21:39:56] rails_nubyist: I thought it JIT-compiled to machine code for long running processes?
[21:40:35] workmad3: ACTION wonders if spring makes jruby more usable in dev
[21:40:56] workmad3: should put that on my list of things to try
[21:41:00] wasamasa: tubbo: what's else there besides largish website projects that run ages and don't need fast startup
[21:41:52] workmad3: wasamasa: the JVM spin-up time is painful for running lots of short test runs in development :(
[21:42:05] workmad3: wasamasa: 3s spin-up time for 0.01s of tests...
[21:42:27] wasamasa: workmad3: that's why I never really got to learn one of these jvm languages
[21:42:47] wasamasa: workmad3: didn't find any sufficiently interesting project where this wouldn't be an impediment
[21:43:04] wasamasa: I have to admit though, gem takes here ages to show anything on screen :P
[21:43:15] workmad3: wasamasa: I think there are plenty of setups that will keep a JVM running that it can just throw code at to run stuff
[21:43:38] wasamasa: workmad3: well, that sucks if you need to make sure it's not the state ruining your tests
[21:44:30] workmad3: wasamasa: said setups will do 'clever' stuff with classloaders and unloaders to keep the JVM running but clear out state, iirc
[21:45:20] workmad3: still, I'm off for now :)
[21:52:58] papercode: rails 3.2 -> attempting to remove a column via migration -> getting an error along the lines of "Missing ignore_columns: <columns>"
[21:53:02] papercode: anyone run into this before?
[21:55:00] papercode: (i am relatively sure the column name is correct)
[21:58:34] tewlz: I would guess a syntax error
[21:58:54] tewlz: and I would suggest gist'ing some code
[21:59:08] papercode: tewlz: yeah, me too, but i can't seem to find it
[21:59:21] papercode: (was given this code to look at)
[22:01:17] tewlz: papercode: yeah I can't seem to find the syntax error either
[22:02:19] papercode: tewlz: oh, lol, missed the earlier part
[22:06:35] volk_: hey guys im getting a ???Can't verify CSRF token authenticity??? even with ???protect_from_forgery with: :null_session??? .. and im not sure why. it lets me post from a curl request, but as soon as im doing a request from IOS, it throws an unauthorized
[22:06:37] volk_: any ideas?
[22:06:42] marahin: Guys. Assuming that I want to have two static templates for an error page and a success page (which appear accordingly when something goes wrong / something goes fine), how bad is using them as "render 'success.html.erb' ", having passed a @message to them as well?
[22:06:57] papercode: nvm, failing due to a custom check, carry on (??????????????????? ?????????
[22:07:05] marahin: (@message containing either error description or some additional info if the operation was succesful)
[22:07:17] rails_nubyist: Does anyone know good resources for using nginx with unicorn?
[22:07:23] rails_nubyist: I have nginx installed
[22:07:28] marahin: rails_nubyist, nginx is black magic! Just sayin'. :P
[22:07:39] tewlz: rails_nubyist: railscasts
[22:07:47] rails_nubyist: I have nginx installed locally
[22:07:49] marahin: rails_nubyist, as long as you don't read the docs, it is.
[22:07:57] marahin: and railscasts is good stuff. :3
[22:08:06] tewlz: took me less time to grok nginx than apache...not sure if just sarcasm...?
[22:08:49] rails_nubyist: Is it a good idea to use nginx and Unicorn in dev? I want to use it on Heroku so seems to make sense to ahve it running locally too
[22:08:54] marahin: tewlz, i am not kidding. I had so many issues with nginx (especially when I set up nginx master <--> user instances of nginx <--> php / rails
[22:09:03] marahin: and I used unix sockets
[22:09:14] marahin: sometimes nginx acted reaaally weird. :P
[22:09:23] wasamasa: I'm looking forward to reverse proxying with nginx
[22:09:28] rails_nubyist: ah jeeeeez, is it that bad?
[22:09:30] marahin: wasamasa, reverse proxying is great. :3
[22:09:32] tewlz: marahin: well I have zero experience with advanced setups, so I'll take your word for it. As for hobby and small sites nginx is much easier to setup
[22:09:38] wasamasa: just have to think up some good structure for running more than one web application on a server
[22:09:44] marahin: nginx is great, but you HAVE to read docs.
[22:09:57] wasamasa: and I think reverse proxying is the way to go plus (sub-)domains
[22:10:12] tewlz: for simple sites there are less docs to read for nginx than apache in my experience
[22:10:15] rails_nubyist: It's just Heroku advises it and with Unicorn I can split the processes a few times right
[22:10:25] rails_nubyist: get some extra bang for buck out of the dynos?
[22:10:58] wasamasa: well, I've tried heroku briefly and didn't like they already insisted on my credit card data for enabling a scheduling task
[22:11:12] Sigma00: check out openshift by redhat
[22:11:16] wasamasa: which means if I ever go over the free plan I'll pay helluva lot
[22:11:35] wasamasa: much more than I'd pay for a vps that doesn't take ages to wake up
[22:12:06] rails_nubyist: Nearly every deployment tutorial out there uses Heroku
[22:12:42] tewlz: rails_nubyist: railscast has an entire cast dedicated to deploying to nginx with unicorn
[22:12:52] tewlz: on digital ocean vps i think?
[22:12:57] tewlz: no linode vps
[22:12:59] wasamasa: tewlz: is railscasts that paid video series?
[22:13:07] rails_nubyist: But its stopped being updated
[22:13:12] wasamasa: then I remember right
[22:13:14] rails_nubyist: the guy who did it got some serious burn out
[22:13:17] tewlz: wasamasa: some are paid, I *think* this one is free? dunno only 9$/mo
[22:13:22] mdot: set irc.server.freenode.username "mdot"
[22:13:24] rails_nubyist: Yeah thats the guy
[22:13:34] rails_nubyist: Just over a year since his last post
[22:13:37] webdestroya: its now "$9/forever"
[22:13:42] wasamasa: well, I wouldn't have problems paying after testdriving it, but if he doesn't add any new ones
[22:13:42] rails_nubyist: But yeah only $9 forever
[22:13:43] webdestroya: since you pay and then it doesnt renew
[22:13:51] tewlz: wait I'm not being charged montly?
[22:13:52] webdestroya: so it is DEFINITELY worth $9 forever
[22:14:00] tewlz: holy crap that guy is the shit
[22:14:02] webdestroya: hes not releasing any more, so theres no monthly charge
[22:14:07] tewlz: those casts are worth more than 9$/mo imo
[22:14:14] rails_nubyist: They are indeed
[22:14:14] webdestroya: once he starts (if he does) then it will resume to $9/mo
[22:14:17] slash_nick: there's also ruby tapas
[22:14:20] kai3x5: gorails.com has a couple of sweet videos
[22:14:24] webdestroya: best $9/mo i ever spent
[22:14:25] rails_nubyist: and no doubt he was making good cash but he apparently couldn't keep going
[22:14:38] rails_nubyist: ruby tapas is Avdi Grimm right?
[22:14:45] rails_nubyist: Not so much Rails tho?
[22:14:50] kai3x5: whats your skill level though
[22:14:51] slash_nick: ACTION shrugs
[22:14:56] tewlz: I hardly doubt ryan bates is ever hurting for cash. I think the emberjs people are trying to throw money at him now
[22:14:57] kai3x5: destroy all software is legit too
[22:15:00] webdestroya: honestly, railscasts has some not rails stuff too
[22:15:15] webdestroya: but i think RubyTapas is mostly not rails
[22:15:24] rails_nubyist: Yeah hes a Ruby magician
[22:15:26] kai3x5: would not recommend if you are starting out
[22:15:31] slash_nick: we use ruby gems in rails apps... sometimes those gems are written specifically for (or are coupled to) certain versions of rails
[22:15:48] rails_nubyist: I watched one video and his pace is defo not for the beginner
[22:16:00] webdestroya: those are totally beginner stuff
[22:16:29] rails_nubyist: I like Ruby Rogues even though I only understand maybe 50%.....if that sometimes
[22:20:26] kai3x5: rails_nubyist what are you looking for
[22:20:36] kai3x5: beginner rails stuff?
[22:22:33] rails_nubyist: I have done the Hartl tutorial and now have an idea for an app
[22:22:50] bratsche: morning, Rails peeps
[22:23:10] rails_nubyist: I am basically looking to start it from scratch using all the common stuff
[22:23:31] slash_nick: I'm having a hard time getting this engine's assets loaded after the main app... I want the engine to depend on the main_app for jquery... basically, i don't want any reference to my engine's assets in the main app
[22:23:47] rails_nubyist: I want to make sure I do it right with Git, TDD etc.
[22:24:06] rails_nubyist: And I will host on Heroku for now as its so easy to start up with them
[22:24:44] rails_nubyist: Reading up Unicorn is defo the way to go on Heroku for my needs so want to get it up and running locally for dev
[22:25:38] rails_nubyist: But I am a DB dude at heart with some programming knowledge in my pocket, been getting into Rails over the past few months now
[22:32:12] TorpedoSkyline: hey guys, quick question for a newb. When I'm creating something like a dashboard or an admin panel, should I create a controller for them even if they're not RESTful resources? Like AdminPanelController or DashboardController and just manually add the actions?
[22:33:07] kai3x5: have you tried activeadmin
[22:33:13] kai3x5: torpedoskyline
[22:33:13] papercode: TorpedoSkyline: are you asking whether or not you should use the generators or just make them by hand?
[22:34:01] TorpedoSkyline: papercode I can make them by hand, I guess the question is around best design practices
[22:34:19] TorpedoSkyline: I need a controller for something like a Dashboard even if I just have one route to it?
[22:34:42] TorpedoSkyline: kai3x5 not advanced enough of an app yet for activeadmin, thanks though!
[22:43:04] the_f0ster: I am using something like date_time.in_time_zone('Asia/Shanghai'), and it says the timezone is CST, even though the utc offset matches, is this a bug? e.g., Wed, 02 Jul 2014 02:00:00 CST +08:00
[22:44:57] the_f0ster: okay TIL CST is china standard time
[22:45:03] the_f0ster: tried googling it and couldnt find it at first :D
[22:45:43] goodnick: What's a good way to self-encode and stream videos using heroku?
[22:48:02] goodnick: Anybody have experience with self-hosted videos?
[22:57:07] goodnick: Can't tell if my messages are being hidden...
[22:57:31] wasamasa: it's just that your questions are very vague
[22:57:33] goodnick: Okay thanks for the heads up
[22:57:47] wasamasa: which is not exactly easy to answer in a helpful way
[22:58:03] wasamasa: channels like this one prefer precise and specific questions
[22:58:11] goodnick: Okay thanks, I'll try to be more clear
[22:58:49] wasamasa: see this document: https://mikeash.com/getting_answers.html
[23:00:22] wasamasa: if you merely want to know whether it's a good idea or not, keep in mind this kind of thing will generate lots of traffic and heroku gets expensive quickly
[23:00:58] goodnick: Right so I'm building a content locking site. Some content will be hosted as pdfs, docs, etc. Some content will be videos. I don't want to use youtube or vimeo as hosting. I'd like to host my own videos. I'll be using the carrierwave gem for video uploading and I was looking into the carrierwave-video gem for video uploading&encoding. I was wondering if anyone had experience with this or any other gems that can upload and conve
[23:01:54] wasamasa: your message got cut off
[23:02:00] goodnick: Right, that's what I was thinking. Or would it be a better idea to host videos on amazon s3 and provide download links?
[23:02:05] wasamasa: less monologues next time please :P
[23:02:07] goodnick: Where did it get cut off?
[23:02:14] goodnick: I'll be using the carrierwave gem for video uploading and I was looking into the carrierwave-video gem for video uploading&encoding.
[23:02:17] wasamasa: "that can upload and conve"
[23:02:18] goodnick: I was wondering if anyone had experience with this or any other gems that can upload and convert videos for html5 playback.
[23:03:50] goodnick: Or would zencoder be a better option?
[23:09:22] Sirele: helloooooooo
[23:11:28] goodnick: better phrasing: I'd like to be be able to upload videos and then have my users play them or download them. I also don't want to spend a lot of money doing it.
[23:17:15] helpa: goodnick: What you just asked could be classed as subjective. Subjective questions often start flamewars, which are tedious and boring. Try all the available options and see which one suits you the best.
[23:17:15] Radar: goodnick: !subjective
[23:17:19] Radar: Zencoder is good, S3 is good.
[23:17:24] Radar: Depends on really what kind of features you want.
[23:19:52] bricker`work: goodnick: What's wrong with YouTube?
[23:20:21] Sigma00: what's wrong with storing all your user's videos on youtube?
[23:20:25] Sigma00: is that what you're asking?
[23:20:32] goodnick: Interesting, wasn't aware that s3 could convert videos. Well it is a content locking site.
[23:20:37] goodnick: The admin uploads the videos
[23:20:40] goodnick: users pay to see them
[23:21:03] goodnick: I want to protect against users sharing the videos
[23:22:11] Sigma00: wherever you choose to host, make sure you understand what your bandwidth requirements are gonna be
[23:23:36] bricker`work: Sigma00: "I'd like to be be able to upload videos and then have my users play them or download them"
[23:23:59] bricker`work: Sigma00: so... no, that's not what I'm asking
[23:25:19] Sigma00: goodnick: not to mention how many concurrent users you'll be able to handle off a single node/vps
[23:25:59] goodnick: Hmmm, Right. Videos will be a max of 30 minutes long each. May have as many as 100 users playing videos at a time. Could be more.
[23:26:29] Sigma00: think about bitrates
[23:27:52] goodnick: I think at least 480p
[23:28:01] goodnick: Maybe youtube is the best option?
[23:28:59] goodnick: Like cloudfront?
[23:32:24] laudace: yup or rackpace has one and there a couple that handle just video
[23:33:21] laudace: If you're setting up HTML5 video remember you should have it a couple different encodings
[23:33:40] laudace: You're probably going to have to transcode too if you do it yourself.
[23:37:40] goodnick: Okay thanks for your help laundace: Sigma00: bricker`work: Radar: wasamasa: