Displaying 20 results from an estimated 20000 matches similar to: "0 errors prohibited this model from being saved"
2010 Jan 28
1
validates preference of at least one param
I have a simple RESTful search scaffold that finds data in a separate
model and controller.
[code]
<h1>New search</h1>
<% form_for(@search) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :category_id %><br />
<%= f.collection_select :category_id, Category.all, :id, :name,
:include_blank => true %>
</p>
<p>
Age
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
2009 Jul 18
2
Sharing controllers/models within a view
Hello, please forgive me if this answer is obvious! I''m new to Rails
this week.
I have two database tables, and the associated scaffolding, controllers,
models and views. The first is service_provider, which holds a list of
service providers. The second is service_provider_countries which is a
table of countries (obvious perhaps).
In views/service_providers/new.html.erb I have a form,
2010 Sep 01
5
validation errors bring up stack trace error page
hello!
I made some custom validations for my app, which do catch invalid data
in the console. However, when I enter invalid data through a form on the
browser view, I get your stack trace error style page (similar to what
you see when you get a syntax error or a nil object) instead of the
nicely styled error messages (what you would see in a scaffolded
application.
First off, what is the stack
2009 Feb 06
2
Using partials with form_for
hi all
i was wondering whether it is possible to use partials along with form_for
and form_field. following code is not working. is there some error or this
case is impossible..??
*#new.html.erb*
<h1>Enter Details for new Partner:</h1>
<% form_for(@partner) do |f| %>
<%= render :partial => ''form'', :locals => {:partner => f} %>
<p>
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the
console, but not from the view. I have the following:
# partial schema
create_table "users", :force => true do |t|
t.string "login", :null => false
t.string "first_name"
t.string "last_name"
t.string "email", :null => false
2009 Nov 12
1
Please help me ------ Mapping an item to article
Hi everybody,
I have a form like this
<h1>New menuitem</h1>
<% form_for(@menuitem) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.label :alias %><br />
<%= f.text_field :alias %>
</p>
<p>
<%= f.label
2009 Oct 02
2
Plural version of the model detected, using singularized version. Override with --force-plural.
what is the proper way to make this work? --force-plural doesn''t seem
to change the results. this only seems to happen when you choose
words that the plural and singular is the same word.
script/generate scaffold equipment name:string description:text
warning Plural version of the model detected, using singularized
version. Override with --force-plural.
results in the following
2008 Jul 12
6
Create db row in my partial template
Hi,
When I use script/generate scaffold for my db it automatically creates
that page where I can select to add a new item to the database.
In the controller, the create method looks like this:
def create
@user = User.new(params[:user])
respond_to do |format|
if @user.save
flash[:notice] = ''User was successfully created.''
format.html {
2009 Feb 09
2
how to get form parameters while using fields_for with nested attributes
hi all..
i am trying to use *fields_for* to get and save nested attributes in a form.
i have a ''Partner'' model associated with an ''Address'' model.
partner has_many :addresses
although the form is displaying fine, but on submitting it the following
error is shown:
*can''t convert HashWithIndifferentAccess into Array*
on this line:
*@partner =
2009 Jun 20
0
AssociationTypeMismatch
Am getting the following error:
Modul(#36555780) expected, got String(#21132310)
After doing a lot of research on the net, i found that i need to pass
on the id field somehow, but i dont really know how to do it.
Following is the model:
---------------------------------
class Modul < ActiveRecord::Base
belongs_to :modulable, :polymorphic => true
end
class Chapter < ActiveRecord::Base
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| %>
<%=
2010 Aug 23
3
Unable to upload images using native rails file upload
I am a rails newbie and am trying to build my first app. I have a jobs
and categories controller and models respectively.
CONTROLLER:
def new
@job = Job.new
@catergory = Catergory.all
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @job }
end
end
#THIS IS A group of 10 RADIO_BUTTONS TO SELECT A CATEGORY FROM. BY
DEFAULT THE FIRST
2006 Sep 24
8
form_for and Multiple Models Being Saved
Howdy Folks,
I want to use form_for to allow a user to submit a form that contains two
instances of the same model. They are entering calendar dates and I want
them to be able to submit 2 from the same form.
Ok, so, using form_for, what is the best way to do this? form_for seems to
be setup to handle a single instance in that it wants a name for the
variable, etc...
Has someone else done this?
2009 Oct 28
6
undefined method `^' for "e":String
I''m attempting to learn Ruby on Rails, but these errors aren''t helping.
I''m currently trying to follow the lessons available on
www.learningrails.com. I received this error after trying to visit a
page generated by using the scaffold command. Actually, this is all I
did up until the error:
rails sample2 -d mysql
mysqladmin -u root -p create sample2_development
ruby
2010 Aug 18
2
auth logic - password confirmation
Hi, newbie here. :)
i have this form on a test rails app:
<% form_for @user do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :username %><br />
<%= f.text_field :username %>
</p>
<p>
<%= f.label :email %><br />
<%= f.text_field :email %>
</p>
<p>
<%= f.label :password %><br
2010 Jun 08
9
[Rails Heroku] Problem with saving object (on heroku hosting)
Hi All,
I have some strange problem which appears only on heroku hosting 2.3.5
default stack (not on my local computer)
I have some models. Here they are:
class Contact < ActiveRecord::Base
belongs_to :user
belongs_to :type, :class_name => "ContactType", :foreign_key =>
"type_id"
validates_presence_of :name, :on => :create, :message =>
2010 Dec 23
0
has_many :through full stack help
I am trying to implement HMT for the first time and having a ton of
trouble. I would like to be able to have the user check a checkbox
and fill some extra fields for data input. I have tried so many
iterations borrowed from different places I found on the web, none
seem to work quite right. Essentially I have two models: ''practice''
and ''system'' where a
2012 Feb 07
2
save method (create action) saves twice
Rails 3.1.3
I have changed a regular scaffold action a bit so that it can save using
ajax.
All I needed to do was adding ":remote => true" in
<div id="script_new">
<%= form_for script, :remote => true do |f| %> <!-- HERE!!! -->
<%= f.hidden_field :video_id %>
<%= f.text_field :text %>
<%= f.submit "save" %>
Problem with non-ascii characters in forms: "incompatible character encodings: UTF-8 and ASCII-8BIT"
2010 Aug 01
3
Problem with non-ascii characters in forms: "incompatible character encodings: UTF-8 and ASCII-8BIT"
Hi
First off, I''m using Ruby 1.9.1p378 and Rails 2.3.8.
I was creating a minimal application to test handling of Norwegian special
characters when I bumped into this strange problem...
I have a simple Car model with fields maker:string and model:string.
For the controller I planned to just have an index action do all the work:
class CarsController < ApplicationController
def index