Comments (21)
Hi Steve,
what's your cell's class name (full constant path, please)? Maybe paste the entire cell class file here, along with where it's stored.
from cells.
Hey Nick - thanks for the quick response.
Cell is:
module User::Cell
class Index < Trailblazer::Cell
def no_items
return "No Users" if model.size == 0
end
end
end
And lives in: app/concepts/user/cell/index.rb
Hope that's what you wanted to know.
from cells.
Yepp, looks correct, and now, show me how you invoke that cell.
from cells.
From the UsersController ...
def index
run User::Index
render cell(User::Cell::Index, result["model"]), layout: false
end
I have tried different layout options as well.
result["model"] is ...
#<ActiveRecord::Relation [#<User id: 1, email: "[email protected]", other_attributes_here>]>
There is only one user at the moment.
from cells.
So where does the view
template name come from? User::Cell::Index
, being a TRB::Cell
, will try to render app/concepts/user/view/index.haml
per default.
It must be a problem in that view, can you paste it?
from cells.
Yep, view template is in: app/concepts/user/view/index.haml
and is standard haml ...
- @title = "Listing Users"
- content_for :description do
%p Users registered on this site.
- content_for :actions do
= action_page_header new_user_path, 'Add User', 'plus'
.row
.col-xs-12.col-sm-12.col-md-12.col-lg-12
.sheet.sheet-condensed
.sheet-inner
%table.table
%thead
%tr
%th Email
%th
%tbody
etc ...
from cells.
Ok, so first of all, setting @instance
variables is a no-go. That's just so wrong. Second, content_for
is not supported in Cells, because it breaks with the idea of encapsulation.
What happens when you just say "hello!" in that template?
from cells.
Fair enough.
Changed index.haml to:
- %h1 Hello World
Same error.
from cells.
Correct me if I'm wrong, but is - %h1 ...
valid HAML?
from cells.
Oops. Your quite right - slip of the keyboard.
Changed the template to ...
%h1 Hello World
Same issue.
from cells.
As I said, I also cloned your own sample app, bundled with a fresh install and got the same error, with your templates. Seems to be more than the haml template structure or location?
Just not sure why I'm the only one getting it.
from cells.
Hi! Which app did you clone?
from cells.
from cells.
Hey Nick. Any thoughts for me on this error. I'd love to use cells, but I guess I can just use normal rails renderer.
from cells.
The example app works for me, just checked. Is it maybe that the example app is using Slim while you're trying to use Haml? Have you tried with .slim
?
from cells.
from cells.
If you want to use Haml, remove cells-slim
from the Gemfile and replace with cells-haml
(http://trailblazer.to/gems/cells/api.html#template-formats). Don't worry, we'll get you on da cells.
from cells.
Yep, have done that. As per previous comment ...
Here is my gem setup ...
rails (5.1.4)
cells (4.1.7)
cells-haml (0.0.10)
cells-rails (0.0.6)
reform-rails (0.1.7)
trailblazer-rails (1.0.4)
haml-rails (1.0.0)
I might try slim and hamlit as well - see if they make a difference. I'll let you know.
from cells.
from cells.
from cells.
Hi people! I encountered the same issue with Cells (Template missing: view: * prefixes: *
) and my search engine brought me there. I just had to rm -rf tmp/cache/
to fix the issue. Have a nice day!
from cells.
Related Issues (20)
- Cells + Airbrake issue - double exceptions raised HOT 2
- Using Cells with Rails engine that has html.erb partials not being picked up HOT 5
- Confusing file structure - views or view? HOT 7
- how to render erb templates when haml/hamlit and erb extensions installed HOT 3
- Render an array inside view cell HOT 1
- Escaping implementation seems to be a glaring LAYER VIOLATION, methinks.
- Is there some way to do html escaping default with options?
- Publish latest version on Rubygems HOT 10
- should default to file_name.html.erb or .haml HOT 1
- Can't get form_with to work from a cell in Rails 6 HOT 3
- License HOT 1
- Form Input renders as raw text in cell HOT 1
- Feature Request: Support Recyclable Cache Key
- Still maintained? Documentation URLs broken. HOT 9
- Default cache key produces clashes HOT 4
- Options hash is same instance passed to each cell when using collections HOT 1
- Slim v5 breaks cells HOT 9
- Ruby 3.0 ArgumentError: wrong number of arguments error with keyword args for Cell::Testing
- Ruby 3.0 ArgumentError: wrong number of arguments error with Caching
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cells.