Tag: 简单forms的

simple_form与bootstrap 3的集成

我已经将bootstrap更新到版本3.除了由simple_form gem生成的表单外,一切正常。 我不知道如何将这两者结合在一起。 我在github项目存储库中找不到任何有用的建议。 那么有人为我提供解决方案吗?

深嵌套导轨4表格

我有3个模型Item接受嵌套的问题和问题属性接受嵌套的答案属性。 我正在尝试以相同的forms创建一个有问题和答案的项目。 item.rb的 class Item < ActiveRecord::Base has_many :questions, dependent: :destroy accepts_nested_attributes_for :questions end question.rb class Question < ActiveRecord::Base belongs_to :item has_many :answers, dependent: :destroy accepts_nested_attributes_for :answers end answer.rb class Answer < ActiveRecord::Base belongs_to :question end item_controller.rb class ItemsController [:content, :helper_text, :kind], :answers_attributes => [:content, :correct]) end end _form.haml = simple_form_for(@item) do |f| = f.input […]

Rails:使用simple_form并集成Twitter Bootstrap

我正在尝试构建一个rails应用程序,而simple_form看起来是一个非常有用的gem。 问题是我使用twitter bootstrap css来做样式,而simple_form不允许你指定html的布局。 任何人都可以告诉我如何将simple_form html符合bootstrap css想要的格式?

我应该如何将rails和simple_form用于嵌套资源?

我正在尝试同时使用另一个(嵌套)创建一个资源。 我正在使用Rails4和simple_form 3.0.0rc。 这是我的代码。 楷模: class User < ActiveRecord::Base has_one :profile accepts_nested_attributes_for :profile end class Profile < ActiveRecord::Base belongs_to :user end 控制器: class UsersController < ApplicationController def new @user = User.new @user.build_profile end def create user = User.new user_params user.save redirect_to root_url # @par =params end private def user_params params.require(:user).permit(:email, profile_attributes: [:name]) end end 查看(新用户的表单) […]

如何在简单forms的日期时间字段中设置时区?

我有一个带有日期时间字段的模型,并以UTC格式存储,如何在特定时区以简单formsgem显示该日期? 已经尝试使用input_html: {value: @model.date.in_time_zone(‘Eastern Time (US & Canada)’)}选项input_html: {value: @model.date.in_time_zone(‘Eastern Time (US & Canada)’)} 注意:我无法更改rails app的时区

simple_form中的嵌套属性返回质量分配错误

楷模: class Topic :destroy validates :name, :presence => true, :length => { :maximum => 32 } attr_accessible :name, :post_id end class Post true has_many :comments, :dependent => :destroy accepts_nested_attributes_for :topic attr_accessible :name, :title, :content, :topic, :topic_attributes end 视图: { :controller => :posts, :action => “create” } do |f| %> Create a Post false, :placeholder => […]