我有一个简单的问题.我有一个如下所示的序列化器:
class GroupSerializer < ActiveModel::Serializer
attributes :id, :name, :about, :city
end
Run Code Online (Sandbox Code Playgroud)
问题在于,每当我更改模型时,我都必须在此序列化程序中添加/删除属性.我只是想默认获取整个对象,因为默认的rails json响应:
render json: @group
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我有一个问题是循环两个Polymers firebase-collection元素.使用我的数据库结构,我首先要检查用户有权访问哪些事件,然后从事件中获取有关该事件的信息.
这段代码的问题在于,当我循环第二个firebase-collection时,"events"上的数据绑定在所有重复上都是相同的,因此它在每个h4上都是相同的名称.
那么有没有办法在data ="{{}}"中拥有一个唯一的变量.还是有更好的方式来写出数据?
<firebase-collection data="{{userData}}" location="{{_getCorrectUrl()}}"></firebase-collection>
<template is="dom-repeat" items="{{userData}}" as="user">
<firebase-collection data="{{events}}" location="{{_getCorrectEventsUrl(user.__firebaseKey__)}}" ></firebase-collection>
<template is="dom-repeat" items="{{events}}" as="event">
<h4>{{event.value.name}}</h4>
</template>
</template>
Run Code Online (Sandbox Code Playgroud) 对不起,这可能是一个基本问题,但我是rails的新手.我想通过命令启动一个新的rails项目rails new projName.在这个过程的中间我收到了这条消息:
run bundle install
Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.
Password:
Run Code Online (Sandbox Code Playgroud)
我不太确定是否应该提供密码,但是我搜索了一下,我发现这样做是安全的(或者至少是我所理解的).
最后我得到了这个警告:
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance. …Run Code Online (Sandbox Code Playgroud)