Skip to content

Instantly share code, notes, and snippets.

@mrcwinn
Created March 21, 2013 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrcwinn/5214597 to your computer and use it in GitHub Desktop.
Save mrcwinn/5214597 to your computer and use it in GitHub Desktop.
# Controller
def publish
trip = Trip.find(params[:id])
trip.status = 'published'
trip.save!
redirect_to account_trips_path, notice: 'Your trip is now live!'
end
# Routes
resources :trips do
member do
post 'publish', to: 'trips#publish'
end
resources :bookings
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment