Skip to content

Instantly share code, notes, and snippets.

~/Develop/Ruby/MovieApp$ heroku logs
2017-02-25T16:13:22.485380+00:00 heroku[run.7757]: Awaiting client
2017-02-25T16:13:22.529527+00:00 heroku[run.7757]: Starting process with command `bundle exec rake db:migrate`
2017-02-25T16:13:22.772470+00:00 heroku[run.7757]: State changed from starting to up
2017-02-25T16:13:28.637302+00:00 heroku[run.7757]: State changed from up to complete
2017-02-25T16:13:28.623429+00:00 heroku[run.7757]: Process exited with status 1
2017-02-25T16:14:11.109893+00:00 app[api]: Starting process with command `bundle exec rake db:seed` by user ohmywob@gmail.com
2017-02-25T16:14:13.263527+00:00 heroku[run.5242]: Awaiting client
2017-02-25T16:14:13.307443+00:00 heroku[run.5242]: Starting process with command `bundle exec rake db:seed`
2017-02-25T16:14:13.526698+00:00 heroku[run.5242]: State changed from starting to up
~/Develop/Ruby/MovieApp$ heroku logs
2017-02-26T07:55:26.624179+00:00 app[web.1]: from /app/config.ru:in `<main>'
2017-02-26T07:55:26.624180+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
2017-02-26T07:55:26.624182+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
2017-02-26T07:55:26.624183+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
2017-02-26T07:55:26.624183+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
2017-02-26T07:55:26.624184+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
2017-02-26T07:55:26.624186+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/commands/server.rb:59:in `app'
2017-02-26T07:55:26.624187+00:00 app[web.1]: from /app/vendor/bundle/ru
@Evanto
Evanto / create.html.erb
Last active April 4, 2017 19:45
SleepCalc
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel='stylesheet' href='./css/main.css' />
</head>
<body>
<!-- Header Section -->
<div class="header">
Cannot render console from 10.0.2.2! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by PagesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"WcMZRmt73Tx3iUBy/Ia2iKRKHeSxDlQfK+GQRZ01nM4oUa+eHbGfaDS5ZYe2XNkhZmLmdrVERWigDRcOqt+S8Q==", "page"=>{"hours"=>"12", "minutes"=>"12"}, "commit"=>"Submit"}
(1.3ms) begin transaction
SQL (4.0ms) INSERT INTO "pages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", 2017-04-05 17:06:38 UTC], ["updated_at", 2017-04-05 17:06:38 UTC]]
(2.1ms) commit transaction
Rendering pages/create.html.erb within layouts/application
Rendered pages/create.html.erb within layouts/application (4.5ms)
Completed 200 OK in 186ms (Views: 163.1ms | ActiveRecord: 7.4ms)
форма во вью:
<div class="col-md-12">
<%= form_for @page do |f| %>
<%= f.label :hours %>
<%= f.select :hours, options_for_select([['5 am'], ['6 am'], ['7 am'], ['8 am'],
['9 am'], ['10 am'], ['11 am'], ['12 noon'], ['13 pm'], ['14 pm'], ['15 pm'],
['16 pm'], ['17 pm'], ['18 pm'], ['19 pm'], ['20 pm'], ['21 pm'], ['22 pm'],
['23 pm'], ['12 midnight'], ['1 am'], ['2 am'], ['3 am'], ['4 am']]) %>
<%= f.select :hours, (1..24).to_a %>
@Evanto
Evanto / divmod
Last active April 12, 2017 19:13
<p><%#= t = min %></p>
<p><%#= hour, t = t.divmod(60) %></p>
<p><%#= "%02d:%02d" % [hour, t] # => "18:30" %></p>
<%= form_for(comment) do |f| %>
<% if comment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
<ul>
<% comment.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
<%= form_for(comment) do |f| %>
<% if comment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
<ul>
<% comment.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
<% @page = Page.last %>
<% t = @page.hours.to_i * 60 + @page.minutes.to_i %>
<% hour, t = t.divmod(60) %>
<%= "%02d:%02d" % [hour, t] %>
<%#= http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html %>
How to prevent input option from sending params?
1
<%= f.time_select :hours, {minute_step: 5, prompt: true, order: [:hour]} %>
<%#= default Hours:Minutes, sends value %>
2
<%= f.time_select :hours, {minute_step: 5, prompt: {hours: 'Choose hour', minutes: 'Choose minutes'}, order: [:hour]} %>
<%#= default 00:00 %>
8