geekdie
Joined
Activity
Posted in uninitialized constant User::shift
the class name is not different, I added that hoping that will fix the problem but it did not.
Posted in uninitialized constant User::shift
I got this error: uninitialized constant User::shift
here's the stack trace
def redirect_based_on_shift_state
if current_user
created_shifts = current_user.shifts.in_state(:created).first
redirect_to new_shift_call_list_path(created_shifts)
end
end
Class < User
self.primary_key = 'guid'
has_many :shifts, foreign_key: 'user_guid', primary_key: 'guid', class_name: 'shift'
Class < Shift
belongs_to :user, foreign_key: 'user_guid', primary_key: 'guid', class_name: 'user'
Thanks for the help!
I upgraded my rails app ruby version from 2.2.1 to 2.5.1 and some its gems. When I load my rails app I got this error. Below are my gems:
gem 'mysql2', '< 0.5.0'
gem 'rails', '< 5.0.0'
gem 'sass-rails', '~> 5.0.0'
gem 'sprockets-es6'
gem 'font-awesome-rails'
gem 'foundation-rails'
Heres the details of the error:
File to import not found or unreadable: foundation/functions.
Load paths:
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/babel-source-5.8.35/lib
/home/jaydee/source/ruby-upgrade/shiftshark/app/assets/fonts
/home/jaydee/source/ruby-upgrade/shiftshark/app/assets/images
/home/jaydee/source/ruby-upgrade/shiftshark/app/assets/javascripts
/home/jaydee/source/ruby-upgrade/shiftshark/app/assets/stylesheets
/home/jaydee/source/ruby-upgrade/shiftshark/vendor/assets/javascripts
/home/jaydee/source/ruby-upgrade/shiftshark/vendor/assets/stylesheets
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/slick_rails-1.5.9/app/assets/fonts
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/slick_rails-1.5.9/app/assets/images
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/slick_rails-1.5.9/app/assets/javascripts
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/slick_rails-1.5.9/app/assets/stylesheets
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/foundation-rails-6.5.1.0/vendor/assets/_vendor
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/foundation-rails-6.5.1.0/vendor/assets/js
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/foundation-rails-6.5.1.0/vendor/assets/scss
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/font-awesome-rails-4.7.0.4/app/assets/fonts
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/font-awesome-rails-4.7.0.4/app/assets/stylesheets
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/local_time-2.1.0/app/assets/javascripts
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/jquery-rails-4.3.3/vendor/assets/javascripts
/home/jaydee/.rvm/gems/ruby-2.5.1/gems/coffee-rails-4.2.2/lib/assets/javascripts
Extracted source (around line #58):
// Allows the use of rem-calc() or lower-bound() in your settings
@import 'foundation/functions';
// The default font-size is set to 100% of the browser style sheet (usually 16px)
// for compatibility with browser-based text zoom or user-set defaults.
Posted in Error when running in Test Env
@Chris Oliver
I think I missed the SSH setup something from your guide.
Posted in Error when running in Test Env
Hi peeps,
I setup linux virtual machine in Azure, I was following this guide https://gorails.com/deploy/ubuntu/14.04
I want my VM as my test environment, however when I run 'cap test deploy' this what I get
test01@test01:~/IBEX-ShiftShark$ cap test deploy --trace
** Invoke test (first_time)
** Execute test
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
DEBUG [f011606c] Running /usr/share/rvm/bin/rvm version as test01@13.76.1.66
DEBUG [f011606c] Command: /usr/share/rvm/bin/rvm version
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as test01@13.76.1.66: Au thentication failed for user test01@13.76.1.66
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/runner s/parallel.rb:16:in rescue in block (2 levels) in execute'
block (2 levels) in execute'
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/runner s/parallel.rb:12:in
Caused by:
Net::SSH::AuthenticationFailed: Authentication failed for user test01@13.76.1.66
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/net-ssh-3.0.1/lib/net/ssh.rb:2 39:in start'
call'
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/connection_pool.rb:50:in
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/connection_pool.rb:50:in create_new_entry'
checkout'
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/connection_pool.rb:22:in
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/netssh.rb:187:in with_ssh'
block in _execute'
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/netssh.rb:137:in
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/netssh.rb:133:in tap'
_execute'
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/netssh.rb:133:in
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/netssh.rb:77:in capture'
block (3 levels) in '
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/capistrano-rvm-0.1.2/lib/capis trano/tasks/rvm.rake:9:in
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/netssh.rb:54:in instance_exec'
run'
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/backen ds/netssh.rb:54:in
/home/test01/.rvm/gems/ruby-2.2.1@shiftshark/gems/sshkit-1.7.1/lib/sshkit/runner s/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => rvm:check
test01@test01:~/IBEX-ShiftShark$
#My Deploy File
lock '3.4.0'
set :application, 'IBEX-ShiftShark'
set :repo_url, 'git@gitlab.com:bossj/IBEX-ShiftShark.git'
set :rollbar_token, 'a9f7527095e9410f97ae87d1eeac80c4'
set :rpush_pid, -> { File.join(shared_path, 'tmp', 'pids', 'rpush.pid') }
set :delayed_job_server_role, :app
set :delayed_job_args, '-n 2'
set :deploy_to, '/home/test01/IBEX-ShiftShark'
Default value for :linked_files is []
set :linked_files, %w[config/database.yml]
set :linked_dirs, %w[log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system]
Default branch is :master
ask :branch, proc { git rev-parse --abbrev-ref HEAD
.chomp }.call
set :rvm_ruby_version, '2.2.1' # rvm gemset to use on the server
set :keep_releases, 5
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :mkdir, '-p', "#{release_path}/tmp"
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
after :finishing, 'deploy:cleanup'
end
after 'deploy:published', 'restart' do
invoke 'delayed_job:restart'
end
#config/deploy/test.rb
server '13.76.1.66', user: 'test01', roles: %w[web app db]
$LOAD_PATH.unshift(File.expand_path('./lib', ENV['rvm_path']))
set :rvm_custom_path, '/usr/share/rvm'
set :stage, :test
set :deploy_to, "/home/test01/#{fetch(:application)}/test/"
set :scm, :gitcopy
after 'deploy:finished', :restart_rpush do
on roles(:web) do
within release_path do
if test "[ -f #{fetch(:rpush_pid)} ]"
execute :bundle, :exec, 'rpush stop -e test'
end
execute :bundle, :exec, 'rpush start -e test'
end
end
end
namespace :delayed do
desc 'Restart Delayed Job'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute! :sudo, 'service delayed_job restart'
end
end
end