bilson
unread,Apr 28, 2009, 11:44:32 AM4/28/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Comatose Plugin
I must have missed it, but is there an example of a simple Comatose
drop involving an ActiveRecord model? In Rails, it's fairly easy to
setup Liquid in a model using...
liquid_methods :attribute1, :attribute2, etc.
In Comatose, I am not sure how to achieve the same. For example, I
have defined the following Comatose drop for the Person model...
Comatose.define_drop 'person' do
def all_people
Person.all
end
end
In the view I am hoping to achieve the following...
{% for p in person.all_people %}
<tr>
<td>{{ p.firstname}}</td>
<td>{{ p.lastname }}</td>
<td>{{ p.email }}</td>
</tr>
{% endfor %}
It doesn't surprise me that this doesn't work with just that, but I do
not know what to add to make it work in this manner. I have tried
adding the "liquid_methods" method to the ActiveRecord model, but that
did nothing.
I can get it to print out this information, but the method is poor...
Comatose.define_drop 'person' do
def all_people
Person.all.collect {|p| [p.firstname, p.lastname, p.email]}
end
end
{% for p in person.all_people %}
<tr>
{% for column in p %}
<td>{{ p.firstname}}</td>
{% endfor %}
</tr>
{% endfor %}
Is there a simple way to make this work? Thanks for your thoughts.
Best Regards,
David Baldwin