├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README.md ├── README.rdoc ├── Rakefile ├── app ├── assets │ ├── audios │ │ ├── chimes.wav │ │ └── desktop.ini │ ├── images │ │ ├── .keep │ │ ├── expensive.gif │ │ ├── fav-icon.png │ │ ├── favicon.ico │ │ ├── fish.jpg │ │ └── wings_logo.gif │ ├── javascripts │ │ ├── admin │ │ │ └── books.js.coffee │ │ ├── ajax.js.coffee │ │ ├── application.js │ │ ├── authors.js.coffee │ │ ├── books.js.coffee │ │ ├── extra.js.coffee │ │ ├── fan_comments.js.coffee │ │ ├── hello.js.coffee │ │ ├── members.js.coffee │ │ ├── reviews.js.coffee │ │ └── users.js.coffee │ ├── stylesheets │ │ ├── admin │ │ │ └── books.css.scss │ │ ├── ajax.css.scss │ │ ├── application.css │ │ ├── authors.css.scss │ │ ├── books.css.scss │ │ ├── extra.css.scss │ │ ├── fan_comments.css.scss │ │ ├── hello.css.scss │ │ ├── members.css.scss │ │ ├── reviews.css.scss │ │ ├── scaffolds.css.scss │ │ └── users.css.scss │ └── videos │ │ ├── child │ │ └── sample.mp4 │ │ └── sample_mpeg4.mp4 ├── controllers │ ├── admin │ │ └── books_controller.rb │ ├── ajax_controller.rb │ ├── application_controller.rb │ ├── authors_controller.rb │ ├── books_controller.rb │ ├── concerns │ │ ├── .keep │ │ └── form_auth.rb │ ├── ctrl_controller.rb │ ├── extra_controller.rb │ ├── fan_comments_controller.rb │ ├── hello_controller.rb │ ├── login_controller.rb │ ├── members_controller.rb │ ├── record_controller.rb │ ├── reviews_controller.rb │ ├── sample_controller.rb │ ├── users_controller.rb │ └── view_controller.rb ├── helpers │ ├── admin │ │ └── books_helper.rb │ ├── ajax_helper.rb │ ├── application_helper.rb │ ├── authors_helper.rb │ ├── books_helper.rb │ ├── extra_helper.rb │ ├── fan_comments_helper.rb │ ├── hello_helper.rb │ ├── members_helper.rb │ ├── reviews_helper.rb │ ├── users_helper.rb │ └── view_helper.rb ├── mailers │ ├── .keep │ ├── notice_mailer.rb │ └── test_mailto_interceptor.rb ├── models │ ├── .keep │ ├── TimeConstraint.rb │ ├── author.rb │ ├── book.rb │ ├── book_callbacks.rb │ ├── compare_validator.rb │ ├── concerns │ │ └── .keep │ ├── fan_comment.rb │ ├── isbn_validator.rb │ ├── member.rb │ ├── memo.rb │ ├── review.rb │ ├── search_keyword.rb │ └── user.rb └── views │ ├── ajax │ ├── _ajax_result.html.erb │ ├── _search_result.html.erb │ ├── index.html.erb │ ├── keywd.html.erb │ ├── result.js.erb │ ├── result.json.jbuilder │ ├── search.html.erb │ └── upanel.js.erb │ ├── authors │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ ├── books │ ├── _book.html.erb │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.atom.builder │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── index.xml.builder │ ├── index.xml.erb │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ ├── ctrl │ ├── cookie.html.erb │ ├── details_info.html.erb │ ├── download.csv.ruby │ ├── dummy.html.erb │ ├── index.html.erb │ ├── link.html.erb │ ├── pass.html.erb │ ├── req_head2.html.erb │ ├── session_show.html.erb │ ├── simple_info.html.erb │ ├── trans.html.erb │ ├── trans2.html.erb │ ├── updb.html.erb │ └── upload.html.erb │ ├── extra │ ├── _share.html.erb │ ├── f_cache.html.erb │ ├── model.html.erb │ ├── model2.html.erb │ ├── paging.html.erb │ ├── share1.html.erb │ ├── share2.html.erb │ └── trans.html.erb │ ├── fan_comments │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ ├── hello │ ├── helper.html.erb │ ├── list.html.erb │ ├── special.html.erb │ ├── test.html.erb │ └── view.html.erb │ ├── layouts │ ├── application.html.erb │ ├── books.html.erb │ ├── child.html.erb │ ├── layout.html.erb │ ├── mail.text.erb │ ├── product.html.erb │ └── sub.html.erb │ ├── login │ └── index.html.erb │ ├── members │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ ├── notice_mailer │ ├── sendmail_confirm.html.erb │ └── sendmail_confirm.text.erb │ ├── record │ ├── assoc_includes.html.erb │ ├── assoc_join.html.erb │ ├── assoc_join2.html.erb │ ├── assoc_join3.html.erb │ ├── belongs.html.erb │ ├── groupby.html.erb │ ├── groupby2.html.erb │ ├── has_and_belongs.html.erb │ ├── has_many_through.html.erb │ ├── hasmany.html.erb │ ├── hasone.html.erb │ ├── keywd.html.erb │ ├── keyword.html.erb │ └── select2.html.erb │ ├── reviews │ ├── _form.html.erb │ ├── _review.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ ├── shared │ └── record_not_found.html.erb │ ├── users │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ └── view │ ├── _separator.html.erb │ ├── adopt.html.erb │ ├── audio.html.erb │ ├── capture.html.erb │ ├── col_radio.html.erb │ ├── col_select.html.erb │ ├── col_select2.html.erb │ ├── conc.html.erb │ ├── content_tag.html.erb │ ├── current.html.erb │ ├── dat_select.html.erb │ ├── datetime.html.erb │ ├── discovery.html.erb │ ├── excerpt.html.erb │ ├── field.html.erb │ ├── fields.html.erb │ ├── form_for.html.erb │ ├── form_for2.html.erb │ ├── form_for3.html.erb │ ├── form_tag.html.erb │ ├── format.html.erb │ ├── group_select.html.erb │ ├── group_select2.html.erb │ ├── helper.html.erb │ ├── helper2.html.erb │ ├── helper3.html.erb │ ├── highlight.html.erb │ ├── html5.html.erb │ ├── image_tag.html.erb │ ├── keyword.html.erb │ ├── link.html.erb │ ├── linkif.html.erb │ ├── mailto.html.erb │ ├── multi.html.erb │ ├── nest.html.erb │ ├── number_to.html.erb │ ├── partial_basic.html.erb │ ├── partial_col.html.erb │ ├── partial_param.html.erb │ ├── partial_spacer.html.erb │ ├── path.html.erb │ ├── sanitize.html.erb │ ├── select.html.erb │ ├── select_tag.html.erb │ ├── select_tag2.html.erb │ ├── simple_format.html.erb │ ├── tag.html.erb │ ├── truncate.html.erb │ ├── urlfor.html.erb │ └── video.html.erb ├── bin ├── bundle ├── rails └── rake ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── backtrace_silencers.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── my_config.rb │ ├── secret_token.rb │ ├── session_store.rb │ ├── test_mail_config.rb │ └── wrap_parameters.rb ├── locales │ ├── de.yml │ ├── en.yml │ ├── ko.yml │ └── models │ │ └── book │ │ └── ja.yml ├── my_config.yml └── routes.rb ├── db ├── migrate │ ├── 20130913051910_create_books.rb │ ├── 20130914060842_create_users.rb │ ├── 20130914060904_create_authors.rb │ ├── 20130914060920_create_reviews.rb │ ├── 20130914060936_create_fan_comments.rb │ ├── 20130915061456_create_members.rb │ ├── 20131005063736_create_memos.rb │ └── 20140118053815_create_join_table_author_book.rb ├── schema.rb ├── seeds.rb └── structure.sql ├── doc └── app │ ├── Admin.html │ ├── Admin │ ├── BooksController.html │ └── BooksHelper.html │ ├── AjaxController.html │ ├── AjaxHelper.html │ ├── ApplicationController.html │ ├── ApplicationHelper.html │ ├── Author.html │ ├── AuthorsController.html │ ├── AuthorsHelper.html │ ├── Book.html │ ├── BookCallbacks.html │ ├── BooksController.html │ ├── BooksHelper.html │ ├── CompareValidator.html │ ├── CtrlController.html │ ├── ExtraController.html │ ├── ExtraHelper.html │ ├── FanComment.html │ ├── FanCommentsController.html │ ├── FanCommentsHelper.html │ ├── FormAuth.html │ ├── HelloController.html │ ├── HelloHelper.html │ ├── IsbnValidator.html │ ├── LoginController.html │ ├── Member.html │ ├── MembersController.html │ ├── MembersHelper.html │ ├── Memo.html │ ├── NoticeMailer.html │ ├── README_rdoc.html │ ├── RecordController.html │ ├── Review.html │ ├── ReviewsController.html │ ├── ReviewsHelper.html │ ├── SampleController.html │ ├── SearchKeyword.html │ ├── TestMailtoInterceptor.html │ ├── TimeConstraint.html │ ├── User.html │ ├── UsersController.html │ ├── UsersHelper.html │ ├── ViewController.html │ ├── ViewHelper.html │ ├── created.rid │ ├── css │ ├── fonts.css │ └── rdoc.css │ ├── fonts │ ├── Lato-Light.ttf │ ├── Lato-LightItalic.ttf │ ├── Lato-Regular.ttf │ ├── Lato-RegularItalic.ttf │ ├── SourceCodePro-Bold.ttf │ └── SourceCodePro-Regular.ttf │ ├── images │ ├── add.png │ ├── arrow_up.png │ ├── brick.png │ ├── brick_link.png │ ├── bug.png │ ├── bullet_black.png │ ├── bullet_toggle_minus.png │ ├── bullet_toggle_plus.png │ ├── date.png │ ├── delete.png │ ├── find.png │ ├── loadingAnimation.gif │ ├── macFFBgHack.png │ ├── package.png │ ├── page_green.png │ ├── page_white_text.png │ ├── page_white_width.png │ ├── plugin.png │ ├── ruby.png │ ├── tag_blue.png │ ├── tag_green.png │ ├── transparent.png │ ├── wrench.png │ ├── wrench_orange.png │ └── zoom.png │ ├── index.html │ ├── js │ ├── darkfish.js │ ├── jquery.js │ ├── navigation.js │ ├── navigation.js.gz │ ├── search.js │ ├── search_index.js │ ├── search_index.js.gz │ ├── searcher.js │ └── searcher.js.gz │ └── table_of_contents.html ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── assets │ ├── application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css │ ├── application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css.gz │ ├── application-89263912e8385765bd57cd2fa026dd0e.js │ ├── application-89263912e8385765bd57cd2fa026dd0e.js.gz │ ├── chimes-29587febd995cdd099fcb2a3a888f0d3.wav │ ├── desktop-3c57fbf7ddab44ab42ceb3c723e4c36e.ini │ ├── fav-icon-91e6ea59f2dd4774bccce741269d5c32.png │ ├── favicon-f25e19e103e8db47bb74fefd2dc2bdf1.ico │ └── manifest-aa873fb3633eb11c3c0c2dd1fb243c1e.json ├── favicon.ico ├── icons │ ├── Thumbs.db │ └── button.gif └── robots.txt ├── test ├── controllers │ ├── .keep │ ├── admin │ │ └── books_controller_test.rb │ ├── ajax_controller_test.rb │ ├── authors_controller_test.rb │ ├── books_controller_test.rb │ ├── extra_controller_test.rb │ ├── fan_comments_controller_test.rb │ ├── hello_controller_test.rb │ ├── members_controller_test.rb │ ├── reviews_controller_test.rb │ └── users_controller_test.rb ├── fixtures │ ├── .keep │ ├── authors.yml │ ├── authors_books.yml │ ├── books.yml │ ├── fan_comments.yml │ ├── members.yml │ ├── notice_mailer │ │ └── sendmail_confirm │ ├── reviews.yml │ └── users.yml ├── helpers │ ├── .keep │ ├── admin │ │ └── books_helper_test.rb │ ├── ajax_helper_test.rb │ ├── authors_helper_test.rb │ ├── books_helper_test.rb │ ├── extra_helper_test.rb │ ├── fan_comments_helper_test.rb │ ├── hello_helper_test.rb │ ├── members_helper_test.rb │ ├── reviews_helper_test.rb │ ├── users_helper_test.rb │ └── view_helper_test.rb ├── integration │ ├── .keep │ └── admin_login_test.rb ├── mailers │ ├── .keep │ └── notice_mailer_test.rb ├── models │ ├── .keep │ ├── author_test.rb │ ├── book_test.rb │ ├── fan_comment_test.rb │ ├── member_test.rb │ ├── memo_test.rb │ ├── review_test.rb │ └── user_test.rb └── test_helper.rb └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/*.log 16 | /tmp 17 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 4 | gem 'rails', '>=4.0.2' 5 | 6 | # Use sqlite3 as the database for Active Record 7 | gem 'sqlite3' 8 | #gem 'pg' 9 | 10 | gem 'will_paginate' 11 | 12 | # Use SCSS for stylesheets 13 | gem 'sass-rails', '~> 4.0.0' 14 | 15 | # Use Uglifier as compressor for JavaScript assets 16 | gem 'uglifier', '>= 1.3.0' 17 | 18 | # Use CoffeeScript for .js.coffee assets and views 19 | gem 'coffee-rails', '~> 4.0.0' 20 | 21 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 22 | # gem 'therubyracer', platforms: :ruby 23 | 24 | # Use jquery as the JavaScript library 25 | gem 'jquery-rails' 26 | 27 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 28 | gem 'turbolinks' 29 | 30 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 31 | gem 'jbuilder', '~> 1.2' 32 | 33 | group :doc do 34 | # bundle exec rake doc:rails generates the API under doc/api. 35 | gem 'sdoc', require: false 36 | end 37 | 38 | # Use ActiveModel has_secure_password 39 | # gem 'bcrypt-ruby', '~> 3.0.0' 40 | 41 | # Use unicorn as the app server 42 | # gem 'unicorn' 43 | 44 | # Use Capistrano for deployment 45 | # gem 'capistrano', group: :development 46 | 47 | # Use debugger 48 | # gem 'debugger', group: [:development, :test] 49 | 50 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 51 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # 퍼펙트 루비 온 레일즈 3 | 4 | ![퍼펙트 루비 온 레일즈 표지](http://image.yes24.com/momo/TopCate665/MidCate004/66435690.jpg) 5 | 6 | **출판사** 제이펍 7 | **원출판사** 기술평론사 8 | **원서명** Ruby on Rails 4 アプリケーションプログラミング(원서 ISBN: 9784774164106) 9 | **저자명** 야마다 요시히로 10 | **역자명** 윤인성 11 | **출판일** 2015년 11월 30일 12 | **페이지** 660쪽 13 | **ISBN** 979-11-85890-32-6 (93000) 14 | 15 | [### 도서 소개 페이지 바로 가기 ###](http://jpub.tistory.com/531) 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | == README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | 26 | 27 | Please feel free to use a different markup language if you do not plan to run 28 | rake doc:app. 29 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Railbook::Application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/audios/chimes.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/audios/chimes.wav -------------------------------------------------------------------------------- /app/assets/audios/desktop.ini: -------------------------------------------------------------------------------- 1 | [LocalizedFileNames] 2 | chimes.wav=@%windir%\system32\mmres.dll,-700 3 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/expensive.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/images/expensive.gif -------------------------------------------------------------------------------- /app/assets/images/fav-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/images/fav-icon.png -------------------------------------------------------------------------------- /app/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/images/favicon.ico -------------------------------------------------------------------------------- /app/assets/images/fish.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/images/fish.jpg -------------------------------------------------------------------------------- /app/assets/images/wings_logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/images/wings_logo.gif -------------------------------------------------------------------------------- /app/assets/javascripts/admin/books.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/ajax.js.coffee: -------------------------------------------------------------------------------- 1 | init = -> 2 | $('#ajax_form').on 'ajax:success', (e, data) -> 3 | $('#result').empty() 4 | $.each data, -> 5 | $('#result').append( 6 | $('
  • ').append( 7 | $('').attr('href', 'http://www.wings.msn.to/index.php/-/A-03/' + @isbn).append(@title) 8 | ) 9 | ) 10 | 11 | $(document).ajaxStart -> 12 | $('#progress').html '통신 중...' 13 | .ajaxComplete -> 14 | $('#progress').html '' 15 | 16 | $('#slide_search').on 'ajax:success', (e, data) -> 17 | $('#result').empty() 18 | $.each data.Slideshows.Slideshow, -> 19 | $('#result').append( 20 | $('
  • ').append( 21 | $('').attr('href', @URL).append("#{@Title}(#{@Description})") 22 | ) 23 | ) 24 | 25 | 26 | $(document).ready(init) 27 | $(document).on('page:change', init) 28 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /app/assets/javascripts/authors.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/books.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/extra.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/fan_comments.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/hello.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | 5 | #$ -> 6 | init = -> 7 | 8 | class Sample 9 | constructor: (@name) -> 10 | result = document.getElementById 'result' 11 | result.onclick = => 12 | alert "안녕하세요. #{@name} 님!" 13 | 14 | s = new Sample('윤인성') 15 | -------------------------------------------------------------------------------- /app/assets/javascripts/members.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/reviews.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/users.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/books.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Admin::Books controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/ajax.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the ajax controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /app/assets/stylesheets/authors.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the authors controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/books.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the books controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/extra.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the extra controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/fan_comments.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the fan_comments controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/hello.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the hello controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/members.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the members controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/reviews.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the reviews controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.css.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | font-family: verdana, arial, helvetica, sans-serif; 5 | font-size: 13px; 6 | line-height: 18px; 7 | } 8 | 9 | p, ol, ul, td { 10 | font-family: verdana, arial, helvetica, sans-serif; 11 | font-size: 13px; 12 | line-height: 18px; 13 | } 14 | 15 | pre { 16 | background-color: #eee; 17 | padding: 10px; 18 | font-size: 11px; 19 | } 20 | 21 | a { 22 | color: #000; 23 | &:visited { 24 | color: #666; 25 | } 26 | &:hover { 27 | color: #fff; 28 | background-color: #000; 29 | } 30 | } 31 | 32 | div { 33 | &.field, &.actions { 34 | margin-bottom: 10px; 35 | } 36 | } 37 | 38 | #notice { 39 | color: green; 40 | } 41 | 42 | .field_with_errors { 43 | padding: 2px; 44 | background-color: red; 45 | display: table; 46 | } 47 | 48 | #error_explanation { 49 | width: 450px; 50 | border: 2px solid red; 51 | padding: 7px; 52 | padding-bottom: 0; 53 | margin-bottom: 20px; 54 | background-color: #f0f0f0; 55 | h2 { 56 | text-align: left; 57 | font-weight: bold; 58 | padding: 5px 5px 5px 15px; 59 | font-size: 12px; 60 | margin: -7px; 61 | margin-bottom: 0px; 62 | background-color: #c00; 63 | color: #fff; 64 | } 65 | ul li { 66 | font-size: 12px; 67 | list-style: square; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/assets/stylesheets/users.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the users controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/videos/child/sample.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/videos/child/sample.mp4 -------------------------------------------------------------------------------- /app/assets/videos/sample_mpeg4.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/assets/videos/sample_mpeg4.mp4 -------------------------------------------------------------------------------- /app/controllers/admin/books_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::BooksController < ApplicationController 2 | end 3 | -------------------------------------------------------------------------------- /app/controllers/ajax_controller.rb: -------------------------------------------------------------------------------- 1 | require 'net/http' 2 | 3 | class AjaxController < ApplicationController 4 | 5 | def test 6 | end 7 | 8 | def upanel 9 | @time = Time.now.to_s 10 | end 11 | 12 | def search 13 | @books = Book.select(:publish).distinct 14 | end 15 | 16 | def result 17 | sleep(2) 18 | @books = Book.where(publish: params[:publish]) 19 | end 20 | 21 | def slideshow 22 | #api_key = 'xxxxxxxx' 23 | #secret = 'xxxxxxxx' 24 | api_key = 'qPIgzUDk' 25 | secret = 'T6o6e2YU' 26 | ts = Time.now.to_i 27 | h = Digest::SHA1.hexdigest(secret + ts.to_s) 28 | render text: "https://www.slideshare.net/api/2/search_slideshows?q=Rails&lang=ko&api_key=#{api_key}&hash=#{h}&ts=#{ts}" 29 | end 30 | 31 | def search_slide 32 | #api_key = 'xxxxxxxx' 33 | #secret = 'xxxxxxxx' 34 | api_key = 'qPIgzUDk' 35 | secret = 'T6o6e2YU' 36 | ts = Time.now.to_i 37 | h = Digest::SHA1.hexdigest(secret + ts.to_s) 38 | Net::HTTP.start('www.slideshare.net', 443, 39 | use_ssl: true, ca_file: 'tmp/cacert.pem') do |https| 40 | res = https.get("/api/2/search_slideshows?q=#{ERB::Util.url_encode(params[:keywd])}&lang=ko&api_key=#{api_key}&hash=#{h}&ts=#{ts}") 41 | render json: Hash.from_xml(res.body).to_json 42 | end 43 | end 44 | 45 | end 46 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | # before_action :check_logined 6 | # rescue_from ActiveRecord::RecordNotFound, with: :id_invalid 7 | # before_action :detect_locale 8 | # add_flash_types :info 9 | # skip_before_action :my_logging 10 | 11 | # def default_url_options(options = {}) 12 | # { locale: I18n.locale } 13 | # end 14 | 15 | private 16 | def check_logined 17 | if session[:usr] then 18 | begin 19 | @usr = User.find(session[:usr]) 20 | rescue ActiveRecord::RecordNotFound 21 | reset_session 22 | end 23 | end 24 | unless @usr 25 | flash[:referer] = request.fullpath 26 | redirect_to controller: :login, action: :index 27 | end 28 | end 29 | 30 | def id_invalid(e) 31 | render 'shared/record_not_found', status: 404 32 | end 33 | 34 | 35 | def detect_locale 36 | I18n.locale = request.headers['Accept-Language'].scan(/\A[a-z]{2}/).first 37 | # I18n.locale = params[:locale] 38 | I18n.locale = :ko 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /app/controllers/authors_controller.rb: -------------------------------------------------------------------------------- 1 | class AuthorsController < ApplicationController 2 | before_action :set_author, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /authors 5 | # GET /authors.json 6 | def index 7 | @authors = Author.all 8 | end 9 | 10 | # GET /authors/1 11 | # GET /authors/1.json 12 | def show 13 | end 14 | 15 | # GET /authors/new 16 | def new 17 | @author = Author.new 18 | end 19 | 20 | # GET /authors/1/edit 21 | def edit 22 | end 23 | 24 | # POST /authors 25 | # POST /authors.json 26 | def create 27 | @author = Author.new(author_params) 28 | 29 | respond_to do |format| 30 | if @author.save 31 | format.html { redirect_to @author, notice: 'Author was successfully created.' } 32 | format.json { render action: 'show', status: :created, location: @author } 33 | else 34 | format.html { render action: 'new' } 35 | format.json { render json: @author.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /authors/1 41 | # PATCH/PUT /authors/1.json 42 | def update 43 | respond_to do |format| 44 | if @author.update(author_params) 45 | format.html { redirect_to @author, notice: 'Author was successfully updated.' } 46 | format.json { head :no_content } 47 | else 48 | format.html { render action: 'edit' } 49 | format.json { render json: @author.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /authors/1 55 | # DELETE /authors/1.json 56 | def destroy 57 | @author.destroy 58 | respond_to do |format| 59 | format.html { redirect_to authors_url } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_author 67 | @author = Author.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def author_params 72 | params.require(:author).permit(:user_id, :name, :birth, :address, :ctype, :photo) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/concerns/form_auth.rb: -------------------------------------------------------------------------------- 1 | module FormAuth 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | before_filter :check_logined 6 | end 7 | 8 | private 9 | def check_logined 10 | if session[:usr] then 11 | begin 12 | @usr = User.find(session[:usr]) 13 | rescue ActiveRecord::RecordNotFound 14 | reset_session 15 | end 16 | end 17 | unless @usr 18 | flash[:referer] = request.fullpath 19 | redirect_to controller: :login, action: :index 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/controllers/extra_controller.rb: -------------------------------------------------------------------------------- 1 | class ExtraController < ApplicationController 2 | 3 | def sendmail 4 | user = User.find(6) 5 | @mail = NoticeMailer.sendmail_confirm(user).deliver 6 | render text: '메일이 정상적으로 전송되었습니다.' 7 | end 8 | 9 | def paging 10 | @books = Book.order('published DESC'). 11 | paginate(page: params[:page], per_page: 5) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/fan_comments_controller.rb: -------------------------------------------------------------------------------- 1 | class FanCommentsController < ApplicationController 2 | before_action :set_fan_comment, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /fan_comments 5 | # GET /fan_comments.json 6 | def index 7 | @fan_comments = FanComment.all 8 | end 9 | 10 | # GET /fan_comments/1 11 | # GET /fan_comments/1.json 12 | def show 13 | end 14 | 15 | # GET /fan_comments/new 16 | def new 17 | @fan_comment = FanComment.new 18 | end 19 | 20 | # GET /fan_comments/1/edit 21 | def edit 22 | end 23 | 24 | # POST /fan_comments 25 | # POST /fan_comments.json 26 | def create 27 | @fan_comment = FanComment.new(fan_comment_params) 28 | 29 | respond_to do |format| 30 | if @fan_comment.save 31 | format.html { redirect_to @fan_comment, notice: 'Fan comment was successfully created.' } 32 | format.json { render action: 'show', status: :created, location: @fan_comment } 33 | else 34 | format.html { render action: 'new' } 35 | format.json { render json: @fan_comment.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /fan_comments/1 41 | # PATCH/PUT /fan_comments/1.json 42 | def update 43 | respond_to do |format| 44 | if @fan_comment.update(fan_comment_params) 45 | format.html { redirect_to @fan_comment, notice: 'Fan comment was successfully updated.' } 46 | format.json { head :no_content } 47 | else 48 | format.html { render action: 'edit' } 49 | format.json { render json: @fan_comment.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /fan_comments/1 55 | # DELETE /fan_comments/1.json 56 | def destroy 57 | @fan_comment.destroy 58 | respond_to do |format| 59 | format.html { redirect_to fan_comments_url } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_fan_comment 67 | @fan_comment = FanComment.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def fan_comment_params 72 | params.require(:fan_comment).permit(:author_no, :name, :body, :deleted) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/controllers/hello_controller.rb: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | class HelloController < ApplicationController 4 | before_action :check_logined, only: :view 5 | skip_before_action :check_logined, only: :list 6 | 7 | def index 8 | render text: 'Hello World..!' 9 | end 10 | 11 | def view 12 | @msg = 'Hello World..!' 13 | # render 'hello/special' 14 | end 15 | 16 | def list 17 | @books = Book.all 18 | end 19 | 20 | def app_var 21 | render text: MY_APP['logo']['source'] 22 | end 23 | 24 | private 25 | def check_logined 26 | if session[:usr] then 27 | 28 | begin 29 | @usr = User.find(session[:usr]) 30 | 31 | rescue ActiveRecord::RecordNotFound 32 | reset_session 33 | end 34 | end 35 | 36 | unless @usr 37 | flash[:referer] = request.fullpath 38 | redirect_to controller: :login, action: :index 39 | end 40 | end 41 | 42 | end 43 | -------------------------------------------------------------------------------- /app/controllers/login_controller.rb: -------------------------------------------------------------------------------- 1 | class LoginController < ApplicationController 2 | skip_before_action :check_logined 3 | 4 | def auth 5 | usr = User.authenticate(params[:username], params[:password]) 6 | if usr then 7 | reset_session 8 | session[:usr] = usr.id 9 | redirect_to params[:referer] 10 | else 11 | flash.now[:referer] = params[:referer] 12 | @error = '사용자 이름/비밀번호가 틀렸습니다.' 13 | render 'index' 14 | end 15 | end 16 | 17 | def logout 18 | reset_session 19 | redirect_to '/' 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/members_controller.rb: -------------------------------------------------------------------------------- 1 | class MembersController < ApplicationController 2 | before_action :set_member, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /members 5 | # GET /members.json 6 | def index 7 | @members = Member.all 8 | end 9 | 10 | # GET /members/1 11 | # GET /members/1.json 12 | def show 13 | end 14 | 15 | # GET /members/new 16 | def new 17 | @member = Member.new 18 | end 19 | 20 | # GET /members/1/edit 21 | def edit 22 | end 23 | 24 | # POST /members 25 | # POST /members.json 26 | def create 27 | @member = Member.new(member_params) 28 | 29 | respond_to do |format| 30 | if @member.save 31 | format.html { redirect_to @member, notice: 'Member was successfully created.' } 32 | format.json { render action: 'show', status: :created, location: @member } 33 | else 34 | format.html { render action: 'new' } 35 | format.json { render json: @member.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /members/1 41 | # PATCH/PUT /members/1.json 42 | def update 43 | respond_to do |format| 44 | if @member.update(member_params) 45 | format.html { redirect_to @member, notice: 'Member was successfully updated.' } 46 | format.json { head :no_content } 47 | else 48 | format.html { render action: 'edit' } 49 | format.json { render json: @member.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | 53 | rescue ActiveRecord::StaleObjectError 54 | render text: '충돌 오류가 발생했습니다.' 55 | 56 | end 57 | 58 | # DELETE /members/1 59 | # DELETE /members/1.json 60 | def destroy 61 | @member.destroy 62 | respond_to do |format| 63 | format.html { redirect_to members_url } 64 | format.json { head :no_content } 65 | end 66 | end 67 | 68 | private 69 | # Use callbacks to share common setup or constraints between actions. 70 | def set_member 71 | @member = Member.find(params[:id]) 72 | end 73 | 74 | # Never trust parameters from the scary internet, only allow the white list through. 75 | def member_params 76 | params.require(:member).permit(:name, :email, :lock_version) 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /app/controllers/reviews_controller.rb: -------------------------------------------------------------------------------- 1 | class ReviewsController < ApplicationController 2 | before_action :set_review, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /reviews 5 | # GET /reviews.json 6 | def index 7 | @reviews = Review.all 8 | end 9 | 10 | # GET /reviews/1 11 | # GET /reviews/1.json 12 | def show 13 | end 14 | 15 | # GET /reviews/new 16 | def new 17 | @review = Review.new 18 | end 19 | 20 | # GET /reviews/1/edit 21 | def edit 22 | end 23 | 24 | # POST /reviews 25 | # POST /reviews.json 26 | def create 27 | @review = Review.new(review_params) 28 | 29 | respond_to do |format| 30 | if @review.save 31 | format.html { redirect_to @review, notice: 'Review was successfully created.' } 32 | format.json { render action: 'show', status: :created, location: @review } 33 | else 34 | format.html { render action: 'new' } 35 | format.json { render json: @review.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /reviews/1 41 | # PATCH/PUT /reviews/1.json 42 | def update 43 | respond_to do |format| 44 | if @review.update(review_params) 45 | format.html { redirect_to @review, notice: 'Review was successfully updated.' } 46 | format.json { head :no_content } 47 | else 48 | format.html { render action: 'edit' } 49 | format.json { render json: @review.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /reviews/1 55 | # DELETE /reviews/1.json 56 | def destroy 57 | @review.destroy 58 | respond_to do |format| 59 | format.html { redirect_to reviews_url } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_review 67 | @review = Review.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def review_params 72 | params.require(:review).permit(:book_id, :user_id, :body) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/controllers/sample_controller.rb: -------------------------------------------------------------------------------- 1 | class SampleController < ApplicationController 2 | include FormAuth 3 | def index 4 | render text: 'Hello World..!' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | before_action :set_user, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /users 5 | # GET /users.json 6 | def index 7 | @users = User.all 8 | end 9 | 10 | # GET /users/1 11 | # GET /users/1.json 12 | def show 13 | end 14 | 15 | # GET /users/new 16 | def new 17 | @user = User.new 18 | end 19 | 20 | # GET /users/1/edit 21 | def edit 22 | end 23 | 24 | # POST /users 25 | # POST /users.json 26 | def create 27 | @user = User.new(user_params) 28 | 29 | respond_to do |format| 30 | if @user.save 31 | format.html { redirect_to @user, notice: 'User was successfully created.' } 32 | format.json { render action: 'show', status: :created, location: @user } 33 | else 34 | format.html { render action: 'new' } 35 | format.json { render json: @user.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /users/1 41 | # PATCH/PUT /users/1.json 42 | def update 43 | respond_to do |format| 44 | if @user.update(user_params) 45 | format.html { redirect_to @user, notice: 'User was successfully updated.' } 46 | format.json { head :no_content } 47 | else 48 | format.html { render action: 'edit' } 49 | format.json { render json: @user.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /users/1 55 | # DELETE /users/1.json 56 | def destroy 57 | @user.destroy 58 | respond_to do |format| 59 | format.html { redirect_to users_url } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_user 67 | @user = User.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def user_params 72 | params.require(:user).permit(:username, :password, :email, :dm, :roles) 73 | # params.require(:user).permit(:username, :password, :email, :dm, :roles, :agreement) 74 | # params.require(:user).permit(:username, :password, :email, :email_confirmation, :dm, :roles, :agreement) 75 | 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /app/controllers/view_controller.rb: -------------------------------------------------------------------------------- 1 | class ViewController < ApplicationController 2 | 3 | def form_tag 4 | @book = Book.new 5 | end 6 | 7 | def form_for 8 | @book = Book.new 9 | # @book = Book.find(1) 10 | end 11 | 12 | def form_for2 13 | @book = Book.new 14 | end 15 | 16 | def form_for3 17 | @book = Book.find(1) 18 | end 19 | 20 | def field 21 | @book = Book.new 22 | end 23 | 24 | def html5 25 | @book = Book.new 26 | end 27 | 28 | def col_radio 29 | @book = Book.new(publish: '제이펍') 30 | @books = Book.select(:publish).distinct 31 | end 32 | 33 | def select 34 | @book = Book.new(publish: '제이펍') 35 | end 36 | 37 | def col_select 38 | @book = Book.new(publish: '제이펍') 39 | @books = Book.select(:publish).distinct 40 | end 41 | 42 | def col_select2 43 | @book = Book.new(publish: '제이펍') 44 | @books = Book.select('DISTINCT publish') 45 | end 46 | 47 | def group_select 48 | @review = Review.new 49 | @authors = Author.all 50 | end 51 | 52 | def group_select2 53 | @review = Review.new 54 | @authors = Author.all 55 | end 56 | 57 | def dat_select 58 | @book = Book.find(1) 59 | end 60 | 61 | def fields 62 | @user = User.find(1) 63 | end 64 | 65 | def conc 66 | @books = Book.all 67 | end 68 | 69 | # def default_url_options(options = {}) 70 | # { charset: 'utf-8' } 71 | # end 72 | 73 | def adopt 74 | render layout: 'sub' 75 | end 76 | 77 | def multi 78 | render layout: 'layout' 79 | end 80 | 81 | def nest 82 | @msg = '오늘도 좋은 날씨입니다.' 83 | render layout: 'child' 84 | end 85 | 86 | def partial_basic 87 | @book = Book.find(2) 88 | end 89 | 90 | def partial_param 91 | @book = Book.find(2) 92 | end 93 | 94 | def partial_col 95 | @books = Book.all 96 | end 97 | 98 | def partial_spacer 99 | @books = Book.all 100 | end 101 | end 102 | -------------------------------------------------------------------------------- /app/helpers/admin/books_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::BooksHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/ajax_helper.rb: -------------------------------------------------------------------------------- 1 | module AjaxHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/authors_helper.rb: -------------------------------------------------------------------------------- 1 | module AuthorsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/books_helper.rb: -------------------------------------------------------------------------------- 1 | module BooksHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/extra_helper.rb: -------------------------------------------------------------------------------- 1 | module ExtraHelper 2 | def books_cache_key 3 | "books-#{Book.count}-#{Book.maximum(:updated_at).to_i}" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/fan_comments_helper.rb: -------------------------------------------------------------------------------- 1 | module FanCommentsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/hello_helper.rb: -------------------------------------------------------------------------------- 1 | module HelloHelper 2 | # def format_datetime(datetime, type = :datetime) 3 | # return '' unless datetime 4 | 5 | # case type 6 | # when :datetime 7 | # format = '%Y년 %m월 %d일 %H:%M:%S' 8 | # when :date 9 | # format = '%Y년 %m월 %d일' 10 | # when :time 11 | # format = '%H:%M:%S' 12 | # end 13 | 14 | # datetime.strftime(format) 15 | #end 16 | end 17 | -------------------------------------------------------------------------------- /app/helpers/members_helper.rb: -------------------------------------------------------------------------------- 1 | module MembersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/reviews_helper.rb: -------------------------------------------------------------------------------- 1 | module ReviewsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/view_helper.rb: -------------------------------------------------------------------------------- 1 | module ViewHelper 2 | def format_datetime(datetime, type = :datetime) 3 | 4 | return '' unless datetime 5 | 6 | case type 7 | when :datetime 8 | format = '%Y년 %m월 %d일 %H:%M:%S' 9 | when :date 10 | format = '%Y년 %m월 %d일' 11 | when :time 12 | format = '%H:%M:%S' 13 | end 14 | datetime.strftime(format) 15 | end 16 | 17 | def list_tag(collection, prop) 18 | content_tag(:ul) do 19 | collection.each do |element| 20 | concat content_tag(:li, element.attributes[prop]) 21 | end 22 | end 23 | end 24 | 25 | def list_tag2(collection, prop) 26 | list = '') 33 | end 34 | 35 | def blockquote_tag(cite, citetext, options = {}, &block) 36 | options.merge! cite: cite 37 | quote_tag = content_tag(:blockquote, capture(&block), options) 38 | p_tag = content_tag(:p) do 39 | concat '출전: ' 40 | concat content_tag(:cite, citetext) 41 | end 42 | quote_tag.concat(p_tag) 43 | end 44 | 45 | def blockquote_tag2(cite, citetext, body = '', options = {}, &block) 46 | options.merge! cite: cite 47 | quote_tag = content_tag(:blockquote, 48 | block_given? ? capture(&block) : body, 49 | options) 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/mailers/.keep -------------------------------------------------------------------------------- /app/mailers/notice_mailer.rb: -------------------------------------------------------------------------------- 1 | class NoticeMailer < ActionMailer::Base 2 | # layout 'mail' 3 | 4 | default from: 'webmaster@wings.msn.to', 5 | cc: 'CQW15204@nifty.com' 6 | def sendmail_confirm(user) 7 | @user = user 8 | # attachments['seal.jpg'] = 9 | # File.read(Rails.root.join('tmp/data/seal.jpg')) 10 | # attachments.inline['wings.jpg'] = 11 | # File.read(Rails.root.join('tmp/data/wings.jpg')) 12 | mail(to: user.email, 13 | subject: '사용자 등록 감사드립니다!') 14 | 15 | # headers[:reply_to] = 'hoge@wings.msn.to' 16 | # headers({ reply_to: 'hoge@wings.msn.to', bcc: 'nami@wings.msn.to'}) 17 | 18 | # @user = user 19 | # mail(to: user.email, 20 | # subject: '사용자 등록 감사드립니다!') do |format| 21 | # format.text { render inline: 'HTML 대응 메일 클라이언트를 사용해주세요!' } 22 | # format.html 23 | # end 24 | 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /app/mailers/test_mailto_interceptor.rb: -------------------------------------------------------------------------------- 1 | class TestMailtoInterceptor 2 | def self.delivering_email(mail) 3 | mail.to = [ 'tester@wings.msn.to' ] 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/models/.keep -------------------------------------------------------------------------------- /app/models/TimeConstraint.rb: -------------------------------------------------------------------------------- 1 | class TimeConstraint 2 | def matches?(request) 3 | current = Time.now 4 | current.hour >= 9 && current.hour < 18 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/models/author.rb: -------------------------------------------------------------------------------- 1 | class Author < ActiveRecord::Base 2 | belongs_to :user 3 | has_and_belongs_to_many :books 4 | has_many :comments, -> { where(deleted: false) }, class_name: 'FanComment', 5 | foreign_key: 'author_no' 6 | 7 | has_many :memos, as: :memoable 8 | 9 | validate :file_invalid? 10 | 11 | def data=(data) 12 | self.ctype = data.content_type 13 | self.photo = data.read 14 | end 15 | 16 | private 17 | def file_invalid? 18 | ps = ['image/jpeg', 'image/gif', 'image/png'] 19 | errors.add(:photo, '는 이미지 파일이 아닙니다.') if !ps.include?(self.ctype) 20 | errors.add(:photo, '는 크기가 1MB를 넘습니다.') if self.photo.length > 1.megabyte 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/models/book.rb: -------------------------------------------------------------------------------- 1 | class Book < ActiveRecord::Base 2 | scope :gihyo, -> { where(publish: '제이펍') } 3 | scope :newer, -> { order(published: :desc) } 4 | scope :top10, -> { newer.limit(10) } 5 | scope :whats_new, ->(pub) { 6 | where(publish: pub).order(published: :desc).limit(5) 7 | } 8 | # default_scope { order(published: :asc) } 9 | 10 | has_many :reviews 11 | has_and_belongs_to_many :authors 12 | has_many :users, through: :reviews 13 | #has_many :memos, as: :memoable 14 | 15 | 16 | 17 | =begin 18 | validates :isbn, 19 | presence: true, 20 | uniqueness: true, 21 | # uniqueness: { allow_blank: true }, 22 | length: { is: 17 }, 23 | # length: { is: 17 , allow_blank: true }, 24 | format: { with: /\A[0-9]{3}-[0-9]{1}-[0-9]{3,5}-[0-9]{4}-[0-9X]{1}\z/ } 25 | # format: { with: /\A[0-9]{3}-[0-9]{1}-[0-9]{3,5}-[0-9]{4}-[0-9X]{1}\z/, allow_blank: true } 26 | # isbn: true 27 | # isbn: { allow_old: true } 28 | =end 29 | 30 | =begin 31 | validates :isbn, 32 | presence: { message: '는 필수입니다.'}, 33 | uniqueness: { allow_blank: true, 34 | message: '%{value}는 유일한 값이어야 합니다.' }, 35 | length: { is: 17 , allow_blank: true, 36 | message: '%{value}는 %{count}자리어야 합니다.' }, 37 | format: { with: /\A[0-9]{3}-[0-9]{1}-[0-9]{3,5}-[0-9]{4}-[0-9X]{1}\z/, 38 | allow_blank: true, message: '%{value}는 정확한 형식이 합니다.'} 39 | =end 40 | 41 | # validate :isbn_valid? 42 | 43 | =begin 44 | validates :title, 45 | presence: true, 46 | length: { minimum: 1, maximum: 100 } 47 | =end 48 | 49 | # validates :title, uniqueness: { scope: :publish } 50 | 51 | =begin 52 | validates :price, 53 | numericality: { only_integer: true, less_than: 10000 } 54 | 55 | validates :publish, 56 | inclusion:{ in: ['제이펍', '한빛미디어', '한빛아카데미', '인사이트', '길벗'] } 57 | =end 58 | 59 | 60 | # after_destroy :history_book 61 | # after_destroy :history_book, unless: Proc.new { |b| b.publish == "unknown" } 62 | # after_destroy BookCallbacks.new 63 | 64 | # after_destroy do |b| 65 | # logger.info('deleted: ' + b.inspect) 66 | # end 67 | 68 | private 69 | # def history_book 70 | # logger.info('deleted: ' + self.inspect) 71 | # end 72 | 73 | 74 | def isbn_valid? 75 | errors.add(:isbn, '는 정확한 형식이 아닙니다.') unless isbn =~ /\A[0-9]{3}-[0-9]{1}-[0-9]{3,5}-[0-9]{4}-[0-9X]{1}\z/ 76 | end 77 | 78 | end 79 | -------------------------------------------------------------------------------- /app/models/book_callbacks.rb: -------------------------------------------------------------------------------- 1 | class BookCallbacks 2 | cattr_accessor :logger 3 | self.logger ||= Rails.logger 4 | 5 | def after_destroy(b) 6 | logger.info('deleted: ' + b.inspect) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/models/compare_validator.rb: -------------------------------------------------------------------------------- 1 | class CompareValidator < ActiveModel::EachValidator 2 | def validate_each(record, attribute, value) 3 | cmp = record.attributes[options[:compare_to]].to_i 4 | case options[:type] 5 | when :greater_than 6 | record.errors.add(attribute, '는 지정된 항목보다 커야합니다.')unless value > cmp 7 | when :less_than 8 | record.errors.add(attribute, '는 지정된 항목보다 작아야합니다.')unless value < cmp 9 | when :equal 10 | record.errors.add(attribute, '는 지정된 항목과 같아야 합니다.')unless value == cmp 11 | else 12 | raise 'unknown type' 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/fan_comment.rb: -------------------------------------------------------------------------------- 1 | class FanComment < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/models/isbn_validator.rb: -------------------------------------------------------------------------------- 1 | class IsbnValidator < ActiveModel::EachValidator 2 | =begin 3 | def validate_each(record, attribute, value) 4 | record.errors.add(attribute, '는 올바른 형식이 아닙니다.') unless value =~ /\A([0-9]{3}-)?[0-9]{1}-[0-9]{3,5}-[0-9]{4}-[0-9X]{1}\z/ 5 | end 6 | =end 7 | 8 | def validate_each(record, attribute, value) 9 | if options[:allow_old] 10 | pattern = '\A([0-9]{3}-)?[0-9]{1}-[0-9]{3,5}-[0-9]{4}-[0-9X]{1}\z' 11 | else 12 | pattern = '\A[0-9]{3}-[0-9]{1}-[0-9]{3,5}-[0-9]{4}-[0-9X]{1}\z' 13 | end 14 | record.errors.add(attribute, '는 올바른 형식이 아닙니다.') unless value =~ /#{pattern}/ 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/models/member.rb: -------------------------------------------------------------------------------- 1 | class Member < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/models/memo.rb: -------------------------------------------------------------------------------- 1 | class Memo < ActiveRecord::Base 2 | belongs_to :memoable, polymorphic: true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/review.rb: -------------------------------------------------------------------------------- 1 | class Review < ActiveRecord::Base 2 | belongs_to :book 3 | # belongs_to :book, touch: true 4 | belongs_to :user 5 | # belongs_to :user, counter_cache: true 6 | # default_scope { order(updated_at: :desc) } 7 | end 8 | -------------------------------------------------------------------------------- /app/models/search_keyword.rb: -------------------------------------------------------------------------------- 1 | class SearchKeyword 2 | include ActiveModel::Model 3 | 4 | attr_accessor :keyword 5 | 6 | validates :keyword, presence: true 7 | end 8 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | has_one :author 3 | has_many :reviews 4 | has_many :books, through: :reviews 5 | 6 | # attr_protected :roles 7 | 8 | # validates :agreement, acceptance: true 9 | # validates :agreement, acceptance: { accept: 'yes' } 10 | # validates :agreement, acceptance:{ on: :create } 11 | # validates :email, confirmation: true 12 | # validates :email, presence: { unless: 'dm.blank?' } 13 | # validates :email, presence: { if: '!dm.blank?' } 14 | # validates :email, presence: { unless: :sendmail? } 15 | # validates :email, 16 | # presence: { unless: Proc.new { |u| u.dm.blank? } } 17 | # with_options unless: 'dm.blank?' do |dm| 18 | # dm.validates :email, presence: true 19 | # dm.validates :roles, presence: true 20 | # end 21 | 22 | def self.authenticate(username, password) 23 | usr = find_by(username: username) 24 | if usr != nil && 25 | usr.password == Digest::SHA1.hexdigest(usr.salt + password) then 26 | usr 27 | else 28 | return 29 | end 30 | end 31 | 32 | # def sendmail? 33 | # dm.blank? 34 | # end 35 | end 36 | -------------------------------------------------------------------------------- /app/views/ajax/_ajax_result.html.erb: -------------------------------------------------------------------------------- 1 | 현재 시간: <%= @time %> -------------------------------------------------------------------------------- /app/views/ajax/_search_result.html.erb: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /app/views/ajax/index.html.erb: -------------------------------------------------------------------------------- 1 |
    현재 시간: <%= Time.now %>
    2 |
    현재 시간: <%= Time.now %>
    3 | <%= link_to '업데이트', { action: :upanel }, remote: true %> 4 | -------------------------------------------------------------------------------- /app/views/ajax/keywd.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag({ action: :search_slide }, id: 'slide_search', remote: true) do %> 2 | <%= text_field_tag :keywd, '', size: 30 %> 3 | <%= submit_tag '검색' %> 4 | <% end %> 5 | 6 | -------------------------------------------------------------------------------- /app/views/ajax/result.js.erb: -------------------------------------------------------------------------------- 1 | $('#result').html( 2 | "<%= escape_javascript(render 'search_result') %>" 3 | ); 4 | -------------------------------------------------------------------------------- /app/views/ajax/result.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@books) do |book| 2 | json.extract! book, :isbn, :title 3 | end 4 | -------------------------------------------------------------------------------- /app/views/ajax/search.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag({ action: :result }, remote: true) do %> 2 | <%= select_tag(:publish, options_from_collection_for_select( 3 | @books, :publish, :publish, '제이펍')) %> 4 | <%= submit_tag '검색' %> 5 | 6 | <% end %> 7 | 8 | -------------------------------------------------------------------------------- /app/views/ajax/upanel.js.erb: -------------------------------------------------------------------------------- 1 | <% 2 | =begin 3 | %> 4 | $('#result').html( 5 | "<%= escape_javascript('현재 시간: ' + @time) %>" 6 | ); 7 | <% 8 | =end 9 | %> 10 | $('#result').html( 11 | "<%= escape_javascript(render 'ajax_result') %>" 12 | ); 13 | -------------------------------------------------------------------------------- /app/views/authors/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@author) do |f| %> 2 | <% if @author.errors.any? %> 3 |
    4 |

    <%= pluralize(@author.errors.count, "error") %> prohibited this author from being saved:

    5 | 6 | 11 |
    12 | <% end %> 13 | 14 |
    15 | <%= f.label :user %>
    16 | <%= f.text_field :user %> 17 |
    18 |
    19 | <%= f.label :name %>
    20 | <%= f.text_field :name %> 21 |
    22 |
    23 | <%= f.label :birth %>
    24 | <%= f.date_select :birth %> 25 |
    26 |
    27 | <%= f.label :address %>
    28 | <%= f.text_area :address %> 29 |
    30 |
    31 | <%= f.label :ctype %>
    32 | <%= f.text_field :ctype %> 33 |
    34 |
    35 | <%= f.label :photo %>
    36 | <%= f.text_field :photo %> 37 |
    38 |
    39 | <%= f.submit %> 40 |
    41 | <% end %> 42 | -------------------------------------------------------------------------------- /app/views/authors/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    Editing author

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @author %> | 6 | <%= link_to 'Back', authors_path %> 7 | -------------------------------------------------------------------------------- /app/views/authors/index.html.erb: -------------------------------------------------------------------------------- 1 |

    Listing authors

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <% @authors.each do |author| %> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | <% end %> 32 | 33 |
    UserNameBirthAddressCtypePhoto
    <%= author.user %><%= author.name %><%= author.birth %><%= author.address %><%= author.ctype %><%= author.photo %><%= link_to 'Show', author %><%= link_to 'Edit', edit_author_path(author) %><%= link_to 'Destroy', author, method: :delete, data: { confirm: 'Are you sure?' } %>
    34 | 35 |
    36 | 37 | <%= link_to 'New Author', new_author_path %> 38 | -------------------------------------------------------------------------------- /app/views/authors/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@authors) do |author| 2 | json.extract! author, :user_id, :name, :birth, :address, :ctype, :photo 3 | json.url author_url(author, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/authors/new.html.erb: -------------------------------------------------------------------------------- 1 |

    New author

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', authors_path %> 6 | -------------------------------------------------------------------------------- /app/views/authors/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= notice %>

    2 | 3 |

    4 | User: 5 | <%= @author.user %> 6 |

    7 | 8 |

    9 | Name: 10 | <%= @author.name %> 11 |

    12 | 13 |

    14 | Birth: 15 | <%= @author.birth %> 16 |

    17 | 18 |

    19 | Address: 20 | <%= @author.address %> 21 |

    22 | 23 |

    24 | Ctype: 25 | <%= @author.ctype %> 26 |

    27 | 28 |

    29 | Photo: 30 | <%= @author.photo %> 31 |

    32 | 33 | <%= link_to 'Edit', edit_author_path(@author) %> | 34 | <%= link_to 'Back', authors_path %> 35 | -------------------------------------------------------------------------------- /app/views/authors/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @author, :user_id, :name, :birth, :address, :ctype, :photo, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/books/_book.html.erb: -------------------------------------------------------------------------------- 1 |

    2 |
    3 | <%= @book.title %>
    4 | <%= @book.publish %>
    5 | 가격 <%= @book.price %>원
    6 | ISBN <%= @book.isbn %>
    7 | 출간일: <%= @book.published %> 8 |

    9 | 10 | 11 | <% 12 | =begin 13 | %> 14 |

    15 | <% type = :details if type.nil? %> 16 | <% if type == :details %> 17 |
    18 | <% end %> 19 | <%= book.title %>
    20 | <%= book.publish %>
    21 | 가격 <%= book.price %>원
    22 | ISBN <%= book.isbn %>
    23 | 출간일: <%= book.published %> 24 |

    25 | <% 26 | =end 27 | %> 28 | 29 | <% 30 | =begin 31 | %> 32 | <%# cache(book) do %> 33 | <% cache_if(book.published <= Date.today ,book) do %> 34 |
    35 | <%= book.title %>
    36 | <%= book.publish %>
    37 | 가격 <%= book.price %>원
    38 | ISBN <%= book.isbn %>
    39 | 출간일: <%= book.published %>
    40 | 리뷰: 41 | <% end %> 42 | <% 43 | =end 44 | %> 45 | -------------------------------------------------------------------------------- /app/views/books/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 | <% if @book.errors.any? %> 3 |
    4 |

    <%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:

    5 | 6 | 11 |
    12 | <% end %> 13 | 14 |
    15 | <%= f.label :isbn %>
    16 | <% 17 | =begin %> 18 | <%= f.label :isbn, 'ISBN 코드' %>
    19 | <% 20 | =end %> 21 | <%= f.text_field :isbn %> 22 |
    23 |
    24 | <%= f.label :title %>
    25 | <%= f.text_field :title %> 26 |
    27 |
    28 | <%= f.label :price %>
    29 | <%= f.number_field :price %> 30 |
    31 |
    32 | <%= f.label :publish %>
    33 | <%= f.text_field :publish %> 34 |
    35 |
    36 | <%= f.label :published %>
    37 | <%= f.date_select :published %> 38 |
    39 |
    40 | <%= f.label :cd %>
    41 | <%= f.check_box :cd %> 42 |
    43 |
    44 | <%= f.submit %> 45 | <% 46 | =begin %> 47 | <%= f.submit '저장', data: { confirm: '저장しても良いですか?', 48 | disable_with: '処理中...' } %> 49 | <% 50 | =end %> 51 |
    52 | <% end %> 53 | -------------------------------------------------------------------------------- /app/views/books/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    Editing book

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @book %> | 6 | <%= link_to 'Back', books_path %> 7 | -------------------------------------------------------------------------------- /app/views/books/index.atom.builder: -------------------------------------------------------------------------------- 1 | atom_feed do |feed| 2 | feed.title('최신 도서 정보') 3 | feed.updated(@books.last.created_at) 4 | 5 | @books.each do |book| 6 | feed.entry(book, 7 | url: "http://test.com/#{book.isbn}/", 8 | published: book.published, 9 | updated: book.published) do |entry| 10 | entry.title(book.title) 11 | entry.content("#{book.publish} #{book.price}원") 12 | entry.author do |author| 13 | author.name(book.authors[0].name) if book.authors[0] 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/views/books/index.html.erb: -------------------------------------------------------------------------------- 1 |

    Listing books

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <% @books.each do |book| %> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | <% end %> 32 | 33 |
    IsbnTitlePricePublishPublishedCd
    <%= book.isbn %><%= book.title %><%= book.price %><%= book.publish %><%= book.published %><%= book.cd %><%= link_to 'Show', book %><%= link_to 'Edit', edit_book_path(book) %><%= link_to 'Destroy', book, method: :delete, data: { confirm: 'Are you sure?' } %>
    34 | 35 |
    36 | 37 | <%= link_to 'New Book', new_book_path %> 38 | 39 | -------------------------------------------------------------------------------- /app/views/books/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@books) do |book| 2 | json.extract! book, :isbn, :title, :price, :publish, :published, :cd 3 | json.url book_url(book, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/books/index.xml.builder: -------------------------------------------------------------------------------- 1 | xml.books do 2 | @books.each do |b| 3 | xml.book(isbn: b.isbn) do 4 | xml.title(b.title) 5 | xml.price(b.price) 6 | xml.publish(b.publish) 7 | xml.published(b.published) 8 | xml.cd(b.cd) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/books/index.xml.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <% @books.each do |b| %> 4 | 5 | <%= b.title %> 6 | <%= b.price %> 7 | <%= b.publish %> 8 | <%= b.published %> 9 | <%= b.cd %> 10 | 11 | <% end %> 12 | 13 | -------------------------------------------------------------------------------- /app/views/books/new.html.erb: -------------------------------------------------------------------------------- 1 |

    New book

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', books_path %> 6 | -------------------------------------------------------------------------------- /app/views/books/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= notice %><%#= flash[:msg] %><%#= info %>

    2 | 3 |

    4 | Isbn: 5 | <%= @book.isbn %> 6 |

    7 | 8 |

    9 | Title: 10 | <%= @book.title %> 11 |

    12 | 13 |

    14 | Price: 15 | <%= @book.price %> 16 |

    17 | 18 |

    19 | Publish: 20 | <%= @book.publish %> 21 |

    22 | 23 |

    24 | Published: 25 | <%= @book.published %> 26 |

    27 | 28 |

    29 | Cd: 30 | <%= @book.cd %> 31 |

    32 | 33 | <%= link_to 'Edit', edit_book_path(@book) %> | 34 | <%= link_to 'Back', books_path %> 35 | -------------------------------------------------------------------------------- /app/views/books/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @book, :isbn, :title, :price, :publish, :published, :cd, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/ctrl/cookie.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag(action: :cookie_rec) do %> 2 | 4 | <%= submit_tag '저장' %> 5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/views/ctrl/details_info.html.erb: -------------------------------------------------------------------------------- 1 | dummy 2 | -------------------------------------------------------------------------------- /app/views/ctrl/download.csv.ruby: -------------------------------------------------------------------------------- 1 | result = '' 2 | result << @books.attribute_names.join(',') 3 | result << "\r" 4 | 5 | @books.each do |b| 6 | result << b.attributes.values.join(',') 7 | result << "\r" 8 | end 9 | 10 | result.encode('EUC-KR') 11 | -------------------------------------------------------------------------------- /app/views/ctrl/dummy.html.erb: -------------------------------------------------------------------------------- 1 | リダイレクトの테스트 2 | <%= link_to 'リダイレクト', { controller: :ctrl, action: :redirect } %>
    3 | -------------------------------------------------------------------------------- /app/views/ctrl/index.html.erb: -------------------------------------------------------------------------------- 1 | 액션 이름과 다른 템플릿 2 | -------------------------------------------------------------------------------- /app/views/ctrl/link.html.erb: -------------------------------------------------------------------------------- 1 | <%= link_to 'redirect 확인', action: :redirect %> 2 | -------------------------------------------------------------------------------- /app/views/ctrl/pass.html.erb: -------------------------------------------------------------------------------- 1 | <%= Digest::MD5::hexdigest(['arint', 'railbook', 12345].join(':')) %> 2 | -------------------------------------------------------------------------------- /app/views/ctrl/req_head2.html.erb: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /app/views/ctrl/session_show.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag(action: :session_rec) do %> 2 | <%= label_tag :email, '메일 주소' %>: 3 | <%= text_field_tag :email, @email, size: 50 %> 4 | <%= submit_tag '저장' %> 5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/views/ctrl/simple_info.html.erb: -------------------------------------------------------------------------------- 1 | dummy 2 | -------------------------------------------------------------------------------- /app/views/ctrl/trans.html.erb: -------------------------------------------------------------------------------- 1 | <%= t '.greeting' %> -------------------------------------------------------------------------------- /app/views/ctrl/trans2.html.erb: -------------------------------------------------------------------------------- 1 | <%= t 'general.greeting.morning' %>
    2 | -------------------------------------------------------------------------------- /app/views/ctrl/updb.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@author, url: { action: :updb_process, id: @author }, 2 | html:{ multipart: true }) do |f| %> 3 | <%= f.label :data, '저자 사진' %>: 4 | <%= f.file_field :data %> 5 | <%= f.submit '업로드' %> 6 | <% end %> 7 | -------------------------------------------------------------------------------- /app/views/ctrl/upload.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag({ action: :upload_process }, multipart: true) do %> 2 | 4 | <%= submit_tag '업로드' %> 5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/views/extra/_share.html.erb: -------------------------------------------------------------------------------- 1 | <% cache('GlobalTime') do %> 2 | 현재 시간(캐시 사용): <%= Time.now %>
    3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/extra/f_cache.html.erb: -------------------------------------------------------------------------------- 1 | 현재 시간(캐시 미사용): <%= Time.now %>
    2 | <% cache do %> 3 | <%# cache(suffix: 'footer') do %> 4 | 현재 시간(캐시 사용): <%= Time.now %>
    5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/views/extra/model.html.erb: -------------------------------------------------------------------------------- 1 |

    2 | <% @book = Book.find(1) %> 3 | <%= render @book %> 4 |

    5 | -------------------------------------------------------------------------------- /app/views/extra/model2.html.erb: -------------------------------------------------------------------------------- 1 | <% cache(books_cache_key) do %> 2 | <% Book.all.each do |book| %> 3 |

    4 | <%= render book %> 5 |

    6 | <% end %> 7 | <% end %> 8 | -------------------------------------------------------------------------------- /app/views/extra/paging.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <% @books.each do |book| %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | <% end %> 16 |
    ISBN 코드이름가격출판사출간일CD
    <%= (book.isbn) %><%= (book.title) %><%= (book.price) %><%= (book.publish) %><%= (book.published) %><%= (book.cd) %>
    17 | <%= will_paginate @books, 18 | previous_label: '<이전 페이지', next_label: '다음 페이지>' %> 19 | -------------------------------------------------------------------------------- /app/views/extra/share1.html.erb: -------------------------------------------------------------------------------- 1 | 현재 시간(캐시 미사용): <%= Time.now %>
    2 | <%= render 'share' %> 3 | -------------------------------------------------------------------------------- /app/views/extra/share2.html.erb: -------------------------------------------------------------------------------- 1 | 현재 시간(캐시 미사용): <%= Time.now %>
    2 | <%= render 'share' %> 3 | -------------------------------------------------------------------------------- /app/views/extra/trans.html.erb: -------------------------------------------------------------------------------- 1 | <%= t 'general.greeting.morning' %>
    2 | <%= t 'general.greeting.hello', name: 'arint' %>
    3 | 4 | <% 5 | =begin 6 | %> 7 | 8 | <%= l Time.now, format: :long %>
    9 | <%= number_to_currency(12345) %>
    10 | <%= t :morning, scope: 'general.greeting' %>
    11 | 12 | <%= t :morning, scope: [:general, :greeting] %>
    13 | <% k = [:general, :greeting] %> 14 | <%= t :morning, scope: k %>
    15 | 16 | <%= t 'general.greeting.night', default: 'Good Night' %>
    17 | 18 | <%= t :night, default: [:default, 'Hello'], 19 | scope: [:general, :greeting] %>
    20 | <%= t 'general.greeting.morning', locale: 'de' %>
    21 | 22 | <%= t 'result', count: 1 %>
    23 | <%= t 'result', count: 2 %>
    24 | 25 | <% 26 | =end 27 | %> 28 | -------------------------------------------------------------------------------- /app/views/fan_comments/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@fan_comment) do |f| %> 2 | <% if @fan_comment.errors.any? %> 3 |
    4 |

    <%= pluralize(@fan_comment.errors.count, "error") %> prohibited this fan_comment from being saved:

    5 | 6 | 11 |
    12 | <% end %> 13 | 14 |
    15 | <%= f.label :author_no %>
    16 | <%= f.number_field :author_no %> 17 |
    18 |
    19 | <%= f.label :name %>
    20 | <%= f.text_field :name %> 21 |
    22 |
    23 | <%= f.label :body %>
    24 | <%= f.text_area :body %> 25 |
    26 |
    27 | <%= f.label :deleted %>
    28 | <%= f.check_box :deleted %> 29 |
    30 |
    31 | <%= f.submit %> 32 |
    33 | <% end %> 34 | -------------------------------------------------------------------------------- /app/views/fan_comments/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    Editing fan_comment

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @fan_comment %> | 6 | <%= link_to 'Back', fan_comments_path %> 7 | -------------------------------------------------------------------------------- /app/views/fan_comments/index.html.erb: -------------------------------------------------------------------------------- 1 |

    Listing fan_comments

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <% @fan_comments.each do |fan_comment| %> 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | <% end %> 28 | 29 |
    Author noNameBodyDeleted
    <%= fan_comment.author_no %><%= fan_comment.name %><%= fan_comment.body %><%= fan_comment.deleted %><%= link_to 'Show', fan_comment %><%= link_to 'Edit', edit_fan_comment_path(fan_comment) %><%= link_to 'Destroy', fan_comment, method: :delete, data: { confirm: 'Are you sure?' } %>
    30 | 31 |
    32 | 33 | <%= link_to 'New Fan comment', new_fan_comment_path %> 34 | -------------------------------------------------------------------------------- /app/views/fan_comments/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@fan_comments) do |fan_comment| 2 | json.extract! fan_comment, :id, :author_no, :name, :body, :deleted 3 | json.url fan_comment_url(fan_comment, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/fan_comments/new.html.erb: -------------------------------------------------------------------------------- 1 |

    New fan_comment

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', fan_comments_path %> 6 | -------------------------------------------------------------------------------- /app/views/fan_comments/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= notice %>

    2 | 3 |

    4 | Author no: 5 | <%= @fan_comment.author_no %> 6 |

    7 | 8 |

    9 | Name: 10 | <%= @fan_comment.name %> 11 |

    12 | 13 |

    14 | Body: 15 | <%= @fan_comment.body %> 16 |

    17 | 18 |

    19 | Deleted: 20 | <%= @fan_comment.deleted %> 21 |

    22 | 23 | <%= link_to 'Edit', edit_fan_comment_path(@fan_comment) %> | 24 | <%= link_to 'Back', fan_comments_path %> 25 | -------------------------------------------------------------------------------- /app/views/fan_comments/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @fan_comment, :id, :author_no, :name, :body, :deleted, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/hello/helper.html.erb: -------------------------------------------------------------------------------- 1 | <% current = Time.now %> 2 | <%= format_datetime(current, :date) %> 3 | -------------------------------------------------------------------------------- /app/views/hello/list.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <% @books.each do |book| %> 8 | 9 | <% 10 | =begin 11 | %> 12 | 13 | <% 14 | =end 15 | %> 16 | 17 | 18 | 19 | <% 20 | =begin 21 | %> 22 | 24 | 26 | <% 27 | =end 28 | %> 29 | 30 | 31 | 32 | 33 | 34 | <% end %> 35 |
    ISBN 코드이름가격출판사출간일CD-ROM
    <%= book.isbn %><%= book.title %> 23 | <%= book.isbn %> 25 | <%= book.title %><%= book.price %>원<%= book.publish %><%= book.published %><%= book.cd %>
    36 | <% 37 | =begin 38 | %> 39 | <%= debug(@books) %> 40 | <%= @books.inspect %> 41 | <% 42 | =end 43 | %> 44 | -------------------------------------------------------------------------------- /app/views/hello/special.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | <%= @msg %> 3 |
    -------------------------------------------------------------------------------- /app/views/hello/test.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/views/hello/view.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | <%= @msg %> 3 |
    4 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Railbook 5 | 6 | <%#= auto_discovery_link_tag(:rss, 7 | { controller: :books, action: :index, id: :rails }, 8 | title: '서버사이드 배움터 WINGS' 9 | ) %> 10 | <%#= favicon_link_tag %> 11 | <%#= favicon_link_tag 'favicon.ico' %> 12 | <%#= favicon_link_tag 'fav-icon.png', type: 'image/png' %> 13 | 14 | <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> 15 | <%= javascript_include_tag "application", "data-turbolinks-track" => true %> 16 | <%= csrf_meta_tags %> 17 | 18 | 19 | 20 | <%= yield %> 21 | <%#= content_for?(:content) ? yield(:content) : yield %> 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/views/layouts/books.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Railbook 5 | <%#= favicon_link_tag %> 6 | <%#= favicon_link_tag 'favicon.ico' %> 7 | <%#= favicon_link_tag 'fav-icon.png', type: 'image/png' %> 8 | 9 | <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> 10 | <%= javascript_include_tag "application", "data-turbolinks-track" => true %> 11 | <%= csrf_meta_tags %> 12 | 13 | 14 | 15 | <%= yield %> 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/views/layouts/child.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :content do %> 2 | 3 |
    4 | <%= yield %> 5 |
    6 | Copyright 1998-2013, Yamada ,Yoshihiro 7 | <% end %> 8 | <%= render template: 'layouts/application' %> -------------------------------------------------------------------------------- /app/views/layouts/layout.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= @title ? @title : 'Rails 입문' %> 5 | <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> 6 | <%= javascript_include_tag "application", "data-turbolinks-track" => true %> 7 | <%= csrf_meta_tag %> 8 | 9 | 10 | <%= yield :extend_menu %> 11 |
    12 | ...그 이외의 컨텐츠... 13 |
    14 | <%= yield %> 15 | 16 | -------------------------------------------------------------------------------- /app/views/layouts/mail.text.erb: -------------------------------------------------------------------------------- 1 | WINGS로 부터의 공지사항입니다. 2 | 언제나 감사드립니다. 3 | 4 | <%= yield %> 5 | -------------------------------------------------------------------------------- /app/views/layouts/product.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Railbook 예제 5 | <% 6 | =begin 7 | %> 8 | <%= @title ? @title : 'Rails 입문' %> 9 | <% 10 | =end 11 | %> 12 | <%= stylesheet_link_tag :all %> 13 | <%= javascript_include_tag :defaults %> 14 | <%= csrf_meta_tag %> 15 | 16 | 17 | 18 | <%= yield %> 19 | 20 | <% 21 | =begin 22 | %> 23 | <%= content_for?(:content) ? yield(:content) : yield %>--> 24 | <% 25 | =end 26 | %> 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/views/layouts/sub.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 액션 단위의 레이아웃 5 | <%= stylesheet_link_tag "application" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/views/login/index.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= @error %>

    2 | <%= form_tag action: :auth do %> 3 |
    4 | <%= label_tag :username, '사용자 이름' %>
    5 | <%= text_field_tag :username, '', size: 20 %> 6 |
    7 |
    8 | <%= label_tag :password, '비밀번호' %>
    9 | <%= password_field_tag :password, '', size: 20 %> 10 |
    11 | <%= hidden_field_tag :referer, flash[:referer] %> 12 | <%= submit_tag '로그인' %> 13 | <% end %> -------------------------------------------------------------------------------- /app/views/members/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@member) do |f| %> 2 | <% if @member.errors.any? %> 3 |
    4 |

    <%= pluralize(@member.errors.count, "error") %> prohibited this member from being saved:

    5 | 6 | 11 |
    12 | <% end %> 13 | 14 |
    15 | <%= f.label :name %>
    16 | <%= f.text_field :name %> 17 |
    18 |
    19 | <%= f.label :email %>
    20 | <%= f.text_field :email %> 21 |
    22 | <%= f.hidden_field :lock_version %> 23 |
    24 | <%= f.submit %> 25 |
    26 | <% end %> 27 | -------------------------------------------------------------------------------- /app/views/members/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    Editing member

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @member %> | 6 | <%= link_to 'Back', members_path %> 7 | -------------------------------------------------------------------------------- /app/views/members/index.html.erb: -------------------------------------------------------------------------------- 1 |

    Listing members

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | <% @members.each do |member| %> 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | <% end %> 26 | 27 |
    NameEmailLock version
    <%= member.name %><%= member.email %><%= member.lock_version %><%= link_to 'Show', member %><%= link_to 'Edit', edit_member_path(member) %><%= link_to 'Destroy', member, method: :delete, data: { confirm: 'Are you sure?' } %>
    28 | 29 |
    30 | 31 | <%= link_to 'New Member', new_member_path %> 32 | -------------------------------------------------------------------------------- /app/views/members/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@members) do |member| 2 | json.extract! member, :name, :email, :lock_version 3 | json.url member_url(member, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/members/new.html.erb: -------------------------------------------------------------------------------- 1 |

    New member

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', members_path %> 6 | -------------------------------------------------------------------------------- /app/views/members/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= notice %>

    2 | 3 |

    4 | Name: 5 | <%= @member.name %> 6 |

    7 | 8 |

    9 | Email: 10 | <%= @member.email %> 11 |

    12 | 13 |

    14 | Lock version: 15 | <%= @member.lock_version %> 16 |

    17 | 18 | <%= link_to 'Edit', edit_member_path(@member) %> | 19 | <%= link_to 'Back', members_path %> 20 | -------------------------------------------------------------------------------- /app/views/members/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @member, :name, :email, :lock_version, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/notice_mailer/sendmail_confirm.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <%= @user.username %>님 8 |
    9 |

    10 | 사이트에 사용자 등록해주셔서 감사드립니다.
    11 | 다음은 등록해주신 정보입니다. 12 |

    13 | 14 | 19 | 20 |

    사이트 이용을 위해 <%= link_to '여기', { host: 'www.example.com', controller: :books, action: :index } %>에서 로그인해주세요.

    21 | 22 | <%#= url_for(host: 'www.example.com', controller: :books, 23 | action: :index, only_path: false) %> 24 | 25 |
    26 | <%= mail_to 'webmaster@wings.msn.to', '서버 사이드 기술 배움터' %> 27 | <%= image_tag 'http://www.wings.msn.to/image/wings.jpg', size: '53x17' %> 28 | <%#= image_tag attachments['wings.jpg'].url, size: '53x17' %> 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/views/notice_mailer/sendmail_confirm.text.erb: -------------------------------------------------------------------------------- 1 | <%= @user.username %>님 2 | 3 | 사이트에 사용자 등록해주셔서 감사드립니다. 4 | 다음은 등록해주신 정보입니다. 5 | 6 | 사용자 이름: <%= @user.username %> 7 | 비밀번호: (보안을 위해 보이지 않습니다.) 8 | 메일 주소: <%= @user.email %> 9 | 10 | 사이트 이용을 위해 다음 페이지에서 로그인해주세요. 11 | 12 | <%= url_for(host: 'www.example.com', controller: :books, 13 | action: :index) %> 14 | 15 | <%#= url_for(controller: :books, action: :index, 16 | only_path: false) %> 17 | 18 | 서버 사이드 기술 배움터(webmaster@wings.msn.to) -------------------------------------------------------------------------------- /app/views/record/assoc_includes.html.erb: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /app/views/record/assoc_join.html.erb: -------------------------------------------------------------------------------- 1 | <% @books.each do |b| %> 2 |

    <%= b.body %>(<%= b.title %>: <%= b.name %>)

    3 | <% end %> -------------------------------------------------------------------------------- /app/views/record/assoc_join2.html.erb: -------------------------------------------------------------------------------- 1 | <% @books.each do |b| %> 2 |

    <%= b.body %>(<%= b.title %>)by <%= b.username %>

    3 | <% end %> -------------------------------------------------------------------------------- /app/views/record/assoc_join3.html.erb: -------------------------------------------------------------------------------- 1 | <% @books.each do |b| %> 2 |

    <%= b.body %>(<%= b.title %>)

    3 | <% end %> -------------------------------------------------------------------------------- /app/views/record/belongs.html.erb: -------------------------------------------------------------------------------- 1 |

    "<%= @review.book.title %>"의 리뷰

    2 |
    3 |

    <%= @review.body %>(<%= @review.updated_at %>)

    -------------------------------------------------------------------------------- /app/views/record/groupby.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <% @books.each do |book| %> 6 | 7 | 8 | 9 | 10 | <% end %> 11 |
    출판사가격
    <%= book.publish %><%= book.avg_price %>원
    -------------------------------------------------------------------------------- /app/views/record/groupby2.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <% @books.each do |key, value| %> 6 | 7 | 8 | 9 | 10 | <% end %> 11 |
    출판사가격
    <%= key %><%= value %>원
    -------------------------------------------------------------------------------- /app/views/record/has_and_belongs.html.erb: -------------------------------------------------------------------------------- 1 |

    "<%= @book.title %>"의 저자 정보

    2 |
    3 | 8 | -------------------------------------------------------------------------------- /app/views/record/has_many_through.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/record/hasmany.html.erb: -------------------------------------------------------------------------------- 1 |

    "<%= @book.title %>"의 리뷰

    2 |
    3 | -------------------------------------------------------------------------------- /app/views/record/hasone.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/record/keywd.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for @search, url: { action: :keywd_process } do |f| %> 2 | <%= f.text_field :keyword, size: 25 %> 3 | <%= f.submit '검색' %> 4 | <% end %> 5 | -------------------------------------------------------------------------------- /app/views/record/keyword.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag action: :ph1 do %> 2 |
    3 | <%= label_tag :publish, '출판사: ' %>
    4 | <%= text_field_tag :publish %> 5 |
    6 |
    7 | <%= label_tag :price, '최저 가격: ' %>
    8 | <%= text_field_tag :price %> 9 |
    10 | <%= submit_tag '검색' %> 11 | <% end %> -------------------------------------------------------------------------------- /app/views/record/select2.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/reviews/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@review) do |f| %> 2 | <% if @review.errors.any? %> 3 |
    4 |

    <%= pluralize(@review.errors.count, "error") %> prohibited this review from being saved:

    5 | 6 | 11 |
    12 | <% end %> 13 | 14 |
    15 | <%= f.label :book %>
    16 | <%= f.text_field :book %> 17 |
    18 |
    19 | <%= f.label :user %>
    20 | <%= f.text_field :user %> 21 |
    22 |
    23 | <%= f.label :body %>
    24 | <%= f.text_area :body %> 25 |
    26 |
    27 | <%= f.submit %> 28 |
    29 | <% end %> 30 | -------------------------------------------------------------------------------- /app/views/reviews/_review.html.erb: -------------------------------------------------------------------------------- 1 | <% cache(review) do %> 2 |
  • <%= review.body %>(<%= review.updated_at %>)
  • 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/reviews/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    Editing review

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @review %> | 6 | <%= link_to 'Back', reviews_path %> 7 | -------------------------------------------------------------------------------- /app/views/reviews/index.html.erb: -------------------------------------------------------------------------------- 1 |

    Listing reviews

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | <% @reviews.each do |review| %> 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | <% end %> 26 | 27 |
    BookUserBody
    <%= review.book %><%= review.user %><%= review.body %><%= link_to 'Show', review %><%= link_to 'Edit', edit_review_path(review) %><%= link_to 'Destroy', review, method: :delete, data: { confirm: 'Are you sure?' } %>
    28 | 29 |
    30 | 31 | <%= link_to 'New Review', new_review_path %> 32 | -------------------------------------------------------------------------------- /app/views/reviews/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@reviews) do |review| 2 | json.extract! review, :book_id, :user_id, :body 3 | json.url review_url(review, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/reviews/new.html.erb: -------------------------------------------------------------------------------- 1 |

    New review

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', reviews_path %> 6 | -------------------------------------------------------------------------------- /app/views/reviews/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= notice %>

    2 | 3 |

    4 | Book: 5 | <%= @review.book %> 6 |

    7 | 8 |

    9 | User: 10 | <%= @review.user %> 11 |

    12 | 13 |

    14 | Body: 15 | <%= @review.body %> 16 |

    17 | 18 | <%= link_to 'Edit', edit_review_path(@review) %> | 19 | <%= link_to 'Back', reviews_path %> 20 | -------------------------------------------------------------------------------- /app/views/reviews/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @review, :book_id, :user_id, :body, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/shared/record_not_found.html.erb: -------------------------------------------------------------------------------- 1 |

    요청한 URL"<%= request.fullpath %>"은 존재하지 않습니다.

    -------------------------------------------------------------------------------- /app/views/users/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@user) do |f| %> 2 | <% if @user.errors.any? %> 3 |
    4 |

    <%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

    5 | 6 | 11 |
    12 | <% end %> 13 | 14 |
    15 | <%= f.label :username %>
    16 | <%= f.text_field :username %> 17 |
    18 |
    19 | <%= f.label :password %>
    20 | <%= f.text_field :password %> 21 |
    22 |
    23 | <%= f.label :email %>
    24 | <%= f.text_field :email %> 25 |
    26 | 32 |
    33 | <%= f.label :dm %>
    34 | <%= f.check_box :dm %> 35 |
    36 |
    37 | <%= f.label :roles %>
    38 | <%= f.text_field :roles %> 39 |
    40 | 47 |
    48 | <%= f.submit %> 49 |
    50 | <% end %> 51 | -------------------------------------------------------------------------------- /app/views/users/edit.html.erb: -------------------------------------------------------------------------------- 1 |

    Editing user

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @user %> | 6 | <%= link_to 'Back', users_path %> 7 | -------------------------------------------------------------------------------- /app/views/users/index.html.erb: -------------------------------------------------------------------------------- 1 |

    Listing users

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | <% @users.each do |user| %> 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | <% end %> 30 | 31 |
    UsernamePasswordEmailDmRoles
    <%= user.username %><%= user.password %><%= user.email %><%= user.dm %><%= user.roles %><%= link_to 'Show', user %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
    32 | 33 |
    34 | 35 | <%= link_to 'New User', new_user_path %> 36 | -------------------------------------------------------------------------------- /app/views/users/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@users) do |user| 2 | json.extract! user, :username, :password, :email, :dm, :roles 3 | json.url user_url(user, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/users/new.html.erb: -------------------------------------------------------------------------------- 1 |

    New user

    2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', users_path %> 6 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= notice %>

    2 | 3 |

    4 | Username: 5 | <%= @user.username %> 6 |

    7 | 8 |

    9 | Password: 10 | <%= @user.password %> 11 |

    12 | 13 |

    14 | Email: 15 | <%= @user.email %> 16 |

    17 | 18 |

    19 | Dm: 20 | <%= @user.dm %> 21 |

    22 | 23 |

    24 | Roles: 25 | <%= @user.roles %> 26 |

    27 | 28 | <%= link_to 'Edit', edit_user_path(@user) %> | 29 | <%= link_to 'Back', users_path %> 30 | -------------------------------------------------------------------------------- /app/views/users/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @user, :username, :password, :email, :dm, :roles, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/view/_separator.html.erb: -------------------------------------------------------------------------------- 1 |
    -------------------------------------------------------------------------------- /app/views/view/adopt.html.erb: -------------------------------------------------------------------------------- 1 | 액션 단위의 레이아웃 설정 2 | -------------------------------------------------------------------------------- /app/views/view/audio.html.erb: -------------------------------------------------------------------------------- 1 | <%= audio_tag 'chimes.wav', autoplay: false, controls: true %> 2 | -------------------------------------------------------------------------------- /app/views/view/capture.html.erb: -------------------------------------------------------------------------------- 1 | <% @current = capture do %> 2 | 현재 시각은 <%= Time.now %>입니다. 3 | <% end %> 4 | 5 | <%= @current %> 6 |
    <%= @current %>
    7 | -------------------------------------------------------------------------------- /app/views/view/col_radio.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 | <%= f.collection_check_boxes(:publish, @books, :publish, :publish) %>
    3 | <%= f.collection_radio_buttons(:publish, @books, :publish, :publish) %> 4 | <% end %> 5 | -------------------------------------------------------------------------------- /app/views/view/col_select.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 | <%= f.collection_select :publish, @books, :publish, :publish %> 3 | <% end %> -------------------------------------------------------------------------------- /app/views/view/col_select2.html.erb: -------------------------------------------------------------------------------- 1 | <%= select_tag 'publish', options_from_collection_for_select(@books, :publish, :publish, '제이펍') %> 2 | -------------------------------------------------------------------------------- /app/views/view/conc.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <% @books.each do |book| %> 8 | 9 | 10 | 11 | 16 | <% 17 | =begin 18 | %> 19 | 24 | <% 25 | =end 26 | %> 27 | 28 | 29 | 30 | 31 | <% end %> 32 |
    ISBN 코드이름가격출판사출간일CD-ROM
    <%= book.isbn %><%= book.title %><%= book.price %>원 12 | <% if book.price >= 30000 13 | concat image_tag 'expensive.gif' 14 | end %> 15 | <%= book.price %>원 20 | <% if book.price >= 3000 %> 21 | <%= image_tag 'expensive.gif' %> 22 | <% end %> 23 | <%= book.publish %><%= book.published %><%= book.cd %>
    -------------------------------------------------------------------------------- /app/views/view/content_tag.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag :p, '오늘도 좋은 날씨', id: :exam, class: :body %> 2 | 3 | <%= content_tag :p, id: :exam, class: :body do %> 4 | 오늘도 좋은 날씨 5 | <% end %> 6 | 7 | <%= content_tag :strong, content_tag(:p, '오늘도 좋은 날씨'), id: :result %> 8 | -------------------------------------------------------------------------------- /app/views/view/current.html.erb: -------------------------------------------------------------------------------- 1 | <%= link_to_unless_current '목록 화면', action: :current %>| 2 | <%= link_to_unless_current '상세 화면', action: :detail %> 3 | -------------------------------------------------------------------------------- /app/views/view/dat_select.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 | <%= f.date_select :published, use_month_numbers: true %> 3 | <% end %> -------------------------------------------------------------------------------- /app/views/view/datetime.html.erb: -------------------------------------------------------------------------------- 1 | <% @current = Time.now %> 2 | <%= @current.strftime('%Y년 %m월 %d일 %H:%M:%S') %> 3 | -------------------------------------------------------------------------------- /app/views/view/discovery.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/view/excerpt.html.erb: -------------------------------------------------------------------------------- 1 | <% msg = 'Rails는 Ruby로 만들어진 프레임워크입니다. Rails에 영향을 받은 프레임워크에는 Catalyst와 symfony 등이 있습니다.' %> 2 | 3 | <%= excerpt(msg, 'Catalyst', radius: 10) %>
    4 | 5 | <%= excerpt(msg, 'Rails', radius: 10) %>
    6 | 7 | <%= excerpt(msg, 'Catalyst', radius: 10, omission: '~' ) %> -------------------------------------------------------------------------------- /app/views/view/field.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 | 텍스트 박스: 3 | <%= f.text_field :isbn, size: 20, maxlength: 25, readonly: true %>
    4 | 비밀번호 박스: 5 | <%= f.password_field :isbn, size: 10, maxlength: 15, disabled: true %>
    6 | 텍스트에리어:
    7 | <%= f.text_area :isbn, cols: 40, rows: 10 %>
    8 | 라디오 버튼: 9 | 10 | 11 |
    12 | 체크 박스: 13 |
    14 | 파일 입력 박스: 15 | <%= f.file_field :isbn, size: 10, maxlength: 15 %>
    16 | hidden 필드: 17 | <%= f.hidden_field :isbn %>
    18 | <% end %> -------------------------------------------------------------------------------- /app/views/view/fields.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@user, url: { action: :create }) do |f| %> 2 |
    3 | <%= f.label :username, '사용자 이름' %>
    4 | <%= f.text_field :username %> 5 |
    6 |
    7 | <%= f.label :email, '메일 주소: ' %>
    8 | <%= f.text_field :email %> 9 |
    10 | <%= field_set_tag '저자 정보' do %> 11 | <%= fields_for @user.author do |af| %> 12 |
    13 | <%= af.label :name, '저자 이름: ' %>
    14 | <%= af.text_field :name %> 15 |
    16 |
    17 | <%= af.label :birth, '생일: ' %>
    18 | <%= af.text_field :birth %> 19 |
    20 | <% end %> 21 | <% end %>
    22 | <%= f.submit '등록' %> 23 | <% end %> -------------------------------------------------------------------------------- /app/views/view/form_for.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 |
    3 | <%= f.label :isbn %>
    4 | <%= f.text_field :isbn, size: 25 %> 5 |
    6 |
    7 | <%= f.label :title %>
    8 | <%= f.text_field :title, size: 25 %> 9 |
    10 |
    11 | <%= f.label :price %>
    12 | <%= f.text_field :price, size: 25 %> 13 |
    14 |
    15 | <%= f.label :publish %>
    16 | <%= f.text_field :publish, size: 25 %> 17 |
    18 |
    19 | <%= f.label :published %>
    20 | <%= f.text_field :published, size: 25 %> 21 |
    22 |
    23 | <%= f.label :cd %>
    24 | <%= f.text_field :cd, size: 25 %> 25 |
    26 |
    27 | <%= f.submit %> 28 |
    29 | <% end %> -------------------------------------------------------------------------------- /app/views/view/form_for2.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book, url: books_path, 2 | html: { id: :new_book, class: :new_book }) do |f| %> 3 |
    4 | <%= f.label :isbn %>
    5 | <%= f.text_field :isbn, size: 25 %> 6 |
    7 |
    8 | <%= f.label :title %>
    9 | <%= f.text_field :title, size: 25 %> 10 |
    11 |
    12 | <%= f.label :price %>
    13 | <%= f.text_field :price, size: 25 %> 14 |
    15 |
    16 | <%= f.label :publish %>
    17 | <%= f.text_field :publish, size: 25 %> 18 |
    19 |
    20 | <%= f.label :published %>
    21 | <%= f.text_field :published, size: 25 %> 22 |
    23 |
    24 | <%= f.label :cd %>
    25 | <%= f.text_field :cd, size: 25 %> 26 |
    27 |
    28 | <%= f.submit %> 29 |
    30 | <% end %> 31 | -------------------------------------------------------------------------------- /app/views/view/form_for3.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book, url: book_path(@book), 2 | html: { id: :edit_book, class: :edit_book_1, 3 | method: :patch }) do |f| %> 4 |
    5 | <%= f.label :isbn %>
    6 | <%= f.text_field :isbn, size: 25 %> 7 |
    8 |
    9 | <%= f.label :title %>
    10 | <%= f.text_field :title, size: 25 %> 11 |
    12 |
    13 | <%= f.label :price %>
    14 | <%= f.text_field :price, size: 25 %> 15 |
    16 |
    17 | <%= f.label :publish %>
    18 | <%= f.text_field :publish, size: 25 %> 19 |
    20 |
    21 | <%= f.label :published %>
    22 | <%= f.text_field :published, size: 25 %> 23 |
    24 |
    25 | <%= f.label :cd %>
    26 | <%= f.text_field :cd, size: 25 %> 27 |
    28 |
    29 | <%= f.submit %> 30 |
    31 | <% end %> 32 | -------------------------------------------------------------------------------- /app/views/view/form_tag.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag(action: :create) do %> 2 |
    3 | <%= label :book, :isbn %>
    4 | <%= text_field :book, :isbn, size: 25 %> 5 |
    6 |
    7 | <%= label :book, :title %>
    8 | <%= text_field :book, :title, size: 25 %> 9 |
    10 |
    11 | <%= label :book, :price %>
    12 | <%= text_field :book, :price, size: 25 %> 13 |
    14 |
    15 | <%= label :book, :publish %>
    16 | <%= text_field :book, :publish, size: 25 %> 17 |
    18 |
    19 | <%= label :book, :published %>
    20 | <%= text_field :book, :published, size: 25 %> 21 |
    22 |
    23 | <%= label :book, :cd %>
    24 | <%= text_field :book, :cd, size: 25 %> 25 |
    26 |
    27 | <%= submit_tag '등록' %> 28 |
    29 | <% end %> 30 | -------------------------------------------------------------------------------- /app/views/view/format.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | @name = 'WINGS 프로젝트 주식회사' 3 | @sum = 87512.35 4 | @shop = 52 5 | %> 6 | <%= sprintf('%.10s: 전체 점포 수 %d개의 월 매출 %.1f만 원, 각 점포의 평균 매출은 %10.3f만 원입니다.', @name, @shop, @sum, @sum / @shop) %> 7 | -------------------------------------------------------------------------------- /app/views/view/group_select.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@review) do |f| %> 2 | 리뷰 대상 도서ㅏ: 3 | <%= f.grouped_collection_select :book_id, @authors, :books, :name, :id, :title %> 4 | 5 | <% end %> -------------------------------------------------------------------------------- /app/views/view/group_select2.html.erb: -------------------------------------------------------------------------------- 1 | <%= select_tag 'book', 2 | option_groups_from_collection_for_select( 3 | @authors, :books, :name, :id, :title, '1') %> -------------------------------------------------------------------------------- /app/views/view/helper.html.erb: -------------------------------------------------------------------------------- 1 | <% current = Time.now %> 2 | <%= format_datetime(current, :date) %>
    3 | <%#= format_datetime(current, :datetime) %>
    4 | <%#= format_datetime(current, :time) %> -------------------------------------------------------------------------------- /app/views/view/helper2.html.erb: -------------------------------------------------------------------------------- 1 | <% @books = Book.all %> 2 | <%= list_tag @books, 'title' %> 3 | <%#= list_tag2 @books, 'title' %> -------------------------------------------------------------------------------- /app/views/view/helper3.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= blockquote_tag('http://www.wings.msn.to', 'サーバサイド技術の学び舎', 3 | class: 'quote') do %> 4 | WINGSプロジェクトは、当初、ライター윤인성のサポート(検証・査読・校正作業)集団という位置づけで開始されたコミュニティでしたが、2002年12월にメンバを大幅に増強し、本格的な執筆者プロジェクトとして生まれ変わりました。
    5 | <%= image_tag 'http://www.wings.msn.to/image/wings.jpg' %> 6 | <% end %> 7 | 8 | <% 9 | =begin 10 | %> 11 | <%= blockquote_tag2('http://www.wings.msn.to', 'サーバサイド技術の学び舎', 12 | 'WINGSプロジェクトは、本格的な執筆者プロジェクトとして生まれ変わりました。', 13 | class: 'quote') %> 14 | 15 | <%= image_tag 'http://www.wings.msn.to/image/wings.jpg' %> 16 | <% 17 | =end 18 | %> -------------------------------------------------------------------------------- /app/views/view/highlight.html.erb: -------------------------------------------------------------------------------- 1 | <% msg = 'Rails는 Ruby로 만들어진 프레임워크입니다. Rails에 영향을 받은 프레임워크에는 Catalyst와 symfony 등이 있습니다.' %> 2 | 3 | <%= highlight(msg, 'Rails') %>
    4 | 5 | <%= highlight(msg, ['Rails', '프레임워크'], 6 | highlighter: '\1') %> 7 | -------------------------------------------------------------------------------- /app/views/view/html5.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 | 색 선택 박스: 3 | <%= f.color_field :isbn %>
    4 | 날짜 입력 박스: 5 | <%= f.date_field :published %>
    6 | 시간 입력 박스: 7 | <%= f.time_field :published %>
    8 | 날짜 시간 입력 박스: 9 | <%= f.datetime_field :published %>
    10 | 날짜 시간 입력 박스(로컬): 11 | <%= f.datetime_local_field :published %>
    12 | 월 입력 박스: 13 | <%= f.month_field :published %>
    14 | 주 입력 박스: 15 | <%= f.week_field :published %>
    16 | 메일 입력 박스: 17 | <%= f.email_field :isbn, size: 25, maxlength: 30 %>
    18 | 숫자 입력 박스: 19 | <%= f.number_field :price, min: 10, max: 10000, step: 10 %>
    20 | 슬라이더: 21 | <%= f.range_field :price, min: 0, max: 10000 %>
    22 | 검색 박스: 23 | <%= f.search_field :isbn, size: 10, maxlength: 15 %>
    24 | 전화번호 입력 박스: 25 | <%= f.telephone_field :isbn, size: 15, maxlength: 20 %>
    26 | URL 입력 박스: 27 | <%= f.url_field :isbn, size: 10, maxlength: 15 %>
    28 | <% end %> -------------------------------------------------------------------------------- /app/views/view/image_tag.html.erb: -------------------------------------------------------------------------------- 1 | <%= image_tag 'wings_logo.gif' %>
    2 | 3 | <%= image_tag '/icons/button.gif' %>
    4 | 5 | <%= image_tag 'http://www.web-deli.com/image/linkbanner_s.gif' %>
    6 | 7 | <%= image_tag 'fish.jpg', alt: '물고기', size: '120x90' %>
    8 | 9 | <%= image_tag 'fish.jpg', alt: '물고기', width: 120, height: 90 %>
    10 | 11 | -------------------------------------------------------------------------------- /app/views/view/keyword.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag({ controller: :keyword, action: :search }, 2 | id: :fm, class: :search) do %> 3 | 검색 키워드: 4 | <%= text_field_tag :keywd, '', size: 30 %> 5 | <%= submit_tag '검색' %> 6 | <% end %> -------------------------------------------------------------------------------- /app/views/view/link.html.erb: -------------------------------------------------------------------------------- 1 | <%= link_to '지원 사이트', 'http://www.wings.msn.to/' %>
    2 | 3 | <%= link_to 'Top', { controller: :hello, action: :index }, 4 | id: :link, class: :menu %>
    5 | 6 | <%= link_to '제거', book_path(1), 7 | { method: :delete, data: { confirm: '제거해도 괜찮습니까?'} } %>
    8 | 9 | <% @book = Book.find(1) %> 10 | <%= link_to book_path(@book) do 11 | image_tag "http://www.wings.msn.to/books/#{@book.isbn}/#{@book.isbn}.jpg" 12 | end %> 13 | -------------------------------------------------------------------------------- /app/views/view/linkif.html.erb: -------------------------------------------------------------------------------- 1 | <% #@user = User.new %> 2 | <%= link_to_if @user.nil?, '로그인', 3 | controller: :login, action: :index %>
    4 | 5 | <%= link_to_unless @user, '로그인', 6 | controller: :login, action: :index %>
    7 | 8 | <%= link_to_if @user.nil?, '로그인', 9 | controller: :login, action: :index do |name| 10 | link_to '마이페이지', controller: :login, action: :info 11 | end %> 12 | 13 | -------------------------------------------------------------------------------- /app/views/view/mailto.html.erb: -------------------------------------------------------------------------------- 1 | <%= mail_to 'CQW15204@nifty.com' %>
    2 | 3 | <%= mail_to 'CQW15204@nifty.com', '질문이 있다면 이쪽으로' %>
    4 | 5 | <%= mail_to 'CQW15204@nifty.com', nil, 6 | subject: '질문', cc: 'testA@test.com' %> 7 | -------------------------------------------------------------------------------- /app/views/view/multi.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :extend_menu do %> 2 | [<%= link_to '관련 정보', action: :relation %>] 3 | [<%= link_to '다운로드', action: :download %>] 4 | [<%= link_to '설문 조사', action: :quest %>] 5 | <% end %> 6 | 7 |
    8 | ...컨텐츠 본문... 9 |
    10 | -------------------------------------------------------------------------------- /app/views/view/nest.html.erb: -------------------------------------------------------------------------------- 1 | <%= @msg %> 2 | -------------------------------------------------------------------------------- /app/views/view/number_to.html.erb: -------------------------------------------------------------------------------- 1 | <%= number_to_currency(12345) %>
    2 | 3 | <%= number_to_currency(12345, unit: '원', precision: 0, format: '%n%u') %>
    4 | 5 | <%= number_to_human(1234567) %>
    6 | 7 | <%= number_to_human(1234567, units: { unit: "", million: "백만" }) %>
    8 | 9 | <%= number_to_human_size(123456) %>
    10 | 11 | <%= number_to_percentage(12.3456) %>
    12 | 13 | <%= number_with_delimiter(1234567.89, delimiter: " ", separator: ",") %>
    14 | 15 | <%= number_with_precision(123.4567) %>
    16 | 17 | <%= number_with_precision(123.4567, precision: 5) %>
    18 | 19 | <%= number_with_precision(123.4567, precision: 5, significant: true) %>
    20 | 21 | <%= number_with_precision(123.4, precision: 5, strip_insignificant_zeros: true) %> 22 | -------------------------------------------------------------------------------- /app/views/view/partial_basic.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | <%= render 'books/book' %> 3 |
    -------------------------------------------------------------------------------- /app/views/view/partial_col.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | 3 | <%= render partial: 'books/book', collection: @books, locals: { type: :details } %> 4 | 5 | <%#= render @books, type: :details %> 6 | 7 | 8 | <% 9 | =begin 10 | %> 11 | <% @books.each do |book| %> 12 | <%= render 'books/book', book: book, type: :details %> 13 | <% end %> 14 | <% 15 | =end 16 | %> 17 | 18 |
    -------------------------------------------------------------------------------- /app/views/view/partial_param.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | <%= render 'books/book', book: @book, type: :details %> 3 | <%#= render 'books/book', book: @book, type: :simple %> 4 |
    5 | -------------------------------------------------------------------------------- /app/views/view/partial_spacer.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | <%= render partial: 'books/book', collection: @books, 3 | spacer_template: 'separator' %> 4 |
    -------------------------------------------------------------------------------- /app/views/view/path.html.erb: -------------------------------------------------------------------------------- 1 | <%= path_to_image('fish.jpg') %>
    2 | 3 | <%= path_to_image('nothing.gif') %>
    4 | 5 | <%= path_to_javascript('books.js') %>
    6 | 7 | <%= url_to_stylesheet('books.css') %> 8 | -------------------------------------------------------------------------------- /app/views/view/sanitize.html.erb: -------------------------------------------------------------------------------- 1 | <% msg = <Rails와 관련된
    질문이 있습니다.

    3 | 응급 4 | 이쪽으로 응답해주세요. 5 | EOL 6 | %> 7 | <%= sanitize msg, tags: %w(br p a), attributes: %w(id class href) %> 8 | -------------------------------------------------------------------------------- /app/views/view/select.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(@book) do |f| %> 2 | <%= f.select :publish, ['제이펍', '한빛미디어', '한빛아카데미'], 3 | { include_blank: '선택해주세요' }, class: 'pub' %>
    4 | <%= f.select :publish, 5 | { '제이펍' => 1, '한빛미디어' => 2, '한빛아카데미' => 3 } %>
    6 | <%= f.select(:publish, 7 | [['제이펍', 1], ['한빛미디어', 2], ['한빛아카데미', 3]]) %>
    8 | <%= f.select :publish, ['제이펍', '한빛미디어', '한빛아카데미'], 9 | { include_blank: '선택해주세요' }, multiple: true %> 10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/views/view/select_tag.html.erb: -------------------------------------------------------------------------------- 1 | <%= select_tag 'publish', raw('') %> -------------------------------------------------------------------------------- /app/views/view/select_tag2.html.erb: -------------------------------------------------------------------------------- 1 | <%= select_tag 'publish', options_for_select( 2 | { '제이펍' => 1, '한빛미디어' => 2, '한빛아카데미' => 3 }, 2) %> 3 | -------------------------------------------------------------------------------- /app/views/view/simple_format.html.erb: -------------------------------------------------------------------------------- 1 | <% article = < 9 | <%= simple_format(article, class: :article) %> 10 | -------------------------------------------------------------------------------- /app/views/view/tag.html.erb: -------------------------------------------------------------------------------- 1 | <%= tag(:br) %> 2 | 3 | <%= tag(:input, { type: 'radio', disabled: true }, true) %> 4 | -------------------------------------------------------------------------------- /app/views/view/truncate.html.erb: -------------------------------------------------------------------------------- 1 | <% msg = 'Rails는 Ruby로 만들어진 프레임워크입니다. Rails에 영향을 받은 프레임워크에는 Catalyst와 symfony 등이 있습니다.' %> 2 | 3 | <%= truncate(msg, length: 50) %>
    4 | 5 | <%= truncate(msg, length: 50, separator: '.') %>
    6 | 7 | <%= truncate(msg, length: 50, omission: '...생략...') %> -------------------------------------------------------------------------------- /app/views/view/urlfor.html.erb: -------------------------------------------------------------------------------- 1 | <%= url_for(action: :new) %>
    2 | 3 | 4 | <%= url_for(controller: :books, action: :show, id: 5, 5 | anchor: 'rails', charset: 'utf8') %>
    6 | 7 | <%= url_for(action: :login, controller: :members, 8 | only_path: false, protocol: 'https') %>
    9 | 10 | 11 | <% @book = Book.find(2) %> 12 | <%= url_for(@book) %>
    13 | 14 | 15 | <%= url_for(:back) %> -------------------------------------------------------------------------------- /app/views/view/video.html.erb: -------------------------------------------------------------------------------- 1 | <%= video_tag 'child/sample.mp4', controls: true, autoplay: false, loop: true, size: '300x150', poster: 'wings_logo.gif' %> 2 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(:default, Rails.env) 8 | 9 | module Railbook 10 | class Application < Rails::Application 11 | config.action_controller.include_all_helpers = false 12 | 13 | # Settings in config/environments/* take precedence over those specified here. 14 | # Application configuration should go into files in config/initializers 15 | # -- all .rb files in that directory are automatically loaded. 16 | 17 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 18 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 19 | # config.time_zone = 'Central Time (US & Canada)' 20 | 21 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 22 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 23 | # config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] 24 | # config.i18n.enforce_available_locales = true 25 | # config.i18n.default_locale = :en 26 | # config.i18n.default_locale = :ja 27 | # config.i18n.default_locale = :de 28 | # config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] 29 | 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | 27 | # adapter: mysql2 28 | # encoding: utf8 29 | # database: railbook 30 | # pool: 5 31 | # username: root 32 | # password: 12345 33 | # socket: /var/lib/mysql/mysql.sock -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Railbook::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Railbook::Application.configure do 2 | # config.cache_store = :memory_store, { size: 16.megabytes } 3 | 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded on 7 | # every request. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports and disable caching. 15 | config.consider_all_requests_local = true 16 | config.action_controller.perform_caching = true 17 | 18 | # config.action_controller.permit_all_parameters = true 19 | 20 | 21 | # Don't care if the mailer can't send. 22 | config.action_mailer.delivery_method = :smtp 23 | config.action_mailer.raise_delivery_errors = true 24 | config.action_mailer.smtp_settings = { 25 | address: 'smtp.examples.com', 26 | port: 587, 27 | user_name: 'hogehoge', 28 | password: 'secret', 29 | domain: 'examples.com' 30 | } 31 | config.action_mailer.default_url_options = 32 | { host: 'www.example.com' } 33 | 34 | # Print deprecation notices to the Rails logger. 35 | config.active_support.deprecation = :log 36 | 37 | # Raise an error on page load if there are pending migrations 38 | config.active_record.migration_error = :page_load 39 | 40 | # Debug mode disables concatenation and preprocessing of assets. 41 | # This option may cause significant delays in view rendering with a large 42 | # number of complex assets. 43 | config.assets.debug = true 44 | # config.assets.digest = true 45 | 46 | # config.log_level = :error 47 | end 48 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Railbook::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static asset server for tests with Cache-Control for performance. 16 | config.serve_static_assets = true 17 | config.static_cache_control = "public, max-age=3600" 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Print deprecation notices to the stderr. 35 | config.active_support.deprecation = :stderr 36 | end 37 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/my_config.rb: -------------------------------------------------------------------------------- 1 | MY_APP = YAML.load( 2 | File.read("#{Rails.root}/config/my_config.yml"))[Rails.env] 3 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure your secret_key_base is kept private 11 | # if you're sharing your code publicly. 12 | Railbook::Application.config.secret_key_base = '69e1bc5e0c5dc1cf61f2e6c19914bad80e7c22c58e6a1be26d8cd820b6ca04a51f0cfb5aea637b50c669671a501b2f41ea37840651e0807dc6cee6d072d5af9b' 13 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Railbook::Application.config.session_store :cookie_store, key: '_railbook_session' 4 | -------------------------------------------------------------------------------- /config/initializers/test_mail_config.rb: -------------------------------------------------------------------------------- 1 | # if !Rails.env.production? 2 | # ActionMailer::Base.register_interceptor(TestMailtoInterceptor) 3 | # end 4 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/models/book/ja.yml: -------------------------------------------------------------------------------- 1 | ja: 2 | attributes: 3 | isbn: "ISBN番号" 4 | title: "이름" 5 | price: "가격" 6 | publish: "출판사" 7 | published: "출간일" 8 | 9 | -------------------------------------------------------------------------------- /config/my_config.yml: -------------------------------------------------------------------------------- 1 | COMMON: &COMMON 2 | author: "rint, Yoshihiro" 3 | logo: 4 | source: "http://www.wings.msn.to/image/wings.jpg" 5 | width: 215 6 | height: 67 7 | 8 | development: 9 | hoge: "dev" 10 | <<: *COMMON 11 | 12 | test: 13 | hoge: "test" 14 | <<: *COMMON 15 | 16 | production: 17 | hoge: "pro" 18 | <<: *COMMON 19 | -------------------------------------------------------------------------------- /db/migrate/20130913051910_create_books.rb: -------------------------------------------------------------------------------- 1 | class CreateBooks < ActiveRecord::Migration 2 | def change 3 | create_table :books do |t| 4 | t.string :isbn 5 | t.string :title 6 | t.integer :price 7 | t.string :publish 8 | t.date :published 9 | t.boolean :cd 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20130914060842_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration 2 | def change 3 | create_table :users do |t| 4 | t.string :username 5 | t.string :password 6 | t.string :salt 7 | t.string :email 8 | t.boolean :dm 9 | t.string :roles 10 | t.integer :reviews_count, default: 0 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20130914060904_create_authors.rb: -------------------------------------------------------------------------------- 1 | class CreateAuthors < ActiveRecord::Migration 2 | def change 3 | create_table :authors do |t| 4 | t.references :user, index: true 5 | t.string :name 6 | t.date :birth 7 | t.text :address 8 | t.string :ctype 9 | t.binary :photo 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20130914060920_create_reviews.rb: -------------------------------------------------------------------------------- 1 | class CreateReviews < ActiveRecord::Migration 2 | def change 3 | create_table :reviews do |t| 4 | t.references :book, index: true 5 | t.references :user, index: true 6 | t.text :body 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20130914060936_create_fan_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateFanComments < ActiveRecord::Migration 2 | def change 3 | create_table :fan_comments do |t| 4 | t.integer :author_no 5 | t.string :name 6 | t.text :body 7 | t.boolean :deleted 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20130915061456_create_members.rb: -------------------------------------------------------------------------------- 1 | class CreateMembers < ActiveRecord::Migration 2 | def change 3 | create_table :members do |t| 4 | t.string :name 5 | t.string :email 6 | t.integer :lock_version, default: 0 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20131005063736_create_memos.rb: -------------------------------------------------------------------------------- 1 | class CreateMemos < ActiveRecord::Migration 2 | def change 3 | create_table :memos do |t| 4 | t.string :memoable_type 5 | t.integer :memoable_id 6 | t.string :body 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20140118053815_create_join_table_author_book.rb: -------------------------------------------------------------------------------- 1 | class CreateJoinTableAuthorBook < ActiveRecord::Migration 2 | def change 3 | create_join_table :authors, :books do |t| 4 | # t.index [:author_id, :book_id] 5 | # t.index [:book_id, :author_id] 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | Book.create(id: 1, isbn: '978-4-7741-5878-5', title: '안드로이드 개발자를 위한 자바', price: 3360, publish: '제이펍', published: '2013-08-20', cd: false) 2 | Book.create(id: 2, isbn: '978-4-7741-5611-8', title: '자바스크립트 라이브러리 실전 활용', price: 2709, publish: '제이펍', published: '2013-03-19', cd: false) 3 | Book.create(id: 3, isbn: '978-4-7980-3585-7', title: '처음 시작하는 안드로이드 애플리케이션 개발', price: 3150, publish: '한빛아카데미', published: '2012-11-22', cd: false) -------------------------------------------------------------------------------- /db/structure.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "authors" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "name" varchar(255), "birth" date, "address" text, "ctype" varchar(255), "photo" blob, "created_at" datetime, "updated_at" datetime); 2 | CREATE TABLE "authors_books" ("author_id" integer NOT NULL, "book_id" integer NOT NULL); 3 | CREATE TABLE "books" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "isbn" varchar(255), "title" varchar(255), "price" integer, "publish" varchar(255), "published" date, "cd" boolean, "created_at" datetime, "updated_at" datetime); 4 | CREATE TABLE "fan_comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "author_no" integer, "name" varchar(255), "body" text, "deleted" boolean, "created_at" datetime, "updated_at" datetime); 5 | CREATE TABLE "members" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "lock_version" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime); 6 | CREATE TABLE "memos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "memoable_type" varchar(255), "memoable_id" integer, "body" varchar(255), "created_at" datetime, "updated_at" datetime); 7 | CREATE TABLE "reviews" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "book_id" integer, "user_id" integer, "body" text, "created_at" datetime, "updated_at" datetime); 8 | CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL); 9 | CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password" varchar(255), "salt" varchar(255), "email" varchar(255), "dm" boolean, "roles" varchar(255), "reviews_count" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime); 10 | CREATE INDEX "index_authors_on_user_id" ON "authors" ("user_id"); 11 | CREATE INDEX "index_reviews_on_book_id" ON "reviews" ("book_id"); 12 | CREATE INDEX "index_reviews_on_user_id" ON "reviews" ("user_id"); 13 | CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version"); 14 | INSERT INTO schema_migrations (version) VALUES ('20130913051910'); 15 | 16 | INSERT INTO schema_migrations (version) VALUES ('20130914060842'); 17 | 18 | INSERT INTO schema_migrations (version) VALUES ('20130914060904'); 19 | 20 | INSERT INTO schema_migrations (version) VALUES ('20130914060920'); 21 | 22 | INSERT INTO schema_migrations (version) VALUES ('20130914060936'); 23 | 24 | INSERT INTO schema_migrations (version) VALUES ('20130915061456'); 25 | 26 | INSERT INTO schema_migrations (version) VALUES ('20131005063736'); 27 | 28 | INSERT INTO schema_migrations (version) VALUES ('20140118053815'); 29 | -------------------------------------------------------------------------------- /doc/app/Admin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module Admin - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module Admin 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/AjaxHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module AjaxHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module AjaxHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/ApplicationHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module ApplicationHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module ApplicationHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/AuthorsHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module AuthorsHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module AuthorsHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/BooksHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module BooksHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module BooksHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/HelloHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module HelloHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module HelloHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/MembersHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module MembersHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module MembersHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/ReviewsHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module ReviewsHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module ReviewsHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/UsersHelper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module UsersHelper - Rails Application Documentation 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 63 | 64 |
    65 |

    66 | module UsersHelper 67 |

    68 | 69 |
    70 | 71 |
    72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
    87 |
    88 | 89 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /doc/app/fonts/Lato-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/fonts/Lato-Light.ttf -------------------------------------------------------------------------------- /doc/app/fonts/Lato-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/fonts/Lato-LightItalic.ttf -------------------------------------------------------------------------------- /doc/app/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /doc/app/fonts/Lato-RegularItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/fonts/Lato-RegularItalic.ttf -------------------------------------------------------------------------------- /doc/app/fonts/SourceCodePro-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/fonts/SourceCodePro-Bold.ttf -------------------------------------------------------------------------------- /doc/app/fonts/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/fonts/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /doc/app/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/add.png -------------------------------------------------------------------------------- /doc/app/images/arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/arrow_up.png -------------------------------------------------------------------------------- /doc/app/images/brick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/brick.png -------------------------------------------------------------------------------- /doc/app/images/brick_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/brick_link.png -------------------------------------------------------------------------------- /doc/app/images/bug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/bug.png -------------------------------------------------------------------------------- /doc/app/images/bullet_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/bullet_black.png -------------------------------------------------------------------------------- /doc/app/images/bullet_toggle_minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/bullet_toggle_minus.png -------------------------------------------------------------------------------- /doc/app/images/bullet_toggle_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/bullet_toggle_plus.png -------------------------------------------------------------------------------- /doc/app/images/date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/date.png -------------------------------------------------------------------------------- /doc/app/images/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/delete.png -------------------------------------------------------------------------------- /doc/app/images/find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/find.png -------------------------------------------------------------------------------- /doc/app/images/loadingAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/loadingAnimation.gif -------------------------------------------------------------------------------- /doc/app/images/macFFBgHack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/macFFBgHack.png -------------------------------------------------------------------------------- /doc/app/images/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/package.png -------------------------------------------------------------------------------- /doc/app/images/page_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/page_green.png -------------------------------------------------------------------------------- /doc/app/images/page_white_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/page_white_text.png -------------------------------------------------------------------------------- /doc/app/images/page_white_width.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/page_white_width.png -------------------------------------------------------------------------------- /doc/app/images/plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/plugin.png -------------------------------------------------------------------------------- /doc/app/images/ruby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/ruby.png -------------------------------------------------------------------------------- /doc/app/images/tag_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/tag_blue.png -------------------------------------------------------------------------------- /doc/app/images/tag_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/tag_green.png -------------------------------------------------------------------------------- /doc/app/images/transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/transparent.png -------------------------------------------------------------------------------- /doc/app/images/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/wrench.png -------------------------------------------------------------------------------- /doc/app/images/wrench_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/wrench_orange.png -------------------------------------------------------------------------------- /doc/app/images/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/images/zoom.png -------------------------------------------------------------------------------- /doc/app/js/navigation.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/js/navigation.js.gz -------------------------------------------------------------------------------- /doc/app/js/search_index.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/js/search_index.js.gz -------------------------------------------------------------------------------- /doc/app/js/searcher.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/doc/app/js/searcher.js.gz -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 48 | 49 | 50 | 51 | 52 |
    53 |

    The page you were looking for doesn't exist.

    54 |

    You may have mistyped the address or the page may have moved.

    55 |
    56 |

    If you are the application owner check the logs for more information.

    57 | 58 | 59 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 48 | 49 | 50 | 51 | 52 |
    53 |

    The change you wanted was rejected.

    54 |

    Maybe you tried to change something you didn't have access to.

    55 |
    56 |

    If you are the application owner check the logs for more information.

    57 | 58 | 59 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 48 | 49 | 50 | 51 | 52 |
    53 |

    We're sorry, but something went wrong.

    54 |
    55 |

    If you are the application owner check the logs for more information.

    56 | 57 | 58 | -------------------------------------------------------------------------------- /public/assets/application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | 12 | 13 | */ 14 | 15 | body { 16 | background-color: #fff; 17 | color: #333; 18 | font-family: verdana, arial, helvetica, sans-serif; 19 | font-size: 13px; 20 | line-height: 18px; } 21 | 22 | p, ol, ul, td { 23 | font-family: verdana, arial, helvetica, sans-serif; 24 | font-size: 13px; 25 | line-height: 18px; } 26 | 27 | pre { 28 | background-color: #eee; 29 | padding: 10px; 30 | font-size: 11px; } 31 | 32 | a { 33 | color: #000; } 34 | a:visited { 35 | color: #666; } 36 | a:hover { 37 | color: #fff; 38 | background-color: #000; } 39 | 40 | div.field, div.actions { 41 | margin-bottom: 10px; } 42 | 43 | #notice { 44 | color: green; } 45 | 46 | .field_with_errors { 47 | padding: 2px; 48 | background-color: red; 49 | display: table; } 50 | 51 | #error_explanation { 52 | width: 450px; 53 | border: 2px solid red; 54 | padding: 7px; 55 | padding-bottom: 0; 56 | margin-bottom: 20px; 57 | background-color: #f0f0f0; } 58 | #error_explanation h2 { 59 | text-align: left; 60 | font-weight: bold; 61 | padding: 5px 5px 5px 15px; 62 | font-size: 12px; 63 | margin: -7px; 64 | margin-bottom: 0px; 65 | background-color: #c00; 66 | color: #fff; } 67 | #error_explanation ul li { 68 | font-size: 12px; 69 | list-style: square; } 70 | -------------------------------------------------------------------------------- /public/assets/application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/assets/application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css.gz -------------------------------------------------------------------------------- /public/assets/application-89263912e8385765bd57cd2fa026dd0e.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/assets/application-89263912e8385765bd57cd2fa026dd0e.js.gz -------------------------------------------------------------------------------- /public/assets/chimes-29587febd995cdd099fcb2a3a888f0d3.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/assets/chimes-29587febd995cdd099fcb2a3a888f0d3.wav -------------------------------------------------------------------------------- /public/assets/desktop-3c57fbf7ddab44ab42ceb3c723e4c36e.ini: -------------------------------------------------------------------------------- 1 | [LocalizedFileNames] 2 | chimes.wav=@%windir%\system32\mmres.dll,-700 3 | -------------------------------------------------------------------------------- /public/assets/fav-icon-91e6ea59f2dd4774bccce741269d5c32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/assets/fav-icon-91e6ea59f2dd4774bccce741269d5c32.png -------------------------------------------------------------------------------- /public/assets/favicon-f25e19e103e8db47bb74fefd2dc2bdf1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/assets/favicon-f25e19e103e8db47bb74fefd2dc2bdf1.ico -------------------------------------------------------------------------------- /public/assets/manifest-aa873fb3633eb11c3c0c2dd1fb243c1e.json: -------------------------------------------------------------------------------- 1 | {"files":{"chimes-29587febd995cdd099fcb2a3a888f0d3.wav":{"logical_path":"chimes.wav","mtime":"2009-06-11T06:22:40+09:00","size":216364,"digest":"29587febd995cdd099fcb2a3a888f0d3"},"desktop-3c57fbf7ddab44ab42ceb3c723e4c36e.ini":{"logical_path":"desktop.ini","mtime":"2011-01-25T15:13:50+09:00","size":68,"digest":"3c57fbf7ddab44ab42ceb3c723e4c36e"},"fav-icon-91e6ea59f2dd4774bccce741269d5c32.png":{"logical_path":"fav-icon.png","mtime":"2011-01-25T21:23:50+09:00","size":756,"digest":"91e6ea59f2dd4774bccce741269d5c32"},"favicon-f25e19e103e8db47bb74fefd2dc2bdf1.ico":{"logical_path":"favicon.ico","mtime":"2006-11-06T00:00:00+09:00","size":2238,"digest":"f25e19e103e8db47bb74fefd2dc2bdf1"},"application-89263912e8385765bd57cd2fa026dd0e.js":{"logical_path":"application.js","mtime":"2013-10-30T15:37:30+09:00","size":289703,"digest":"89263912e8385765bd57cd2fa026dd0e"},"application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css":{"logical_path":"application.css","mtime":"2013-09-25T15:00:48+09:00","size":1560,"digest":"12b3c7dd74d2e9df37e7cbb1efa76a6d"}},"assets":{"chimes.wav":"chimes-29587febd995cdd099fcb2a3a888f0d3.wav","desktop.ini":"desktop-3c57fbf7ddab44ab42ceb3c723e4c36e.ini","fav-icon.png":"fav-icon-91e6ea59f2dd4774bccce741269d5c32.png","favicon.ico":"favicon-f25e19e103e8db47bb74fefd2dc2bdf1.ico","application.js":"application-89263912e8385765bd57cd2fa026dd0e.js","application.css":"application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css"}} -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/favicon.ico -------------------------------------------------------------------------------- /public/icons/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/icons/Thumbs.db -------------------------------------------------------------------------------- /public/icons/button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/public/icons/button.gif -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/admin/books_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Admin::BooksControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/ajax_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AjaxControllerTest < ActionController::TestCase 4 | test "should get test" do 5 | get :test 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/authors_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AuthorsControllerTest < ActionController::TestCase 4 | setup do 5 | @author = authors(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:authors) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create author" do 20 | assert_difference('Author.count') do 21 | post :create, author: { address: @author.address, birth: @author.birth, ctype: @author.ctype, name: @author.name, photo: @author.photo, user_id: @author.user_id } 22 | end 23 | 24 | assert_redirected_to author_path(assigns(:author)) 25 | end 26 | 27 | test "should show author" do 28 | get :show, id: @author 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @author 34 | assert_response :success 35 | end 36 | 37 | test "should update author" do 38 | patch :update, id: @author, author: { address: @author.address, birth: @author.birth, ctype: @author.ctype, name: @author.name, photo: @author.photo, user_id: @author.user_id } 39 | assert_redirected_to author_path(assigns(:author)) 40 | end 41 | 42 | test "should destroy author" do 43 | assert_difference('Author.count', -1) do 44 | delete :destroy, id: @author 45 | end 46 | 47 | assert_redirected_to authors_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/books_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BooksControllerTest < ActionController::TestCase 4 | =begin 5 | test "diff check" do 6 | assert_difference 'Book.count', 1 do 7 | post :create, book: { isbn: '978-4-7741-4223-0', 8 | title: 'Rubyポケットリファレンス', price: 3000, 9 | publish: '제이펍' } 10 | end 11 | end 12 | =end 13 | 14 | 15 | =begin 16 | setup do 17 | @book = books(:one) 18 | end 19 | 20 | test "should get index" do 21 | get :index 22 | assert_response :success 23 | assert_not_nil assigns(:books) 24 | end 25 | 26 | test "should get new" do 27 | get :new 28 | assert_response :success 29 | end 30 | 31 | test "should create book" do 32 | assert_difference('Book.count') do 33 | post :create, book: { cd: @book.cd, isbn: @book.isbn, price: @book.price, publish: @book.publish, published: @book.published, title: @book.title } 34 | end 35 | 36 | assert_redirected_to book_path(assigns(:book)) 37 | end 38 | 39 | test "should show book" do 40 | get :show, id: @book 41 | assert_response :success 42 | end 43 | 44 | test "should get edit" do 45 | get :edit, id: @book 46 | assert_response :success 47 | end 48 | 49 | test "should update book" do 50 | patch :update, id: @book, book: { cd: @book.cd, isbn: @book.isbn, price: @book.price, publish: @book.publish, published: @book.published, title: @book.title } 51 | assert_redirected_to book_path(assigns(:book)) 52 | end 53 | 54 | test "should destroy book" do 55 | assert_difference('Book.count', -1) do 56 | delete :destroy, id: @book 57 | end 58 | 59 | assert_redirected_to books_path 60 | end 61 | =end 62 | end 63 | -------------------------------------------------------------------------------- /test/controllers/extra_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ExtraControllerTest < ActionController::TestCase 4 | test "should get sendmail" do 5 | get :sendmail 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/fan_comments_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class FanCommentsControllerTest < ActionController::TestCase 4 | setup do 5 | @fan_comment = fan_comments(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:fan_comments) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create fan_comment" do 20 | assert_difference('FanComment.count') do 21 | post :create, fan_comment: { author_no: @fan_comment.author_no, body: @fan_comment.body, deleted: @fan_comment.deleted, name: @fan_comment.name } 22 | end 23 | 24 | assert_redirected_to fan_comment_path(assigns(:fan_comment)) 25 | end 26 | 27 | test "should show fan_comment" do 28 | get :show, id: @fan_comment 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @fan_comment 34 | assert_response :success 35 | end 36 | 37 | test "should update fan_comment" do 38 | patch :update, id: @fan_comment, fan_comment: { author_no: @fan_comment.author_no, body: @fan_comment.body, deleted: @fan_comment.deleted, name: @fan_comment.name } 39 | assert_redirected_to fan_comment_path(assigns(:fan_comment)) 40 | end 41 | 42 | test "should destroy fan_comment" do 43 | assert_difference('FanComment.count', -1) do 44 | delete :destroy, id: @fan_comment 45 | end 46 | 47 | assert_redirected_to fan_comments_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/hello_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HelloControllerTest < ActionController::TestCase 4 | 5 | test "list action" do 6 | get :list 7 | assert_equal 10, assigns(:books).length, 'found rows is wrong.' 8 | assert_response :success, 'list action failed.' 9 | assert_template 'hello/list' 10 | end 11 | 12 | 13 | =begin 14 | test "routing check" do 15 | assert_generates('hello/list', 16 | { controller: 'hello', action: 'list' }) 17 | # assert_recognizes({ controller: 'hello', action: 'list' }, 'hello/list') 18 | end 19 | =end 20 | 21 | =begin 22 | test "select check" do 23 | get :list 24 | assert_select 'title' 25 | assert_select 'title', true 26 | assert_select 'font', false 27 | assert_select 'title', 'Railbook' 28 | assert_select 'title', /[A-Za-z0-9]+/ 29 | assert_select 'script[data-turbolinks-track=?]', /.+/ 30 | assert_select 'table tr[style]', 10 31 | assert_select 'table' do 32 | assert_select 'tr[style]', 1..10 33 | end 34 | assert_select 'title', { count: 1, text: 'Railbook' } 35 | end 36 | =end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /test/controllers/members_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class MembersControllerTest < ActionController::TestCase 4 | setup do 5 | @member = members(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:members) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create member" do 20 | assert_difference('Member.count') do 21 | post :create, member: { email: @member.email, lock_version: @member.lock_version, name: @member.name } 22 | end 23 | 24 | assert_redirected_to member_path(assigns(:member)) 25 | end 26 | 27 | test "should show member" do 28 | get :show, id: @member 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @member 34 | assert_response :success 35 | end 36 | 37 | test "should update member" do 38 | patch :update, id: @member, member: { email: @member.email, lock_version: @member.lock_version, name: @member.name } 39 | assert_redirected_to member_path(assigns(:member)) 40 | end 41 | 42 | test "should destroy member" do 43 | assert_difference('Member.count', -1) do 44 | delete :destroy, id: @member 45 | end 46 | 47 | assert_redirected_to members_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/reviews_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ReviewsControllerTest < ActionController::TestCase 4 | setup do 5 | @review = reviews(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:reviews) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create review" do 20 | assert_difference('Review.count') do 21 | post :create, review: { body: @review.body, book_id: @review.book_id, user_id: @review.user_id } 22 | end 23 | 24 | assert_redirected_to review_path(assigns(:review)) 25 | end 26 | 27 | test "should show review" do 28 | get :show, id: @review 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @review 34 | assert_response :success 35 | end 36 | 37 | test "should update review" do 38 | patch :update, id: @review, review: { body: @review.body, book_id: @review.book_id, user_id: @review.user_id } 39 | assert_redirected_to review_path(assigns(:review)) 40 | end 41 | 42 | test "should destroy review" do 43 | assert_difference('Review.count', -1) do 44 | delete :destroy, id: @review 45 | end 46 | 47 | assert_redirected_to reviews_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UsersControllerTest < ActionController::TestCase 4 | setup do 5 | @user = users(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:users) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create user" do 20 | assert_difference('User.count') do 21 | post :create, user: { dm: @user.dm, email: @user.email, password: @user.password, roles: @user.roles, username: @user.username } 22 | end 23 | 24 | assert_redirected_to user_path(assigns(:user)) 25 | end 26 | 27 | test "should show user" do 28 | get :show, id: @user 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @user 34 | assert_response :success 35 | end 36 | 37 | test "should update user" do 38 | patch :update, id: @user, user: { dm: @user.dm, email: @user.email, password: @user.password, roles: @user.roles, username: @user.username } 39 | assert_redirected_to user_path(assigns(:user)) 40 | end 41 | 42 | test "should destroy user" do 43 | assert_difference('User.count', -1) do 44 | delete :destroy, id: @user 45 | end 46 | 47 | assert_redirected_to users_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/authors.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | rint: 4 | id: 1 5 | user_id: 1 6 | name: 윤인성 7 | birth: 1991-12-09 8 | address: 서울특별시 강서구 9 | 10 | hasrat: 11 | id: 2 12 | user_id: 2 13 | name: 연하진 14 | birth: 1991-02-14 15 | address: 서울특별시 강서구 16 | 17 | iana: 18 | id: 3 19 | user_id: 3 20 | name: 김연화 21 | birth: 1989-10-15 22 | address: 서울특별시 마포구 23 | -------------------------------------------------------------------------------- /test/fixtures/authors_books.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | modernjava: 4 | book_id: 1 5 | author_id: 1 6 | 7 | jslib: 8 | book_id: 2 9 | author_id: 1 10 | 11 | jslib_2: 12 | book_id: 2 13 | author_id: 2 14 | 15 | rails: 16 | book_id: 3 17 | author_id: 2 18 | 19 | sql: 20 | book_id: 4 21 | author_id: 2 22 | 23 | android: 24 | book_id: 5 25 | author_id: 1 26 | 27 | php: 28 | book_id: 6 29 | author_id: 3 30 | 31 | html: 32 | book_id: 7 33 | author_id: 3 34 | 35 | refhtml: 36 | book_id: 8 37 | author_id: 1 38 | 39 | servlet: 40 | book_id: 9 41 | author_id: 1 42 | 43 | iphone: 44 | book_id: 10 45 | author_id: 3 46 | -------------------------------------------------------------------------------- /test/fixtures/books.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | modernjava: 4 | id: 1 5 | isbn: 978-4-7741-5878-5 6 | title: 안드로이드 개발자를 위한 자바 7 | price: 33600 8 | publish: 제이펍 9 | published: 2013-08-20 10 | cd: false 11 | 12 | jslib: 13 | id: 2 14 | isbn: 978-4-7741-5611-8 15 | title: 자바스크립트 라이브러리 실전 활용 16 | price: 27090 17 | publish: 제이펍 18 | published: 2013-03-19 19 | cd: false 20 | 21 | rails: 22 | id: 3 23 | isbn: 978-4-7741-4980-6 24 | title: Ruby on Rails 4 포켓 레퍼런스 25 | price: 29190 26 | publish: 제이펍 27 | published: 2012-01-26 28 | cd: true 29 | 30 | sql: 31 | id: 4 32 | isbn: 978-4-8222-9621-6 33 | title: 함께 공부하는 SQL 34 | price: 23100 35 | publish: 인사이트 36 | published: 2013-04-22 37 | cd: true 38 | 39 | android: 40 | id: 5 41 | isbn: 978-4-7980-3585-7 42 | title: 처음 시작하는 안드로이드 애플리케이션 개발 43 | price: 31500 44 | publish: 한빛아카데미 45 | published: 2012-11-22 46 | cd: false 47 | 48 | php: 49 | id: 6 50 | isbn: 978-4-7981-2631-9 51 | title: 10일 만에 살펴보는 PHP 입문 교실 52 | price: 33600 53 | publish: 한빛미디어 54 | published: 2012-09-13 55 | cd: true 56 | 57 | html: 58 | id: 7 59 | isbn: 987-4-8222-9612-4 60 | title: HTML5 애플리케이션 개발 입문 61 | price: 19950 62 | publish: 인사이트 63 | published: 2012-06-07 64 | cd: false 65 | 66 | refhtml: 67 | id: 8 68 | isbn: 978-4-7741-5067-3 69 | title: HTML5 개발 포켓 레퍼런스 70 | price: 27090 71 | publish: 한빛미디어 72 | published: 2012-04-17 73 | cd: false 74 | 75 | servlet: 76 | id: 9 77 | isbn: 978-4-7981-3049-1 78 | title: 혼자 공부하는 Java 서버 사이드 개발 79 | price: 37800 80 | publish: 한빛미디어 81 | published: 2013-01-28 82 | cd: false 83 | 84 | iphone: 85 | id: 10 86 | isbn: 978-4-88337-774-9 87 | title: Flash CS를 사용한 iPhone 프로그래밍 88 | price: 26250 89 | publish: 길벗 90 | published: 2011-08-16 91 | cd: false -------------------------------------------------------------------------------- /test/fixtures/fan_comments.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | author_no: 1 5 | name: 윤명월 6 | body: 친절하게 설명해줘서 좋았어요! 7 | deleted: true 8 | 9 | two: 10 | author_no: 1 11 | name: 남기주 12 | body: 기초부터 차근차근 알려주는 책인 것 같아요. 13 | deleted: false 14 | 15 | three: 16 | author_no: 2 17 | name: 연하진 18 | body: 서로 대화하는듯한 설명이 마음에 들었어요. 19 | deleted: false -------------------------------------------------------------------------------- /test/fixtures/members.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | one: 4 | id: 1 5 | name: 윤인성 6 | email: testA@test.com 7 | lock_version: 0 8 | 9 | two: 10 | id: 2 11 | name: 연하진 12 | email: testB@test.com 13 | lock_version: 0 14 | 15 | 16 | three: 17 | id: 3 18 | name: 김연화 19 | email: testH@test.com 20 | lock_version: 0 21 | -------------------------------------------------------------------------------- /test/fixtures/notice_mailer/sendmail_confirm: -------------------------------------------------------------------------------- 1 | nkakeyaさま 2 | 3 | この度は、本サイトへユーザ등록をいただきましてありがとうございました。 4 | 以下は、등록いただいたユーザ情報です。 5 | 6 | 사용자 이름: nkakeya 7 | 비밀번호: (セキュリティ保護のため、伏せています) 8 | 메일 주소: testG@test.com 9 | 10 | サイトをご利用いただくには、以下のページから로그인を行ってください。 11 | http://www.example.com/books 12 | 13 | 14 | "サーバサイド技術の学び舎"事務局(webmaster@wings.msn.to) 15 | -------------------------------------------------------------------------------- /test/fixtures/reviews.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | modernjava_1: 4 | id: 1 5 | book_id: 1 6 | user_id: 2 7 | body: Android 개발을 할 것이라면 꼭 읽었으면 좋겠어요! 8 | 9 | modernjava_2: 10 | id: 2 11 | book_id: 1 12 | user_id: 3 13 | body: Java 기본을 다시 살펴보고 싶을 때마다 펴보고 있는 책이에요. 14 | 15 | jslib_1: 16 | id: 3 17 | book_id: 2 18 | user_id: 2 19 | body: 굉장히 유용합니다. 다양한 라이브러리를 소개해줍니다. 20 | 21 | jslib_2: 22 | id: 4 23 | book_id: 2 24 | user_id: 4 25 | body: 친절한 설명에 예제도 많아서 좋습니다. 26 | 27 | jslib_3: 28 | id: 5 29 | book_id: 2 30 | user_id: 5 31 | body: 초보자에게는 조금 어려울 수 있을 것 같습니다. 32 | 33 | rails_1: 34 | id: 6 35 | book_id: 3 36 | user_id: 1 37 | body: 그림과 예제가 많아서 초보자인 저도 쉽게 이해할 수 있었어요! 38 | 39 | rails_2: 40 | id: 7 41 | book_id: 3 42 | user_id: 1 43 | body: 내용이 좋습니다. 44 | 45 | sql: 46 | id: 8 47 | book_id: 4 48 | user_id: 5 49 | body: 데이터베이스를 처음 공부해서 조금 어려웠지만 이제 잘 사용할 수 있을 것 같아요! 50 | 51 | android: 52 | id: 9 53 | book_id: 5 54 | user_id: 3 55 | body: 기초부터 응용까지 모두 다루어주고 있습니다. 이 책 한 권으로도 안드로이드 개발을 끝낼 수 있을 것 같아요. 56 | 57 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | arint: 4 | id: 1 5 | username: arint 6 | password: 2cf00a11121ad260ed32b290f9aefa01279bd5a2 7 | salt: 5f90a188468f64998c5a 8 | email: testA@test.com 9 | dm: true 10 | roles: admin,manager 11 | reviews_count: 2 12 | 13 | hasat: 14 | id: 2 15 | username: hasat 16 | password: 9be7f45387af4f7bbe720d16a6f334503b5c4f81 17 | salt: 5f90a188468f64998c5b 18 | email: testD@test.com 19 | dm: false 20 | roles: admin 21 | reviews_count: 2 22 | 23 | hiana: 24 | id: 3 25 | username: hiana 26 | password: 6cc09597819748465c6a2603a6f7a52d51eb01ef 27 | salt: 5f90a188468f64998c5c 28 | email: testE@test.com 29 | dm: true 30 | roles: manager 31 | reviews_count: 2 32 | 33 | rant: 34 | id: 4 35 | username: rant 36 | password: 06780c9b144eaf8dc0c8c6ded18afb032cac9b5e 37 | salt: 5f90a188468f64998c5d 38 | email: testF@test.com 39 | dm: false 40 | roles: member 41 | reviews_count: 1 42 | 43 | gurum: 44 | id: 5 45 | username: gurum 46 | password: 088aac29e5ea1bfd8879eaf3b621bdd3d31f072e 47 | salt: 5f90a188468f64998c5e 48 | email: testG@test.com 49 | dm: true 50 | roles: member 51 | reviews_count: 2 52 | 53 | nkakeya: 54 | id: 6 55 | username: nkakeya 56 | password: c599f512c00d8bbb9fd883f28b9555213516f88e 57 | salt: 5f90a188468f64998c5f 58 | email: testG@test.com 59 | dm: true 60 | roles: manager,member 61 | reviews_count: 0 62 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/test/helpers/.keep -------------------------------------------------------------------------------- /test/helpers/admin/books_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Admin::BooksHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/ajax_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AjaxHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/authors_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AuthorsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/books_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BooksHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/extra_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ExtraHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/fan_comments_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class FanCommentsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/hello_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HelloHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/members_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class MembersHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/reviews_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ReviewsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/users_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UsersHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/view_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ViewHelperTest < ActionView::TestCase 4 | test "format helper" do 5 | result = format_datetime(Time.now, :date) 6 | assert_match /\d{4}년 \d{1,2}월 \d{1,2}/, result 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/test/integration/.keep -------------------------------------------------------------------------------- /test/integration/admin_login_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AdminLoginTest < ActionDispatch::IntegrationTest 4 | test "login test" do 5 | get '/hello/view' 6 | assert_response :redirect 7 | assert_redirected_to controller: :login, action: :index 8 | assert_equal '/hello/view', flash[:referer] 9 | 10 | follow_redirect! 11 | assert_response :success 12 | assert_equal '/hello/view', flash[:referer] 13 | 14 | post '/login/auth', { username: 'arint', password: '12345', 15 | referer: '/hello/view' } 16 | assert_response :redirect 17 | assert_redirected_to controller: :hello, action: :view 18 | assert_equal users(:arint).id, session[:usr] 19 | 20 | follow_redirect! 21 | assert_response :success 22 | 23 | # post_via_redirect '/login/auth', { username: 'arint', 24 | # password: '12345', referer: '/hello/view' } 25 | # assert_response :success 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/test/mailers/.keep -------------------------------------------------------------------------------- /test/mailers/notice_mailer_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class NoticeMailerTest < ActionMailer::TestCase 4 | test "sendmail_confirm" do 5 | user = User.find(6) 6 | mail = NoticeMailer.sendmail_confirm(user).deliver 7 | assert !ActionMailer::Base.deliveries.empty? 8 | assert_equal "사용자 등록 감사드립니다!", mail.subject 9 | assert_equal "testG@test.com", mail.to[0] 10 | assert_equal "webmaster@wings.msn.to", mail.from[0] 11 | assert_equal read_fixture('sendmail_confirm').join, mail.body.to_s 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/test/models/.keep -------------------------------------------------------------------------------- /test/models/author_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AuthorTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/book_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BookTest < ActiveSupport::TestCase 4 | test "book save" do 5 | book = Book.new({ 6 | isbn: '978-4-7741-4466-X', 7 | title: 'Ruby on Rails 입문', 8 | price: 3100, 9 | publish: '제이펍', 10 | published: '2014-02-14', 11 | cd: false 12 | }) 13 | assert book.save, 'Failed to save' 14 | end 15 | 16 | =begin 17 | test "book validate" do 18 | book = Book.new({ 19 | isbn: '978-4-7741-44', 20 | title: 'Ruby on Rails 입문', 21 | price: 3100, 22 | publish: '제이펍', 23 | published: '2014-02-14', 24 | cd: false 25 | }) 26 | assert !book.save, 'Failed to validate' 27 | assert_equal book.errors.size, 2, 'Failed to validate count' 28 | assert book.errors[:isbn].any?, 'Failed to isbn validate' 29 | end 30 | =end 31 | 32 | =begin 33 | test "where method test" do 34 | result = Book.find_by(title: '자바스크립트 라이브러리 실전 활용') 35 | assert_instance_of Book, result ,'result is not instance of Book' 36 | assert_equal books(:jslib).isbn, result.isbn, 'isbn column is wrong.' 37 | assert_equal Date.new(2013, 03, 19), result.published, 38 | 'published column is wrong.' 39 | end 40 | =end 41 | 42 | =begin 43 | def setup 44 | @b = books(:jslib) 45 | end 46 | 47 | def teardown 48 | @b = nil 49 | end 50 | 51 | test "where method test" do 52 | result = Book.find_by(title: '자바스크립트 라이브러리 실전 활용') 53 | assert_instance_of Book, result ,'result is not instance of Book' 54 | assert_equal @b.isbn, result.isbn, 'isbn column is wrong.' 55 | assert_equal @b.published, result.published, 'published column is wrong.' 56 | end 57 | =end 58 | 59 | end 60 | -------------------------------------------------------------------------------- /test/models/fan_comment_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class FanCommentTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/member_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class MemberTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/memo_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class MemoTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/review_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ReviewTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] ||= "test" 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | ActiveRecord::Migration.check_pending! 7 | 8 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 9 | # 10 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 11 | # -- they do not yet inherit this setting 12 | fixtures :all 13 | 14 | # Add more helper methods to be used by all tests here... 15 | end 16 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jpub/RubyonRails4/c4bd37b9b9922f574dc64e57fc3ece48b0dc6f56/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------