I’m working on my first rails app and having a weird issue.
I’m using Rails 3.2.6 with mongodb.
In my view, I can get a label to display like so:
<%= f.label :percent %>
But when I try the same thing with a text field
like so:
<%= f.text_field :percent %>
the page doesn’t even load, nothing happens.
Here is my controller:
class TrimmingsController < ApplicationController
def new
@order = Order.find params[:order_id]
end
And my model:
class Trimming
include Mongoid::Document
embedded_in :order
field :percent, type: String
end
And here is my whole view:
<%= form_for @order do |f| %>
<p>
<%= f.text_field :percent %>
</p>
<% end %>
I just want to get a text_field to display sorry for the
simpleton question but I’ve been trying for 2 days to get
this text field to pop up.
You need to make percent attr_accessible. Add this to your model.