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
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
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 http://www.ruby
4 matches
Mail list logo