Difficulties understanding store interactions between client and server

Hello,

So I am trying to develop a custom plugin for my community. I have followed the tutorials for developing a plugin by @eviltrout and the tutorials still miss important information about communicating between the frontend and backend. I read that everything is ajax calls, but I have found a plugin example that I cannot understand.

I am looking at this Notebook plugin.
So I understand the server routes and the client controller. What I cannot understand is how are the server routes called, even if there are no ajax calls.

I think it has something to do with the RestModel that the note model extends.
Still I cannot find the implementantion that specifies what routes you have to define in the server so that the store in ember can use.

I would greatly appreciate any help!

1 Like

Also, the server routes are defined in plugin.rb and reading from this post, I expected to see some calls to {route}.json from ember, but nothing.

I guess there is a wrapper somewhere in the discourse services, but I cannot find it.

Do you need to add data to a new rails model, or are you adding stuff to existing ones? You can, for example, add_to_serializer.

It might help to share more details about what you’re trying to accomplish.

First of all, I want to understand how the mechanism works. And I am referring to how does the store in ember.js call endpoints in rails.

Rails puts stuff in json that gets loaded by ember.

For me it’s easier to try to accomplish something and understand what’s required to accomplish that rather than understand the whole first.

You can read books on ember and rails if you want to understand it all.

I read a book on rails, which gave me some understanding of that. The ember side had taken me a long while to make any sense at all of ember.

1 Like