我需要在应用程序ROR中的生产环境中安装postgresql,以便在使用heroku之后使用它,但是当我尝试安装gem'pg'时会触发以下错误.我是新手,所以我不知道那样做
我正在使用ruby 1.9.3p547(2014-05-14修订版45962)[i686-linux] rails
Rails 3.2.19 Ubuntu 12.04
的Gemfile
来源' https://rubygems.org '
宝石'轨道','3.2.19'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'hirb'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :production do
gem 'pg'
end …Run Code Online (Sandbox Code Playgroud) ruby ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 ruby-on-rails-4
我有一个问题我在ROR中创建了以下模型
create_table "seat_types", :force => true do |t|
t.string "type"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
Run Code Online (Sandbox Code Playgroud)
但是当我在rails控制台中向模型添加数据时,会出现以下错误:字段类型是字符串而不是外键
1.9.3-p547 :014 > SeatType
=> SeatType(id: integer, type: string, description: string, created_at: datetime, updated_at: datetime)
1.9.3-p547 :015 > a=SeatType.new
=> #<SeatType id: nil, type: nil, description: nil, created_at: nil, updated_at: nil>
1.9.3-p547 :016 > a.type="SC"
=> "SC"
1.9.3-p547 :017 > a.description="Servicio semicama"
=> "Servicio semicama"
1.9.3-p547 :018 > a.save
(0.2ms) BEGIN
SQL (0.5ms) INSERT INTO `seat_types` …Run Code Online (Sandbox Code Playgroud) 我需要获取 div en Jquery 的所有后代子项,不仅是直接子项 我需要属性 css 应用于元素 p 和元素跨度
<!DOCTYPE html>
<html>
<head>
<style>
.descendants * {
display: block;
border: 2px solid lightgrey;
color: lightgrey;
padding: 5px;
margin: 15px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("div").children().css({
"color": "red",
"border": "2px solid red"
});
});
</script>
</head>
<body>
<div class="descendants" style="width:500px;">div (current element)
<p>p (child)
<span>span (grandchild)</span>
</p>
<p>p (child)
<span>span (grandchild)</span>
</p>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我需要知道是否在 Javascript 中退出了一些从后到前的合并方法,或者我必须创建它
例子
var fruits = ["Banana", "Orange", "Apple", "Mango"];
Run Code Online (Sandbox Code Playgroud)
到
var fruits = ["Mango","Apple","Orange","Banana"];
Run Code Online (Sandbox Code Playgroud)