虽然代码似乎是正确的,但当我尝试发送表单时,多次选择的值不会被发送.
如果我只删除多个选项,一切都按预期工作,只考虑一个值,但每个事务存储多个标记很重要.
模型
Transaction.rb
class Transaction < ActiveRecord::Base
has_and_belongs_to_many :tags
Run Code Online (Sandbox Code Playgroud)
Tag.rb
class tag < ActiveRecord::Base
has_and_belongs_to_many :transactions
Run Code Online (Sandbox Code Playgroud)
视图
<%= form.collection_select :tag_ids, @tags, :id, :name, {},
{:multiple => true} %>
Run Code Online (Sandbox Code Playgroud)
结果:
<select id="transaction_tag_ids" multiple="multiple" name="transaction[tag_ids][]">
<option value="1">..</option>
</select>
Run Code Online (Sandbox Code Playgroud) 我的应用程序上使用了具有透明背景的资产。在 iOS 上,backgroundColor: 'transparent'图像组件的设置按预期工作,但在 Android 上,它始终以浅灰色背景渲染。
事实上,backgroundColor 值在 Android 上似乎被完全忽略了。
现在看起来是这样的:
<View style={styles.cardHeader}>
<Image
source={require('../assets/images/greeting.png')}
style={styles.greetingImage} />
</View>
Run Code Online (Sandbox Code Playgroud)
款式:
cardHeader: {
alignSelf: 'stretch',
backgroundColor: Color.GREY,
paddingTop: 30,
borderTopLeftRadius: 5,
borderTopRightRadius: 5
},
greetingImage: {
alignSelf: 'center',
backgroundColor: 'transparent'
}
Run Code Online (Sandbox Code Playgroud)