Creating Methods in the Model?

Yes you should be defining methods inside your model. Models are just classes and so you create methods just like any class.

To expand on your example of a 'variable' of two submitted via form:

class User < ActiveRecord::Model   def name     "#{firstname} #{lastname}"   end end

This gives you method which will combine firstname and lastname (which would be in the database) into a name

Usage: user = User.new(:firstname => 'John', :lastname => 'Doe') user.name #=> "John Doe"

There is nothing wrong with defining these and calling them from a controller, or view and not sure why that doesn't seem right to you? You mention that the methods you have tried don't work for you, if you're still battling, give us some code to look at.

Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

This post should help

http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model

Don't use pseudo-ruby, just write ruby otherwise we can't tell if you're making a mistake. Don't create a variable called permalink, create a method called permalink

class User < ActiveRecord::Base   validates...

  def permalink     #Do what you need to create the permalink and return it   end end

There is no reason to validate the permalink because you're creating it dynamically. Just validate the presence of name and city so you have both available to build your permalink Now whenever you call user.permalink, you'll get what you need.

self.method creates a method on the User object so that you get User.method instead of user.method (which is called on the instance of the object)

Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain