To render the partial, try:

...
   <%= render :partial=>'shared/albums' %>
...

Jeff

On Oct 8, 2:09 am, Nuno Neves <rails-mailing-l...@andreas-s.net>
wrote:
> Hi,
>
> I'm learning rails and my first application is a simple gallery that
> pulls photos from flickr using flickraw.
>
> The site has 3 main zones:
>
> Left: where all albums are listed
> Center: where a photo is shown
> Bottom: where I have a few thumbnails
>
> I already build everything but using only one Controller. Now I would
> like to separate some actions and have something like this:
>
> Controllers
>
> Gallery
>  - index (main page)
>
> Albuns
>  - index (list all photosets)
>  - show (specific phototset from show/id)
>
> Photos
>  - index (list all photos)
>  - show (specific photo from show/id)
>
> controllers/albums_controller.rb:
>
> class AlbumsController < ApplicationController
>   require 'flickraw'
>   @@key = '123'
>   @@user= '123'
>
>   def index
>     @albums = flickr.photosets.getList(:api_key => @@key, :user_id =>
> @@user)
>   end
> end
>
> views/albums/index.html.erb
>
> <% content_for :albums do %>
>   <%= render 'shared/albums' %>
> <% end %>
>
> views/shared/_albums.html.erb
>
> <% albums.each do |a| %>
>   <%= link_to (a.title, :controller => 'albums', :action => 'show', :id
> => a.id) %><br />
> <% end %>
>
> The problem is I can't share partials between views from other
> Controllers.
> If I call the partial from the controller Albums everything work as
> expected.
> If I call it from other Controller, the variable albums is nil.
>
> I already used :object => @albums, :collections => @albums and locals =>
> { :albums => @albums } but nothing.
>
> What is wrong?
>
> Thanks
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to