Rails ActiveAdmin - Edit the new resource-view -


I added ActiveAdmin to my app and successfully changed the index-payment to my processing. Now when I click on 'new resource', I'm brought to the new method, however, there is a button unavailable (paperclip) so that the user has permission to upload an image-attachment.

I can not find any way to edit the scene, neither I am getting a way to re-write the new method.

If you want any code by me, then I can paste everything here.

Thank you! // Check the very bottom of this post for solutions!

// In this way I tried to do it, but it is not working. For my index-management I have 'App / Admin / Entry. RB 'has been implemented, but the' new 'method does not work at all.

App / Admin / Entry RB:

  ActiveAdmin.register does the entry index column: ID column: Description column: created_at column: image_content_type column do | Entry | Links = link_to "edit", edit_admin_entry_path (entry) link + = "link" = "link_to" delete ", admin_entry_path (entry),: method = & gt; : Delete, Data: {Confirm: "Are You Sure?" } Links end and deff new form_for enter, html = & gt; {: Multipurpose = & gt; True} what? F | F.text_area: Description f.text_area: Description f.file_field: image end f.submit 'save' end of the end   

Before I added ActiveAdmin, I just entered Added a loft and used it: entries_transfer.rb:

  def new @entry = Access. View new end   

(new.html.slim): h1 new entry == render form 'form' = link_to 'back', entries_path

rendered form (_form.html.slim):

  = form_for @entry ,: html = & gt; {: Multipurpose = & gt; True} what? F | - If @ entry.errors.any? #error_explanation h2 = "# {pluralize (@ entry.errors.count," error ")} has declined to save this entry:" ul - @ entry.errors.full_messages.each do | Message | Li = Message .field = f.label: description = f.text_area: description = f.file_field: image .actions = f.submit 'save'   

Now, while it still works LocalHost: 3000 / entries / new title shows default view for this localhost: 3000 / admin / entries / new

If you've got any help, it would be highly appreciated! Is there a way to see the existing code that ActiveAdmin uses beforehand in some way? I can change it by adding one field only to the need.

// Solution:

App / Admin / Resource. Rb
  ActiveAdmin.register entry permit_params: image,: Description Index column: ID Column: Description column: Created column_ column: image_file_name column: image_content_type column do | Entry | Links = link_to "edit", edit_admin_entry_path (entry) link + = "link" = "link_to" delete ", admin_entry_path (entry),: method = & gt; : Delete, Data: {Confirm: "Are You Sure?" } What to do with links and end forms. F | F.inputs do "new entry" f.input: description f.input: image end f.actions end end 

You can customize both the control functions and the new resource view.

To edit the new operation in the controller.

  # app / admin / Your_resource.rb controller def new @ source = resource. New ... # Your custom argument ends here   

To edit a new resource view and add a picture with a paperclip.

  # app / admin / your_resource.rb form html: {multipart: true} do | F | F.inputs do "Resource Details" f.input: Title .... # Your Input Field # This Image Adds Field But Be Careful # # The name of this model should be in your model f.input: Image, As: File, Required: Wrong End f.actions Ended    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -