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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:09:53+00:00 2026-05-15T20:09:53+00:00

This might be impossible to answer since there are probably too many variables here,

  • 0

This might be impossible to answer since there are probably too many variables here, but I thought I’d give it a shot since I always find other answers here. I am still fairly new to rails.

So, I have a bills model/controller/view. I want to create a new bill. I will be editing out the things that shouldn’t matter much, but if they are needed I can add them in – just don’t want a wall of text.

In the route:

map.resources :bills

My new method in the controller:

def new
    @bill = Bill.new
    @submit_txt = "Create"

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @bill }
    end
  end

my form:

<% form_for(@bill) do |f| %>
        <%= f.error_messages %>
 ### form elements here, this all seems fine ####
        <p>
          <%= f.submit @submit_txt %>
        </p>
    <% end %>

my create method in the controller:

def create
    is_weekly = false
    is_monthly = false

    @bill = current_user.recurring_bills.build(params[:bill])
    @bill.year = @current_year

    @errors = 'checking this out'

    if @errors.blank?
      logger.info "no errors, supposedly; going to save"

     ### do saving stuff here####
    else
      logger.info "errors not blank"
      render :action => :new
    end
end

For some reason this always renders /bills instead of /bills/new. It used to work and I don’t know what I did wrong, but now it’s not. I get the same response with render :template => ‘bills/new’. It goes to the right page with a redirect, but then it won’t fill in the form with old values.

The log:

Processing BillsController#create (for 127.0.0.1 at 2010-07-21 21:00:47) [POST]
  Parameters: {"commit"=>"Create", "action"=>"create", "authenticity_token"=>"Kc7/iPKbfJBKHHVARuN7K6207tW6Jx4OUn7Xb4uSB8A=", "bill"=>{"name"=>"rent", "month"=>"", "amount"=>"200", "alternator"=>"odd", "day"=>"35", "frequency"=>"monthly", "weekday"=>""}, "controller"=>"bills"}
  User Load (0.6ms)   SELECT * FROM "users" WHERE ("users"."remember_token" = 'dd7082c56f5a252d14e4e68c528eb26551875c647f998c15d16a064cb075d63c') LIMIT 1
errors not blank
Rendering template within layouts/application
Rendering bills/new
Rendered bills/_form (14.5ms)
Rendered layouts/_stylesheets (3.3ms)
Rendered layouts/_header (5.7ms)
Rendered layouts/_footer (0.3ms)
Completed in 174ms (View: 30, DB: 1) | 200 OK [http://localhost/bills]

Hopefully someone has an idea of what I’ve done wrong, or I guess I’m starting over.

  • 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-15T20:09:54+00:00Added an answer on May 15, 2026 at 8:09 pm

    run a rake:routes from your command line and you will see how they map.

        bills GET    /bills(.:format)          {:controller=>"bills", :action=>"index"}
              POST   /bills(.:format)          {:controller=>"bills", :action=>"create"}
     new_bill GET    /bills/new(.:format)      {:controller=>"bills", :action=>"new"}
    edit_bill GET    /bills/:id/edit(.:format) {:controller=>"bills", :action=>"edit"}
         bill GET    /bills/:id(.:format)      {:controller=>"bills", :action=>"show"}
              PUT    /bills/:id(.:format)      {:controller=>"bills", :action=>"update"}
              DELETE /bills/:id(.:format)      {:controller=>"bills", :action=>"destroy"}
    

    The RESTful resources take a little getting used to but in your case \bills with a post method goes to the create action. You are specifying in the create action to render the contents of the new template when you call render :action => :new – you do not actually run the action.

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

Sidebar

Related Questions

This might be simple or impossible ;-) Is there a way to restrict the
This might sound like a stupid question but just trying to learn something here.
This is probably impossible, but i'm going to ask anyways. I have a multi-threaded
This seems like a bug in Rails to me, but there's probably not much
I rather expect that this might be impossible - but I was wonderring if
This might be a silly question, but here goes : I hashed a dictionary
This might seem like a very easy question for some of you folks, but
This might be a simple question but I've searched and searched and can't find
This might be a very basic question but it confuses me. Can two different
This might have to be broken down a bit but what i want to

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.