Problems with an id

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:

<%= I18n.t('tog_social.groups.site.blogs') %> <%@blogs = Blog.find(:all, :conditions => {:id_referencia => group_id, :tipo => 'Grupo'}) -%>
    <% if @blogs.length > 0 %> <% @blogs.each do |blog| -%>
  • <%= link_to "#{sanitize textilize(blog.title)}", conversatio_blog_path(blog), :title => "#{sanitize(blog.title)}" %>
    <%= I18n.t('tog_social.groups.model.created_at') %> <%=I18n.l(blog.created_at, :format => :long)%>
  • <% end -%> <% else -%> <%= I18n.t('tog_social.groups.model.no_blogs_for_this_group') %> <% end -%>

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:

<%= I18n.t(‘tog_social.groups.site.blogs’) %></
h2>
4:
6: <%@blogs = Blog.find(:all, :conditions => {:id_referencia =>
group_id, :tipo => ‘Grupo’}) -%>
7:
8:

9:

    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.

Thanks i resolved the problem it was a shit that i was programming.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs