Chris Oliver

Joined

291,200 Experience
86 Lessons Completed
299 Questions Solved

Activity

Posted in Ruby issue when doing cap deploy production

Well, the point about using secrets.yml is that you don't need to put them in the ENV anymore. Just make sure the file is not in your repository.

Create secrets.yml on the server in the shared directory like you did with database.yml and then write your keys in it directly. Then add the file to your config/deploy.rb to make sure it gets symlinked on deploy.

After that, you can use those secrets without having to go through ENV. They did this so that you wouldn't have to deal with this annoying system configuration and you can manage it a lot easier!

Posted in Ruby issue when doing cap deploy production

If you use secrets.yml, you don't access them through the ENV anymore. Instead you want to use Rails.application.secrets.key_name to retrieve your values.

Take a look here for a blog post on it: http://richonrails.com/articles/the-rails-4-1-secrets-yml-file

I'll also be sure to do a screencast on this topic because I think it's not documented too well. :)

You could do that as well. The only thing to keep in mind is if you ever plan on changing the implementation, you'll want to bring it back out into its own method again.

Posted in Ruby issue when doing cap deploy production

If you're using Rails 4.1, you can use secrets.yml to set these variables or you can set them in the nginx configuration: https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#about_environment_variables

Posted in Button Loading Animations with jQuery UJS Discussion

You'll have to make sure your assets are loaded properly and the icons display elsewhere.

Sometimes it won't display right away because your icon font isn't loaded until you click the button and it takes too long to load.

Posted in Button Loading Animations with jQuery UJS Discussion

You can accomplish that using string interpolation here because it's Ruby code inside the ERB tag.

<%= f.button 'Log in', class: 'btn btn-success', data: { disable_with: "#{icon('spinner')} Logging In..." } %>

Posted in Button Loading Animations with jQuery UJS Discussion

What's your code look like?

Posted in Authorization with Pundit Discussion

Use whichever one makes the most sense to you. I tend to prefer Pundit, but that's my preference.

Posted in Ruby issue when doing cap deploy production

Install bundler on the server:

gem install bundler
rbenv rehash

Posted in Ruby issue when doing cap deploy production

You'll need to create the database.yml with a production config on the server in the folder that it mentions there since you don't have it in your repository. And yes, it'll need the configuration to postgres that you mentioned in the other thread.

Posted in Ruby issue when doing cap deploy production

Cool, so that's fixed. You'll need to check your git repo in the config to make sure it exists and/or add the forward_agent option to use your local keys for grabbing the code to the server from Github.

Posted in Ruby issue when doing cap deploy production

Well hmm, that's potentially your problem. That folder should exist to store your Ruby version in. I'm also running 2.1.2p25 on my machine, but I only have a ~/.rbenv/versions/2.1.2 folder.

Try using this instead:

set :rbenv_ruby, '2.1.2'

Posted in Ruby issue when doing cap deploy production

The second answer is good, shows that it's loaded rbenv correctly.

My bad on that first one, I meant ls ~/.rbenv/versions/2.1.2-p95

Posted in setup Postgres user fails

I think that's because the postgres user already exists. You can do the following to drop the user and create it from scratch:

sudo su postgres
dropuser postgres
createuser --pwprompt

Posted in Ruby issue when doing cap deploy production

If you type this command, what is the output? ls ~/.rbenv/versions/2.1.2-p95

Also, type which ruby and make sure the output is /home/deploy/.rbenv/shims/ruby

Posted in Styling with Bootstrap Sass Discussion

Ha, glad you figured it out! I was going to say the gem hasn't changed recently so it's likely something wrong with your Gemfile.

Posted in Ruby issue when doing cap deploy production

That error says that on the server the ruby version you have doesn't match the one you set in your Capfile. You'll want to make sure the version in this file matches the version of Ruby on the server.

Posted in Deploy Rails guide confusion

Hey Anthony,

You're right, this is on your VPS. I need to update the tutorial to so it's clear which commands get run on which machine so it's easier to wrap your head around those steps.

You'll need to run the command with sudo so that it is not readonly and you can save your changes.

Using nano sudo nano /etc/nginx/sites-enabled/default
Or with vim if you prefer it sudo vim /etc/nginx/sites-enabled/default

Posted in jQuery UJS and AJAX Discussion

Hmm, it definitely looks like it's working right. The date appears to have reset to a default value though. I'm going to guess the time column is similar to datetime which also stores the date (according to your logs, it looks right). If it doesn't though, then that could be why your dates keep resetting to 2000.

Posted in Using Vagrant for Rails Development Discussion

Cool, it's always good to have consistency like that between development and production so I'm definitely with you there.

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.