diff --git a/.byebug_history b/.byebug_history new file mode 100644 index 00000000..926b2842 --- /dev/null +++ b/.byebug_history @@ -0,0 +1,256 @@ +c +@out_params +c +@out_params +c +v +env['simpler.controller'] +"#{env['simpler.controller'].class}##{env['simpler.action']}" +c +@out_params +c +handler +response +headers +status +c +params +c +@params +c +controller.params +c +controller.params +c +params +c +controller.params +c +controller.params +c +controller.params +c +controller.params +c +controller.params +controller +c +controller.headers +controller.params +c +controller.params +controller.params= +controller.params +c +@params +c +@request.env['simpler.controller.params'] +c +controller.request.env['simpler.controller.params'] +c +controller.request.env['simpler.action'] +controller.request +route.params +controller.route +controller +c +route +c +route.determ_params(env) +env +route +exit +@request.env['simpler.controller'] +@request.env['simpler.contoller.params'] +@request.env['simpler.contoller'] +self +@request.env['simpler.contoller'] +@request.env['simpler.action'] +env['simpler.action'] +{env['simpler.controller'] +#{env['simpler.controller'].class}##{env['simpler.action']}" +exit +@request +exit +env['simpler.action'] +env['simpler.router'] +env['simpler'] +@app.call(env) +env['router'] +env['simpler.router'] +env +exit +env['simpler.controller'] +env +exit +handler +exit +env['simpler.action'] +env['simpler.controller'] +env['simpler.controller'].class +env +env['simpler.controller'].class +#{env{'simpler.action'}} +"#{env['simpler.controller'].class}" +env['simpler.controller'].class +env +@app.call(env) +exit +handler.class +handler +exit +respone +response +header +headers +status +status, header, respone = @app.call(env) +all.status +all +exit +all +env +all +c +route_path +user_path +c +@params +route_path +exit +route_path +user_path +user_path.match?(route_path) +@path +exit +"/tests/1".match(/\/tests\/(\w+)\Z/) +"/tests/1".match?(/\/tests\/(\w+)\Z/) +"/tests/1".match?(/\/tests\/(\w+)/) +"/tests/1".match?(/\/tests\/(\w+)/Z) +/tests/1.match?(/\/tests\/(\w+)/) +"/tests/1".match?(/\/tests\/(\w+)/) +"/tests/1".match?("/\/tests\/(\w+)/") +"/tests/1".match? "/\/tests\/(\w+)/" +"/tests/1".match?('/\/tests\/(\w+)/') +route_path +"/tests/1".match?(route_path) +"/tests/1".match?("/\/tests\/(\w+)/") +user_path.match?(route_path) +route_path +user_path +c +route_path +user_path +@path +exit +Hash[keys.captures.zip(values.captures)] +Hash[*keys.captures.zip(values.captures)] +keys.captures.zip(values.captures) +values.captures +keys.captures +keys.captures.zip(values.captures) +keys.captures +keys +keys.names +@path +c +@path +exit +keys +values +route_path +user_path +user_path.match?(route_path) +@path +exit +values +keys +@path +c +@path +path +c +keys +values +c +keys +exit +route_path +@path +route_path +keys +route_path +c +route_path +values +route_path +c +@router +@router.route_for(env) +c +@routes.find { |route| route.match?(method, path) } +c +route +c +@routes.find { |route| route.match?(method, path) } +path +@routes +c +@router.route_for(env) +env +@router +route +c +@method == method && correct_path?(path) +c +@method == method && correct_path?(path) +correct_path?(path) +c +@path +path +correct_path?(path) +c +correct_path?(path) +exit +c +correct_path?(path) +@method == method +@method +c +@routes.find { |route| route.match?(method, path) } +c +route +c +@params +c +@path +c +@path +path +exit +@params +c +route +c +@path +path +c +@path +user_path +route_path +@params +c +exit +user_path +path +@params +params +c +@path +path +c +@path +path +exit +@path +path diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..19353b96 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.byebug_history +/app/app.log diff --git a/app/controllers/tests_controller.rb b/app/controllers/tests_controller.rb index 1526a689..67d529a0 100644 --- a/app/controllers/tests_controller.rb +++ b/app/controllers/tests_controller.rb @@ -1,11 +1,15 @@ -class TestsController < Simpler::Controller +# frozen_string_literal: true +class TestsController < Simpler::Controller def index - @time = Time.now + @tests = Test.all + # render plain: "ololo" + status 201 end - def create - + def show + @test = Test.find(id: @params[:id]) end + def create; end end diff --git a/app/models/test.rb b/app/models/test.rb index 86376668..db135e04 100644 --- a/app/models/test.rb +++ b/app/models/test.rb @@ -1,8 +1,9 @@ +# frozen_string_literal: true + # Simpler.application.db.create_table(:tests) do # primary_key :id # String :title, null: false # Integer :level, default: 0 # end class Test < Sequel::Model - end diff --git a/app/views/tests/index.html.erb b/app/views/tests/index.html.erb index 39fce580..673818d6 100644 --- a/app/views/tests/index.html.erb +++ b/app/views/tests/index.html.erb @@ -7,6 +7,11 @@
<%= @time %>
+