这里有一个小问题.
我的闪光通知/警报在里面 [" "]

在我的控制器中,如果表单未保存,我必须显示错误.
format.html { redirect_to new_project_procurement_management_plan_path, alert:"#{@project_procurement_management_plan.errors.full_messages}"}
Run Code Online (Sandbox Code Playgroud)
这是我将flash放入视图的方式:
_alert.html.erb:
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert alert-<%= flash_class(level) %>" id="flash">
<a class="close" data-dismiss="alert" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
在我的帮助文件中:
#Flash Message
def flash_class(level)
case level
when :notice then "success"
when :error then "error"
when :alert then "error"
end
end
Run Code Online (Sandbox Code Playgroud)
现在我如何删除里面的错误显示 [" "]
谁知道在哪里配置它?谢谢.
编辑
这是我模型中的验证消息:
def equality
self.items.each do |item|
errors.add(:base, "#{item.description.capitalize}: …Run Code Online (Sandbox Code Playgroud) 每次我尝试重新索引使用...
耙太阳黑子:solr:reindex
这些错误消息始终显示:
错误 - RSolr ::错误:: Http - 500内部服务器错误 - 正在重试...错误 - RSolr ::错误:: Http - 500内部服务器错误 - 忽略...错误 - RSolr ::错误:: Http - 500内部服务器错误 - 正在重试...错误 - RSolr ::错误:: Http - 500内部服务器错误 - 忽略...
我试图停止然后开始使用...
rake sunspot:solr:stop
rake sunspot:solr:start
Run Code Online (Sandbox Code Playgroud)
但什么都没发生.
现在每次我尝试在localhost中运行我的应用程序...
这是错误:
RSolr::Error::Http - 500 Internal Server Error
Error: Severe errors in solr configuration.
Check your log files for more detailed information on what may be wrong.
If you want solr to continue after configuration errors, change:
<abortOnConfigurationError>false</abortOnConfigurationError> …Run Code Online (Sandbox Code Playgroud) 这是我第一次遇到这样的错误:
Running `rake db:migrate` attached to terminal... up, run.8524
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: Operation timed out - connect(2) (Errno::ETIMEDOUT)
Backtrace: /usr/local/heroku/lib/heroku/client/rendezvous.rb:39:in `initialize'
/usr/local/heroku/lib/heroku/client/rendezvous.rb:39:in `open'
/usr/local/heroku/lib/heroku/client/rendezvous.rb:39:in `block in start'
/usr/local/heroku/ruby/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
/usr/local/heroku/lib/heroku/client/rendezvous.rb:31:in `start'
/usr/local/heroku/lib/heroku/command/run.rb:113:in `rendezvous_session'
/usr/local/heroku/lib/heroku/command/run.rb:100:in `run_attached'
/usr/local/heroku/lib/heroku/command/run.rb:21:in `index'
/usr/local/heroku/lib/heroku/command.rb:206:in `run'
/usr/local/heroku/lib/heroku/cli.rb:28:in `start'
/usr/local/heroku/bin/heroku:24:in `<main>'
Command: heroku run rake db:migrate --app oppcis
Version: heroku-toolbelt/2.35.0 (x86_64-darwin10.8.0) ruby/1.9.3
Run Code Online (Sandbox Code Playgroud)
我已经出去使用heroku了一段时间......在大回归之后,我遇到了这个错误.
就现在的Heroku新闻而言,我已经过时了.
我希望有人可以给我一个建议,解决方案或涉及的问题.
谢谢.
编辑:
日志说......
2013-02-15T08:38:00+00:00 heroku[api]: Starting process …Run Code Online (Sandbox Code Playgroud) 我一直在关注以下教程:http://wiki.developerforce.com/page/Accessing_Salesforce_Data_From_Ruby
但是,我坚持你需要提供密钥的部分:
host: login.salesforce.com # Use test.salesforce.com for sandbox
client_secret: 1234567890 # This is the Consumer Secret from Salesforce
client_id: somebigidthinghere # This is the Consumer Key from Salesforce
sobject_module: SFDC_Models # See below for details on using modules
debugging: true # Can be useful while developing
username: me@mycompany.com
password: mypasswordplusmysecuritytoken
Run Code Online (Sandbox Code Playgroud)
我在哪里可以得到client_secret和client_id.来自Salesforce官方API站点的教程有点过时了.http://www.salesforce.com/us/developer/docs/api_rest/index.htm
而其他一些教程甚至没有提到从哪里获得它.
我已经在http://developer.force.com/创建了一个帐户
甚至创建了一个自定义应用程序,如果我错了,请纠正我.
然后不知道在哪里找到我需要的钥匙.
任何变通办法将不胜感激.
如何成功安装Mongrel for ruby 1.9.3
这是错误:
Building native extensions. This could take a while...
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lc... yes
creating Makefile
make
compiling http11_parser.c
compiling http11.c
http11.c: In function ‘http_field’:
http11.c:70:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c:71:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c:77:22: error: ‘struct RString’ has no member named ‘ptr’
http11.c:77:50: error: ‘struct RString’ …Run Code Online (Sandbox Code Playgroud) 知道为什么我不能为Mac 10.9和Rails 3安装therubyracer gem吗?
Installing therubyracer (0.11.3)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/xiruki/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
creating Makefile
make
compiling accessor.cc
clang: warning: argument unused during compilation: '-rdynamic'
In file included from accessor.cc:1:
./rr.h:462:14: error: no type named 'AccessorGetter' in namespace 'v8'
inline v8::AccessorGetter accessorGetter() {return &AccessorGetter;}
~~~~^
./rr.h:463:14: error: no type named 'AccessorSetter' in namespace 'v8'
inline v8::AccessorSetter accessorSetter() {return RTEST(set) ? …Run Code Online (Sandbox Code Playgroud) 嗨,我正在尝试编译ffmpeg,但此错误显示:
? ffmpeg [master] ./configure --enable-gpl --enable-version3 --enable-nonfree \
--enable-postproc --enable-libass \
--enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-libfreetype \
--enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libopenjpeg \
--enable-openssl --enable-libschroedinger --enable-libtheora \
--enable-libvo-aacenc --enable-libvorbis --enable-libvpx \
--enable-libx264 --enable-libxvid --prefix=/usr
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
ERROR: libfdk_aac must be installed and version must be >= 3.4.12.
If you think configure made a mistake, make sure you are using the latest
version …Run Code Online (Sandbox Code Playgroud) 试图实现,这种格式的自动冲刺 XXX-XXX-XXXX
这是我到目前为止所拥有的:
$('.telnumber').keyup(function() {
var foo = $(this).val().split("-").join(""); // remove hyphens
foo = foo.match(new RegExp('.{1,3}', 'g')).join("-");
$(this).val(foo);
});
Run Code Online (Sandbox Code Playgroud)
前两个块很好,但如何限制最后一个块接受4位数?
如果到目前为止有3个数字,它仍然是自动划线.
我不擅长REGEX所以任何想法都会受到赞赏.
最近,我通过databasedotcom gem将Salesforce API集成到了我的Rails 3.2应用程序中。
另外,还有一个后台作业用于数据同步。
登录我的专业版Salesforce帐户后,Resque作业失败,并显示此错误...
Class
Jobs::Salesforce::Contact
Arguments
1
Exception
Databasedotcom::SalesForceError
Error
The REST API is not enabled for this Organization.
Run Code Online (Sandbox Code Playgroud)
即使是专业版,我也将如何启用API?
我尝试使用Developer Edition,但没有问题。
在Salesforce中是否有允许使用REST API的特定版本?
专业版的试用版怎么样?
谢谢。祝你有美好的一天!
我正在尝试验证某个输入,其中用户只能输入整数值...否则将执行错误消息
$user_mcc = $_REQUEST['mobile_countrycode'];
if($user_mcc == ""){
is_numeric($_REQUEST['mobile_countrycode']);
}
if (!is_numeric($_REQUEST['mobile_countrycode'])){
echo '<script type="text/javascript">alert("Not a numeric value!\n\nMake sure that your country codes, area codes\nand mobile/fax/phone numbers are correct! \n"); return true;</script>';
echo '<script type="text/javascript">history.back();</script>';
die('' . mysql_error());
}
Run Code Online (Sandbox Code Playgroud)
我试过这么多的功能,如empty,is_null,== NULL,== 'NULL等...但没有奏效.
如果我将一个字符串值放入输入文本字段,就像我输入的那样... "Banana",!is_numeric可以执行上面的函数,因为输入的值是FALSE而不是数值.
但是,每当我将输入字段留空时NULL,该!is_numeric函数仍然可以执行,就像它将NULL值识别为非数值一样.!is_numeric如果输入值是,我该怎么做才能绕过函数NULL.谢谢.
PS:我已经尝试过!is_int,!is_integer而且ctype_digit,而是回到相同的结果,不接受NULL值.
我怎样才能实现这种表:

在“计划”列内,有子列(一月、二月等)。
我试过<th></th>里面<th></th>
但它不起作用。
看我的小提琴: http: //jsfiddle.net/TAJzY/1/
我有 2 个不同名称的下拉列表,我试图只在一个字段中进行查询。
我正在使用一个 jQuery 函数,其中如果item 1选中,将显示下拉列表 1,如果item 2选中,将显示下拉列表 2。
这是我从 mysql 数据库和表填充下拉列表的方式:
<div id="minquep">
<label>Branch</label>
<SELECT name="user_min">
<OPTION VALUE="0">Choose a branch
<?=$minq_options?>
</SELECT>
</div>
<div id="albury">
<label>Branch</label>
<SELECT name="user_branch">
<OPTION VALUE="0">Choose a branch
<?=$al_options?>
</SELECT>
Run Code Online (Sandbox Code Playgroud)
这就是我通过填写带有下拉列表的表单将查询插入 mysql 的方式:
if (isset($_REQUEST['Submit'])) {
$sql = "INSERT INTO $db_table(branch) values ('".mysql_real_escape_string(stripslashes($_REQUEST['user_branch'])).",".mysql_real_escape_string(stripslashes($_REQUEST['user_min']))."')";
if($_REQUEST['user_branch']= ""){
($_REQUEST['user_branch']) = NULL;
}
if($result = mysql_query($sql ,$db)) {
echo '<script type="text/javascript">alert("The user has been added successfully!\n");return true;</script>';
echo "<meta http-equiv=\"refresh\" content=\"0;URL=add_user.php\">";
}
else { …Run Code Online (Sandbox Code Playgroud) 我想知道它为什么不起作用.
这是我的JS:
$("#cat-code").change(function(){
var value = $("#cat-code option:selected").val();
if (value == "10400000"){
$("#div1").show();
$("#div2").hide();
}
});
Run Code Online (Sandbox Code Playgroud)
选择标记:
<select class="cat-code" id="cat-code" name="project_procurement_management_plan[items_attributes][0][category_id]">
<option value="1">10400000</option>
<option value="2">10401000</option>
</select>
Run Code Online (Sandbox Code Playgroud)
Div显示或隐藏:
<div class="div1">hi</div>
<div class="div2">hello</div>
Run Code Online (Sandbox Code Playgroud)
任何变通办法将不胜感激.谢谢.
ruby ×3
javascript ×2
mysql ×2
php ×2
salesforce ×2
ffmpeg ×1
heroku ×1
html ×1
html-table ×1
jquery ×1
macos ×1
mongrel ×1
regex ×1
solr ×1
sunspot ×1
therubyracer ×1