Class: Monolith::ModelsController::Index

Inherits:
View
  • Object
show all
Defined in:
app/controllers/monolith/models_controller.rb

Overview

Phlex views

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#models=(value) ⇒ Object (writeonly)

Sets the attribute models

Parameters:

  • the value to set the attribute models to.



149
150
151
# File 'app/controllers/monolith/models_controller.rb', line 149

def models=(value)
  @models = value
end

Instance Method Details

#view_templateObject



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'app/controllers/monolith/models_controller.rb', line 151

def view_template
  div(class: "p-6 space-y-4") do
    h1(class: "text-2xl font-bold") { "Models" }
    p(class: "text-sm") { "#{@models.size} ActiveRecord models in your application." }

    Table @models do
      it.row("Model") {
        nav_link it.name, controller: "/monolith/models", action: :show, id: it.to_param
      }
      it.row("Table") { |m|
        code { m.table_name }
      }
      it.row("Columns") {
        it.column_names.size.to_s
      }
    end
  end
end