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
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") %>