title: rails star rating system - ajaxful-rating
body: <p>I'm trying to implement a star rating system in my rails application. I've opted to use <a href="https://github.com/edgarjs/ajaxful-rating" rel="nofollow">ajaxful-rating</a> gem for this. </p>
  
  <ul>
  <li>I've installed the Gem</li>
  <li>I've ran the script</li>
  <li>I've added ajaxful_rateable to my gear model to enable rating them.</li>
  <li>I've added ajaxful_rater to my user model to enable rating other items.</li>
  </ul>
  
  <p>I'm not completely through the installation because I'm running into errors with the routes. I need to know what I'm doing wrong on the routes or database. From the instructions on the gem it didn't seem that I needed to augment the database except to cache the average rating. But I'm getting the following error when I try to access the view</p>
  
  <pre><code>Mysql2::Error: Table 'equiptme.rates' doesn't exist: SHOW FULL FIELDS FROM `rates`
  </code></pre>
  
  <p>Please help. My code is below.</p>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>  resources :gears, :member =&gt; {:rate =&gt; :post} do
      resources :calendars, :only =&gt; [:create, :destroy, :edit] 
      resources :comments, :only =&gt; [:create, :destroy] 
    end
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>        &lt;% @comments.each do |comment| %&gt;
              &lt;div style="width: 99%; min-height: 190px; margin-bottom: 30px; border-bottom: 1px dotted #DAD9D9;"&gt;
                    &lt;div style="width: 17%; float: left; overflow: hidden; margin-left: 10px; text-align: center; font-size: 14px; "&gt;
                      &lt;div class="gearcomments_userpic_container"&gt;&lt;%= image_tag comment.user.userimage.url(:comments), :class =&gt; "gearcomments_userpic" %&gt;&lt;/div&gt;&lt;/br&gt;
                      &lt;%= comment.user.name %&gt; 
                    &lt;/div&gt;
                    &lt;div style="width: 55%; float: left; margin-left: 10px; font-size: 13px;"&gt;
                      &lt;%= comment.body %&gt; 
                    &lt;/div&gt; 
                    &lt;div style="width: 15%; float: left; text-align: center;"&gt;
                       &lt;h4&gt;Overall Rating&lt;/h4&gt;&lt;/br&gt;
                       &lt;%= ratings_for @gear, :show_user_rating =&gt; true %&gt;
                       &lt;div&gt;&lt;/div&gt;&lt;/br&gt;
                       &lt;% # display delete link only for comments written by this particular user %&gt;
                       &lt;% if user_signed_in? and comment.user_id == current_user.id %&gt;
                           &lt;span&gt;&lt;%= link_to 'delete', gear_comment_path(@gear, comment), :confirm =&gt; 'Are you sure?', :method =&gt; :delete, :class =&gt; "" %&gt;&lt;/span&gt;
                       &lt;% end %&gt;          
                    &lt;/div&gt;
              &lt;/div&gt;       
          &lt;% end %&gt;
  </code></pre>
  
  <p><strong>Gear Model</strong></p>
  
  <pre><code>class Gear &lt; ActiveRecord::Base
    ...
    ajaxful_rateable :stars =&gt; 6, :allow_update =&gt; true
  end
  </code></pre>
  
  <p><strong>User Model</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base 
   ...
    ajaxful_rater
  end
  </code></pre>