vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

.ignore_columns.add gets ignored #168

Closed eriko closed 13 years ago

eriko commented 13 years ago

so you should be able to set ActiveScaffold.set_defaults do |config| config.ignore_columns.add [:lock_version] config.ignore_columns.add [:vectors] config.ignore_columns.add [:subject] end

in the application_controller but it seems to not work. In this case I need to block out :vectors from tsearch on postgresql and I can not make it not be searched as the various LIKE methods do not work on it. I have stopped using tsearch anyways so I can work around it by dropping the column but something seems to be wrong with ignore_columns .

vhochstein commented 13 years ago

Works for me, eg: config.ignore_columns.add [:created_at, :updated_at, :lock_version]

Which version of activescaffold are you using?

eriko commented 13 years ago

I am using the a pull from the 24th of june. It is not that it errors out. The issue is that it is still in the query still has the excluded columns in it.

So I striped the ignore in application_controller.rb down to

  ActiveScaffold.set_defaults do |config|
    config.ignore_columns.add [:name]
  end

Then when I search both the count query and the select query contain "name" and while the search should fail as the name column is the only one with the data it does not. Note the OR "customers"."name" ILIKE '%FAKE%' . I wonder if this is because I use postgresql and mysql?

SELECT "customers".* FROM "customers" WHERE (((("customers"."email" ILIKE '%FAKE%' OR "customers"."kind" ILIKE '%FAKE%' OR "customers"."location" ILIKE '%FAKE%' OR "customers"."name" ILIKE '%FAKE%' OR "customers"."phone" ILIKE '%FAKE%' OR "customers"."stub" ILIKE '%FAKE%' OR "customers"."username" ILIKE '%FAKE%'))) AND (customers.kind = 'person')) ORDER BY "customers"."id" ASC LIMIT 50 OFFSET 0
vhochstein commented 13 years ago

Ah, ok, column is not showing in list view, but it is justed for searches....

vhochstein commented 13 years ago

Fixed.

eriko commented 13 years ago

Yep and thanks.