On Thu, Nov 26, 2009 at 9:24 PM, Emerson Macedo wrote:
> Fernando Perez wrote:
> > Hi,
> >
> > Let's take the example of the depot app. In my controller I set @order.
> > Then in the view comes the bad stuff:
> >
> > @order.items.each do |item|
> > item.product.title
> > end
> >
> > Now I'm havi
Fernando Perez wrote:
> Hi,
>
> Let's take the example of the depot app. In my controller I set @order.
> Then in the view comes the bad stuff:
>
> @order.items.each do |item|
> item.product.title
> end
>
> Now I'm having problems specing item.product.title. A quick and dirty
> fix is to trade
I wrote a blog post that may be helpful.
http://www.patmaddox.com/blog/demeter-is-for-encapsulation Basically,
when you have structural objects as in this case, demeter isn't
useful.
Luke Redpath wrote something called Demeter's Revenge which you might
want to look at. I've not used it though so
+1 what we are doing here is rendering resources in different contexts. In
the original example we are rendering product resources in an order context.
We should let the product define how it should be viewed - after all it
knows best. If we need different views in different contexts then just
crea
The way I go about this is, IMO, pretty straight forward. I cringe
when people start talking about generating html in models, since I
think separation of concerns is much more important than law of
demeter, and I think that the model most definitely shouldn't be
concerned with how it needs
On 19 Apr 2009, at 19:54, David Chelimsky wrote:
On Sun, Apr 19, 2009 at 11:24 AM, Mark Wilden
wrote:
On Sun, Apr 19, 2009 at 3:51 AM, Matt Wynne
wrote:
@order_presenter.product_titles do |product_title, url|
<%= link_to product_title, url %>
end
The presentation of an order in most
>http://spin.atomicobject.com/2008/01/27/the-exceptional-presenter
Interesting idea too. So basically I need to totally rethink and
refactor the way my views display the information to the customer:
Let's see how I currently display or not an add to cart button depending
whether or not the
On Sun, Apr 19, 2009 at 11:24 AM, Mark Wilden wrote:
> On Sun, Apr 19, 2009 at 3:51 AM, Matt Wynne wrote:
>
>> @order_presenter.product_titles do |product_title, url|
>> <%= link_to product_title, url %>
>> end
>
> The presentation of an order in most apps will be constructed from
> additional c
On Sun, Apr 19, 2009 at 12:24 PM, Mark Wilden wrote:
> On Sun, Apr 19, 2009 at 3:51 AM, Matt Wynne wrote:
>
>> @order_presenter.product_titles do |product_title, url|
>> <%= link_to product_title, url %>
>> end
>
> The presentation of an order in most apps will be constructed from
> additional c
> This is where I start to introduce a presenter layer in between the
> view and the models.
Very interesting. Thank you very much.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/ma
On Sun, Apr 19, 2009 at 3:51 AM, Matt Wynne wrote:
> @order_presenter.product_titles do |product_title, url|
> <%= link_to product_title, url %>
> end
The presentation of an order in most apps will be constructed from
additional columns (e.g., color, size, price, extended price). These
columns
On 19 Apr 2009, at 11:08, Fernando Perez wrote:
@order.product_titles do |product_title|
<%= product_title %>
end
Another problem, is that not only do I need the title, but also a
clickable permalink which uses a url helper (not available to models),
the product price, and maybe othe
>@order.product_titles do |product_title|
> <%= product_title %>
>end
>
Another problem, is that not only do I need the title, but also a
clickable permalink which uses a url helper (not available to models),
the product price, and maybe other stuff in the future. So I might end
u
On 18 Apr 2009, at 23:08, Lenny Marks wrote:
On Apr 18, 2009, at 1:17 PM, Fernando Perez wrote:
Hi,
Let's take the example of the depot app. In my controller I set
@order.
Then in the view comes the bad stuff:
@order.items.each do |item|
item.product.title
end
Now I'm having problems s
On Apr 18, 2009, at 1:17 PM, Fernando Perez wrote:
Hi,
Let's take the example of the depot app. In my controller I set
@order.
Then in the view comes the bad stuff:
@order.items.each do |item|
item.product.title
end
Now I'm having problems specing item.product.title. A quick and dirty
fi
On Sat, Apr 18, 2009 at 10:17 AM, Fernando Perez wrote:
>
> @order.items.each do |item|
> item.product.title
> end
>
> Now I'm having problems specing item.product.title. A quick and dirty
> fix is to trade a for for an underscore, so I create Item#product_title:
>
> def product_title
> product.
Hi,
Let's take the example of the depot app. In my controller I set @order.
Then in the view comes the bad stuff:
@order.items.each do |item|
item.product.title
end
Now I'm having problems specing item.product.title. A quick and dirty
fix is to trade a for for an underscore, so I create Item#p
17 matches
Mail list logo