Methods

Files

Cell::ActionView

Public Instance Methods

render_cell(name, state, opts = {}) click to toggle source

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>
# File lib/rails_extensions.rb, line 29
    def render_cell(name, state, opts = {})
      cell = Cell::Base.create_cell_for(@controller, name, opts)
      cell.render_state(state)
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.