blog

How To Use Image_tag In Rails With Mustache Template

Recently I have been working on one rails project, In which I have used Mustache.js.

Moustache is a logic-less template used for client-side dynamic template rendering.

You can check this link, Mustache, for more details.

As a rails developer, it’s common to use image_tag for displaying images in rails, so I preferred to use image_tag for displaying images.

So when I tried using image_tag with a mustache, I was surprised!! Why? Because that image_tag was not working as expected. So I thought something was wrong with image_tag. And then, I read more details about image_tag.

See below code…(In which image_tag was not working)

app/assets/javascripts/sample.coffee

app/views/sample.html.slim

After using the above code, I got compiled version of image_tag as below.Then I realized that image_tag is compiled at the server-side & then it sends compiled(html tag) to the client-side. But the mustache template is collected on the client-side. So the…

amoludage's avataramoludage

Recently I have been working on one rails project, In which I have used Mustache.js.

Mustache is a logic-less template which is used for client side dynamic template rendering.

You can check this link Mustache for more details.

As I’m rails developer it’s common to use image_tag for displaying images in rails, so I preferred to use image_tag for displaying images.

So when I was trying to use image_tag with mustache, I was surprised!! Why? Because, that image_tag was not working as expected. So I thought something is wrong with image_tag. And then I read more details about image_tag.

See below code…(In which image_tag was not working)

app/assets/javascripts/sample.coffee

app/views/sample.html.slim

After using above code I got compiled version of image_tag as below.

Then I realized that image_tag is compiled at server side & then it sends compiled(html tag) to the client side. But mustache template is compiled at client side. So the…

View original post 97 more words

ProTips: Elastic Search & Rails

In this blog post, I will not tell you how to set up an elastic search with Rails. There are plenty of blog posts available for that, and I referred to this blog post, to begin with, elastic search and rails.

In this blog post, I will be showing how to set the “ignore malformed” option. This may sound trivial, but unfortunately, the usage is neither in the ES-rails documentation, nor I could find any content on the web.

I spent a few hours digging into the ES-rails code and deciphered it. I hope this helps you save time.

PROBLEM

Recently we started using elastic search in our project. One of the tables had around 9 Million records. After configurations/settings, we started the indexing. Monitored a few thousand records, and indexes were correctly getting generated. However, in the end, the indexing of 5k documents failed. I was puzzled. Why only…

Shweta Kale's avatarLearn with fun

In this blog post I am not going to tell you about how to setup elasticsearch with Rails. There are plenty of blog posts available for that. I referred this blog post to begin with elastic search and rails.

In this blog post, I will be showing how to set “ignore malformed” option. This may sound trivial but unfortunately the usage is neither in the ES-rails documentation nor I could find any content on the web.

I spent a few hours digging in the ES-rails code and finally deciphered it. Hope this helps you save the time.

Problem

Recently we started using elastic search in our project. One of the table had around 9 Million records. After configurations/setting we started the indexing. Monitored a few thousand records and indexes were correctly getting generated. However, at the end found out that the indexing of 5k records failed.  I was puzzled, why only…

View original post 566 more words