Note that there are some explanatory texts on larger screens.

plurals
  1. POInstance Variable string collection lost after render => 'new'
    primarykey
    data
    text
    <p>When I get an error creating a quote, it renders the same page it was just on and displays the errors. Unfortunately two inputs are drop down menus of strings, and they disappear when the refresh happens.</p> <p>I've looked at <a href="https://stackoverflow.com/questions/10104652/rail-3-instance-variable-not-available-after-redirection">Rail 3: instance variable not available after redirection</a> which talks about sessions, which looks like it could be the right way to go but I'm not sure. Any help would be appreciated.</p> <p>quotes controller</p> <pre><code>def new @quote = Quote.new @quote.items.build @types = ["T-Shirt", "Hoodie", "Sweatpants"] @colors = ["White", "Black", "Red", "Blue", "Green"] end def create @quote = Quote.new(params[:quote]) respond_to do |format| if @quote.save format.html { redirect_to root_url } flash[:success] = "Your quote is being approved. You will recieve an email shortly!" format.json { render json: @quote, status: :created, location: @quote } else format.html { render :action =&gt; 'new' } format.json { render :json =&gt; @quote.errors, :status =&gt; :unprocessable_entry } flash[:error] = "Quote failed to create! Try again!" end end end </code></pre> <p>form partial</p> <pre><code>&lt;!-- item form --&gt; &lt;%= f.input :make, collection: @types, label: 'Thread Type' %&gt; &lt;%= f.input :amount, label: 'How Many' %&gt; &lt;%= f.input :color, collection: @colors %&gt; &lt;!-- nested form for creating a design of an item --&gt; &lt;%= f.simple_fields_for :designs, :html =&gt; { :multipart =&gt; true } do |designform| %&gt; &lt;%= render "customdesign", g: designform %&gt; &lt;% end %&gt; &lt;!-- add/remove another design --&gt; &lt;%= f.link_to_add "Add Design", :designs %&gt; &lt;%= f.input :note, :input_html =&gt; { :cols =&gt; 50, :rows =&gt; 3 }, label: 'Special Notes or Requests' %&gt; &lt;%= f.link_to_remove "Remove" %&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload