Commit f2e2d3dc by Đường Sỹ Hoàng

Fixed coding styles

parent 2ded87ff
...@@ -4,12 +4,12 @@ class ApplicationController < ActionController::Base ...@@ -4,12 +4,12 @@ class ApplicationController < ActionController::Base
private private
# Confirms a logged-in user. # Confirms a logged-in user.
def logged_in_user def logged_in_user
unless logged_in? unless logged_in?
store_location store_location
flash[:danger] = "Please log in." flash[:danger] = "Please log in."
redirect_to login_url redirect_to login_url
end
end end
end
end end
class Micropost < ApplicationRecord class Micropost < ApplicationRecord
belongs_to :user
default_scope -> { order(created_at: :desc) } default_scope -> { order(created_at: :desc) }
mount_uploader :picture, PictureUploader mount_uploader :picture, PictureUploader
belongs_to :user
validates :user_id, presence: true validates :user_id, presence: true
validates :content, presence: true, length: { maximum: 140 } validates :content, presence: true, length: { maximum: 140 }
validate :picture_size validate :picture_size
......
...@@ -3,7 +3,6 @@ class User < ApplicationRecord ...@@ -3,7 +3,6 @@ class User < ApplicationRecord
attr_accessor :remember_token, :activation_token, :reset_token attr_accessor :remember_token, :activation_token, :reset_token
has_many :microposts
has_many :microposts, dependent: :destroy has_many :microposts, dependent: :destroy
validates :email, presence: true, length: { maximum: 255 }, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } validates :email, presence: true, length: { maximum: 255 }, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false }
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
<%= render "shared/feed" %> <%= render "shared/feed" %>
</div> </div>
</div> </div>
<% else %> <% else %>
<div class="center jumbotron"> <div class="center jumbotron">
<h1>Welcome to the Sample App</h1> <h1>Welcome to the Sample App</h1>
<h2> <h2>
This is the home page for the This is the home page for the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment