2

I think I already know the answer to this, but I'm going to ask it anyway.

I've got a rails app, and integrating angular into one of the areas of the app to get some of that magic. To add to the mix I'm integrating the Chewy gem to use ElasticSearch.

So, using this example:

I have a Presentation model with the following fields:

  1. id
  2. venue id
  3. presentation id
  4. rating

I have a Presentations view with loops through a Presentation partial and I'm doing essentially the same thing with Angular and I'm looping through a Presentation directive.

Now, with normal ERB when I pull a list of presentations in the ERB view I could just have: <%= presentation.venue.name %> to show the venue's name.

What I'm wondering is, and like I said I think I already know the answer to this, going the angular route through this when I'm looping through my Presentation directive, even though it's an _presentation.html.erb file I can't use the active record relation because javascript get's rendered after the html.

So, in my angular directive template, where instead I would have presentation.venue.name I would need to have an angular function that would pull that in, right?

Is there some way, when I'm pulling the data in through ElasticSearch/Chewy I could pull this data in as well? That's my only other option I believe?

Mauricio Moraes
  • 7,255
  • 5
  • 39
  • 59
Jason Shultz
  • 940
  • 1
  • 19
  • 36

0 Answers0