Avoid exception when object.user is nil
This commit is contained in:
parent
07cb0005b0
commit
0607abe2fd
|
@ -49,8 +49,8 @@ after_initialize do
|
|||
def excerpt
|
||||
Post.excerpt(object.cooked, 70)
|
||||
end
|
||||
def username; object.user.username; end
|
||||
def avatar_template; object.user.avatar_template; end
|
||||
def username; object.user && object.user.username; end
|
||||
def avatar_template; object.user && object.user.avatar_template; end
|
||||
end
|
||||
|
||||
# Run a data explorer query on the currently connected database.
|
||||
|
|
Loading…
Reference in New Issue