我有两个模型restaurant和user我要执行has_and_belongs_to_many关系.
我已经进入模型文件并添加了has_and_belongs_to_many :restaurants和has_and_belongs_to_many :users
我假设在这一点上我应该能够像Rails 3那样做:
rails generate migration ....
Run Code Online (Sandbox Code Playgroud)
但我所尝试的一切似乎都失败了.我确信这是非常简单的我对rails很新,所以我还在学习.
migration ruby-on-rails has-and-belongs-to-many ruby-on-rails-3
我正在试验Puppeteer使用无头Chrome并试图找到如何报告第一次涂漆的时间.我一直在浏览Chrome DevTools Performance API,并注意到有一个Performance.metrics但是当我订阅该事件时它从未触发过.
const client = page._client
await client.send('Page.enable')
await client.send('DOM.enable')
await client.send('Performance.enable')
client.on('Performance.metrics', (obj) => {
console.log({obj})
})
await page.goto('http://example.com', {waitUntil: 'networkidle2'})
Run Code Online (Sandbox Code Playgroud)
但事件观察员从未被解雇过.关于如何从Performance中观察指标数据的任何建议?
我有一个通用的二进制应用程序,目前正在处理该应用程序的iPad版本.iPad正在使用uitabbarcontroller,在第二个选项卡上我有6个图像,当添加UIPinchGesture时它没有响应.我userInteractionEnabled=YES;尝试以编程方式添加图像视图,然后添加手势识别器,但似乎仍然无法正常工作.
我尝试将委托设置为视图控制器并实现其中一个委托方法,但没有得到任何响应.以下是我正在做的代码示例:
UIImageView *img2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img2-large.png"]];
img2.frame = CGRectMake(20, 20, 100, 100);
[img2 setUserInteractionEnabled:YES];
img2.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:img2];
UIPinchGestureRecognizer *img2Pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(img2Pinch:)];
[img2 addGestureRecognizer:img2Pinch];
[img2Pinch release];
- (void)img2Pinch:(UIPinchGestureRecognizer *)sender {
NSLog(@"HERE");
}
Run Code Online (Sandbox Code Playgroud)
我确定我很遗憾这是愚蠢的.我以前用过这些东西,但不能为我的生活弄清楚出了什么问题.
有谁知道你是否可以创建一个使用UIButton的设置包?我希望能够在设置中创建类似Twitter的东西,但似乎不可能.