Generate is not generating the codes - ruby-on-rails

I'm trying to give a generate any, and it will not, this error appears, and sometimes nothing appears, it keeps running forever, and nothing appears. What is going on? I'm new to this area.
root#ubuntu:~/Projeto/Projeto_testes/teste_projeto_generator# rails g scaffold User name email
/usr/lib/ruby/vendor_ruby/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
root#ubuntu:~/Projeto/Projeto_testes/teste_projeto_generator#

I did not solve it permanently, but I found a solution to circumvent the error.
When I give a new rails, it generates the gem file, there will be specified the rails version, I just change the generated gemfile, the one I "created":
source 'https://rubygems.org'
gem 'openssl', '2.0.4'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', github: 'rails/rails', branch: '4-2-stable'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'rails-i18n', '~> 4.0.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
I could not use the rbenv nor rvm to upgrade my rails, so I do this "adjustment".

Related

Rails 4 Heroku Deployment The Page Doesn't Exists

I have a basic rails app contains nothing but Welcome controller and Index action.Which both empty.I have defined a root route to it.And deployed to heroku.Bu i get "The page you were looking for doesn't exist." this error message.My url is "https://murmuring-island-27368.herokuapp. c o m/".(Please delete the spaces from c o m ).Btw i tried running production env on local but it says "Internal Server Error
Missing secret_token and secret_key_base for 'production' environment, set these values in config/secrets.yml".So what should i do?
This is the gem file.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
Generate new secret key, Try
rake secret

zurb foundation 6 on rails 4 works locally but not on dokku

I have a rails app with foundation 6 gem that renders well locally, but as soon that I push to a dokku server, the layout is not rendered.
On the chrome devlopper console I find the following error:
Uncaught ReferenceError: $ is not defined
My Gemfile
source 'https://rubygems.org'
gem 'rails_12factor', group: :production
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
#CMS
gem 'comfortable_mexican_sofa', '~> 1.12.0'
gem 'comfy_blog', '~> 1.12.0'
#foundation
gem 'foundation_rails_helper'
gem 'foundation-rails', github: "zurb/foundation-rails"
gem 'foundation-icons-sass-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
gem 'puma'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :production do
gem 'pg'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
ruby "2.2.2"
EDIT:
I've realised that locally the application.erb.html is inserted, but on dokku it's not.
Make sure that the assets are precompiled. In the production environment 'rake assets:precompile' has to run through before the rails server is started.

getting error: 'File to import not found or unreadable: foundation/functions' on Rails application

Whenever i try to access my rails app when it's running on localhost, I get the error:
File to import not found or unreadable: foundation/functions.
Load paths:
/home/oscar/RubymineProjects/myapp/app/assets/images
/home/oscar/RubymineProjects/myapp/app/assets/javascripts
/home/oscar/RubymineProjects/myapp/app/assets/stylesheets
/home/oscar/RubymineProjects/myapp/vendor/assets/javascripts
/home/oscar/RubymineProjects/myapp/vendor/assets/stylesheets
/var/lib/gems/2.1.0/gems/jquery-rails-4.1.0/vendor/assets/javascripts
/var/lib/gems/2.1.0/gems/coffee-rails-4.1.1/lib/assets/javascripts
/var/lib/gems/2.1.0/gems/foundation-rails-6.1.2.0/vendor/assets/js
/var/lib/gems/2.1.0/gems/foundation-rails-6.1.2.0/vendor/assets/scss
/var/lib/gems/2.1.0/gems/cocoon-1.2.7/app/assets/javascripts
I have tried fixing this using every method I could find in similar questions, but to no avail. Here is my Gemfile:
source 'https://rubygems.org'
gem 'foundation_rails_helper'
gem 'cocoon'
gem 'devise'
gem 'foundation-rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.4'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
## Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'remove_turbolinks'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'better_errors'
end
Any advice or suggestions would be appreciated.

Social_stream gem migration error

I have been trying to install the social_stream engine in rails 4.2.3. I'm following the guide from their home page [(http://social-stream.dit.upm.es/started/#rails)][1] Everything works until I try to migrate.
I get the following error
undefined method `database_authenticatable' for #`<ActiveRecord::ConnectionAdapters::TableDefinition`
I have tried installing this as a Mountable Engines as shown in a rails cast. That also doesn't work.
this is how my gem file looks
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'social_stream'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
I'm using cloud ide. cloud9.io. Please help me resolve this issue as I really want to try this engine out. Please let me know if there are any resources on how to install and get it working. Thank you in advance.

Activemessaging caused infinite loop in my Rails app

In my rails app, activemessaing caused an infinite loop, e.g. when I run bundle install, an error message is given:
"Your Gemfile requires gems that depend on each other, creating an infinite loop. Please remove gem 'activemessaging' and try again."
Any ideas?
Gemfile
source 'https://rubygems.org'
#gem 'dotenv-rails', :groups => [:development, :test]
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'bootstrap-sass', '3.2.0.0'
gem 'rails_config'
gem 'nokogiri-pretty'
gem 'dotenv-rails'
gem 'devise'
gem 'devise_ldap_authenticatable'
gem "activemessaging"
gem 'stomp'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'daemons'
As the message suggests, the problem is caused by the infinite loop dependency, e.g. activemessaging depends on itself. Check the gem spec in activemessaging to see if there is a self dependency defined.
I managed to get it fixed.
Just refer activemessaging to my forked version:
gem "activemessaging", :git => "https://github.com/digital-york/activemessaging.git"
The changes I've made is just to comment out self dependencies in the gem spec.

Resources