sfractal
Programming Phoenix LiveView: error: redefine live_session (page 52-54)
I entered the code on page 52 establishing a new authenticated route and it won’t compile. I get:
$ iex -S mix phx.server               
Compiling 1 file (.ex)
== Compilation error in file lib/pento_web/router.ex ==
** (RuntimeError) attempting to redefine live_session :require_authenticated_user.
live_session routes must be declared in a single named block.
    (phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/router.ex:274: Phoenix.LiveView.Router.__live_session__/3
    lib/pento_web/router.ex:78: (module)
Looking in router, I see phx.gen.auth added another line with similar name
    live_session :require_authenticated_user,
      on_mount: [{PentoWeb.UserAuth, :ensure_authenticated}] do
      live "/users/settings", UserSettingsLive, :edit
      live "/users/settings/confirm_email/:token", UserSettingsLive, :confirm_email
    end
Don’t know if that is issue or if it is something I’m doing wrong.
Any help appreciated.
First Post!
sfractal
Duh! Looking closer - it looks like same code. Maybe I was just supposed to add the one line to the lines already there instead of making a new block. Operator error on my part.
Popular Pragmatic Bookshelf topics
                        
                      
                      
                Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: 
bundle exec sequel...
              
            
            
          
              New
                Hello Brian, 
I have  some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
              
            
            
          
              New
                I ran this command after installing the sample application: 
$ cards add do something --owner Brian 
And got a file not found error: 
Fil...
              
            
            
          
              New
                @noelrappin 
Running the webpack dev server, I receive the following warning: 
ERROR in tsconfig.json 
TS18003: No inputs were found in c...
              
            
            
          
              New
                Title: Build a Weather Station with Elixir and Nerves: Problem connecting to Postgres with Grafana on  (page 64) 
If you follow the defau...
              
            
            
          
              New
                Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
              
            
            
          
              New
                Hi all, 
currently I wonder how the Tailwind colours work (or don’t work). 
For example, in app/views/layouts/application.html.erb I have...
              
            
            
          
              New
                Title: Agile Web Development with Rails 7: (page 70) 
I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
              
            
            
          
              New
                I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20:  “Update activity...
              
            
            
          
              New
                I’ve got to the end of Ch. 11, and the app runs, with all tabs displaying what they should – at first.  After switching around between St...
              
            
            
          
              New
Other popular topics
                        
                      
                      
                @AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. 
https://f...
              
            
            
          
              New
                I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
              
            
            
          
              New
                I’ve been really enjoying obsidian.md: 
 
It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
              
            
            
          
              New
                Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
              
            
            
          
              New
                Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: 
asdf install erlang 23.1.2
Configure failed.
checking ...
              
            
            
          
              New
                Saw this on TikTok of all places! :lol: 
Anyone heard of them before? 
  
    
  
Lite:
              
            
            
          
              New
                If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: 
bre...
              
            
            
          
              New
                Was just curious to see if any were around, found this one: 
I got 51/100: 
  
Not sure if it was meant to buy I am sure at times the b...
              
            
            
          
              New
                Big O Notation can make your code faster by orders of magnitude. Get the hands-on info you need to master data structures and algorithms ...
              
            
            
              
          
              New
                Develop, deploy, and debug BEAM applications using BEAMOps: a new paradigm that focuses on scalability, fault tolerance, and owning each ...
              
            
            
              
          
              New
Categories:
Sub Categories:
Popular Portals
- /elixir
 - /rust
 - /ruby
 - /wasm
 - /erlang
 - /phoenix
 - /keyboards
 - /python
 - /rails
 - /js
 - /security
 - /go
 - /swift
 - /vim
 - /clojure
 - /haskell
 - /emacs
 - /java
 - /svelte
 - /onivim
 - /typescript
 - /kotlin
 - /c-plus-plus
 - /crystal
 - /tailwind
 - /react
 - /gleam
 - /ocaml
 - /elm
 - /flutter
 - /vscode
 - /ash
 - /html
 - /opensuse
 - /centos
 - /php
 - /zig
 - /deepseek
 - /scala
 - /lisp
 - /textmate
 - /sublime-text
 - /react-native
 - /nixos
 - /debian
 - /agda
 - /kubuntu
 - /arch-linux
 - /django
 - /deno
 - /revery
 - /ubuntu
 - /manjaro
 - /nodejs
 - /spring
 - /diversity
 - /lua
 - /julia
 - /slackware
 - /c
 
    





