title: Laravel 4 - Call to a member function actividads() on a non-object (pivote table)
body: <p>I'm trying to save in my DB the relation between two tables <code>actividads</code> and <code>fichas</code> (through a pivot table: <code>actividad-ficha</code>. And I'm having this message:</p>
  
  <blockquote>
    <p>Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR)</p>
    
    <p>Call to a member function actividads() on a non-object</p>
  </blockquote>
  
  <p>I pass through my Route two variables (ids):</p>
  
  <pre><code>Route::get('ficha/{id_ficha}/{id_actividad}', array('uses' =&gt; 'FichaController@enFicha'));
  </code></pre>
  
  <p>And then, in my 'FichaController':</p>
  
  <pre><code>public function enFicha($id_ficha, $id_actividad)
  {
          $ficha = Ficha::find($id_ficha);
         // $actividad_id = Actividad::find($id_actividad); (doesnt work)
          $actividad_id = $id_actividad; 
          $ficha-&gt;actividads()-&gt;sync($actividad_id, false);
  
          return Redirect::route('actividads.index'); 
  }
  </code></pre>
  
  <p>Here my models:</p>
  
  <pre><code>class Actividad extends Eloquent {
  protected $guarded = array();
  public function fichas()
  {       
      return $this-&gt;belongsToMany('Ficha', 'actividad_ficha')-&gt;withTimestamps(); //
  }
  
  class Ficha extends Eloquent {
  protected $guarded = array();
  public function actividads()
  {
      return $this-&gt;belongsToMany('Actividad', 'actividad_ficha')-&gt;withTimestamps();
  }
  </code></pre>
  
  <p>After change what @decco and @Ben suggested me, I have the next error message:</p>
  
  <pre><code>Argument 1 passed to Illuminate\Database\Eloquent\Relations\BelongsToMany::formatSyncList() must be of the type array, string given, called in /Applications/XAMPP/xamppfiles/htdocs/webs/lara4/edu1/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php on line 578 and defined 
  </code></pre>
  
  <p>I don't know what is wrong with that... Any idea??</p>
  
  <p>Thank you very much!!</p>