Ruby on Rails: Displaying model attribute on view -


so have user model , store model created. having problem displaying name of store has been created in database. it's stupid problem, easy solution, can't figure out i'm doing wrong. here user controller find store want display:

def show    @user = user.find(params[:id])    @store = store.find(1) end 

and here view:

<% provide(:title, @user.username) %>  <div class="row">   <aside class="col-md-4">    <section class="user_info">      <h1>        <%= gravatar_for @user %>        <%= @user.username %>      </h1>    </section>  </aside> </div>  <li><% @store.name %></li> 

so name of user shows up, no issues there, reason, name of store not showing up. know fact there store id: 1 in database. here appreciated!

to output content erb, need add = erb block:

<%= @store.name %> 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -