Module Cell::ActionView
In: lib/rails_extensions.rb

Methods

Public Instance methods

Call a cell state and return its rendered view.

ERB example:

  <div id="login">
    <%= render_cell :user, :login_prompt, :message => "Please login" %>
  </div>

If you have a UserCell cell in app/cells/user_cell.rb, which has a UserCell#login_prompt method, this will call that method and then will find the view app/cells/user/login_prompt.html.erb and render it. This is called the :login_prompt state in Cells terminology.

If this view file looks like this:

  <h1><%= @opts[:message] %></h1>
  <label>name: <input name="user[name]" /></label>
  <label>password: <input name="user[password]" /></label>

The resulting view in the controller will be roughly equivalent to:

  <div id="login">
    <h1><%= "Please login" %></h1>
    <label>name: <input name="user[name]" /></label>
    <label>password: <input name="user[password]" /></label>
  </div>

[Source]

    # File lib/rails_extensions.rb, line 29
29:     def render_cell(name, state, opts = {})
30:       cell = Cell::Base.create_cell_for(@controller, name, opts)
31:       cell.render_state(state)
32:     end

[Validate]