SystemStackError (stack level too deep): error while uploading image in rails - iphone

I am working on ROR and providing api to IOS app. In this app an IOS user uploads an image to Rails App. I am working with paperclip gem. This was working fine before I run the bundle update command. Now I am getting this error:
SystemStackError (stack level too deep):
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:70
My Gemfile looks like this:
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'paperclip', '~> 3.0'
gem 'activerecord-import', '>= 0.2.0'
gem 'execjs'
gem 'therubyracer'
IOS developers are using Base64 to encode an image before uploading to Rails App. My Rails app uses this method to decode the photo_data:
def decode_photo_data
data = StringIO.new(Base64.decode64(self.photo_data))
self.photo = data
end
This was all working fine but I don’t know whether it is IOS bug or Rails bug. If it is Rails bug is it related to paperclip or something else. Please help.

Ok I got the solution for this. I find out that this is a paperclip bug. Since I run the bundle update command, it downloaded a new paperclip version paperclip-3.4.1 but before bundle update or bundle install it was using paperclip-3.3.1 so now I updated my Gemfile to this:
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'paperclip', '~> 3.3.1'
And it starts working again in my case. No error now.

Related

how can i change heroku databse / hosting

I would like to change my heroku database to something that allows for concurrent connections as my site is getting some traffic and seems to crash when multiple users are attempting to access the site. i have looked into changing my DB to unicorn but not sure if this is what I really need. I am a beginner and any insight into what I need to do would be extremely useful!
my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.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
gem 'bootstrap-sass'
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'sqlite3'
end
# 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
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Setting up puma is very straight forward. Follow this step by step: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
That said, I would dig deeper. Changing to puma is worth doing regardless but it may not be the root of your problem. App could be crashing for a number of reasons.
Here are the puma docs as well, just in case: https://github.com/puma/puma

Need help getting rails server to work

So I feel incredibly frustrated. I am doing www.railstutorial.org and they require a very specific version of rails (4.2.2). I have installed it as they wanted. Put in their Gemfile specs on their "hello_app" app they provided. When I run "rails server" I get an error message saying that "byebug" is erroring. I try to install earlier and later versions of bye bug and I get the same error message. Can someone please help me? I feel pretty lost.
The tutorial is at the url below.
https://www.railstutorial.org/book/beginning#code-hello_action
alopex#alopex-TH55-HD:~/workspace/hello_app$ more Gemfile
source 'https://rubygems.org
gem 'rails', '4.2.2'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
alopex#alopex-TH55-HD:~/workspace/hello_app$ bundle install
Gem::InstallError: byebug requires Ruby version >= 2.0.0.
An error occurred while installing byebug (3.4.0), and Bundler cannot continue.
Make sure that `gem install byebug -v '3.4.0'` succeeds before bundling.
alopex#alopex-TH55-HD:~/workspace/hello_app$ sudo gem install byebug -v 3.4.0
ERROR: Error installing byebug:
byebug requires Ruby version >= 2.0.0.
I fixed this problem in this way:
Open your application's Gemfile
remove: gem 'byebug'
replace it with: gem 'pry-byebug', platform: [:ruby_20]
It isn't rails issue: byebug requires Ruby version to be 2.0 at least. You can check your Ruby version with ruby -v, I guess it is 1.9.3 in your case. You can use rvm to install actual Ruby version on your system.
Also, you can try to remove byebug from Gemfile and try to run bundle again. Maybe other gems can run with ruby 1.9.3, and you can learn rails without dealing with rvm.

How map mongodb on ruby and rails

I am practice on ruby on rails 4 and using mongodb database,I am trying to work follow this site to connect database : http://mongoid.org/en/mongoid/docs/documents.html
However, when I worked this step this occur error:
rails g mongoid:config
error:
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (4.1.1)
In Gemfile:
mongoid (~> 3.1.6) x86-mingw32 depends on
activemodel (~> 3.2) x86-mingw32
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I am also try the command bundel update but it has that error:
sorry I am new bie on ruby and rails and mongodb, so I hope there is any easy guide to follow.
thankyou
Try skipping ActiveRecord when creating your app.
rails new my_app -O
I had this problem using the following:
gem 'rails', '4.1.1'
gem 'mongoid', '~> 4.0.0'
Skipping ActiveRecord solved that error.

Rake doesn't work with latest Compass? "uninitialized constant Sass::Script (NameError)"

I've been playing with Octopress for few days and today wanted to try latest Susy v. 2.1.2 which requires Compass v. 1.0 (1.0.0.alpha.19 atm) which requires Sass v. 3.3 , as far as I know… Beside that, according to the Susy changelog, Susy is registered with Compass 1.0 automatically.
So I modified my Gemfile:
source "https://rubygems.org"
group :development do
gem 'rake', '~> 10.0'
gem 'jekyll', '~> 0.12'
gem 'rdiscount', '~> 2.0.7'
gem 'pygments.rb', '~> 0.3.4'
gem 'RedCloth', '~> 4.2.9'
gem 'haml', '~> 3.1.7'
gem 'compass', '1.0.0.alpha.19'
gem 'sass', '~> 3.3'
gem 'sass-globbing', '~> 1.0.0'
gem 'rubypants', '~> 0.2.0'
gem 'rb-fsevent', '~> 0.9'
gem 'stringex', '~> 1.4.0'
gem 'liquid', '~> 2.3.0'
gem 'directory_watcher', '1.4.1'
end
gem 'sinatra', '~> 1.4.2'
So I did bundle install. But it seems rake generate neither rake preview don't like new Compass at all. Gettin plenty of these:
/Library/Ruby/Gems/2.0.0/gems/compass-core-
1.0.0.alpha.19/lib/compass/core/sass_extensions.rb:2:in `<top
(required)>': uninitialized constant Sass::Script (NameError)
Compass alone working without any problem. Though, I'm pretty new to Rake, Compass, Octopress so am I missing something?

Bundler::GemNotFound: Could not find net-ssh-2.7.0 in any of the sources

I've added capistrano to my Gemfile. After running the bundle command I get the following Error:
Bundler::GemNotFound: Could not find net-ssh-2.7.0 in any of the sources
This is my Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.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', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem 'simple_form'
gem 'jquery-rails'
gem 'less-rails'
gem 'therubyracer'
gem "liquid"
gem "devise"
gem "devise-basecamper"
gem "cancan"
gem 'userstamp', git: 'git://github.com/andrezimpel/userstamp.git'
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
group :development do
gem 'capistrano'
end
# Use debugger
# gem 'debugger', group: [:development, :test]
When I remove gem 'capistrano' everything works fine!
I'm not sure where the problem is, I hope somebody could help me.
Running rvm env . > .powenv worked for me.
Seems that pow made me some trouble.
cc: pow says: Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources