After commenting out normalize-scss in my Gemfile and running rails -s, I get:
bin/rails:6: warning: already initialized constant APP_PATH
/Users/ItsMe/foo/bar/bin/rails:6: warning: previous definition of APP_PATH was here
Adding the gem back in lets me run the server.
...why? I've already checked bin/rails:6, and APP_PATH looks totally fine.
Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'pg', '~> 0.18.3'
gem 'sass-rails', '~> 5.0'
gem 'compass-rails', '~> 2.0', '>= 2.0.5'
# gem 'normalize-scss', '~> 3.0', '>= 3.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
# gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
# gem 'bootstrap-sass', '~> 3.3', '>= 3.3.5.1'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'figaro', '~> 1.1', '>= 1.1.1'
gem 'susy', '~> 2.2', '>= 2.2.6'
gem 'breakpoint', '~> 2.5'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'rails_12factor', '~> 0.0.3'
end
Solved it. I had required the gem in config/application.rb. Removed it, and solved.
Related
I'm trying to implement photo upload using DropzoneJS and Active Storage but at this point, my app throws undefined method 'image' for #<ActiveStorage::Attachment:0x00007fa51201dd80> error.
models/car.rb
index.html.erb
My Gemfile. Do i need to uncomment image-processing gem to enable and use?
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.5'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
#gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
#Provides better error page for Rails and other Rack apss.
gem 'better_errors', '~> 2.5', '>= 2.5.1'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'bootstrap', '~> 4.4.1'
gem 'devise', '~> 4.7', '>= 4.7.1'
gem 'jquery-rails'
gem 'omniauth', '~> 1.9'
gem 'omniauth-facebook', '~> 5.0'
#new gems
group :development, :production do
gem 'capistrano', '~> 3.11', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano-rails', '~> 1.4', require: false
gem 'capistrano-passenger', '~> 0.2.0'
gem 'capistrano-rbenv', '~> 2.1', '>= 2.1.4', github: 'capistrano/rbenv', require: false
end
#gem 'capistrano', '~> 3.11'
#gem 'capistrano-rails', '~> 1.4'
#gem 'capistrano-passenger', '~> 0.2.0'
#gem 'capistrano-rbenv', '~> 2.1', '>= 2.1.4'
gem 'jquery-ui-rails', '~> 5.0'
This is a bit confusing as i'm new to this.
Am i suppose to create a Controller for Photos?
Do i need to add a certain gem too?
How do i fix this?
You don't need to create another model. All you need to make sure you add has_many_attached :photos to your model file and using url_for(self.photos[0]) for getting url. You can also go with self.photos[0].service_url
Edit after comments:
You are getting same NoMethodError because there is no image method defined on cover_photo. One way of correcting your can be like this
def cover_photo(size_x, size_y)
if self.photos.length > 0
self.photos[0].variant(resize_to_limit: [size_x, size_y]).processed.service_url
else
"blank.jpg"
end
end
So I'm having issues pushing to Heroku I run
git push heroku master
It starts pushing, then fails with this error
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NameError: uninitialized constant Devise
/tmp/build_e47e5acc3405b13038fee9893d25b35a/config/initializers/devise.rb:3:in `<top (required)>'
Here's my gemfile
gem 'rails', '4.2.4'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'byebug', group: :development
gem 'web-console', '~> 2.0', group: :development
gem 'bootstrap-sass', '~> 3.3.5.1'
gem 'devise', '~> 3.5.2'
gem 'paperclip', '~> 4.3.1'
gem 'aws-sdk', '< 2.0'
gem 'jquery-turbolinks'
gem 'masonry-rails', '~> 0.2.4'
gem 'will_paginate', '~> 3.0.7'
gem 'will_paginate-bootstrap', '~> 1.0.1'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
It appears Devise is the culprit, would I have to add Devise to " group :production do"? I haven't assigned it to any particular group, but it is in the Gemfile.
Thanks guys.
Edit: I've added "Devise" to :production do, and still the same result.
I am on windows machine while using the command line i get this error
"(Backtrace restricted to imported tasks) cap aborted! LoadError: cannot load such file -- capistrano/passenger C:/Sites/Buy/Capfile:23:in `'
(See full trace by running task with --trace)"
And on git bash with the same command i have this error.
" cap production deploy C:/tools/ruby21/lib/ruby/2.1.0/rubygems.rb:235:in bin_path': can't find gem capistrano ([">= 0.a"]) (Gem::GemNotFoundException)
from C:/RailsInstaller/Ruby2.1.0/bin/cap:22:in'"
The gems i am using.
gem 'rails', '4.1.8'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'rails_12factor', group: :production
gem 'protected_attributes', '~> 1.1', '>= 1.1.3'
gem 'rake', '~> 10.5'
gem 'rake-compiler', '~> 0.9.5'
gem 'rspec', '~> 3.4'
gem 'omniauth-digitalocean', '~> 0.2.0'
gem 'devise', '~> 3.5', '>= 3.5.6'
gem 'bootstrap-sass'
gem 'autoprefixer-rails', '~> 6.3', '>= 6.3.1'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'
gem 'pg'
gem "cf-autoconfig", "~> 0.2.1"
gem 'omniauth', '~> 1.3', '>= 1.3.1'
gem 'json', '~> 1.8', '>= 1.8.3'
gem 'omniauth-twitter', '~> 1.2', '>= 1.2.1'
gem 'omniauth-facebook', '~> 3.0'
platforms :ruby do
gem 'unicorn'
end
group :development do
gem 'capistrano', '~> 3.4'
gem 'capistrano-bundler', '~> 1.1', '>= 1.1.4'
gem 'capistrano-rbenv', '~> 2.0', '>= 2.0.4'
gem 'capistrano-rails', group: :development
end
gem 'tzinfo-data', platforms: [:mingw, :mswin]
I had same error but with:
capistrano/rbenv
I commit the line (in your case 23) in Gapfile and the deploy work with no problems.
You may have included a line in Capfile that is:
require 'capistrano/passenger'
Please remove this line and try again cap production deploy:initial
The new capistrano requires the passenger file but I think you are not using passenger but webrick, puma or unicorn. So that is the reason your cap cannot find passenger.
For more info on deploying rails app to digital ocean ubuntu server with capistrano, puma, nginx complete tutorial available at:
http://sulmanbaig.com/blog/deploy-on-digitalocean-rails-puma-nginx
I'm trying to install active admin which I was partly successful with. However, I want to use the '0-6-stable' and not the "1.0.0.pre2" version. When I changed my gem file to reflect my change, I get the following error message:
Resolving dependencies...
Bundler could not find compatible versions for gem "formtastic":
In Gemfile:
activeadmin (>= 0) ruby depends on
formtastic (~> 2.0) ruby
formtastic (3.2.0.pre)
Now, I've gotten this message before and I would just delete my Gemfile.lock but it doesn't seem like that is working.
Copy of my gem file:
source 'http://rubygems.org'
ruby '2.2.1'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'formtastic', github: 'justinfrench/formtastic'
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'railties', '~> 4.2', '>= 4.2.5'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor', group: :production
gem 'pg', group: :production
gem 'activeadmin', github: 'activeadmin', branch: '0-6-stable'
#gem 'will_paginate', '~> 3.0'
#gem 'will_paginate-bootstrap'
gem 'carrierwave'
gem "fog"
gem "figaro"
gem 'execjs'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem "mini_magick"
gem 'devise'
gem 'searchkick'
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
The reason I want to use the most stable version of active admin is because I'm getting "NoMethodError in Admin::AdminUsersController#index" when I select "Admin Users" I hoping that using the stable version will correct this issue.
EDIT: The ActiveAdmin Issue: https://github.com/activeadmin/activeadmin/issues/4249
You can't use the 0-6-stable branch, if you use rails >= 4.x, 0-6-stable works only with rails <= 3.x.
This mean's your Gemfile need to look like this:
source 'http://rubygems.org'
ruby '2.2.1'
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'railties', '~> 4.2', '>= 4.2.5'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor', group: :production
gem 'pg', group: :production
gem 'activeadmin', github: 'activeadmin'
#gem 'will_paginate', '~> 3.0'
#gem 'will_paginate-bootstrap'
gem 'carrierwave'
gem "fog"
gem "figaro"
gem 'execjs'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem "mini_magick"
gem 'devise'
gem 'searchkick'
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
From the ActiveAdmin point of view there is no need to use ransack, inherited_resources and formtastic from github.
1: remove Gemfile.lock
2: Add gem 'jquery-rails'
3: add gem 'formtastic'
4: Run bundle install
Still if you have any issue in bundle Github Active Admin ,I would like to say go with rails 3.2.
Hope this help you !!!
Ruby byebug never seems to stop in any of my code. It installed properly without errors. I did a bundle update byebug as well as gem pristine byebug. I start the rails server with this command rails s -e development
Here's the gem file
source 'https://rubygems.org'
#ruby '2.0.0'
gem 'multi_json', '1.7.8'
gem 'rails' #, '4.0.5'
#gem 'activerecord-session_store', github: "rails/activerecord-session_store", branch: 'master'
gem "activerecord-session_store", "~> 0.1.0"
gem 'devise', '3.1.1'
gem 'rolify', '~> 3.4'
gem 'cancan', '~> 1.6.10'
#gem "resque", "~> 2.0.0.pre.1", github: "resque/resque"
gem 'resque', '~> 1.25.1', :require=>"resque/server"
gem 'resque-retry', '~> 1.0.0.a'
gem 'resque-scheduler', '~> 2.5.3', :require => "resque_scheduler/server"
gem 'resque-pool', '~> 0.3.0'
gem 'resque_mailer', '~> 2.2.6'
gem 'god', '~> 0.13.4'
gem 'gravtastic', '~> 3.2.3', :require => "gravtastic"
gem 'aws-ses', '~> 0.6.0', :require => 'aws/ses'
# stripe/payments
gem 'stripe', '~> 1.10.1'
gem 'stripe_event', '~> 1.3.0'
gem 'stripe-rails', '~> 0.2.6'
gem 'koudoku', '~> 0.0.11'
# ultra hook for wen hook testing
gem 'ultrahook', '~> 0.1.3'
# bill data
gem 'sunlight', '~> 1.1.0'
gem 'congress', '~> 0.2.3'
gem 'openstates', '~> 0.0.1'
#admin stuff
# gem 'rails_admin', '~> 0.6.1'
gem 'will_paginate', '~> 3.0.5'
gem "statsd-ruby", :require => "statsd"
gem 'paperclip', '= 3.5.4'
gem 'aws-sdk', '~> 1.5.7'
gem 'roadie', '~> 2.4.3'
gem 'exception_notification', '~> 4.0.1'
gem 'exception_handler', '~> 0.3.45'
gem 'spawnling', '~> 2.1.1'
gem 'acts_as_list', '~> 0.4.0'
gem 'jquery-rails', '~> 3.1.0'
gem "jquery-ui-rails", '~> 4.2.1'
gem 'jquery-timepicker-rails', '~> 1.3.7'
gem 'time_splitter', '~> 1.0.0'
gem 'pg', '~> 0.17.1'
gem 'gibbon', "~> 1.0.4"
gem 'coffee-rails', "~> 4.0.1"
gem 'carmen', "~> 1.0.1"
gem 'nested_form', "~> 0.3.2"
gem 'simple_form', "~> 3.0.2"
gem 'ckeditor', '~> 4.1.0'
gem 'tinymce-rails', "~> 4.0.19"
gem 'fileuploader-rails', '= 3.5'
gem 'email_validator', "~> 1.4.0"
gem "impressionist", "~> 1.5.1"
gem 'rack-timeout', '~> 0.0.4'
gem 'protected_attributes', '~> 1.0.8'
# Gem to embed youtube/vimeo videos
gem 'conred', '~> 0.5.0'
# Gem to implement copy to clipboard functionality via flash
gem 'zeroclipboard-rails', '~> 0.1.0'
gem 'geocoder', '~> 1.1.9'
gem 'rack-ssl-enforcer', '~> 0.2.8'
gem 'newrelic_rpm', '~> 3.9.6.257'
# to put environment variable configurations
gem 'figaro', '~> 1.1.1'
gem 'byebug'
gem 'pry-byebug'
# better way of displaying errors on dev
gem 'better_errors', '~> 2.1.1'
gem 'binding_of_caller', '~> 0.7.2'
#gem 'debugger', '~> 1.6.8'
group :development, :test do
gem 'rspec-rails', '~> 2.14.1'
gem 'timecop', '~> 0.7.1'
gem 'spork', '~> 1.0rc'
gem 'guard', "~> 2.6.0"
gem 'guard-rspec', "~> 4.2.8"
gem 'rb-fsevent', "~> 0.9.3"
gem "jasmine-rails", "~> 0.5.1"
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 4.0.0'
gem "compass-rails", "~> 1.1.2"
gem 'uglifier', '>= 1.3.0'
end
I had downgrade to a lower version of byebug and it works. Not sure what incompatibilities there may have been with the latest version. Using 3.5.1 worked for me.
gem 'byebug', '~> 3.5.1'