Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6116583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:13:21+00:00 2026-05-23T15:13:21+00:00

I want to make a dashboard page with on top a create action (form)

  • 0

I want to make a dashboard page with on top a create action (form) and underneath it a list action… (to display all the questions that have been made) I was wondering what is the best way to do this.

I have a QuestionsController with a list and a create action. So i do need to make a DashboardController with a createlist action…? And there render the two templates from the QuestionController…?

Or do i need to make a DashboardController with both the list and create actions on them refering to the Questions model?

Best regards,
Thijs

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:13:21+00:00Added an answer on May 23, 2026 at 3:13 pm

    You should create QuestionsController, with form partial included on index view. This form should simply follow to create action, and this action should at error (remember that there could be validation errors) render index action, and after success it should redirect back to index.

    Unless you also need to create questions from other places, then it’s more complicated.

    UPDATE:

    You could also create DashboardsController, but I would only use it to display dashboard (show action and singular resource, not resources in routes.rb), and then normally follow new question form to QuestoinsController#create, and redirect back to DashboardsController#show. This way it’s more RESTful if you also show more than one resource type on dashboard, because you show singular dashboard (with questions and other resources), but you follow to QuestionsController#create to create Question.

    UPDATE 2:

    To make it in one place if you (or anyone else needs):

    1. In your routes.rb file define resources:

      resources :questions
      
    2. In your QuestionController:

      class QuestionsController < ApplicationController
        def index
          setup_questions
        end
      
        def create
          @question = Question.new(params[:question])
          if @question.save
            redirect questions_path, :notice => "Successfully created question."
          else
            setup_questions
            render :action => :index
          end
        end
      
        private
      
        def setup_questions
          @questions = Question.order(:name).page(params[:page])
          # or any other method to fetch all your questions
      
          @question ||= Question.new
        end
      end
      
    3. In your app/views/questions/index.html.erb view:

      <% @questions.each do |question| %>
        <%# display question as table row %>
      <% end %>
      
      <% render :template => "form", :locals => {:question => @question} %>
      
    4. in app/views/questions/_form.html.erb you just define your standard form for new question:

      <%= form_for question do |f| %>
        <%# form fields %>
      <% end %>
      

    Then you don’t need view for new action, as this action would just display form for new question, and you have this form in index action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I want to make the arguments i pass through the urls as optional. url(r'^dashboard/forms/(\w+)|/create/$','dashboard_message_create'),
I have style sheet with a class name changebackgroundcolor i want make change in
I am traversing a HTML document using javascript DOM. I want make a list
I have uploaded a app in production mode to linode. I want make changes
I want make a xslt transformation to xsl-fo but I´m not really sure that
I'm trying to figure out why anyone would want to create a dashboard in
I want make a UI that is semi transparent in WPF VS2008, so I
i have a label and i want make its font bold pragmatically .I try
I am trying to make an admin dashboard that shows an administrator relevant statistics

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.