rails 3.2.22.5 → 4.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.rdoc +77 -0
- data/guides/CHANGELOG.md +9 -0
- data/guides/Rakefile +77 -0
- data/guides/assets/images/belongs_to.png +0 -0
- data/guides/assets/images/book_icon.gif +0 -0
- data/guides/assets/images/bullet.gif +0 -0
- data/guides/assets/images/challenge.png +0 -0
- data/guides/assets/images/chapters_icon.gif +0 -0
- data/guides/assets/images/check_bullet.gif +0 -0
- data/guides/assets/images/credits_pic_blank.gif +0 -0
- data/guides/assets/images/csrf.png +0 -0
- data/guides/assets/images/edge_badge.png +0 -0
- data/guides/assets/images/favicon.ico +0 -0
- data/guides/assets/images/feature_tile.gif +0 -0
- data/guides/assets/images/footer_tile.gif +0 -0
- data/guides/assets/images/fxn.png +0 -0
- data/guides/assets/images/getting_started/confirm_dialog.png +0 -0
- data/guides/assets/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
- data/guides/assets/images/getting_started/form_with_errors.png +0 -0
- data/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
- data/guides/assets/images/getting_started/new_post.png +0 -0
- data/guides/assets/images/getting_started/post_with_comments.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
- data/guides/assets/images/getting_started/show_action_for_posts.png +0 -0
- data/guides/assets/images/getting_started/template_is_missing_posts_new.png +0 -0
- data/guides/assets/images/getting_started/undefined_method_post_path.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_create_for_posts.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_new_for_posts.png +0 -0
- data/guides/assets/images/grey_bullet.gif +0 -0
- data/guides/assets/images/habtm.png +0 -0
- data/guides/assets/images/has_many.png +0 -0
- data/guides/assets/images/has_many_through.png +0 -0
- data/guides/assets/images/has_one.png +0 -0
- data/guides/assets/images/has_one_through.png +0 -0
- data/guides/assets/images/header_backdrop.png +0 -0
- data/guides/assets/images/header_tile.gif +0 -0
- data/guides/assets/images/i18n/demo_html_safe.png +0 -0
- data/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translated_en.png +0 -0
- data/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translation_missing.png +0 -0
- data/guides/assets/images/i18n/demo_untranslated.png +0 -0
- data/guides/assets/images/icons/README +5 -0
- data/guides/assets/images/icons/callouts/1.png +0 -0
- data/guides/assets/images/icons/callouts/10.png +0 -0
- data/guides/assets/images/icons/callouts/11.png +0 -0
- data/guides/assets/images/icons/callouts/12.png +0 -0
- data/guides/assets/images/icons/callouts/13.png +0 -0
- data/guides/assets/images/icons/callouts/14.png +0 -0
- data/guides/assets/images/icons/callouts/15.png +0 -0
- data/guides/assets/images/icons/callouts/2.png +0 -0
- data/guides/assets/images/icons/callouts/3.png +0 -0
- data/guides/assets/images/icons/callouts/4.png +0 -0
- data/guides/assets/images/icons/callouts/5.png +0 -0
- data/guides/assets/images/icons/callouts/6.png +0 -0
- data/guides/assets/images/icons/callouts/7.png +0 -0
- data/guides/assets/images/icons/callouts/8.png +0 -0
- data/guides/assets/images/icons/callouts/9.png +0 -0
- data/guides/assets/images/icons/caution.png +0 -0
- data/guides/assets/images/icons/example.png +0 -0
- data/guides/assets/images/icons/home.png +0 -0
- data/guides/assets/images/icons/important.png +0 -0
- data/guides/assets/images/icons/next.png +0 -0
- data/guides/assets/images/icons/note.png +0 -0
- data/guides/assets/images/icons/prev.png +0 -0
- data/guides/assets/images/icons/tip.png +0 -0
- data/guides/assets/images/icons/up.png +0 -0
- data/guides/assets/images/icons/warning.png +0 -0
- data/guides/assets/images/jaimeiniesta.jpg +0 -0
- data/guides/assets/images/nav_arrow.gif +0 -0
- data/guides/assets/images/oscardelben.jpg +0 -0
- data/guides/assets/images/polymorphic.png +0 -0
- data/guides/assets/images/radar.png +0 -0
- data/guides/assets/images/rails4_features.png +0 -0
- data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/guides/assets/images/rails_guides_logo.gif +0 -0
- data/guides/assets/images/rails_logo_remix.gif +0 -0
- data/guides/assets/images/rails_welcome.png +0 -0
- data/guides/assets/images/session_fixation.png +0 -0
- data/guides/assets/images/tab_grey.gif +0 -0
- data/guides/assets/images/tab_info.gif +0 -0
- data/guides/assets/images/tab_note.gif +0 -0
- data/guides/assets/images/tab_red.gif +0 -0
- data/guides/assets/images/tab_yellow.gif +0 -0
- data/guides/assets/images/tab_yellow.png +0 -0
- data/guides/assets/images/vijaydev.jpg +0 -0
- data/guides/assets/javascripts/guides.js +57 -0
- data/guides/assets/javascripts/jquery.min.js +4 -0
- data/guides/assets/javascripts/responsive-tables.js +43 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
- data/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
- data/guides/assets/stylesheets/fixes.css +16 -0
- data/guides/assets/stylesheets/kindle.css +11 -0
- data/guides/assets/stylesheets/main.css +709 -0
- data/guides/assets/stylesheets/print.css +52 -0
- data/guides/assets/stylesheets/reset.css +43 -0
- data/guides/assets/stylesheets/responsive-tables.css +50 -0
- data/guides/assets/stylesheets/style.css +13 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
- data/guides/code/getting_started/Gemfile +38 -0
- data/guides/code/getting_started/Gemfile.lock +150 -0
- data/guides/code/getting_started/README.rdoc +28 -0
- data/guides/code/getting_started/Rakefile +6 -0
- data/guides/code/getting_started/app/assets/images/rails.png +0 -0
- data/guides/code/getting_started/app/assets/javascripts/application.js +16 -0
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/application.css +13 -0
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +3 -0
- data/guides/code/getting_started/app/controllers/application_controller.rb +5 -0
- data/guides/code/getting_started/app/controllers/comments_controller.rb +17 -0
- data/guides/code/getting_started/app/controllers/posts_controller.rb +47 -0
- data/guides/code/getting_started/app/controllers/welcome_controller.rb +4 -0
- data/guides/code/getting_started/app/helpers/application_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/comments_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/posts_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/welcome_helper.rb +2 -0
- data/guides/code/getting_started/app/models/comment.rb +3 -0
- data/guides/code/getting_started/app/models/post.rb +7 -0
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +15 -0
- data/guides/code/getting_started/app/views/comments/_form.html.erb +13 -0
- data/guides/code/getting_started/app/views/layouts/application.html.erb +14 -0
- data/guides/code/getting_started/app/views/posts/_form.html.erb +27 -0
- data/guides/code/getting_started/app/views/posts/edit.html.erb +5 -0
- data/guides/code/getting_started/app/views/posts/index.html.erb +21 -0
- data/guides/code/getting_started/app/views/posts/new.html.erb +5 -0
- data/guides/code/getting_started/app/views/posts/show.html.erb +18 -0
- data/guides/code/getting_started/app/views/welcome/index.html.erb +3 -0
- data/guides/code/getting_started/bin/bundle +4 -0
- data/guides/code/getting_started/bin/rails +4 -0
- data/guides/code/getting_started/bin/rake +4 -0
- data/guides/code/getting_started/config.ru +4 -0
- data/guides/code/getting_started/config/application.rb +17 -0
- data/guides/code/getting_started/config/boot.rb +4 -0
- data/guides/code/getting_started/config/database.yml +25 -0
- data/guides/code/getting_started/config/environment.rb +5 -0
- data/guides/code/getting_started/config/environments/development.rb +30 -0
- data/guides/code/getting_started/config/environments/production.rb +80 -0
- data/guides/code/getting_started/config/environments/test.rb +36 -0
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +7 -0
- data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +4 -0
- data/guides/code/getting_started/config/initializers/inflections.rb +16 -0
- data/guides/code/getting_started/config/initializers/locale.rb +9 -0
- data/guides/code/getting_started/config/initializers/mime_types.rb +5 -0
- data/guides/code/getting_started/config/initializers/secret_token.rb +12 -0
- data/guides/code/getting_started/config/initializers/session_store.rb +3 -0
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +14 -0
- data/guides/code/getting_started/config/locales/en.yml +23 -0
- data/guides/code/getting_started/config/routes.rb +7 -0
- data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +10 -0
- data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +11 -0
- data/guides/code/getting_started/db/schema.rb +33 -0
- data/guides/code/getting_started/db/seeds.rb +7 -0
- data/guides/code/getting_started/public/404.html +27 -0
- data/guides/code/getting_started/public/422.html +26 -0
- data/guides/code/getting_started/public/500.html +26 -0
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +5 -0
- data/guides/code/getting_started/test/controllers/comments_controller_test.rb +7 -0
- data/guides/code/getting_started/test/controllers/posts_controller_test.rb +7 -0
- data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +9 -0
- data/guides/code/getting_started/test/fixtures/comments.yml +11 -0
- data/guides/code/getting_started/test/fixtures/posts.yml +9 -0
- data/guides/code/getting_started/test/helpers/comments_helper_test.rb +4 -0
- data/guides/code/getting_started/test/helpers/posts_helper_test.rb +4 -0
- data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +4 -0
- data/guides/code/getting_started/test/models/comment_test.rb +7 -0
- data/guides/code/getting_started/test/models/post_test.rb +7 -0
- data/guides/code/getting_started/test/test_helper.rb +15 -0
- data/guides/rails_guides.rb +44 -0
- data/guides/rails_guides/generator.rb +248 -0
- data/guides/rails_guides/helpers.rb +51 -0
- data/guides/rails_guides/indexer.rb +68 -0
- data/guides/rails_guides/kindle.rb +119 -0
- data/guides/rails_guides/levenshtein.rb +31 -0
- data/guides/rails_guides/markdown.rb +163 -0
- data/guides/rails_guides/markdown/renderer.rb +82 -0
- data/guides/source/2_2_release_notes.md +435 -0
- data/guides/source/2_3_release_notes.md +621 -0
- data/guides/source/3_0_release_notes.md +614 -0
- data/guides/source/3_1_release_notes.md +556 -0
- data/guides/source/3_2_release_notes.md +565 -0
- data/guides/source/4_0_release_notes.md +228 -0
- data/guides/source/_license.html.erb +2 -0
- data/guides/source/_welcome.html.erb +19 -0
- data/guides/source/action_controller_overview.md +872 -0
- data/guides/source/action_mailer_basics.md +599 -0
- data/guides/source/action_view_overview.md +1565 -0
- data/guides/source/active_model_basics.md +200 -0
- data/guides/source/active_record_basics.md +370 -0
- data/guides/source/active_record_callbacks.md +358 -0
- data/guides/source/active_record_querying.md +1621 -0
- data/guides/source/active_record_validations.md +1128 -0
- data/guides/source/active_support_core_extensions.md +3791 -0
- data/guides/source/active_support_instrumentation.md +487 -0
- data/guides/source/api_documentation_guidelines.md +209 -0
- data/guides/source/asset_pipeline.md +832 -0
- data/guides/source/association_basics.md +2129 -0
- data/guides/source/caching_with_rails.md +350 -0
- data/guides/source/command_line.md +594 -0
- data/guides/source/configuring.md +736 -0
- data/guides/source/contributing_to_ruby_on_rails.md +455 -0
- data/guides/source/credits.html.erb +76 -0
- data/guides/source/debugging_rails_applications.md +675 -0
- data/guides/source/development_dependencies_install.md +195 -0
- data/guides/source/documents.yaml +179 -0
- data/guides/source/engines.md +961 -0
- data/guides/source/form_helpers.md +955 -0
- data/guides/source/generators.md +644 -0
- data/guides/source/getting_started.md +1775 -0
- data/guides/source/i18n.md +983 -0
- data/guides/source/index.html.erb +27 -0
- data/guides/source/initialization.md +562 -0
- data/guides/source/kindle/KINDLE.md +26 -0
- data/guides/source/kindle/copyright.html.erb +1 -0
- data/guides/source/kindle/layout.html.erb +27 -0
- data/guides/source/kindle/rails_guides.opf.erb +52 -0
- data/guides/source/kindle/toc.html.erb +24 -0
- data/guides/source/kindle/toc.ncx.erb +64 -0
- data/guides/source/kindle/welcome.html.erb +5 -0
- data/guides/source/layout.html.erb +148 -0
- data/guides/source/layouts_and_rendering.md +1132 -0
- data/guides/source/migrations.md +1059 -0
- data/guides/source/nested_model_forms.md +225 -0
- data/guides/source/plugins.md +435 -0
- data/guides/source/rails_application_templates.md +229 -0
- data/guides/source/rails_on_rack.md +342 -0
- data/guides/source/routing.md +1088 -0
- data/guides/source/ruby_on_rails_guides_guidelines.md +124 -0
- data/guides/source/security.md +973 -0
- data/guides/source/testing.md +981 -0
- data/guides/source/upgrading_ruby_on_rails.md +286 -0
- data/guides/source/working_with_javascript_in_rails.md +396 -0
- data/guides/w3c_validator.rb +95 -0
- metadata +315 -31
@@ -0,0 +1,28 @@
|
|
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
|
+
<tt>rake doc:app</tt>.
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
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
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
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
|
+
*/
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CommentsController < ApplicationController
|
2
|
+
|
3
|
+
http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy
|
4
|
+
|
5
|
+
def create
|
6
|
+
@post = Post.find(params[:post_id])
|
7
|
+
@comment = @post.comments.create(params[:comment].permit(:commenter, :body))
|
8
|
+
redirect_to post_path(@post)
|
9
|
+
end
|
10
|
+
|
11
|
+
def destroy
|
12
|
+
@post = Post.find(params[:post_id])
|
13
|
+
@comment = @post.comments.find(params[:id])
|
14
|
+
@comment.destroy
|
15
|
+
redirect_to post_path(@post)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
|
3
|
+
http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show]
|
4
|
+
|
5
|
+
def index
|
6
|
+
@posts = Post.all
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
@post = Post.find(params[:id])
|
11
|
+
end
|
12
|
+
|
13
|
+
def edit
|
14
|
+
@post = Post.find(params[:id])
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
@post = Post.find(params[:id])
|
19
|
+
|
20
|
+
if @post.update(params[:post].permit(:title, :text))
|
21
|
+
redirect_to action: :show, id: @post.id
|
22
|
+
else
|
23
|
+
render 'edit'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def new
|
28
|
+
@post = Post.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def create
|
32
|
+
@post = Post.new(params[:post].permit(:title, :text))
|
33
|
+
|
34
|
+
if @post.save
|
35
|
+
redirect_to action: :show, id: @post.id
|
36
|
+
else
|
37
|
+
render 'new'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy
|
42
|
+
@post = Post.find(params[:id])
|
43
|
+
@post.destroy
|
44
|
+
|
45
|
+
redirect_to action: :index
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<p>
|
2
|
+
<strong>Commenter:</strong>
|
3
|
+
<%= comment.commenter %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong>Comment:</strong>
|
8
|
+
<%= comment.body %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= link_to 'Destroy Comment', [comment.post, comment],
|
13
|
+
method: :delete,
|
14
|
+
data: { confirm: 'Are you sure?' } %>
|
15
|
+
</p>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Blog</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= form_for @post do |f| %>
|
2
|
+
<% if @post.errors.any? %>
|
3
|
+
<div id="errorExplanation">
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited
|
5
|
+
this post from being saved:</h2>
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<p>
|
14
|
+
<%= f.label :title %><br>
|
15
|
+
<%= f.text_field :title %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<%= f.label :text %><br>
|
20
|
+
<%= f.text_area :text %>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<p>
|
24
|
+
<%= f.submit %>
|
25
|
+
</p>
|
26
|
+
<% end %>
|
27
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h1>Listing Posts</h1>
|
2
|
+
<table>
|
3
|
+
<tr>
|
4
|
+
<th>Title</th>
|
5
|
+
<th>Text</th>
|
6
|
+
<th></th>
|
7
|
+
<th></th>
|
8
|
+
<th></th>
|
9
|
+
</tr>
|
10
|
+
|
11
|
+
<% @posts.each do |post| %>
|
12
|
+
<tr>
|
13
|
+
<td><%= post.title %></td>
|
14
|
+
<td><%= post.text %></td>
|
15
|
+
<td><%= link_to 'Show', action: :show, id: post.id %></td>
|
16
|
+
<td><%= link_to 'Edit', action: :edit, id: post.id %></td>
|
17
|
+
<td><%= link_to 'Destroy', { action: :destroy, id: post.id },
|
18
|
+
method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<p>
|
2
|
+
<strong>Title:</strong>
|
3
|
+
<%= @post.title %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong>Text:</strong>
|
8
|
+
<%= @post.text %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<h2>Comments</h2>
|
12
|
+
<%= render @post.comments %>
|
13
|
+
|
14
|
+
<h2>Add a comment:</h2>
|
15
|
+
<%= render "comments/form" %>
|
16
|
+
|
17
|
+
<%= link_to 'Edit Post', edit_post_path(@post) %> |
|
18
|
+
<%= link_to 'Back to Posts', posts_path %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# Assets should be precompiled for production (so we don't need the gems loaded then)
|
6
|
+
Bundler.require(*Rails.groups(assets: %w(development test)))
|
7
|
+
|
8
|
+
module Blog
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
15
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
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
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Blog::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers.
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Raise an error on page load if there are pending migrations
|
26
|
+
config.active_record.migration_error = :page_load
|
27
|
+
|
28
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
29
|
+
config.assets.debug = true
|
30
|
+
end
|