I have a controller with the normal CRUD actions for a resource called "Issue". The Issue table has a boolean called published to save the state of each instance. When an issue gets the published boolean set to true, all the other instances of Issue should be set to false.
My question is about the issues_controller.rb. Right now, I don't have the published boolean listed as attr_accessible. My thought was that I would have a button in my view that routed to a specific action:
def publish
// before_filter to set all the issues' publish column to false
// update_attribute to set publish column to true
end
def surpress
// update_attribute to set this issues publish column to false
end
After doing some research and rethinking my approach, I thought perhaps it would be better to create some sort of new controller - published_issues_controller.rb that uses more resourceful routes:
def create
// same as the publish method above
end
def destroy
// same as surpress method above
end
This is my first rails app - any insight on whether one of these approaches (or something completely different) is best would be much appreciated.