ISSUE: Scaffolding "My scaffold format is different"?

Hi Alex. I get trouble, Googled about 2hr and didnt find anything to solve it. EXAMPLE <code> rails g scaffold Boomboom name:string </code> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ class BoomboomsController < ApplicationController before_action :set_boomboom, only: [:show, :edit, :update, :destroy] def index @boombooms = Boomboom.all respond_with(@boombooms) end def show respond_with(@boomboom) end def new @boomboom = Boomboom.new respond_with(@boomboom) end def edit end def create @boomboom = Boomboom.new(boomboom_params) @boomboom.save respond_with(@boomboom) end def update @boomboom.update(boomboom_params) respond_with(@boomboom) end def destroy @boomboom.destroy respond_with(@boomboom) end private def set_boomboom @boomboom = Boomboom.find(params[:id]) end def boomboom_params params.require(:boomboom).permit(:name) end end _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ It creates respond_with(:id) by default. I tried to generate scaffold with other apps the same. Only if i create new app and g scaffold then works. _ _ _ _ _ _ New_app _g_Boomboom _ _ _ _ _ _ _ _ _ _ class BoomboomsController < ApplicationController before_action :set_boomboom, only: [:show, :edit, :update, :destroy] # GET /boombooms # GET /boombooms.json def index @boombooms = Boomboom.all end # GET /boombooms/1 # GET /boombooms/1.json def show end # GET /boombooms/new def new @boomboom = Boomboom.new end # GET /boombooms/1/edit def edit end # POST /boombooms # POST /boombooms.json def create @boomboom = Boomboom.new(boomboom_params) respond_to do |format| if @boomboom.save format.html { redirect_to @boomboom, notice: 'Boomboom was successfully created.' } format.json { render :show, status: :created, location: @boomboom } else format.html { render :new } format.json { render json: @boomboom.errors, status: :unprocessable_entity } end end end # PATCH/PUT /boombooms/1 # PATCH/PUT /boombooms/1.json def update respond_to do |format| if @boomboom.update(boomboom_params) format.html { redirect_to @boomboom, notice: 'Boomboom was successfully updated.' } format.json { render :show, status: :ok, location: @boomboom } else format.html { render :edit } format.json { render json: @boomboom.errors, status: :unprocessable_entity } end end end # DELETE /boombooms/1 # DELETE /boombooms/1.json def destroy @boomboom.destroy respond_to do |format| format.html { redirect_to boombooms_url, notice: 'Boomboom was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_boomboom @boomboom = Boomboom.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def boomboom_params params.require(:boomboom).permit(:name) end end HOW TO FIX IT ? Help me Pleas )))

Posted almost 5 years ago by Rovshen Gurdov
Posted almost 5 years ago by Rovshen Gurdov

The Problem Solved, Just gem DEVISE 340 that includes Responders.

Whoever will get the same ISSUE add this to in your config/application.rb add:

config.app_generators.scaffold_controller :scaffold_controller

1
Posted almost 5 years ago by Alex Yang

Glad you were able to solve it! If you need to paste a lot of code in the future, I recommend using CloudApp to do so.

0