Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't show proper code to the purposed changes #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/docs/guide/services.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Edit `grails-app/controllers/org/grails/guides/VehicleController.groovy` (the sc
[source,groovy]
.grails-app/controllers/org/grails/guides/VehicleController.groovy
----
include::{sourceDir}/grails-app/controllers/org/grails/guides/scaffolding/VehicleController.groovy[indent=0,lines="6..11"]
include::{sourceDir}/grails-app/controllers/org/grails/guides/scaffolding/VehicleController.groovy[indent=0,lines="11..15"]
----
<1> By simply defining a property in our controller with the same name as our service class, Grails will inject a reference to the service for us.

Expand All @@ -63,7 +63,7 @@ Now (still editing `VehicleController.groovy`), modify the `show` action as seen
[source,groovy]
.grails-app/controllers/org/grails/guides/VehicleController.groovy
----
include::{sourceDir}/grails-app/controllers/org/grails/guides/VehicleController.groovy[indent=0,lines="18..20"]
include::{sourceDir}/grails-app/controllers/org/grails/guides/VehicleController.groovy[indent=0,lines="20..24"]
----

We've added new property to the `model`, called `estimatedValue`. The value of this property is the result of calling our service method, `getEstimate`, to which we pass the `vehicle` property we are about to render.
Expand All @@ -77,4 +77,4 @@ include::{sourceDir}/grails-app/views/vehicle/show.gsp[indent=0,lines="17..20"]
----
<1> `<g:formatNumber>` is another GSP tag which provides many useful options for rendering numbers, including currency and decimal precision. See the http://docs.grails.org/latest/ref/Tags/formatNumber.html[Grails documentation] for more.

Restart the application and browse to the show page for a `Vehicle`, such as `http://localhost:8080/vehicle/show/1`. You should see the "Estimated Value" on the page
Restart the application and browse to the show page for a `Vehicle`, such as `http://localhost:8080/vehicle/show/1`. You should see the "Estimated Value" on the page