Thx so much Yehuda :-)

On Wed, Dec 3, 2008 at 11:16 PM, Yehuda Katz <[EMAIL PROTECTED]> wrote:
> You need to do:
>  resources :articles do
>    resources :comments do
>      resources :ratings, Community::Rating, :controller =>
> "community/ratings"
>    end
>  end
>
> Otherwise Merb guesses that :ratings means that Rating class.
> -- Yehuda
> On Wed, Dec 3, 2008 at 11:58 AM, Martin Gamsjaeger <[EMAIL PROTECTED]>
> wrote:
>>
>> Hey all,
>>
>> I have my routes setup like so:
>>
>>  resources :articles do
>>    resources :comments do
>>      resources :ratings, :controller => "community/ratings"
>>    end
>>  end
>>
>> My ratings model is defined like
>>
>> module Community
>>
>>  class Rating
>>
>>    include DataMapper::Resource
>>
>>    property :id,         Serial
>>    property :comment_id, Integer
>>    property :rate,       Integer
>>
>>    belongs_to :comment
>>
>>  end
>>
>> end
>>
>> When I POST to /articles/1/comments/1/ratings it works fine, but then,
>> when I want to redirect to
>>
>> /articles/1/comments/1/ratings/1
>>
>> using
>>
>> redirect @article, @comment, @rating
>>
>> and I get the following error:
>>
>>  ~ Resource route not found: [#<Article id=1 title="yo" body="snusnu"
>> editor_id=nil>, #<Comment id=1 article_id=1 body="wassup">,
>> #<Community::Rating id=1 comment_id=1 rate=1>] -
>> (Merb::Router::GenerationError)
>>
>> If I don't nest the rating model, everything works fine!
>>
>> Any ideas?
>>
>> cheers
>> snusnu
>>
>>
>
>
>
> --
> Yehuda Katz
> Developer | Engine Yard
> (ph) 718.877.1325
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to