Created
April 18, 2011 14:48
-
-
Save AJFaraday/925494 to your computer and use it in GitHub Desktop.
Unknown errir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This error | |
wrong number of arguments (1 for 0) | |
Rails.root: /home/andrew/Documents/GRUB | |
Application Trace | Framework Trace | Full Trace | |
app/models/subscription.rb:23:in `extend_deliveries' | |
app/models/subscription.rb:15:in `times' | |
app/models/subscription.rb:15:in `extend_deliveries' | |
app/controllers/subscriptions_controller.rb:11:in `roll_subscriptions' | |
app/controllers/subscriptions_controller.rb:10:in `each' | |
app/controllers/subscriptions_controller.rb:10:in `roll_subscriptions' | |
# app/models/subscription.rb | |
def extend_deliveries | |
if self.deliveries.empty? | |
delivery_date = DateProcess.getLast(self.weekday) | |
else | |
delivery_date = self.deliveries.last.date | |
end | |
4.times do # extends for 4 more deliveries | |
delivery_date += self.interval.days | |
Delivery.create(:user_id => self.user_id, :box_id => self.box_id, :subscription_id => self.id, :date => delivery_date.to_date) # this is line 23 | |
end | |
end | |
# app/controllers/subscriptions_controller.rb | |
def roll_subscriptions | |
session[:return_to] ||= request.referer | |
Subscription.all.each do |subscription| | |
subscription.extend_deliveries | |
end | |
flash[:notice] = "subscriptions rolled forward!" | |
redirect_to session[:return_to] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment