我不知道这是否是一个常见问题.但是我的Ruby on Rails应用程序中存在一个奇怪的问题.
例如在Chrome中:
当我单击link_to或者我尝试更改页面时,它将加载,加载和加载,页面不会简单地打开.要打开,我需要在另一个选项卡中单击"打开"并关闭当前选项卡,这样就可以正确加载页面.我不知道到底发生了什么,它刚刚开始从一个时刻发生到另一个时刻.
在Firefox中:
上面的问题没有发生,但它没有向我显示最新的HTML,除非我用F5刷新.然后它会显示除第一次以外的所有内容.
我使用Linux来运行我的项目,它是localhost.这两种情况都非常奇怪,我认为它们是以某种方式相关的.我已经清除了两个浏览器中的两个缓存.
更新:
正如建议搜索涡轮链接.我安装了宝石,但我唯一使用涡轮连接的地方就在application.html.erb.
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
Run Code Online (Sandbox Code Playgroud)
例:
当我单击登录属性时,它是:
<li> <%= link_to "Sign up", new_member_registration_path, :class => 'navbar-link' %> </li>
Run Code Online (Sandbox Code Playgroud)
该呼叫处于待处理状态且未移动(在Chrome上),这是一张网络图片:
在我的控制台日志中没有打印,没有任何东西只是被卡住而什么都不做.
我正在尝试使用实体框架生成迁移,但我不断遇到
Referencing column 'TaskId' and referenced column 'Id' in foreign key constraint 'FK_WorkerTaskTargetReference_WorkerTask_TaskId' are incompatible.
Run Code Online (Sandbox Code Playgroud)
我不知道为什么。
我的配置似乎是正确的:
public class WorkerTaskConfiguration : EntityConfiguration<WorkerTask>
{
public override void Configure()
{
Entity.Property(x => x.CreatedBy).IsRequired().HasMaxLength(DataModelConstants.DEFAULT_FIELD_LENGTH);
Entity.Property(x => x.UpdatedBy).IsRequired().HasMaxLength(DataModelConstants.DEFAULT_FIELD_LENGTH);
Entity.HasMany(x => x.Messages).WithOne(x => x.Task).HasForeignKey(x => x.TaskId).IsRequired();
Entity.HasMany(x => x.TargetReferences).WithOne(x => x.Task).HasForeignKey(x => x.TaskId).IsRequired();
}
}
public class WorkerTaskTargetReferenceConfiguration : EntityConfiguration<WorkerTaskTargetReference>
{
public override void Configure()
{
Entity.HasKey(e => e.Id);
Entity.Property(e => e.CreatedBy).IsRequired().HasMaxLength(DataModelConstants.DEFAULT_FIELD_LENGTH);
Entity.Property(e => e.UpdatedBy).IsRequired().HasMaxLength(DataModelConstants.DEFAULT_FIELD_LENGTH);
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我应用迁移时:
Failed executing DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 HTML5 从给定的当前时间开始制作视频。我正在使用执行以下操作的 javascript 函数:
function goToMinute(params) {
var video = document.getElementById("video_tags");
video.currentTime = 100;
video.play();
}
Run Code Online (Sandbox Code Playgroud)
这个函数在点击时被调用,因为我有一个位置列表,当我点击它们时,我通过参数传递位置时间,然后我想从那里开始视频。
我已经检查过了,参数给了我我想要的数字,例如 10.10(以秒为单位)。
由于它不起作用,我尝试在那里放置一个值,就像我之前在代码中显示的那样:
video.currentTime = 100;
Run Code Online (Sandbox Code Playgroud)
调试我发现我的video.currentTime归因正在设置video.currentTime = 0并且视频从头开始。为什么会这样?
调用函数的代码:
<th><a onclick="goToMinute(<%= manual.time %>)"><%= manual.time %></a></th>
Run Code Online (Sandbox Code Playgroud)
我还可以添加已经在 Firefox、Chrome 和 Edge 中尝试过的内容。
我这里有这个类调用方法setPoint
public class PointsList extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.listpoints, container, false);
public static class PointCreation extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.point_creation, container, false);
setPoint(view, CREATE);
return view;
}
}
static final void setPoint(View view, int goal) {
final EditText SerialField = (EditText) view.findViewById(R.id.Serial);
if(goal == CREATE) {
Button buttonGuardar = (Button) view.findViewById(R.id.buttonGuardar); …Run Code Online (Sandbox Code Playgroud) 我在这堂课的一个片段里面:
public class NetworksList extends Fragment{
Run Code Online (Sandbox Code Playgroud)
在我的onCreate函数里面我也有这段代码:
XmlPullParserFactory pullParserFactory;
try {
pullParserFactory = XmlPullParserFactory.newInstance();
XmlPullParser parser = pullParserFactory.newPullParser();
InputStream in_s = getActivity().getApplicationContext().getAssets().open("temp.xml");
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
parser.setInput(in_s, null);
Toast.makeText(getActivity().getApplicationContext(), "size: ", Toast.LENGTH_LONG).show();
parseXML(parser);
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
希望我尝试用来打开XML文件.我在资源文件夹中有我的XML文件,但我得到:
05-08 18:03:11.034 24645-24645/pt.smartgeo.aees W/System.err? java.io.FileNotFoundException: temp.xml
05-08 18:03:11.034 24645-24645/pt.smartgeo.aees W/System.err? at android.content.res.AssetManager.openAsset(Native Method)
05-08 18:03:11.034 24645-24645/pt.smartgeo.aees W/System.err? at android.content.res.AssetManager.open(AssetManager.java:316)
05-08 18:03:11.034 24645-24645/pt.smartgeo.aees W/System.err? at android.content.res.AssetManager.open(AssetManager.java:290)
05-08 18:03:11.034 24645-24645/pt.smartgeo.aees …Run Code Online (Sandbox Code Playgroud) 我首先在 Windows 中开发我的 RoR 应用程序。现在,由于我在一些 gem、SSH 和其他东西方面遇到了一些问题,因此我决定迁移到 Linux。我正在尝试启动应用程序,但似乎我无法启动。
当我这样做时,bundle update rails我收到以下错误:
Could not find gem 'rails (= 4.2.4) x64-mingw32' in the gems available on this
machine.
Run Code Online (Sandbox Code Playgroud)
这是我的 tzinfo-data gem:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
Run Code Online (Sandbox Code Playgroud)
但我也已经尝试过这个:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Run Code Online (Sandbox Code Playgroud)
任何的想法?因为当我这样做时,bundle install我也收到了以下错误:
You have requested:
rails = 4.2.4
The bundle currently has rails locked at 4.2.4.
Try running `bundle update rails`
Run Code Online (Sandbox Code Playgroud)
更新:
Gemfile 内容
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 http 客户端上传文件,但我总是从后端得到不好的响应。我假设问题出在请求上,因为除此之外,我的请求所具有的一切都与我在 aurelia http 客户端上发出的请求完全相同。
一般来说,这里有一些关于 angular 请求标头的信息:
Request URL: https://*/document/document?name=ecv_template_en.pdf&classification=0
Request Method: POST
Content-Type: application/json
Request payload:
------WebKitFormBoundary1gYAP6XB8f1TQ7RP
Content-Disposition: form-data; name="blobFile"; filename="ecv_template_en.pdf"
Content-Type: application/pdf
------WebKitFormBoundary1gYAP6XB8f1TQ7RP--
Run Code Online (Sandbox Code Playgroud)
来自 aurelia http 客户端的相同请求:
Request URL: https://*/document/document?name=ecv_template_en.pdf&classification=0
Request Method: POST
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarydb5u93415NsBfKEz
Run Code Online (Sandbox Code Playgroud)
现在没有请求有效负载,而是带有 blobFile: (binary)
这是我为了重现调用而执行的角度代码:
const formData = new FormData();
formData.append("blobFile", documentUpload.file);
return this.http
.post(`${*}/document?name=${name}&classification=${classification}`,
formData).pipe(
map(do stuff))
);
Run Code Online (Sandbox Code Playgroud)
我还检查了 formData 的内容,它在 aurelia 请求和角度请求上完全相同。
我正在调用的端点如下:
[HttpPost()]
public ActionResult Create([FromForm]IFormFile blobFile,
[FromQuery] string name,
[FromQuery] ClassificationType classification)
Run Code Online (Sandbox Code Playgroud) 我有以下输入
<input
id="{{options.elementId}}"
#awesomplete
class="c-awesomplete__input dropdown-input"
[formControl]="control"
[type]="customType"
[label]="options.label"
(click)="toggleDropdown()"
(change)="changed($event)">
Run Code Online (Sandbox Code Playgroud)
使用awesomplete jquery插件。当我选择或写入一个值时,它不会触发更改的事件。而且我不知道为什么,除非我在输入组件之外单击。如果在输入之外单击,它将触发更改。但是,我希望一旦从下拉列表中选择一个值或编写一些内容,它就会触发。
@ViewChild("awesomplete", {static: false}) public awesompleteRef: ElementRef;
@Input() public control: FormControl;
@Input() public options: IAwesompleteOptions;
public awesomplete: Awesomplete;
constructor() { }
ngOnInit() {
this.control.enable();
}
ngAfterViewInit() {
this.awesomplete = new Awesomplete(this.awesompleteRef.nativeElement, this.options);
}
public toggleDropdown(): void {
this.awesomplete.evaluate();
this.awesomplete.open();
}
public clearText(): void {
this.control.setValue("");
}
public changed($event): void {
console.log("I've changed");
}
Run Code Online (Sandbox Code Playgroud) 当我这样做时,我得到Null Point Exception:
String Serial = SerialField.getText().toString();
Run Code Online (Sandbox Code Playgroud)
这是代码:
public static class PointCreation extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.point_creation, container, false);
Button buttonGuardar = (Button) view.findViewById(R.id.buttonGuardar);
buttonGuardar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getActivity().getApplicationContext(), "tou a carregar no botao guardar", Toast.LENGTH_LONG).show();
final EditText SerialField = (EditText) view.findViewById(R.id.Serial);
final EditText ObservationField = (EditText) view.findViewById(R.id.Observation);
String Serial = SerialField.getText().toString();
String Observation = ObservationField.getText().toString();
pointsList.add(new …Run Code Online (Sandbox Code Playgroud)