-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActionController::UrlGenerationError in Admin::Bids#show #4028
Comments
Please provide the related resource file and the stacktrace. |
app/admin/bid.rb
|
Pleas provide a longer stacktrace, it should be go to the first active admin row |
Sorry, here it is:
|
On which url does this happen? On a Page or a Resource? Please provide the active admin file for the url. |
It happens on a url when trying to view a particular bid (resource), for example: http://localhost:3000/admin/bids/711 In my config/routes.rb file I have: |
The only other person who's reported a |
@seanlinsley Thanks for your response, but I am not using the routes gem. |
Please post the related model. |
class Bid < ActiveRecord::Base
belongs_to :lot
belongs_to :user
#validate :check_if_highest_bid
after_save :update_lot
#after_save :notify_outbid
#after_save :update_bidders
after_save :update_lot_time
#after_destroy :update_lot
def auto_bid
# these are the parameters passed to initialization of AutoBidder class
# this_bidder: the user placing the current bid
# bid: the current bid
# @lot: the lot being bid on
this_bidder = self.user
bid = self
@lot = self.lot
# if the lot has no bids yet, save the current bid and set it as max bid
# if this conditional is true, then this bid being placed is the initial bid
if @lot.has_bids?
# uses the AutoBidder class for complex logic involved in auto bidding
autobidder = AutoBidder.new(@lot, this_bidder, bid)
autobidder.place_bid
# AuctionMailer.notify_bidder(this_bidder.email, @lot).deliver
else
new_max_bid = this_bidder.max_bids.create(amount: bid.amount, lot_id: @lot.id)
@lot.max_bid = new_max_bid
bid.amount = @lot.price + @lot.increment
bid.save
end
end
# checks if the high bidder is bidding when they're already the high bidder
def repeat_bidder?
user == lot.max_bid.user
end
def username
user.email if user
end
def lot_name
lot.title
end
def update_lot
lot.check_highest_bid
end
def check_if_highest_bid
errors.add(:amount, "must be higher than current bid") unless lot.price < amount
end
def update_lot_time
if (lot.end_time - Time.now) <= lot.closing_window
lot.end_time += lot.time_extension
lot.save
end
end
def notify_outbid
@lot = lot
@bids = lot.bids
logger.debug "notify outbid"
if @bids.count > 1
@outbid = {user: @bids[-2].user, amount: @bids.last.amount, lot: @lot.title}
AuctionMailer.you_got_outbid_playa(@outbid).deliver
end
end
def bidders
@bidders ||= []
end
def notify_all_bidders(bidders)
bidders.each do |bidder|
notify_bidder(bidder)
end
end
def notify_bidder(bidder)
AuctionMailer.notify_bidder(bidder, lot).deliver
end
def update_bidders
lot.bids.each do |bid|
bidders << bid.user.email
end
bidders.uniq!
notify_all_bidders(bidders)
end
end |
You must be customizing your controller, because as your error shows:
The ID parameter is being passed an instance of the model, not a number. The only other ticket with something similar is #2527, which does this in a test: it "assigns the requested blog to @blog" do
@blog = FactoryGirl.create(:blog)
get :show, id: @blog
assigns(:blog).should eq(@blog)
end When they should be doing |
It sounds pretty clearly like this is a bug in your code and not in Active Admin, so I'm closing this for now. |
Faced the same issue with one particular model that has no primary keys at all. The
After adding primary key "id" for that model Hope this helps. |
I got this same error in every listing page on my production server. active_admin version : master branch, ref d84f819
|
I keep getting this error when trying to view the "show" page for a resource. I can view the "index" and "edit" pages okay though.
The text was updated successfully, but these errors were encountered: