Colin Law wrote in post #1056490:
I think the problem is that you have just used
%= render 'form' %
to render the form. You have not passed the @activity variable to the
form. Have a look at the Rails Guide on Layouts and Rendering for how
to use :locals to pass variables when rendering a
On 14 April 2012 14:11, Julian P. li...@ruby-forum.com wrote:
Colin Law wrote in post #1056490:
I think the problem is that you have just used
%= render 'form' %
to render the form. You have not passed the @activity variable to the
form. Have a look at the Rails Guide on Layouts and
new.html.erb
h1New Activity/h1
%= 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
Colin Law wrote in post #1056501:
On 14 April 2012 13:17, Julian P. li...@ruby-forum.com wrote:
end
end
end
What does the last end match with?
Colin
Damn it that was the mistake. I was always looking at the wrong spot.
Thank you very much Colin.
Julian
--
Posted via
On 14 April 2012 15:55, Julian P. li...@ruby-forum.com wrote:
Colin Law wrote in post #1056501:
On 14 April 2012 13:17, Julian P. li...@ruby-forum.com wrote:
end
end
end
What does the last end match with?
Colin
Damn it that was the mistake. I was always looking at the wrong spot.
Hi,
def search
end
def search1
@employee = Employee.find(params[:id])
respond_to do |format|
format.html{render :partial = 'show'}
format.xml
end
end
search.html is
%= form_for(@employee) do |e| %
EMP ID%=
On Fri, Sep 2, 2011 at 5:30 PM, Pab prabu.ne...@gmail.com wrote:
Hi,
def search
end
def search1
@employee = Employee.find(params[:id])
respond_to do |format|
format.html{render :partial = 'show'}
format.xml
end
end
hi
def search
@employee
end
i have done the above, but it shows following error
undefined method `model_name' for NilClass:Class
Extracted source (around line #1):
1: %= form_for(@employee) do |e| %
2: %= e.error_msg %
3: EMP ID%= e.text_field :id %br
4: %= e.submit 'search', :controller =
On Fri, Sep 2, 2011 at 6:31 PM, Pab prabu.ne...@gmail.com wrote:
hi
def search
@employee
end
i have done the above, but it shows following error
undefined method `model_name' for NilClass:Class
Extracted source (around line #1):
1: %= form_for(@employee) do |e| %
2: %= e.error_msg
Hi,
in @employee = Employee.new, what .new describes about? and i gave
@employee = Employee.search
instead of that, which result in error
undefined method `search' for #Class:0x9295500
thanks,
-pab
--
You received this message because you are subscribed to the Google Groups Ruby
on
On Fri, Sep 2, 2011 at 7:00 PM, Pab prabu.ne...@gmail.com wrote:
Hi,
in @employee = Employee.new, what .new describes about? and i gave
@employee = Employee.search
instead of that, which result in error
undefined method `search' for #Class:0x9295500
I suggest you read some tutorials
Hi Jim,
I got nothing in my action search and linked the search button to
search1 action, which contains the find function is that a problem?
thanks,
-pab
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group,
Pab wrote in post #1019703:
Hi Jim,
I got nothing in my action search and linked the search button to
search1 action, which contains the find function is that a problem?
Yes. Here is the order of what happens:
1) The browser sends a request that hits the action connected to your
Michael Pavling wrote in post #1001495:
Just a guess, but you might want:
@new_trad = Translation.new
No, it's Translations and I forgot to tell that it's not an ActiveRecord
model.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the
On 27 May 2011 14:23, Louis Wrobel li...@ruby-forum.com wrote:
Michael Pavling wrote in post #1001495:
Just a guess, but you might want:
@new_trad = Translation.new
No, it's Translations and I forgot to tell that it's not an ActiveRecord
model.
Right... so the form_for stuff won't work
Hi,
Within your view: I would say you need to replace do |user_comment|
with something else like do |u|
There are no errors in your controller for the new action.
I see you said:
Show of User should let you create a
new comment.
Part of the Rails framework is the convention of mapping new
I would think, @user_comment is nil. Could you attach your controller,
too?
On 28.01.2011, at 03:43, David G. wrote:
Thanks. Same results. So I am also attaching the
user_comments\new.html.erb file. Show of User should let you
create a
new comment.
ActionView::Template::Error
Sure and thanks! You are probably right, since this is a new
UserComment. I am attaching the two controllers - the other files are
included above.
Attachments:
http://www.ruby-forum.com/attachment/5813/user_comments_controller.rb
http://www.ruby-forum.com/attachment/5814/users_controller.rb
David G. wrote in post #978220:
Sure and thanks! You are probably right, since this is a new
UserComment. I am attaching the two controllers - the other files are
included above.
Well, there's your problem! Look at the UserComment#new method. You're
setting @usercomment in the controller,
Marnen Laibow-Koser wrote in post #978225:
David G. wrote in post #978220:
Sure and thanks! You are probably right, since this is a new
UserComment. I am attaching the two controllers - the other files are
included above.
Well, there's your problem! Look at the UserComment#new method.
Thanks for your reply. So let me ask a few specific questions to
clarify my understanding of Ruby.
class UserCommentsController ApplicationController
def new
@usercomment = UserComment.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml =
Again: Please quote when replying! Otherwise the discussion will be
hard to follow, and you will be more likely to skip over things in the
posts you're trying to respond to (as you seem to have done in this
case).
David G. wrote in post #978245:
Thanks for your reply. So let me ask a few
I had tried that already. My _form.html.erb actually starts with
%= form_for(@user_comment) do |user_comment| %
% if @user_comment.errors.any? %
div id=errorExplanation
h2%= pluralize(@user_comment.errors.count, error) %
prohibited this user comment from being saved:/h2
and I
David G. wrote in post #977740:
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
I have attached it - thanks! I am calling this from from a link in the
show of the User class so have enclosed that view as well. Thanks!
Attachments:
http://www.ruby-forum.com/attachment/5807/_form.html.erb
http://www.ruby-forum.com/attachment/5808/show.html.erb
--
Posted via
Please quote when replying.
David G. wrote in post #978047:
I have attached it - thanks! I am calling this from from a link in the
show of the User class so have enclosed that view as well. Thanks!
I'm not sure if this is the direct cause, but it looks like the variable
f isn't defined
Thanks. Same results. So I am also attaching the
user_comments\new.html.erb file. Show of User should let you create a
new comment.
ActionView::Template::Error (undefined method `model_name' for
NilClass:Class):
1: %= form_for(@user_comment) do |user_comment| %
2: % if
27 matches
Mail list logo