Activity
Posted in Our First API (Example) - GoRails
I'm using this Chrome plugin: https://github.com/callumlo...
I sure hope they get these issues with thor sorted out soon
Rails shouldn't cache project names or anything. Spring might, there have been a few times recently where I noticed I had to run spring stop
to fix a couple odd bugs that seemed like things were cached when they shouldn't be.
Posted in Apartment and Sidekiq
Sounds like the apartment-sidekiq gem isn't finding the tenant.
11:34:10 worker.1 | 2016-12-19T15:34:10.798Z 7489 TID-ox4vqdyhs WARN: Apartment::TenantNotFound: One of the following schema(s) is invalid: "companydemo" "public"
I just came across this in thor recently. I didn't have the same errors you have, but it is that latest thor release. It actually originally broke all new rails apps for a couple hours, then they released a patch, but still has issues it looks like.
https://github.com/erikhuda/thor/issues/533
These things you're seeing is probably something similar.
You could probably try setting thor in your Gemfile to "0.19.11" which was the version that wasn't causing any trouble previously.
gem "thor", "= 0.19.11"
Posted in Announcing the GoRails Forum
Yeah, it's pretty incredible to see how far it's come. All thanks to you guys in the community though. Couldn't do it without you. 💕
Awesome to have the debugging option, and it makes sense that you don't want misspellings in that situation. Search is complex. Haha
Posted in Announcing the GoRails Forum
Pretty crazy, it's been 2 years already!
Searchkick's docs for autocomplete show using this which should tell it to index those with the word_start option, so I believe that's all I did.
class Book < ActiveRecord::Base
searchkick word_start: [:title, :author]
end
https://github.com/ankane/searchkick/#instant-search--autocomplete
You doing something different?
Yep, you can upload any file type you want with Paperclip, Carrierwave, or Shrine. I like Shrine the most personally, it's nice and modular so that's what I'd personally recommend using.
Thanks Alex! I had a lot of fun recording these episodes each day. I think they turned out great, but I think it was the naming or something that got them underwatched.
Update: I actually tried out the zip file from S3 approach on this and it worked really really well. I just compiled on Ubuntu and zipped up the ~/.rbenv/versions/2.3.3
directory and uploaded it to S3. Install scripts just download and extract that to the same location, and then run rbenv rehash
so rbenv can setup all the proper shims to know that version is available. Worked like a charm!
Posted in DRY Validations for Similar Models
Definitely! You can probably do this cleanest by creating a Concern and putting the validations in there, then including the concern in both models. That's exactly the purpose they're designed for, so they should do exactly what you want.
Posted in Ruby version stuck on macOS
Weird, rbenv should be in your path.
Yeah you can definitely do this route. So long as you can quickly update to the latest version if security bugs are fixed in a new version, that's the only real concern with using prebuilt binaries.
You could also just install rbenv on every machine and then copy in a precompiled binary for the version of Ruby you want yourself. You could compile it in a VM and then zip it up and just store it on S3 to download and extract on each of your production machines. That way you can always control the version of Ruby and get security releases out in just a few minutes where you might have to wait a long amount of time for some repository to get updated.
Hey Samuel, I haven't done this recently, but it's a fun one that I should definitely do a screencast on sometime.
Check out this post. He links to a couple other related posts that are worth reading and implements a SQL query to do ranking. You can probably do something similar to this: http://www.akitaonrails.com/2016/10/31/ruby-on-rails-implementation-of-a-proper-ranking-popularity-system
Posted in Ruby version stuck on macOS
Hmmm, I can only think of the obvious places, .ruby-version
and Gemfile
to check, but I'm sure you've already done that. Did you get this figured out?
Mainly it's good convention to keep one class per file, and have the class inside the file named exactly the same.
Rails already does autoloads that path, it's just that it requires the class inside to match the folder+filename. So since it already does that, you might as well just follow the convention.
Posted in Your biggest aha! moment?
Exactly. And that's why I tend not to talk in buzzwords as best I can on GoRails. Most of what we do is really not that complicated, it just appears that way because we try to name every little detail. If you can get rid of all that, you can start really understanding things. And once you do, that's where the names come from, as succinct descriptions of things you commonly see. The trouble is trying to learn the names first without having seen the underlying patterns repeatedly in their raw, unnamed format.
Posted in Exporting Records To CSV Discussion
For the sake of the example, the model is the easiest place to put it. To better organize the code I would probably move this code to its own class but since that's not the concept I want to focus on in this episode, I just placed the code in the model.
The class has to match the filename exactly. If you have app/models/reviews/create_review.rb you need to have a class Reviews::CreateReview
defined in it. It must match the folder and filename for autoloading to work automatically. Folders equate to namespaces, and underscored filenames are converted to cased words.