Skip to content

Commit

Permalink
More rubocop Rails/ActionOrder.
Browse files Browse the repository at this point in the history
  • Loading branch information
openbrian committed Jan 14, 2023
1 parent a32a3bd commit 2d0deb6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions app/controllers/communities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,12 @@ def index
# GET /communities/mycity.json
def show; end

def edit; end

def new
@title = t "communities.new.title"
@community = Community.new
end

def update
if @community.update(community_params)
redirect_to @community, :notice => t(".success")
else
flash.now[:alert] = t(".failure")
render :edit
end
end
def edit; end

def create
@community = Community.new(community_params)
Expand All @@ -59,6 +50,15 @@ def create
end
end

def update
if @community.update(community_params)
redirect_to @community, :notice => t(".success")
else
flash.now[:alert] = t(".failure")
render :edit
end
end

private

def recent_changesets
Expand Down
22 changes: 11 additions & 11 deletions app/controllers/community_links_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,20 @@ class CommunityLinksController < ApplicationController
load_and_authorize_resource :except => [:create, :new]
authorize_resource

def edit; end

def index
@community = Community.friendly.find(params[:community_id])
@links = @community.community_links
end

def edit; end

def new
@community = Community.friendly.find(params[:community_id])
@title = t "community_links.new.title"
@link = CommunityLink.new
@link.community_id = params[:community_id]
end

def update
if @link.update(link_params)
redirect_to @link.community, :notice => t(".success")
else
flash.now[:alert] = t(".failure")
render :edit
end
end

def create
@community = Community.friendly.find(params[:community_id])
@link = @community.community_links.build(link_params)
Expand All @@ -41,6 +32,15 @@ def create
end
end

def update
if @link.update(link_params)
redirect_to @link.community, :notice => t(".success")
else
flash.now[:alert] = t(".failure")
render :edit
end
end

def destroy
community_id = @link.community_id
@link.delete
Expand Down

0 comments on commit 2d0deb6

Please sign in to comment.