I'm fairly new to Sinatra, and I'm trying to access data from a database from within a partial.
Here's an example of a partial that I want on a page:
<% @articles.each do |article| %>
<ul>
<li> <%= article.articleName %> </li>
</ul>
<% end %>
It works fine if I just set up a route like
get '/articles' do
@article = Articles.all
erb :articles
end
and the /articles page with something like
<% @articles.each do |article| %>
<article>
<p> <%= article.articleName %> </p>
<p> <%= article.articleBody %> </p>
</article>
<% end %>
However, it doesn't seem like the above code works if I put it into a partial.
Any help would be appreciated. I'm sure I'm missing something simple.