Advice on replacing scaffolding in show.rhtml

Hi there, I have a VERY newbie question about replacing the scaffolding
code in show.rhtml, which looks like this:

<% for column in Recipe.content_columns %>
<%= column.human_name %>: <%=
@recipe.send(column.name) %>


<% end %>

With this format I can’t really get to each individual item in the
recipe. I want to do something like:

<% for recipe in @recipes %>

<%= recipe.description %>

<% end %>

My controller looks like this:

def show
name = Recipe.find(params[:id])
end

Any ideas? Thanks in advance!

Dave

Okay, I answered my own question. I can do:

<%= @recipe.description %>

Awesome!

Dave wrote:

Hi there, I have a VERY newbie question about replacing the scaffolding
code in show.rhtml, which looks like this:

<% for column in Recipe.content_columns %>
<%= column.human_name %>: <%=
@recipe.send(column.name) %>


<% end %>

With this format I can’t really get to each individual item in the
recipe. I want to do something like:

<% for recipe in @recipes %>

<%= recipe.description %>

<% end %>

My controller looks like this:

def show
name = Recipe.find(params[:id])
end

Any ideas? Thanks in advance!

Dave

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs