I have a rails application that completes a partial name search function.
Whenever I try to load a certain page I'm getting the error:
NoMethodError in Rx_search_requests#new
Showing /Users/kweihe/pmpaware-webapp/app/views/rx_search_requests/new.html.erb where line #40 raised:
undefined method `partial_last_name?' for #<RxSearchRequest:0x007f9705efeb08>
partial_last_name
is an attribute in the rx_search_query.rb
model
there's a couple of places in this particular model that call partial_last_name?
if @rx_search_request.partial_last_name?
there's also a couple of places in another model rx_search_partial_query.rb
that call partial_last_name?
validates :last_name, length: {minimum: 3}, if: :partial_last_name?
and here
def partial_name_search? partial_last_name? || partial_first_name? end
Any idea why rails would be complaining about an undefined method that is an attribute? partial_last_name
is a boolean attribute, so using the question mark just returns true or false.
also, just for reference here is the view snippet that the log is also complaining about
<legend>Patient Info</legend>
<% FormField.active_roles = current_user.roles %>
<% c = @rx_request -%>
<% if FormFields[c].first_name.visible? %>
<div class='controls <%= FormFields[c].first_name.required? ? 'required' : '' %>'>
<div class="form-inline partial_checkbox">
<%= f.label :first_name, 'First Name' %>
<% if current_user.can? :access, ActionableItem.find_by_path("/RxSearch/Partial Name Search") %>
<%= f.check_box :partial_first_name, :class => 'partial_search_name' %> Partial spelling
<% end %>
</div>
<%= f.text_field :first_name %>
</div>
<% end %>
<% if FormFields[c].last_name.visible? %>
<div class='controls <%= FormFields[c].last_name.required? ? 'required' : '' %>'>
<div class="form-inline partial_checkbox">
<%= f.label :last_name, 'Last Name' %>
<% if current_user.can? :access, ActionableItem.find_by_path("/RxSearch/Partial Name Search") %>
<%= f.check_box :partial_last_name,:class => 'partial_search_name' %> Partial spelling
<% end %>
</div>
<%= f.text_field :last_name %>
</div>
<% end %>
Aucun commentaire:
Enregistrer un commentaire