0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

How to add models in ActiveAdmin (Basic)

Last updated at Posted at 2019-04-16

Premise

  • ActiveAdmin main unit has been installed (rails generate).

procedure

Create a Rails model.

 rails generate model book title:string author:string 

Make data.

 rake db:migrate 

Create resources for ActiveAdmin.

 rails generate active_admin:resource book 

Start the Rails server.

 rails server 

And when trying to register new data from a browser (http: // localhost: 3000 / admin / books / new). . .

Exception occurred!

ActiveModel :: ForbiddenAttributesError in Admin :: BooksController # create

I can not create.

Solution

After that, specify permit_params in the resource file of ActiveAdmin! only this.

 ActiveAdmin.register Book do permit_params :title, :author end 

Original by

ActiveAdmin でのモデルの追加方法 (基本)

About

About this translattion

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?