-
-
Save anonymous/056b4bfa1b18dec6eb44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| = semantic_form_for @produit.shared_produit, :url => url_for(:controller =>"backend/shared_produits", :action =>"update",:produit_id=>@produit.id),:method=>:put do |f| | |
| = f.input :shared, :input_html => { :value => true}, :as=>:hidden | |
| = f.submit "Autoriser partage" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def shared_produit_params | |
| if current_admin_user.admin | |
| params.require(:shared_produit).permit(:sharing_start,:free_price,:shared) | |
| else | |
| params.require(:shared_produit).permit(:sharing_start,:free_price,:shared) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def update | |
| @produit=Produit.updatable_to(current_admin_user,current_shop).find(params[:produit_id]) | |
| @[email protected]_produit | |
| if @shared_produit.update_attributes(shared_produit_params) | |
| redirect_to :back, notice: "Partage modifié" | |
| else | |
| redirect_to :back, alert: "Erreur lors de l'édition" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment