Skip to content

Instantly share code, notes, and snippets.

View Syntaf's full-sized avatar
🚄
Rails Enthusiast

Grant Mercer Syntaf

🚄
Rails Enthusiast
View GitHub Profile
{
"UNITS":{
"precip_accumulated":"Inches",
"wind_speed":"knots",
"solar_radiation":"W\/m**2",
"wind_gust":"knots",
"relative_humidity":"%",
"precip_intervals":"Inches",
"wind_chill":"Fahrenheit",
"elevation":"ft",

Backtrace

Errno::ENOENT: No such file or directory @ rb_check_realpath_internal - /usr/local/bundle/gems/debase-0.2.4.1/test/example
  /usr/local/lib/ruby/2.7.0/rubygems/package.rb:517:in `realpath'
  /usr/local/lib/ruby/2.7.0/rubygems/package.rb:517:in `block in mkdir_p_safe'
  /usr/local/lib/ruby/2.7.0/rubygems/package.rb:516:in `each'
  /usr/local/lib/ruby/2.7.0/rubygems/package.rb:516:in `reduce'
  /usr/local/lib/ruby/2.7.0/rubygems/package.rb:516:in `mkdir_p_safe'
  /usr/local/lib/ruby/2.7.0/rubygems/package.rb:438:in `block (2 levels) in extract_tar_gz'
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
# ...
def reload_admin
RailsAdmin::Config.reset
load(Rails.root.join('config/initializers/rails_admin.rb'))
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
before_action :reload_admin, if: :rails_admin_path?
private
# implemented in step three
def reload_admin; end
# config/initializers/rails_admin.rb
RailsAdmin.config do |config|
# Use a string literal to prevent auto-loading during
# initialization, you'll get a warning in Rails 6.0+
config.parent_controller = 'ApplicationController'
# ...
end
# app/models/group.rb
class Group < ApplicationRecord
include Moderate::GroupConfig
include Sluggable
# ...
end
# app/models/concerns/moderate/group_config.rb
@Syntaf
Syntaf / ApplicationController.rb
Created August 8, 2020 18:17
Dynamically reloads rails_admin configuration that lives within model concerns.
# frozen_string_literal: true
class ApplicationController < ActionController::Base
before_action :reload_rails_admin, if: :rails_admin_path?
private
def reload_rails_admin
RailsAdmin::Config.reset
# frozen_string_literal: true
# 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.
#
{
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceRoot}",
"name": "Minitest - Run at cursor position",
"type": "Ruby",
"request": "launch",
"program": "${workspaceRoot}/bin/rails",
"args": [
if ($showMobile)
{
$pageSize = 23;
}
else
{
$pageSize = $_GET['pp'] ? $_GET['pp'] : 24;
}
// .....