开发者

jQuery token input on Rails [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

I'm trying to use the jQuery token input p开发者_开发技巧lugin with Rails and Mongoid.

Using this Railscast as a reference I added the plugin to my app and I setup the various methods, etc.

I created a method on my model that should return this data:

class TheModel
    def token_inputs
        { :id => _id, :name => name }
    end
end

In my controller I do this:

class TheModelsController < ApplicationController
    @models = TheModel.all

    respond_to do |format|
        format.json { render :json => @models.map(&:token_inputs) }
    end
end


It's fixed. I missed a comma in my JavaScript. Silly me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜