Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Rails 4 and asset paths in development mode #88

Open
pehlert opened this Issue Jun 25, 2013 · 16 comments

Comments

10 participants
Contributor

pehlert commented Jun 25, 2013

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?

Contributor

bastiaanterhorst commented Jun 26, 2013

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?

Contributor

pehlert commented Jun 26, 2013

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 Jul 1, 2013

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'
Contributor

bastiaanterhorst commented Jul 2, 2013

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.

Contributor

pehlert commented Jul 3, 2013

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!

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

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

Contributor

kim3er commented Jul 17, 2013

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

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

Contributor

bastiaanterhorst commented Aug 6, 2013

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

Contributor

kirs commented Dec 30, 2013

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

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.

Contributor

kirs commented Jan 15, 2014

@bastiaanterhorst could you release it on Rubygems, please?

Contributor

bastiaanterhorst commented Jan 16, 2014

@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.

Contributor

kirs commented Jan 16, 2014

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 Mar 9, 2014

@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?

@renews renews added Fix-me labels Jun 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment