Note that there are some explanatory texts on larger screens.

plurals
  1. POPartial Rendering of another controller's view ruby on rails
    primarykey
    data
    text
    <p>I am using twitter Boostraps tabbable feature found here: <a href="http://twitter.github.com/bootstrap/components.html#navs" rel="nofollow">http://twitter.github.com/bootstrap/components.html#navs</a></p> <p>And within this navigation content window, I am trying to render a view that displays a "course". This view found in views/courses/_show.html.erb looks like this:</p> <pre><code>&lt;div class="center hero-unit"&gt; &lt;h1&gt;&lt;%= @course.course_name %&gt;&lt;/h1&gt; &lt;%= link_to 'New Question Set',new_answer_path(:course_ID =&gt; @course.id), :class =&gt; "btn btn-large btn-primary" %&gt; &lt;%= link_to 'Launch Session!', edit_course_path, :class =&gt; "btn btn-large btn-primary" %&gt; &lt;/div&gt; </code></pre> <p>I am trying to render it and failing with the following code in views/instructor/show.html.erb</p> <pre><code>&lt;% courses.each do |c| %&gt; &lt;div class="tab-pane" id="&lt;%=c.course_name%&gt;"&gt; &lt;%= render :partial =&gt; 'courses/show', :locals =&gt; {@course=&gt;c} %&gt; &lt;/div&gt; </code></pre> <p>I get the following error:</p> <blockquote> <p>/app/views/courses/_show.html.erb:1: syntax error, unexpected '=', expecting keyword_end ...tput_buffer = @output_buffer; = local_assigns[:];show = loca... ... ^ /app/views/courses/_show.html.erb:1: syntax error, unexpected ']', expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END ...tput_buffer; = local_assigns[:];show = local_assigns[:show];... ...</p> </blockquote> <p>saying it's failing at line 1 of my courses/_show.html.erb</p> <p>My Course Controller looks like this:</p> <pre><code>class CoursesController &lt; ApplicationController # GET /courses # GET /courses.json def index @courses = Course.all respond_to do |format| format.html # index.html.erb format.json { render :json =&gt; @courses } end end # GET /courses/1 # GET /courses/1.json def show @course = Course.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json =&gt; @course } end end # GET /courses/new # GET /courses/new.json def new @course = Course.new(instructor_ID: params[:instructor_ID]) respond_to do |format| format.html # new.html.erb format.json { render :json =&gt; @course } end end # GET /courses/1/edit def edit @course = Course.find(params[:id]) end # POST /courses # POST /courses.json def create @course = Course.new(params[:course]) respond_to do |format| if @course.save format.html { redirect_to @course, :notice =&gt; 'Course was successfully created.' } format.json { render :json =&gt; @course, :status =&gt; :created, :location =&gt; @course } else format.html { render :action =&gt; "new" } format.json { render :json =&gt; @course.errors, :status =&gt; :unprocessable_entity } end end end # PUT /courses/1 # PUT /courses/1.json def update @course = Course.find(params[:id]) respond_to do |format| if @course.update_attributes(params[:course]) format.html { redirect_to @course, :notice =&gt; 'Course was successfully updated.' } format.json { head :no_content } else format.html { render :action =&gt; "edit" } format.json { render :json =&gt; @course.errors, :status =&gt; :unprocessable_entity } end end end </code></pre> <p>Note: I have ommited some of the methods like delete in my controller to save space.</p> <p>Any Ideas?!</p>
    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.
    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