rubysherpas / forem

The best Rails 3 and Rails 4 forum engine. Ever.
http://forem.herokuapp.com
MIT License
1.55k stars 422 forks source link

Admin-side Category Delete produces CategoriesController error #572

Open vcavallo opened 10 years ago

vcavallo commented 10 years ago

Using:


When navigating to /forums/admin/categories and clicking "delete" for a category, this error is raised:

AbstractController::ActionNotFound - The action 'show' could not be found for Forem::Admin::CategoriesController:

The same seems to happen for any delete actions on Forums (/forums/admin/forums) and Groups (/forums/admin/groups) as well.

If I stick a show.html.erb file in app/views/forem/admin/categories, the delete action doesn't complain and routes to that file. But the :delete method doesn't fire.

Any ideas? I'm happy to provide any further necessary information. See below for full stack trace, gemfile and gemfile.lock


full stack trace:

Started GET "/forums/admin/categories/testing-this-thinger" for 127.0.0.1 at 2014-06-25 16:31:02 -0400

AbstractController::ActionNotFound - The action 'show' could not be found for Forem::Admin::CategoriesController:
  actionpack (4.0.3) lib/abstract_controller/base.rb:131:in `process'
  actionpack (4.0.3) lib/abstract_controller/rendering.rb:44:in `process'
  actionpack (4.0.3) lib/action_controller/metal.rb:195:in `dispatch'
  actionpack (4.0.3) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.0.3) lib/action_controller/metal.rb:231:in `block in action'
  actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
  actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:48:in `call'
  actionpack (4.0.3) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.0.3) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:680:in `call'
  railties (4.0.3) lib/rails/engine.rb:511:in `call'
  railties (4.0.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
  actionpack (4.0.3) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.0.3) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:680:in `call'
  omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!'
  omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call'
  omniauth (1.2.1) lib/omniauth/builder.rb:59:in `call'
  rack-livereload (0.3.15) lib/rack/livereload.rb:23:in `_call'
  rack-livereload (0.3.15) lib/rack/livereload.rb:14:in `call'
  rails4_client_side_validations (0.0.3) lib/rails4_client_side_validations/middleware.rb:21:in `call'
  rack (1.5.2) lib/rack/etag.rb:23:in `call'
  rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/flash.rb:241:in `call'
  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/cookies.rb:486:in `call'
  activerecord (4.0.3) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
  activerecord (4.0.3) lib/active_record/migration.rb:369:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.0.3) lib/active_support/callbacks.rb:373:in `_run__468131918321514821__call__callbacks'
  activesupport (4.0.3) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/reloader.rb:64:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
  better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
  better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:17: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/vinney/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/vinney/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/vinney/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Gemfile: https://gist.github.com/vcavallo/8681c1fac0adac0a82df Gemfile.lock: https://gist.github.com/vcavallo/c5802edf54b563dff350

radar commented 10 years ago

@vcavallo First thought is that jquery_ujs isn't loaded, which is typically what makes those delete links work. Are you able to reproduce this issue in a new app with that Gemfile?

evaogbe commented 10 years ago

@radar I had the same problem. Made a new app that shows the error.

NelsonBrandao commented 10 years ago

@radar In the config/initializers/forem.rb file add:

Rails.application.config.to_prepare do Forem.layout = "application" end

That should fix it

evaogbe commented 10 years ago

Changing the links to buttons (link_to -> button_to) also works. More semantic too.

ivgames commented 10 years ago

Also has same proble, and also changed forum layout

ivgames commented 10 years ago

Approved below: //------------------------------------- @radar In the config/initializers/forem.rb file add:

Rails.application.config.to_prepare do Forem.layout = "application" end

That should fix it

radar commented 10 years ago

Can someone please provide me with exact details on how to reproduce this for a brand new Forem app?

bodrovis commented 10 years ago

It seems that the default Forem's layout does not include jquery_ujs: https://github.com/radar/forem/blob/rails4/app/assets/javascripts/forem.js.erb

Therefore when you specify own layout (eg, application) it gets loaded and everything works fine.

ivgames commented 10 years ago

I've forked forem last friday, and merged it into spree application. After, i need to render forum inside spree application. I change layout in forem.rb to spree layout. After that i tried to delete one of created forums from admin panel, and saw error described above

bodrovis commented 10 years ago

@RostDetal Yeah, seems that's the case.

ivgames commented 10 years ago

my forem config/initializers/forem.rb

Forem.user_class = "Spree::User" Rails.application.config.to_prepare do Forem.layout = Spree::Config.layout Forem.email_from_address = "please-change-me@example.com" Forem.per_page = 20 end

radar commented 10 years ago

Hi @RostDetal and @bodrovis, I'm still waiting for some exact steps to reproduce this in a new app. Please provide these.

bodrovis commented 10 years ago

@radar Don't ask me :)) I was not getting this error but judging by the details it seems that ujs is the cause. Not sure though

ivgames commented 10 years ago
  1. Install clean rails APP
  2. install forem
  3. In APP initializer try to change layout for forem like a Forem.....layout = "application" outside Rails.application.config.to_prepare do ... end