Chris Oliver

Joined

291,200 Experience
86 Lessons Completed
299 Questions Solved

Activity

Yeah, that should be correct. You'd multiple the two together to get your minimum pool size since each thread would need a database connection to operate (since they're doing the work).

Your app would look like this:

worker 1 
-> thread
-> thread
-> thread
-> thread
-> thread
worker 2
-> thread
-> thread
-> thread
-> thread
-> thread

Posted in Help

Your first if doesn't have an end.

Try writing it like this:

def can_you_vote?(age)
  if age >= 17
        print "True"
    else
      print False
    end
end

Posted in Nested Comment Threads in Rails - Part 1 Discussion

Hey Arnas,

Just make your form match your routes like you normally would:

<%= form_with model: [@project, @task, Comment.new], local: true do |form| %>

Posted in Thoughts on Rails 6, is it ready for production?

Yep! I think RC1 is just fine. It's called a release candidate because if there are no bugs or regressions, this is exactly the code that will ship as the final version.

I believe the only bugs in rc1 right now are related to the new features, so as long as you're not using those too heavily, you're good to upgrade.

These are the open tickets preventing Rails 6 from being released: https://github.com/rails/rails/milestone/63

I know you can use an administrate custom field to customize the form field. There are some gems out there to help make that easier but I can't remember the name of the one that does this.

This one isn't quite right since it seems like it's only for belongs to, but it's almost exactly what you want: https://github.com/fishbrain/administrate-field-belongs_to_search

Posted in Introduction to Importing from CSV Discussion

Correct, you need validations for uniqueness so you don't get duplicates. Email is typically the field marked for uniqueness.

Wicked is pretty great. It's about as simple as it gets because if you built it yourself, you'd basically be creating wicked. I don't know of many other options, but it's pretty easy to use.

Posted in ActionCable in JumpStart project

Hey Stefan!

Everything is basically exactly the same, except that your Javascript is now in app/javascript instead.

The easiest way to setup a channel is just to run the rails generate for it:

rails g channel MyChannel

And it will take care of creating the files for you.

You can read about the JS stuff here in the edge guides:
https://edgeguides.rubyonrails.org/action_cable_overview.html#client-side-components

Posted in "You must use Bundler 2 or greater..." Error

Try upgrading to Ruby 2.6.3 (it's the latest version anyways).

There was an issue in Ruby core that they mentioned here in this discussion about the issue. https://github.com/bundler/bundler/issues/6937

This Bundler 2 stuff has been an absolute mess.

Posted in rvm vs rbenv

Bundler handles all that for you, so gemsets don't do anything these days. Your Gemfile dictates the versions for each gem, so as long as you have a Gemfile for your apps, you're set. It won't even attempt to load other gem versions.

Gemsets from rvm are from back in the early, early Ruby days when Bundler didn't exist. There was not a good way of keeping track of gem versions, so they introduced that to help. It hasn't been necessary since then.

I personally use rbenv because it's less intrusive. Rvm will override methods in your bash prompt and rbenv does not. There can be conflicts that come up and cause problems, and rvm is a bit harder to set up in production. I've ended up doing some complex things with Ruby (like building Rails hosting with Hatchbox.io), so having a simpler ruby version manager like rbenv comes in handy for things like that.

You're free to use rvm if you like. You probably don't have too much of a reason to switch, so don't worry much about it.

Posted in Display Posts on Homepage

Hey Mike,

If you want to list posts on the homepage, you just need to query for them in your homepage's controller action.

def index
  @posts = current_user.posts if user_signed_in?
end
```

Also if you use Devise, you can actually change the root when a user is logged in which I find to be the most easy option for modifying the homepage when a user is logged in. That way you can point it to any controller action and it'll be separated out nicely.

```
# config/routes.rb
authenticated :user do
  root to: "posts#index"
end

root to: "homepage#show"
```

Posted in New Project Rails 6 rc1 or 5.2.3?

Webpacker is currently having some issues. You can check their latest issues to see a discussion on it. I think they're getting closer to having a solution.

Posted in How to email @mentioned users (from ep #288)?

@Adam, that's going to be in a future video very soon. 😜

Posted in New Project Rails 6 rc1 or 5.2.3?

Rails 6 should be just around the corner once they fix a couple of bugs/regressions. Since you probably won't be finished with your app by then, you won't have to worry about the upgrade if you start it in Rails 6 rc1 and you get to take advantage of the new features in Rails 6 if you want.

I've been using Rails 6 for a few projects for a couple months now and it's been very solid.

Posted in Setup Errors for Rails on MacOS 10.14 Mojave

Oops, sorry I wasn't clear. That line of code goes in the Gemfile file, not in the terminal.

Posted in Setup Errors for Rails on MacOS 10.14 Mojave

Hey Jerrica,

Looks like maybe you're just missing this line in your Gemfile:

gem 'bootsnap', require: false

Try adding that and running bundle afterwards to install it.

It's basically just trying to load bootsnap but it can't find it. Bootsnap is a tool to make loading Rails faster. https://github.com/Shopify/bootsnap#how-does-this-work

Posted in How to use Action Mailbox in Rails 6 Discussion

You can definitely do it, but you wouldn't be able to use ActionMailbox for that. You'd want to use something like Twilio and setup a controller to receive the webhooks they send. I've been planning on doing some Twilio stuff, so I'll have to do that soon!

Did you yarn install?

You can run bin/webpack to run webpack and see what the compilation error was.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.