On Martes, 2 de Junio de 2009 17:14:16 JannaB escribió:
> This is really melting down on me now, and I am too deep into AS on
> this project to go another route.
>
> Every table in my db has an int field 'deleted' which, if nonzero,
> means that record is deleted. Thus, in my ApplicationController, I
> have:
>
>  def conditions_for_collection
>       ['deleted = 0']
>   end

You can use acts_as_paranoid instead of adding a . I think you will get less 
problems.

>
> Per your instructions here (maybe I did it wrong) I have:
>
> CustomersController < ApplicationController
>
>   active_scaffold :customer do |config|
>        config.label = "Customers"
>        config.columns  =
> [:lastname, :firstname, :middlename, :status,  :origin, :associate]
>        #list.columns.exclude :comments
>        config.columns[:status].form_ui = :select
>        #config.columns[:origin].form_ui = :select
>        #config.columns[:associate].form_ui = :select
> end
>
> When I go to perform a "create" on an empty Customers table (which has
> fields staus_id, origin_id and associates_id) I am getting the
> following stack trace -- I have no idea at all how this can be coming
> out of AS.....is it me? Am I doing something really stupid here -- or
> is there a problem with AS? -Janna

I would need debug your application to find the problem (bug in ActiveScaffold 
or your app, I don't know).

>
> ctionView::TemplateError (Mysql::Error: Unknown column
> 'statuses.deleted' in 'where clause': SELECT count(*) AS count_all
> FROM `origins` WHERE ((statuses.deleted != 0)) ) on line #8 of vendor/
> plugins/active_scaffold/frontends/default/views/
> _form_association_footer.html.erb:
> 5:   remote_controller = nil
> 6: end
> 7:
> 8: show_add_existing = (!column.through_association? and
> options_for_association_count(column.association) > 0)
> 9:
> 10: show_add_new = !column.through_association? and
> (column.plural_association? or (column.singular_association? and not
> associated.empty?))
> 11: show_add_new = false unless @record.class.authorized_for?(:action
> => :create)
>
>     vendor/plugins/active_scaffold/frontends/default/views/
> _form_association_footer.html.erb:8
>     vendor/plugins/active_scaffold/frontends/default/views/
> _horizontal_subform.html.erb:19
>     vendor/plugins/active_scaffold/frontends/default/views/
> _form_association.html.erb:18
>     vendor/plugins/active_scaffold/frontends/default/views/
> _form.html.erb:10
>     vendor/plugins/active_scaffold/frontends/default/views/
> _form.html.erb:2
>     vendor/plugins/active_scaffold/frontends/default/views/
> _create_form.html.erb:38
>
> Rendered rescues/_trace (406.0ms)
> Rendered rescues/_request_and_response (0.0ms)
> Rendering rescues/layout (internal_server_error)
>
>
> On Jun 2, 10:54 am, "Sergio Cambra .:: entreCables S.L. ::."
>
> <[email protected]> wrote:
> > On Martes, 2 de Junio de 2009 16:38:23 JannaB escribió:
> > > Mr Banabas, No, that doesn;t do anything here. That just leaves me now
> > > with a text field to input an integer. If I do
> > >  config.columns[:status_id].form_ui = :select
> > > if at least gives me a select box (though, there are no values in it)
> >
> > Probably you have removed status from config.columns, and added status_id
> > to config.columns
> > But you must use config.columns[:status].form_ui = :select, you mustn't
> > use the foreign keys in config.columns
> >
> > > On Jun 2, 10:17 am, "[email protected]"
> > >
> > > <[email protected]> wrote:
> > > > I would give the following a try:
> > > > config.columns[:status].form_ui = :select
> > > >
> > > > On Jun 2, 3:23 pm, JannaB <[email protected]> wrote:
> > > > > I have the following models:
> > > > >
> > > > > class Status < ActiveRecord::Base
> > > > >    has_many :customers
> > > > > end
> > > > >
> > > > > class Customer < ActiveRecord::Base
> > > > >   belongs_to :status
> > > > > end
> > > > >
> > > > > Then, in :
> > > > >
> > > > > class CustomersController < ApplicationController
> > > > >   before_filter :require_associate
> > > > >
> > > > >   active_scaffold :customer do |config|
> > > > >        config.columns[:status_id].form_ui = :select
> > > > > ...
> > > > > end
> > > > >
> > > > > And I never get the select. Not for the status_id. or the id's into
> > > > > any other tables. I have also tried ui_type, and again, nothing.
> > > > >
> > > > > Am I doing something blatantly wrong that I cannot seem to get this
> > > > > to work? Thanks, Janna
> >
> > --
> > Sergio Cambra .:: entreCables S.L. ::.
> > Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
> > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> 
-- 
Sergio Cambra .:: entreCables S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 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