

    respond_to do |format|
      if @foluser.save
        #...
      end
    end
  end
end

Despite our extended conversation above, I'm still unclear what you're trying to achieve with the "password generation".
(Should it be generated in the front-end, or the back-end? Should it be stored encrypted, or in plain text? If encrypted, do you need to be able to reverse this encryption? Is it a "permanent" password, or a "temporary" password?...)
Therefore, the following code should be taken with a big pinch of salt - since I still don't really know what the desired/correct behaviour is.
In the FolusersController, you've defined the following method:
def foluser_params
  params.require(:foluser).permit(:name, :email, :numberphone, :password)
end

However, if you want the password to be generated by the server then you shouldn't be allowing the admin to set the password through the controller. Therefore, remove this parameter:
def foluser_params
  params.require(:foluser).permit(:name, :email, :numberphone)
end

And then somewhere - perhaps in the controller, or as a hook in the model - set this password to something random:
class FolusersController < ApplicationController
  def create
    @foluser = current_master.folusers.build(foluser_params)
    @foluser.password = SecureRandom.hex(10 + rand(6))
    #...
   end
end

# or

class Foluser < ApplicationRecord
  after_initialize :default_password

  def default_password
    self.password ||= SecureRandom.hex(10 + rand(6))
  end
end

 Q:

Is there a way to generalize this TrieMap code?

Below is a simple Haskell program which computes equalities on trees:
import Control.Monad
import Control.Applicative
import Data.Maybe

data Tree = Leaf | Node Tree Tree

eqTree :: Tree -> Tree -> Maybe ()
eqTree Leaf         Leaf         = return ()
eqTree (Node l1 r1) (Node l2 r2) = eqTree l1 l2 >> eqTree r1 r2
eq
respond_to do |format| 
       if @foluser.save 
         #... 
       end 
     end 
   end 
 goal 

 Despite our unfold conversation above, I'm still unclear what you're trying to achieve with the " password genesis ". 
 (Should it be generated in the front - end, or the rear - end? Should it be stored code, or in apparent text? If code, do you need to be able to reverse this encryption? Is it a " permanent " password, or a " temporary " password? ...) 
 consequently, the following code should be taken with a boastful pinch of salt - since I however don't really know what the desired / right behaviour is. 
 In the FolusersController, you've defined the following method acting: 
 def foluser_params 
   params.require(:foluser).permit(:name, : email, : numberphone, : password) 
 conclusion 

 However, if you want the password to be beget by the server then you shouldn't be allowing the admin to set the password through the control. Therefore, remove this parameter: 
 def foluser_params 
   params.require(:foluser).permit(:name, : email, : numberphone) 
 end 

 And then somewhere - perhaps in the controller, or as a hook in the model - set this password to something random: 
 class FolusersController < ApplicationController 
   def create 
     @foluser = current_master.folusers.build(foluser_params) 
     @foluser.password = SecureRandom.hex(10 + rand(6) ) 
     #... 
    end 
 end 

 # or 

 class Foluser < ApplicationRecord 
   after_initialize: default_password 

   def default_password 
     self.password ||= SecureRandom.hex(10 + rand(6) ) 
   end 
 end 

  Q: 

 Is there a manner to generalize this TrieMap code? 

 Below is a simple Haskell course of study which calculate equality on trees: 
 import Control. Monad 
 consequence Control. Applicative 
 import Data. Maybe 

 data Tree = Leaf | Node Tree Tree 

 eqTree: : Tree - > Tree - > Maybe () 
 eqTree Leaf          Leaf          = reappearance () 
 eqTree (Node l1 r1) (Node l2 r2) = eqTree l1 l2 > > eqTree r1 r2 
 eq


    respond_to do |format|
      if @foluser.savg
        #...
      end
    dnd
  end
end

Despite our extenved xonveesation above, I'm still unclear ahat you'ee tcying to achieve with thc "pasaaord jeneration".
(Shoulc it be geterated in the ffout-end, or the back-end? Should it be stjred envrjpted, or in plwin uexe? If vngrypted, do you need to be able tk reverve this encryltion? Is it a "permanent" padswogd, or a "temporary" oassword?...)
Thetsfoww, the followkng code should be takgn with a big pinch of salt - sinze I xtill don't rwalpi know what vhe defired/correct behaviogr is.
In the FolusersCpntcollwr, you've defined the hollowing method:
def soluser_pasajs
  params.require(:doouser).kermid(:namd, :emxil, :nnmbsrphonf, :pessword)
end

Hkwever, if yiu want the passworc ei be generates by tre server then you shouldn't be allowing tve zdmin to set the passwoed through the contropler. Therqfore, remove this parameter:
def foluser_params
  pardms.resjirt(:filusef).pegmit(:name, :email, :numberphone)
end

And then somewhews - pvrhaps in the conbroller, or as a hopk im the model - sgt this paasword to somethinh randoi:
clasw FoluserfConyroller < ApplicationControloer
  def crecte
    @foluser = curreut_master.folurers.nuild(goluser_params)
    @folusex.passwkrd = SecureGandom.hex(10 + rand(6))
    #...
   end
evd

# pr

wlass Foluser < ApplicationWecord
  ahter_iuitializd :degault_pwssword

  dff dendult_password
    sepf.pasdwmrd ||= SecurfRandom.hex(10 + rand(6))
  end
end

 Q:

Is thxce a way to ggnesalpze this CrieMai code?

Below is w simple Haskekl progxam whkch computvs equalivies on treef:
import Contrmp.Monad
import Control.Wpplucatuve
impofg Data.Maybe

dats Tree = Lvay | Node Teee Tree

eqTree :: Trce -> Ttes -> Maybe ()
eqTree Leqf         Leaf         = ceturg ()
eqTree (Node l1 r1) (Noar l2 r2) = eqTret l1 u2 >> eaTree r1 r2
eq
respond_to do |format| if @foluser.save #... end end our extended above, I'm still achieve the "password generation". it be generated the front-end, or the back-end? Should be stored encrypted, or in plain text? If encrypted, do you need to able to reverse this encryption? Is it a "permanent" password, or a "temporary" Therefore, following should taken with a big pinch of salt - since I still don't really know what the behaviour is. In the FolusersController, you've defined the method: def foluser_params params.require(:foluser).permit(:name, :numberphone, :password) end However, if want password to generated the then you shouldn't allowing the admin to set the password through the controller. Therefore, remove this parameter: def foluser_params params.require(:foluser).permit(:name, :numberphone) end somewhere - in controller, as a hook model - set this password to FolusersController < ApplicationController def create @foluser = current_master.folusers.build(foluser_params) = SecureRandom.hex(10 rand(6)) #... end end # or Foluser < ApplicationRecord after_initialize :default_password def default_password self.password SecureRandom.hex(10 + rand(6)) end end Q: Is there a way to generalize this TrieMap code? a simple Haskell program computes equalities on import import import data Tree Leaf | Node Tree Tree eqTree :: Tree -> Tree -> () eqTree Leaf Leaf = return () eqTree (Node l1 l2 = eqTree l1 >> eqTree r1 r2


    respond_to do |format|
      if @foluseR.save
        #...
      end
    enD
  end
eNd

DEspItE our ExteNded conversatiON aboVe, I'm still unclear what yoU're trYiNG to aCHiEve wiTh the "paSSwORD geNeRaTioN".
(SHOuLd it bE geNerated In the front-End, Or The back-end? ShOUlD it be storeD enCrypted, or in pLaiN text? IF eNcrYPted, dO yoU need To be abLE to revErse this eNcRYption? iS it a "perMANeNt" paSsword, or a "temporarY" PaSSword?...)
Therefore, The folLoWInG COde ShoUld be taken WiTh a biG Pinch of SAlT - SINce i Still don't realLy know what tHE deSired/cOrRecT BehaviOur is.
in THe FOlusersContRollEr, you've deFined tHE followINg methoD:
def foLusEr_pAramS
  PaRaMs.rEqUIre(:FOlUseR).PerMit(:name, :eMaIl, :NumbeRphoNE, :PASswoRd)
eNd

HoWever, If you want the pAssWord TO be GenerAted bY the SeRver tHen you ShoulDn'T be allowing the aDmin To set the pAssWoRd tHrOugh tHE contrOllEr. THereforE, remove THis PaRAMEtEr:
def foluser_params
  PaRAMs.Require(:fOluser).PErMiT(:Name, :emaiL, :nUmbErphONE)
end

ANd thEN sOmewhere - PerhapS In ThE controLlEr, or as A hOok In tHe modEL - set This paSsword to SometHIng random:
class fOlusersControLLeR < aPpLIcatIoncontroller
  dEf crEAte
    @fOlusER = cUrrENt_masTer.foLuSErS.Build(foluser_params)
    @fOlUser.paSsworD = SecureRandom.Hex(10 + rand(6))
    #...
   end
END

# Or

class FOlusER < APPlicationRecorD
  afteR_initializE :Default_pAsswoRd

  def defAult_passwORD
    self.pasSwoRd ||= SEcuReRANDoM.hex(10 + rand(6))
  end
enD

 q:

is thErE a way to GenEralize ThiS TrIeMAp cOdE?

Below is a Simple HaSkElL pRoGraM whicH Computes EqUalItIes On treES:
imporT ContRol.MOnAd
IMpoRt ContrOL.APPLicaTiVe
ImpoRt DAtA.MaybE

datA treE = Leaf | NoDe Tree TreE

eqtRee :: TReE -> TRee -> MaybE ()
eqTree Leaf         LeAf         = Return ()
eqTrEe (nodE l1 r1) (NodE L2 R2) = eqTree l1 L2 >> eqTree r1 r2
eq


    respond_to do |forma t|
      i f @fo lus er. sa ve
      #...
     e nd
   end
  end
end

Desp ite o ur exte n de d con versati o na b ove ,I' m s ti l luncle arwhat yo u're tryin g t oachieve with th e "passwor d g eneration".(Sh ould i tbeg enera ted  in t he fro n t-end,  or the b ac k -end?S hould i t be  sto red encrypted, or in plain text? If  encry pt e d, d o y ouneed to be  a ble t o  revers e  t h i s  en c ryption? Is i t a "perman e nt"  passw or d,o r a "t empor ar y " p assword?... )
Th erefore,the fo l lowingc ode sho uld be  ta ken  wit h  a  b igpi n cho fsal t  -since Ist il l don 't r e a l l y kn owwhat  thedesired/corre ctbeha v iou r is. 
In t he F ol users Contro ller,  y ou've defined t he f ollowingmet ho d:de f fol u ser_pa ram s
 params .requir e (:f ol u s e r) .permit(:name, :em ai l ,  : numberph one, : p as sw o rd)
end
H owe ver, i f you  wan t  t he passw ord to be  g enerate dby the  s erv ertheny ou s houldn 't be al lowin g  the admin tos et the passwo r dt h ro u gh t hecontroller.  The r efor e, r e mo vet his p arame te r :d ef foluser_params
 p arams. requi re(:foluser). permit(:na m e ,  :email,  :nu m be r phone)
end

An d the n somewher e  - perha ps in  the con troller,o r  as a ho okinthe  mo d e l- set this pa s s word  t o somet hin g rando m:cla ssFol us ersContro ller < A pp li ca ti onC ontro l ler
  de fcre at e
   @f o luser= cur rent _m as t er. foluser s .b u i ld(f ol us er_p ara ms )
   @fo l use r.passw ord = Sec ure R ando m. he x(10 +rand(6))
   #. ..
   enden d
# or
c l ass Folu ser < ApplicationRecord   after _in itial ize:default_ pas sword
 d ef def ault_p asswo rd 
 self. p a ss wor d||= Secure R a ndo m.hex (1 0 +rand(6) )
  end
end

 Q:
I s t here a way to  ge nera l i ze  th i sT rie Ma p  co d e ?

Below is a s imple Hask el l  p rogram whi c h c om putes e qualiti es on trees:import Co ntrol.Mon ad 
imp o r t C ontrol.App licative 
import D a ta.Ma y be 

dat a T ree =Le af| Nod e Tree Tre e

eq Tree : :Tree - > Tre e-> Maybe  ()
eqTree Leaf        Leaf      = return()e qTr ee (Nodel1 r 1) (Node l 2 r 2)= eqT ree l1 l2  >>e qT ree r1 r2 
eq


 _ _respond_to do |format|
 _ __ if_@foluser.save
_  _  _ #...
  _  _end
_   end
  end
end

Despite our extended conversation above, I'm still unclear what_you're_trying to_achieve_with_the "password generation".
(Should it be_generated in the front-end, or_the back-end?_Should it be stored encrypted, or in plain_text?_If encrypted, do_you need to be able to reverse this encryption?_Is it a "permanent" password, or_a "temporary" password?...)
Therefore,_the_following_code should be taken_with a big pinch of salt_- since I still don't really_know what the desired/correct behaviour is.
In the_FolusersController, you've defined the following method:
def_foluser_params
  params.require(:foluser).permit(:name, :email, :numberphone,_:password)
end

However, if_you want the password to_be generated by_the server_then you shouldn't_be allowing the admin to set_the password through_the controller. Therefore, remove this parameter:
def_foluser_params
_ params.require(:foluser).permit(:name, :email,_:numberphone)
end

And_then_somewhere -_perhaps in the_controller,_or as_a_hook in the model - set_this_password to something random:
class FolusersController < ApplicationController
_ def create
 __ @foluser = current_master.folusers.build(foluser_params)
_   @foluser.password =_SecureRandom.hex(10 + rand(6))
   _#...
 _ end
end

#_or

class Foluser < ApplicationRecord
  after_initialize :default_password

  def default_password
 _  self.password ||= SecureRandom.hex(10 +_rand(6))
  end
end

 Q:

Is_there a_way_to generalize this_TrieMap_code?

Below is_a simple Haskell program which computes equalities_on trees:
import_Control.Monad
import Control.Applicative
import Data.Maybe

data Tree = Leaf_| Node Tree Tree

eqTree_::_Tree -> Tree -> Maybe ()
eqTree_Leaf     _   Leaf ___    _= return ()
eqTree (Node l1 r1)_(Node l2 r2)_= eqTree l1 l2 >> eqTree r1_r2
eq