Redactor insert image CMS (Comfortable Mexican Sofa) - ruby-on-rails

I have taken an existing site. Integrated a CMS (Comfortable Mexican Sofa). Then installed Redactor. Threw Redactor I have the ability to add content and display it on localhost:3000. I also have the ability to upload Files. I run into a problem using its insert image function in the content box.
My server log:
Started POST "/admin/sites/2/pages/2/null?ajax=1" for 127.0.0.1 at 2015-09-22 01:26:44 -0400
ActionController::RoutingError (No route matches [POST] "/admin/sites/2/pages/2/null"):
actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.3) 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.3) 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.3) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.3) lib/rails/engine.rb:511:in `call'
railties (4.0.3) 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/bam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/Users/bam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/Users/bam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
My Gemfile's relevent Gems (I did not add imagemagick to the Gemfile although I have installed it).
ruby '2.0.0'
gem 'rails', '4.0.3'
gem "paperclip", "~> 4.3.0"
gem 'comfortable_mexican_sofa', '~> 1.12.0'
gem 'kaminari'
config/environments/development
# Per https://github.com/thoughtbot/paperclip
Paperclip.options[:command_path] = "/usr/bin/"
routes
comfy_route :cms_admin, :path => '/admin'
# Make sure this routeset is defined last
comfy_route :cms, :path => '/', :sitemap => false
config/initializers/paperclip.rb
Paperclip.options[:command_path] = "/usr/bin/"
When I file upload and it is successful this is the first two lines of the server log where the difference occurs is on line 2.
Started POST "/admin/sites/2/files?ajax=true" for 127.0.0.1 at 2015-09-22 01:48:10 -0400
Processing by Comfy::Admin::Cms::FilesController#create as HTML
Feel Free to checkout out the repo I was not sure how do demonstrate the files that Redactor added. https://github.com/jpbamberg1993/aqqaluk the branch it "redactor".
Do not hesitate to critique this post it is my first one.
Thank You

Turns out that the new version of Comfortable Mexican Sofa comes with redactor. Based on our Ruby version it was defaulting to the older version. Upgrading the gemset solved the problem.
https://github.com/comfy/comfortable-mexican-sofa/tree/v1.12.6
Another alternative that was presented to me was to "You can upload the image in the ​Files​ section of the admin, then refer to the image in your default page editor. After you upload an image, CMS adds an “uploaded files” module to the right of your editor where you can copy-and-paste image URLs to create <image> tags." Ed Toro

Related

Attempting to trace where this asset is getting called

I see this error when I load any page on my website:
Started GET "/assets/star-rating.min.js.map" for ::1 at 2018-01-26 08:18:34 -0500
ActionController::RoutingError (No route matches [GET] "/assets/star-rating.min.js.map"):
web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:22:in `middleware_call'
web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:13:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.2) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.2) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.2) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
rack-cors (0.4.1) lib/rack/cors.rb:81:in `call'
railties (4.2.2) lib/rails/engine.rb:518:in `call'
railties (4.2.2) lib/rails/application.rb:164:in `call'
rack (1.6.4) lib/rack/deflater.rb:35:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
puma (3.6.2) lib/puma/configuration.rb:225:in `call'
puma (3.6.2) lib/puma/server.rb:578:in `handle_request'
puma (3.6.2) lib/puma/server.rb:415:in `process_client'
puma (3.6.2) lib/puma/server.rb:275:in `block in run'
puma (3.6.2) lib/puma/thread_pool.rb:116:in `call'
puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
Rendered /Users/jeremylopez/.rvm/gems/ruby-2.2.3#awaken/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/_trace.html.erb (2.3ms)
Rendered /Users/jeremylopez/.rvm/gems/ruby-2.2.3#awaken/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/routing_error.html.erb within rescues/layout (452.2ms)
Processing by ErrorsController#internal_server_error as HTML
but I have no idea where it's being called. Does anyone have a good method of tracing this to find out whey it's trying to load this asset on all pages?
Could you provide more information on your asset pipeline? If you're doing everything through sprockets then check application.js - you can use process of elimination to see which require it comes from.
If you're loading scripts from a lot of different sources, you could use the network tab of your browser's developer tools, and see if these requests originate right after any particular script.
That's very wired problem but need refactoring that also tough for finding where from called this.
That's mean any gem or any file are dependent or linked to this file or application.js requiring this star-rating.min.js.map, I have searched on the Google writing star-rating.min.js.map this but not found any file over the Google which match this star-rating.min.js.map.
If you find any file within your application which calling this then you must remove or comment out this.
I think you understood the point.

Ruby on Rails devise issues

I have been trying to figure this out for way too long and i am hoping for some help here. I am new to Ruby and downloaded devise gem but when i try to run the sign up page it is giving me this error in my terminal:
Started GET "/users/sign_up" for 127.0.0.1 at 2013-09-11 17:52:28 -0700
ActionController::RoutingError (No route matches [GET] "/users/sign_up"):
actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.12) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.12) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.12) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.12) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.12) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.12) lib/rails/engine.rb:479:in `call'
railties (3.2.12) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.12) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Rendered /usr/local/rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/actionpack-3.2.12/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (3.0ms)
I imagine this means i do not have a route for the sign up page. How do i set that up. I have looked online and tried almost everything and nothing seems to work.
I would first make sure Devise is set up properly, per the instructions here... https://github.com/plataformatec/devise
Specifically (after getting the Devise gem)...
rails generate devise:install
followed by...
rails generate devise MODEL
Where MODEL is often User.
After that your routes should just work assuming your links are correct. The sign up link alias is...
new_user_registration_path
Your routes.rb should have something like the following in it if it's set up properly...
devise_for :users
In your routes.rb
devise_for :users
maybe try running
rails g devise User
Hopefully you have already run
rails g devise:install

Error Running Ruby on Rails App in Production Mode

I'm just starting to use Ruby on Rails and I am going through a tutorial to get started. I have everything working for testing, so I can use a rails server command in the directory to make it show the basic "Welcome aboard" page that I want to see; however, when I change this to rails server -e production I suddenly only see the "The page you were looking for doesn't exist." page. When this happens, the command prompt shows:
[2013-08-07 19:54:26] INFO WEBrick 1.3.1
[2013-08-07 19:54:26] INFO ruby 1.9.3 (2013-06-27) [i386-mingw32]
[2013-08-07 19:54:26] INFO WEBrick::HTTPServer#start: pid=12664 port=3000
I, [2013-08-07T19:54:26.515238 #12664] INFO -- : Started GET "/" for 127.0.0.1
at 2013-08-07 19:54:26 -0700
F, [2013-08-07T19:54:26.752394 #12664] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/"):
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `c
all'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `ca
ll'
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 tag
ged'
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'
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'
C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
This may seem very similar to a number of other questions, but I have tried a number of solutions that have all failed. Thank you for any possible help.
Indeed, this is the default behaviour for an application that has no routes.
The "Welcome aboard" page is just an introduction for developers and is only shown in the development environment.

Problems with rails 4 in production environment

I create a new rails 4beta1 app (ruby 2.0) from scratch and when I launch de server in development mode it runs fine but when I try in production it doesn't.
I already try to run bundle exec rake assets:precompile RAILS_ENV=production and change the config.serve_static_assets to true in the config/environments/production file but I still got the error:
=> Booting WEBrick
=> Rails 4.0.0.beta1 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-03 11:53:46] INFO WEBrick 1.3.1
[2013-04-03 11:53:46] INFO ruby 2.0.0 (2013-02-24) [x86_64-darwin12.2.0]
[2013-04-03 11:53:46] INFO WEBrick::HTTPServer#start: pid=13848 port=3000
I, [2013-04-03T11:53:50.521162 #13848] INFO -- : Started GET "/" for 127.0.0.1 at 2013-04-03 11:53:50 +0100
F, [2013-04-03T11:53:50.695426 #13848] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/"):
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0.beta1) 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.beta1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0.beta1) lib/rails/engine.rb:510:in `call'
railties (4.0.0.beta1) lib/rails/application.rb:96: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/jbatista/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/Users/jbatista/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/Users/jbatista/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
Webpage error:
In Rails 4.0, for technical reasons the default Rails page doesn't work on production environment, this includes any server (like heroku). The good news is that the error will go away when you start add controllers, set routes, etc...
Just start development and you'll be fine.
also looks like you need to define the root route in config/routes.rb
something like
MyApp::Application.routes.draw do
root :to => "MyApp#index"
end
where MyApp refers to your applications name.
In config/environments/production.rb serve_static_assets should be false because in production their server will handle them.
config.serve_static_assets = false
Moreover, you should not use WEBrick in production, it should only be used in development. Go for thin for example instead.
Basically, add gem 'thin' to our Gemfile.

Routing Error for assets Rails 3.2.8 on Upgrading Rails 3.1

Its really frustrating to see the routing errors for stylesheets, images when I upgrade to 3.2.8 from 3.1.1 Rails. Tried the "bundle exec rails server" command and also tried a adding the gems in the file one by one, did not work too :(
ActionController::RoutingError (No route matches [GET] "/stylesheets/application.css"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
When linking to assets in rails, always use asset_path, asset_url, or one of the helper functions that call these in turn (image_path, image_url, javascript_include_tag, stylesheet_link_tag).
In your case, it looks like you hardcoded /stylesheets/application.css in your application layout. Simple change that code to something like
<%= stylesheet_link_tag :application %>
and it should correctly point to /assets/application.css for development, and /assets/application-<sha1 hash>.css in production (when assets are compiled).
Also, if you have the assets compiled locally (if you have anything in public/assets this is the case. You may want to rm -rf public/assets if you're developing locally), then you need the following line in your config/application.rb:
config.serve_static_assets = true

Resources