forked from zinc-collective/convene
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Tobias
: Expose Trust#show
with link to Payout#new
#23
Open
zspencer
wants to merge
8
commits into
tobias/issuing-payouts
Choose a base branch
from
tobias/issuing-payouts-sprout-tobias-gizmo
base: tobias/issuing-payouts
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6ea09c0
✨ `Tobias`: Sprout `Tobias` Gizmo
zspencer 55affc0
✨ `Tobias`: Flesh out the pathway to `Trust#show`
chloeinnvaer d7af160
🧹 Manually overriding`#model_name` is a bit odd
zspencer d38b5fc
🧹 Eliminate inappropriate schema changes
zspencer c672ca8
🧹 Run the Linter
zspencer b7f902b
✨ `Tobias`: Add "New Payout" button to `Trust#show`
zspencer 5ec5a7b
🧹 `Tobias`: Move `TrustPolicy` to it's own file
zspencer 4660d76
🧹 Delete unnecessary alias
zspencer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
class Tobias | ||
class Tobias < Furniture | ||
has_many :trusts, inverse_of: :tobias | ||
default_scope { where(furniture_kind: "tobias") } | ||
location(parent: :room) | ||
end | ||
|
||
# TOBIAS is hard to pluralize... Rails presumed TOBIAS was plural... | ||
# So this tells Rails that TOBIAS is the singular form, and that TOBIASes | ||
# is the plural. | ||
ActiveSupport::Inflector.inflections(:en) do |inflect| | ||
inflect.plural(/^(tobias)$/i, '\1\2es') | ||
inflect.singular(/^(tobias)es/i, '\1') | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Tobias | ||
class Record < ApplicationRecord | ||
self.abstract_class = true | ||
extend StripsNamespaceFromModelName | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Tobias | ||
class Routes | ||
def self.append_routes(router) | ||
router.resources :tobiases, module: "tobias" do | ||
router.resources :trusts do | ||
router.resources :payouts | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Tobias | ||
class TrustPolicy < ApplicationPolicy | ||
def show? | ||
true | ||
end | ||
alias_method :entry, :object | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<h1>Trust <%= trust.id %></h1> | ||
|
||
<%= link_to("New Payout", trust.location(:new, child: :payout)) %> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Tobias | ||
class TrustsController < FurnitureController | ||
expose :trust, model: Trust | ||
|
||
def show | ||
authorize trust | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryBot.define do | ||
factory :tobias do | ||
room | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
require_relative "tobias_factory" | ||
|
||
FactoryBot.define do | ||
factory :tobias_trust, class: "Tobias::Trust" do | ||
tobias | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we call
router.resources
, we are connecting the URLpath
to the application./spaces/:space_id/rooms/:room_id
, nested under the "Section" the TOBIAS is in.So,
resources :tobiases
creates an entry point into our application at the/spaces/:space_id/rooms/:room_id/tobiases
path. When we nestresources
calls within ado...end
block, like we do withrouter.resources :trusts
this nests them within that path , a-la/spaces/:space_id/rooms/:room_id/tobiases/:tobias_id/trusts
What path do you think the line with
router.resources :payouts
creates?