Ruby on Rails Saturday, March 2, 2013

Dave, consider this refactor

create an instance method in your question model

def standard?
  question_type == "standard"
end

then your view/controller syntax get a bit more readable

@question.standard?


On Sat, Mar 2, 2013 at 12:56 PM, Dave Castellano <lists@ruby-forum.com> wrote:
When I "render :new",  the view gets called correctly but there is a
partial in the new.html.erb view which does not render.

<%= form_for @question, :as=> :question,  :url => { :action => "create"}
do |f| %>
  <% if @question_type == "standard" %>
      <%= render 'new_and_edit_fields', f: f %>

Can I not render a render??

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment