-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rails nested url for reps resource, controller, view
- Loading branch information
Showing
4 changed files
with
30 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class RepsController < ApplicationController | ||
respond_to :json | ||
|
||
def index | ||
# sleep 5 | ||
# @reps = Rep.all | ||
sett = Sett.find(params[:sett_id]) | ||
@reps = sett.reps | ||
@exercises = Exercise.all | ||
end | ||
|
||
private | ||
|
||
def rep_params | ||
params.require(:rep).permit(:sett_id, :position) | ||
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,5 @@ | ||
attributes :id, :sett_id, :exercise_id, :resistance, :position | ||
|
||
node(:exercise_name)do |rep| | ||
@exercises.find(rep.exercise_id).name | ||
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 @@ | ||
collection @reps | ||
|
||
extends "reps/_base" |
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