我可以在Google Chrome上使用POSTMAN客户端将有效负载消息发送到GCM服务器以进行测试.其次,如果是,则要发送的header和url参数是什么.
假设用户模型使用带有strong_parameters的Rails4.
class User < ActiveRecord::Base
has_secure_password
accepts_nested_attributes_for :identity
// rest of code omitted for brevity
end
Run Code Online (Sandbox Code Playgroud)
如果我参考指南我应该能够做到
def user_params
params.require(:user).permit(:email, identity_attributes: [])
end
Run Code Online (Sandbox Code Playgroud)
允许每个identity_attribute的mass_assignment,无论其名称或编号如何.但这是在"未经许可的参数:identity_attributes"中运行的
但是,如果我指定identity_attributes它是有效的
def user_params
params.require(:user).permit(:email, identity_attributes: [:last_name, :first_name])
end
Run Code Online (Sandbox Code Playgroud)
我在Identity中有很多属性,我可以通过User对它们进行mass_assign,而不指定所有属性.
我错过了什么吗?这是一个错误吗?
干杯
在对类DataType进行序列化时,忽略了dbOptions,但正在使用其值打印dataType.
注意我只需要在序列化期间忽略这些属性而不是反序列化.
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "dataType")
@JsonSubTypes(value = {
@JsonSubTypes.Type(value = DefaultType.class, name = "Default"),
@JsonSubTypes.Type(value = NumberRangeType.class, name = "NumberRange"),
})
public abstract class DataType {
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
protected String dataType;
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
protected String dbOptions;
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDbOptions() {
return dbOptions;
}
public void setDbOptions(String dbOptions) {
this.dbOptions = dbOptions;
}
abstract
public void compute() …Run Code Online (Sandbox Code Playgroud) 我拥有可以在Xcode 8和IOS 10.3.1上正常运行的代码,直到将Xcode更新为9和Visual Studio for Xamarin。
这是下面的代码,在调试过程中会引发错误并使应用程序崩溃:
// Code fetching data from SQLITE [Package name Sqlite-net-pcl]
// Result -> System.Collections.Generic.List
var Result = await _database.GetAsync();
if (Result.Count > 0){
try
{
foreach (var resultObj in Result)
{
Debug.WriteLine("Data {0} ", resultObj.name);
}
}
Run Code Online (Sandbox Code Playgroud)
当我调试代码时,我可以在Result内看到值,并在resultObj.name的表达式求值时看到所需的结果。但是一旦调试器到达Debug.WriteLine /如果我尝试使用resultObj.name,它就会崩溃,并带有以下堆栈跟踪:
2017-09-22 15:06:18.549 LoginPage.iOS[415:35914] error: * Assertion at /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/external/mono/mono/mini/debugger-agent.c:4714, condition `array->len == 1' not met
2017-09-22 15:06:18.550 LoginPage.iOS[415:35914] critical: Stacktrace:
2017-09-22 15:06:18.550 LoginPage.iOS[415:35914] critical: at <unknown> <0xffffffff>
2017-09-22 15:06:18.551 LoginPage.iOS[415:35914] critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) …Run Code Online (Sandbox Code Playgroud)