Skip to content

Instantly share code, notes, and snippets.

@Zeko369
Created November 24, 2023 09:35
Show Gist options
  • Save Zeko369/cfeafa51867ffb97db3a9a33d9f466af to your computer and use it in GitHub Desktop.
Save Zeko369/cfeafa51867ffb97db3a9a33d9f466af to your computer and use it in GitHub Desktop.
<h2><%= request.fullpath %></h2>
<ul>
<% @topics.each do |topic| %>
<li>
<%= link_to topic.name, sandbox_path(topic_id: topic.id) %>
</li>
<% end %>
</ul>
<% if @topic.present? %>
<div class="tw-fixed tw-z-20 tw-top-20 tw-bg-orange-300">
<%= link_to "Close", sandbox_path %>
<h1><%= @topic.name %></h1>
<p><%= @topic.description %></p>
</div>
<% end %>
# frozen_string_literal: true
class SandboxController < LoggedOutController
before_action :load_topic, only: [:show]
def index
@topics = Topic.all
if params[:topic_id]
@topic = Topic.find(params[:topic_id])
end
end
def show
end
def load_topic
@topic = Topic.find(params[:id])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment