-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Let's update draft:resource to use the new style for querying that we've been using in class: first put the Whatever::ActiveRecord_Relation in a variable called matching_whatevers, then proceed to do an .at(0) or .order to produce the instance variable.
def index
matching_whatevers = Whatever.all
@list_of_whatevers = matching_whatevers.order({ :created_at => :desc })
render({ :template => "whatever_templates/index.html.erb" })
enddef show # edit, update, destroy
the_id = params.fetch("path_id")
matching_whatevers = Whatever.where({ :id => the_id })
@the_whatever = matching_whatevers.at(0)
render({ :template => "whatever_templates/show.html.erb" })
endMetadata
Metadata
Assignees
Labels
No labels