Question: I have a Todo model with `title:string, description:text` and `completed:boolean` and two self references: children & parents joined by a todos\_todos table (parent\_id, child\_id). 

I want to prevent a Todo with `completed == true` from being edited unless the user passes `params[:completed] = false`. I also want to prevent children from being added to the todo if it's completed. 

I know I can do this easily in the controller with this:

```
def update 
    ...
    @todo.find(params[:id])
    if params[:completed] == false 
        if @todo.completed == true 
            render :edit
            ...
end 

```

...but I'm not sure that's the correct way to do this. I feel like I should use a validation in my model for this, except I can't figure out a way compare to user's input with existing data in the model.

Answer: 
Change:

```
def OutputPlane(SphericalRefraction):

```

into:

```
class OutputPlane(SphericalRefraction):

```

an you should be good to go.
You are not inheriting `SphericalRefraction` because you have defined `OutputPlane` like a function and not like a class.

So `def OutputPlane(SphericalRefraction):`
should be
`class OutputPlane(SphericalRefraction):`