« Back to channel list

#RubyOnRails - 19 April 2017

« Back 1 day Forward 1 day »
[00:12:53] r3vDev: has joined #RubyOnRails
[00:49:40] patarr: has joined #RubyOnRails
[00:52:10] watersoul: has joined #RubyOnRails
[00:52:36] quazimodo: has joined #RubyOnRails
[00:54:19] Kamuela: has joined #RubyOnRails
[00:54:41] boshhead: has joined #RubyOnRails
[00:56:43] justAllgood: has joined #RubyOnRails
[00:58:48] syndikate: has joined #RubyOnRails
[01:01:39] sevenseacat: has joined #RubyOnRails
[01:08:07] irishfromua: has joined #RubyOnRails
[01:10:40] Trynemjoel: has joined #RubyOnRails
[01:12:41] patarr: has joined #RubyOnRails
[01:23:10] patarr: has joined #RubyOnRails
[01:28:01] p8m: has joined #RubyOnRails
[01:38:26] baweaver: qmr: hipster developer here, use AWS.
[01:38:53] baweaver: because we have this problem called scaling, you probably haven't heard of it.
[01:39:34] baweaver: on a more serious note though....
[01:40:02] baweaver: reference what AWS runs for their M4 series, try and emulate that hardware if you want to rack it up. Typically a Large is a good standard
[01:40:42] baweaver: The problem with running your own is if you need to scale fast you're hosed. There's hardware failure, maintenance, datacenter admins, and a whole slew of other concerns that are also abstracted from you.
[01:41:18] baweaver: it's not as simple as only hardware or being, as you put it, a "hipster dev"
[01:41:25] Tempesta: has joined #RubyOnRails
[01:41:32] baweaver: which quite frankly is not a good way to endear you to a channel
[01:42:00] fryguy: i'm going to assume he knows all of these business risks and is making an informed decision
[01:42:02] baweaver: You also need to worry about cross-regional replication. What about your clients in America, Europe, Asia, etc?
[01:43:25] baweaver: when you're in the terabyte scale that lag time can hurt a service, especially when you're trying to shard over multiple DB clusters.
[01:43:27] sevenseacat: fryguy: I think the point is that if he knew all that, there wouldn't be a decision to make
[01:43:29] Radar: baweaver: maybe you should mention the little mom & pop company you work for?
[01:43:37] Radar: you know, as a hipster dev
[01:43:40] baweaver: I don't like to posture.
[01:43:52] Radar: how many employees do they have anyway?
[01:44:05] baweaver: Depends how many they hired today, I lose track
[01:44:45] baweaver: in SF.... 300+? There are a ton more in San Mateo, San Diego, Tokyo, and other areas.
[01:45:15] baweaver: I'm probably seriously underestimating the SF office's size honestly.
[01:46:08] fryguy: hrmm, i'm actually curious now
[01:46:10] baweaver: Then there's all the fun surrounding PostgreSQL vs something like Cassandra for handling that large of a data set.
[01:46:16] baweaver: I'll PM you.
[01:50:06] baweaver: Jeez, and Solr for search indexing against that set with metric stores to monitor it all
[01:50:30] baweaver: Protip: Ops is hard :P
[01:50:43] baweaver: give your local sysadmin a beer some time, they probably need it
[01:51:12] sevenseacat: ours are meh, I'll pass :P
[01:51:30] baweaver: Mayhap the beer makes them less meh?
[01:53:50] Jameser: has joined #RubyOnRails
[01:56:37] loy_aqua: has joined #RubyOnRails
[01:57:46] cerulean: has joined #RubyOnRails
[01:57:53] cerulean: is there no partial replacement in turbo links 5?
[01:58:10] cerulean: i just wanna pretend like a div is <body> and leave some code
[01:58:21] cerulean: outside div id="fakebody>
[02:04:45] cerulean: data-turbolinks-permanent still seems to reload the element
[02:05:23] qmr: baweaver: ... right, responsible for 200TB (and multi PB at last job), but I have not heard of "scaling"
[02:05:38] qmr: "the cloud" is the the only thing that "scales", ... OK
[02:05:41] baweaver: It's called a hipster joke.
[02:06:15] libastral: has joined #RubyOnRails
[02:06:37] qmr: also howdy neighbor (I think)
[02:07:00] HoierM: has joined #RubyOnRails
[02:08:07] baweaver: still though, as I'd mentioned up there the m4 family is a good standard set to reference
[02:08:53] baweaver: moreover the cloud takes care of a ton of other related issues than anything at a premium cost
[02:08:56] baweaver: it's a tradeoff
[02:10:01] qmr: having worked for a "cloud" (VPS) company, just the word triggers me
[02:11:27] baweaver: Yeah, I went through most of the gamut of concerns on things as I can't reliably predict what experience you've had.
[02:11:57] baweaver: Most any of our rails services run on m4.xlarge or m4.large servers and rarely have issues handling load
[02:12:38] baweaver: really depends on what you're trying to host though.
[02:13:46] baweaver: I assume data heavy by the TB scale there, so you may look into ElasticSearch as well
[02:14:36] qmr: thats storage. DB is ~1TB~
[02:16:07] qmr: this is all neither here nor there, only concern now is shoveling through rails app as fast as possible
[02:17:20] baweaver: got deployment taken care of yet?
[02:17:33] baweaver: what else are you looking into? Just hardware?
[02:18:55] qmr: capistrano. just shiny new fast app servers right now
[02:19:02] brent__: has joined #RubyOnRails
[02:20:00] baweaver: Gotcha. Reference AWS's build for M4.XL, then make sure to tune Puma (app server) to use it properly behind NginX (or your pref) and it should be good.
[02:22:32] baweaver: around the bay area then?
[02:25:30] mr-spoon: has joined #RubyOnRails
[02:25:33] qmr: south bay. on caltrain heading home
[02:26:35] baweaver: east bay, working downtown SF.
[02:26:50] baweaver: could do without the commute :P
[02:27:00] baweaver: Yeah, rent is way better though
[02:27:02] baweaver: well, lease now.
[02:27:36] qmr: yeaaaaaa. I might look at rw city hillsdale or daly city or something
[02:29:07] baweaver: Isn't RWC gaining quite a bit on prices lately?
[02:29:46] baweaver: Ah, and couldn't help the hipster dev jab earlier
[02:31:41] DaniG2k: has joined #RubyOnRails
[02:33:34] baweaver: qmr: #ruby-offtopic, there's actually a couple bay area folks around if you want to talk town.
[02:34:10] DaniG2k: I'm having a realy hard time testing a controller method. This is my code
[02:34:12] DaniG2k: https://gist.github.com/DaniG2k/37321ea6ec60cf7924b9c3e84189f1a1
[02:34:35] DaniG2k: I want to basically test that calling #refresh_locked_accounts will set the accounts to pending: false
[02:35:13] DaniG2k: one of the problems however is that this will trigger an external request in my app so not sure how to test this
[02:37:32] baweaver: will take a look in a second if someone else doesn't see it DaniG2k. Finishing something off atm.
[02:38:04] DaniG2k: help would be much appreciated
[02:38:11] DaniG2k: I've been struggling with this for days
[02:39:44] sevenseacat: its not a controller action?
[02:40:08] DaniG2k: sevenseacat: yea I'm testing controller.refresh_locked_accounts
[02:40:13] DaniG2k: so #refresh_locked_accounts
[02:40:29] DaniG2k: which in turn runs #authorize!
[02:40:43] sevenseacat: I can see that, but that doesnt answer the question
[02:41:08] DaniG2k: what do you mean it's not a controller action?
[02:41:22] sevenseacat: its a question. is it a controller action or not?
[02:41:50] DaniG2k: #refresh_locked_accounts is, yes.
[02:42:08] sevenseacat: that was an effort
[02:43:14] loy_aqua: has joined #RubyOnRails
[02:48:03] DaniG2k: I'm getting a Module::DelegationError
[02:48:10] DaniG2k: ` ActionController::Metal#status= delegated to @_response.status=, but @_response is nil:`
[02:48:43] DaniG2k: I might need to stub out the request
[02:48:48] DaniG2k: but not entirely sure how
[02:49:19] sevenseacat: what request?
[02:49:56] DaniG2k: ac.authorize(account.email, account.password) dispatches an external request to Airbnb
[02:50:34] DaniG2k: how would I stub ac.authorize(account.email, account.password) ?
[02:54:01] loy_aqua: has joined #RubyOnRails
[02:56:22] r3vDev: has joined #RubyOnRails
[02:56:50] DaniG2k: it returns a Faraday::Response object
[03:00:19] sandstrom: has joined #RubyOnRails
[03:02:33] duderonomy: has joined #RubyOnRails
[03:13:01] fschuindt: has joined #RubyOnRails
[03:17:54] bronson: has joined #RubyOnRails
[03:22:12] r3vDev: has joined #RubyOnRails
[03:26:10] bronson: has joined #RubyOnRails
[03:36:29] LastWhisper: has joined #RubyOnRails
[03:38:01] LastWhisper: Hey guys I'm running into a hiccup with some contracting work I'm doing -- In one of their models, they do `enum font_type_code: Repo::Constants::FONT_TYPES`, and what that constant is, is a hash FONT_TYPES = { arial: 1, times_new_roman: 2 }
[03:38:34] LastWhisper: so when I do Model.first, it displays font_type_code: 1, but when I do Model.first.font_type_code, it returns "arial"
[03:40:51] LastWhisper: I would like it to return me the actual index code, so 1 in my case
[03:41:36] sevenseacat: thats not what enums do
[03:41:45] sevenseacat: but you can write another helper to do that if you wish
[03:42:39] sevenseacat: eg. def font_type_index(code); self.class.font_type_codes[code]; end
[03:43:13] sevenseacat: http://api.rubyonrails.org/classes/ActiveRecord/Enum.html might be worth a read for you
[03:43:48] LastWhisper: yup was reading that before asking my question .. I def see why it's useful & used
[03:47:56] LastWhisper: thank you for your help sevenseacat
[03:48:01] LastWhisper: I feel like you help me on all languages all the time xD
[03:51:38] bronson: has joined #RubyOnRails
[03:54:57] baweaver: The mystical sevenseacat is everywhere, friend
[03:55:16] sevenseacat: ACTION tips hat
[04:02:15] LastWhisper: Okay I've run into another issue.. weird. so this app is on rails 4.2.0 atm, I'm trying to do a basic .parameterize on a string "that_looks_like_this", adding a separator '-'
[04:02:20] LastWhisper: so, hyphenated instead of underscored
[04:02:26] LastWhisper: I'd check apidock but it's down atm :(
[04:02:52] sevenseacat: whats the problem exactly?
[04:02:54] LastWhisper: ActiveSupport::Inflector.parameterize(str, separator: '-')
[04:02:54] LastWhisper: yields TypeError: no implicit conversion of Hash into String
[04:03:05] LastWhisper: str = "that_looks_like_this"
[04:03:24] LastWhisper: I've also tried plain str.parameterize(separator: '-')
[04:03:35] LastWhisper: as well as parameterize(str, '-')
[04:03:54] sevenseacat: any more of a backtrace of the error?
[04:04:04] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[04:04:26] sevenseacat: you want just str.parameterize('-')
[04:04:53] sevenseacat: http://api.rubyonrails.org/v4.2.7.1/classes/String.html#method-i-parameterize
[04:05:44] sevenseacat: the inflector version also takes the string separator as the second arg
[04:06:09] fschuindt: There's a clever way to access the 'max-age' value from this string: "public, max-age=23527, must-revalidate, no-transform"?
[04:06:15] sevenseacat: http://api.rubyonrails.org/v4.2.7.1/classes/ActiveSupport/Inflector.html#method-i-parameterize
[04:07:15] sevenseacat: fschuindt: regex would work
[04:07:40] fschuindt: sevenseacat: I'm always afraid of it. haha
[04:08:17] sevenseacat: I find https://regex101.com/ makes them less intimidating, because it offers lots of help and references and the like
[04:08:39] fschuindt: thank you, I will have a look
[04:08:44] sevenseacat: failing that, http://rubular.com/ is good to testwith
[04:08:53] cerulean: hey guys. so how do I do an ajax form with turbolinks again
[04:14:57] cerulean: i made a soundcloud player that can have uninterrupted playing
[04:15:01] cerulean: but the form stops it
[04:15:08] cerulean: even tho turbo links is on
[04:16:12] sevenseacat: that makes sense, given turbolinks will replace the entire contents of the page, including the player
[04:16:56] sevenseacat: http://guides.rubyonrails.org/working_with_javascript_in_rails.html#form-for
[04:17:51] cerulean: well the player issue isnt the real thing. i am using HTMLAudioElement in a variable now. it does work. the only thing that stops it is submitting a form. clicking links inside the same layout wont stop the player
[04:18:04] LastWhisper: sevenseacat, i couldn't get the parameterize thing working I just ended up gsubbing it -_- hacky af
[04:18:28] cerulean: gsub and split your way to freedom
[04:18:29] sevenseacat: LastWhisper: odd. did my suggestion not work?
[04:19:11] LastWhisper: It did not for me... I tried both versions
[04:19:43] sevenseacat: oh right, because it thinks the string is one word, so there's nothing to parameterize
[04:19:55] sevenseacat: it did work in that it didnt raise an error, but didnt do what you wanted
[04:21:04] cerulean: i need turbolinks.replace or something but its gone
[04:21:20] LastWhisper: exactly sevenseacat :)
[04:22:53] sevenseacat: LastWhisper: you want dasherize instead of parameterize
[04:22:54] cerulean: are forms supposed to work exactly like links in turbolinks?
[04:23:24] sevenseacat: http://api.rubyonrails.org/v4.2.7.1/classes/String.html#method-i-dasherize
[04:24:00] sevenseacat: though it just does a String#tr under the hood :D
[04:24:28] sevenseacat: cerulean: I think you're being deliberately vague, so no-one can offer help.
[04:24:52] sevenseacat: cerulean: if you're having a problem with your code, please gist it so we can see whats going on.
[04:25:19] cerulean: i'm not being deliberately vague
[04:25:50] sevenseacat: then please gist your code so we can offer you help with it.
[04:25:58] fixture: has joined #RubyOnRails
[04:27:44] bachmann: has joined #RubyOnRails
[04:28:13] cerulean: https://gist.github.com/mixflame/244e3a2517e99f0c5b3f76e39c05a25e
[04:28:26] cerulean: this works and i get the results. but the turbolinks disrupts the audio..
[04:28:30] cerulean: while the links don't
[04:28:35] cerulean: or lack of turbolinks disrupts it
[04:28:36] sevenseacat: there's no turbolinks there
[04:28:41] cerulean: how do I add it/
[04:28:42] sevenseacat: did you check the link I posted?
[04:29:08] _aeris_: has joined #RubyOnRails
[04:29:18] cerulean: the form_for javascript documentation?
[04:29:33] cerulean: i tried it with remote: true, doesn't even work at all
[04:29:40] sevenseacat: define 'doesnt even work'
[04:30:06] cerulean: the request is probably submitted, but i'm not redirected to search results using TL
[04:30:16] sevenseacat: "You probably don't want to just sit there with a filled out <form>, though. You probably want to do something upon a successful submission. To do that, bind to the ajax:success event. On failure, use ajax:error."
[04:30:41] sevenseacat: you wont be redirected anywhere, thats the point
[04:31:04] cerulean: i sorted wanted the search results on a seperate page
[04:32:08] sevenseacat: then it sounds like you dont want a form submission at all
[04:32:22] sevenseacat: it sounds like you just want to perform a Turbolinks page load
[04:32:53] cerulean: how do i use turbolinks to inject the partial?
[04:32:57] sevenseacat: https://github.com/turbolinks/turbolinks/blob/master/README.md#turbolinksvisit
[04:33:08] cerulean: i know about Turbolinks.visit
[04:33:13] cerulean: i don't know how to integrate it in my code
[04:33:24] cerulean: use paramters in the url?
[04:33:25] cerulean: im an idiot
[04:33:47] sevenseacat: it sounds like you should call it when the user submits the form
[04:33:52] sevenseacat: with the data they submit
[04:42:45] cerulean: got it working with that method sevenseacat :)
[04:51:10] fixture: has joined #RubyOnRails
[04:55:07] Radar: [14:33:26] <cerulean> im an idiot
[04:55:12] Radar: Man I wish I could pin messages to the channel
[04:58:33] bios: has joined #RubyOnRails
[04:59:29] dminuoso: !goodmorning
[04:59:29] helpa: おはよう ございます
[05:00:05] sevenseacat: so polite, helpa
[05:04:39] raul782: has joined #RubyOnRails
[05:07:58] loy_aqua: has joined #RubyOnRails
[05:09:21] cerulean: oh shit it's dminuoso and Radar *fat girl running*
[05:09:28] ChanServ: +q *!*@174-29-46-3.hlrn.qwest.net
[05:09:45] Radar: ACTION What did I say yesterday about that sorta language? See you in an hour.
[05:14:56] baash05: has joined #RubyOnRails
[05:16:39] baash05: Hey all.. I'm trying to write a gem, and test how it interacts with an active record. I was wondering how others test sql generation without having a database stipulated in the rspec.
[05:17:07] baash05: Would I have to add a database.yml type thing to the gem?
[05:21:24] p8m: has joined #RubyOnRails
[05:24:08] bios: hey *.. if I'm seeing errors in my errors object on update, but then it redirects to the edit view and the errors are gone.. what do I need to do to pass those along?
[05:24:14] bios: any ideas?
[05:26:04] bachmann: has joined #RubyOnRails
[05:27:45] sevenseacat: you shouldn't be redirecting to the edit view - you should be rendering the edit view from the update action
[05:28:04] sevenseacat: so the form in the edit view gets the object with errors and can print them appropriately
[05:28:36] bios: yes.. sorry, format.html { render :edit, @event }
[05:28:50] bios: oh.. rm the , @event
[05:28:54] bios: I was just trying somethign
[05:28:57] jeyraof^mbpr: has joined #RubyOnRails
[05:29:07] bios: but I'm rendering :edit
[05:29:26] sevenseacat: and whats in the edit view?
[05:29:38] bios: that's what's so confusing to me..
[05:29:57] bios: I am redefining @event in the edit view
[05:30:16] sevenseacat: there's the problem
[05:30:25] sevenseacat: why are you doing that?
[05:31:29] bios: hrm.. I thought I needed to define @event in there because I've updated the routes to reference by a uuid instead the db record id
[05:31:43] bios: https://gist.github.com/mikesaltsman/e18e43120acdc731daf0443e545da437
[05:32:35] sevenseacat: thats the controller, not the view defining @event there is fine
[05:32:51] sevenseacat: (insert a - between "view" and "defining")
[05:33:03] rakm: has joined #RubyOnRails
[05:33:06] bios: oh.. my bad.. I'm tired..
[05:33:15] bios: I'm defining @edit in the controller :]
[05:33:22] bios: in the edit method
[05:33:33] sevenseacat: I hope you're also defining it in the update method
[05:34:06] bios: yes.. actually, I'm using a before_action to set the event
[05:34:07] srinidhi: has joined #RubyOnRails
[05:34:15] bios: so I'm probably defining it twice, maybe?
[05:34:21] bios: would that be problematic? '
[05:34:25] sevenseacat: so where are you referencing the errors in the view that aren't set as you expect?
[05:34:36] sevenseacat: it's not a great idea, but it wont break or anything
[05:38:18] bios: so, I'm putting the errors to log in the update method and it's showing up as expected, but in my edit view if I put <%= @event.errors.first %> nothing shows
[05:38:33] bios: (as a test)
[05:38:51] sevenseacat: can you gist the view?
[05:39:59] bios: https://gist.github.com/mikesaltsman/e1454b937749bb773803ae6e4d942759
[05:40:57] sevenseacat: and how are you printing out the errors in the update action? can you gist the update action?
[05:41:34] bios: https://gist.github.com/mikesaltsman/18df89658588c3e2aa3cf618e01a07a2
[05:42:55] sevenseacat: man I find all that respond_to format stuff confusing and noisy when you only have one output format, but thats unrelated
[05:43:12] pLaTo0n: has joined #RubyOnRails
[05:44:47] brent__: has joined #RubyOnRails
[05:44:49] bios: this bug has been killing me for a while.. I just don't understand what's happening
[05:45:25] bios: sevenseacat: you were helping me with this last week sometime too.... :].. you definitely helped me understand what was going on a lot more, so thank you!
[05:45:36] sevenseacat: can you gist the logs of what you're seeing when you submit the form?
[05:46:24] bios: https://gist.github.com/mikesaltsman/72f5559c82d6f2ae29d0d605947b8b17
[05:48:02] sevenseacat: two things seem unusual there - one, the format of the request is JS, not HTML; and two, the edit view seems to be rendering twice
[05:48:18] sevenseacat: oh nvm the second is me not having my glasses on
[05:48:32] bios: no worries.. the first is the initial load, and then the submit
[05:49:13] sevenseacat: I do remember this vip_url thing now that I see this :)
[05:49:30] bios: Processing by Accounts::EventsController#update as JS
[05:49:37] bios: is that the line you're talking about?
[05:50:30] sevenseacat: given your code is definitely all like 'my format is html or else'
[05:51:18] bios: I'm not even sure why it would be formatting in js
[05:51:35] sevenseacat: does your form have a `remote: true` tag on it, or some other JS?
[05:52:17] bios: it does!
[05:52:30] bios: and, I believe the reason I did that was
[05:52:33] sevenseacat: that would explain why it's submitting via js then
[05:52:51] sevenseacat: so the form is submitting via JS, and rendering the new edit view, but then you're not updating the page with the new HTML
[05:52:56] bios: because it's updating an event record inside the tour route, maybe?
[05:53:23] bios: ahh.. that explains why the errors is not going along
[05:53:28] bios: because it's a new event record
[05:53:31] bios: or object
[05:54:06] bios: Ok.. so.. the question is, what's the proper way to handle this?
[05:54:20] sevenseacat: removing the remote: true should sort you out
[05:54:40] bios: but I think I put that there because of the nested form or something .. it was for a purpose
[05:54:51] bios: I guess I'll figure out what the reprocussions are and deal with them
[05:55:01] bios: but this explains my issue.. thank you!
[05:55:23] sevenseacat: needing JS doesnt have anything to do with the nestedness of the form (is that a word? it is now)
[05:55:50] bios: that works.. getting rid of the remote true fixed it!
[05:55:53] bios: <3 .. thank you!!
[05:56:02] sevenseacat: its how you want the form to be submitted - if you use JS to make the request, then you need JS to process the response
[05:56:57] r3vDev: has joined #RubyOnRails
[06:04:38] drale2k_: has joined #RubyOnRails
[06:10:26] bios: oh.. sevenseacat .. I think I remember why I had the remote:true
[06:11:09] bios: because when I go to submit a new event, it pust the record id in the path instead of the 'tour_id"
[06:11:28] bios: and I stumbled across that as a fix for that somehow
[06:11:38] bios: does that make sense?
[06:11:55] drale2k_: has joined #RubyOnRails
[06:12:09] sevenseacat: but I get the problem, I did notice tht when looking at the logs
[06:12:18] bios: so, I am creating a new record with a url like /tours/e4Hqh8jTTcCrvQ3kH26Mtd7a/events/new
[06:12:59] sevenseacat: how are you getting the slug in the URL there?
[06:14:13] sevenseacat: oh I think I saw it in one of the gists
[06:14:25] sevenseacat: oh they're gone lol
[06:14:55] bios: oh..sorry
[06:15:01] sevenseacat: all good. typing up my own gist now
[06:15:58] bios: <%= simple_form_for([@tour,@event]) do |f| %>
[06:16:01] sevenseacat: https://gist.github.com/sevenseacat/fdf239bdc572a5c29776483f3f71985d
[06:16:41] bios: oh right.. the to_param
[06:16:52] sevenseacat: you already have one defined?
[06:17:29] sevenseacat: by default, to_param will use the ID of the record, ie. 10 in the logs you shared before
[06:17:41] sevenseacat: whereas you want the slug e4Hqh8jTTcCrvQ3kH26Mtd7a instead
[06:17:53] sevenseacat: (or whatever you're calling that field)
[06:18:27] bios: yes.. I have that in a private method in my tours_controller
[06:18:38] bios: yes.. that is what's happening...
[06:19:04] sevenseacat: to_param is for models, not controllers
[06:19:12] bios: I did notice that it seemed kinda hacky once I started replacing the db ids with the other columns
[06:19:37] bios: hrm... that's probably my issue
[06:19:48] bios: I'm defining it in my event model, but not in my tour model.
[06:19:53] bios: I'm defining it in my tour controller
[06:19:59] bios: which is weird that it works at all
[06:20:05] bios: which is probably why it felt hacky
[06:20:18] bios: cause I was constantly having to work around
[06:20:29] bios: ok. I think I've got some cleanup to do
[06:20:48] sevenseacat: bios: looks like it :) if you get stuck, ping us
[06:21:01] sevenseacat: http://api.rubyonrails.org/classes/ActiveRecord/Integration.html#method-i-to_param the API docs for to_param btw
[06:21:17] bios: I cannot thank you enough! This has been a huge pain in my ass!
[06:21:28] bios: goodnight *
[06:21:33] sevenseacat: have a good one :)
[06:27:01] netzfisch: has joined #RubyOnRails
[06:29:39] wkoszek: ACTION thinks he got pkgr to work for his empty Rails app template. Can deploy his Rails app via apt-get now.
[06:39:30] bronson: has joined #RubyOnRails
[06:42:03] sevenseacat: wkoszek: good work. that sound scary to me, but if it was what you were trying to do, power to you
[06:43:06] wkoszek: sevenseacat: the other approaches to just having rails app come up and work in case something happened (out of disk? out of ram?) required a lot of work
[06:43:53] wkoszek: pkgr have me a way to just apt-get my app; I got 'service <myapp> start', and a helper utility called 'myapp ...' and it seems to work
[06:44:19] wkoszek: not sure for how long it'll be the case, but if it ends up working like that longer term, that was worth a 2 day investment.
[06:44:48] irishfromua: has joined #RubyOnRails
[06:44:52] wkoszek: yeah, it's ain't pretty, but works.
[06:45:07] harfangk: has joined #RubyOnRails
[06:49:20] patarr: has joined #RubyOnRails
[06:53:30] Technodrome: has joined #RubyOnRails
[06:59:32] sandstrom: has joined #RubyOnRails
[06:59:41] drale2k_: has joined #RubyOnRails
[07:09:46] arBmind: has joined #RubyOnRails
[07:28:46] Doldge: has joined #RubyOnRails
[07:29:41] Doldge: has joined #RubyOnRails
[07:33:54] cerulean: has joined #RubyOnRails
[07:37:40] srinidhi: has joined #RubyOnRails
[07:45:18] mikecmpbll: has joined #RubyOnRails
[07:45:22] brent__: has joined #RubyOnRails
[07:46:12] loy_aqua: has joined #RubyOnRails
[07:49:12] marr: has joined #RubyOnRails
[07:52:40] KorriX: has joined #RubyOnRails
[07:55:10] scope: has joined #RubyOnRails
[07:55:30] scope: hi its been a long long time since i have installed ROR i know i'm suppose to add something to bash but i forget what how and where
[07:55:43] scope: when i run rails new app i get software not installed
[07:56:08] mikecmpbll: has joined #RubyOnRails
[08:02:24] kristofferR: has joined #RubyOnRails
[08:04:15] Qchmqs: has joined #RubyOnRails
[08:05:37] ionte: has joined #RubyOnRails
[08:11:00] srinidhi: has joined #RubyOnRails
[08:12:29] r3vDev: has joined #RubyOnRails
[08:25:30] armyriad: has joined #RubyOnRails
[08:35:22] arBmind: has joined #RubyOnRails
[08:35:30] KorriX: has joined #RubyOnRails
[08:37:55] loy_aqua: has joined #RubyOnRails
[08:40:43] lxsameer: has joined #RubyOnRails
[08:42:52] shotbug: has joined #RubyOnRails
[08:44:02] nOgAnOo: has joined #RubyOnRails
[08:45:29] Cork: i'm trying to use assert_enqueued_jobs in a minitest, but i get undefined method `assert_enqueued_jobs` (http://api.rubyonrails.org/classes/ActiveJob/TestHelper.html)
[08:45:47] Cork: do i need to include a special lib or something for it to work?
[08:46:10] sevenseacat: you might need to include that helper
[08:46:25] Cork: activejob/lib/active_job/test_helper ?
[08:46:36] sevenseacat: ActiveJob::TestHelper
[08:47:12] Cork: yup, worked, thanks
[08:50:14] patarr: has joined #RubyOnRails
[08:50:17] arup_r: has joined #RubyOnRails
[08:52:59] arup_r: I have the route https://gist.github.com/aruprakshit/b44db16a8341573df3435d3606869cae. So /static_pages/feed/share/12 and /static_pages/feed both points to the same action. How do I check the path inside the controller if it is /static_pages/feed/share/12 or /static_pages/feed/? I tried `controller_path` method but it is giving me only "static_pages". Any other helper method which can give me the whole path?
[08:53:41] universa1: why not check if the param that takes the 12 is set or not?!
[08:58:04] arup_r: hm that will work too. because /static_pages/feed/12 is a 404. cool
[09:02:05] patientj: has left #RubyOnRails: ()
[09:02:54] DrYockel1: has joined #RubyOnRails
[09:05:55] Ergo: has joined #RubyOnRails
[09:07:45] Trynemjoel: has joined #RubyOnRails
[09:10:05] elaptics: has joined #RubyOnRails
[09:10:34] rakm: has joined #RubyOnRails
[09:25:27] workmad3: has joined #RubyOnRails
[09:38:14] Doldge: has joined #RubyOnRails
[09:46:38] DrYockel1: has joined #RubyOnRails
[09:49:39] ferr: has joined #RubyOnRails
[09:56:15] sevenseacat: has joined #RubyOnRails
[09:59:16] arup_r: has joined #RubyOnRails
[09:59:38] arup_r: can we refactor the routes definition to get the same output? https://gist.github.com/aruprakshit/2297d37bc810b2d9108bb8c35d8712b3
[10:03:25] tbuehlmann: arup_r: sure, indent by 2 spaces instead of 4, done!
[10:04:38] tbuehlmann: you could iterate over an array [:facebook, :linkedin] and define the routes, but I don't think that makes things better
[10:04:53] p8m: has joined #RubyOnRails
[10:05:17] yaw: has joined #RubyOnRails
[10:05:25] arup_r: ok.. I thought some other helpers exist to produce it. thanks for looking into it tbuehlmann
[10:06:35] arup_r: I thought there probably a macro method exist to merge them scope 'social_shares', controller: 'social_shares', as: :social_shares :)
[10:09:18] shotbug: has joined #RubyOnRails
[10:17:46] gambl0re: has joined #RubyOnRails
[10:26:50] srinidhi: has joined #RubyOnRails
[10:35:51] quazimodo: has joined #RubyOnRails
[10:38:45] wethu: has joined #RubyOnRails
[10:46:39] quazimodo: has joined #RubyOnRails
[10:51:05] patarr: has joined #RubyOnRails
[10:53:29] wethu: has joined #RubyOnRails
[11:08:41] shotbug: has joined #RubyOnRails
[11:19:12] justAllgood: has joined #RubyOnRails
[11:21:25] wethu: has joined #RubyOnRails
[11:25:04] Takumo: has joined #RubyOnRails
[11:26:19] Takumo: Hi all, I'm trying to use `fields_for` in order to add a set of fields for a set of items in a model's `has_many` relation
[11:27:04] Takumo: I've managed to get it submitting the data in what I think is the correct way, i.e. `outer_model[inner_model][id][field] value`
[11:27:23] Takumo: but I get an error trying to then save that data. I have `accepts_nested_attributes_for` enabled on the relation
[11:46:04] HoierM: has joined #RubyOnRails
[11:52:20] tbuehlmann: Takumo: I have an idea, but what exactly is the error?
[11:52:54] Takumo: I worked around it myself in the end, using `params[:inner_model].each_pair`
[12:01:48] Fernando-Basso: has joined #RubyOnRails
[12:03:31] arBmind: has joined #RubyOnRails
[12:07:32] shotbug: has joined #RubyOnRails
[12:17:50] drale2k_: has joined #RubyOnRails
[12:22:16] Jameser: has joined #RubyOnRails
[12:25:07] AntiSpamMeta: has joined #RubyOnRails
[12:31:19] igniting: has joined #RubyOnRails
[12:35:55] pawandubey: has joined #RubyOnRails
[12:43:15] cseder: has joined #RubyOnRails
[12:51:57] patarr: has joined #RubyOnRails
[13:05:19] yaw: has joined #RubyOnRails
[13:08:18] Jameser: has joined #RubyOnRails
[13:25:23] agent_white: has joined #RubyOnRails
[13:27:27] Technodrome: has joined #RubyOnRails
[13:27:34] DLSteve: has joined #RubyOnRails
[13:30:37] KorriX: has joined #RubyOnRails
[13:34:31] w0bni: has joined #RubyOnRails
[13:36:23] frankarine: has joined #RubyOnRails
[13:36:56] agent_white: mornin' folks
[13:37:49] frankarine: Hi guys, I am getting this error when running rails generate devise:intall "Could not find generator 'devise:install'. Maybe you meant 'assets', 'generator' or 'coffee:assets'" any idea what it could be?
[13:38:24] sevenseacat: how did you set up devise in your app?
[13:44:22] frankarine: I added this line to my gemfile: gem 'devise', '~> 4.1', '4.1.1'
[13:44:37] frankarine: then run bundle install
[13:45:30] w0bni: How can I select all elements with either nil or a distinct value for a field?
[13:46:43] w0bni: I've tried grouping by the field, but that didn't work because I use postgres and the field isn't the primary index. I then tried DISTINCT ON(field), but couldn't get it to include all NULL values.
[13:50:03] dminuoso: frankarine: spring.
[13:51:12] dminuoso: w0bni: Something like "IS NULL OR DISTINCT" is not expressible in SQL. Use a union.
[13:51:53] w0bni: dminuoso: I tried find_by_sql and union, which worked, but the fact that it returns an array means I can't chain my scopes on it
[13:51:59] w0bni: does this mean it is time to ditch the scopes and start writing pure SQL?
[13:52:09] SteenJobs: has joined #RubyOnRails
[13:52:13] romeoh: has joined #RubyOnRails
[13:52:53] Saukk: has joined #RubyOnRails
[13:52:56] dminuoso: w0bni: There's actually Arel::Nodes::Union, but the moment you get there you end up with an unmaintainable pile of code. I'd say go straight for SQL.
[13:53:14] dminuoso: SQL is at least readable and understandable.
[13:56:30] jphase: has joined #RubyOnRails
[14:02:41] r3vDev: has joined #RubyOnRails
[14:05:44] bga57: has joined #RubyOnRails
[14:06:11] Technodrome: has joined #RubyOnRails
[14:07:01] chouhoulis: has joined #RubyOnRails
[14:09:57] r3vDev: has joined #RubyOnRails
[14:21:37] shotbug: has joined #RubyOnRails
[14:24:40] ableto: has joined #RubyOnRails
[14:25:28] chouhoulis: has joined #RubyOnRails
[14:49:47] rakm: has joined #RubyOnRails
[14:52:53] maxmanders: has joined #RubyOnRails
[15:03:20] mikecmpbll: has joined #RubyOnRails
[15:03:23] igniting: has joined #RubyOnRails
[15:06:47] gregf_: has joined #RubyOnRails
[15:16:47] pmunt: has joined #RubyOnRails
[15:19:55] polishdub: has joined #RubyOnRails
[15:27:48] theunraveler: has joined #RubyOnRails
[15:28:42] p8m: has joined #RubyOnRails
[15:30:13] theunraveler: has joined #RubyOnRails
[15:33:57] dionysus69: has joined #RubyOnRails
[15:36:10] pcpanic: has joined #RubyOnRails
[15:39:07] dyyylan: has joined #RubyOnRails
[15:39:16] Polysics: has joined #RubyOnRails
[15:39:45] Polysics: question: I have a list of Contacts and a list of Calls, both for a Campaign
[15:40:06] Polysics: is there a way to do a sort of inverse join that will give me Contacts I have not yet Call-ed?
[15:40:16] Polysics: without resoirting to IN() if I can
[15:41:03] mikecmpbll: has joined #RubyOnRails
[15:44:40] LastWhisper____: has joined #RubyOnRails
[15:50:59] username: has joined #RubyOnRails
[15:59:32] ravster: has joined #RubyOnRails
[16:00:19] AzaToth: has joined #RubyOnRails
[16:02:54] arBmind: has joined #RubyOnRails
[16:03:27] chouhoulis: has joined #RubyOnRails
[16:16:32] cerulean: has left #RubyOnRails: ()
[16:25:34] gusrub: has joined #RubyOnRails
[16:26:19] drale2k_: has joined #RubyOnRails
[16:27:31] ravster: has joined #RubyOnRails
[16:37:01] hobodave: has joined #RubyOnRails
[16:43:58] quazimodo: has joined #RubyOnRails
[16:48:34] rakm: has joined #RubyOnRails
[16:54:37] stee_3: has joined #RubyOnRails
[16:56:23] fixture: has joined #RubyOnRails
[16:58:54] quazimodo: has joined #RubyOnRails
[17:01:41] gusrub: has joined #RubyOnRails
[17:09:02] chouhoulis: has joined #RubyOnRails
[17:09:38] GodFather: has joined #RubyOnRails
[17:17:43] cseder: has joined #RubyOnRails
[17:20:01] cek: has joined #RubyOnRails
[17:20:42] cek: I'm looking for a way to truncate/clean a table outside a transaction in rspec after() hook
[17:21:17] fryguy: cek: Check out DatabaseCleaner, I think it has hooks and/or documentation for rspec
[17:21:34] cek: i just need to truncate it, i don't want another gem.
[17:23:43] fryguy: so then truncate it?
[17:23:49] greengriminal: has joined #RubyOnRails
[17:24:14] fryguy: you know where you need to execute the code (the rspec after hook), you know what you want to execute (a sql truncate command), what are you missing?
[17:26:40] cek: (0.2ms) rollback transaction
[17:27:53] cd-rum: has joined #RubyOnRails
[17:28:07] gusrub: has joined #RubyOnRails
[17:29:01] fryguy: what data are you changing inside of the transaction that lives outside of the transaction that you need to truncate?
[17:30:39] duderonomy: has joined #RubyOnRails
[17:40:37] ResidentBiscuit: has joined #RubyOnRails
[17:45:56] cek: restoring an sql dump of big size
[17:51:30] mwlang: has joined #RubyOnRails
[17:51:59] hobodave: has joined #RubyOnRails
[17:56:30] ErhardtMundt: has joined #RubyOnRails
[17:59:39] patarr: has joined #RubyOnRails
[18:05:05] bronson: has joined #RubyOnRails
[18:05:41] lxsameer: has joined #RubyOnRails
[18:07:32] francuz: has joined #RubyOnRails
[18:12:05] jsrn_: has joined #RubyOnRails
[18:17:37] chouhoulis: has joined #RubyOnRails
[18:21:45] Technodrome: has joined #RubyOnRails
[18:24:29] Fernando-Basso: has joined #RubyOnRails
[18:30:50] drale2k_: has joined #RubyOnRails
[18:35:50] sandstrom: has joined #RubyOnRails
[18:37:40] quazimodo: has joined #RubyOnRails
[18:45:55] Technodrome: has joined #RubyOnRails
[18:45:58] pLaTo0n: has joined #RubyOnRails
[18:48:09] drale2k_: has joined #RubyOnRails
[18:51:14] mwlang: I seem to have a chicken and egg problem deploying my Rails 4.2 app with capistrano 3.8.0. The prior deployment was with capistrano 3.4.0 and using rake 10.4.2 while the new version is attempting to activate rake 12.0.0…which isn’t even in the Gemfile (comes from capistrano dependencies). The solution I found so far is to attempt the deploy, then log into the box, cd to the failed release folder and issue bundle install, log out and re-attempt th
[18:51:15] mwlang: deploy (and it’ll work).
[18:52:28] mwlang: this is our staging environment, so no big deal there, but when we get ready to deploy same to production, this is going to be a headache. Any idea how to programatically resolve this so deploys to production “just work” when the time comes?
[19:00:46] greengriminal: has joined #RubyOnRails
[19:02:11] bachmann: has joined #RubyOnRails
[19:06:06] op84: has joined #RubyOnRails
[19:07:33] dminuoso: ACTION hands mwlang a docker container
[19:08:00] mwlang: how would docker solve this?
[19:08:09] dminuoso: By not needing this silly capistrano.
[19:08:21] op84: hey guys - what i’m doing wrong on this has_many through association? using it multiple times… https://paste.ofcode.org/meFW4dhWf9J66iNr3m6hU5
[19:08:34] dminuoso: mwlang: Though you can safely ignore my remarks.
[19:08:46] mwlang: as in build and test in local docker container and deploy by shipping a docker container?
[19:09:11] mwlang: dminuoso: oh. I thought your remarks were, “ignore at your own risk” :-p
[19:09:59] mwlang: sometimes I just want to throw it all away and go back to Rails 1.2. :-D
[19:10:04] dminuoso: op84: That depends on what you mean by "wrong"
[19:10:10] dminuoso: mwlang: But yes.
[19:10:32] dminuoso: mwlang: The amazing thing is that it removes the notion of "development"/"testing"/"staging"/"production" because it's the same container everywhere.
[19:10:33] mwlang: can I use capistrano to deploy containers?
[19:10:36] dminuoso: mwlang: Yeah.
[19:11:21] op84: dminuoso: ah got it… didn’t use the source attribute… thanks!
[19:13:11] dminuoso: mwlang: Here we just push to gitlab, gitlab builds the docker image, tests it, puts it into the registry and then we deploy that image.
[19:14:09] mwlang: dminuoso: oh, nice. I’m going to google for that set up.
[19:15:05] dminuoso: mwlang: The thing is just that it requires serious commitment when you have database apps, because you really should then keep your database inside docker containers too.
[19:21:10] marr: has joined #RubyOnRails
[19:23:44] KnownSyntax: has joined #RubyOnRails
[19:26:45] michielb: has joined #RubyOnRails
[19:39:06] machty: i have a background job that does a mass import to replace lots of items in the database
[19:41:58] rakm: has joined #RubyOnRails
[19:43:50] ravster: mwlang: I've never used capistrano. I'd suggest Ansible as an alternative to cap or docker. I've used that for a few years and haven't had problems with setup and orchestration.
[19:44:47] havenwood: mwlang: An aside, but Mina is a nice Cap alternative: http://nadarei.co/mina/
[19:49:35] arBmind: has joined #RubyOnRails
[19:50:54] dminuoso: ravster: The statement that ansible could be an alternative to docker is proof that you have absolutely no idea what you are talking about.
[19:58:17] hahuang65: has joined #RubyOnRails
[20:00:17] mikecmpbll: has joined #RubyOnRails
[20:03:10] machty: i have a background task that does a batch import; i wrap the whole thing in a DB transaction in case the import fails halfway through, but i also want to be able to update a `state` attribute on a Job in the database so i can see the state of this long running vjob
[20:03:29] machty: unfortunately if i'm just using a single DB connection it's going to include that Job.state set in the transaction
[20:03:38] machty: which means i won't see anything until the whole job is complete
[20:03:46] machty: i believe the answer is just i need to check out a separate connection
[20:05:55] username1: has joined #RubyOnRails
[20:09:45] segy: has joined #RubyOnRails
[20:10:01] Technodrome: has joined #RubyOnRails
[20:19:32] rakm: has joined #RubyOnRails
[20:29:42] Skull0Inc: has joined #RubyOnRails
[20:35:25] romeoh: has joined #RubyOnRails
[20:37:59] Skull0Inc: Hey all, just wondering if anyone has come across a way to nest a link_to which also specifies a class..
[20:38:18] Skull0Inc: <%= link_to(new_message_path) do %>
[20:38:19] Skull0Inc: 16 <span class="toggle-mobile">Contact XYZ</span><span class="toggle-tablet">Contact</span>
[20:38:21] Skull0Inc: 17 <% end %>
[20:39:06] Skull0Inc: basically I want to link_to(some_path), class:"my_class" do ..
[20:39:51] Skull0Inc: Anyy suggestions would be most appreciated.
[20:40:41] fryguy: link_to(some_path, "some text", class: 'my_class')
[20:41:06] rgr: has joined #RubyOnRails
[20:41:07] Skull0Inc: sure but also specify a nested link_to
[20:41:46] fryguy: so add a link_to in the block?
[20:41:46] Skull0Inc: I shall try it
[20:42:16] Skull0Inc: ahah, works perfect
[20:42:28] Skull0Inc: Thank you so much for your response.
[20:43:09] Skull0Inc: didn't think of chaining commands in the ()
[20:49:05] theunraveler: has joined #RubyOnRails
[20:50:15] theunraveler: has joined #RubyOnRails
[20:57:35] spicerack: has joined #RubyOnRails
[21:01:57] andrew91841: has joined #RubyOnRails
[21:02:45] fschuindt: has joined #RubyOnRails
[21:06:30] Technodrome: has joined #RubyOnRails
[21:09:56] hobodave: Hi guys. Is there an idiomatic DRY way to put a group of routes under a legacy scope (have to maintain legacy API) - Here's my routes.rb: https://gist.github.com/hobodave/4cf9564d2164858cc379075c91db5c9d
[21:10:34] hobodave: See comment on line 6
[21:20:53] LastWhisper____: hey guys what's the "norm" on returning nil based on rescuing any exception ?
[21:21:39] hobodave: that doesn't sound normal LastWhisper____
[21:24:00] baweaver: hobodave: http://stackoverflow.com/a/8179035/2872906
[21:24:04] baweaver: stuff them in a method
[21:24:10] baweaver: it's still "Just Ruby" remember
[21:24:34] baweaver: LastWhisper____: Use a sane return value where possible
[21:24:56] baweaver: Let's say it's a method that normally returns a collection of results, you could return an empty array
[21:25:07] LastWhisper____: well; this is currently just a workaround to a method that is failing on the gem side of things
[21:25:14] hobodave: baweaver duh, thank you :)
[21:25:30] LastWhisper____: basically it tries to do an .unpack on an object that is nil
[21:25:37] LastWhisper____: i don't wanna mess w/ their code though
[21:25:44] LastWhisper____: so I'd rather it just fail gracefully
[21:27:32] jphase: has joined #RubyOnRails
[21:34:24] LastWhisper____: https://github.com/ip2location/ip2location-ruby/blob/master/lib/ip2location_ruby.rb#L196 this specific line here. if filer.read(16) returns nil, it bombs on the unpack
[21:34:53] LastWhisper____: so the problem is with our file itself right now; but until that's fixed i wanted to at least let our stuff fail gracefully, thus adding the begin; rescue; return nil; end
[21:37:27] pupsicle: has joined #RubyOnRails
[21:41:06] baweaver: you can inline rescue
[21:41:28] baweaver: my_value = some_sketchy_method rescue nil
[21:41:46] baweaver: just make sure to comment it
[21:41:58] Technodrome: has joined #RubyOnRails
[21:44:24] gusrub: has joined #RubyOnRails
[21:45:02] DoctorMonocular: has joined #RubyOnRails
[21:50:32] new-nick: has joined #RubyOnRails
[21:53:55] dmarr: has left #RubyOnRails: ()
[22:05:48] SteenJobs_: has joined #RubyOnRails
[22:10:06] helpa-bot: has joined #RubyOnRails
[22:12:06] helpa: has joined #RubyOnRails
[22:12:17] kristofferR: has joined #RubyOnRails
[22:18:03] sonOfRa: has joined #RubyOnRails
[22:19:36] kristofferR: has joined #RubyOnRails
[22:20:22] GodFather: has joined #RubyOnRails
[22:23:23] Radar: GOOD MORNING
[22:23:38] adam12: Radar: what time is it there
[22:23:45] Radar: adam12: !g local time in Melbourne
[22:24:06] pytuger: has joined #RubyOnRails
[22:50:47] andrew91841: has joined #RubyOnRails
[23:09:16] Technodrome: has joined #RubyOnRails
[23:10:40] Jameser: has joined #RubyOnRails
[23:16:29] Derperperd: has joined #RubyOnRails
[23:31:16] Papierkorb: Radar: OHAYO
[23:58:16] uks: has joined #RubyOnRails