小编Don*_*llo的帖子

Slim SyntaxError

我决定尝试苗条的模板引擎,但我有奇怪的错误.

ActionView::Template::Error (Unknown line indicator
  app/views/layouts/application.html.slim, Line 1
    <!DOCTYPE html>
    ^
):
  slim (1.1.1) lib/slim/parser.rb:448:in `syntax_error!'
Run Code Online (Sandbox Code Playgroud)

它出现在所有页面上.例如:

Started GET "/" for 127.0.0.1 at 2012-03-21 09:47:49 +0400
Processing by AuthenticationsController#index as HTML
  Authentication Load (0.9ms)  SELECT "authentications".* FROM "authentications" 
  User Load (1.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 17 LIMIT 1
  CACHE (0.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 17 LIMIT 1
  Rendered authentications/index.html.slim within layouts/application (88.4ms)
Run Code Online (Sandbox Code Playgroud)

我有gem 'slim-rails'我的Gemfile和

意见/认证/ index.html.slim:

table
  tr
    th User
    th Provider …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails slim-lang

7
推荐指数
1
解决办法
4362
查看次数

Textarea高度Chrome问题

有没有人在Chrome中解决textarea身高问题?

在这种简单的情况下:

<div>
    <textarea>
    </textarea>
</div>
Run Code Online (Sandbox Code Playgroud)

Google Chrome添加了两个像素,因此div.height = textarea.height + 2px.是的,我尝试Eric的"reset.ccs" - 没有用.

PS当然在我的"简单案例"textarea和div有边框,填充和边距0px.

css height textarea google-chrome

6
推荐指数
1
解决办法
7580
查看次数

如何使用带骨干的超薄模板?

如何使用带骨干的超薄模板?

我在ruby-on-rails应用程序中使用使用eco模板的rails-on-rails gem.但在我的项目中,我使用瘦模板引擎,当然我只想使用一种模板类型.但我怎样才能转向骨干?

来自codebrew的Gem backbone-rails提供erb和haml,所以我想我也可以使用slim.但是怎么样?

ruby-on-rails backbone.js slim-lang

5
推荐指数
1
解决办法
3274
查看次数

在销毁对象时清空列名

我有两个模特:Show和Deal.

class Show < ActiveRecord::Base
  has_many :deals, :inverse_of => :show, :dependent => :destroy
  ...

class Deal < ActiveRecord::Base
  belongs_to :show, :inverse_of => :deals
  ...
Run Code Online (Sandbox Code Playgroud)

当我试图销毁Show时出现此错误:

PG::Error: ERROR:  zero-length delimited identifier at or near """"
LINE 1: DELETE FROM "deals" WHERE "deals"."" = $1
Run Code Online (Sandbox Code Playgroud)

为什么列名称为空?在schema.rb中:

create_table "deals", :id => false, :force => true do |t|
  t.integer "discount_id"
  t.integer "show_id"
end

create_table "shows", :force => true do |t|
  t.integer  "movie_id"
  t.integer  "hall_id"
  t.datetime "show_time"
  t.integer  "city_id"
  t.integer  "price"
end
Run Code Online (Sandbox Code Playgroud)

外键添加到数据库中

CONSTRAINT fk_deals_shows …
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails

5
推荐指数
1
解决办法
806
查看次数