I am trying to identify a user ID number, to grab a Student row from an ActiveRecord table, but for some reason the 'post' block won't find my :id.
For the 'get', the url is localhost:9456/update/17. It's this 17 I need to pass to the 'post' block to update the database.
I am not sure how to do this. Parse the URL? It seems like I am missing something obvious.
# update user page
get '/update/:id' do
@student = Student.find(params[:id]) #this returns ID=17
erb :update
end
#update user submit
post '/update' do
@student = Student.find(params[:id]) #this line doesn't work
@student.name = (params[:name])
@student.email = (params[:email])
@student.save
redirect '/'
end
thanks!