如何确定分区的scrollHeight使用css overflow:auto?
我试过了:
$('test').scrollHeight();
$('test').height(); but that just returns the size of the div not all the content
Run Code Online (Sandbox Code Playgroud)
最终,我正在尝试创建一个聊天,并始终在屏幕上显示当前消息的滚动条.
所以我想的是以下内容:
var test = $('test').height();
$('test').scrollTop(test);
Run Code Online (Sandbox Code Playgroud)
谢谢,
布赖恩
我想知道是否有人可以解释如何在一个对象数组上使用will_paginate?
例如,在我的网站上,我有一个意见部分,用户可以对意见进行评分.这是我写的一个方法来收集评价意见的用户:
def agree_list
list = OpinionRating.find_all_by_opinion_id(params[:id])
@agree_list = []
list.each do |r|
user = Profile.find(r.profile_id)
@agree_list << user
end
end
Run Code Online (Sandbox Code Playgroud)
谢谢
如何将Rails 3.0置于生产模式?
我只是将以下代码放在config/environment中:
RAILS_ENV = 'production'
Run Code Online (Sandbox Code Playgroud)
还有什么我需要改变的吗?
谢谢.
我有一个带有帐户ID的Ruby数组.
我想将一个帐户ID的Ruby数组存储在一个Javascript数组中.
我想知道最好的方法吗?
此外,当我一直试图这样做时,似乎Javascript认为如果只输入一个帐户ID,则应该是数组的大小.有没有解决的办法?我试过把它放在引号中,但这似乎不起作用.
我正在使用以下内容:
gem 'friendly_id', github: 'FriendlyId/friendly_id', branch: 'master'
Run Code Online (Sandbox Code Playgroud)
我正在我的Rails 4网站上创建一篇文章部分.我遇到的问题是,当我更改现有文章的名称时,slug不会更新.
这是我到目前为止:
extend FriendlyId
friendly_id :name, use: :slugged
add_column :articles, :slug, :string
add_index :articles, :slug, unique: true
Run Code Online (Sandbox Code Playgroud) 我正在尝试建立一个新的时尚单页网站,我滚动到页面上的一个部分.我想把"固定"标题带到内容的确切位置.我正在使用Zurb基金会.这是我到目前为止(这里找到的一些代码):
<li><%= link_to "Recent Work", "#", "data-scroll" => "recent" %></li>
$(document).ready(function() {
$("a[data-scroll]").click(function() {
var id = $(this).data("scroll")
$('html,body').animate({
scrollTop: $("#"+id).offset().top},
'slow');
});
});
<div id="recent">some content</div>
Run Code Online (Sandbox Code Playgroud)
我遇到的问题如上所述.我想把我的固定标题带到页面上这个div的确切位置.请指教.
有没有办法为text_area生成的textarea标签之间的方法指定一个值?
这是我正在使用的代码的示例.
<% remote_form_for ... do |f| %>
<%= f.text_area :message %>
<%= f.submit 'Update' %>
<% end %>
Run Code Online (Sandbox Code Playgroud) 我只是设置了一个新的迁移和模型关系,并且在测试表之间的关系时在控制台中我得到以下错误:NameError:uninitialized constant.
有谁知道什么是错的?
谢谢
编辑:
这是错误
NameError: uninitialized constant Profile::ProfileNotification
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2199:in `compute_type'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2195:in `compute_type'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:156:in `send'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:156:in `klass'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:187:in `quoted_table_name'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/has_many_association.rb:97:in `construct_sql'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_collection.rb:21:in `initialize'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1300:in `new'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1300:in `profile_notifications'
from (irb):3
Run Code Online (Sandbox Code Playgroud)
ProfileNotification迁移中的代码:
class CreateProfileNotifications < ActiveRecord::Migration
def self.up
create_table :profile_notifications do |t|
t.integer :profile_id, :null => false
t.integer :notification_id, :null => false
t.string :notification_text
t.boolean :checked, :default => false
t.boolean :update_reply, :default => false
t.boolean :opinion_reply, …Run Code Online (Sandbox Code Playgroud) 我在JSP文件中编写了以下代码:
<c:catch var="e">
<%
int accountNumber = Integer.parseInt(request.getParameter("accountNumber"));
int depositAmount = Integer.parseInt(request.getParameter("depositAmount"));
%>
<sql:query var='account' dataSource="jdbc/bank">
select * from account where AccountNumber=<%= accountNumber %>
</sql:query>
<c:choose>
<c:when test="${account.first() == false}">
<p>Account not found</p>
</c:when>
<c:otherwise>
<h3>Deposit Made</h3>
<p>Account number: <%= accountNumber %></p>
<p>Deposit amount: <%= depositAmount %></p>
<p>New balance: </p>
</c:otherwise>
</c:choose>
</c:catch>
<c:if test="${e != null}">
error
</c:if>
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是以下代码抛出一个javax.el.MethodNotFoundException:无法找到[0]参数异常的方法[first]:
<c:when test="${account.first() == false}">
<p>Account not found</p>
</c:when>
Run Code Online (Sandbox Code Playgroud)
我需要访问sql:query中的帐户变量,以便检查第一行是否存在.
javascript ×4
jquery ×3
friendly-id ×1
java ×1
jsp ×1
jstl ×1
pagination ×1
redirect ×1
ruby ×1