Seriously stumped cannot call attribute out

Hi, i am having problems displaying a simple attribute. what is weird
is that all the other attributes are can be called but not .p . I
have been racking my brain on why but I just don’t get it. it doesn’t
make sense i can call nearly every attribute except this one

DB creation code:

create_table :supermarket do |t|
t.integer :groceries_id
t.decimal :price, :precision => 8, :scale => 2
t.integer :p
t.decimal :numindeal, :precision => 8, :scale => 2
t.decimal :promprice, :precision => 8, :scale => 2
  t.timestamps
end

Table

id |groceries_id |price|p|numindeal|promprice|
1 |1| |3.00|1|3.00 ||3.00 |

Helper.rb

def pricecheck(groceries,supermarket)
z = groceries.send(supermarket)

z.groceries_id
z.price
z.numindeal
z.promprice {all these work}
z.p {this gives “wrong number of arguments (0 for 1)”}
end

view code:

<%= pricecheck(groceries,“supermarket”) %>

this is what it says in console

Groceries.find(1).supermarket.p ArgumentError: wrong number of arguments (0 for 1)
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/
active_record/associations/association_proxy.rb:177:in p' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/associations/association_proxy.rb:177:insend’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/
active_record/associations/association_proxy.rb:177:in
`method_missing’
from (irb):30

Nevermind found out. You cannot use p for a column name

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs