腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
使用
`:
has_many
处理
复选框
窗体:通过
记录
关联
、
、
、
、
我
使用
Rails 3.0.7,我想在:
has_many
:
through
记录
协会的视图文件中
使用
复选框
字段(即用于新建和编辑
表单
)。我看到了
使用
has_and_belongs_to_many
记录
协会很容易实现的那种事情,但是是否有可能轻松地
使用
第一个提到的
关联
呢?如果是的话,怎么做呢?
浏览 1
提问于2011-07-03
得票数 4
回答已采纳
2
回答
如何
使用
复选框
使用
嵌套窗体创建多条
记录
我的问题是试图理解如何创建一个嵌套
表单
,以便将多条
记录
添加到我的PizzaTopping连接表中。我还需要在
复选框
中显示的配料。<div class="form-horizontal">困惑#1: 据我所知,这是为了在
复选框
中显示一个完整的模型,这是可行的,但我对控制器如何接受这一点并在与披萨相关的配料的连接表中创建
记录
感到困惑我想要单独的
记录
(而不是一个由一组not组成的属性
浏览 19
提问于2016-07-29
得票数 1
回答已采纳
1
回答
has_many
的
复选框
,带有附加的联接表属性
、
、
我在某些模型之间有一个
has_many
:
through
关联
,这些模型决定哪些数据集在某些仪表板上可见。class Dashboard < ActiveRecord::Base
has_many
:datasets, :
through
=>:dashboard_datasets
has_many
:dashboards, :
through
=> :dashboard
浏览 5
提问于2017-09-21
得票数 1
1
回答
Rails 4通过关系实现多对多
、
县有:
has_many
:jobs, :
through
=> :countyizationsbelongs_to :county作业具有:
has_many
:counties, :
through
=> :countyizations我正在
使用
simple_forms,并在我的创建/
浏览 1
提问于2014-01-25
得票数 0
1
回答
在Ruby on Rails中只有一个模型时,向多个表添加
记录
?
、
、
、
当我在提交
表单
时只有一个模型(clients)时,如何将
记录
添加到两个表(clients和clients_category_merge)? 我相信有一个很好的方法可以做到这一点。
浏览 0
提问于2011-06-29
得票数 0
回答已采纳
2
回答
Rails在联接表中创建多条
记录
、
、
我试图通过创建操作在联接表中创建多个
记录
。这是我的协会。class User
has_many
:skills,
through
: :abilities
has_many
:abilities
has_many
:skills,
through
: :abilities belongs_to :jobend我有
浏览 4
提问于2016-01-25
得票数 4
回答已采纳
1
回答
是否可以通过
使用
表单
进行
关联
来附加/取消附加has_one?
、
、
、
、
我的模特长得像这样: has_one :gallery,
through
: :photo_gallery belongs_to :gallery 为了
浏览 1
提问于2014-07-09
得票数 0
1
回答
窗体,不
使用
通常的“添加”和“删除”,而是
使用
复选框
显示所有选项。
、
、
、
、
class Employee
has_many
:languages,
through
: :experiences
has_many
:employees,
through
: :experiences belongs_toemployee attr_a
浏览 2
提问于2013-04-12
得票数 1
1
回答
has_many_
through
关联
添加多个
关联
我有一个
使用
复选框
的
has_many
关联
,可以很好地与statement和identity配合
使用
。
has_many
:identities, :
thro
浏览 0
提问于2017-10-23
得票数 0
1
回答
使用
collection_singular_ids=ids而不保存到数据库
、
、
在rails中,我
使用
other_ids=[...]方法在
has_many
:
through
关联
上分配连接。有没有办法在只
使用
Model.new的情况下分配这些连接?例如,当我提交一个包含
has_many
关系
复选框
的
表单
时,就会发现这一点很有用。当
表单
不保存时(当验证失败时),选中的
复选框
将被重置。型号:
has_many
:c
浏览 0
提问于2012-11-17
得票数 4
1
回答
使用
has_many
复选框
创建的重复联接表
记录
,不能取消/销毁它们
、
、
、
、
我遵循HABTM #17关于
使用
复选框
使用
联接表创建
关联
记录
的操作。:project
has_many
:restrictions, :
through
=> :project_restrictions belongs
浏览 2
提问于2014-10-30
得票数 0
2
回答
ActiveRecord,Rails 4:
has_many
:通过作用域条件失败
、
、
我正在开发一个系统,在这个系统中,User可以通过
使用
user_id、wedding_id和role信息的Attendance模型以多种方式与另一个实体Wedding相
关联
。在问题的帮助下,我找到了用Rails 4风格的
关联
替换:conditions的方法。我现在的协会是:
has_many
:wedding_attendances
through
: :wedding_attendances
has_many
浏览 7
提问于2015-06-08
得票数 2
回答已采纳
1
回答
Rails 4
关联
验证破坏
、
、
、
、
我有两种模式,通过第三种模式有多到多的
关联
。由前人:
has_many
:appointments
has_many
:physicians,
through
: :appointments
使用
simple_form,我有这个
复选框
集(医师<e
浏览 10
提问于2015-09-08
得票数 2
回答已采纳
3
回答
Rails 3
has_many
:直通概念
、
、
我的have_many :
through
是通过连接表在员工和职位之间工作。然而,我的员工编辑
表单
将所有职位作为整个应用程序的
复选框
返回,而不仅仅是这个特定用户的职位。我是否需要对我的
关联
做一些不同的事情,或者有没有更好的方法来缩小
表单
中的数据范围?< ActiveRecord::Base
has_many
:employees, :
through
=> :staffizations
has_many</e
浏览 0
提问于2011-09-01
得票数 0
1
回答
如何搜索
关联
记录
具有给定属性值的
关联
?
、
、
、
、
我
使用
Rails 4,我想在
关联
记录
具有给定属性值的情况下搜索
关联
记录
。也就是说,我有一个
has_many
:
through
关联
,如下所示
has_many
:comment_associations
has_many
:comments,
through
: :comment_associationscommen
浏览 0
提问于2014-05-19
得票数 0
回答已采纳
3
回答
在
关联
中避免‘`save!’有多个
、
、
、
、
我有一个通过属性
关联
的
has_many
,并对"join model“进行了一些验证。class User
has_many
:projects, :
through
=> :project_users
has_many
:users, :
through
=> :project_users cla
浏览 0
提问于2011-10-03
得票数 3
2
回答
在谁调用销毁的情况下通过
关联
依赖销毁来销毁
has_many
、
、
钩子中检查调用destroy的对象(类)
has_many
:appointments, dependent: :destroyend class Patient < A
浏览 1
提问于2012-04-06
得票数 7
回答已采纳
2
回答
ActiveRecord::HasManyThroughOrderError:不能有
has_many
:通过
关联
、
、
、
:users,
through
: :user_badgesendclass User < ApplicationRecord
has_many
:user_badges endb = Badge.create:
through
association 'User#badg
浏览 0
提问于2018-03-23
得票数 9
回答已采纳
1
回答
rails 4为
关联
表中的额外字段创建
表单
我试图为学生创建一个简单的
表单
,以选择课程列表并为每门课程输入备注。 这些是我在学生模型
has_many
:course_associations
has_many
:courses, :
through
=> :course_associationsaccepts_nested_attributes_for :course_associations accepts_nested
浏览 0
提问于2016-02-12
得票数 0
3
回答
FactoryGirl和RSpec:为规范创建一个必需的nested_attributes
记录
、
、
、
我有一个模型contact,
has_many
:locations,
through
: :relationships,以及
has_many
:teams,
through
: :contacts_teams联系人必须具有
关联
的team和location才能通过验证。换句话说:一个新的contact必须有一个
关联
的relationship
记录
和一个
关联
的contacts_team
记录
。,
through
: :contac
浏览 4
提问于2016-03-24
得票数 2
回答已采纳
点击加载更多
相关
资讯
vue.js初入门——十表单控件绑定
如何创建一个可填写的PDF表单?3大好用工具
从零开始HTML#028——5分钟-Forms 表单
HTML中的表单
Vue 3 表单输入绑定
热门
标签
更多标签
云服务器
ICP备案
实时音视频
即时通信 IM
对象存储
活动推荐
运营活动
广告
关闭
领券