小编bot*_*bot的帖子

jquery同位素插件容器高度不会随同位素项目增长(与砖石相同)

我有一个同位素项目,当有人在里面评论时它会增长.当它生长时,我如何告诉主同位素容器随之生长?现在正在发生的事情是,随着同位素项的增长,同位素容器保持它在调用$(".home_main")时设置的初始高度.同位素(); 因此,当我在同位素项中留下注释时,项目会增长,然后被主容器切断.谢谢.

我已经看到你可以设置,resizesContainer: true但这对我没有帮助.谢谢.

不确定它是否有任何区别,但我也尝试使用Masonry jquery插件(看起来非常相似)并且遇到了同样的问题.

html javascript jquery jquery-masonry jquery-isotope

5
推荐指数
2
解决办法
1万
查看次数

Rails Active Admin PUT 不更新布尔值 (SQL Server)

我在生产中切换到 SQL Server,并意识到 Active Admin PUT 调用不会更新我数据库中的某些布尔值。PUT 调用将返回 302,并且不会更新记录,即使我可以看到参数正按预期发送。例如,如果布尔值设置为 false,而我想将其设置为 true,则 Active Admin 会正确地将值发送为 value => true,但它不会更新。

我注意到有趣的一件事是,在我们运行测试的 heroku 上,这些字段的值将在 Active Admin 中更新得很好。在使用 SQL Server 的生产环境中,值显示为 1 和 0,而不是 true 或 false。我有一种感觉,这是问题的一部分。

我的问题是,为什么只有一些布尔值在 SQL SERVER 上显示为 1 和 0,而在 heroku 和 mySQL 上显示为 true 或 false?如何修复这些值以使显示为真和假,而不是 1 和 0?

更多信息。通过 rails 控制台更新这些值,在应用程序中,工作得很好。我可以在所有环境中成功地说 model.field = true 然后 model.save 。

mysql sql-server ruby-on-rails activeadmin

5
推荐指数
1
解决办法
761
查看次数

Rails路由:浅=>真

想知道为什么申请时我的/文章路线不会出现:shallow => true?

的routes.rb

resources :users, :shallow => true do
  resources :articles
end
Run Code Online (Sandbox Code Playgroud)

还试过这个:

resources :users do
  resources :articles, :shallow => true
end
Run Code Online (Sandbox Code Playgroud)

访问/文章不会按预期向我显示任何用户的所有文章,但我仍然可以访问/ articles /:id就好了.这是预期的行为吗?

ruby routes ruby-on-rails

4
推荐指数
1
解决办法
7162
查看次数

Rails Heroku Sidekiq确认Procfile正在运行

我在我的应用程序的根目录中设置了Procfile:

web: bundle exec thin start -p $PORT
worker: bundle exec sidekiq -c 5 -v
Run Code Online (Sandbox Code Playgroud)

我可以看到,当我通过推送我的rails应用程序时,heroku会看到它 git push heroku master

Procfile declares types      -> web, worker
Run Code Online (Sandbox Code Playgroud)

问题是一堆工作刚刚陷入"入队"部分.

如果我从命令行运行heroku run bundle exec sidekiq,那么只有作业才会处理.

关于如何调试这个的任何想法?谢谢!

ruby-on-rails heroku sidekiq

4
推荐指数
1
解决办法
2075
查看次数

Resque Mysql2::Error: 用户已超出“max_user_connections”资源(当前值:10)

我在 Heroku 上运行 Resque,我的数据库是 ClearDB。我收到此错误:

“Mysql2::Error:用户‘bdb2aedbee2c38’已超出‘max_user_connections’资源(当前值:10):显示完整字段projects

该错误来自我的 Heroku 应用程序的 Resque 管理员。

如何确定 Resque 与 ClearDB 建立了多少连接?

我如何告诉 ClearDB 允许更多连接,或者告诉 Resque 创建更少?

“当前值:10”是指 ClearDB 允许的连接数,还是 Resque 试图建立的当前连接数?

谢谢!

mysql heroku resque ruby-on-rails-3

4
推荐指数
1
解决办法
7760
查看次数

Google Maps V3 API密钥本地计算机错误:GoogleGoogle已禁止对此应用程序使用Maps API

我正在我的计算机上运行rails 3设置,只使用内置的rails服务器并获得Google Maps API V3错误:

Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: http://code.google.com/apis/maps/documentation/javascript/tutorial.html#Obtaining_Key
Run Code Online (Sandbox Code Playgroud)

这只是在我的本地计算机上进行测试.http://0.0.0.0:3000.如果有人知道我如何配置我的API密钥进行本地测试会很棒,谢谢!

google-maps-api-3 ruby-on-rails-3

3
推荐指数
1
解决办法
7793
查看次数

未找到Rails @import指南针

这是我的application.css:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-3 asset-pipeline compass-sass

3
推荐指数
1
解决办法
1126
查看次数

mySQL to PostgreSQL concat名字搜索的名字和姓氏(Ruby on Rails)

嘿,我正在试图弄清楚如何将在mySQL中工作的语句转换为PostgreSQL,如果有人知道解决方案,那就很好奇.

这是在mySQL中有效的语句:

def self.by_name(keywords)
    if keywords
        find(:all, :conditions => ["concat(first_name," ",last_name) like?", "%#{keywords}%"])

    end
  end
Run Code Online (Sandbox Code Playgroud)

以下是我在本网站上发现的基本上有类似问题的陈述,但它对我不起作用,如果我进行像Contact.by_name("Bobby")这样的搜索,则没有结果.

def self.by_name(keywords)
    if keywords
        find(:all, :conditions => ["textcat(textcat(first_name,text ' '),last_name) like?", "%#{keywords}%"])
    end
  end
Run Code Online (Sandbox Code Playgroud)

我的想法是,我可以搜索"Bobby","Fishcer"或"Bobby Fischer",它可以匹配任何人的名字,姓氏或名字和姓氏.谢谢!

mysql postgresql ruby-on-rails ruby-on-rails-3

3
推荐指数
1
解决办法
1605
查看次数

Rails Rspec Model Spec用户:email ActiveRecord :: RecordInvalid

试图找出我的rspec测试失败的原因.最值得注意的是看似矛盾的失败消息.说明我有一个ActiveRecord :: RecordInvalid错误,这正是我所声称应该发生的事情.

这是我的user.rb

...
validates_presence_of :email
...
Run Code Online (Sandbox Code Playgroud)

这是我的users_spec.rb

...
it "is invalid without email" do 
  Factory(:user, email: nil).should raise_error(ActiveRecord::RecordInvalid)
end
...
Run Code Online (Sandbox Code Playgroud)

这是输出:

Failures:

  1) User a user (in general) is invalid without email
     Failure/Error: Factory(:user, email: nil).should raise_error(ActiveRecord::RecordInvalid)
     ActiveRecord::RecordInvalid:
       Validation failed: Email is invalid, Email can't be blank
     # ./spec/models/user_spec.rb:34:in `block (3 levels) in <top (required)>'
Run Code Online (Sandbox Code Playgroud)

最初我是以这种方式测试它但是它一直都失败了,所以我决定指出我期待的错误.

it "is invalid without email" do 
  Factory(:user, email: nil).should_not be_valid
end
Run Code Online (Sandbox Code Playgroud)

ruby rspec ruby-on-rails

3
推荐指数
1
解决办法
3725
查看次数

PhoneGap Mobile Rails身份验证(从头开始设计?身份验证?)

我有一个带有Rails后端的PhoneGap应用程序.我试图找出使用json从移动应用程序验证用户的最佳方法.

我目前正在使用设计,但我不必使用它.在Phonegap中使用移动应用程序修改设计的最简单方法是什么?

我知道这里有很多帖子......但是,其中一些已经过时或者看起来非常复杂.希望可能有更多来自一些经过试验和测试的项目或教程的最新信息.

我发现的一个帖子也建议使用jsonp,但它看起来也是一个相当复杂的黑客.你可以在这里找到它:http://vimeo.com/18763953

我也想知道如果从头开始进行身份验证我是否会更好,如本Railscast中所述:http: //railscasts.com/episodes/250-authentication-from-scratch

谢谢!

ruby ruby-on-rails devise cordova

3
推荐指数
1
解决办法
3422
查看次数