我正在开发一个目录,该目录使用css -transform属性在悬停时缩放每个'swatch'.
这是我的问题:在某些浏览器和某些网站上,当您将鼠标悬停在样本上时,会导致页面在翻转时"闪烁".我无法解决这个问题,在一个网站上它可能是Safari的独特之处,另一个网站可能只发生在Chrome中,另一个网站则完全没问题.
希望我有更多的信息,但也许其他人遇到了类似的问题.

.swatch {
-webkit-box-shadow: #EFEFEF 2px 2px 0px;
-webkit-transform: scale(1);
-webkit-transition-duration: 0.2s;
border: 1px solid white;
position: relative;
z-index: 1;
.swatch:hover {
position:relative;
z-index:10;
transition-duration: 0.2s;
transform:scale(1.8);
-webkit-transition-duration: 0.2s;
-webkit-transform:scale(1.8);
}
Run Code Online (Sandbox Code Playgroud)
在删除任何z-index属性时似乎也解决了问题,但是悬停样本在其他样本后面; 这对这个项目不起作用.
任何想法都表示赞赏.
我最近遇到了一个问题,用户上传了一个图像,并且在某处某处,回形针正在翻转它.
有问题的图片可以在http://photoramblr.com/photos/36看到
如你所见,图像是颠倒的; 但是将图像拖到桌面上它会出现在正确的位置.由于此图像是在iPhone上拍摄的,因此我只能假设这与iPhone上图像的方向设置有关.有没有人遇到这样的事情或有任何建议如何解决这个问题?
这里的代码是非常简单的Paperclip术语:
class Photo < ActiveRecord::Base
has_attached_file :image,
:storage => :s3,
:s3_credentials => S3_CREDENTIALS,
:styles => {
:thumb => "100x100#",
:small => "138x138>",
:large => "580x580>",
:x_large => "1600x1600>"}
Run Code Online (Sandbox Code Playgroud)
嗯,我能够通过拍摄图像的截图并上传它来解决这个问题.元数据中肯定有一些东西正在设置正确的方向,而这些方向并未完成.
红宝石2.1.8导轨3.2.18
我正在尝试在仅在特定属性已更改时保存记录时运行回调.例如
before_save :do_the_thing, if: :my_attr_changed?
Run Code Online (Sandbox Code Playgroud)
但是,当我改变my_attr并保存时,do_the_thing不会被调用.然而,如果我做同样的事情,但是:
before_save :do_the_thing
def do_the_thing
puts my_attr_changed?
end
Run Code Online (Sandbox Code Playgroud)
它在日志中输出"true".在这里相当困惑.任何帮助赞赏.谢谢.
不确定我的问题是否与此线程有关(http://stackoverflow.com/questions/6589066/rmagick-and-os-x-lion),但我刚刚升级到Lion; 更具体地说,我购买了一台新机器,并通过我的旧配置文件迁移.
我无法启动rails 3,因为它无法找到rmagick,我无法安装rmagick,因为我收到以下错误.我尝试卸载rmagick和imageMagick,但在尝试捆绑安装时仍然遇到同样的错误.有什么想法吗?谢谢
Installing rmagick (2.13.1) with native extensions /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:551:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/opt/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include …Run Code Online (Sandbox Code Playgroud) 我刚刚升级到Xcode 5,现在Gitbox似乎无法找到FileMerge作为diff工具,并且没有手动设置路径的选项.有人知道再次链接它的方法吗?
validates_confirmation_of :password我的用户模型中有一个.问题是我还在@comment.user.save!创建注释时运行以更新用户帐户的某些属性.
创建评论时出错Validation failed: Password confirmation can't be blank.我无法添加:on => "save"到我的验证,因为我的comments控制器也调用了保存功能.
我在创建和更新时已经阅读了这个线程Rails模型验证,但它没有回答我的具体问题.
更新 用户模型代码段:
class User < ActiveRecord::Base
attr_accessor :password
# validations
validates_presence_of :username
validates_length_of :username, :within => 6..25
validates_uniqueness_of :username
validates_presence_of :email
validates_length_of :email, :maximum => 100
validates_format_of :email, :with => EMAIL_REGEX
validates_confirmation_of :password, :if => :password_changed?
validates_presence_of :password_confirmation
validates_length_of :password, :within => 4..25, :on => :create
before_save :create_hashed_password
after_save :clear_password
private
def clear_password
self.password = …Run Code Online (Sandbox Code Playgroud) 我正在使用gem metasearch来提供一些排序功能.该页面默认为某种类型created_at ASC,但我希望它是created_at DESC,但我无法明确说明,因为它将覆盖MetaSearch的排序功能.
def index
@search = Photo.search(params[:search])
end
Run Code Online (Sandbox Code Playgroud)
有关如何实现这一点的任何想法?
我有一个,friendships_controller但我想从内部调用它create和destroy行动users_controller.实际上,我设置的方式,create方法工作正常,但destroy没有.
用户/指数
<%= button_to "+ Add Friend", :controller => "friendships", :action => 'create', :method => "post", :id => user.id %>
<%= button_to "- Unfriend", {:controller => "friendships", :action => 'destroy'}, :confirm => "Are you sure you want to unfriend #{user.username}?", :method => :delete, :id => user.id %>
Run Code Online (Sandbox Code Playgroud)
如果我单击Unfriend按钮,我会得到跟踪轨道异常:
ActiveRecord::RecordNotFound in FriendshipsController#destroy
Couldn't find User with ID=destroy
Run Code Online (Sandbox Code Playgroud)
这是以下destroy行动friendships_controller:
def destroy
@accepting_user = User.find(params[:id])
@friendship = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Rail的distance_of_time_in_words助手,但由于某些原因我得到了一个未定义的方法错误.这是我的代码:
def confirm_has_quota
last_upload = current_user.photos.last.created_at
remaining_time = distance_of_time_in_words(1.day.ago, last_upload)
if last_upload < 1.day.ago
return true
else
flash[:error] = "You are allowed 1 upload per day. Please try again in" + remaining_time + "."
redirect_to(:back)
end
end
Run Code Online (Sandbox Code Playgroud)
这给了我"未定义的方法`distance_of_time_in_words'".有谁看到我在这里做错了什么?谢谢.
我正在使用chargify_api_aresgem来搜索Chargify订阅.
@current_subscription = Chargify::Subscription.find_by_customer_reference(@dealer.id)
redirect_to(dealers_path) unless @current_subscription
Run Code Online (Sandbox Code Playgroud)
但是,如果没有找到订阅,它永远不会进入重定向的下一行,因为find_by_customer_reference如果找不到任何东西就吐出404,但是我想要某种方式让它返回,nil所以我可以将它转到下一行,我将用户重定向到那里.
有没有人知道如何轻轻地失败或更好的方式我可以重定向用户如果没有找到对象?谢谢.
导轨:'4.2.10' kaminari:'1.0.1'
我正在处理一个非常简单的关系,其中 aConversation有很多ConversationMessages. 我Conversation在索引上显示这些记录,并希望按具有最新ConversationMessage. 这就是事情变得有趣的地方。
def index
@conversations = current_user.conversations.includes(:conversation_messages).order("conversation_messages.created_at DESC").page(params[:page])
end
Run Code Online (Sandbox Code Playgroud)
发生的事情是,当我订购 using 时conversation_messages.created_at,大多数记录没有显示在视图中,实际上分页完全消失了;但是,如果我附加?page=3到 url,您仍然可以访问其他页面;他们每个人的记录数量都非常有限。
此外,如果我删除.page(params[:page])并摆脱分页,所有结果都会显示我是按Conversation日期还是按ConversationMessage日期排序。
只是当ConversationMessage同时使用按和分页排序时,一切似乎都变得混乱了。
有什么想法吗?
在我的应用程序中,评论属于照片,我正在尝试添加一种方法来销毁评论.
的routes.rb
resources :photos do
resources :comments
end
Run Code Online (Sandbox Code Playgroud)
CommentsController
def destroy
@comment = Comment.find(params[:id])
@comment.destroy
end
Run Code Online (Sandbox Code Playgroud)
照片/ show.html.erb
<% @photo.comments.each do |comment| %>
<%= comment.body %></p>
<p><%= link_to 'Remove comment', comment, :confirm => 'Are you sure you want to remove this comment? This cannot be undone.', :method => :delete %></p>
<% end %>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是undefined method 'comment' for #<Photo:0x10ace9270>.
我想我可能没有正确设置我的路线,因为当我检查路线时,comment我得到:
rake routes | grep comment
photo_comments GET /photos/:photo_id/comments(.:format) {:action=>"index", :controller=>"comments"}
POST /photos/:photo_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_photo_comment GET /photos/:photo_id/comments/new(.:format) …Run Code Online (Sandbox Code Playgroud)