Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sample_app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Đường Sỹ Hoàng
sample_app
Commits
f2e2d3dc
Commit
f2e2d3dc
authored
Nov 21, 2019
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed coding styles
parent
2ded87ff
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
app/controllers/application_controller.rb
+7
-7
app/helpers/microposts_helper.rb
+0
-2
app/models/micropost.rb
+4
-1
app/models/user.rb
+0
-1
app/views/static_pages/home.html.erb
+3
-3
No files found.
app/controllers/application_controller.rb
View file @
f2e2d3dc
...
@@ -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
app/helpers/microposts_helper.rb
deleted
100644 → 0
View file @
2ded87ff
module
MicropostsHelper
end
app/models/micropost.rb
View file @
f2e2d3dc
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
...
...
app/models/user.rb
View file @
f2e2d3dc
...
@@ -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
}
...
...
app/views/static_pages/home.html.erb
View file @
f2e2d3dc
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment