r_c controller infecting other r_c controllers

0 views
Skip to first unread message

Jason Boxman

unread,
May 19, 2008, 4:25:59 PM5/19/08
to resource_controller
Honestly, this makes no sense. It only happens in production and only
after Mongrel has been running for a couple minutes. At first start
of Mongrel, it doesn't happen.

Missing template employees/company/index.html.erb in view path /srv/
rails/current/app/views

I've never defined anything like that in the EmployeesController,
ever. It correctly loads from company/index.html.erb in development,
always. In production, it gets confused and starts to think it's a
PhonesController, I guess.

I am using revision 164 from trunk presently.

Completely baffling. I have no namespaced EmployeeController
instances, either. (I've heard of collisions in production when such
things come into play.)

class PhonesController < AttributeController
index.wants.html do
render :action => "#{parent_type.to_s.underscore}/
index"
end
end

class EmployeesController < AttributeController ; end

class AttributeController < ApplicationController
resource_controller
layout 'attribute'
actions :all, :except => [:show]

[create, update].each do |action|
action.wants.js { render :text => url_for(:action
=> :index).to_json }
action.failure.wants.js { render :text =>
object.errors.for_base_and_collection.to_json }
end

destroy.wants.html { redirect_to url_for(:action => :index) }

private

def collection
@collection ||= end_of_association_chain.find(:all,
collection_options)
end

def collection_options
{:order => "#{model_name.to_s.pluralize}.id ASC"}
end
end

James Golick

unread,
May 19, 2008, 4:46:09 PM5/19/08
to resource_...@googlegroups.com
that's really, really weird, if you're using r164, because those accessors are inheritable.

I'm going to try to repeat the bug on a fresh project right now, and I'll let you know if I can repeat or not.

J.

James Golick

unread,
May 19, 2008, 4:58:30 PM5/19/08
to resource_...@googlegroups.com
yeah, I can repeat it in production mode

give me a bit to hunt down the problem, and I'll try to get you a fix asap

Jason Boxman

unread,
May 19, 2008, 5:09:00 PM5/19/08
to resource_controller
Oh, wow. I'm glad I'm not on crack.

Let us all know what it was -- I'm certainly curious to know.

Thank you!

On May 19, 4:58 pm, "James Golick" <jamesgol...@gmail.com> wrote:
> yeah, I can repeat it in production mode
>
> give me a bit to hunt down the problem, and I'll try to get you a fix asap
>
>
>
> On Mon, May 19, 2008 at 4:46 PM, James Golick <jamesgol...@gmail.com> wrote:
> > that's really, really weird, if you're using r164, because those accessors
> > are inheritable.
>
> > I'm going to try to repeat the bug on a fresh project right now, and I'll
> > let you know if I can repeat or not.
>
> > J.
>
> > On Mon, May 19, 2008 at 4:25 PM, Jason Boxman <jason.box...@gmail.com>

James Golick

unread,
May 19, 2008, 5:47:24 PM5/19/08
to resource_...@googlegroups.com
fixed in master on github... i'll merge to the other branches shortly.

basically what was happening was that the inhertiable accessors weren't working properly, because the #dup methods on ResourceController::ActionOptions, and FailableActionOptions weren't working right. They weren't actually duplicating all of the necessary data... didn't realize that was a pre-requisite for using inheritable accessors, although, thinking about it now, it makes a lot of sense.

J.
Reply all
Reply to author
Forward
0 new messages