kreativgebiet / rich

:money_with_wings: An opinionated CKEditor editor for Rails with flexible image uploads
MIT License
418 stars 238 forks source link

Rails 4 and asset paths in development mode #88

Open pehlert opened 11 years ago

pehlert commented 11 years ago

I was trying to use rich with a brand new Rails 4 app and ActiveAdmin today. However, while I managed to load rich properly, I realised that the asset_path helper in e.g. ckeditor.js.erb returns only "/ckeditor" instead of the expected "/assets/ckeditor".

This causes CKEditor to not load properly.

I tried various tweaks to my asset pipeline configuration, but non of them helped. When I added the "/assets/" prefix manually, CKEditor came up as expected.

Can someone confirm this behavior before I investigate further?

bastiaanterhorst commented 11 years ago

To be honest I haven't tested Rich on Rails 4 yet. Do you think there is a way to make this work with Rails 4 without breaking Rails 3 compatibility?

pehlert commented 11 years ago

Hey Bastiaan,

Quite frankly, I have no deeper knowledge of what was changed or not to the asset pipeline and how things are expected to work. I downgraded my application to 3.2 yesterday because it was too much of a hassle with all the library incompatibilities.

I might be able to look into it if someone confirms that the issue happens for him as well to rule out my environment as the cause. So I'd appreciate if you could leave this around a bit longer until someone else comments.

mwlang commented 11 years ago

It happens for me as well on new Rails 4 app with Active Admin on the rails4 branch.

Started GET "/ckeditor/config.js?t=D08E" for 127.0.0.1 at 2013-07-01 17:30:26 -0400

ActionController::RoutingError (No route matches [GET] "/ckeditor/config.js"):
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /Users/mwlang/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /Users/mwlang/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /Users/mwlang/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
bastiaanterhorst commented 11 years ago

I'll try to look into this soon. In the mean time, I'd love to hear it if anyone finds a solution. Preferably one that is backwards compatible.

pehlert commented 11 years ago

Sorry guys, been busy with other things lately. I really hope that I will get a chance to look into it this week. Otherwise I'd also love to hear why it breaks from someone else. Thanks!

glaucocustodio commented 11 years ago

I got the same problem with Rails 4, Rails Admin and Rich, it looks for "MediaEmbed" and "richfile" inside "/ckeditor" instead "/assets/ckeditor".

glaucocustodio commented 11 years ago

Follow the workaround I have done to get rich, rails admin and rails 4 working https://gist.github.com/glaucocustodio/5985229

kim3er commented 11 years ago

Other thing to keep in mind when rolling into Production, in the models attr_acessible has been removed in Rails 4.

moehassan commented 11 years ago

Fix for Active Admin

i just applied your edits to the following files /assets/javascripts/rich/editor/ckeditor_path.js /assets/javascripts/rich/editor/rich_editor.js.erb

bastiaanterhorst commented 11 years ago

There's now an experimental rails4 branch where @dunyakirkali is working his magic.

kirs commented 10 years ago

I couldn't find any rails4 branch, any progress on it?

rrrodrigo commented 10 years ago

I just had the same problem (with Rails 4 and ActiveAdmin). It turns out it is already fixed in master branch, but the gem you get by default is an old one. The Gemfile entry should look like this:

gem 'rich', github: 'bastiaanterhorst/rich'

... and then it works fine.

kirs commented 10 years ago

@bastiaanterhorst could you release it on Rubygems, please?

bastiaanterhorst commented 10 years ago

@kirs I'd like to do some more thorough testing before releasing a new gem, but am a bit tied up at the moment. So for now: use the master branch.

kirs commented 10 years ago

Tell me if I can help you with the gem somehow.

On 16 January 2014 12:29, Bastiaan Terhorst notifications@github.comwrote:

@kirs https://github.com/kirs I'd like to do some more thorough testing before releasing a new gem, but am a bit tied up at the moment. So for now: use the master branch.

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

KrauseFx commented 10 years ago

@bastiaanterhorst Maybe it should be mentioned in the README, that the current rich release is not yet working perfectly with Rails 4 and the user should use the master branch instead?