samedi 14 août 2021

How can I display country code and last 3 digits of phone number in Ruby on Rails views?

I am a beginner in RoR. This is original phone number +77123456999

I am going display it as +77xxxxxx999

here is my index.html.erb file codes.

`

<tbody>
    <% @users.each do |user| %>
        <tr>
            <td>
                <%= user.username %>
            </td>
            <td>
                <%= user.phone %>
            </td>
            <td>
                <%= user.email %>
            </td>
            <td>
                <%= user.state %>
            </td>
        </tr>
    <% end %>
</tbody>

`

the value of user.phone is +77123456999 How can I change is as I want?

Aucun commentaire:

Enregistrer un commentaire