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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:05:27+00:00 2026-05-27T12:05:27+00:00

im a rails (and ruby) newbie and struggling with an a scaffolded controller that

  • 0

im a rails (and ruby) newbie and struggling with an a scaffolded controller that i was trying to tweak more to my configurations- the record is being saved but the fields in the db are null- here is the result of the development.log

Started POST "/events" for 127.0.0.1 at 2011-12-12 10:36:55 +0000
  Processing by EventsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"mizap5163W5RbRrHiWdepYZDgrsaflhJPWaVhdHlaOA=", "event"=>{"title"=>"bla de bla", "details"=>"bla de bla", "ticket_info"=>"bla de bla", "when(1i)"=>"2011", "when(2i)"=>"12", "when(3i)"=>"12", "when(4i)"=>"10", "when(5i)"=>"34", "ends(1i)"=>"2011", "ends(2i)"=>"12", "ends(3i)"=>"12", "ends(4i)"=>"10", "ends(5i)"=>"34"}, "commit"=>"Create Event"}
  [1m[35m (0.0ms)[0m  BEGIN
  [1m[36mSQL (0.0ms)[0m  [1mINSERT INTO `events` (`created_at`, `details`, `ends`, `image_url`, `location`, `organiser_id`, `ticket_info`, `title`, `updated_at`, `when`) VALUES ('2011-12-12 10:36:55', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2011-12-12 10:36:55', NULL)[0m
  [1m[35m (45.0ms)[0m  COMMIT
Redirected to http://localhost:3000/events/11
Completed 302 Found in 67ms

the form and the controller are pretty basic so i do not know where i have gone wrong.

controller methods-

# GET /Events/new
  # GET /Events/new.json
  def new
    @Event = Event.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @Event }
    end
  end

  # GET /Events/1/edit  
  def edit
    @Event = Event.find(params[:id])
  end

  # POST /Events
  # POST /Events.json
  def create
    @Event = Event.new(params[:Event])


    respond_to do |format|
      if @Event.save

        format.html { redirect_to @Event, notice: 'Event was successfully created.' }
        format.json { render json: @Event, status: :created, location: @Event }
      else
        format.html { render action: "new" }
        format.json { render json: @Event.errors, status: :unprocessable_entity }
      end
    end
  end

And the form (probably very basic mistakes)

<%= form_for(@Event) do |f| %>

  <% if @Event.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@Event.errors.count, "error") %> prohibited this event from being saved:</h2>

      <ul>
      <% @Event.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :title %><br />
    <%= f.text_field :title %>
  </div>
  <div class="field">
    <%= f.label :details %><br />
    <%= f.text_area :details %>
  </div>
  <div class="field">
    <%= f.label :ticket_info %><br />
    <%= f.text_area :ticket_info %>
  </div>
  <div class="field">
    <%= f.label :when %><br />
    <%= f.datetime_select :when %>
  </div>
   <div class="field">
    <%= f.label :ends %><br />
    <%= f.datetime_select :ends %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

and the model- (i added in the attr_accessible tags thinking it owuld make a difference)

class Event < ActiveRecord::Base
   attr_accessible :title, :Details, :image_url, :organiser_id, :ticket_info, :when, :ends, :location
end

you can see from the log that the sql query is not inserting a row with any data but the params are they

  • 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-27T12:05:28+00:00Added an answer on May 27, 2026 at 12:05 pm

    This is wrong:

    def create
        @Event = Event.new(params[:Event])
        ....
    end
    

    It should be:

    def create
        @Event = Event.new(params[:event])
        ....
    end
    

    hf…

    // And also you should use downcase in cvariable Names. Uppercase should only be used for Constants like the ClassName!

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

Sidebar

Related Questions

I am just starting to write ruby rails. I wrote a controller but is
This is more a general question but my particular case involves a ruby/rails app
hey I am newbie to ruby on rails and I am trying run a
Still a rails and ruby newbie, and I'm trying to figure out why adding
I'm Ruby/Rails newbie and trying to get the laika tool ( http://github.com/CCHIT/laika/tree/master ) running
I am a newbie to Ruby on Rails and I am trying to learn
I am a newbie to Ruby on Rails and trying to setup oracle based
As a Ruby on Rails newbie, I understand that the @ and : references
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
What is the best way to generate a random DateTime in Ruby/Rails? Trying 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.