I get the error no implicit conversion of Symbol into String
when I try to create a new record, which I don't understand because all data is formed of strings.
In the controller I have:
def new
@account = Account.new
end
def create
@account = Account.new(account_params)
if @account.save
redirect_to(:action => 'index')
else
render('new')
end
end
private
def account_params
params.require(:account).permit(:username, :firstname, :lastname, :organisation, :phonenumber, :avatar, :about, :verified)
end
And the form is simply:
<%= form_for(@account) do |f| %>
<div>
<%= f.label :username %><br>
<%= f.text_field :username %>
</div>
<div>
<%= f.label :firstname %><br>
<%= f.text_field :firstname %>
</div>
<div>
<%= f.label :lastname %><br>
<%= f.text_field :lastname %>
</div>
... more of the same...
<div class="actions">
<%= f.submit %>
</div>
<% end %>
And the migration file:
class CreateAccounts < ActiveRecord::Migration
def change
create_table :accounts do |t|
t.string :username
t.string :firstname
t.string :lastname
t.string :organisation
...more of the same, all strings...
end
add_index :accounts, :username, unique: true
end
end
I'm using Rails 3.2 and Ruby 2.1.5.