Skip to content

Commit

Permalink
fix(ImplicitRender): Change view path as per Phlex defaults
Browse files Browse the repository at this point in the history
The default path to a Phlex view is `[:controller_path]/[:action_name]_view`, which is classify'ed
and constantized. You can override this by defining a `phlex_view_path` method in your controller.

```ruby
def phlex_view_path(action_name)
  "views/#{controller_path}/#{action_name}"
end
```
  • Loading branch information
joelmoss committed Oct 12, 2023
1 parent 424b430 commit 8b96600
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/phlexible/rails/action_controller/implicit_render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ def render_plex_view(options)
render assign_phlex_accessors(view.new)
end

private

def phlex_view(action_name = @_action_name)
"views/#{controller_path}/#{action_name}".classify.safe_constantize
phlex_view_path(action_name).classify.constantize
end

def phlex_view_path(action_name)
"#{controller_path}/#{action_name}_view"
end
end
end
Expand Down

0 comments on commit 8b96600

Please sign in to comment.