1

I am getting

private method `new' called for Reminder:Class

The Application trace is

app/controllers/reminders_controller.rb:27:in `new'

The new action is as follows

 def new
    @reminder = @current_user.reminders.build()
    @title = "New Reminder"
    respond_to  do |format|
      format.html # new.html.erb
      format.json { render json: @reminder }
    end
  end

The Reminder Model is has follows

class Reminder < ActiveRecord::Base
belongs_to :user
belongs_to :assignment
attr_accessible :datetime, :sent_at, :status, :send_time

STATUSES = ["Not Sent", "Sending", "Sent", "Canceled"]

validates_presence_of :sent_at, :status, :user_id, :assignment_id 

before_save :round_tine


def round_time
  self.send_time = Time.at(t.to_i/(15*60)*(15*60))
end
end

I don't know how the method would be private. Thanks for the help in advance!

UPDATE: Added a method to the model. Error still occurs.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
Mab879
  • 608
  • 16
  • 33
  • 1
    please post the whole controller? and check if any of your other class having name clash with Reminder Model class – abhas Jul 07 '12 at 04:30
  • That is that problem I have a mailer with the same class as the model. – Mab879 Jul 07 '12 at 13:56
  • 1
    put mailer class name as ReminderMailer not just Reminder. That's the problem rails is not able to distinguish between two classes and it is identifying the new method for mailer class which has name Reminder and showing the error. – abhas Jul 07 '12 at 17:46

2 Answers2

3

put mailer class name as ReminderMailer not just Reminder. That's the problem rails is not able to distinguish between two classes and it is identifying the new method for mailer class which has name Reminder and showing the error.

abhas
  • 5,193
  • 1
  • 32
  • 56
1

You probably have the private declaration somewhere above your new definition. Post the entirety of your reminders_controller or just remove that offending line.

Veraticus
  • 15,944
  • 3
  • 41
  • 45
  • The offending line is `@reminder = @current_user.reminders.build()` The whole point of the action. Sorry not making that clear. – Mab879 Jul 07 '12 at 01:07