Re: [Rails] Can only traverse a polymorphic association in one direction

2010-06-03 Thread BarryOg
Thanks for taking the time to read through my code and spot the obvious, I guess too much coffee and too little sleep is not the best recipe. Matt Jones wrote: > > > The has_one is still named what you've specified (:node_entry in this > case), the polymorphic stuff doesn't change that... > >

[Rails] Can only traverse a polymorphic association in one direction

2010-05-27 Thread BarryOg
Hi all, I'm working on a polymorphic association and I've run into a bit of a stumbling block. I only seem to be able to traverse the relationship in one direction and not the other. This is what my code looks like: class NodeEntry < ActiveRecord::Base acts_as_nested_set belongs_to :node,

Re: [Rails] Finding it difficult to test a before_filter on my ApplicationController

2010-04-15 Thread BarryOg
Frederick Cheung-2 wrote: > > > > That's not quite what I meant. What i meant was > > > class ApplicationControllerTest < ActionController::TestCase > class StubController < ApplicationController > def index >render :text => 'index action' > end > end > tests Applicati

Re: [Rails] Finding it difficult to test a before_filter on my ApplicationController

2010-04-15 Thread BarryOg
Frederick Cheung-2 wrote: > > > Assuming for a moment (and I don't know if this is true) that you > can't test application controller directly, there's no reason you > cannot create a subclass of ApplicationController that only exists in > your test and which you use to exercise the methods pr

Re: [Rails] Finding it difficult to test a before_filter on my ApplicationController

2010-04-15 Thread BarryOg
Marnen Laibow-Koser-2 wrote: > > > I do not know about any design decisions but I do agree with Cojones to > move test_authorize_works_when_user_logged_in into the User or > AccessControl test. > > I don't mean to be pedantic when asking this, only want to have a better understanding of the

Re: [Rails] Finding it difficult to test a before_filter on my ApplicationController

2010-04-15 Thread BarryOg
Marnen Laibow-Koser-2 wrote: > > Of course, you can keep it in the ApplicatonController. That's what the > ApplicationController is for. I just wouldn't test the > ApplicationController itself cause it doesn't make sense to me and I > guess you're not supposed to test it anyway since there's

Re: [Rails] Finding it difficult to test a before_filter on my ApplicationController

2010-04-15 Thread BarryOg
Marnen Laibow-Koser-2 wrote: > > In my opinion this test belongs to the UserSession or User controller > cause you're testing if a user is authorized not the application. You > just need to put it into the application controller for its > application-wide accessibility. Besides that I can't

[Rails] Finding it difficult to test a before_filter on my ApplicationController

2010-04-15 Thread BarryOg
Hi All, I'm writing tests for my new rails app and I've run into a bit of a brick wall. I'm trying to write a test for my ApplicationController which has a simple authorize method. And when I try and run the test I'm hitting a nil object exception. Here's what my ApplicationController looks lik

[Rails] My model object's attributes are not being saved

2010-03-29 Thread BarryOg
Hello all, I'm into my first week of rails coding and I'm really enjoying it so far. I've run into a bit of an problem. I have a user model which represents the currently logged in user. I'm also creating a gas_reading model which will be a child of the user model. When I attempt to create and