Giter VIP home page Giter VIP logo

Comments (15)

apotonick avatar apotonick commented on June 14, 2024

Did you try it, looks good :-)

That's something we should get running soon. Anyway, if you need a quick workaround, just use the controller as cell server, like

class CellController < ...
  def serve
    render :text => render_cell(...)

from cells.

mooktakim avatar mooktakim commented on June 14, 2024

Recent entry in the blog mentions that in Rails3 cells are controllers?
so i'm think BasketCell.action(:index) should be possible.

Will test this out

from cells.

mooktakim avatar mooktakim commented on June 14, 2024

nope, can't do it.
"action" method doesn't exist.

It would be great if we could do this though, would be VERY handy.
Similar to how rack app can be mounted in a route for rails3

from cells.

apotonick avatar apotonick commented on June 14, 2024

I more and more love this idea! You could attach a cell to a route in order to provide RESTful HTML views of resources, for instance. Will check that out!

from cells.

mooktakim avatar mooktakim commented on June 14, 2024

Absolutely. It would be a very cool way to decouple the cells and routes.
You would have all the flexibility to create whatever routing you would want.

from cells.

apotonick avatar apotonick commented on June 14, 2024

Wait- wouldn't this strengthen the coupling between Cell and route? The cell being a complete Rack-compatible controller sitting directly on a route?

from cells.

mooktakim avatar mooktakim commented on June 14, 2024

I mean, it would decouple cells from controllers. At the moment you need require a controller to display the cell, so you can route to it.

from cells.

apotonick avatar apotonick commented on June 14, 2024

The emerging problem will be: Cells don't know about Rack so far, so we will need a module to make 'em speak HTTP.

from cells.

jamesbebbington avatar jamesbebbington commented on June 14, 2024

@apotonick did this go anywhere in the end? We too would like to explore caching cells with Varnish.

from cells.

nickhoffman avatar nickhoffman commented on June 14, 2024

Yeah, this is a great idea. +1

from cells.

rainhead avatar rainhead commented on June 14, 2024

+1

from cells.

apotonick avatar apotonick commented on June 14, 2024

The recent commits in master removed the controller dependency. You can now create standalone cells like

class StandaloneCell < Cell::Base
end

StandaloneCell.new.render_state(:drink)

The next step would be to make cells mountable on routes - could anyone provide a minimal example app to show me what's missing?

from cells.

apotonick avatar apotonick commented on June 14, 2024

Ok, guys, this WORKS now in 3.8.0!!! Just be sure to derive your cell from Cell::Base if you don't want the AC dependency.

To mount it:

match "/posts" => proc { |env|
  [ 200, {}, [ Cell::Base.render_cell_for(:post, :show) ]]
}

Lemme know how it works and what can be improved.

from cells.

apotonick avatar apotonick commented on June 14, 2024

http://nicksda.apotomo.de/2011/12/mounting-a-cell-to-a-route-with-cells-3-8/

from cells.

rainhead avatar rainhead commented on June 14, 2024

This is pretty cool, but it will almost certainly be several months before we're able to play with it. I'm not sure it's exactly what we're looking for, but I can't tell you what that is because I've been out of this area for too long.

from cells.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.