This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BlogsController < ApplicationController | |
def index | |
@posts = Post.find(:all) | |
end | |
def show | |
@post = Post.find(params[:id]) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BlogsController < ApplicationController | |
def index | |
@posts = Post.find(:all) | |
end | |
def show | |
@post = Post.find(params[:id]) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>New post</h1> | |
<% form_for :post , :url => blogs_path do |f| -%> | |
<%= f.error_messages %> | |
<div><label>subject</label><%= f.text_field :subject %></div> | |
<div><label>content</label><%= f.text_area :content %> </div> | |
<%= f.submit "Submit", :disable_with => 'Submiting...' %> | |
<% end -%> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>My Blog</h1> | |
<h2><%= link_to 'New post', new_blog_path %></h2> | |
<table> | |
<tr> | |
</tr> | |
<% for post in @posts %> | |
<tr> | |
<td><%= post.subject %> </td> | |
<td><%= link_to 'Show', blog_path(post) %></td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Editing post</h1> | |
<% form_for :post , :url => blog_path(@post) , :html => {:method => :put} do |f| -%> | |
<%= f.error_messages %> | |
<div><%= f.text_field :subject %> | |
<div><%= f.text_area :content %></div> | |
<%= f.submit "Submit", :disable_with => 'Submiting...' %> | |
<% end -%> | |
<%= link_to 'Show', blog_path(blog) %> | | |
<%= link_to 'Back', blogss_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Editing post</h1> | |
<% form_for :post , :url => blog_path(@post) , :html => {:method => :put} do |f| -%> | |
<%= f.error_messages %> | |
<div><%= f.text_field :subject %> | |
<div><%= f.text_area :content %></div> | |
<%= f.submit "Submit", :disable_with => 'Submiting...' %> | |
<% end -%> | |
<%= link_to 'Show', blog_path(blog) %> | | |
<%= link_to 'Back', blogss_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><%= @post.subject %></h1> | |
<div> | |
<%= @post.content %> | |
</div> | |
<%= link_to 'Edit', edit_blog_path(@post) %> | | |
<%= link_to 'Back', blogs_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><%= @post.subject %></h1> | |
<div> | |
<%= @post.content %> | |
</div> | |
<%= link_to 'Edit', edit_blog_path(@post) %> | | |
<%= link_to 'Back', blogs_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dddddd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dddddd |