1

I am creating rails mobile application using jQuery for mobile... and I am using devise for authentication, and I have created new controller called user controller to create userprofile page... until I create usercontroller devise was working properly but after creating user controller, after logging in login link will become logout link, if I refresh the page it will give a link to login but once again if I refresh the page it will show link to logout.

here is my routes

Kdproject::Application.routes.draw do
root :to => 'home#index'
 devise_for :users, :path_prefix => 'd'
  namespace :user do
    root :to => "pages#viewprofile"
  end
  match '/index', :to => 'users#index'
  match '/viewprofile', :to =>'pages#viewprofile'

Please help me to come out of this...

рüффп
  • 5,172
  • 34
  • 67
  • 113
Shreedhar
  • 5,502
  • 3
  • 22
  • 27
  • even 'edit/update user' is not working properly.. please help me.. – Shreedhar Dec 16 '11 at 08:40
  • Please write your question in a better way. Did you change your routes when you created Usercontroller? – Jatin Ganhotra Dec 16 '11 at 09:04
  • yeah i have changed my routes... this is my routes Kdproject::Application.routes.draw do root :to => 'home#index' devise_for :users, :path_prefix => 'd' namespace :user do root :to => "pages#viewprofile" end match '/index', :to => 'users#index' match '/viewprofile', :to =>'pages#viewprofile' – Shreedhar Dec 16 '11 at 09:17
  • http://railscasts.com/episodes?utf8=%E2%9C%93&search=devise just in case you'll get problems of this kind again. – rmagnum2002 May 01 '12 at 19:01

3 Answers3

2

Devise has already a registrations controllers for this. If You want to add your own functionality there, you can inherit from the Registrations devise one:

class RegistrationsController < Devise::RegistrationsController

  def update
    ... your code here
  end
end

and update your routes then:

devise_for :users, :controllers => { :registrations => "registrations" }

but if you just want to add more fields, it would be much easier to get devise views, and modify the one you need (views/devise/registrations/edit) to get views:

rails generate devise:views
alony
  • 10,725
  • 3
  • 39
  • 46
  • here the problem is with sessions.. after logged out it wont destroy the session, and pls refer to my github repo and help me please.... – Shreedhar Dec 16 '11 at 09:33
0

This is was happening because the compiled js and css in public folder. problem solved by doing

rake assets:clean
Shreedhar
  • 5,502
  • 3
  • 22
  • 27
0

Did you include javascript for jquery and jquery_ujs ? If not include it in layout. For example :-

<%= javascript_include_tag "jquery", "jquery_ujs" %>

You can check this question too.

Community
  • 1
  • 1
Amrit Dhungana
  • 4,371
  • 5
  • 31
  • 36