Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Some problem when follow this tuto. #7

@zw963

Description

@zw963

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: add config.import 'models/application_record' into config/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 on method, not conflict with browser event, you just hope yield
    one behavior only, use a name other than on is 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 param to 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_save

I think first solution is better, because params.on_save is just like usual param,
it just use logic instead of a variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions