Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/banners_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def create
authorize! @banner

if @banner.save
redirect_to banners_path, notice: "Banner was successfully created."
redirect_to @banner, notice: "Banner was successfully created."
else
set_form_variables
render :new, status: :unprocessable_content
Expand All @@ -39,7 +39,7 @@ def create
def update
authorize! @banner
if @banner.update(banner_params)
redirect_to banners_path, notice: "Banner was successfully updated.", status: :see_other
redirect_to @banner, notice: "Banner was successfully updated.", status: :see_other
else
set_form_variables
render :edit, status: :unprocessable_content
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/community_news_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def create
end

if success
redirect_to community_news_index_path,
redirect_to @community_news,
notice: "Community news was successfully created."
else
@community_news = @community_news.decorate
Expand All @@ -91,7 +91,7 @@ def update
end

if success
redirect_to community_news_index_path,
redirect_to @community_news,
notice: "Community news was successfully updated.", status: :see_other
else
set_form_variables
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/event_registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create

respond_to do |format|
format.html {
redirect_to event_registrations_path,
redirect_to @event_registration,
notice: "Registration created."
}
end
Expand All @@ -74,7 +74,7 @@ def create
def update
authorize! @event_registration
if @event_registration.update(event_registration_params)
redirect_to event_registrations_path, notice: "Registration was successfully updated.", status: :see_other
redirect_to @event_registration, notice: "Registration was successfully updated.", status: :see_other
else
set_form_variables
render :edit, status: :unprocessable_content
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create

respond_to do |format|
if success
format.html { redirect_to events_path, notice: "Event was successfully created." }
format.html { redirect_to @event, notice: "Event was successfully created." }
format.json { render :show, status: :created, location: @event }
else
set_form_variables
Expand All @@ -74,7 +74,7 @@ def update

respond_to do |format|
if success
format.html { redirect_to events_path, notice: "Event was successfully updated." }
format.html { redirect_to @event, notice: "Event was successfully updated." }
format.json { render :show, status: :ok, location: @event }
else
set_form_variables
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def create
authorize! @organization

if @organization.save
redirect_to organizations_path, notice: "Organization was successfully created."
redirect_to @organization, notice: "Organization was successfully created."
else
set_form_variables
render :new, status: :unprocessable_content
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/quotes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create
authorize! @quote

if @quote.save
redirect_to quotes_path, notice: "Quote was successfully created."
redirect_to @quote, notice: "Quote was successfully created."
else
set_form_variables
render :new, status: :unprocessable_content
Expand All @@ -43,7 +43,7 @@ def create
def update
authorize! @quote
if @quote.update(quote_params)
redirect_to quotes_path, notice: "Quote was successfully updated.", status: :see_other
redirect_to @quote, notice: "Quote was successfully updated.", status: :see_other
else
set_form_variables
render :edit, status: :unprocessable_content
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/resources_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def create
end

if success
redirect_to resource_path(@resource)
redirect_to @resource
else
@resource = @resource.decorate
set_form_variables
Expand All @@ -106,7 +106,7 @@ def update

if success
flash[:notice] = "Resource updated."
redirect_to resource_path(@resource)
redirect_to @resource
else
set_form_variables
flash[:alert] = "Failed to update Resource."
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/stories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def create
end

if success
redirect_to stories_path, notice: "Story was successfully created."
redirect_to @story, notice: "Story was successfully created."
else
@story = @story.decorate
set_form_variables
Expand All @@ -104,7 +104,7 @@ def update
end

if success
redirect_to stories_path, notice: "Story was successfully updated.", status: :see_other
redirect_to @story, notice: "Story was successfully updated.", status: :see_other
else
@story = @story.decorate
set_form_variables
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/story_ideas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def create

if success
flash[:notice] = "StoryIdea was successfully created."
if allowed_to?(:index?, StoryIdea)
redirect_to story_ideas_path
if allowed_to?(:show?, @story_idea)
redirect_to @story_idea
else
redirect_to root_path
end
Expand Down Expand Up @@ -85,8 +85,8 @@ def update

if success
flash[:notice] = "StoryIdea was successfully updated."
if allowed_to?(:index?, StoryIdea)
redirect_to story_ideas_path, status: :see_other
if allowed_to?(:show?, @story_idea)
redirect_to @story_idea, status: :see_other
else
redirect_to root_path, status: :see_other
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/tutorials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def create
authorize! @tutorial

if @tutorial.save
redirect_to tutorials_path, notice: "Tutorial was successfully created."
redirect_to @tutorial, notice: "Tutorial was successfully created."
else
@tutorial = @tutorial.decorate
set_form_variables
Expand All @@ -47,7 +47,7 @@ def create
def update
authorize! @tutorial
if @tutorial.update(tutorial_params)
redirect_to tutorials_path, notice: "Tutorial was successfully updated.", status: :see_other
redirect_to @tutorial, notice: "Tutorial was successfully updated.", status: :see_other
else
@tutorial = @tutorial.decorate
set_form_variables
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def create

if @user.save
# @user.notifications.create(notification_type: 0)
redirect_to users_path(search: @user.email), notice: "User was successfully created."
redirect_to @user, notice: "User was successfully created."
else
set_form_variables
render :new, status: :unprocessable_content
Expand Down Expand Up @@ -114,7 +114,7 @@ def update
bypass_sign_in(@user) if @user == current_user
notice = "User was successfully updated."
notice += " A confirmation email has been sent to #{@user.unconfirmed_email}." if @user.unconfirmed_email.present? && @user.saved_change_to_unconfirmed_email?
redirect_to users_path, notice: notice
redirect_to @user, notice: notice
else
flash[:alert] = "Unable to update user."
set_form_variables
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/workshop_ideas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def create
notification_type: 0)

flash[:notice] = "Workshop idea was successfully created."
if allowed_to?(:index?, WorkshopIdea)
redirect_to workshop_ideas_path
if allowed_to?(:show?, @workshop_idea)
redirect_to @workshop_idea
else
redirect_to root_path
end
Expand All @@ -53,7 +53,7 @@ def edit
def update
authorize! @workshop_idea
if @workshop_idea.update(workshop_idea_params)
redirect_to workshop_ideas_path, notice: "Workshop idea was successfully updated.", status: :see_other
redirect_to @workshop_idea, notice: "Workshop idea was successfully updated.", status: :see_other
else
set_form_variables
render :edit, status: :unprocessable_content
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/workshop_variation_ideas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def create
flash[:notice] = "Workshop variation idea was successfully created."
if params[:from] == "workshop_show" && @workshop_variation_idea.workshop.present?
redirect_to workshop_path(@workshop_variation_idea.workshop, anchor: "workshopVariations") and return
elsif allowed_to?(:index?, WorkshopVariationIdea)
redirect_to workshop_variation_ideas_path and return
elsif allowed_to?(:show?, @workshop_variation_idea)
redirect_to @workshop_variation_idea and return
else
redirect_to root_path and return
end
Expand All @@ -65,7 +65,7 @@ def create
def update
authorize! @workshop_variation_idea
if @workshop_variation_idea.update(workshop_variation_idea_params)
redirect_to workshop_variation_ideas_path, notice: "Workshop variation idea was successfully updated.", status: :see_other
redirect_to @workshop_variation_idea, notice: "Workshop variation idea was successfully updated.", status: :see_other
else
set_form_variables
render :edit, status: :unprocessable_content
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/workshop_variations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def create
flash[:notice] = "Workshop Variation has been created."
if params[:from] == "workshop_show" && @workshop_variation.workshop.present?
redirect_to workshop_path(@workshop_variation.workshop, anchor: "variation-#{@workshop_variation.id}") and return
elsif allowed_to?(:index?, WorkshopVariation)
redirect_to workshop_variations_path(sort: "created") and return
elsif allowed_to?(:show?, @workshop_variation)
redirect_to @workshop_variation and return
else
redirect_to root_path and return
end
Expand Down Expand Up @@ -82,7 +82,7 @@ def update

if @workshop_variation.update(workshop_variation_params)
flash[:notice] = "Workshop Variation updated successfully."
redirect_to workshop_variations_path
redirect_to @workshop_variation
else
set_form_variables
flash[:alert] = "Unable to update Workshop Variation."
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/workshops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create

if success
flash[:notice] = "Workshop created successfully."
redirect_to workshops_path(sort: "created")
redirect_to @workshop
else
set_form_variables
flash.now[:alert] = "Unable to save the workshop."
Expand Down Expand Up @@ -165,7 +165,7 @@ def update

if success
flash[:notice] = "Workshop updated successfully."
redirect_to workshops_path
redirect_to @workshop
else
set_form_variables
flash[:alert] = "Unable to update the workshop."
Expand Down
8 changes: 4 additions & 4 deletions spec/requests/banners_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
}.to change(Banner, :count).by(1)
end

it "redirects to the banners index" do
it "redirects to the created banner" do
post banners_url, params: { banner: valid_attributes }
expect(response).to redirect_to(banners_url)
expect(response).to redirect_to(banner_url(Banner.last))
end
end

Expand Down Expand Up @@ -104,11 +104,11 @@
skip("Add assertions for updated state")
end

it "redirects to the banners index" do
it "redirects to the updated banner" do
banner = Banner.create! valid_attributes
patch banner_url(banner), params: { banner: new_attributes }
banner.reload
expect(response).to redirect_to(banners_url)
expect(response).to redirect_to(banner_url(banner))
end
end

Expand Down
8 changes: 4 additions & 4 deletions spec/requests/community_news_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
}.to change(CommunityNews, :count).by(1)
end

it "redirects to community_news index" do
it "redirects to the created community news" do
post community_news_index_url, params: { community_news: valid_attributes }
expect(response).to redirect_to(community_news_index_url)
expect(response).to redirect_to(community_news_url(CommunityNews.last))
end
end

Expand Down Expand Up @@ -146,11 +146,11 @@
skip("Add assertions for updated state")
end

it "redirects to the community_news index" do
it "redirects to the updated community news" do
community_news = CommunityNews.create! valid_attributes
patch community_news_url(community_news), params: { community_news: new_attributes }
community_news.reload
expect(response).to redirect_to(community_news_index_url)
expect(response).to redirect_to(community_news_url(community_news))
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/event_registrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
patch event_registration_path(existing_registration),
params: { event_registration: { event_id: new_event.id } }

expect(response).to redirect_to(event_registrations_path)
expect(response).to redirect_to(event_registration_path(existing_registration))
expect(existing_registration.reload.event_id).to eq(new_event.id)
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/requests/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
}.to change(Event, :count).by(1)
end

it "redirects" do
it "redirects to the created event" do
post events_path, params: valid_params
expect(response).to redirect_to(events_path)
expect(response).to redirect_to(event_url(Event.last))
end

it "stores start_date/end_date in UTC when created by user in Pacific time zone" do
Expand All @@ -110,8 +110,8 @@
public: true
} }

expect(response).to redirect_to(events_url)
created = Event.order(created_at: :desc).first
expect(response).to redirect_to(event_url(created))
expect(created.start_date.utc).to eq(Time.utc(2025, 6, 15, 19, 0, 0))
expect(created.end_date.utc).to eq(Time.utc(2025, 6, 15, 20, 0, 0))
end
Expand All @@ -129,8 +129,8 @@
public: true
} }

expect(response).to redirect_to(events_url)
created = Event.order(created_at: :desc).first
expect(response).to redirect_to(event_url(created))
expect(created.start_date.utc).to eq(Time.utc(2025, 6, 15, 19, 0, 0))
expect(created.end_date.utc).to eq(Time.utc(2025, 6, 15, 20, 0, 0))
end
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/organizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
}.to change(Organization, :count).by(1)
end

it "redirects to the organizations index" do
it "redirects to the created organization" do
post organizations_url, params: { organization: valid_attributes }
expect(response).to redirect_to(organizations_url)
expect(response).to redirect_to(organization_url(Organization.last))
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/stories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
post stories_url, params: { story: base_attributes }
}.to change(Story, :count).by(1)

expect(response).to redirect_to(stories_path)
expect(response).to redirect_to(story_url(Story.last))
end
end
end
Expand Down
Loading