|
KoRMaK posted:My one major tip: learn where your gem libs are and dig around in them. Sometimes the documentation is on the github site, but if you get into the code you'll see all sorts of helpful comments. I had to do this with attr_encrypted when we realized that it wasn't using IV and Salt. Someone forked it, made the improvement, and then it was merged back into attr_encrypted but no documentation talked about it. I eventually got into the library and started doing searches for keywords and found what I needed. You'd want to call "title_will_change!" at the top of my_function unless the character was the same. Ruby code:
|
# ¿ Jun 13, 2014 16:59 |
|
|
# ¿ May 15, 2024 13:28 |
|
KoRMaK posted:Oh, okay. Thanks! Also, why? Is _title and @my_thing.title the same object in memory? I thought doing _title = @my_thing.title would create a new instance of the string. And when I set @my_thing.title = _title it would see that there was a different string set. When you're doing assignment in Ruby, it's by reference- two names pointing to the same thing. Ruby code:
If you straight-up need copies and you know you do, look at Object#dup and Object#clone.
|
# ¿ Jun 13, 2014 18:30 |
|
I use vim.vroom, with it's "run current file's spec" command bound to leader-r. Maybe not as fast as running a single spec, but not by much at all, and I still get vim's goodness.
|
# ¿ Jun 17, 2014 01:23 |
|
enraged_camel posted:I'm working on a hobby CRUD project that allows users to upload stuff and then view their submissions. That would work, yes, but like Smol in curious what the use case is here. Why don't you want that slug in your database?
|
# ¿ Aug 16, 2014 19:13 |
|
PHP thread is thataway
|
# ¿ Aug 26, 2014 23:32 |
|
KoRMaK posted:What is that? Plain Old Ruby Objects.
|
# ¿ Oct 15, 2014 18:27 |
|
big boi posted:This is awesome, I'm going to use #blank? all over the place now. Casimir runs a pretty good program- we hired one of his grads a little over a year ago.
|
# ¿ Feb 6, 2015 18:13 |
|
Could always look at a site like http://www.ruby-toolbox.com to see what the most popular ones are, then dive into one on Github to see what its open issues are.
|
# ¿ Feb 17, 2015 09:41 |
|
KoRMaK posted:If I wanted to spawn a process from my app that runs continuously, how would I do that and make sure it' stays running, or gets started again if its not? My rough draft is that I would spawn a SuckerPunch job that would just continuously run with a do while(true) loop, and sleep when it didn't have stuff to do. You'll also want something like god/monit/whatever the new hotness is if you want to ensure that the process is constantly running.
|
# ¿ May 12, 2015 05:06 |
|
This is everything I never knew I needed.
|
# ¿ May 22, 2015 15:33 |
|
The Dreamer posted:I'm trying to randomly grab a field from a randomly selected record that is associated with another record. I see that I can do this by ordering and calling a Random function for whichever database I'm using. This is still a prototype app so I'll probably actually do this before I go to production. I found a different way to do this though and was wondering if it was actually a terrible idea. It works now but I'm not sure how it would scale over time with larger database tables. You could do a quick COUNT(*) then choose a random record using rand(count) as your offset and a LIMIT 1
|
# ¿ May 29, 2015 07:37 |
|
Pollyanna posted:There is always more, and it is always worse. Let us see `rake stats`
|
# ¿ May 12, 2016 18:09 |
|
^^ code:
|
# ¿ May 12, 2016 19:34 |
|
Am I the only person left in TYOOL 2016 that manually adds every JS library that he uses? Granted, I don't use much, but still.
The Journey Fraternity fucked around with this message at 05:37 on Jun 15, 2016 |
# ¿ Jun 15, 2016 05:34 |
|
necrotic posted:They've finally have first-class foreign key support in ActiveRecord migrations! I think the rails5 release is focused mostly on performance improvements and bug fixes over new features, with ActionCable being the big exception. So just pure improvements since if I ever need sockets I'm gonna be using Phoenix
|
# ¿ Jun 30, 2016 20:41 |
|
New Turbolinks is the tits. That is all.
|
# ¿ Jul 27, 2016 04:43 |
|
Ruby on Rails Love-In: Office Space now a reality
|
# ¿ Dec 8, 2016 21:37 |
|
Pardot posted:Whew, looks like Matz said no to this and it's rolled back https://bugs.ruby-lang.org/issues/12958#note-18 Nice to see sanity win one.
|
# ¿ Dec 12, 2016 23:39 |
|
I may have considered using STI along with Postgres’s table inheritance at one point but I’ve since stopped thinking about the monstrosity that spawned that idea.
|
# ¿ Mar 7, 2018 04:16 |
|
kayakyakr posted:Rails 6 went official yesterday: https://weblog.rubyonrails.org/2019/8/15/Rails-6-0-final-release/ Which puts our massive codebase completely out of any support. God I need a new job.
|
# ¿ Aug 19, 2019 02:31 |
|
Sivart13 posted:you don't want your job to be upgrading the massive codebase to Rails 6? I would love to, if it weren't such a behemoth undertaking even to get it to 5.0. This codebase predates every single engineer, and was originally written by PHP devs writing their first Rails app.
|
# ¿ Aug 19, 2019 06:22 |
|
|
# ¿ May 15, 2024 13:28 |
|
kayakyakr posted:1) you do need a new job Oh for sure, I have none for them either. This place is very reactionary and only upgrades when things fall out of security fix windows, giving no time to do it outside of that small window. (I'll stop the derail here)
|
# ¿ Aug 21, 2019 22:40 |