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 8085117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:00:44+00:00 2026-06-05T18:00:44+00:00

I am running rails 3.2 I have created a nested form (requests > tags)

  • 0

I am running rails 3.2

I have created a nested form (requests > tags) with coffeescript handling the addition of new tags.

Everything works with the exception of the form posting a blank tag.name

I am trying to write a method to delete the blank field before the form posts. I realize this may be the wrong approach, but I am still a beginner:

requests_controller.rb

  def create
        @request = current_user.requests.build(params[:request])
        @tag = Tag.new
        if @tag.name.blank?
          destroy_blank
        end

    respond_to do |format|
      if @request.save
        format.html  { redirect_to(@request,
                      :notice => 'Request was successfully created.') }
        format.json  { render :json => @request,
                      :status => :created, :location => @request }
      else
        format.html  { render :action => "new" }
        format.json  { render :json => @request.errors,
                      :status => :unprocessable_entity }
      end
    end
  end

request.rb

 def destroy_blank
    blank = @tag.name
    blank.delete
 end

I hope that’s clear. If not let me know and I will include more information.

  • 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-06-05T18:00:46+00:00Added an answer on June 5, 2026 at 6:00 pm

    If you can’t stop blank tags from coming in, you can create a before_create filter in the model to skip saving blank tags. Leave the controller clean and simple.

    Good luck!

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

Sidebar

Related Questions

I have created a simple application using rails new simple_cms -d mysql2 After running
I have a new rails application which I have created under Windows 7 by
I have created a new rails project with the command: rails project_name but now
I am running Win7 and have created Rails 3 apps on this box and
I am running Rails 3.0.9 and SQlite3 1.3.4 I have created a boolean called
I have created a new rails 3.2 app and my cucumber specs are returning
Begginer Running rails 3.2.2, Ruby 1.8.7 I have 2 models, a Hotel (created by
I have created a rvm 1.8.7 for running older rails projects. When I run
I have an app running Rails 2.3.5 that has a JSON API for much
I have a rails app running on port 3000. The page in question has

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.