On Martes, 23 de Febrero de 2010 18:16:54 gs84 escribió:
> On 23 fév, 17:18, "Sergio Cambra .:: entreCables S.L. ::."
>
> <[email protected]> wrote:
> > Then we need pjoffreservices controller code. Are you using a virtual
> > column
>
> Here is my "pjoffreservices controller":
> class PjoffreservicesController < ApplicationController
>   before_filter :login_required, :only => [:create, :update]
>
>   active_scaffold :pjoffreservice do |config|
>     config.create.multipart = true
>     config.update.multipart = true
>
>     #config.create.formats << :pdf
>     config.create.columns = [:typepj, :description, :filename]
>     config.update.columns = [:typepj, :description, :filename]
>     config.list.columns = [:auteur, :typepj, :description, :filename]
>
>
> config.create.columns.exclude(:user, :auteur, :created_at, :updated_at)
>
> config.update.columns.exclude(:user, :auteur, :created_at, :updated_at)
>     config.columns[:typepj].form_ui = :select
>
>     config.list.label = "Pièces jointes"
>     config.columns[:filename].label = "Fichier"
>     config.columns[:auteur].label = "Auteur"
>     config.columns[:typepj].label = "Type"
>     config.columns[:created_at].label = "Créé le"
>     config.columns[:updated_at].label = "Mis à jour le"
>
>     #config.update.link.inline = false
>   end
> end

How are you showing filename column as a file input? Do you have a helper? To 
use a helper for a subform you must put it in main controller helper, instead 
of helper from subform controller. If you have a helper for filename column in 
pjoffreservices helper, you can add that helper to offreservices controller 
(helper :pjoffreservices)

>
> > Which helper have you added it in?
>
>   I in pjoffreservices Helper. And in "offreservices Helper" because
> the first one didn't work.
>   I have a "has_and_belongs_to_many" association.

Returning 0 works for all kind of associations. This is the code from 
_form_association_footer.html.erb:

show_add_existing = (!column.through_association? and 
options_for_association_count(column.association) > 0)

returning 0 in options_for_association_count sets show_add_existing to false, 
and then code which adds select and add existing button is skipped.

 Are you sure your helper override is being used? You can try debugging from 
that line in form_association_footer, or writing to log file from your helper 
(for example Rails.logger.debug association.name.inspect)

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to