-
Notifications
You must be signed in to change notification settings - Fork 12
Some problem when follow this tuto. #7
Description
Following just the summarize discuss in gitter:
Following is toto error:
-
get '/(*other)', to: 'hyperloop#app', which introduce in Chapter 7, should mention in Chapter 1, other, rails route not worked, I do this myself when follow this tuto, but others maybe not.
-
after rails g hyperloop:install, and then copy application_record.rb into app/hyperloop/models, that not work,
uninitialized constant ApplicationRecord, the solution is: addconfig.import 'models/application_record'intoconfig/initializers/hyperloop.rb, and rm tmp/cache, then worked.
this step is done in this project, but when follow tuto, no where told us.
Follow is some advice for hyperloop
Following usage i think is error-prone.
EditItem(todo: params.todo).on(:save, :cancel) { mutate.editing false }
In most case, :save, :cancel should be browser internal event,
If we use a event like this but name conflict with this, what happen?
and, use param to define a event is very strange for me.
I think a better idea is: (two selection)
- Not use
onmethod, not conflict with browser event, you just hope yield
one behavior only, use a name other thanonis better, or, just simple:
# replace EditItem(todo: params.todo).on(:save, :cancel) { mutate.editing false }
# with
EditItem(
todo: params.todo,
on_save: proc { mutate.editing false },
on_cancel: proc { mutate.editing false }
)
# and invoke it like this:
params.on_save.call- Not use
paramto declare a event. e.g.
def event(name)
# detect all browser internal support event name, if conflict, raise a error.
param name, type: Proc
end
event :on_saveI think first solution is better, because params.on_save is just like usual param,
it just use logic instead of a variable.