trim()在这里,我的函数值存在问题PostgreSQL:
Ruby代码:
if(this.modelName=="ClientOffice")
{ this.params="model_name="+this.modelName+"&action_name="+this.actionName+"&
find_condition=btrim(clients_corporate_billings.id,' ') %3D
btrim('"+validString('populateValue0','text')+"',' ')
& object_id="+this.objectId;
}
Run Code Online (Sandbox Code Playgroud)
&action_name="+this.actionName+"
&find_condition=btrim(clients_corporate_billings.id,' ') %3D
btrim('"+validString('populateValue0','text')+"',' ')
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,btrim是functionPostgreSQL 进行修剪,但它给出/产生错误。
在这里,在RUBY我需要一个像这样的格式
"2011年2月1日11.00"
.我试过这个
"Time.now.utc.strftime("%B %d %Y %R")"
Run Code Online (Sandbox Code Playgroud)
但我需要格式化后缀为st,nd,rd,th等的数字.请提出建议.
在我的代码中"
NoMethodError(尝试调用私有方法):app/controllers/project_evaluations_controller.rb:94:在`calculate'中
发生.SampleCode:对于Controller :: Index&Show Method未提及.
class ProjectEvaluationsController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:index, :show]
def calculate
@project_id = params[:id]
@costs_last_calculated = Time.now.utc
@total_internal_hours = 10
@total_external_hours = 20
@project_evaluation.update(:internal_hours => @total_internal_hours, :external_hours => @total_external_hours, :costs_last_calculated => @costs_last_calculated)
render :action=>"show"
end
end
Run Code Online (Sandbox Code Playgroud)
路线:
resources :project_evaluations do
match "calculate", :on => :collection
end
Run Code Online (Sandbox Code Playgroud)
建议任何解决方案!
在Rails中,我试图将秒仅转换为小时。但是巧合的是,功能还提供了其他东西。
For example - Second = 164580
Output like : 45:43:0
Run Code Online (Sandbox Code Playgroud)
在间隔24小时后,它也会转换为一天。我正在尝试使用任何Ruby内置函数来仅获取总时数。
试图构建phonegap应用程序,但奇怪的错误:-
user@ubuntu:~/Projects/PhoneGap/testapp$ phonegap build android
[phonegap] executing 'cordova build android'...
Running command: /home/user/Projects/PhoneGap/testapp/platforms/android/cordova/build
module.js:338
throw err;
^
Error: Cannot find module 'q'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/user/Projects/PhoneGap/testapp/platforms/android/cordova/lib/spawn.js:23:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
You may not have the required environment or OS to build this project
Run Code Online (Sandbox Code Playgroud)
科尔多瓦-v => 5.3.3
想要的:{“ node”:“ 0.8.x || 0.10.x”}(当前:{“ node”:“ 0.12.7”,“ npm”:“ 2.11.3”}
请提出一些建议..谢谢
我想找到一种方法来清除代码选择ui-select.
例如,我有以下代码
<ui-select ng-model="selectedCustomerCode" ng-if="CustomerIds.length>1" on-select="CustomerCodeFiltersOnSelectCallback($item, $model)" theme="bootstrap">
<ui-select-match class="ui-select-match" allow-clear="true" placeholder="??????? ??????? ??????...">{{$select.selected.CCode}}</ui-select-match>
<ui-select-choices class="ui-select-choices" repeat="customer in CustomerIds | propsFilter: {CCode: $select.search}">
<div ng-bind-html="customer.CCode | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
Run Code Online (Sandbox Code Playgroud)
我想碰上一个清晰的按钮并清除一些输入,包括ui-select.清除ui-select的代码是什么?
在这里,我无法在postgre sql查询中将布尔值转换为字符.
SELECT *FROM ltl_class_nmfc_aliases
WHERE ltl_class_nmfc_aliases.id
NOT IN(SELECT ltl_class_nmfc_aliases_id FROM commodities_shippeds
WHERE commodities_shipped_obj_type LIKE 'ClientOffice')
OR ltl_class_id IS NULL
AND lower(commodity_description_alias) LIKE E'%%'
AND lower(ltl_value) LIKE E'%92.5%'
AND hazardous :: integer LIKE E '%%'
AND cast(schedule_b as character varying(255)) LIKE E'%%'
AND cast(harmonized_tariff as character varying(255)) LIKE E'%%'
ORDER BY commodity_description_alias,ltl_value LIMIT 25;
Run Code Online (Sandbox Code Playgroud)
在这里,我无法在AND hazardous :: integer LIKE E '%%'
建议我如何进行类型转换?
在红宝石中,
@today_date = Time.now.utc.strftime("%Y-%m-%d")
Run Code Online (Sandbox Code Playgroud)
如果今天的日期是:: 2011-07-20
但现在我想before 2 days :: 2011-07-17通过使用Ruby代码来约会.请提出建议.
谢谢
在我的本地机器上,我正在尝试安装与日期相关的格式化程序宝石.但在安装时我遇到了一些奇怪的错误.
[admin@localhost test_folder]$ gem install formatter-0.0.1.gem
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/local/rvm/gems/ruby-2.0.0-p353
directory.
Run Code Online (Sandbox Code Playgroud)
我无法在本地安装它.操作系统是CentOS,Ruby版本是Ruby2.
提前致谢
大家好我创建了一个带有令牌认证的RESTful API(Rails 4 + Devise),我还用gem(rack-cors)管理CORS实现,但现在我想用angular.js的API
为此,我这样做:
var app = angular.module('models');
app.factory('Session',['$resource',function($resource){
var Session = $resource(
'http://api.creositios.dev/sessions/:id',
{},
{
create: { method: 'POST'},
delete: { method: 'DELETE', params: { id: '@id'} }
}
);
return Session;
}]);
Run Code Online (Sandbox Code Playgroud)
这是我的控制者
app = angular.module('controllers');
app.controller('SessionCtrl',['$scope','Session',function($scope,Session){
$scope.new_session = function(){
$scope.session = Session.create({email: 'developer.jimenez@gmail.com', password: '12345678'});
};
}]);
Run Code Online (Sandbox Code Playgroud)
到目前为止,我对实现没有问题.我的问题是不知道如何管理返回我工厂的令牌.
使用angular.js管理用户令牌的好方法是什么,并在angular.js中的不同控制器中验证用户?
这是我第一个使用令牌进行身份验证的应用.建议非常感谢!
javascript restful-authentication access-token angularjs angularjs-scope
例如,我有一个未排序的整数数组
array = [ 2,5,3,6,33,11,7,23,8,50,9 ]
Run Code Online (Sandbox Code Playgroud)
通过最小迭代,我如何找到两个总和为10的元素?
方法1:我假设
我尽力找到最好的方法,但没有得到任何解决方案.
是否可以在轨道上的ruby中检测字符串的最后一个字符并用""替换它.说明::假设我有字符串作为"demo-"然后我必须检查它的最后一个字符,如果它是" - "然后用""替换它,否则不应该采取任何行动.
示例 - 代码::
search_text.downcase! if !search_text.nil?
Run Code Online (Sandbox Code Playgroud)
现在如果seach_text的值为"demo-",则通过替换" - "将其更改为"demo".
提前致谢 !!!
ruby ×7
angularjs ×2
postgresql ×2
rubygems ×2
sql ×2
access-token ×1
arrays ×1
controller ×1
cordova ×1
database ×1
datetime ×1
gem ×1
javascript ×1
ui-select ×1