Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid predicate #22

Closed
lunks opened this issue Sep 3, 2011 · 4 comments
Closed

Invalid predicate #22

lunks opened this issue Sep 3, 2011 · 4 comments

Comments

@lunks
Copy link

lunks commented Sep 3, 2011

Hello, I've got a form field like this:

    <%= search_form_for @q, :url => dashboard_index_path do |f| %>
      <%= f.grouping_fields @q do |f| %>
        <%= f.hidden_field_tag :or, 'or' %>
        <%= f.text_field :status_signal_strength_gt %>
        <%= f.text_field :status_signal_strength_lt %>
        <%= f.text_field :status_battery_level_gt %>
        <%= f.text_field :status_battery_level_lt %>
        <%= f.text_field :status_sd_card_gt %>
        <%= f.text_field :status_sd_card_lt %>
        <%= f.text_field :status_application_gt %>
        <%= f.text_field :status_application_lt %>
        <%= f.text_field :status_available_ram_mem_gt %>
        <%= f.text_field :status_available_ram_mem_lt %>
      <% end %>
      <%= f.grouping_fields @q do |f| %>
        <%= f.hidden_field_tag :any, 'any' %>
        <%= f.select :status_network_name %>
        <%= f.text_field :status_network_type %>
        <%= f.text_field :gadget_name %>
        <%= f.text_field :gadget_model_name %>
        <%= f.text_field :gadget_model_type_name %>
      <% end %>
      <%= f.submit %>

@q is associatiated with telepone, which has a status.

Status schema is:

  create_table "statuses", :force => true do |t|
    t.integer  "company_id"
    t.integer  "telephone_id"
    t.decimal  "battery_level"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "os"
    t.string   "os_version"
    t.string   "imei"
    t.string   "imsi"
    t.string   "network_type"
    t.string   "network_name"
    t.integer  "lac"
    t.string   "app_version"
    t.integer  "signal_strength"
    t.integer  "available_ram_mem"
    t.integer  "total_application_storage",     :limit => 8
    t.integer  "available_application_storage", :limit => 8
    t.integer  "total_sd_card_storage",         :limit => 8
    t.integer  "uptime",                        :limit => 8
    t.integer  "available_sd_card_storage",     :limit => 8
    t.integer  "sd_card"
    t.integer  "application"
  end

But I get No valid predicate for status_network_name when trying to submit the form. What am I doing wrong?

@lunks
Copy link
Author

lunks commented Sep 3, 2011

Nevermind, forgot the actual_predicate :P

@lunks lunks closed this as completed Sep 3, 2011
@fguillen
Copy link

fguillen commented Sep 1, 2012

I'm having the same annoying error, I don't find any documentation about how to solve.

@lunks what did you do?

@fguillen
Copy link

fguillen commented Sep 1, 2012

Ah!.. I found it.. you have to modify your field names and add them prefixes like _cont or _start... https://github.com/ernie/ransack/blob/master/lib/ransack/constants.rb

@dlp21103
Copy link

@fguillen ....THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants