Skip to content

Admin of Kassi server

gnomet edited this page Sep 14, 2010 · 6 revisions

Current admin UI

Currently there is no specific management UI for admins to manage contents of the service. There is an admin view for feedbacks (at /admin/feedbacks) but there is nothing else at the moment.

If someone is interested to contribute on that side of Kassi, more comprehensible admin interface could be a good area, since the core development team is not working on that in near future.

Managing Kassi with Rails console

In Rails console, most of the needed management tasks can be made but it is not the most user friendly environment.. :/

Start the console

script/console (or rails console in Rails3)

It starts in development environment by default. To start in production environment (to make changes to production database etc.) use

script/console production (or @rails console production in Rails3)

Run commands as ruby code

Most of the stuff that you could write in ruby code (in the controllers for example) works in the console.

Delete a specific user

Person.find_by_id("the_guid_the_targer_person").destroy

or in two phases:

p = Person.find_by_id("the_guid_the_targer_person")
p.destroy

NOTE: This does not remove the person from ASI database. If you need to remove it from there too, you need to do the similar thing in ASI console.

Modify (or delete) a listing

a = Listing.find_by_title("title_of the_listing")

or you can use find_by any attribute you want:

a = Listing.find_by_id(id_of_the_listing)

a.title = "new title"
a.content = "new contact"
a.save (to store the changes in the database)

To delete a listing, use find in a similar way and then:

a.destroy

Other modifications

The basic principle is the same. You have all the ActiveRecord classes available. Just use the finders to select the objects you want and then you can call any methods that they have. Just remember that after changing values of attributes, you have to call save, before the changes are stored in the database. The method destroy removes the object from the database immediately.

The rails guide about active record finders can be useful. You can use lines like Person.all or Listing.last etc.