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