Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
bc545cfd
Commit
bc545cfd
authored
May 16, 2019
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain render_if_exists opts caveat
parent
bc852e05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
doc/development/ee_features.md
doc/development/ee_features.md
+13
-1
No files found.
doc/development/ee_features.md
View file @
bc545cfd
...
...
@@ -446,16 +446,28 @@ The disadvantage of this:
port
`render_if_exists`
to CE.
-
If we have typos in the partial name, it would be silently ignored.
##### Caveats
The
`render_if_exists`
view path argument must be relative to
`app/views/`
and
`ee/app/views`
.
Resolving an EE template path that is relative to the CE view path will not work.
```
haml
-
# app/views/projects/index.html.haml
=
render_if_exists
'button'
# Will not render `ee/app/views/projects/_button` and quietly fail
=
render_if_exists
'button'
# Will not render `ee/app/views/projects/_button` and
will
quietly fail
=
render_if_exists
'projects/button'
# Will render `ee/app/views/projects/_button`
```
You should not explicitly set render options like
`partial`
or provide a
`locals`
hash.
The first argument should be a path string and the second can be a hash replacing
`locals`
.
```
ruby
render
partial:
'projects/button'
,
locals:
{
project:
project
}
# becomes
render_if_exists
'projects/button'
,
project:
project
```
#### Using `render_ce`
For
`render`
and
`render_if_exists`
, they search for the EE partial first,
...
...
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