ckeditor problem

46 views
Skip to first unread message

a manhood

unread,
Apr 18, 2013, 10:24:41 PM4/18/13
to codea...@googlegroups.com
Dear all,

Could you please help me ?

i am using https://github.com/galetahub/ckeditor with rails 3

After i added the before filter at the application controller, it shows error when uploading the photos at the editor

ActionController::RoutingError (No route matches {:controller=>"ckeditor/home"}):
app/controllers/application_controller.rb:21:in `check_permission'

Code of application controller


class ApplicationController < ActionController::Base

  before_filter :check_login, :check_permission

  def check_login
#@user = User.find_by_email_and_password(params[:email],params[:password])
if session['user'].nil?
flash[:notice] = "login failed"
redirect_to :controller => 'home', :action => 'login'
else
flash[:notice] = "logged in"
#redirect_to :controller => 'home'
end
  end
  
  def check_permission
  if not session['user'].nil?
  @current_user = User.get_current_user(session['user'])
  if @current_user.mtype == "super_admin"
  else
  redirect_to :controller => 'home'
  end
  else
  redirect_to :controller => 'home'
  end
  end

  protect_from_forgery
end

Could you please advise me some suggestions to fix it ?

Thanks,
Alex

Steve Holmes

unread,
Apr 18, 2013, 10:28:30 PM4/18/13
to codea...@googlegroups.com
Did you mount the engine in your routes file?
See the read me on the link you included.

Cheers
Steve
--
You received this message because you are subscribed to the Google Groups "Codeaholics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codeaholics...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Matthew Rudy Jacobs

unread,
Apr 18, 2013, 10:34:22 PM4/18/13
to Codeaholics

the problem seems to be to do with namespacing.

in the ckeditor controllers, the link to "home" is trying to resolve "ckeditor/home",

I'd suggest trying to redirect to controller: "/home"

Matthew Rudy Jacobs

unread,
Apr 18, 2013, 10:35:44 PM4/18/13
to Codeaholics

also, I'd suggest using a route method rather than a hash.

redirect_to home_path

a manhood

unread,
Apr 18, 2013, 10:39:02 PM4/18/13
to codea...@googlegroups.com
Steve, yes. mount Ckeditor::Engine => '/ckeditor' at the route.rb

Matthew, how to redirect to controller: "/home" ? doing at the route.rb ?

36613 (tatonlto@gmail.com)

unread,
Apr 18, 2013, 10:48:24 PM4/18/13
to codea...@googlegroups.com
could you attach your routes.rb as well ?

Matthew Rudy Jacobs

unread,
Apr 18, 2013, 10:50:58 PM4/18/13
to Codeaholics


On 19 Apr, 2013 10:39 AM, "a manhood" <a.ma...@gmail.com> wrote:
>
> Steve, yes. mount Ckeditor::Engine => '/ckeditor' at the route.rb
>
> Matthew, how to redirect to controller: "/home" ? doing at the route.rb ?

redirect_to controller: "/home"

a manhood

unread,
Apr 18, 2013, 10:51:31 PM4/18/13
to codea...@googlegroups.com
Elearning::Application.routes.draw do
  mount Ckeditor::Engine => '/ckeditor'
  
  resources :users
  resources :churches
  
  get 'home/youtube'
  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => 'welcome#index'

  # See how all your routes lay out with "rake routes"
  match '/auth/:facebook/callback' => 'authen#facebook_login' 

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  match ':controller(/:action(/:id))(.:format)'

end

36613 (tatonlto@gmail.com)

unread,
Apr 19, 2013, 12:09:47 AM4/19/13
to codea...@googlegroups.com
1)
if you followed Matthew instruction, it should be working already

2)
to use the home_path helper method Matthew mentioned, you need to add a named route in your routes.rb:
get '/home/index', as: :home

then you can do this in your check_login method
redirect_to home_path


Cheers,
Eddie

a manhood

unread,
Apr 19, 2013, 12:25:41 AM4/19/13
to codea...@googlegroups.com
thanks all, but it shows error

ActionController::RoutingError (No route matches {:controller=>"home"}):
  app/controllers/application_controller.rb:21:in `check_permission'

I am still solving it....

Alex


36613 (tatonlto@gmail.com)

unread,
Apr 19, 2013, 2:22:55 AM4/19/13
to codea...@googlegroups.com
not trying "/home" ?

a manhood

unread,
Apr 19, 2013, 2:37:32 AM4/19/13
to codea...@googlegroups.com
thanks all.....solved.....thanks so much
Reply all
Reply to author
Forward
0 new messages