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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:23:41+00:00 2026-06-14T16:23:41+00:00

im trying to declare some virtual attributes that will be used to combine date

  • 0

im trying to declare some virtual attributes that will be used to combine date and time together given me date time, though i keep getting the following error. as you can see from the code examples below, how im setting the attributes, and what information im passing through to them.

ActiveModel::MassAssignmentSecurity::Error in SchedulesController#create

{"utf8"=>"✓",


"authenticity_token"=>"j4V6DAqK5U/+ZGaSKDlrEoOBqXu3pEq/FM51ingi2sg=",
 "schedule"=>{"event"=>"1",
 "result_id"=>"",
 "date"=>"04/11/2012",
 "arrival_time"=>"08:00 PM",
 "time"=>"08:00 PM",
 "duration"=>"1800",
 "location_id"=>"11",
 "selected_players"=>["",
 "41",
 "38"],
 "team_id"=>"1",
 "opponent_id"=>"1",
 "home_or_away"=>"Home"},
 "commit"=>"Save Event"}

controller

    # POST /schedules
  # POST /schedules.json
  def create
    params[:schedule].delete(:date)
    params[:schedule].delete(:time)
    @user = User.find(current_user)

    @players = User.where(:team_id => current_user[:team_id]).all
    params[:schedule][:selected_players].compact
    #params[:schedule][:selected_players].reject!{|selected_players| selected_players==""}
    #@availabilities = @user.availabilities.create(:unique_id => params[:schedule][:id])

    @schedule = Schedule.new(params[:schedule])

    respond_to do |format|
      if @schedule.save
        #Notifier.event_added(@user,@schedule).deliver
        format.html { redirect_to(schedules_url,
                                  :notice => "#{event_display_c(@schedule.event)} vs #{@schedule.opponent.name} was successfully created.") }
        format.json { render :json => @schedule, :status => :created, :location => @schedule }
      else
        format.html { render :action => "new" }
        format.json { render :json => @schedule.errors, :status => :unprocessable_entity }
      end
    end
  end

model

class Schedule < ActiveRecord::Base
  belongs_to :location
  belongs_to :opponent
  belongs_to :team
  belongs_to :result
  has_many :availabilities, :dependent => :destroy

  attr_accessible :location_id, :user_id, :opponent_id, :datetime, :score_for, :score_against, :event,
                  :team_id, :home_or_away, :arrival_time, :duration, :selected_players, :result_id

  attr_accessor :date, :time
  • 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-14T16:23:43+00:00Added an answer on June 14, 2026 at 4:23 pm

    figured this out for myself, just added the fields in the database in the end

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

Sidebar

Related Questions

I am trying to declare some integer values (used for controlling checkboxes that I
I'm trying to generate some sql that is used to calculate some final scores
I'm trying to collect an often used subset of GUI-Elements together into one Subclass,
I'm working with some C++/CLI code (new syntax) and am trying to declare a
I'm trying to do some fitting with lsqcurvefit. I have a function like that:
I'm trying to declare some final Strings for using as keys later, but I
Trying to get some documentation on this. Have seen it used in some websites
Effectively I'm trying to send some template emails so that I can test a
I'm trying to declare a lot of enums however for some reason one of
I seem to be forgetting my C++ ... I'm trying to declare some functions

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.