Tag: textarea

使用Ruby on Rails保留文本区域中的换行符

为了练习Ruby on Rails,我正在创建一个包含文本区域的博客(遵循Mackenzie Child的教程)。 提交文本后,将删除所有换行符。 我知道这个问题的变化已经被提出,但是尽管整整一天都在努力,但我无法复制任何结果。 我对JQuery不太熟悉。 是否有一组步骤可以保留换行符? _form.html.erb posts_controller.rb class PostsController < ApplicationController before_action :authenticate_user!, except: [:index, :show] def index @posts = Post.all.order('created_at DESC') end def new @post = Post.new end def create @post = Post.new(post_params) @post.save redirect_to @post end def show @post = Post.find(params[:id]) end def edit @post = Post.find(params[:id]) end def update […]

Ruby on Rails中textarea的最大长度

我尝试在我的表单上的textarea上应用:maxlenght => 40。 但它没有成功。 我们可以对textarea有长度限制吗? 文本区域的代码是 2, :cols => 60 , :maxlength => 140, :autocomplete => :off, :class => “textareabytes” %>

Rails:使用Textarea:has_many关系

嘿伙计们,这里的第一个问题。 我有几个产品和用户可以将这些产品放在愿望清单上。 用户可以拥有许多愿望清单(用于不同目的)。 产品可以添加到Wishlists,但还有其他信息:您必须指定某个产品的数量。 此逻辑用于包含,其具有字段数量 。 Class Wishlist belongs_to :user # User class is irrelevant here has_many :inclusions has_many :products, :through => :inclusions end Class Product has_many :inclusions has_many :wishlists, :through => :inclusions end Class Inclusion belongs_to :product belongs_to :wishlist end 这一切都很有效,但现在是真正的问题。 愿意通过textareas编辑愿望清单。 语法很简单: 数量productname 。 所有用户都使用此语法。 例如,编辑愿望清单应如下所示: 1 Bicycle 4 Shoe 1 Telephone 提交表单时,应在幕后处理所有逻辑。 […]

如何在rails中实现编辑/格式化文本区域

我想实现文本框(文本区域),如图所示。我知道简单的textarea但不知道这种类型的文本区域给出了格式化,编号设施,因为iam new to rails plz帮助我