draper

    1熱度

    1回答

    On Rails的4當我執行了一個裝飾我得到了以下錯誤RSpec的測試: /app/spec/decorators/my_decorator_spec.rb:3:in `<top (required)>': uninitialized constant MyDecorator (NameError) 我肯定失去了一些東西,但我不知道是什麼。 我生成 rails g decorator My

    3熱度

    2回答

    使用Rails 5我加入了寶石 gem 'draper', '3.0.0.pre1' 然後當我打電話安裝發電機,我得到一個錯誤 Could not find generator 'draper:install'. Maybe you meant 'devise:install', 'config:install' or 'responders:install' 什麼林做錯了這裏?

    0熱度

    1回答

    我在我的應用程序中有各種相關的模型。我已經設置了Draper來在父類的初始化時裝飾關聯。 我有以下類別: Customer (has_many :accounts) Account (belongs_to :customer && has_many :facilities && has_one :contact) Contact (belongs_to :account) Facility

    0熱度

    2回答

    我在app/decorators/post_decorator.rb中有PostDecorator類。 它有一個調用Devise的current_user方法的方法。它看起來像這樣: class PostDecorator < Draper::Decorator delegate_all def voter h.current_user end end

    1熱度

    1回答

    我在處理draper gem時遇到了一些問題。 安裝布店 寶石 '布店' $ bundle install ,這是成功的。 做rails generate draper:install $ rails generate draper:install ,但我得到了一些錯誤 Expected string default value for '--test-framework'; got fa

    2熱度

    1回答

    裝飾在前期1.0版本布店寶石,我們能夠使用decorates方法明確指定類裝飾的(例如,當類被命名空間): MyClassDecorator < Draper::Base decorates :my_class, :class => Namespace::MyClass ... 現在(過濾器1.3)decorates不接受其他參數。 但只是省略:class選項導致"unin

    0熱度

    1回答

    我嘗試在我的項目中使用draper,decent_exposure和decent_decoration gems,但某些功能無法正常工作。這很奇怪,因爲我剛剛從antoher項目中複製了這些代碼。 我的控制器: class PostsController < ApplicationController expose_decorated(:post) expose_decora

    0熱度

    1回答

    我有我的裝飾問題: class ReviewDecorator < Draper:Decorator delegate_all def author @author = User.find_by(review.user_id) "#{@author.firstname} #{@author.lastname}" end end 我每次測試這

    0熱度

    2回答

    我想用戶draper寶石,看起來像我設置得很好,但是,當我調用我的draper方法內的方法時,我得到一個「未定義的方法錯誤」這裏是我所做的遠。 gem 'draper' bundle install rails g decorator MyModel 在我的裝飾,我有以下代碼。 class TaskDecorator < Draper::Decorator delegate_

    2熱度

    1回答

    考慮到我有一個類,從Draper::Decorator繼承,像這樣: class PageDecorator < Draper::Decorator delegate_all delegate :title, :name, :region, :keys, to: :glass_decorator, prefix: :glass def fu