-
Website
http://jamesgolick.com -
Original page
/2008/7/27/introducing-activepresenter-the-presenter-library-you-already-know.html -
Subscribe
All Comments -
Community
-
Top Commenters
-
jfcouture
2 comments · 4 points
-
peterwd
1 comment · 1 points
-
lucashungaro
5 comments · 1 points
-
luigimontanez
3 comments · 1 points
-
Millisami
1 comment · 1 points
-
-
Popular Threads
There might be a few cases where you would need the same forms in multiple controllers (i.e. the abstraction and reuse you provide with a presenter) but it seems that that would be a rare case. Is it worth the mental overhead of having this "presenter" concept for those few rare cases? My preference would be to just reuse the mixin concept people are already familiar with (i.e. implement the various REST actions on a module then mixin to multiple controllers). This would seem to give you the same reuse the presenter provides without the additional mental overhead of an entirely new concept.
Just my two cents
@Eric, this is an implementation of the Presenter design pattern: http://blog.jayfields.com/2007/03/rails-present...
I led a BOF session at Railsconf 2008 on this topic, and there's definitely a big interest and need for this gem. In fact I registered "active_presenter" on RubyForge, but never got around to doing anything with it, so if you want to publish this gem there, I'd be glad to transfer the project to you. Just hit me up with an email at mike /-at-/ subelsky.com.
-Mike
So one project with (to leave javascript out of the equation) 10 tasks in a single form for creating and updating the tasks?
What about deleting them?
Nice article.
We met in Berlin last year. I need to send you an email. Can you email me to the address included in this form?
Thanks.
<rant>
Why are multi-model forms so fraking hard (no standard solution, gotta write extra code, little documentation on the solutions that exists) in Rails when WebObjects was doing this 10 years ago with keypaths?
</rant>
I installed from Github as a plugin. Also, when using the presenter to create a user and an account I'm getting some weird posting issues.
so my AccountSignupPresenter presents :account, :user
then on my form I have this: form_for @account_signup_presenter, :url => accounts_path
for some reason everything looks great and works, but the form is posting to the accounts index action. It obviously should post to the accounts create action.
Any help would be appreciated. Thanks again for the great work!
:url => { :controller => 'accounts', :action => :create }
I haven't tried active_presenter yet, but it does seem intriguing.
CachingPresenter is a strict presentation-logic presenter. It does cool stuff with caching/memoization. Should it provide useful to James or anyone else seeing this post please check it out:
* Github - http://github.com/zdennis/caching_presenter/
* Docs - http://github.com/zdennis/caching_presenter/wik...
If I have a User model with an Address as Addressable, how would this work? I tried doing a UserPresenter using the UserController directly, then a ProfilePresenter using a seperate ProfileController and nothing would work.
In particular an edit example would be great. Or maybe I just missed something!
Anyway... great work!
James I found some problems when I used this gem with select_tags and names of models are like this
presents :photographer,
:user,
:location,
:photographer_award,
:photographers_language,
:photographer_nationality,
:photographer_reference,
:visa
so when I want to put <%= f.select :photographer_language_language_id, [[l(:select_one), nil]] + @languages.collect{|language| [l(:spoken_language, language.name.to_sym), language.id]}, :id => nil %>
and photographer_language_language_id is to catch language_id field from photographer_languages table
require File.expand_path(File.dirname(__FILE__) + '/../active_presenter')