Skip to content

Commit 5cfc416

Browse files
author
Matthew Saginario
committed
fixed policy generator, install doc
1 parent 5f0e76c commit 5cfc416

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

docs/installation/installation.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Add the rails-hyperstack gem to your Gemfile, and then bundle install. This can
3232
bundle add 'rails-hyperstack', --version "~> 1.0.alpha1.0"
3333
```
3434

35-
> If you want to use the unreleased edge branch your gem specification will be:
35+
> If you want to use the unreleased edge branch your gem specification will be:
3636
```ruby
3737
gem 'rails-hyperstack',
3838
git: 'git://github.com/hyperstack-org/hyperstack.git',
@@ -113,9 +113,9 @@ The following subdirectories are standard:
113113
app/
114114
...
115115
hyperstack/
116-
components/
117-
models/
118-
operations/
116+
components/
117+
models/
118+
operations/
119119
stores/
120120
shared/
121121
lib/
@@ -158,8 +158,8 @@ class HyperComponent
158158
param_accessor_style :accessors
159159
end
160160
```
161-
> Note: You can override the base class name using the `--base-class` switch:
162-
> For example if you prefer ApplicationComponent rather than HyperComponent
161+
> Note: You can override the base class name using the `--base-class` switch:
162+
> For example if you prefer ApplicationComponent rather than HyperComponent
163163
```bash
164164
bundle exec rails g hyper:component Test --base-class=ApplicationComponent
165165
```
@@ -200,7 +200,7 @@ and override the default layout
200200

201201
For example
202202
```erb
203-
<% render_component 'Dashboard', user: @user %>
203+
<%= react_component 'Dashboard', user: @user %>
204204
```
205205
> Note that you may have several component trees mounted in a single page using the `render_component` helper. While this is not typical for a clean sheet Hyperstack design, it is useful when mixing Hyperstack with legacy applications.
206206
@@ -253,7 +253,7 @@ various routing methods.
253253

254254
> Note that in a large app you may have several single page apps working together,
255255
along with some legacy routes.
256-
In such an application the router structure might look like this:
256+
In such an application the router structure might look like this:
257257
```ruby
258258
Rails.application.routes.draw do
259259
... # legacy routes
@@ -332,7 +332,7 @@ Webpacker uses manifests to determine how to package up assets. Hyperstack depe
332332
>
333333
> This means that page load time is comparable to any other Rails view, and that Rails can cache the pages like any other view.
334334
>
335-
> But to make this work packages that rely on the `browser` object cannot be used during prerendering. Well structured packages that depend on the `browser` object will have a way to run in the prerendering environment.
335+
> But to make this work packages that rely on the `browser` object cannot be used during prerendering. Well structured packages that depend on the `browser` object will have a way to run in the prerendering environment.
336336
337337
These two files look like this and are placed in the `app/javascript/packs` directory:
338338
```javascript
@@ -464,7 +464,7 @@ policies for legacy parts of your system.
464464

465465
#### Moving the `application_record.rb` File.
466466

467-
Once you have a basic Policy defined the client can access your Rails models. For your ActiveRecord model class definitions to be visible on the client you need to move them to the `app/hyperstack/models` directory. This directory (along with `app/hyperstack/operations` and `app/hyperstack/shared`) are *isomorphic* directories. The code in these directories will be accessible on both the client and the server.
467+
Once you have a basic Policy defined the client can access your Rails models. For your ActiveRecord model class definitions to be visible on the client you need to move them to the `app/hyperstack/models` directory. This directory (along with `app/hyperstack/operations` and `app/hyperstack/shared`) are *isomorphic* directories. The code in these directories will be accessible on both the client and the server.
468468
> Moving the files is necessary both because of the way Rails is structured, but its also very useful when evolving legacy systems to Hyperstack. Until a class
469469
definition is moved to the `hyperstack/models` directory it will be ignored by Hyperstack.
470470

@@ -537,14 +537,14 @@ bundle exec hyperstack-hotloader -p 25222 -d app/hyperstack
537537
This will tell the Hotloader to use port 25222, and to scan the
538538
`app/hyperstack` directory.
539539

540-
> If for some reason you cannot use port 25222 you can change it, but you need to also configure this in the Hyperstack initializer file:
540+
> If for some reason you cannot use port 25222 you can change it, but you need to also configure this in the Hyperstack initializer file:
541541
```ruby
542542
...
543543
config.hotloader_port = 12345 # override default of 25222
544544
...
545545
```
546546

547-
Now that the Hotloader is running, you can start your Rails server the normal way, and refresh your browser page.
547+
Now that the Hotloader is running, you can start your Rails server the normal way, and refresh your browser page.
548548
You should now see `require 'hyperstack/hotloader' # CLIENT ONLY` added to the manifest,
549549
and you will also see a message indicating that your browser has connected to the Hotloader.
550550

@@ -629,7 +629,7 @@ Hyperstack.configuration do |config|
629629
config.import 'path/to/file', client_only: true # but only in the client manifest
630630
config.import 'path/to/file', server_only: true # but only on the server_only manifest
631631

632-
# The cancel_import directive removes an import. This is used when we replace
632+
# The cancel_import directive removes an import. This is used when we replace
633633
# assets from the rails side with those loaded by webpacker
634634
config.cancel_import 'path/to/file'
635635
end

ruby/rails-hyperstack/lib/generators/hyperstack/install_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def install_webpacker
113113

114114
def create_policies_directory
115115
return if skip_hyper_model?
116-
policy_file = File.join('app', 'hyperstack', 'models', 'application_record.rb')
116+
policy_file = File.join('app', 'policies', 'application_policy.rb')
117117
unless File.exists? policy_file
118-
create_file 'policy_file', <<-RUBY
118+
create_file policy_file, <<-RUBY
119119
# #{policy_file}
120120
121121
# Policies regulate access to your public models

0 commit comments

Comments
 (0)