ruby on rails - superclass mismatch for class CommentsController (TypeError), best way to rename? -
i ran problem tonight while deploying , i'm trying fixed asap
i have no idea why happening. works fine locally not on heroku. tried sorts of different fixes after researching may have resort renaming class commentscontroller (hopefully works). best way go that? i'm pretty new rails need on making these changing correctly.
here's commentscontroller looks fyi:
class commentscontroller < applicationcontroller def new @post = post.new(params[:post]) end def show @comment = comment.find(params[:id]) respond_to |format| format.js end end def create @post = post.find(params[:post_id]) @comment = comment.new(params[:comment]) @comment.micropost = @post @comment.user = current_user if @comment.save redirect_to(:back) else render partial: 'shared/_comment_form', locals: { post: @post } end end end
comments associated each post (users able comment on posts). post other codes if needed.
here's error heroku logs
2013-04-09t05:55:19.454545+00:00 app[web.2]: /app/app/controllers/comments_contr oller.rb:1:in `<top (required)>': superclass mismatch class commentscontroll er (typeerror)
routes.db
sampleapp::application.routes.draw resources :posts, :path => "posts" resources :users resources :messages collection post :delete_selected end end end activeadmin.routes(self) devise_for :admin_users, activeadmin::devise.config resources :users member :following, :followers end end resources :sessions, only: [:new, :create, :destroy] resources :posts, only: [:create, :destroy] resources :relationships, only: [:create, :destroy] resources :posts resources :comments end root to: 'static_pages#home' match '/signup', to: 'users#new' match '/signin', to: 'sessions#new' match '/signout', to: 'sessions#destroy', via: :delete match '/post', to: 'static_pages#post' match '/post1', to: 'static_pages#post1' match '/faq', to: 'static_pages#faq' match '/review', to: 'users#review' match "/posts/:id/review" => "posts#review" end
when ran advanced indexed search inside rails app folder, here relevant files came up
- comments_controller.rb - comments_helper.rb - comments_helper_spec.rb - comments_controller_spec.rb - 3 migration files - routes.rb (posted above) - schema.rb (table called "active_admin_comments" , table called "comments') - post.rb model (has_many :comments) - user.rb model (has_many :comments) - comment.rb model - active_admin.rb in config/initializer (any instance find "comments" has been #'ed out")
i have same issue (server start correct, rspec fails same error). in case problem in activeadmin (0.6.0). don't know exactly, maybe in namespacing.
just downgrade 0.5.0 on version there no problems commentscontroller.
Comments
Post a Comment