I've tried all the methods outlined Here for getting google analytics up and running on my rails app.
I think that google is talking to my app because when I inspect the elements and look at the network I see the .js file.
I thought I might need to just sit and wait but this didn't work. I've now tried several ways to do this and nothing is working.
gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# For google analytics
gem 'google-analytics-rails', '1.0.0'
gem 'activeadmin'
gem 'pg'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'pry'
end
gem 'rails_12factor'
gem 'delayed_job_active_record'
gem 'unicorn'
I have this line in my head tag at the bottom.
<%= analytics_init if Rails.env.production? %>
I thought this was the problem so I removed the if statement but that seemed like a bad idea as it would allow google to track any environment.It still didn't work after this...
What am I missing? I've never had this problem with analytics before. Any suggestions?
My guess is that you forgot to replace the placeholder within the analytics.js.coffee file.
#analyticsId: ->
# your google analytics ID(s) here...
'UA-XXXXXXX-XX'
Related
This question already has answers here:
Heroku deployment failed because of sqlite3 gem error
(6 answers)
Closed 5 years ago.
There are so many stackoverflow posts on this issue but I do not know why I am not getting any to work. Here is what my gemfile looks like:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# 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.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# 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.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'sqlite3', :group => [:development, :test]
group :production do
gem 'thin'
gem 'pg'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
When I run git push heroku master it gives me an error saying that gem install sqlite3 -v '1.3.13' is not available and needs to be installed(even though I have installed it).
I have tried deleteing the gem lock file, and bundleing and still nothing. I would love if someone was able to tell me where I am going wrong, because I have no idea what is wrong.
Refer to this article:
https://devcenter.heroku.com/articles/sqlite3
Sqlite is not supported by heroku as it uses an ephemeral filesystem so the database would be erased periodically.
You can use sqlite as a development database but you need to use something like
gem 'pg'
in production. You can simply remove sqlite from your gemfile or move it to one of the development / test groups.
If you are using a database in your application you also need to set up the config/database.yml file with the correct configuration.
In my app when I am running bundle install, I am getting below error.
vendor/gems/spree_social/spree_social.gemspec
is not valid. Please fix this gemspec.
The validation error was 'spree_social-3.1.0.beta contains itself
(spree_social-3.1.0.beta.gem), check your files list'
I tried everything like removing the Gemlock and updating the gems. It didn't work.
Below is my Gemfile
source 'https://rubygems.org'
ruby '2.3.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'font-awesome-sass', '~> 4.5.0'
# 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 'roo-xls'
# 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 'aws-sdk', '< 2.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'paperclip'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'rails_12factor', group: :production
# 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'
gem 'sqlite3'
end
group :production do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'pg'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'spree_scaffold', github: 'freego/spree_scaffold'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'spree', '3.0.5'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_wishlist' , :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_wishlist-2.2.0')
gem 'spree_social', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_social')
gem 'spree_gift_card', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_gift_card')
gem 'stringex'
gem 'spree_reviews', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_reviews')
gem 'spree_auth_devise', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_auth_devise-3.0.6')
gem 'spree_mail_settings', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_mail_settings')
gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings', branch: 'master'
Anyone else faced this?
Thanks
This is most likely because your compiled .gem file is contained in the repository. I assume that this is because the gem is trying to package the spree_social-3.1.0.beta.gem file inside itself, and it doesn't like that. Try removing the .gem file from the repository and rerunning bundle install.
I am willing to bet that File.join(File.dirname(__FILE__), '/vendor/gems/spree_social' points to a git repository, where bundle install will compile and install the gem each time you try to run it. My understanding is that when the gem is compiled in this way, it runs git ls-files -z`.split("\x0") on the git repository to get the list of files to put in the gem. Since the .gem file appears in the results, it tries to compile it into the gem, which causes it to fail.
I ran into this issue today, where my Gemfile was pulling a gem from a repository I published to Github, and bundle install kept failing until I removed the .gem file from the repository.
I'm following SaaS from edX and I'm trying to run my rails server that I created using
rails s
and it keeps throwing a load error for
gem/ruby-1.9.3-p448/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so:
undefined symbol: ruby_current_thread
I'm not quite sure what I can do to fix this, or what other info would be required to help me solve this. I'm sorry for such a vague post but ruby on rails is rather new to me and I'm not sure why its throwing this
ive tried
gem install rails
and i get a permissions error
*Edit 1
Gemfile The debug19 is what i was told to put in per my instructions from edX 169.1
source 'https://rubygems.org'
gem 'rails', '3.2.14'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
gem 'haml'
# To use debugger
# gem 'debugger'
group :development ,:test do
gem 'ruby-debug19' , :require => 'ruby-debug'
end
I don't know enough about your environment to give an exact answer, but you can try removing ruby-debug-base19 and ruby-debug from your Gemfile. You can also see if it's being installed by another gem by looking for references to them in your Gemfile.lock. If they are dependencies, remove the gems they depend on as well.
I'm trying to get carrierwave set up with carrierwave_backgrounder, delayed_job, and fog for storage on AWS S3.
Whenever I try to do anything in the console such as generate controllers, I am getting this error:
ruby-1.9.3-p194/gems/carrierwave_backgrounder-0.0.9/lib/carrierwave_backgrounder.rb:19:in `backend': wrong number of arguments (1 for 0) (ArgumentError)
The culprit seems to be my initializer file, backgrounder.rb, which is copied directly from the carrierwave_backgrounder github.
CarrierWave::Backgrounder.configure do |c|
# :delayed_job, :girl_friday, :sidekiq, :qu, :resque, or :qc
c.backend :delayed_job
end
If I comment that out, my generators and such start working. I set up delayed_job and carrierwave properly I believe. Here's my gemfile as well:
gem 'rails', '3.2.8'
gem 'pg'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise'
gem 'delayed_job_active_record'
gem 'carrierwave'
gem 'carrierwave_backgrounder'
gem 'fog'
gem 'rmagick'
Use latest git release for implement this.
Add this in your gemfile:
gem 'carrierwave_backgrounder', :git => "git://github.com/lardawge/carrierwave_backgrounder.git"
I got an issue here. I'm working on an app built with Rails and Backbone. In my development environment, everything's run well, but when I deployed it to the production server, this error showed in my firebug :
TypeError: this._reset is not a function
...;return a.success=function(d,e,f){ba.add?"add":"reset",c&&c(b,...
Could anyone help me on this?
Revision 1
I've precompiled the assets and this is my Gemfile :
source 'https://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'devise', '1.5.3'
gem 'friendly_id'
gem 'pry'
gem "paperclip", "~> 2.5.0"
gem "kaminari"
#gem "ckeditor", "3.7.0.rc3"
gem "tinymce-rails"
gem "puma"
gem "tlsmail"
gem "rails-erd"
gem "juggernaut"
gem "thin"
#gem 'execjs'
#gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
Anyway, I got this new fact. I tried run the app in production mode in my local machine and it ran well, but not in my server. Is there anything that I forgot to install in my server?
It seems that you install backbone manually.
I recommend using something like backbone-rails gem to help integrating rails and backbone gracefully. Something like https://github.com/codebrew/backbone-rails (there are also other gem around, but codebrew implementation is one of the most popular).
This is to ensure consistent dependency across machines.
Don't forget to read about asset pipeline, most of my problem with js and rails in production comes from my lack of understanding regarding rails 3 asset pipeline: http://guides.rubyonrails.org/asset_pipeline.html
And if you're serious about integrating backbone and rails, https://learn.thoughtbot.com/products/1-backbone-js-on-rails is an indispensable resource (at US$ 49)
EDITED:
This is my typical Gemfile when creating backbone.js & rails app:
group :assets do
gem 'haml-rails', '~> 0.3.4'
gem 'sass-rails', '~> 3.2.5'
gem 'bootstrap-sass', '~> 2.0.3.1'
gem 'compass', '~> 0.12.1'
gem 'compass-rails', '~> 1.0.2'
gem 'coffee-rails', '~> 3.2.2'
gem 'jquery-rails', '~> 2.0.2'
gem 'jquery-ui-rails', '~> 1.1.0'
gem 'handlebars_assets', '~> 0.4.4'
gem 'rails-backbone', '~> 0.7.2'
# javascript
gem 'haml_coffee_assets', '~> 1.2.0'
gem 'execjs', '~> 1.4.0'
gem 'therubyracer', '~> 0.10.1'
gem 'uglifier', '~> 1.2.4'
gem 'yajl-ruby', '~> 1.1.0'
end