On Wed, Jan 7, 2009 at 7:47 PM, AkitaOnRails <fabio...@gmail.com> wrote:
> If you're watching the newest updates to the main repo, you'll see
> that I've been quite busy :-)
Very nice, thanks for the work.
> But there are still some oddities that I would like to expose
> here. One is actually breaking my head right now.
>
> Take this route:
>
> map.resources :projects do |projects|
> projects.resources :repositories, :member => { :new => :get }
> end
>
> This is a simplification of the clone page. If I load this under Rails
> 2.1.0 and simulate his named route:
>
>>> new_project_repository_path(1,2)
>
> It works properly and gives back:
>
> => "/projects/1/repositories/2/new"
>
> But, if I just change the version to Rails 2.2.2 and run it again, now
> I have:
>
>>> new_project_repository_path(1,2)
> NoMethodError: You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.to_sym>
> [snip]
> Does anyone know what have changed in the nesting logic of 2.2.2 that
> makes this break to badly?
I think the primary reason is probably that we're breaking rails
conventions horribly here, basically the #new and #create actions in
the RepositoriesController behave very differently in that they
require the repository id as well in the route
(/projects/x/repos/y/new as opposed to the usual rails way:
/projects/x/repos/new). I've forgotting my originally reasoning for
breaking that convention, but probably related to being too lazy to
figure out two better action names, or move it to another controller.
Any suggestions for a nicer approach? The intent of the to actions is
to clone a repository.
JS