rich icon indicating copy to clipboard operation
rich copied to clipboard

I can't upload any images - NoMethodError Exception: undefined method `rich_file='

Open matteofuzz opened this issue 11 years ago • 21 comments

Using Rails 4.0.0 and Paperclip 4.1.0 When I select a new image to upload app raise: " - NoMethodError Exception: undefined method `rich_file=' " In debugger I verified that the exception raises at line 62

60.      if(file_params)
61.        file_params.content_type = Mime::Type.lookup_by_extension(file_params.original_filename.split('.').last.to_sym)
62.        @file.rich_file = file_params
63.      end

matteofuzz avatar Feb 11 '14 22:02 matteofuzz

I've seen this issue as well, but using CarrierWave. My guess is it has something to do with the order in which files are being loaded, and the backend (either paperclip or carrierwave) is not getting included.

efatsi avatar Feb 11 '14 23:02 efatsi

It almost seemed like an autoload issue as it would work, and then stop after awhile. Wondering if the backend isn't getting re-loaded properly after Rails autoloads files.

mackermedia avatar Feb 11 '14 23:02 mackermedia

Any news regarding this issue? I see the same problem with the same configuration (Rails 4.0.0 and Paperclip 4.1.0).

neutralino1 avatar Mar 17 '14 16:03 neutralino1

Ok, it works after a night's sleep. Weird.

neutralino1 avatar Mar 18 '14 09:03 neutralino1

@neutralino1 I bet that it's going to happen to you again. Unfortunately I didn't have time for a proper fix, but if you hit the issue again, a working hack is to fork the repo, and manually include your backend of choice - https://github.com/vigetlabs/rich/commit/8d6707ccf7f11b7b197deebdca62eaa9cd3add53

efatsi avatar Mar 18 '14 13:03 efatsi

@neutralino1 or you could try something similar to an open pull request which looks like it might solve the problem for paperclip only. PR: https://github.com/bastiaanterhorst/rich/pull/145

On Tuesday, March 18, 2014, Eli Fatsi [email protected] wrote:

@neutralino1 https://github.com/neutralino1 I bet that it's going to happen to you again. Unfortunately I didn't have time for a proper fix, but if you hit the issue again, a working hack is to fork the repo, and manually include your backend of choice - vigetlabs@8d6707chttps://github.com/vigetlabs/rich/commit/8d6707ccf7f11b7b197deebdca62eaa9cd3add53

Reply to this email directly or view it on GitHubhttps://github.com/bastiaanterhorst/rich/issues/140#issuecomment-37930180 .

mackermedia avatar Mar 18 '14 14:03 mackermedia

Yeah, that's my PR.

neutralino1 avatar Mar 18 '14 14:03 neutralino1

Oh! Well then! At first glance, it looks like this would be needed for the CarrierWave backend as well.

mackermedia avatar Mar 18 '14 14:03 mackermedia

Indeed, but I am not using CarrierWave and I don't have the time to set it up and test it. Sorry.

neutralino1 avatar Mar 18 '14 14:03 neutralino1

i'm getting the same error. What is the best thing to do? use neutralino1's fork or something else?

asecondwill avatar May 15 '14 04:05 asecondwill

Chances are you just needed to restart your rails server. Often times newly-installed gems won't work properly until you give everything a reboot.

jererutter avatar Aug 01 '14 00:08 jererutter

Why close this issue when its not fixed? It can't be that I have to restart the server if I make one change to a locale file or anything in the view when developing? This is a real issue that is affecting the workflow.

Preen avatar Dec 04 '15 12:12 Preen

It's just that you need to restart the rails server once. If you change a locale file it's not an issue for rich, but for rails.

iduuck avatar Dec 05 '15 19:12 iduuck

How can it not be? If I make a change on the locale file and I get a NoMethodError Exception: undefined method `rich_file=' error it sure is related to rich?

Preen avatar Dec 05 '15 21:12 Preen

Ok, my apologize. Wasn't up to date about the issue anymore.

Will open again. On Sat 5 Dec 2015 at 22:20 Philip Mannheimer [email protected] wrote:

How can it not be? If I make a change on the locale file and I get a NoMethodError Exception: undefined method `rich_file=' error it sure is related to rich?

— Reply to this email directly or view it on GitHub https://github.com/kreativgebiet/rich/issues/140#issuecomment-162248732.

iduuck avatar Dec 05 '15 21:12 iduuck

Thanks!

Preen avatar Dec 05 '15 21:12 Preen

Can I manually require Rich in order to temporary fix this? Because it really destroys my dev :<

Preen avatar Dec 17 '15 20:12 Preen

@preen I stumbled upon this in my local dev setup, when I tested, but it just worked for me after a restart (for the whole time)..

Which version are you on?

iduuck avatar Dec 18 '15 09:12 iduuck

@iDuuck I have this issue too. Using ActiveAdmin. Change ActiveAdmin file symbol and the error appears.

NoMethodError in Rich::Files#index
undefined method `rich_file' for #<Rich::RichFile:0x007fc24add2048>

Gemfile.lock

GIT
  remote: https://github.com/kreativgebiet/rich.git
  revision: 8b7a80101b18a3fdd34fc5e4275b0d9d421a58a9
  specs:
    rich (1.4.8)
      jquery-rails
      kaminari
      mime-types
      rack-raw-upload
      rails (>= 3.2.0)
      sass-rails

Gemfile

gem 'rich', git: 'https://github.com/kreativgebiet/rich.git'

Ammet avatar Feb 12 '16 15:02 Ammet

@ammet: Doesn't your pull request (https://github.com/kreativgebiet/rich/pull/203) fix this issue?

iduuck avatar Feb 26 '16 10:02 iduuck

Yep

Ammet avatar Feb 26 '16 10:02 Ammet