Skip to content

Commit

Permalink
no need to create every time
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Aug 8, 2024
1 parent d3a92dc commit 2367a98
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
4 changes: 0 additions & 4 deletions app/controllers/links_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# app/controllers/links_controller.rb
class LinksController < ApplicationController
before_action :authenticate_user!, except: [:index, :show, :user_links]

Expand Down Expand Up @@ -48,14 +47,11 @@ def user_links
@pinned_links = @user.links.where(visible: true, pinned: true).order(:position)
@achievements = @user.achievements.order(date: :desc)
@user.tags = JSON.parse(@user.tags) if @user.tags.is_a?(String)

OpenGraphImageGenerator.new(@user).generate
end

private

def link_params
params.require(:link).permit(:url, :title, :description, :position, :icon, :visible, :pinned)
end

end
2 changes: 0 additions & 2 deletions app/controllers/users/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ def update
@user = current_user
@user.tags = JSON.parse(@user.tags) if @user.tags.is_a?(String)

# If the user wants to update their password, require the current password
if params[:user][:password].present? || params[:user][:password_confirmation].present?
successfully_updated = @user.update_with_password(account_update_params)
else
# Otherwise, allow updating without the current password
params[:user].delete(:current_password)
successfully_updated = @user.update_without_password(account_update_params.except(:current_password))
end
Expand Down

0 comments on commit 2367a98

Please sign in to comment.