Created
November 24, 2023 09:35
-
-
Save Zeko369/cfeafa51867ffb97db3a9a33d9f466af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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