Stack level too deep when using carrierwave versions
It turned out, that it's a carrierwave's fault (well, actually, osx fault). Thread with explanation: https://github.com/carrierwaveuploader/carrierwave/issues/1330
Solution:
gem 'rmagick', :require => 'RMagick'
Find cause of 'Stack level too deep' in Carrierwave when destroying files
It turns out that the Carrierwave wiki can be misleading.
I assumed that model.file.file.extension
could be used in full_filename
as well. Turns out it can't: model.file.file
uses the full_filename
to fetch the filename. So this was creating a infinite loop and thus a SystemStackError.
The solution I went for was a simple File.extname
:
class AttachmentUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
def store_dir
"uploads/projects/#{model.attachable.project.to_param}/attachments/#{model.id}/#{model.digest}/"
end
version :large do
process resize_to_fit: [700, 700]
def full_filename (for_file = model.file.file)
"large#{File.extname(for_file)}"
end
end
version :thumbnail, from_version: :large do
process resize_to_fill: [250, 250]
def full_filename (for_file = model.file.file.extension)
"thumbnail#{File.extname(for_file)}"
end
end
end
stack level too deep when uploading and resizing image using carrierwave and rmagick
I had a similar problem. To fix it, in your Gemfile do this:
gem 'rmagick', require: false
instead of this:
gem 'rmagick'
Restart your server and try again.
Stack Level Too Deep error - produced with strong parameters I think
Try this:
in your gemfile, change gem "rmagick"
to
gem 'rmagick', :require => 'RMagick'
from https://github.com/carrierwaveuploader/carrierwave/issues/1330
Can't spot the stack level too deep error
Your recurrent pathifize
call takes original hash
(and that's why for nested hashes it creates infinite recursion) as an argument, while it probably should take value
:
pathifize(value, results, combined_key, b)
Stack Level too deep when using active storage has_one_attached :picture
Updated Answer:
The root cause of this problem in my case was having a field with the same name in my model (column in the table) as the attachment, which is not needed, since Active Storage uses separate tables. And when to_json
is called on such a model object, it causes Stack level too deep error.
After removing the column from the database, the problem goes away.
I see you have the same situation in your model, so i would suggest to you to remove column picture
from the table volunteers
Original Answer:
I just ran into the same problem. For now, i solved it by omitting the attachment from json generation.
In your case, it would be something like
@volunteer.to_json(except: :picture)
or using responders
respond_with @volunteer, except: :picture
or
format.json { render json: @volunteer, except: :picture }
Why am I getting a SystemStackError: stack level too deep in my rails3 beta4 model
You are calling same method in method itself
def forum_type_changed?
self.forum_type_changed? #This will never ending process hence it gives error
end
I think you have same method name
and column name
that causing problem change your method name then
def check_forum_type_changed?
self.forum_type_changed? #method name and column name are different
end
Related Topics
What Are Some Good Role Authorization Solutions Used with Authlogic
Ruby Mailer Is Coming Up with an Eoferror
Using Activerecord Find_In_Batches Method for Deleting Large Data
Ruby Refuses to Divide Correctly
Telling Bundler to Exclude Certain Gems from a Particular Gem's Installation
Change String in a Date Format to Another Format
Why Is Throw and Catch Hardly Ever Used in Ruby
How to Round a Float to a Specified Number of Significant Digits in Ruby
Why Require Mongo Gives Me Loaderror: No Such File to Load -- Openssl
How to Understand Sender and Receiver in Ruby
Authlogic Perishable_Token Resets on Every Request
Is There a Method to Limit/Clamp a Number
How to Put a Delay on a Loop in Ruby
How to Make Xcode Use the Correct Version of Ruby When Running a Script
Execjs::Programerror in Welcome#Index Typeerror: Object Doesn't Support This Property or Method
Printing Elements of Array Using Erb