Displaying 20 results from an estimated 40000 matches similar to: "has many relation in a form"
2010 Feb 07
0
using form_for in a partial
Hello,
I would like a user to fill out a form (a long contract) and then email
it to them, including the new values.
So I was leaning towards a partial or layout so I didn''t have to write
the contract twice. But that''s where I run into problems. The only
difference between the form (contract) and the email are the form tags
will be replaced with their actual values. For
2011 May 20
3
How to handle non model data in form?
Hey,
I got a form which looks like this:
- form_for(@article, :html => {:multipart => true}, :url =>
articles_path) do |f|
= errors_for(@article)
.field
= f.label :text
%br
= f.text_field :text
.field
= f.label :author_id
%br
= f.text_field :author_id
.actions
= f.submit
But since I don''t want anyone to type in an author id I changed it
2012 Apr 14
7
undefined method `model_name' for NilClass:Class
Hi guys,
I just started using Ruby on Rails. After implementing the RoR blog
tutorial I started with my own data model.
Sadly I am not able to get my create page running.
Model:
class Activity < ActiveRecord::Base
validates :activity, :presence => true
validates :forKids, :presence => true
validates :start_date, :presence => true
end
Controller:
class ActivitiesController <
2010 Nov 19
1
I18n::InvalidLocaleData error on load page
Hi All,
I use rails 3.0.1 in my application and when the server web load this
following page http://localhost:3000/signup
<h1>Sign up</h1>
<%= form_for(@user) do |f| %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :email %><br
2010 Sep 21
0
Upload form with uploadify jquery plugin
I would like to integrate the uploadify plugin with a standard rails
form. However I can''t figure out how to add a new field and have it get
submitted with the file upload. I added a name field into the form, but
the valued does not get submitted.
<%
dialog_file_description = ''Photos''
allowed_extensions = [:jpg, :jpeg, :gif, :png]
max_size = 20.megabyte
2012 Aug 15
0
Devise access customer information without password
I am trying to customize my account with devise. However I do not want
to provide a confirmation password on every details. Therefore I have
created a new controller has mentionned on the following tutorial:
https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password.
This seem to work, however i have different sections such has follow
2010 Jun 02
1
Ajax with JQuery
I have used Ajax link and live validation in index.rhtml
Ajax link requires JavaScript "prototype" and live validation requires
"jquery".
i got "element.dispatchEvent is not a function" on the firebug console
when i used "prototype" and "jquery" in same page index.rhtml
after i removed javascript "prototype" library, i got "Ajax is
2011 Mar 10
4
Multi-model forms
Hi guys, I''m new to ruby and rails and I''m working on multi model
forms, specifically 3. I''m using this http://guides.rubyonrails.org/getting_started.html
as a start, and its got a 2 Model example but I cant seem to get the
last one working.
These are my models:
Country name:string code:string (has_one :address)
Address address_line1:string
2011 May 27
4
undefined method `model_name' for NilClass:Class in a form_for
Hi! I know that there are other topics about this issue, I read them and
I''m always blocked. Here is the error message:
undefined method `model_name'' for NilClass:Class
Extracted source (around line #30):
27:
28: <h2>Add Translation</h2>
29:
30: <%= form_for @new_trad do |f| %>
31: Locale: <%= f.text_field :locale %>
32: Key : <%=
2010 Jul 19
1
instance_exec routes -> form helpers
The new router in Rails 3 is clean and concise and marks the
acceptance of instance_exec as a method for writing a gorgeous DSL.
I''m wondering should something similar be applied to the default form helpers?
Moving from this:
<%= form_for(@post) do |f| %>
<%= f.text_field :title %>
<% end %>
to this:
<%= form_for(@post) do %>
<%= text_field :title %>
2010 Feb 26
0
save has-many associations
I have the following association
class Document < ActiveRecord::Base
has_many :sections
has_many :items, :through => :sections
end
class Section < ActiveRecord::Base
belongs_to :document
has_many :items
end
class Item < ActiveRecord::Base
belongs_to :section
end
Here is the sample view for the ''new'' action
<% form_for(@document) do |f| %>
<%=
2011 May 16
2
Cannot get multipart => true , running well in my form when using remote => true
I have a simple form , with a file field
= form_for (Clip.new), :html => {:multipart => true} , :remote =>
true , do |f|
= f.hidden_field :user_id, {:value => current_user.id}
= f.text_field :name
= f.text_area :description
= f.file_field :image
= f.submit I18n.t(:add)
generating the html code
<form accept-charset="UTF-8"
2013 May 02
1
trouble-with-capybara-and-rspec-on-a-new-model-spec
I have searched a lot for a solution, but I could not find it! I am trying
to make a rails application after watching Michael Hartl''s tutorial and
when i fill data manually and submit it nothing happens and nothing records
in the Mailers table and I am facing the following error:
Failures:
1) Mailer pages mail us with valid information should send a mail
Failure/Error: expect
2010 Nov 01
2
form_for .label class
Hi,
Could anyone tell me what I''m doing wrong below when trying to apply a
style to the following label and text field
<div class="group">
<%= f.label :name, :html => {:class => "label"} %>
<%= f.text_field :name, :html => {:class => "label"} %>
</div>
Doesn''t work at all, the form however picks
2007 Oct 01
1
form urls and activeresource object
I have an update form that looks like this:
<% form_for @article do |f| %>
<p>
<b>Title</b><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.submit "Update" %>
</p>
and when I try to update it doesn''t work because it prints this in the
html form:
<form
2011 Sep 14
5
rjs error TypeError: element.getElementsByTagName is not a function in rails 3+jquery
hi,
i am using rails 3.0.10
i am trying with sample application for searching data from table and
updating
my search.html.erb file is
<%= form_for (@employee) do |s|%
<div id ="search_details">
<%= s.text_field :name%>
<%= s.text_field :emp_id, :onfocus =>
''sal(document.getElementById(''employee_name'').value);''%>
Unable to figure out why a photo attribute of the paperclip plugin is not being passed in as a param
2011 May 20
4
Unable to figure out why a photo attribute of the paperclip plugin is not being passed in as a param
Hello all,
I am trying to implement a feature in my app where a user posts a
message along with an image.
This is something similar to what is there in `www.diasp.org` .
I dealing with a pretty much outdated configuration of Rails 2.0.2 and
Ruby 1.8.7 , both running on Ubuntu 10.04 OS for project specific
purposes.
Initially, I found a problem in finding an appropriate plugin for
paperclip
2012 Apr 09
0
Autocomplete text-field version of dynamic select menu?
I have a form for submission of brand, model, and style. Style
belongs_to model, and model belongs_to brand. The form is actually a
style submission form, but allows users to create new brands or models
as well, should they not exist.
What I want is for the autocomplete for ''model'' to populate when an
object for ''brand'' is selected in the first text field..
2007 Jul 31
1
form_for - over riding the controller that generates the form
Hello,
I am trying to install my login and search forms as default parts of
the layout. This is the code I am using:
<% form_for :user, :url => {:action => ''authenticate''} do |f| %>
<p>Username:<br /><%= f.text_field :username, :size => 30 %></p>
<p>Password:<br /><%= f.password_field :password, :size => 30
2008 Oct 30
1
Nested Resouces,not getting parent id(project_id) from form
Hi
i am using nested resources,here project having has many relation with
defects.
Main problem here is i am not getting project_id from edit form.What''s a
problem if any one knows please help.
edit.html.erb
<% form_for(@defect,@project) do |f| %>
<%=f.text_field :name%>
<%end%>
routes.rb
map.resources :projects,:has_many=>:defects
map.resources :defects