Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

non active record models #1

Open
@mkhezr

Description

@mkhezr

Hi,

I'm trying to use this helper with a non active record model. here is the model code without application logic:

class Source < Foodtree::API::Base
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
include ActiveModel::Conversion
extend ActiveModel::Naming

def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end

def persisted?
false
end

needed by the jquery_autocomplete_helper plugin

def display_name
name
end

end

in my views I have used the helper as you instructed:

<%= f.autocomplete_field(:source_id, :url => sources_path)%>

and when loading the page I get the following error on the same line in the view as above:

undefined method `pluralize' for nil:NilClass

What do I need to do so the helper works with non active record models?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions