neerajsingh0101 / admin_data

A non instrusive gem which helps you browse, search and manage your data using browser
http://admin-data-demo.heroku.com/admin_data
MIT License
376 stars 56 forks source link

Create custom hooks as a column #66

Open THEY opened 13 years ago

THEY commented 13 years ago

As per the wiki, we are able to create new columns, for proc'd data, as per the example:

config.columns_order = { 'User' => [:id, :phone_numbers] }
config.column_settings = {'User' => { :phone_numbers => lambda {|model| model.phone_numbers.map {|r| r.number}.join(', ') } } }

Is it possible to create a completely new column that doesn't exist as model to provide a hook into our application? As per the following:

config.columns_order = { 'User' => [:id, :custom_hook_column] }
config.column_settings = {'User' => { :custom_hook_column => 'my_app_hook_path/' + :id } }
neerajsingh0101 commented 13 years ago

It should be possible to create a new column that does not really exist as a column in the table.

If you run into any problem then let me know and I will look into this issue.

THEY commented 13 years ago

I'm getting an undefined method for "custom_hook_column" at admin_data-1.1.10/app/views/admin_data/search/search/_listing.html.erb where line #29

neerajsingh0101 commented 13 years ago

I will look into this tonight.