草庐IT

assets_attributes

全部标签

ruby-on-rails - Heroku 不更新 Assets 修改

我正在使用heroku在ruby​​onrails中部署我的应用程序,但是有一个问题,当我部署我的应用程序时,heroku不会更新我在编译我的Assets之前所做的修改。我使用简单的rakeassets:clean在localhost中解决了我的问题,但是在heroku中,这并没有解决我在修改我的Assets时所做的备份更新config.assets.initialize_on_precompile=falseconfig.assets.initialize_on_precompile=true改了这个但是没用 最佳答案 有几件事要

ruby-on-rails - rails 4 : Bootstrap-sass gem assets work on development but not on production

我有一个使用gembootstrap-sass在本地机器上开发的Rails应用程序。在开发中一切正常,但当我将我的应用程序部署到生产服务器时,字形图标停止工作。控制台中出现错误:downloadablefont:downloadfailed(font-family:"GlyphiconsHalflings"style:normalweight:normalstretch:normalsrcindex:1):status2147746065source:http://mydomain.com/assets/bootstrap/glyphicons-halflings-regular.wo

ruby-on-rails - 在模型中使用 accepts_nested_attributes_for 时出现 Rails 4.1 错误

此类分配代码在railsv4.0.5之前是可以的但它在rails4.1.x中出错有一个apidocumentation所以我想它没有被弃用。我不知道这是什么问题。Loadingdevelopmentenvironment(Rails4.1.1)2.1.1:001>classAssignmentbelongs_to:group2.1.1:003?>has_one:event2.1.1:004?>accepts_nested_attributes_for:event2.1.1:005?>endNameError:undefinedlocalvariableormethod`generate

ruby-on-rails - Rails 不在开发模式下使用 nginx 提供 Assets

我在Debian6的虚拟机上工作。我前面有nginx来提供静态文件('jpg、png、css、js...)和apache来运行脚本。但我有一个问题,我的Assets文件出现404错误。我的nginx配置:server{listen80;server_namemysite;#access_log/var/log/nginx/access.mysite.log;#error_log/var/log/nginx/error.mysite.log;#LesrequêtessonttransmisesauprocessusApacheécoutantenlocalsurleport81locat

ruby-on-rails - 当我运行 rake assets :precompile got couldn't find file 'jquery' in application. js on//= require jquery

当我运行时bundleexecrakeassets:precompile我得到了couldn'tfindfile'jquery'在application.js上线://=requirejqueryrails3.2.2。什么是原因? 最佳答案 我敢说您的应用程序中没有任何jquery.js文件。如果它不在app/assets或vendor/assets或lib/assets中,请将其添加到其中之一——或者如果您使用的是jquery-railsgem,请按照说明进行操作here. 关于rub

ruby-on-rails - 具有 mongoid 的许多对象的 update_attributes

可能是这样的:@users=User.criteria.for_ids(params[:user_ids])@users.update_all(:suspend=>true)代替:foruin@usersu.suspend=trueu.update_attributesend 最佳答案 看看这个:#Updatingonerecord:Person.update(15,:user_name=>'Samuel',:group=>'expert')#Updatingmultiplerecords:people={1=>{"first_na

ruby Chef 指令 : include_attribute vs. include_attributes

我在chef属性文件中看到了这段代码。include_recipe"deployment"include_attribute"postgresql"include_attribute"redis"include_attributes"uaa"include_attributes"service_lifecycle"有什么不同?include_attribute与include_attribute*S*我找不到任何关于include_attribute*S*的文档 最佳答案 include_attribute属性用于对收敛时加载属性文

ruby-on-rails - rails : validation fails with before_create method on datetime attribute

ApiKey.create!抛出验证错误:expires_at不能为空。classApiKey有属性t.datetime:expires_at但是,如果删除了验证,则before_create方法会在创建时起作用。这是为什么?-此模式适用于其他属性,例如access_tokens(字符串)等 最佳答案 我会说因为before_create在验证之后运行,也许您想将before_create替换为before_validation注意:如果你像那样留下回调,它会在你运行valid?或save或任何时候设置到期日期触发验证的事件记录方法

ruby-on-rails - Assets :precompile end of file reached

我正在尝试在我的Rails4应用程序上运行assets:precompile,但我不断收到:rakeaborted!endoffilereached在capistrano提示同样的错误后,我在我的VPS上运行这个命令。有什么想法吗?[deploy@skateboxesskateboxes]$cd/var/www/skateboxes/releases/20131024204508&&(RAILS_ENV=production/usr/local/rvm/bin/skateboxes_rakeassets:precompile)rakeaborted!endoffilereached/v

ruby-on-rails - Rails 4 如何从模型中调用 accessible_attributes

您好,我正在尝试这个tutoonRailscast(ImportingcsvExcelfile)。我在这一行product.attributes=row.to_hash.slice(*accessible_attributes)上遇到错误undefinedlocalvariableormethodaccessible_attributes'for#`这是我的模型。classProduct在我的Controller上结束,我定义了product_paramsdefproduct_paramsparams.require(:product).permit(:name,:price,:rel