views:

180

answers:

1

Ok I have posted a couple of things that had to do with my problem but I think I have it narrowed down. Here is where I am at:

I have my index.rhtml page inside of /views/main and the main_controller is set up correctly. I am attempting to make this page a dashboard of sorts so it needs to reference multiple other views to display their index.html.erb page. I will use 'proposals' as our example. I want to display the proposal views/proposals/index.html.erb page in the views/main/index.rhtml side bar. I have gathered that you do this through partials.

So...I created a file, /views/proposals/_index.html.erb that has the same code as views/proposals/index.html.erb.

Then in my views/main/index.rhtml file I have the following code:

<%= render :partial => @proposal %>

Now, I don't get an error message, simply nothing is displayed. I don't have anything referencing this (I don't think) in my routes.rb file and I suspect that is the problem.

Sorry for the redundancy on this question but I didn't even really know what I was asking. Hope this helps.

UPDATED:

When I put the <%= render :partial => "proposals/index" %> mentioned below I now get this error:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

Extracted source (around line #1):

1: <% @proposals.each do |proposal| %>
2: <div id="proposalindex">
3: <%= link_to_unless_current h(proposal.name), proposal %><br/>
4: <p5>Added <%= time_ago_in_words(proposal.created_at) %> ago | </p5

This partial works within the proposals controller not not sure what this means.

+2  A: 
<%= render :partial => "proposals/index" %>
khelll
I just did that and still not go. Got a little further but now getting another error. I will update the question so you can see the error.
bgadoci
Do you have an at `@proposals` object in your `MainController#index`? If you want to list all the proposals, you will still need to do `@proposals = Proposal.all` at some point.
theIV
I don't. What is the best way to display it in there?
bgadoci
Just fixed it. Thank you all so much. I'm pumped.
bgadoci