Note: Don't do this on a production evniroment!
Get the heroku database name:
heroku pg:infoName can be found in the reponse from the command above. For example: Add-on: soaring-newly-1337.
| { | |
| "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
| "draw_minimap_border": true, | |
| "find_selected_text": true, | |
| "font_face": "Bitstream Vera Sans Mono", | |
| "font_options": | |
| [ | |
| "subpixel_antialias", | |
| "bold" | |
| ], |
| describe PostPolicy do | |
| let(:scope) { Post.where(:published => true } | |
| subject(:policy_scope) { PostPolicy::Scope.new(user, scope).resolve } | |
| permissions ".scope" do | |
| context "for an ordinary user" | |
| let(:user) { User.new(:admin => false) } | |
| it "hides unpublished post" do | |
| post = Post.create(:published => false) |
| namespace :db do | |
| desc "Backs up heroku database and restores it locally." | |
| task import_from_heroku: [ :environment, :create ] do | |
| HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote. | |
| c = Rails.configuration.database_configuration[Rails.env] | |
| heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil | |
| Bundler.with_clean_env do | |
| puts "[1/4] Capturing backup on Heroku" | |
| `heroku pg:backups capture DATABASE_URL#{heroku_app_flag}` |
Note: Don't do this on a production evniroment!
Get the heroku database name:
heroku pg:infoName can be found in the reponse from the command above. For example: Add-on: soaring-newly-1337.
| module Arel::Predications | |
| def has_key(right) | |
| Arel::Nodes::HasKey.new(self, quoted_node(right)) | |
| end | |
| end | |
| class Arel::Nodes::HasKey < Arel::Nodes::Binary | |
| def operator; :"?" end | |
| end |
| # The following comments fill some of the gaps in Solargraph's understanding of | |
| # Rails apps. Since they're all in YARD, they get mapped in Solargraph but | |
| # ignored at runtime. | |
| # | |
| # You can put this file anywhere in the project, as long as it gets included in | |
| # the workspace maps. It's recommended that you keep it in a standalone file | |
| # instead of pasting it into an existing one. | |
| # | |
| # @!parse | |
| # class ActionController::Base |
One way to do this is to use bundler to scaffold our gem:
bundler gem my_gem
I prefer to put tasks meant to manage the gem itself in lib/tasks, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks.
If you're trying to install the postgresql gem pg and it is failing with the following error message:
Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: ~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pg-1.2.3/ext
~/.rbenv/versions/3.0.0/bin/ruby -I ~/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20210125-97201-pycpo.rb extconf.rb