|
Weird. Does it also fail in irb for you?
|
# ? Mar 20, 2013 19:15 |
|
|
# ? May 15, 2024 03:05 |
|
Lexicon posted:Weird. Does it also fail in irb for you? It does, in fact. Odd.
|
# ? Mar 20, 2013 19:30 |
|
Pardot posted:It does, in fact. Odd. I am very disappointed in ruby today. This was causing a bug in my project that took hours to identify.
|
# ? Mar 20, 2013 19:31 |
|
Lexicon posted:I am very disappointed in ruby today. This was causing a bug in my project that took hours to identify. Well it's just some bug with irb, ruby itself is fine $ ruby -r 'active_support/all' -e 'r = {a: 1, until: 2}.stringify_keys; p r' {"a"=>1, "until"=>2}
|
# ? Mar 20, 2013 19:45 |
|
Pardot posted:Well it's just some bug with irb, ruby itself is fine Yeah, it doesn't seem to like the new hash syntax: code:
code:
|
# ? Mar 20, 2013 19:55 |
|
Pardot posted:Well it's just some bug with irb, ruby itself is fine Yeah, that's a fair point. I was just stepping through logic in rails console under the [faulty assumption] the parser was the same. Banging my head against the wall when it was hanging on one of these. Anyway - a rather compelling reason to use pry!
|
# ? Mar 20, 2013 20:03 |
|
I suspect irb thinks until: is until, the reverse of while.code:
|
# ? Mar 20, 2013 20:38 |
|
Cocoa Crispies posted:I suspect irb thinks until: is until, the reverse of while. Oh for sure, it totally is. It fails similarly with 'if' and 'unless'. Non-conditional keywords like 'class' are apparently fine.
|
# ? Mar 20, 2013 20:43 |
|
This is a pretty good read if you haven't seen it, root cause analysis of the Github mass email incident from Tuesday.
|
# ? Mar 20, 2013 20:51 |
|
3.2.13 is such a clusterfuck.
|
# ? Mar 21, 2013 09:28 |
|
Smol posted:3.2.13 is such a clusterfuck. Can you elaborate?
|
# ? Mar 21, 2013 12:13 |
|
Obsurveyor posted:Can you elaborate? They included the security vulnerability updates, plus a bunch of other changes that ended up causing performance and other regressions.
|
# ? Mar 21, 2013 13:50 |
|
Good summary of it here: http://blog.bugsnag.com/2013/03/20/rails-3-2-13-performance-regressions-major-bugs/
|
# ? Mar 21, 2013 14:05 |
|
Civil Twilight posted:Good summary of it here: http://blog.bugsnag.com/2013/03/20/rails-3-2-13-performance-regressions-major-bugs/ This must all be ActiveRecord related(which I don't use) because I haven't seen any of those dev server slow response issues upgrading from 3.0 to 3.2 along with the rest of my gems over the last couple days. Finally got all my specs/features passing again. Probably should have done this sooner since my cucumber runs went from 5 minutes to less than a minute.
|
# ? Mar 21, 2013 14:33 |
|
It's apparently Sprockets related, so I guess it depends on how heavily you're using that.
|
# ? Mar 21, 2013 16:37 |
|
I'm a newb at Rails stuff but I've followed the Rails Tutorial that was recommended here, and now I have a small app. I am playing around with the Facebook API using Omniauth-Facebook and Koala, which is going well. But I want to to set up something like this: 1) User logs in to my site using their email and password, gets a session with a token that's stored in the user table and is a random base64 string (SecureRandom.urlsafe_base64) - this is done and works fine. 2) I have an app on Facebook. User clicks a button on my site once logged in to authorize the app. This is handled via OmniAuth. This is done-ish. 3) Facebook generates a token which I persist and then I generate session/cookie that tracks them What I'm having a hard time with is #3 - I'm generally following this for the Omniauth stuff, but I don't know enough about how sessions work to know if I can simply create a second session for the same user or if I have to create a different controller for the Facebook session type? Basically I want to be sure that my app knows which session to look at when doing stuff on my site (logging in, logging out, changing their contact info) versus doing stuff on my site via Facebook (using the FB session and token). Hopefully this makes sense?
|
# ? Mar 21, 2013 17:03 |
|
Sub Par posted:I'm a newb at Rails stuff but I've followed the Rails Tutorial that was recommended here, and now I have a small app. I am playing around with the Facebook API using Omniauth-Facebook and Koala, which is going well. But I want to to set up something like this: Also a noob, but it sounds to me as if you are overcomplicating things. You don't need more than one session. Your User's session is stored in code:
code:
Session is just a Hash. It has an :id=>'122343123414232' member, presumably :user_id => something, and whatever else you want to put in it. The Session is also stored as a cookie on the user's computer, by default. At least I'm pretty sure it is. Be careful with putting important unencrypted info in it, otherwise go hog wild. Well, hog wild without making it too large(4kb max size?). Disclaimer, again, I'm also a noob. e. Actually the session variable itself is just session, I think session[:user_id] is just an extra member. e2. Here's the official reference, though I find it fairly complicated. There are various ways to debug rails applications(ie. stop it's operation and see what's stored in various variables). Whenever you hit an error you should be able to see the session hash and stare at what's in it. If you have something like https://github.com/charliesome/better_errors you even get a console to play around with. I think it's even better if you can use pry, but I haven't gotten around to figuring it out yet(not that it looks hard, just gotta do it). The point being, play around with sessions in whatever way you want and just manually raise errors at some point in execution so you can get inside your variables at that time. Sil fucked around with this message at 18:19 on Mar 21, 2013 |
# ? Mar 21, 2013 18:11 |
|
Excellent, thank you, I think that puts me on the right track.
|
# ? Mar 21, 2013 18:15 |
|
Ok so now I'm trying to troubleshoot an error. I can't reproduce it in development, the thing works just fine there. But when I deploy to Heroku and Facebook hits /auth/facebook/callback, I get a 500 - internal server error. I can't figure out why that would be happening. Heroku logs says: code:
|
# ? Mar 22, 2013 21:38 |
|
It's been a while, but I think the free logs are like that. You could add some exception notification gem to your app though.
|
# ? Mar 22, 2013 22:59 |
|
Yeah after an hour of failing I just paid the $12 for Exceptional and got my back trace in seconds. A++ would buy again.
|
# ? Mar 22, 2013 23:31 |
|
Anything you print to stdout will get picked up by logplex and show up in `heroku logs --tail` or any drains you set up. I thought rails did this automatically, but checked a rails project i have and saw I'm using the rails_log_stdout gem, then remembered from way back when that rails by default logs to files.
Pardot fucked around with this message at 00:11 on Mar 25, 2013 |
# ? Mar 25, 2013 00:07 |
|
Does anyone have a good gem for a popup overlay? Basically when a button is pressed, I'd like to see a form pop up with some info from the page the button was on, and some blank form fields for a user to add info into. So let's say you're on the Pink Floyd Dark Side of the Moon page. You click "Add to collection" and a popup appears asking you to check what formats you have the album in (CD, vinyl, etc) and quantity.
|
# ? Mar 25, 2013 21:05 |
I think what you're asking about is a modal? Are you using jQuery UI? Because that has a modal control built in. You can nest forms in modals and submit them with ajax if that's your thing. e; http://jqueryui.com/dialog/
|
|
# ? Mar 25, 2013 21:11 |
|
raej posted:Does anyone have a good gem for a popup overlay? Basically when a button is pressed, I'd like to see a form pop up with some info from the page the button was on, and some blank form fields for a user to add info into. Something like a lightbox?
|
# ? Mar 26, 2013 04:30 |
|
MrDoDo posted:Something like a lightbox? Something similar, but with another page. In this case it would be /collection/add which is a form, from the /albums/1 with populating info from /albums/1 in the /collection/add form.
|
# ? Mar 26, 2013 05:11 |
|
raej posted:Something similar, but with another page. In this case it would be /collection/add which is a form, from the /albums/1 with populating info from /albums/1 in the /collection/add form. You can do an AJAX request to populate the div for the lightbox with the collections form. Auto populate the field you need from from the selected album then post to the collection when you submit the form. I have done something similar and that was the way I did it.
|
# ? Mar 26, 2013 05:23 |
|
MrDoDo posted:You can do an AJAX request to populate the div for the lightbox with the collections form. Auto populate the field you need from from the selected album then post to the collection when you submit the form. I have done something similar and that was the way I did it. Start with a link or button to go to a new view that has the collections form. Add a remote: option that does that over AJAX and puts it in a lightbox (you may need to teach the action how to render without a layout). That way you get progressive enhancement.
|
# ? Mar 26, 2013 15:35 |
|
Cocoa Crispies posted:Start with a link or button to go to a new view that has the collections form. Add a remote: option that does that over AJAX and puts it in a lightbox (you may need to teach the action how to render without a layout). That way you get progressive enhancement. This would probably be the best way start out, thanks for that
|
# ? Mar 26, 2013 19:49 |
|
I am building a file attachment system. I know there are gems out there that do this, but I'm doing it by hand. Things are going well, I have successfully saved the data into the database (yes, into the DB) and successfully retrieved it and delivering it to the user via web browser. My question is how do I read that file back into an object that I can then do file.content_type on? I'm running into wierd problems where ruby complains that it is a string and not a file or something. Ruby code:
|
# ? Mar 27, 2013 17:54 |
|
Security things to look out for in Rails 3 and 4.
|
# ? Mar 27, 2013 18:13 |
|
KoRMaK posted:I am building a file attachment system. I know there are gems out there that do this, but I'm doing it by hand. Things are going well, I have successfully saved the data into the database (yes, into the DB) and successfully retrieved it and delivering it to the user via web browser. You seem to know that what you're doing is nuts, why are you doing it? Just as an exercise?
|
# ? Mar 27, 2013 19:16 |
|
I actually don't have any compelling evidence to use to convince the team against it, so I am complicit. Even if I do get evidence against it, I'd still like to know how to solve my problem as a learning exercise.
|
# ? Mar 27, 2013 19:59 |
|
Save it to a separate column in the database. A StringIO doesn't know anything about content types.
|
# ? Mar 27, 2013 20:59 |
|
It IS a string? I think #new expects a path or link to open? Why not use Paperclip-database? https://github.com/softace/paperclip_database Why it's a bad idea: I think the simple answer is that you having Amazon/Dropbox store and deliver your files is presumably cheaper than delivering it from Heroku or your own server or whatever. Furthermore I think Amazon S3 and Dropbox store the files at multiple locations around the world, making their delivery speed even better. I don't know if this is actually true(as in I've seen it mentioned as opposed to read studies done about it), and it all depends on your own server anyway.
|
# ? Mar 27, 2013 21:06 |
|
StringIO is not a string. Think of it as an IO object backed by a string instead of a file or a network socket.
|
# ? Mar 27, 2013 21:11 |
|
I'm looking to store a person's username in the database (Postgres - Heroku) as entered but add a case-insensitive unique index on the username column. So for example, I want a user to be able to sign up as "MyUserName" and have my application display the username as entered, while still disallowing other users from signing up as "myusername". The only solution I can find on google is to downcase/upcase the username prior to shoving it into the DB since Postgres' unique indexes are case sensitive by default. This accomplishes uniqueness, but doesn't allow me to display the username as entered. Were I operating in the database, I would just code:
|
# ? Mar 28, 2013 03:00 |
|
This'd do it but then you're not database-agnostic about it if that matters to you.
|
# ? Mar 28, 2013 03:33 |
|
Either seems like a kludge but I guess the kludge that makes the app more db-agnostic and allows users to potentially change their display name if I decide on that later will win. Thanks for that link though, it's helpful to see how to execute statements like that as part of a migration.
|
# ? Mar 28, 2013 03:38 |
|
|
# ? May 15, 2024 03:05 |
|
Or have them sign in with their email.
|
# ? Mar 28, 2013 03:46 |