Cells Rails控制台中的开拓者单元
如何在Rails控制台中使用“开拓者”单元 概念助手不起作用Cells Rails控制台中的开拓者单元,cells,trailblazer,Cells,Trailblazer,如何在Rails控制台中使用“开拓者”单元 概念助手不起作用 irb(main):002:0> c = concept(Resource::Cell, l) NoMethodError: undefined method `concept' for main:Object Did you mean? concern context from (irb):2 concept()&cell()是控制器帮助程序,这意味着如果控制器未加载,它们将无法在控制
irb(main):002:0> c = concept(Resource::Cell, l)
NoMethodError: undefined method `concept' for main:Object
Did you mean? concern
context
from (irb):2
concept()&cell()是控制器帮助程序,这意味着如果控制器未加载,它们将无法在控制台中工作。但你不需要它们
使用cell最简单的方法就是像这样调用它们。您可以使用任何其他ruby对象
单元格
# concepts/song/cell/cell.rb
module Song::Cell
class Index < Trailblazer::Cell
def show
render
end
end
class Show < Trailblazer::Cell
def show
render
end
end
end
控制台
# Any of the following calls - they are all equivalent pretty much
# The spit html output of the cell
Song::Cell::Show.(Song.last).()
Song::Cell::Show.(Song.last).render
Song::Cell::Show.(Song.last).(:show)
# Any of the following calls - they are all equivalent pretty much
# The spit html output of the cell
Song::Cell::Show.(Song.last).()
Song::Cell::Show.(Song.last).render
Song::Cell::Show.(Song.last).(:show)