You always need to have 3 tables in your database. As you said recipes
steps
and recipe_steps
Then you have two solutions with your models. The first one with 3 models:
class Recipe
has_many :recipe_steps
has_many :steps, through: :recipe_steps
end
class Step
has_many :recipe_steps
has_many :recipes, through: :recipe_steps
end
class RecipeStep
belongs_to :step
belongs_to :recipe
end
The second one with only two models:
class Recipe
has_and_belongs_to_many :steps
end
class Step
has_and_belongs_to_many :recipes
end
You will use the second solution if you don't want to manage data in the recipe_steps
table. But if you want to add some informations in this table (price or quantity for example), you must use the first solution.
In all cases you must create the 3 tables.
You will find more information here: http://guides.rubyonrails.org/association_basics.html
I hope this help