On Thu, Sep 15, 2011 at 6:02 PM, Mauro <[email protected]> wrote:

> class Shop < ActiveRecord::Base
>  has_many :documents, :dependent => :restrict
> end
>
> class Document < ActiveRecord::Base
>  belongs_to :shop
>  default_scope :order => 'updated_at DESC'
> end
>
> in the Shop show view I have:
>
> - for document in @shop.documents
>    %li(id="shop_documents")= link_to document.subject,
> shop_document_url(@shop, document)
>
> I want list document based on reference_date attribute and not using
> default scope.
> I've tried:
>
> def show
>  @shop = Shop.unscoped.find(params[:id], :include => :documents,
> :order => "documents.reference_date")
>
> but don't work.
>
>
Look at
http://stackoverflow.com/questions/1648971/rails-why-is-with-exclusive-scope-protected-any-good-practice-on-how-to-use-it


> --
> 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.
>
>


-- 
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

-- 
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.

Reply via email to