我正在使用paper_trail进行审计跟踪.除了创建,更新和删除事件,我想跟踪一些自定义事件,如视图(记录),发送(电子邮件)等.我们如何在审核模型时引入此类自定义事件?
我们如何测试认证与消化的解释这里使用curl?
我能够测试简单的基本设置例如Authorization头Basic {SECRET}哪里SECRET是Base64::encode64("username:password")为解释在这里
我尝试发送Authentication具有相同值的标头但是NoMethodError (undefined method 'unpack' for nil:NilClass)在线呼叫authenticate_or_request_with_http_digest
请问有谁能解释我在这里做错了什么?
authentication curl ruby-on-rails basic-authentication ruby-on-rails-3
后RAILS_ENV=production bundle exec rake assets:precompile的下拉成为开发环境反应迟钝.点击按钮没有任何反应.然而,从public/assets开始工作中删除一切.它也适用于生产模式(rails s -e production)
该应用程序使用twitter bootstrap和主动管理员.看起来有些事情变得矛盾了.
请注意,它在Heroku上的分段工作正常
这是生成的html的快照
<li id="organization-selector" class="dropdown">
<a href="/" data-toggle="dropdown" data-target="#organization-selector" class="dropdown-toggle">
RedKivi
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="/organizations/1">RedKivi</a>
</li>
<li>
<a href="/organizations/2">BoTree</a>
</li>
<li class="divider"></li>
<li>
<a href="/organizations/new">New organization</a>
</li>
</ul>
</li>
Run Code Online (Sandbox Code Playgroud)
应用程序/资产/样式表/ application.css.scss
...
....
*= require_self
*= require jquery.ui.slider
*= require_tree .
Run Code Online (Sandbox Code Playgroud)
应用程序/资产/ JavaScript的/ application.js中
//= require jquery
//= require jquery_ujs
//= require …Run Code Online (Sandbox Code Playgroud) jquery ruby-on-rails ruby-on-rails-3 activeadmin twitter-bootstrap
在处理Rails 2.3.18到Rails 3.2.x迁移时,我在type列中面临名称问题
这是定义的关系.
app/models/reservation.rb
class Reservation
end
class Reservation::Guest < Reservation
end
class Reservation::Event < Reservation
end
Run Code Online (Sandbox Code Playgroud)
在保存Reservation::Guest或Reservation::Event实例时,type保存的值是Reservation::Guest和Reservation::EventRails 3中的.但是在Rails 2中,它保存没有名称空间即,Guest或Event.
它需要付出很多努力来迁移现有数据并更改所有type不需要命名空间的地方.
如果type不在命名空间中进行大量修改,是否可以在没有命名空间和休息的情况下进行保存?
migration legacy-code single-table-inheritance ruby-on-rails-3 ruby-on-rails-2
我必须更新具有firstName和lastName的Person记录.用户应该能够从html表单更改它,并在提交时应该更新它.
这是我的代码.
@PUT
@Path("/{userId}")
public Response updatingResource(@FormParam("firstName") String firstName, @FormParam("lastName ") String lastName , @PathParam("userId") String userId){
System.out.println(firstName);
System.out.println(lastName);
return Response.ok().build();
}
Run Code Online (Sandbox Code Playgroud)
SOP语句打印为null.我一直在使用Mozilla Firefox的Poster插件发送PUT请求.
我也尝试通过注释它@Consumes(MediaType.APPLICATION_FORM_URLENCODED)但仍然为每个值打印null.
如何编写和调用接收这三个值的PUT方法.我偶然发现并发现有人要求使用JSON或XML.我该如何使用JSON?如果有人帮助我编写REST方法来更新资源,我会非常感激
如果我使用Firefox的RESTClient和Google的rest-client发送PUT请求,我可以获取表单参数.这个工具都有像我放置的身体部分firstName=Amit&lastName=Patel.另外我添加标题Content-Type为application/x-www-form-urlencoded.我认为Firefox的海报是错误的.任何人都可以建议我有任何其他方式我应该验证代码或我可以信任前两个REST客户端?
我通过RubyMine IDE进行远程调试时遇到以下错误.
$ bundle exec rdebug-ide --port 1234 -- script/rails server
Fast Debugger (ruby-debug-ide 0.4.9) listens on :1234
/home/amit/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-ide19-0.4.12/lib/ruby-debug-ide.rb:123:in `debug_load'
/home/amit/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-ide19-0.4.12/lib/ruby-debug-ide.rb:123:in `debug_program'
/home/amit/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-ide19-0.4.12/bin/rdebug-ide:87:in `<top (required)>'
/home/amit/.rvm/gems/ruby-1.9.3-p125/bin/rdebug-ide:19:in `load'
/home/amit/.rvm/gems/ruby-1.9.3-p125/bin/rdebug-ide:19:in `<main>'
Uncaught exception: cannot load such file -- script/rails
Run Code Online (Sandbox Code Playgroud)
我按照此链接安装了需要的gems进行远程调试.
这是用于远程调试的Gemfile配置
#To Debug
gem 'linecache19', '0.5.13', :path => "~/.rvm/gems/ruby-1.9.3-p125/gems/linecache19-0.5.13/"
gem 'ruby-debug-base19', '0.11.26', :path => "~/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-base19-0.11.26/"
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'ruby-debug-ide19'
Run Code Online (Sandbox Code Playgroud)
该应用程序使用Ruby 1.9.3和Rails 3.0.11运行.
我在我的Rails应用程序中使用了Blueimp jQuery File Upload.当用户选择文件时,我想在将文件上传到服务器之前显示图像的缩略图和图像的名称.
我一直在引用该演示来自定义这个插件.我能够在屏幕上打印文件的名称,但无法显示缩略图.
这是生成的html
<!DOCTYPE html>
<html>
<head>
<title>Fileupload</title>
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/jquery.fileupload-ui.css?body=1" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ui.widget.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.tmpl.js?body=1" type="text/javascript"></script>
<script src="/assets/load-image.min.js?body=1" type="text/javascript"></script>
<script src="/assets/canvas-to-blob.min.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.fileupload.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.fileupload-fp.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.fileupload-ui.js?body=1" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="Akp8GLPQ+DlFYI1g3CUA71hk0vg3G84aVwcVRHTlRUY=" name="csrf-token" />
</head>
<body>
<div class="files">
<form action="/users" class="upload" id="fileupload" method="post">
<input id="user_photo" name="user[photo]" type="file" />
<div>Upload …Run Code Online (Sandbox Code Playgroud) 我想要每个用户发送的最新消息.这是样本数据
表:对话
sender receiver message date
============================================================
1 2 "hi" "2013-03-04 09:55:01.122074"
2 1 "hello" "2013-03-04 09:55:32.903975"
1 2 "have you done with the taks?" "2013-03-04 09:57:46.383007"
2 1 "almost..." "2013-03-04 09:58:55.783219"
2 1 "should be able to finish 2day" "2013-03-04 09:59:28.950705"
2 3 "shall we start?" "2013-03-04 10:01:16.842725"
3 2 "give me a minute" "2013-03-04 10:01:41.994589"
3 2 "let us start" "2013-03-04 10:02:14.04551"
Run Code Online (Sandbox Code Playgroud)
对于ID为2的用户,我应该可以获得以下两条记录
1 2 "have you done with the taks?" "2013-03-04 09:57:46.383007"
3 2 "let us start" …Run Code Online (Sandbox Code Playgroud) 在部署应用程序时Rails 3.2.17,我们遇到以下错误.
EB-commandprocessor.log
+ su -s /bin/bash -c 'leader_only bundle exec rake db:migrate' webapp
rake aborted!
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
/var/app/ondeck/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace) (ElasticBeanstalk::ActivityFatalError)
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:189:in `rescue in exec'
...
caused by: command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/12_db_migration.sh
Run Code Online (Sandbox Code Playgroud)
这是我们的database.yml配置
production:
adapter: postgresql …Run Code Online (Sandbox Code Playgroud) deployment postgresql amazon-web-services ruby-on-rails-3 amazon-elastic-beanstalk
pdfseparate要求指定%d为PDF-page-pattern,并替换为页码。
$ pdfseparate CFL_1115_ISSUU.pdf cfl-%d.pdf作品。它将单独的输出文件名设置为cfl-1.pdf, cfl-2.pdf, ..., cfl-10.pdfetc。
现在我需要添加导致0修复的文件名字符串长度。因此,当我尝试在command中使用格式字符时$ pdfseparate CFL_1115_ISSUU.pdf cfl-%04d.pdf,它给出了错误Syntax Error: 'cfl-%04d.pdf' must contain '%d' if more than one page should be extracted
有人可以建议这种格式是否可行吗?
jquery ×2
postgresql ×2
ruby ×2
activeadmin ×1
activerecord ×1
curl ×1
debugging ×1
deployment ×1
file-upload ×1
html5 ×1
java ×1
javascript ×1
jax-rs ×1
jaxb ×1
jersey ×1
jquery-ui ×1
legacy-code ×1
migration ×1
pdf ×1
poppler ×1
rest ×1
rubymine ×1
sql ×1
unix ×1