#RubyOnRails - 23 October 2018
« Back 1 day Forward 1 day »
[07:15:15] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[08:28:34] drale2k_: I would like to be able to get a blog post via ID or via "alias". Alias i a field i generated when the blog post is generated
[08:29:02] drale2k_: what is the best way to tell rails to first try alias and then fallback to ID if the param is not found as an alias
[11:28:03] dionysus69: Hey all, would you help me decide whether I should go the Heroku way for scaling or Google Kubernetes Engine platform? My problem is to find simple platform for best price.
[11:34:23] blackcross: dionysus69, go with whichever has the lowest intranet, interconnect, and/or (local) latency. For example, AWS latency from their S3 (storage) to their EB (scaling servers) is pretty horrible.
[11:34:56] blackcross: honestly, buying/renting your own barebones and setting them up properly is the best way to go, in my experience
[11:43:23] dionysus69: well, we then will have to provide constant electricity and internet which is not 100% guaranteed in my country :s
[11:48:43] blackcross: oh, then go with whatever has the lowest intra-network latency between storage and nodes
[11:52:55] blackcross: buy you may not want to bother with all the security and setup, so i'll check Google Kubernetes Engine vs heroku for u
[13:16:24] dionysus69: blackcross: thank you, since moving an app to docker isnt that complicated I will make both setups and make them work for a month, see which requires lower complexity, price and ability to scale
[13:21:13] Psy-Q: i don't understand how a block passed to authenticate_or_request_with_http_basic would work. when i return false inside it, it counts as successful authentication. but the examples seem to just compare usernames/passwords which would return true and pass the auth test, no? why doesn't false fail it?
[13:44:37] jlebrech: i have an angularjs/rails app which when I redirect_to puts in the /#!/ anchor tag when I redirect. how do that clear that out. tried login_path(anchor: 'logged_out') but nil and blank redirect using the original anchors.
[13:45:34] nzst: Psy-Q: i'd remove that begin/rescue block for starters and just return false to see if that's the actual problem
[13:46:08] Psy-Q: nzst: problem is i have a general catch-all for RecordNotFound in the application controller, so that'll trigger on any unfound user
[13:46:36] Psy-Q: i will check if it's hitting l6, i had a binding.pry there earlier and i think it was called
[13:49:27] Psy-Q: if i simply return false from that block (no other code in it) it still lets all requests through, seems to ignore the basic authentication so i'm probably using this wrong
[14:02:01] Psy-Q: but all the examples i find and the source suggest you just return false or true, that's all, that's it
[14:11:07] Psy-Q: this also just gives true: ActiveSupport::SecurityUtils.secure_compare("foo", "foo") & ActiveSupport::SecurityUtils.secure_compare("bar", "bar")
[14:58:06] Aces1up: can someone help me with some association model issues I am having? have posted code here : https://paste.ofcode.org/XuBbAx3Jq2g6RQxCQkFY6E
[15:08:16] Solaris444: New to Rails here, and having a little trouble. I'm getting the following error 'No route matches [POST] "/business/customers/new"'
[15:09:11] fryguy: that seems like it's probably the wrong url to be POSTing to, assuming you are doing normal REST routes, you'd be GETting that (if you expect to see a form), or POSTing to /business/customers if you have already filled out the form and are actually trying to create the record
[15:09:18] Solaris444: I'm unsure why, because as far as I can tell, my controller should be sending POST for new users to #create
[15:11:35] jlebrech: resources :business do; resources :customers do; post :new, on: member; end; end
[15:19:31] Solaris444: fryguy: I followed the ruby on rails tutorial.. shouldn't I be automatically redirected to create when trying to post?
[15:23:56] Linell: I'm having trouble making Warden's redirect! method work, and would really appreciate some help.
[15:24:50] Solaris444: By the way, fryguy, jlebrech... thank you. :) This is my first rails app, and I have been stumped!
[15:36:08] nzst: oh, found the docs https://www.rubydoc.info/github/hassox/warden/Warden%2FStrategies%2FBase:redirect!
[15:36:11] Linell: nzst: pretty much just this https://www.rubydoc.info/github/hassox/warden/Warden%2FStrategies%2FBase:redirect!
[15:36:41] Linell: In an older app we have it just works™ but it's several years old and padrino, not rails
[15:37:49] jlebrech: i have a question about redirect_to how do i stop redirecting copying the url#anchor to the next location?
[15:53:42] jlebrech: anchor nil or '', doesn't work. but a string works and it's my current solution
[16:04:11] thejamespinto: nzst: you cannot do that on redirect_to() You can do that on the root_path method
[16:05:04] thejamespinto: nzst: here's everything you need to know https://api.rubyonrails.org/classes/ActionDispatch/Routing/UrlFor.html#method-i-url_for
[16:06:47] thejamespinto: app.root_path anchor: 'nzst-should-study-view-helpers' => "/#nzst-should-study-view-helpers"
[16:07:33] nzst: thejamespinto: don't be rude, it wasn't even my original question, i was just trying to help jlebrech.
[16:08:27] thejamespinto: nzst: I'm sorry. I always have relax mode on when I'm answering casual questions
[16:08:43] nzst: Linell: stumped me too, I can't find much other than a line in the source about having to throw a :warden symbol. My only guess is to throw the :warden and then in the catch try the redirect!
[16:11:36] thejamespinto: BTW, I just learned I can add option :script_name to it and change the entire URL. 😍
[16:28:36] mfunkmann: Hey folks, I would like to create a rails application to run offline in conjunction with Electron ... are there any resources out there from people who already did something similar?
[16:39:17] Skull0Inc: Just saw your reference of Opal ...I just came across this today : https://hyperstack.org
[16:45:15] havenwood: mfunkmann: I've embedded a Sinatra app in a macOS app before. I'm not sure how sane it is. :P
[16:45:30] Skull0Inc: Is this the place to ask about how people feel about rails development with so much JS / React stuff looking to take over?
[16:49:24] havenwood: mfunkmann: It was a long time ago, and I can't share the thing it ended up being, but here's a public minimal example from 2012: https://github.com/havenwood/sinatra-dot-app
[16:49:51] havenwood: mfunkmann: I question my own sanity looking at this: https://github.com/havenwood/sinatra-dot-app/blob/master/Sinatra.app/Contents/MacOS/app.sh#L7
[16:50:27] havenwood: mfunkmann: Instead of embedding Sinatra, I had the app install Sinatra itself. >.>