views:

7

answers:

0

What I do and it's working :

*in skills_Controller.erb* :

  def index
    @skills = Skill.all
  end

  def fetch_skills(conditions)
     @skills = Skill.find :all,
         :order => 'id DESC',
         :conditions => conditions
   end

  def skilloffer
    fetch_skills ["community_id = ? AND request = ?", @current_user.community_id, false]     
     render :action => 'index'
  end

in communities/show.mobile.erb :

<%= link_to t('Offers'), skilloffer_skills_path %>

in routes.erb:

map.resources :skills, :has_many => :patents, :collection => { :skilloffer => :get }

OK some more precision on this code : It's for a mobile site (mobile.erb), but the problem is the same on the html site.

The users have an associated community. They create some skills. So when he is connected : on the page of the community he has a link to go on the index page of the skills that contains all the skills of the community.

Well, what I would like to do is :

If I'm not connected or I'm on a community I don't participate, I would like to have a link where I go to the skills' index page that contains all the skills of the communities

In fact that's not all the skills, only the skills where the request is false, but change nothing of the problem.

I thought I a possibility can be :

Finding a mode to pass the community_id form the html page and replace @current_user by the community that is visited ?!