diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index d7da534..2769466 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -10,7 +10,7 @@ def create respond_to do |format| if @post.save - format.html { redirect_to root_path, notice: 'Post creado exitosamente.' } + format.html { redirect_to root_path, notice: 'Post created.' } format.json { render :show, status: :created, location: @post } else format.html { render :new, status: :unprocessable_entity } @@ -28,7 +28,7 @@ def edit; end def update respond_to do |format| if @post.update(post_params) - format.html { redirect_to root_path, notice: "Post was successfully updated." } + format.html { redirect_to root_path, notice: 'Post was successfully updated.' } format.json { render :show, status: :ok, location: @post } else format.html { render :edit, status: :unprocessable_entity } diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c765127..3f6c05b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -25,7 +25,7 @@ def create respond_to do |format| if @user.save - format.html { redirect_to user_url(@user), notice: "User was successfully created." } + format.html { redirect_to user_url(@user), notice: 'User was successfully created.' } format.json { render :show, status: :created, location: @user } else format.html { render :new, status: :unprocessable_entity } @@ -38,7 +38,7 @@ def create def update respond_to do |format| if @user.update(user_params) - format.html { redirect_to user_url(@user), notice: "User was successfully updated." } + format.html { redirect_to user_url(@user), notice: 'User was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit, status: :unprocessable_entity } @@ -47,25 +47,15 @@ def update end end - # DELETE /users/1 or /users/1.json -=begin - def destroy - @user.destroy! + private - respond_to do |format| - format.html { redirect_to users_url, notice: "User was successfully destroyed." } - format.json { head :no_content } - end + # Use callbacks to share common setup or constraints between actions. + def set_user + @user = User.find(params[:id]) end -=end - private - # Use callbacks to share common setup or constraints between actions. - def set_user - @user = User.find(params[:id]) - end - # Only allow a list of trusted parameters through. - def user_params - params.require(:user).permit(:name, :lastName, :birthday, :weight, :height, :email, :image_profile) - end + # Only allow a list of trusted parameters through. + def user_params + params.require(:user).permit(:name, :lastName, :birthday, :weight, :height, :email, :image_profile) + end end diff --git a/app/views/main/home.html.erb b/app/views/main/home.html.erb index 5720fbf..e957af6 100644 --- a/app/views/main/home.html.erb +++ b/app/views/main/home.html.erb @@ -1,6 +1,5 @@
Esto es un template para probar funcionalidades, el diseño se modificará después.
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete %> diff --git a/app/views/posts/edit.html.erb b/app/views/posts/edit.html.erb index bb7b994..3ec6a8d 100644 --- a/app/views/posts/edit.html.erb +++ b/app/views/posts/edit.html.erb @@ -1 +1 @@ -<%= render 'form', event: @event, title: 'Edit post' %> \ No newline at end of file +<%= render 'form', event: @event, title: 'Edit post' %> diff --git a/app/views/posts/new.html.erb b/app/views/posts/new.html.erb index 0284956..5b28206 100644 --- a/app/views/posts/new.html.erb +++ b/app/views/posts/new.html.erb @@ -1 +1 @@ -<%= render 'form', event: @event, title: 'New post' %> \ No newline at end of file +<%= render 'form', event: @event, title: 'New post' %> diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index bc06aa0..9e6a0dc 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -1,2 +1,2 @@