Rails - How to Fix secrets.yml.enc - ruby-on-rails

Not great with Linux environments. Building an app in Ruby on Rails with Cloud9 via AWS. It's Rails 5.1 so using secrets but trying my hand at encrypted secrets.
I went and started the process with the rails secrets:setup no problem
I then started editing the file with the edit:secrets so that it would encrypt properly.
Unfortunately I used a "tab" in the file instead of just spaces. Now when I go back to edit the file, it gives me an error about finding an unaproved yaml character and won't let me edit the file.
I've tried re-runing secrets:setup to try to restart the process but to no avail. Any suggestions? Thank you in advance.

You can just delete the 2 secret files and start again:
config/secrets.yml.key
config/secrets.yml.enc

Related

Missing encryption key to decrypt file with: Rails Development environment

I've been working on a rails app & I'm sharing the code with someone through github. When I run the code locally on my machine, everything works fine, but when they run the code on their local environment they get this error:
Missing encryption key to decrypt file with. Ask your team for your master key and write it to /Users/krys2fa/articles/config/master.key or put it in the ENV['RAILS_MASTER_KEY'].
Does anyone know how I can fix this?? Thank you :)
Tell your buddy to run:
EDITOR="nano" rails credentials:edit
This command will open the nano editor and will let create your credentials file. Once then tell him to restart his server.
Remember to not to include this file in the version system. By default it is ignored in the .git file, so it is very likely your partner does not have it.
It is very weird that you can run it but your partner doesn't. Are you sure he is not requiring the master key file in development.rb ?

Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

I've updated rails from 5.1.4 to 5.2 and remove Papaerclip to use Active Storage.
I'm using digitalocean spaces. In my development env I've setted credentials in storage.yml to save images to digitalocean.
I've added aws gem in gemfile. I run db:migrate for active storage.
But when I'm going to submit the form with an image upload html tag, i receive this error: Unable to autoload constant ActiveStorage::Blob::Analyzable.
Anyone can help me?
I had the same problem and I fixe it creating new project from scratch and error disapears. I know that maybe you can't do this and I've look for possible diferences between project with the error and the new one.
The only diference I could find is about Rails credentials. With new projects using Rails 5.2, Rails is creating credentials automatically. You could check if you have credentials enabled because you will see credentials.yml.enc and master.key in you config folder.
If you don't have it, try to enable it using this tutorial https://medium.com/cedarcode/rails-5-2-credentials-9b3324851336
Hope it helps!

Downloaded project from Github, rails server won't start

Downloaded a project from Github and I am having issues getting the rails server to start. I ran the bundle install and am definitely in the right directory, is there anything that I've missed that you're supposed to do?
http://pastebin.com/rjhkQkZk
Run rails server. If there is another error, please provide more information:
Operating System
Rails Version
Log
Make sure you are at the root (directory) of the project you downloaded. And then try this command:
rails s
It would be really nice if we could learn what your log entries say.
In your terminal set the ruby source and go to the Root directory.
hit rails s or rails server
Stupid, stupid noob mistake - it's with sinatra not rails. Sorry to waste your time, guys.

Cannot start project in rails

I'm pretty new to Rails.
I created a new Rails app: rails new app_name, and ran rails server etc.
But, once I shut down and reopened my machine, I can run neither rails server nor rails console. It says to use the rails new app_name command again, but I just want to restart where I left off the day before.
Any advice is very much appreciated.
I'm guessing your current working directory of your command line is not in your project directory which you created yesterday.
cd some_path/to_my/rails_project
rails server
You must be in the directory that represents your project to do things like launch the server. Otherwise, how does it know what project to launch a server for?
Just make sure you are in the directory of the rails app you created. Sounds like you aren't.

Need help with my rails 3 environment

pulled down a repo from git. For some reason I need to do
./script/rails.rb s
where on the rails 3 ap I started on my box, I can just do the
rails server
can anyone help me set up my environment so I don't have to do this? I'm still trying to figure out what I need to type to do a migration...
I think I've figured this out. The repo you downloaded was from somebody developing on a Windows machine. They have to add the ".rb" extention to script/rails to get it to work right.
Calling rails server is really just an alias for script/rails. But you're getting an error because when you type rails server, script/rails isn't there.
The solution is easy: in your local copy of that project, rename script/rails.rb back to script/rails the way it should be.
Also, rails s and rails server are the same thing - one is just a shortcut.

Resources