Skip to content

Commit

Permalink
Update Working_With_Genie_Apps.md
Browse files Browse the repository at this point in the history
* Books.lj
- attributes of the mutable struct need two double brakets for a blank string ("")
- internal function seed() was not finding the Searchlight package

* initializer searchlight.jl
- changed to mirror the code I have in my application (I am assuming the application code is more "up to date" than the docs)
  • Loading branch information
marco-zanon authored Jun 3, 2020
1 parent d75f167 commit 16fbb4f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions docs/guides/Working_With_Genie_Apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,15 +708,15 @@ Edit the `Books.jl` file to make it look like this:
# Books.jl
module Books
import SearchLight: AbstractModel, DbId
import SearchLight: AbstractModel, DbId, save!
import Base: @kwdef
export Book
@kwdef mutable struct Book <: AbstractModel
id::DbId = DbId()
title::String = "
author::String = "
title::String = ""
author::String = ""
end
end
Expand All @@ -740,7 +740,7 @@ function seed()
]
for b in BillGatesBooks
Book(title = b[1], author = b[2]) |> SearchLight.save!
Book(title = b[1], author = b[2]) |> save!
end
end
```
Expand All @@ -752,9 +752,16 @@ Now, to try things out. Genie takes care of loading all our resource files for u
```julia
using SearchLight
SearchLight.Configuration.load()
eval(Meta.parse("using SearchLight$(SearchLight.config.db_config_settings["adapter"])"))
SearchLight.connect()
try
SearchLight.Configuration.load()
if SearchLight.config.db_config_settings["adapter"] !== nothing
eval(Meta.parse("using SearchLight$(SearchLight.config.db_config_settings["adapter"])"))
SearchLight.connect()
end
catch ex
@error ex
end
```

---
Expand Down

0 comments on commit 16fbb4f

Please sign in to comment.