Ruby on Rails显示imdb星级评级

时间:2015-01-21 11:55:17

标签: ruby-on-rails ruby ruby-on-rails-3 imdb

我在rails应用程序上有一个ruby,在index.html.erb页面上循环播放每部电影以显示标题,图像,导演等。我想要做的是将电影的imdb等级显示为好。有没有办法可以做到这一点?

index.html.erb:

<% @films.each do |film| %>
        <% if film.release_date < Date.today %>
        <div class='large_panel'>
            <%= image_tag film.image_url,:size => "900x200" %>
            <h1><%= film.title %></h1>
             <div class="bbfc-icons">
                <img src="/images/bbfc/15.png" alt="15" height="40" width="40">
            </div>

            <div class="clearfix">
            </div>  
            <div>
                <div class='film_info_two_column_left wider'>
                    <div class="allShowtimes large_txt">
                        Continues Friday 16th January - Thursday 5th February
                    </div>
                </div>

                <div class='film_info_two_column_right whatsonpgae'>
                    <div class="allShowtimes">
                        <%= link_to 'Show', film_path(film) %>&nbsp;&nbsp;&nbsp;<%= link_to 'Edit', edit_film_path(film) %>
                        </div>
                </div>

                <div class='clearfix'></div>
            </div>
        </div>
<% end %>

1 个答案:

答案 0 :(得分:0)

This gem应该是从IMDB获取数据所需的全部内容。

此外,您可以使用ratyrate获取评分的样式。