Resrfull Editer

Bonjour,

bon je suis toujours dans mon sythème d’authification et j’utilise
toujours
le plugin “restful athenfication”
J’ai ajouter une fonction d’édtion afin d’edtier mes utilisateur mais Ã
chaque fois que je clique sur le bouton

  1. je ne retourne pas à l’indes
  2. mon user n’est pas éditer.

Merci d’avance la je patoge :frowning:

voila page edit_rhtml
<%= error_messages_for :user %>

Editer <%= h @user.login %>

<% form_for :user, :url => users_path(@user), :method => :put do |f|
-%>

Login
<%= f.text_field :login %>

Email
<%= f.text_field :email %>

role
<%= f.select :role, %w(super_user power_user low_user) %>

<%= submit_tag 'Editer' %>

<% end -%>
mon controller
class UsersController < ApplicationController

Be sure to include AuthenticationSystem in Application Controller

instead
include AuthenticatedSystem

If you want “remember me” functionality, add this before_filter to

Application Controller
before_filter :login_from_cookie
before_filter :find_user, :except => [:index, :new, :create]

def index
@users = User.find :all
end

render new.rhtml

def new
@user = User.new
end

def create
@user = User.new(params[:user])
@user.save!
self.current_user = @user
#rederiger à la page index
redirect_back_or_default(’/’)
flash[:notice] = “Thanks for signing up!”
rescue ActiveRecord::RecordInvalid
render :action => ‘new’
end

def activate
@user = User.find_by_activation_code(params[:id])
if @user and @user.activate
self.current_user = @user
redirect_back_or_default(’/’)
flash[:notice] = “Your account has been activated.”
end
end

#seul admin peut edit les users
def edit; end

#Editer la catégories et la sauvegarde dans la bdd
def update
@user.update_attributes params[:user]
@user.save!
flash[:notice] = ‘User was successfully updated.’
redirect_to :action => ‘index’
rescue ActiveRecord::RecordInvalid #intercepte les execeptions
render :action => “edit”
end

protected
#récupère id de la catégorie
def find_user
@user = User.find params[:id]
rescue ActiveRecord::RecordNotFound
#render _404 #affiche la page 404
end

#retrour à l’index on affiche le message
def redirect_to_index ( msg = nil )
flash[:notice] = msg if msg

redirect_to :action => ‘index’

end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs