-
Notifications
You must be signed in to change notification settings - Fork 0
Admin of Sharetribe server
Currently there is no specific management UI for admins to manage contents of the service. There is an admin view for feedbacks, news and polls (at /admin/feedbacks) but there is nothing else at the moment.
If someone is interested to contribute on that side of Sharetribe, more comprehensible admin interface could be a good area, since the core development team is not working on that in near future.
In Rails console, most of the needed management tasks can be made but it is not the most user friendly environment.. :/
rails console production
(or use development you want that environment and db to be used)
Most of the stuff that you could write in ruby code (in the controllers for example) works in the console.
find the person using any active record finder
p = Person.find_by_email("email_of_person")
update values
p.update_attribute(:is_admin, true)
p.update_attribute(:usename. "new_username")
etc.
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
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
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.