MatijaL
Hello,
I have a plug which adds a layout to some controller functions.
With Phoenix 1.6, I wrote it like this and it worked fine.
plug :put_layout "account.html" when action in [:edit, :update]
Phoenix 1.7 introduced a new way of writing it, it should be written something like this:
plug :put_layout, html: {TestApp.LayoutView, :account}
but now I can’t use when clause.
Can anyone suggest a proper way of writing this plug?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 21 to 12- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
tmbb
Ok, I agree it’s fine then
josevalim
It is not backwards incompatible. The scenario we warn only happens when you mix the new style (which by definition did not exist before and by definition cannot be incompatible) with the old style. If you are getting the warning, it means you are mixing both styles and certainly one of them is not working as expected.
LostKobrakai
How is adding a warning backward incompatible?
tmbb
Isn’t this a backward incompatible change? Should we have these between minor versions?
MatijaL
I just tried it and it works. Thanks a lot for taking the time to solve it and getting back to me.
josevalim
We found a potential cause for this. If you are using
plug :put_layout, html: ..., you need to makes sure that you declare the default layout and its format in youruse Phoenix.Controller, layouts: [html: {MyDefaultLayout, :app}].We have introduced a warning message on a soon to be released new patch version of Phoenix.
Here is the issue: Phoenix 1.7 Controller.put_layout @spec does not allow 1.6 usage · Issue #5320 · phoenixframework/phoenix · GitHub
Here is the commit: Add warning on mixed layout usage, closes #5320 · phoenixframework/phoenix@b2f110f · GitHub
MatijaL
Thanks for checking it out… I checked the docs and updated the code but as I changed it, something else broke and when I updated that piece of code again something new broke so eventually I gave up. The thing is that I don’t use LiveView but regular views, my plan is to move to LiveView eventually but that requires some time so for now I went back to the old code. Phoenix 1.7 is backward compatible so ElixirLS is giving me errors but that it, the code works just fine.
codeanpeace
Could it have to do with the shift from
use MyAppWeb, :viewtouse MyAppWeb, :htmland the new functionembed_templates?source: Phoenix.View docs
MatijaL
I don’t think I ever even touched that file except when upgrading to 1.7
josevalim
What about your my_app_web.ex file? Maybe something in there?