Hello everybody,

I have one problem because i don't know how to pass the id of a group
that i have in my application.

Here is the code:

I have one link to show all the blogs of the current group

  <%= link_to I18n.t('tog_social.groups.model.view_all_blogs'),
blogs_groups_path(@group) %>

and in the controller i don't know what i have to put to see all the
blogs of this group, and render the view blogs.html.erb

  def blogs
    @group = params[:group]
    id = @group.id
    @blogs = Blog.find(:all, :conditions => {:id_referencia =>
id, :tipo => 'Grupo'})
    @order = params[:order] || 'created_at'
    @page = params[:page] || '1'
    @asc = params[:asc] || 'desc'
    @blogs = @blogs.paginate  :per_page => 10,
                                :page => @page,
                                :order => @order + " " + @asc

    respond_to do |format|
       format.html { render :template => "groups/blogs"}
       format.xml  { render :xml => @blogs }
    end

  end

and in the view blogs.html.erb I have this but this fail:

<!--Portlet para mostrar los blogs del grupo actual-->
<div class="portlet portletM" id="portlet_blogs_group">
    <h2><span><%= I18n.t('tog_social.groups.site.blogs') %></span></
h2>
        <!--Buscamos en la tabla blogs los blogs que tenga id_referencia
igual a la id del grupo actual
            y que sea del tipo grupo-->
        <%...@blogs = Blog.find(:all, :conditions => {:id_referencia =>
group_id, :tipo => 'Grupo'}) -%>

        <div class="portlet_content">
        <ul>
                <!--Si hay blogs-->
                <% if @blogs.length > 0 %>
                        <!-- los recorremos todos y para cada uno mostramos un 
enlace al
blog y cuando fue creado-->
              <% @blogs.each do |blog| -%>
                <li class="clearfix">
                  <div class="image left"><img src="/images/
blogs.jpg?"></div>
                              <div class="title"><%= link_to "#{sanitize
textilize(blog.title)}", conversatio_blog_path(blog), :title =>
"#{sanitize(blog.title)}" %></div>
                  <div class="text">
                      <%= I18n.t('tog_social.groups.model.created_at')
%> <%=I18n.l(blog.created_at, :format => :long)%>
                  </div>
                </li>
              <% end -%>
                          <!--Paginamos los blogs en el el portlet-->
                        <!--sino habĂ­a blogs lo indicamos mediante un 
mensaje.-->
                        <% else -%>
                          <%= 
I18n.t('tog_social.groups.model.no_blogs_for_this_group') %>
                        <% end -%>
        </ul>
    </div>
</div> <!-- /.portlet_pluginsTog -->

and show me the next error: NameError in Groups#blogs

Showing vendor/plugins/tog_social/app/views/groups/blogs.html.erb
where line #6 raised:

undefined local variable or method `group_id' for #<ActionView::Base:
0x9e9d690>

Extracted source (around line #6):

3:     <h2><span><%= I18n.t('tog_social.groups.site.blogs') %></span></
h2>
4:      <!--Buscamos en la tabla blogs los blogs que tenga id_referencia
igual a la id del grupo actual
5:          y que sea del tipo grupo-->
6:      <%...@blogs = Blog.find(:all, :conditions => {:id_referencia =>
group_id, :tipo => 'Grupo'}) -%>
7:
8:      <div class="portlet_content">
9:         <ul>


Request

Parameters:

{"group"=>"1-clster-de-tecnologa-iuctc"}

Can anyone help me. How can i pass the id of the group.

Thanks for your help.


-- 
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-t...@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