Skip to content

Commit 3208f9c

Browse files
committed
Add #cells_for
1 parent d81a003 commit 3208f9c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/controllers/hotsheet/sheets_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Hotsheet::SheetsController < Hotsheet::ApplicationController
66

77
def index
88
@columns = @sheet.columns
9-
@cells = @sheet.model.pluck(*@columns.map(&:name)).transpose
9+
@cells = @sheet.cells_for(@columns)
1010
end
1111

1212
def update

lib/hotsheet/sheet.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def columns
2929
@columns.select(&:visible?)
3030
end
3131

32+
def cells_for(columns)
33+
@model.pluck(*columns.map(&:name)).transpose
34+
end
35+
3236
private
3337

3438
def ensure_model_exists!(name)

0 commit comments

Comments
 (0)