Displaying 8 results from an estimated 8 matches for "error_explanation".
2012 Apr 14
7
undefined method `model_name' for NilClass:Class
...er json: @activity }
end
end
View:
<h1>New Activity</h1>
<%= render ''form'' %>
<%= link_to ''Back'', activities_path %>
and partial:
<%= form_for(@activity) do |f| %>
<% if @activity.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@activity.errors.count, "error") %> prohibited
this activity from being saved:</h2>
<ul>
<% @activity.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>...
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
...on.all.to_gmaps4rails
respond_to do |format|
format.html { redirect_to locations_url }
format.json { head :no_content }
end
end
and the _form I use to create the new location:
<%= form_for(@location) do |f| %>
<% if @location.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@location.errors.count, "error") %> prohibited this
location from being saved:</h2>
<ul>
<% @location.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>...
2012 Apr 05
0
Polymorphism, acts_as_relation gem and nested attributes
...addresses and so on. But I''m struggling to get it to
work. I use HAML for whoever may reply with the view code, which is a
lot more readable.
I have the form currently something like this:
views/users/_form.html.haml
= form_for(@user) do |f|
- if @user.errors.any?
#error_explanation
%h2
= pluralize(@user.errors.count, "error")
prohibited this user from being saved:
%ul
- @user.errors.full_messages.each do |msg|
%li= msg
.field
= f.label :name
= f.text_field :name
.field...
2012 Aug 25
0
accepts_nested_attributes_for and fields_for not working!
...dinner models:
class Lunch < ActiveRecord::Base
attr_accessible :menu_id, :lunch_menu
belongs_to :menu
mount_uploader :lunch_menu, ImageUploader
end
Menu Form:
<%= form_for @menu, :html => {:multipart => true} do |f| %>
<% if @menu.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@menu.errors.count, "error") %> prohibited this
menu from being saved:</h2>
<ul>
<% @menu.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul&g...
2011 Mar 10
4
Multi-model forms
...d
through a select_tag instead of inserting a new country.
This is the guest form, with the nested address form view:
<% if @guest.address.nil? %>
<% @guest.build_address %>
<% end %>
<%= form_for(@guest) do |f| %>
<% if @guest.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@guest.errors.count, "error") %> prohibited
this guest from being saved:</h2>
<ul>
<% @guest.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul...
2011 Apr 25
30
NoMethodError in Book
...NoMethodError in Book#new
Showing /home/amrit/boook/app/views/book/_form.html.erb where line #1
raised:
undefined method `model_name'' for NilClass:Class
The content of _form.html.erb file are:
<%= form_for(@post) do |f| %>
<% if @post.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited
this post from being saved:</h2>
<ul>
<% @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>...
2011 Jul 14
10
Devise confusing routes
I had a similar problem yesterday.
I would go to the root of my site and I would get a Too Many Redirects
message. It seems like there was an infinite loop. After struggling for
over an hour yesterday late at night, it seemed like I fixed it.
But now, when I want to create a New User, it''s redirecting me to the
Sign In screen. Seems like I didn''t fix the problem completely.
I
2011 Nov 05
13
Adding a site admin user while creating a site
...end
*-------------------*
**
*Below is the form to which i have made changes, I have added the bold part
in the below form ( this form is called by views/sites/new.html.erb) *
**
*-------------------------*
<%= form_for(@site) do |f| %>
<% if @site.errors.any? %>
<div id="error_explanation">
<h2>Could not save record due to following errors. Please correct
them and continue</h2>
<ul>
<% @site.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
&...