[Rails] Validation question
carl
carl at carldr.com
Wed Mar 2 13:37:27 GMT 2005
Hi,
> I think you mean @list = List.find_first(@params[ "list" ][ "id" ])
Yes, indeed I did - I typed in the code fresh into my mail client, rather than
cut+paste!
> And also in your case it would probably be clearer to do:
> if list.owner == @session["user"]
> rather than
> if @session[ "user" ].lists.include? list
Yeah, I agree.
> You wouldn't want your model to access the session variable directly,
> and you wouldn't neccessarily want to pass in the logged in user to each
> model call, so I think the controller is the best place to put it.
Yes, that did help. I'll just leave it as is (Except for the change above)
then, I was just wondering if there was a better way than I was already doing it.
Thanks for your help,
Carl.
More information about the Rails
mailing list