Hi,
I was thinking whether it would be more elegant for a view to call
methods on the controller rather than rely on instance variables. I'm
not really sure what the answer is so thought I would throw it out
here.
Perhaps with a basic DSL that makes it explicit what the controller is
setting, like:
class BooksController < ActionController::Base
var :book do
Book.find(params[:id])
end
end
where var:
class ApplicationController..
def self.var(name, &block)
define_method(name, block)
helper_method(name)
# Perhaps memoize too?
end
end
Does this violate the rule that the controller should be driving the
view? Any major disadvantages you can see?
Regards,
Andrew
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.