Update Autocomplete suggestion list?

Background:

1. I created a project from the command line.
2. I created a scaffold for a model "Product" from the command line.
3. I ran db:migrate from the command line.
4. I  imported the project into RubyMine (v1.1.1).
4. I created a migration from the command line to add a "price" column to the "Product" model .
5. I again ran db:migrate from the command line.

While RM is able to autocomplete the "Product" model's attributes defined during scaffold generation ("title", "description", "image_url"), it does not show the "price" attribute in autocomplete. How can I tell RM to update the autocomplete suggestion list?

Thanks

- Sarah K

0

Hello,

RM should automatically reparse migration files in this case.
1. At first try to edit your migration file, e.g. comment whole file and uncomment it. Then wait 2-3 seconds and try autocompletion again
2. If the previous instruction doesn't help then try to reopen project
3. If 2,3 don't help then show us you migration file for "price"

0
Avatar
Permanently deleted user

Hi Roman,

Thanks for your reply. I have noticed that the autocomplete does work in certain areas and not in others.


It appears to work in the model when i add validation, eg: "validates_presence_of" autocompletes with ":title", ":description", ":image_url" & ":price".


It also appears to work in a view when using an instance variable, eg:

<p>
  <b>Title:</b>
  <%=h @product.xxx %>
</p>


Where autocomplete suggests "title", "description", "image_url" & "price" for the attribute.


It does not work where there is an iterator (eg, in index.html.erb):

<% @products.each do |product| %>
  <tr>
    <td><%=h product.title %></td>
    <td><%=h product.description %></td>
    <td><%=h product.image_url %></td>
    <td><%=h product.xxx %></td>
  </tr>
<% end %>


Autocomplete will complete "title", "description", "image_url" but not "price".

I've tried everything you posted above but this did not appear to help

Thanks for your help,

Sarah

P.S. Here is my migration:

class AddPriceToProduct < ActiveRecord::Migration
  def self.up
    add_column :products, :price, :decimal,
               :precision => 8, :scale => 2, :default => 0
  end

  def self.down
    remove_column :products, :price
  end
end

0

请先登录再写评论。