If a model exist that matches "Schedule" is used within the component. It will not work:
module Components
module Schedule
class Index < React::Component::Base
before_mount do
@schedules = Schedule.all
end
def render
ul do
@schedules.each do |schedule|
li { schedule.title }
end
end
end
end
end
end
What happens is that the Schedule.all tries to use the Component method instead of the reactiverecord model.
index:260 Exception raised while rendering #<Components::Schedule::Index:0x2f6>
at Opal.defs.TMP_1 [as $new] (<eval>:24540:15)
at module_constructor.ːmethod_missing (<eval>:23097:54)
at module_constructor.method_missing_stub [as $all] (<eval>:20693:35)
at $Index.$a.$$p.TMP_1 (<eval>:85402:56)
at $Index.ːinstance_exec (<eval>:23026:24)
at ːrun_callback.$b.$$p.TMP_2 (<eval>:61709:88)
at Opal.yield1 (<eval>:20885:14)
at Array.ːeach (<eval>:30895:26)
at $Index.ːrun_callback (<eval>:61712:64)
at ːcomponent_will_mount.$a.$$p.TMP_8 (<eval>:63038:23)
I think that documentation may be sufficient to resolve this issue in the future or perhaps an error thrown during generating the original component if a model already exists with the same name.
While creating a component using
If a model exist that matches "Schedule" is used within the component. It will not work:
What happens is that the Schedule.all tries to use the Component method instead of the reactiverecord model.
I think that documentation may be sufficient to resolve this issue in the future or perhaps an error thrown during generating the original component if a model already exists with the same name.