Ruby on Rails Wednesday, October 2, 2013

I'm trying to make rails_admin use the custom registration controller that I used, instead of the devise one.

Meaning when I enter with /users/sign_up it uses the custom controller that has a method that I need, however if I create a user with rails_admin it seems to use the devise controller and not mine. I tried to "update" rails_admin using rails g rails_admin:install, no luck.

routes.rb

Siteconfigurationlistgenerator::Application.routes.draw do    devise_for :users, :controllers => {:registrations => "registrations"}    mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'

registration controller:

class RegistrationsController < Devise::RegistrationsController    after_filter :create_folder, :only => :create    def new      super    end    def create      build_resource(sign_up_params)      if resource.save        if resource.active_for_authentication?          set_flash_message :notice, :signed_up if is_navigational_format?          sign_up(resource_name, resource)          respond_with resource, :location => after_sign_up_path_for(resource)        else          set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?          expire_session_data_after_sign_in!          respond_with resource, :location => after_inactive_sign_up_path_for(resource)        end      else        clean_up_passwords resource        respond_with resource      end    end      def update      super    end      def create_folder      path =  Pathname.new(Rails.root.to_s + '/tmp/')       directory_name = resource.email                     Dir.mkdir(path.to_s + directory_name.to_s)                  end  end

How can I make rails_admin take the custom controller instead of the devise one? I really need that create_folder executed.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c561a41e-fca8-4d8a-8558-8d68c70f46fa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment