Ok so I have two problems with activescaffold and searching. The first
is an error I get when trying to search with the advance active scaffold
search plugin. nothing happens and I get this error on the page:
ActionController::UnknownAction (No action responded to update_table.
Actions: attributes_hash_is_empty?, column_value_from_param_value,
create, delete, destroy, edit, edit_associated,
find_or_create_for_params, index, list,
manage_nested_record_from_params, nested, new, render_field, row, show,
show_advanced_search, show_search, table, update, update_column, and
update_record_from_params):
My other issue is that i have a field in one of my models which is
called user_id, it is an id of a user, hence the name. Now when that
appears in the table generated by active scaffold its an integer, so I
overrode that to show the name of that user. however when I use the
standard search provided by active scaffold it still thinks its an
integer and so I would like to know how i can make it search for the
name.
I have never used active scaffold myself, but my general understanding
of this error is that you need to add a special action update_table
(in
your * ActionController*) which processes your resquest. Otherwise, I
see
some similar methods which I may advise you to check whether they can do
what you want: update, update_column, and update_record_from_params.
My other issue is that i have a field in one of my models which is
called user_id, it is an id of a user, hence the name. Now when that
appears in the table generated by active scaffold its an integer, so I
overrode that to show the name of that user. however when I use the
standard search provided by active scaffold it still thinks its an
integer and so I would like to know how i can make it search for the
name.
Did you add the id in your model? Look at the following:
class User < ActiveRecord::Base
set_primary_key :user_id
Thanks for the quick reply! I dont think making it a primary_key will
fix it. I came up with an idea of haveing a custom search form with a
dropdown menu of all the users and the value that would be passed would
be an id. I just dont know how to do that. I also dont quite get what
you mean by “check that they can do what you want”, its a plugin so
surely it would be ok?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.