Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## in users controller
- def add
- @image = Image.find(params[:id])
- @user = current_user
- @image.user_images.create(attributes = { :user_id => @user.id })
- flash[:notice] = 'You have added an image'
- end
- ## view code
- <%= button_to 'Add', :action => :add, :id => image.id %>
Add Comment
Please, Sign In to add comment