Displaying 20 results from an estimated 10000 matches similar to: "NilClass passed to partial view"
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 <
2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up
examples of how to have multiple entities in a single-table inheritance
related to anything.
I have an addresses table, but multiple entities can have Addresses:
both Person (which has 2 addresses) and Retailer. I''ve been told that I
need to use single-table inheritance, and this was my attempt:
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
Hi All,
just in a spot of bother with this gem, I am trying to create a new
location and get the above msg.
here is my controller:
class LocationsController < ApplicationController
# GET /locations
# GET /locations.json
def index
@locations = Location.all
@json = Location.all.to_gmaps4rails
end
respond_to do |format|
format.html # index.html.erb
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 : <%=
2005 Sep 29
0
Table relationships with single table inheritance
Hi,
How do I relate a table to another when one of the models uses single table
inheritance? Will this even work? This is the specific problem I am having:
There''s an "Address" model with "ShippingAddress" and "BillingAddress" as
subclasses. It looks like this:
class Address < ActiveRecord::Base
End
class ShippingAddress < Address
has_one :order
2011 Aug 31
9
undefined method `model_name' for NilClass:Class in rails 3.0.0
Hi,
i got search which shows following error
ActionView::Template::Error (undefined method `model_name'' for
NilClass:Class):
1: <%= form_for(@employee) do |e| %>
2: EMP ID<%= e.text_field :id %><br>
3: <%= e.submit ''search'', :controller => ''employees'', :action =>
''search1'' %>
2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
I have the following models:
class Order < ActiveRecord::Base
belongs_to :billing_address
belongs_to :shipping_address
accepts_nested_attributes_for :billing_address
accepts_nested_attributes_for :shipping_address, :reject_if => proc {
|attributes| attributes[''has_shipping_address''] != ''1'' }
def after_initialize
self.build_billing_address
2011 Jan 26
13
undefined method `model_name' for NilClass:Class
I am new to Ruby on Rails and have a very simple foreign key example
that is driving me nuts. I am using Rails 3 under Windows Vista and have
two tables: users and user_comments. user_comments.user_id should
point to the user a comment is about.
In my show view for user I have a link to the new method of
user_comments to allow a comment to be created. This throws:
Showing
2011 Apr 25
30
NoMethodError in Book
I got a following error.
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><%=
2006 Aug 02
3
Data relationships for e-commerce: users, orders, addresses
Hi there
I''m in the process of developing an e-commerce Rails app but am
getting a little stuck on what models I should be working with on the
order/checkout side of things.
The app requires users to be registered and authenticated to checkout.
So I already have a User model and an Order model (which belongs to a
User). The Order model is largely similar to that used in the Agile
Rails
2009 Mar 28
2
Git and vendor/rails
This is really a git question but the problem is with rails using git and
others may have come across the problem.
I have a branch on my application''s git repository with edge rails as a
subproject checked out into vendor/rails. this allows me to keep my
application edge-compliant by checking out the branch (which creates the
rails folder in vendor), pulling the latest edge rails and
2012 Apr 21
13
issues with changing directory structure in rails3
class BranchesController < ApplicationController
def branch
@branch = Branch.new (params[:branch])
branch_back = @branch.*branch*
end
end
in the model have one *branch.rb*
class Branch
def branch
end
end
In the view have one branches folder, also have the branch.html.erb in that
folder.
<%= form_for(@branch) do |f| %>
<%end%>
*routes.rb*
*
*
match
2010 Oct 21
4
Authlogic + Rails3 - undefined method `Login' for nil:NilClass
Im new to Rails, and decided to start of with Rails3. After a lot of
searching ive managed to get a little bit of Authlogic working. I''m able
to register a user, login & logout.
Now, I would like to add more features, get more of authlogic working.
I''m using Railscast EP 160 as my reference.
Portions of the code found on the tutorial throw errors: Eg:
<!--
2012 Jul 18
3
Undefined method error
I have been working on a project based on Michael Hartl''s book Ruby on
Rails Tutorial in order to try to teach myself Ruby on Rails. However,
when it tries to render a form designed to allow a user to submit a
small message, I get an error saying, "undefined method `model_name'' for
NilClass:Class". It says the error is at line 1, which is "<%= form_for
2012 Jan 20
3
Fields_for adding html (text) for hidden field
Hello all,
I''m getting this weird ''<input name value=''2'' type=''hidden'' />'' text
printed out in my form. See attached image. I''ve spent too much time
trying to figure it out already and it''s not going to stop me from
moving on for now.
As you can see it''s still very early on.
I''m using
2011 Jun 29
6
RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)
In my user_sessions_controller:
class UserSessionsController < ApplicationController
before_filter :require_no_user, :only => [:create, :new]
before_filter :require_user, :only => :destroy
def new
@user_session = UserSession.new
@message = "Hello."
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
2010 Aug 18
6
undefined method `eq' for nil:NilClass
I''m walking through an example in the "Head First Rails" book, but,
instead doing the examples using Rails3.0.0.rc.
But, I''m getting this error when browsing for example:
http://localhost:3000/advs/1
undefined method `eq'' for nil:NilClass
Provided that my advs_controller.rb is as follows:
http://pastie.org/private/cd9zntg2ite57ept288kfa
Any ideas why
2011 May 27
14
[rails] undefined method `model_name' for NilClass:Class
Never seen the error above before, code:
describe "edit action" do
it "edit action should render edit template" do
food = Food.create(:name=>''mooo'') #
Food.any_instance.stubs(:valid?).returns(true)
get :edit, :id => food.id
response.should render_template(:edit)
end
end
-------------- next part
2012 Oct 17
6
NoMethodError (undefined method `service_options' for nil:NilClass)
hi i am using rails 2.3.4 and i am facing "no method error"
there is possibility to not find method but my question is - is there
possibility to error occurred because of empty table? or error in another
controller or helper?
error trace:
Processing QuoteRequestsController#create (for 127.0.0.1 at 2012-10-17
16:07:34) [POST]
Parameters:
2008 Dec 02
4
Am I wrong or is fields_for not working right in Rails 2.2.2
I may be totally wrong about what the fields_for method is supposed to
do, but for some reason I thought using it scoped an object around an
association.
For example, I have a User class and when you''re creating a new user I
want to use fields_for to add a BillingAddress to the user like so:
<%- fields_for :billing_address do |billing_address_form| -%>
<%= render :partial