설문조사 사례로 살펴보는 모델 관계에 따라 중첩하는 입력 폼
rails new surveyform
#encoding: utf-8 | |
require 'net/http' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'timeout' | |
TIMEOUT_CNT = 42 | |
def print_info code | |
retries = TIMEOUT_CNT |
#encoding: utf-8 | |
require 'net/http' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'timeout' | |
TIMEOUT_CNT = 42 | |
def print_header | |
puts 'no,name,address,contact,doctor' |
class Place | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
include Geocoder::Model::Mongoid | |
field :type | |
field :category | |
field :category_desc | |
field :name | |
field :description |
#encoding: utf-8 | |
require 'net/http' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'timeout' | |
require 'json' | |
TIMEOUT_CNT = 42 | |
def egen_print_pharm_info code |
name = [ | |
"상회", | |
"분당상가", | |
"백화점", | |
"NC백화점" | |
] | |
print "name = " | |
p name |
var OneThingBar=function() { | |
// 1thing.kr - Let's start with one thing. | |
var styl = document.createElement('style') | |
styl.innerHTML = "div#notification-banner { background: rgba(255, 51, 0, 1); border-radius: 0 0 6px 6px; color: rgba(255, 255, 255, 1); cursor: pointer; font-weight: bold; font-family: Open Sans; left: 0%; line-height: 25px; margin-left: 0px; position: fixed; text-align: center; top: 0; width: 100%; } div#notification-banner span { padding: 3px 10px; }" | |
document.body.appendChild(styl) | |
var banner = document.createElement("div") | |
banner.id = "notification-banner" | |
banner.onclick = (function () { return function() {this.style.display='none'} })() | |
banner.title="누르면 사라집니다.(click to hide)" | |
banner.innerHTML = '뭐라도 해야겠는데 그저 막막하신가요? 작은 것 하나를 <a href="http://1thing.kr/" target=_blank>시작</a>해봐요.' |
require 'minitest/autorun' | |
begin | |
require_relative 'hamming' | |
rescue LoadError => e | |
puts "\n\n#{e.backtrace.first} #{e.message}" | |
puts DATA.read | |
exit 1 | |
end | |
class HammingTest < Minitest::Test |
require 'FileUtils' | |
Dir["contents/**/*"].select{ |f| File.file? f }.map{ |f| FileUtils.move "#{f}", "images/#{File.basename f}.jpg" } |
<h1>Test</h1> | |
<%= form_tag { 'basic form tag' } %> | |
<%= form_tag('/posts') { 'form posts'} %> | |
<%= form_tag('/posts/1', method: :put) { 'form posts/1'} %> | |
<%= form_tag('/upload', multipart: true) { 'form upload' } %> | |
<%= form_tag('/posts') do -%> | |
<div><%= submit_tag 'Save' %></div> | |
<% end -%> | |
<%= form_tag('/posts', remote: true) { 'remote' } %> | |
<%= form_tag('http://far.away.com/form', authenticity_token: false) { 'token false' } %> |