I have a page with two forms. It's a nic setting form. I have given everything a css id just to make them easily selectable.
%form#mnic_form
.datagrid
%table
%thead
%tr
%th{:colspan => "2"}
= "(eth0 - Management) Port Settings (#{#a.get_management_nic["mac"]})"
%tbody#managementnic
%tr
%td
DHCP:
%td
%input#dhcpon1{:type => "radio", :name => "dhcp", :value => "true", :checked => #a.get_management_nic["dhcp"], :onclick => "dhcpHandler('management')"} Enabled
%br
%input#dhcpoff1{:type => "radio", :name => "dhcp", :value => "false", :checked => !#a.get_management_nic["dhcp"], :onclick => "dhcpHandler('management')"} Disabled
%tr
%td
IP Address:
%td
%input#ip1{:type => "text", :name => "ip", :value => #a.get_management_nic["ip"], :onblur => "IPHandler('#ip1')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
Subnet Mask:
%td
%input#subnet1{:type => "text", :name => "subnet", :value => #a.get_management_nic["subnet"], :onblur => "IPHandler('#subnet1')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
Gateway:
%td
%input#gateway1{:type => "text", :name => "gateway", :value => #a.get_management_nic["gateway"], :onblur => "IPHandler('#gateway1')" }
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
DNS Servers:
%td
%input#dyndns1{:type => "checkbox", :name => "dynamicDNS", :value => "true", :checked => #a.get_management_nic["dynamicDNS"], :onclick => "dynamicDNSHandler('management')"}
Automatically assign DNS from DHCP Server
%tr
%td
DNS 1:
%td
%input#dns11{:type => "text", :name => "dns1", :value => #a.get_management_nic["dns1"], :onblur => "IPHandler('#dns11')" }
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
DNS 2:
%td
%input#dns21{:type => "text", :name => "dns2", :value => #a.get_management_nic["dns2"], :onblur => "IPHandler('#dns21')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%input#mnic_submit{:type => "button", :value => "Save", :onclick => "submitMNic()"}
%form#vnic_form
.datagrid
%table
%thead
%tr
%th{:colspan => "2"}
= "(eth1 - Video) NIC Port Settings (#{#a.get_video_nic["mac"]})"
%tbody#videonic
%tr
%td
DHCP:
%td
%input#dhcpon2{:type => "radio", :name => "dhcp", :value => "true", :checked => #a.get_video_nic["dhcp"], :onclick => "dhcpHandler('video')"} Enabled
%br
%input#dhcpoff2{:type => "radio", :name => "dhcp", :value => "false", :checked => !#a.get_video_nic["dhcp"], :onclick => "dhcpHandler('video')"} Disabled
%tr
%td
IP Address:
%td
%input#ip2{:type => "text", :name => "ip", :value => #a.get_video_nic["ip"], :onblur => "IPHandler('#ip2')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
Subnet Mask:
%td
%input#subnet2{:type => "text", :name => "subnet", :value => #a.get_video_nic["subnet"], :onblur => "IPHandler('#subnet2')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
Gateway:
%td
%input#gateway2{:type => "text", :name => "gateway", :value => #a.get_video_nic["gateway"], :onblur => "IPHandler('#gateway2')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
DNS Servers:
%td
%input#dyndns2{:type => "checkbox", :name => "dynamicDNS", :value => "true", :checked => #a.get_video_nic["dynamicDNS"], :onclick => "dynamicDNSHandler('video')"}
Automatically assign DNS from DHCP Server
%tr
%td
DNS 1:
%td
%input#dns12{:type => "text", :name => "dns1", :value => #a.get_video_nic["dns1"], :onblur => "IPHandler('#dns12')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
DNS 2:
%td
%input#dns22{:type => "text", :name => "dns2", :value => #a.get_video_nic["dns2"], :onblur => "IPHandler('#dns22')"}
%img.spinner{:src => '/img/busy_spinner.gif', :style => "display: none", :height => "15"}
%tr
%td
%td
%p All multicast routed on this interface
%input#vnic_submit{:type => "button", :value => "Save", :onclick => "submitVNic()"}
Now when I go to test this using capybara, I try these two functions:
page.choose('dhcpoff1')
page.choose('dhcpoff2')
and the first one works perfectly, and the second one does nothing. This shouldn't be that difficult to figure out, but I'm completely stuck. Been staring at it for hours. I appreciate any insight you might have.
function dhcpHandler(m_or_v) {
var tmp = (m_or_v === "management") ? tmp = $('#managementnic > tr > td > input') : tmp = $('#videonic > tr > td > input');
if (tmp[0].checked) {
tmp[2].disabled = true;
tmp[3].disabled = true;
tmp[4].disabled = true;
}
else {
tmp[2].disabled = false;
tmp[3].disabled = false;
tmp[4].disabled = false;
}
}
More testing. There are controller methods above, so let me just say that the page starts with dhcpon2 selected, and ip2, gateway2, and subnet2 all disabled.
I'm trying to run page.choose('dhcpoff2') and get it to select dhcpoff2, and then trigger the dhcpHandler() to un-disable the 3 fields. a workaround that works is page.execute_script("$('#dhcpoff2').click()") but that's too unbearable. currently I have it failing in selenium (2.48.1, capybara 2.5.0), and working in poltergeist...??? so to be more specific, here's a test:
page.choose('dhcpoff2')
#page.execute_script("$('#dhcpoff2').click()")
assert !find('#ip2')["disabled"]
if we comment out line 2 (the ghetto work around) it passes with poltergeist as the driver, but not with selenium as the driver.
And finally, here's the driver setup I'm using, swapping which lines are commented to switch between poltergeist and selenium:
include Capybara::DSL
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false, phantomjs: "C:/Ruby22-x64/bin/phantomjs.exe")
end
Capybara.default_driver = :selenium
Capybara.javascript_driver = :selenium
#Capybara.default_driver = :poltergeist
#Capybara.javascript_driver = :poltergeist
Capybara.default_max_wait_time = 10
Capybara.ignore_hidden_elements = false
Related
my form is submitting without params in "Customer Information" and "Shipping Information". The form is rendered in a modal and looks like this
#formShipping.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "productShippingLabel", :role => "dialog", :tabindex => "-1"}
.modal-dialog
.modal-content
.modal-header
%button.close{"data-dismiss" => "modal", :type => "button"}
%span{"aria-hidden" => "true"} ×
%span.sr-only Close
%h4#myModalLabel.modal-title Payment Form
.modal-body
/ Button trigger modal
.hide-info
.panel.panel-default
.panel-heading Customer Information
.panel-body
.col-md-3
.col-md-6
%label{:for => "email"} Email Address
%input.form-control{:type => "text"}/
%label{:for => "name"} Name
%input.form-control{:type => "text"}/
%label{:for => "password"} Password
%input.form-control{:type => "text"}/
%label{:for => "password-confirmation"} Password confirmation
%input.form-control{:type => "text"}/
.col-md-3
.panel.panel-default
.panel-heading Shipping Address
.panel-body
.col-md-6
%label{:for => "name"} Name
%input.form-control{:type => "text"}/
%label{:for => "city"} City
%input.form-control{:type => "text"}/
%label{:for => "zipcode"} Zipcode
%input.form-control{:type => "text"}/
.col-md-6
%label{:for => "address"} Address
%input.form-control{:type => "text"}/
%label{:for => "state"} State
%input.form-control{:type => "text"}/
%label{:for => "country"} Country
%input.form-control{:type => "text"}/
.panel.panel-default
.panel-heading
%h3.panel-title Card information
.panel-body
.row
.col-md-6
%label{:for => "name"} Card Number
%input.form-control{:type => "text", "data-stripe" => "number"}/
.col-md-3
%label{:for => "name"} CVC
%input.form-control{:placeholder => "Ex. 331", :type => "text", "data-stripe" => "cvc"}/
.col-md-3
= label_tag :card_month, "Expiration"
= select_month nil, {add_month_numbers: true}, {name: nil, id: "card_month", "data-stripe" => "exp-month"}
= select_year nil, {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "card_year", "data-stripe" => "exp-year"}
.text-center
%h2.total-amount
Total:
$0.00
%input{:name => "terms", :type => "CHECKBOX"}>/
Agree to terms?
%br/
%br
%span.payment-errors
%input{:name => "store_front", :type => "hidden", :value => #store_front.id}/
.text-center
%button.btn.btn-primary{:type => "submit"} Pay Now!
.modal-footer
%button.btn.btn-default{"data-dismiss" => "modal", :type => "button"} Close
My stripe params come through just fine. But this is the result of checking my submitted params:
>> params
=> {"utf8"=>"✓", "authenticity_token"=>"xkgz3HdfwqS0/AfKpQteT1FaJE/LMhMneUKETCug47qhlw=", "order_products"=>[{"product_id"=>"37", "quanity"=>"0"}, {"product_id"=>"38", "quanity"=>"1"}], "switchName1"=>"on", "custom-amount"=>"", "store_front"=>"34", "stripeToken"=>"token", "action"=>"create", "controller"=>"orders"}
Does anyone know why my inputs aren't submitting?
You've forgotten the name attribute for each one of your input elements.
Change:
%input.form-control{:type => "text"}/
to:
%input.form-control{:type => "text", :name =>"email"}/
and set the correct value for each one of your elements.
You have specified you field for lable but not your input so add that
%label{:for => "email"} Email Address
%input.form-control{:email, :type => "text"}/
I have a Rails form for which I'm trying to change the size of the default fields using either :size or both :cols => "30", :rows => "10" as in the code below. However, the form fields are staying the default size. Is there something I'm doing wrong?
<%= d.text_field c, :class => 'random', :value => "#{c}", :size => "30", :id => 'correction_data_'"#{c.parameterize}"%>
or this way
<%= d.text_field #title, :class => 'random', :value => "#{#title}", :cols => "30", :rows => "10", :id => 'correction_data_'"#{#title.parameterize}"%>
text_field doesn't consider rows and cols attributes, but does consider size attribute. text_area considers rows, cols and size attributes.
text_field:
<%= d.text_field c, :class => 'random', :value => "#{c}", :size => 30, :id => 'correction_data_'"#{c.parameterize}" %>
text_area using rows and cols:
<%= d.text_area #title, :class => 'random', :value => "#{#title}", :cols => 30, :rows => 10, :id => 'correction_data_'"#{#title.parameterize}" %>
text_area using size:
<%= d.text_area #title, :class => 'random', :value => "#{#title}", :size => "30x10", :id => 'correction_data_'"#{#title.parameterize}" %>
I followed the tutorial http://railscasts.com/episodes/253-carrierwave-file-uploads?view=asciicast and I've got my nested form setup with the attached inside a nested form below. Everything works fine but the image isn't being uploaded / storing the filename in the db.
<%= simple_nested_form_for(#order) do |f| %>
<%= f.error_notification %>
<div class="inputs">
<label> <%= link_to 'New Customer', new_customer_path %> <small>or</small></label><div class="clear"></div>
<%= f.association :customer, :label =>'Existing Customer', :include_blank => false %>
<%= f.input :due_date, :as => :date, :start_year => Date.today.year, :start_day => Date.today.day, :stary_month => Date.today.month, :order => [:month, :day, :year], :input_html => { :class => 'date' } %>
<%= f.input :sales_tax, :input_html => { :class => 'text', :value => current_user.sales_tax, :onChange=>"itemcalculate()", :id => 'invoice-salestax' }, :hint => '%' %>
<%= f.input :discount, :input_html => { :class => 'text', :onChange=>"itemcalculate()", :id => 'invoice-discount' }, :placeholder => '$30', :label => 'Discount' %>
<%= f.fields_for :lineitems do |item| %>
<div id='size'>
<label style="margin-top:0 !important;">Details</label>
<%= item.input :product_name, :input_html => { :class => 'text' }, :label => false, :wrapper_html => { :class => 'detail-wrapper' }, :input_html => { :class => 'details'}, :hint => 'Product Name', :placeholder => 'Gildan 2000' %>
<%= item.input :color, :input_html => { :class => 'text' }, :label => false, :wrapper_html => { :class => 'detail-wrapper' }, :input_html => { :class => 'details'}, :hint => 'Product Color', :placeholder => 'Blue' %>
<%= item.input :price_per, :input_html => { :class => 'text details', :onChange=>"itemcalculate()", :id => 'invoice-priceper' }, :label => false, :wrapper_html => { :class => 'detail-wrapper' }, :hint => 'Price per', :placeholder => "4.50", :required => true %>
<%= item.input :extra_fee, :input_html => { :class => 'text details', :onChange=>"itemcalculate()", :id => 'invoice-extrafee' }, :label => false, :wrapper_html => { :class => 'detail-wrapper', :value => '0' }, :hint => 'Extra fee', :required => true %>
<div class='clear'></div>
<label>Sizes</label>
<%= item.input :xxs, :input_html => { :class => 'sizes', :value => '0', :onChange=>"itemcalculate()", :id => 'invoice-xxs' }, :hint=> 'xxs', :label => false, :wrapper_html => { :class => 'size-wrapper' } %>
<%= item.input :xs, :input_html => { :class => 'sizes', :value => '0', :onChange=>"itemcalculate()", :id => 'invoice-xs' }, :hint=> 'xs', :label => false, :wrapper_html => { :class => 'size-wrapper' } %>
<%= item.input :s, :input_html => { :class => 'sizes', :value => '0', :onChange=>"itemcalculate()", :id => 'invoice-s' }, :hint=> 's' , :label => false, :wrapper_html => { :class => 'size-wrapper' }%>
<%= item.input :m, :input_html => { :class => 'sizes', :value => '0', :onChange=>"itemcalculate()", :id => 'invoice-m' }, :hint=> 'm', :label => false, :wrapper_html => { :class => 'size-wrapper' } %>
<%= item.input :l, :input_html => { :class => 'sizes', :value => '0', :onChange=>"itemcalculate()", :id => 'invoice-l' }, :hint=> 'l', :label => false, :wrapper_html => { :class => 'size-wrapper' } %>
<%= item.input :xl, :input_html => { :class => 'sizes', :value => '0', :onChange=>"itemcalculate()", :id => 'invoice-xl' }, :hint=> 'xl', :label => false, :wrapper_html => { :class => 'size-wrapper' } %>
<%= item.input :xxl, :input_html => { :class => 'sizes', :value => '0', :onChange=>"itemcalculate()", :id => 'invoice-xxl' }, :hint=> 'xxl', :label => false, :wrapper_html => { :class => 'size-wrapper' } %>
<label>Extra Notes</label>
<%= item.text_area :extra_notes %>
<!-- start image upload -->
<%= item.fields_for :images, :html => {:multipart => true} do |image| %>
<%= f.file_field :image %>
<%= image.link_to_remove "Remove Image", :id => 'remove-image' %>
<% end %>
<%= item.link_to_add "<img src='/images/icon-camera.png' id='camera-icon'/> Add an image".html_safe, :images, :id=> 'add-image' %>
<!-- end image upload -->
<div class='clear'></div>
<%= item.link_to_remove "Remove Item" %>
</div>
<% end %>
<p id='add-new-item'><%= f.link_to_add "+ Add an Item", :lineitems %></p>
</div>
<%= f.hidden_field :user_id, :value => current_user.id %>
<div class="actions">
<%= f.button :submit %>
</div>
<% end %>
I'm getting the error WARNING: Can't mass-assign protected attributes: image
WARNING: Can't mass-assign protected attributes: images_attributes
My Image model looks like this:
class Image < ActiveRecord::Base
attr_accessible :lineitem_id, :image
belongs_to :lineitem, :polymorphic => true
mount_uploader :image, ImageUploader
end
# == Schema Information
#
# Table name: images
#
# id :integer not null, primary key
# lineitem_id :integer
# image :string(255)
# created_at :datetime
# updated_at :datetime
#
Any idea what's wrong?
in your image upload section, i think you want
<%= image.file_field :image %>
instead of
<%= f.file_field :image %>
sounds/looks like you're trying to tack the image file field onto the orders form when it should be part of the nested form you created for the image.
I guess this line:
attr_accessible :lineitem_id, :image
prevents your image from saving. You should fix/improve this definition, so it accepts other parameters as well, when mass assigning.
use something like this, since im not using active record some stuff its missing.. but you should be able to adapt it to your needs..
class LineItem
attr_accessible :images_attributes
has_many :images
accepts_nested_attributes_for :images, :allow_destroy => true
end
class Image
attr_accessible :lineitem_id, :image
belongs_to :lineitem, :polymorphic => true
mount_uploader :image, ImageUploader
end
that should work
You need add :remove_image to attr_accessible.
I'm sure there has to be a very simple solution to my problem but i don't know why i cant seem to put my finger on it, the problem is that I'm trying to submit a form but every time i submit the form the create action controller gives the following error
Mysql2::Error: Column 'preffered_players' cannot be null: INSERT INTO saved_sessions (preffered_players, session_id, preffered_opponents, game_id, game_type, opponents_list, banned_players, players_list) VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
how ever all these values that the error says are null are passed through parameters as soon as the form is submitted, can anyone tell me how to use the parameter values that i get from the form to fill in the little nulls in my query, create controller is as follow
def create
opponents_list = params[:opponents_list]
banned_players = params[:banned_players]
game_type = params[:game_type]
session_id = params[:session_id]
preffered_opponents = params[:preffered_opponents]
game_id = params[:game_id]
players_list = params[:players_list]
preffered_players = params[:preffered_players]
#saved_sessions = SavedSession.new(params[:saved_sessions])
respond_to do |format|
if #saved_sessions.save
format.html { redirect_to(#game, :notice => 'Game was successfully created.') }
format.xml { render :xml => #game, :status => :created, :location => #game }
else
format.html { render :action => "new" }
format.xml { render :xml => #game.errors, :status => :unprocessable_entity }
end
end
end
thanks for any advice...
i'm including the form code however its very messy(its a huge form) plus its in haml :)
- form_tag('/saved_sessions',:method => :post, :id => "new_game") do
.select_option
.list_col1
.fl
%img{:alt => "image", :border => "0", :src => "/images/happy_face.png"}/
.blue_col
= text_field_tag :preffered_opponents, "", :class => :blue_bar
.clr
.list_col2
.list_col2_top_row
.radio_row
.fl
%input{:type => "radio", :name => "battle_scale", :value => "3"}
.fl 3 vs 3
.fl
%input{:type => "radio", :name => "battle_scale", :value => "5"}
.fl 5 vs 5
.clr
%div
.fl
%img{:alt => "image", :border => "0", :src => "/images/sad_face.png"}/
.fl
/%input#banned_players.white_bar{:type => "text"}/
= text_field_tag :banned_players, "", :class => :white_bar
.clr
.versus_row
#inputs-vs.versus_col1
.versus_col_row
.blue_col
/%input#input-1-vs.blue_bar{:type => "text"}/
= text_field_tag 'input-1-vs', "", :class => :blue_bar
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.clr
.versus_col_row
.blue_col
/%input#input-2-vs.blue_bar{:type => "text"}/
= text_field_tag 'input-2-vs', "", :class => :blue_bar
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.clr
.versus_col_row
.blue_col
/%input#input-3-vs.blue_bar{:type => "text"}/
= text_field_tag 'input-3-vs', "", :class => :blue_bar
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.clr
.versus_col_row
.blue_col
/%input#input-4-vs.blue_bar{:type => "text"}/
= text_field_tag 'input-4-vs', "", :class => :blue_bar
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.clr
.versus_col_row
.blue_col
/%input#input-5-vs.blue_bar{:type => "text"}/
= text_field_tag 'input-5-vs', "", :class => :blue_bar
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.clr
.versus_col2
%img{:alt => "0", :border => "0", :src => "/images/vs.png"}/
#inputs.versus_col1
.versus_col_row
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.blue_col
/%input#input-1.pink_bar{:name => "blah", :type => "text"}/
= text_field_tag 'input-1', "", :class => :pink_bar
.clr
.versus_col_row
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.blue_col
/%input#input-2.pink_bar{:name => "blah", :type => "text"}/
= text_field_tag 'input-2', "", :class => :pink_bar
.clr
.versus_col_row
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.blue_col
/%input#input-3.pink_bar{:name => "blah", :type => "text"}/
= text_field_tag 'input-3', "", :class => :pink_bar
.clr
.versus_col_row
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.blue_col
/%input#input-4.pink_bar{:name => "blah", :type => "text"}/
= text_field_tag 'input-4', "", :class => :pink_bar
.clr
.versus_col_row
.fl
%img{:alt => "image", :border => "0", :src => "/images/lock.png"}/
.blue_col
/%input#input-5.pink_bar{:name => "blah", :type => "text"}/
= text_field_tag 'input-5', "", :class => :pink_bar
.clr
.clr
.session_row
%p
%b You can save and share this session by entering your email. A unique code will be sent
%p.small_text (Session are stored for 30 days)
.seesion_send_row
.fl
/%input.big_white_bar{:type => "text"}/
= text_field_tag 'email_bar', "", :class => :big_white_bar
.fl
%span 2+2=
%span
%span
/%input.small_bar{:type => "text"}/
= text_field_tag 'code_bar', "", :class => :small_bar
.fl
/%a{:href => "#."}
/%img{:alt => "image", :border => "0", :src => "/images/send_button.png"}/
= submit_tag("Send")
hope this can help you guys better understand the problem..
You seem to be pulling from 2 different places. The block of code at the top of the method is pulling the values from the top level of the incoming params, but then later you initialize a new SavedSession using the params[:saved_sessions] input. The two things don't seem to match...
if saved_sessions.opponents_list is found at opponents_list = params[:opponents_list] in the first line, then when you later try to save params[:saved_sessions], you're getting it from a different spot in the params...
EDIT: so you do not need both of the sets of values you have in the action. if you build your form like this (or at least something like this) you'll get the params correctly and can just blindly send them into SavedSession.new, and then call .save.
- form_for(#aved_session) do |f|
-.blue_col
= f.text_field :preffered_opponents, "", :class => :blue_bar
If you allow f.text_field to build the id and name then rails magic will make sure that they are named/id'd correctly and then more rails magic interprets them and builds your input parameters correctly. This will build your params as:
params = {:saved_session => {:preferred_opponents => "text value" }...
Then you can pull those params out:
saved_session_input = params[:saved_session]
and pass them into new just like you are. the difference is that now those parameters are actually IN there.
The way you have it is like this:
params = {:preferred_opponents => "text value", :saved_session => {:preferred_opponents => nil }...
this means you're passing nil in for the expected values for new. Note that you don't actually assign your local values to the new saved_session before calling save.
I hope this is clearer.
I am creating an equipment and I have two actions in my equipment controller, new and create.. and I have two views which is new and a partial form..
I also have four tables.. which are equipments, equipment_types, equipment_locations, and equipment_management_informations..
The form looks like..
>= error_messages_for 'equipment'
%table.contentText{:style => "width: 100%"}
- if #types
%tr
%td Equipment Type
%td= collection_select 'equipment', 'equipment_type_id', #types, :id, :name, {}, :class => "dropdownSelect"
%tr
%td Location
%td= select 'equipment', 'equipment_location_id', #equipment_locations.collect { |e| ["#{e.name.capitalize!}", e.id]},{}, :class => "dropdownSelect"
%tr
%td Serial Number
%td= text_field 'equipment', 'serial_number', :class => 'textFields'
%tr
%td MAC Address
%td= text_field 'equipment', 'mac_address', :class => 'textFields'
%tr
%td IP Address
%td= text_field 'equipment', 'ip_address', :class => 'textFields'
- if #stands
%tr
%td Stand
%td= collection_select 'equipment', 'stand_id', #stands, :id, :street_no, :include_blank => true
%tr
%td{:valign => 'top'} Description
%td= text_area 'equipment', 'description', :cols => 45, :rows => '3', :class => "txt_area_effect"
and my new view is like:
> %h3 New equipment
%div{:style => "border: 1px solid #CCC;"}
- form_tag :action => 'create', :estate_id => #estate do
= render :partial => 'form'
= submit_tag "Create"
- action = "list"
%input{:type => "button", :value => "Back", :onclick => "window.location='#{action}';", :class => "start"}
and my create action display this a nil when i inspect it
#equipment = Equipment.find(params[:equipment])
it gives an error like
Unknown key(s): equipment_type_id, mac_address, description, equipment_location_id, serial_number, ip_address
#equipment = Equipment.find(params[:equipment])
should be:
#equipment = Equipment.new(params[:equipment])
or
#equipment = Equipment.new(params[:equipment])
(just posting answer from comments so this stops showing as unanswered)