I'm using Rails 3, on ruby 1.8.7. And using for auth. devise (1.1.3). But it is a quite large community site i'm building, so i have a table for profiles and a table for users. And every time a user registers it should generate a profile also, but in devise i'm not allowed the controllers, so i'm completely lost..
Edit
Now it says
undefined method `getlocal' for Tue, 28 Dec 2010 11:18:55 +0000:DateTime
Then when i make a file in lib called date_time.rb with this code
class DateTime
def getlocal
"it works"
end
end
And require it in my Application controller it gives me this
fail wrong number of arguments (1 for 0)
it is like it don't know anything called devise anymore, but in my routes i do have devise
devise_for :users
You can subclass the Devise RegistrationsController and add your own logic in the create() method, and call the parent class methods for everything else.
class MyRegistrationsController < Devise::RegistrationsController
prepend_view_path "app/views/devise"
def create
super
# Generate your profile here
# ...
end
def update
super
end
end
If you want to customise the Devise views that are packaged inside the Gem then you can run the following command to generate the view files for your app:
rails generate devise:views
You will also need to tell the router to use your new controller; something like:
devise_for :users, :controllers => { :registrations => "my_registrations" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With