help me debug this model

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

help me debug this model

fugee ohu
This model has some errors that I wasn't able to get sorted out the two lines that begin with validate should be validates but after that I don't understand what the author's trying to do If I change them to validates I get the error Unknown validator: 'MessageValidator' for   validate :auction_active?, message: :auction_active


class Bid < ActiveRecord::Base
  belongs_to :auction
  belongs_to :user

  validates :auction, :user, presence: true
  validate :auction_active?, message: :auction_active
  validate :last_user_different?

  scope :sorted, -> { order(:created_at) }

  after_create :update_auction

  private

  def auction_active?
    if auction && !auction.active?
      if auction.finished?
        errors.add(:auction, :finished)
      else
        errors.add(:auction, :not_started)
      end
    end
  end

  def last_user_different?
    if auction && user
      errors.add(:user, :same_user_twice) if auction.last_user == user
    end
  end

  def update_auction
    auction.increase_price_and_time
    auction.publish_updates
  end
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/074b2a56-5cec-4217-a6dd-a0df9477c3f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

Mugurel Chirica
What have you tried so far in debugging this?

Have you used any debugger like pry to see what happens when you rune the code?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL37D8Fj5oHW2Q2uhdVuSkaC69eCoZywfvR3K4-KpABhTof65w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

fugee ohu
In reply to this post by fugee ohu


On Monday, March 26, 2018 at 8:17:56 PM UTC-4, fugee ohu wrote:
This model has some errors that I wasn't able to get sorted out the two lines that begin with validate should be validates but after that I don't understand what the author's trying to do If I change them to validates I get the error Unknown validator: 'MessageValidator' for   validate :auction_active?, message: :auction_active


class Bid < ActiveRecord::Base
  belongs_to :auction
  belongs_to :user

  validates :auction, :user, presence: true
  validate :auction_active?, message: :auction_active
  validate :last_user_different?

  scope :sorted, -> { order(:created_at) }

  after_create :update_auction

  private

  def auction_active?
    if auction && !auction.active?
      if auction.finished?
        errors.add(:auction, :finished)
      else
        errors.add(:auction, :not_started)
      end
    end
  end

  def last_user_different?
    if auction && user
      errors.add(:user, :same_user_twice) if auction.last_user == user
    end
  end

  def update_auction
    auction.increase_price_and_time
    auction.publish_updates
  end
end


Like I said I don't understand what the author's trying to do No i'm not using any debug tools

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/150abfed-8f4d-4df6-8a47-ea7dec132a98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

Allen Maxwell
In reply to this post by fugee ohu
It might help to have the models for auction and user... also, I like to add the annotate gem which gives some header comments in all my models to show what fields etc are there.  Very helpful info and references.

you already know that the validate needs to be validates...

is this an active system or SUD?  do you have a solid development database that is well populated to test/develop against?

this link may help some:  http://guides.rubyonrails.org/active_record_validations.html#custom-methods

other than that I'd have to see it in action to debug further. 

Good luck

Max

On Monday, March 26, 2018 at 6:17:56 PM UTC-6, fugee ohu wrote:
This model has some errors that I wasn't able to get sorted out the two lines that begin with validate should be validates but after that I don't understand what the author's trying to do If I change them to validates I get the error Unknown validator: 'MessageValidator' for   validate :auction_active?, message: :auction_active


class Bid < ActiveRecord::Base
  belongs_to :auction
  belongs_to :user

  validates :auction, :user, presence: true
  validate :auction_active?, message: :auction_active
  validate :last_user_different?

  scope :sorted, -> { order(:created_at) }

  after_create :update_auction

  private

  def auction_active?
    if auction && !auction.active?
      if auction.finished?
        errors.add(:auction, :finished)
      else
        errors.add(:auction, :not_started)
      end
    end
  end

  def last_user_different?
    if auction && user
      errors.add(:user, :same_user_twice) if auction.last_user == user
    end
  end

  def update_auction
    auction.increase_price_and_time
    auction.publish_updates
  end
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/88b2801f-f7d7-4c32-b81f-7180632db1d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

fugee ohu
Ok, and I don't understand what this means:
validates :auction_active?, message: :auction_active

class Auction < ActiveRecord::Base
  include ApplicationHelper

  belongs_to :product
  belongs_to :image
  has_many :bids

  validates :product, :image, :min_price, :start_price, :start_time, :duration, :bid_time_step, :bid_price_step, presence: true
  validates :duration, :bid_time_step, numericality: { only_integer: true }
  validates :min_price, :start_price, :bid_price_step, numericality: { greater_than_or_equal_to: 0.01 }
  validates :min_price, :start_price, :bid_price_step, fractionality: { multiplier: 0.01 }

  after_initialize do
    self.start_time = Time.now.round_by(15.minutes) if self.new_record? && self.start_time.nil?
  end

  before_create { |auction| auction.price = auction.start_price }

  def self.finished_soon
    # TODO: use PostgreSQL
    Auction.all.select { |a| (a.time_left <= 5.seconds) && (a.time_left > 1.second) }
  end

  def started?
    start_time < Time.now
  end

  def finished?
    time_left < 0
  end

  def active?
    started? && !finished?
  end

  def time_left
    finish_time - Time.now
  end

  def start_in
    start_time - Time.now
  end

  def finish_time
    start_time + duration.seconds
  end

  def last_user
    bids.sorted.last.user if bids.any?
  end

  def increase_price_and_time
    self.price += self.bid_price_step
    self.duration += self.bid_time_step
    self.save!
  end

  def publish_updates
    PrivatePub.publish_to '/auctions/update', auction_id: self.id, time_left: status_desc(self), price: self.price
  end
end


On Tuesday, March 27, 2018 at 6:54:34 AM UTC-4, Allen Maxwell wrote:
It might help to have the models for auction and user... also, I like to add the annotate gem which gives some header comments in all my models to show what fields etc are there.  Very helpful info and references.

you already know that the validate needs to be validates...

is this an active system or SUD?  do you have a solid development database that is well populated to test/develop against?


other than that I'd have to see it in action to debug further. 

Good luck

Max

On Monday, March 26, 2018 at 6:17:56 PM UTC-6, fugee ohu wrote:
This model has some errors that I wasn't able to get sorted out the two lines that begin with validate should be validates but after that I don't understand what the author's trying to do If I change them to validates I get the error Unknown validator: 'MessageValidator' for   validate :auction_active?, message: :auction_active


class Bid < ActiveRecord::Base
  belongs_to :auction
  belongs_to :user

  validates :auction, :user, presence: true
  validate :auction_active?, message: :auction_active
  validate :last_user_different?

  scope :sorted, -> { order(:created_at) }

  after_create :update_auction

  private

  def auction_active?
    if auction && !auction.active?
      if auction.finished?
        errors.add(:auction, :finished)
      else
        errors.add(:auction, :not_started)
      end
    end
  end

  def last_user_different?
    if auction && user
      errors.add(:user, :same_user_twice) if auction.last_user == user
    end
  end

  def update_auction
    auction.increase_price_and_time
    auction.publish_updates
  end
end



class User < ActiveRecord::Base
  has_many :authorizations
  has_many :bids
  has_one :avatar
  belongs_to :role
  has_many :permissions, through: :role

  validates :nickname, presence: true
  validates :nickname, uniqueness: { case_sensitive: false }

  accepts_nested_attributes_for :avatar

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :omniauthable, omniauth_providers: [:facebook, :vkontakte]

  before_create { |user| user.role = Role.default_role unless user.role }

  scope :bots, -> { where(role: Role.bot) }

  def self.random_bot
    bots.order('RANDOM()').first
  end

  def admin?
    role == Role.admin
  end

  def bot?
    role == Role.bot
  end

  def self.find_for_oauth(auth)
    authorization = Authorization.where(provider: auth.provider, uid: auth.uid.to_s).first
    if authorization
      user = authorization.user
    else
      email = auth.info[:email]
      nickname = auth.info[:nickname]
      user = User.where(email: email).first
      if user
        user.create_authorization(auth)
      elsif email.present? && nickname.present?
        password = Devise.friendly_token[0, 20]
        user = User.create(email: email, password: password, password_confirmation: password, nickname: nickname)
        user.create_authorization(auth)
      end
    end
    user
  end

  def create_authorization(auth)
    self.authorizations.create!(provider: auth.provider, uid: auth.uid)
  end

  def add_authorization(auth)
    authorization = Authorization.where(provider: auth.provider, uid: auth.uid.to_s).first
    if authorization
      authorization.user == self
    else
      create_authorization(auth)
      true
    end
  end
end



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/394b4c7e-27e7-4e39-b9f1-1164887c5eda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

fugee ohu
In reply to this post by Allen Maxwell
Actually the first thing is see when I visit that link is the use of validate without the s

On Tuesday, March 27, 2018 at 6:54:34 AM UTC-4, Allen Maxwell wrote:
It might help to have the models for auction and user... also, I like to add the annotate gem which gives some header comments in all my models to show what fields etc are there.  Very helpful info and references.

you already know that the validate needs to be validates...

is this an active system or SUD?  do you have a solid development database that is well populated to test/develop against?

this link may help some:  <a href="http://guides.rubyonrails.org/active_record_validations.html#custom-methods" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_validations.html%23custom-methods\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHq7BPl3EYg-mjyEpwEQ8qYg_MZYQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_validations.html%23custom-methods\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHq7BPl3EYg-mjyEpwEQ8qYg_MZYQ&#39;;return true;">http://guides.rubyonrails.org/active_record_validations.html#custom-methods

other than that I'd have to see it in action to debug further. 

Good luck

Max

On Monday, March 26, 2018 at 6:17:56 PM UTC-6, fugee ohu wrote:
This model has some errors that I wasn't able to get sorted out the two lines that begin with validate should be validates but after that I don't understand what the author's trying to do If I change them to validates I get the error Unknown validator: 'MessageValidator' for   validate :auction_active?, message: :auction_active


class Bid < ActiveRecord::Base
  belongs_to :auction
  belongs_to :user

  validates :auction, :user, presence: true
  validate :auction_active?, message: :auction_active
  validate :last_user_different?

  scope :sorted, -> { order(:created_at) }

  after_create :update_auction

  private

  def auction_active?
    if auction && !auction.active?
      if auction.finished?
        errors.add(:auction, :finished)
      else
        errors.add(:auction, :not_started)
      end
    end
  end

  def last_user_different?
    if auction && user
      errors.add(:user, :same_user_twice) if auction.last_user == user
    end
  end

  def update_auction
    auction.increase_price_and_time
    auction.publish_updates
  end
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b8ab4f9b-1682-4006-8d91-8f2c556f34e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

Walter Lee Davis

> On Mar 27, 2018, at 9:20 AM, fugee ohu <[hidden email]> wrote:
>
> Actually the first thing is see when I visit that link is the use of validate without the s

The validate method is used along with a custom validator method. The validates method is "built in" and uses a DSL to specify how you want the validations to work.

validate :has_a_bow_on_top?

private

def has_a_bow_on_top?
  unless bow&.on_top?
    errors[:bow].add "must be on top"
    false
  end
end

The built-in validates method is configured like this:

validates :bow, presence: true

This is a very basic example, there are lots more things you can do with it. For all of our sakes, please read this entire page: http://guides.rubyonrails.org/active_record_validations.html

Walter

>
> On Tuesday, March 27, 2018 at 6:54:34 AM UTC-4, Allen Maxwell wrote:
> It might help to have the models for auction and user... also, I like to add the annotate gem which gives some header comments in all my models to show what fields etc are there.  Very helpful info and references.
>
> you already know that the validate needs to be validates...
>
> is this an active system or SUD?  do you have a solid development database that is well populated to test/develop against?
>
> this link may help some:  http://guides.rubyonrails.org/active_record_validations.html#custom-methods
>
> other than that I'd have to see it in action to debug further.
>
> Good luck
>
> Max
>
> On Monday, March 26, 2018 at 6:17:56 PM UTC-6, fugee ohu wrote:
> This model has some errors that I wasn't able to get sorted out the two lines that begin with validate should be validates but after that I don't understand what the author's trying to do If I change them to validates I get the error Unknown validator: 'MessageValidator' for   validate :auction_active?, message: :auction_active
>
>
> class Bid < ActiveRecord::Base
>   belongs_to :auction
>   belongs_to :user
>
>   validates :auction, :user, presence: true
>   validate :auction_active?, message: :auction_active
>   validate :last_user_different?
>
>   scope :sorted, -> { order(:created_at) }
>
>   after_create :update_auction
>
>   private
>
>   def auction_active?
>     if auction && !auction.active?
>       if auction.finished?
>         errors.add(:auction, :finished)
>       else
>         errors.add(:auction, :not_started)
>       end
>     end
>   end
>
>   def last_user_different?
>     if auction && user
>       errors.add(:user, :same_user_twice) if auction.last_user == user
>     end
>   end
>
>   def update_auction
>     auction.increase_price_and_time
>     auction.publish_updates
>   end
> end
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b8ab4f9b-1682-4006-8d91-8f2c556f34e6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9B8A922E-409D-4DBF-951D-8F01AD01A245%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

fugee ohu


On Tuesday, March 27, 2018 at 11:44:54 AM UTC-4, Walter Lee Davis wrote:

> On Mar 27, 2018, at 9:20 AM, fugee ohu <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="tuRQLaPLBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">fuge...@...> wrote:
>
> Actually the first thing is see when I visit that link is the use of validate without the s

The validate method is used along with a custom validator method. The validates method is "built in" and uses a DSL to specify how you want the validations to work.

validate :has_a_bow_on_top?

private

def has_a_bow_on_top?
  unless bow&.on_top?
    errors[:bow].add "must be on top"
    false
  end
end

The built-in validates method is configured like this:

validates :bow, presence: true

This is a very basic example, there are lots more things you can do with it. For all of our sakes, please read this entire page: <a href="http://guides.rubyonrails.org/active_record_validations.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_validations.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGxfO6sClNALuZoSM5H6U2R6yK4rA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_validations.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGxfO6sClNALuZoSM5H6U2R6yK4rA&#39;;return true;">http://guides.rubyonrails.org/active_record_validations.html

Walter

>
> On Tuesday, March 27, 2018 at 6:54:34 AM UTC-4, Allen Maxwell wrote:
> It might help to have the models for auction and user... also, I like to add the annotate gem which gives some header comments in all my models to show what fields etc are there.  Very helpful info and references.
>
> you already know that the validate needs to be validates...
>
> is this an active system or SUD?  do you have a solid development database that is well populated to test/develop against?
>
> this link may help some:  <a href="http://guides.rubyonrails.org/active_record_validations.html#custom-methods" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_validations.html%23custom-methods\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHq7BPl3EYg-mjyEpwEQ8qYg_MZYQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_validations.html%23custom-methods\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHq7BPl3EYg-mjyEpwEQ8qYg_MZYQ&#39;;return true;">http://guides.rubyonrails.org/active_record_validations.html#custom-methods
>
> other than that I'd have to see it in action to debug further.
>
> Good luck
>
> Max
>
> On Monday, March 26, 2018 at 6:17:56 PM UTC-6, fugee ohu wrote:
> This model has some errors that I wasn't able to get sorted out the two lines that begin with validate should be validates but after that I don't understand what the author's trying to do If I change them to validates I get the error Unknown validator: 'MessageValidator' for   validate :auction_active?, message: :auction_active
>
>
> class Bid < ActiveRecord::Base
>   belongs_to :auction
>   belongs_to :user
>
>   validates :auction, :user, presence: true
>   validate :auction_active?, message: :auction_active
>   validate :last_user_different?
>
>   scope :sorted, -> { order(:created_at) }
>
>   after_create :update_auction
>
>   private
>
>   def auction_active?
>     if auction && !auction.active?
>       if auction.finished?
>         errors.add(:auction, :finished)
>       else
>         errors.add(:auction, :not_started)
>       end
>     end
>   end
>
>   def last_user_different?
>     if auction && user
>       errors.add(:user, :same_user_twice) if auction.last_user == user
>     end
>   end
>
>   def update_auction
>     auction.increase_price_and_time
>     auction.publish_updates
>   end
> end
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="tuRQLaPLBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="tuRQLaPLBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/b8ab4f9b-1682-4006-8d91-8f2c556f34e6%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/b8ab4f9b-1682-4006-8d91-8f2c556f34e6%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/b8ab4f9b-1682-4006-8d91-8f2c556f34e6%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/b8ab4f9b-1682-4006-8d91-8f2c556f34e6%40googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


Thanks Walter And passing a symbol to message: how does that work? 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/53605b52-f944-48fe-9a04-54a2b629d9a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

Walter Lee Davis
Read the docs I linked you to, and if that doesn't explain it, then ask the author of the code you're extending. It's possible that it is passing a reference to a proc or lambda, but I have not seen that exact code before, so I can only guess.

Walter

> On Mar 27, 2018, at 2:04 PM, fugee ohu <[hidden email]> wrote:
>
> Thanks Walter And passing a symbol to message: how does that work?
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/59801D36-D4F0-4032-920A-D16052AC3671%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help me debug this model

fugee ohu


On Tuesday, March 27, 2018 at 2:12:27 PM UTC-4, Walter Lee Davis wrote:
Read the docs I linked you to, and if that doesn't explain it, then ask the author of the code you're extending. It's possible that it is passing a reference to a proc or lambda, but I have not seen that exact code before, so I can only guess.

Walter

> On Mar 27, 2018, at 2:04 PM, fugee ohu <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="3sJzm7DTBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">fuge...@...> wrote:
>
> Thanks Walter And passing a symbol to message: how does that work?
>
>

I changed it to 
validate :auction_active?, message: self.errors
and now page loads without any errors

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/174e8b7e-afc4-48fd-8288-511a2556f49a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.