Rails views and emberjs views


(Tom) #1

I am wondering what happens after the rails aplication run through its controllers and finally renders its views

for example

    <% if @category %>
  <h1>
    <% if @category.parent_category %>
    <%= link_to @category.parent_category.url, itemprop: 'item' do %>
      <span itemprop='name'><%= @category.parent_category.name %></span>
    <% end %>
    &nbsp;
    <% end %>
    <%= link_to @category.url, itemprop: 'item' do %>
      <span itemprop='name'><%= @category.name %></span>
    <% end %>
  </h1>
  <br/>
<% end %>

Which is definitly not the final HTML code.
I know it gets proccessed by emberjs
what actually happend in ember.js?

THanks


(Robin Ward) #2

You are looking at the code that we serve up for crawlers. It is not presented when viewing via a javascript client.

There’s honestly a lot you probably need to learn before understanding how this works. I’d start with the ember guides and then take another look at the HTML our application serves up :smile:


(Mittineague) #3

Don’t use the browsers “view-source” use the browsers dev tools “inspect” (and other features - note, you may need to install an “Ember” addon for more benefit)

For example - Firefox (Chrome and IE have similar)

.


(Tom) #4

So the ember app fires its ajax to /about.json(takes the /about route as example) and render its view via the ember template system rather than the rails template system

And the rails template occurs only when javascript is disabled (EX:crawler)

Am i right? thanks


(Robin Ward) #5

Yes that is the general gist of it.