Class: NyrosForm2::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- NyrosForm2::UsersController
- Defined in:
- app/controllers/nyros_form2/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/nyros_form2/users_controller.rb', line 13 def create @user = User.new(user_params) respond_to do |format| if @user.save format.html { redirect_to users_path, notice: 'Contact was successfully created.' } format.json { render json: @user, status: :created, location: @user } else format.html { render action: "new" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/nyros_form2/users_controller.rb', line 43 def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url, notice: 'user succesfully deleted' } format.json { head :no_content} format.js { render :layout => false } end end |
#edit ⇒ Object
30 31 32 |
# File 'app/controllers/nyros_form2/users_controller.rb', line 30 def edit @user = User.find(params[:id]) end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/nyros_form2/users_controller.rb', line 5 def index @users = User.all.paginate(:per_page => 5, :page => params[:page]).order('created_at DESC') end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/nyros_form2/users_controller.rb', line 9 def new @user = User.new end |
#show ⇒ Object
26 27 28 |
# File 'app/controllers/nyros_form2/users_controller.rb', line 26 def show @user = User.find(params[:id]) end |
#update ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/nyros_form2/users_controller.rb', line 34 def update @user = User.find(params[:id]) if @user.update_attributes(user_params) redirect_to users_path else render :edit end end |