嗨我在捆绑安装时遇到此错误...
Installing therubyracer (0.10.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/rajendran/.rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/rajendran/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)
Gem files will remain installed in /home/rajendran/.rvm/gems/ruby-1.9.3-p374/gems/therubyracer-0.10.1 for inspection.
Results logged …Run Code Online (Sandbox Code Playgroud) 在redux-form的v6中,我们可以显示正常输入字段的错误,如下所示
我们可以像这样创建自定义renderField
const renderField = ({ input, label, type, meta: { touched, error } }) => (
<div>
<label>{label}</label>
<div>
<input {...input} placeholder={label} type={type}/>
{touched && error && <span>{error}</span>}
</div>
</div>
)
Run Code Online (Sandbox Code Playgroud)
在表单中,我们可以使用该自定义renderField
<Field name="username" type="text" component={renderField} label="Username"/>
Run Code Online (Sandbox Code Playgroud)
现在我需要知道,我们如何为select字段做同样的事情,我们应该如何将dropdown选项传递给这个自定义renderFields,是否有想法为select创建自定义renderField?
您好,我有两个具有 has_one 关联的模型。我需要使用委托字段进行搜索。
**Model 1:**
class Reservation < ActiveRecord::Base
belongs_to :content
delegate :type, :title, :to => :content
end
**Model 2:**
class Content < ActiveRecord::Base
has_one :reservation
end
Run Code Online (Sandbox Code Playgroud)
由于委托,以下查询工作正常:
reservations = Reservation.last
reservations.title
~ Content Load (0.6ms) SELECT `contents`.* FROM `contents` WHERE `contents`.`id` = 95 LIMIT 1
=> "Birthday Party"
Run Code Online (Sandbox Code Playgroud)
现在我需要使用委托字段进行查询:
reservations = Reservation.where("title = ?","some_title")
Run Code Online (Sandbox Code Playgroud)
它返回错误:
Unknown column 'title' in 'where clause'
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?我这样做的方式正确吗?感谢您阅读我的问题。
ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.1 ruby-on-rails-3.2 rails-activerecord
在角度下拉列表中显示选定值时遇到问题.当我给这样的时候它起作用
$scope.selectedItem = $scope.items[1];
Run Code Online (Sandbox Code Playgroud)
如果我直接给出那个价值,那就不行了
$scope.selectedItem = { name: 'two', age: 27 };
Run Code Online (Sandbox Code Playgroud)
HTML:
<html ng-app="app">
<body>
<div ng-controller="Test">
<select ng-model="selectedItem" ng-options="item.name for item in items">
</select>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
JS:
var app = angular.module('app',[]);
app.controller('Test',function($scope){
$scope.items = [{name: 'one', age: 30 },{ name: 'two', age: 27 },{ name: 'three', age: 50 }];
$scope.selectedItem = $scope.items[1];
});
Run Code Online (Sandbox Code Playgroud)
CODEPEN: http ://codepen.io/anon/pen/zxXpmR
解:
谢谢samir-das.我根据你的建议修好了.
var choosen_value = { name: 'two', age: 27 };
angular.forEach($scope.items, function(item){
if(angular.equals(choosen_value, item)){
$scope.selectedItem = item; …Run Code Online (Sandbox Code Playgroud) 这是我的桌子.
Ticket(id int auto_increment,name varchar(50));
Run Code Online (Sandbox Code Playgroud)
插入此表后,我希望发送id和邮件名称..如何获取最后一个Inserted值.
有助于解决这个问题......
这是我的Neo4j主动节点
class User
include Neo4j::ActiveNode
has_many :out, :following, type: :following, model_class: 'User'
end
john = User.find(:name => "John")
tom = User.find(:name => "Tom")
# create following relationship john --> tom
john.following << tom
# check count
john.following.count
#=> 1
# again create the relationship
john.following << tom
# again check count
john.following.count
#=> 2
Run Code Online (Sandbox Code Playgroud)
我想创造独特的关系.
为避免重复,我们必须在创建关系密码查询时使用create unique.
例:
MATCH (root { name: 'root' })
CREATE UNIQUE (root)-[:LOVES]-(someone)
RETURN someone
Run Code Online (Sandbox Code Playgroud)
参考:http://neo4j.com/docs/stable/query-create-unique.html
我怎么能用Rails在Neo4j.rb中做到这一点......?
提前致谢..
我正在使用Neo4j.rb将Neo4j Graph数据库与Rails集成.
我应该使用JRuby还是Ruby?
使用neo4j.rb与JRuby和Ruby有什么区别(任何利弊)?
一些例子告诉我们使用JRuby,我也可以用Ruby执行Rails应用程序.
通过rails app进行迁移时出现此错误
Gem:模块的未定义方法`cache'
我正在使用
Rails 3.2.9
Ruby 1.8.7
Ubuntu 12.04
rake db:migrate --trace
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/object.rb:138: warning: method redefined; discarding old try_dup
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/symbol.rb:3: warning: method redefined; discarding old try_dup
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/time.rb:41: warning: method redefined; discarding old to_datetime
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/boolean.rb:2: warning: method redefined; discarding old try_dup
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/boolean.rb:8: warning: method redefined; discarding old try_dup
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/module.rb:14: warning: method redefined; discarding old try_dup
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/nil.rb:2: warning: method redefined; discarding old try_dup
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/numeric.rb:2: warning: method redefined; discarding old try_dup
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/merb-core-1.1.3/lib/merb-core.rb:477: warning: method redefined; discarding old orm
/home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/merb-core-1.1.3/lib/merb-core.rb:494: warning: method redefined; …Run Code Online (Sandbox Code Playgroud) ruby rubygems ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2
我正在使用carmen rails gem来选择国家和次区域.实施数据库后保存国家代码和子区域代码.
我可以使用此代码从代码中获取国家名称@country_name = Carmen::Country.coded(country_code)
现在我想从子区域代码获取子区域名称.
帮我解决这个问题.
我正在为我的 Express.js 应用程序使用 Bookshelf.js ORM,在 Bookshelf ORM 中仅给出了定义模型和关联的示例..
我找不到任何地方,如何定义模型属性和数据类型,例如
name: {
type: string
}
age: {
type: number
}
Run Code Online (Sandbox Code Playgroud)
需要帮助.. 提前致谢..
这是我的javascript代码,我想将选项的当前选定值传递给我的js函数,在此代码中我使用静态数字6.
<select name='project_name' class='required input_field' id='project_name' onchange="sendRequest('GET','getClientName.jsp?ProjectId=6')">
<option value=''>-- Select --</option>
<option value="1">Project 1</option>
<option value="2">Project 2</option>
<option value="3">Project 3</option>
</select>
Run Code Online (Sandbox Code Playgroud)
帮我解决这个问题......
在构建 ORM 查询时,我想查看执行的实际(原始)查询是什么。
例如在 Rails 中,我们可以这样做:
User.where(name: 'Oscar').to_sql
# => SELECT "users".* FROM "users" WHERE "users"."name" = 'Oscar'
Run Code Online (Sandbox Code Playgroud)
Bookshelfjs 中存在此功能吗?或任何其他方式来获得这个?
提前致谢