I have two models:
class Forum < ActiveRecord::Base
has_many :threads
end
class Thread < ActiveRecord::Base
belongs_to :forum, :dependent => :destroy
has_many :posts
end
In my view, I try this:
<%= #forum.name %>
<% #forum.threads.each do |thread| %>
<%= link_to thread.name, [#forum, thread], :class => "remote" %>
<% end %>
And I get this error on line #1:
undefined method `scoped' for Thread:Class
Any idea what's going on here? I've seen other users describe this problem, but it's typically because they've pluralized the has_many or singularized the belongs_to. As far as I can tell, my models are well-made. Please let me know what I'm doing wrong.
The full stack trace:
activerecord (3.2.9) lib/active_record/associations/association.rb:123:in `target_scope'
activerecord (3.2.9) lib/active_record/associations/association.rb:87:in `scoped'
activerecord (3.2.9) lib/active_record/associations/collection_association.rb:382:in `find_target'
activerecord (3.2.9) lib/active_record/associations/collection_association.rb:335:in `load_target'
C:in `load_target'
activerecord (3.2.9) lib/active_record/associations/collection_proxy.rb:87:in `method_missing'
app/views/forums/_show.html.erb:2:in `_app_views_forums__show_html_erb___1062139204_27502608'
actionpack (3.2.9) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.9) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.9) lib/action_view/template.rb:143:in `render'
actionpack (3.2.9) lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
actionpack (3.2.9) lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
actionpack (3.2.9) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.9) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.9) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.9) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.9) lib/action_view/renderer/partial_renderer.rb:237:in `render'
actionpack (3.2.9) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.2.9) lib/action_view/helpers/rendering_helper.rb:27:in `render'
app/views/forums/show.html.erb:1:in `_app_views_forums_show_html_erb___608144578_36161352'
actionpack (3.2.9) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.9) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.9) lib/action_view/template.rb:143:in `render'
actionpack (3.2.9) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.9) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.9) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.9) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.9) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.9) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.9) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.9) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.9) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.9) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.9) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.9) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.9) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.9) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.9) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.9) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.9) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.9) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.9) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.9) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.9) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.9) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.9) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.9) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.9) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.9) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.9) lib/active_support/callbacks.rb:425:in `_run__271720943__process_action__435225614__callbacks'
activesupport (3.2.9) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.9) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.9) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.9) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.9) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.9) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.9) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.9) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.9) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.9) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.9) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.9) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.9) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.9) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:601:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.9) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.9) lib/active_support/callbacks.rb:405:in `_run__598850227__call__514831618__callbacks'
activesupport (3.2.9) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.9) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.9) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.9) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.9) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.9) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.9) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.9) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.9) lib/rails/engine.rb:479:in `call'
railties (3.2.9) lib/rails/application.rb:223:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.9) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
The problem is caused by your model class name Thread, because it is also the name of a standard Ruby class.
When Rails tries to find the target class of the association it uses the internal class Thread (which has no scoped method) instead of your model class.
There a two solutions:
1. Rename the model (best solution)
class Topic < ActiveRecord::Base #Thread class
end
class Forum < ActiveRecord::Base
has_many :topics
end
This way you can still keep your original association names:
class Forum < ActiveRecord::Base
has_many :theads, class_name: 'Topic'
end
2. Put your Thread model in a module (works but might have unwanted side-effects)
class MyApp::Thread < ActiveRecord::Base
end
class Forum < ActiveRecord::Base
has_many :threads, class_name: 'MyApp::Thread'
end
You could also put all your models and controllers in a module. Rails looks for constants in the current module first, so your Thread class will be found first. This also has the advantage that you don't have to explicitly specify the class_name on your associations or in your controller actions.
class MyApp::Thread < ActiveRecord::Base
end
class MyApp::Forum < ActiveRecord::Base
has_many :threads # Works!
end
class MyApp::ThreadsController < ApplicationController
def show
#thread = Thread.find(params[:id]) # Works!
end
end
But you also have to change your routes.rb to account for the module and your input names in your views will all be prefixed with the module name, so even if this solution looks very clean, it might not be what you want.
Perhaps this construct: [#forum, thread] is making rails look for a nested resource in config/routes.rb such as
resources :forums do
resources :threads
end
Related
I have a weird error in my rails query.
my controller action looks like this ;
def manager_home
render layout: 'feed.html.erb'
#questions = Conversation.where("nature ='Question' AND status = 'Not Answered'").last(20)
end
and my view looks like this (extract)
<div class="large-12 columns">
<% #questions.each do |question| %>
<p><strong><%= "#{question.created_at}" %>:</strong> <%= "#{question.message}" %></p>
<ul class="inline-list">
<li>Reply</li>
</ul>
<%end%>
</div>
However, i get this error;undefined methodeach' for nil:NilClass`
But the same query in the console finds results
What could be the problem? I have a feeling its something silly am overlooking.
the full trace is;
app/views/home/manager_home.html.erb:26:in `_app_views_home_manager_home_html_erb__442256602_76257090'
actionpack (3.2.13) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.13) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.13) lib/action_view/template.rb:143:in `render'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.13) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.13) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.13) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.13) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.13) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/local/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.13) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:39:in `render'
app/controllers/home_controller.rb:11:in `manager_home'
actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.13) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.13) lib/active_support/callbacks.rb:425:in `_run__572589686__process_action__328897408__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.13) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__109696510__call__883773334__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
render layout is returning out of the action before #questions is being assigned. Reverse the order and your problem should be resolved:
#questions = Conversation.where("nature ='Question' AND status = 'Not Answered'").last(20)
render layout: 'feed.html.erb'
I'm getting a "no implicit conversion of Fixnum into String" error with client-side-validations. Can't find anything on SO regarding this. Code is as follows:
Form in the view:
<% #tournament.sub_tournaments.each_with_index do |sub, i| %>
<%= f.fields_for :sub_tournaments, sub, :validate => true do |sub_form| %>
<div class="tab-content match-content hide">
<span class="match_fields"></span>
<fieldset class="emty">
<legend>Match</legend>
<div class="add-item add_match">
<% if i == 1 %>
<%= link_to_add_matches_fields(sub_form, :player_matches, i) %>
<% else %>
<%= link_to_add_matches_fields(sub_form, :team_matches, i) %>
<% end %>
</div>
</fieldset>
</div>
<% end %>
<% end %>
the view references link_to_add_matches_fields which is in application_helper
def link_to_add_matches_fields(f, association, index)
new_object = f.object.send(association).klass.new
id = new_object.object_id
game = Game.find(index + 1)
fields = f.fields_for(association, new_object, child_index: id) do |builder|
render("tournaments/form_partials/" + association.to_s.singularize + "_fields", f: builder, game: game)
end
link_to('#', :class => "add-matches-button", data: {id: id, fields: fields.gsub("\n", "")}) do
'<span class="sign pos">+</span><div>ADD Match</div>'.html_safe
end
end
Everything works through here and passes to either _team_matches or _player_matches correctly. But in _team_matches -
<fieldset>
<%= f.hidden_field :_destroy %>
<legend>Match<span class="remove">Remove</span></legend>
<table>
<tr>
<td> HOME TEAM
##this line## <%= f.collection_select(:home_team_id, TeamDivision.where("game_id = ?", game.id), :id, :name, {include_blank: true}) %>
</td>
...
The marked line is throwing the error - If i take out collection_select and put in another variable, or just text, things are rendering fine. If change the TeamDivision.where part, it throws the same error. Based on the full trace (below), it has something to do with client-side-validations, but not sure what could be preventing the form from even being shown...?
TypeError - no implicit conversion of Fixnum into String:
client_side_validations (3.2.5) lib/client_side_validations/action_view/form_builder.rb:98:in `build_validation_options'
client_side_validations (3.2.5) lib/client_side_validations/action_view/form_builder.rb:75:in `collection_select_with_client_side_validations'
app/views/tournaments/form_partials/_team_match_fields.html.erb:7:in `_app_views_tournaments_form_partials__team_match_fields_html_erb___1390226928296495378_2640008440'
actionpack (3.2.13) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.13) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.13) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.1.26) Ruby/lib/mini_profiler/profiling_methods.rb:90:in `block in profile_method'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:237:in `render'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.2.13) lib/action_view/helpers/rendering_helper.rb:27:in `render'
app/helpers/application_helper.rb:35:in `block in link_to_add_matches_fields'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `capture'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:605:in `fields_for'
client_side_validations (3.2.5) lib/client_side_validations/action_view/form_helper.rb:54:in `fields_for'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1467:in `fields_for_nested_model'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1453:in `block in fields_for_with_nested_attributes'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1452:in `fields_for_with_nested_attributes'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1302:in `fields_for'
client_side_validations (3.2.5) lib/client_side_validations/action_view/form_builder.rb:53:in `fields_for_with_client_side_validations'
app/helpers/application_helper.rb:34:in `link_to_add_matches_fields'
app/views/tournaments/form_partials/_form.html.erb:172:in `block (3 levels) in _app_views_tournaments_form_partials__form_html_erb__2167663622248243032_2516373920'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `capture'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:605:in `fields_for'
client_side_validations (3.2.5) lib/client_side_validations/action_view/form_helper.rb:54:in `fields_for'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1467:in `fields_for_nested_model'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1453:in `block in fields_for_with_nested_attributes'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1452:in `fields_for_with_nested_attributes'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1302:in `fields_for'
client_side_validations (3.2.5) lib/client_side_validations/action_view/form_builder.rb:53:in `fields_for_with_client_side_validations'
app/views/tournaments/form_partials/_form.html.erb:163:in `block (2 levels) in _app_views_tournaments_form_partials__form_html_erb__2167663622248243032_2516373920'
activerecord (3.2.13) lib/active_record/associations/collection_proxy.rb:89:in `method_missing'
app/views/tournaments/form_partials/_form.html.erb:162:in `block in _app_views_tournaments_form_partials__form_html_erb__2167663622248243032_2516373920'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `capture'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:378:in `form_for'
client_side_validations (3.2.5) lib/client_side_validations/action_view/form_helper.rb:25:in `form_for'
app/views/tournaments/form_partials/_form.html.erb:1:in `_app_views_tournaments_form_partials__form_html_erb__2167663622248243032_2516373920'
actionpack (3.2.13) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.13) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.13) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.1.26) Ruby/lib/mini_profiler/profiling_methods.rb:90:in `block in profile_method'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:237:in `render'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.2.13) lib/action_view/helpers/rendering_helper.rb:27:in `render'
app/views/tournaments/new.html.erb:7:in `_app_views_tournaments_new_html_erb___2830740236402949620_2540177140'
actionpack (3.2.13) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.13) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.13) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.1.26) Ruby/lib/mini_profiler/profiling_methods.rb:90:in `block in profile_method'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.13) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.13) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.13) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.13) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.13) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/Users/*/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (3.2.13) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.13) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.13) lib/active_support/callbacks.rb:448:in `block in _run__4570382803702994908__process_action__2904075733109352235__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_64511'
app/controllers/application_controller.rb:19:in `set_time_zone'
activesupport (3.2.13) lib/active_support/callbacks.rb:214:in `_conditional_callback_around_64511'
activesupport (3.2.13) lib/active_support/callbacks.rb:414:in `_run__4570382803702994908__process_action__2904075733109352235__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:45:in `process'
rack-mini-profiler (0.1.26) Ruby/lib/mini_profiler/profiling_methods.rb:90:in `block in profile_method'
actionpack (3.2.13) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
bullet (4.6.0) lib/bullet/rack.rb:10:in `call'
client_side_validations (3.2.5) lib/client_side_validations/middleware.rb:21:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__3907649973208251614__call__26916800040981581__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
better_errors (0.9.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (0.9.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (0.9.0) lib/better_errors/middleware.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
rack-mini-profiler (0.1.26) Ruby/lib/mini_profiler/profiler.rb:278:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/Users/*/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/Users/*/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/Users/*/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
You have to update you client-side-validation gem.
See this commit: https://github.com/bcardarella/client_side_validations/commit/1602e5da3cf9535cf1254046aa8d8f1248fa5b58
The changes:
child_index = #options[:child_index] ? "(\\d+|#{Regexp.escape(#options[:child_index])})" : "\\d+"
^^^^
child_index = #options[:child_index] ? "(\\d+|#{Regexp.escape(#options[:child_index].to_s)})
Run:
bundle update --source client_side_validations
I'm using Event Calendar to generate a calendar for my events, but I'm getting a weird error. Every time I run webrick I get an "undefined method 'calendar'" error, but if I change anything in the events_helper and save without restarting the server, the error disappears! Has anyone seen such an error?
This is the line the message is referring to in the events_helper.rb (line 3)
def event_calendar
# args is an argument hash containing :event, :day, and :options
calendar event_calendar_opts do |args|
event = args[:event]
%(#{h(event.name)})
end
end
Thanks!
-- Full Trace:
app/helpers/events_helper.rb:20:in `event_calendar'
app/views/events/index.html.erb:8:in `_app_views_events_index_html_erb__2839012149448078506_2185002760'
actionpack (3.2.6) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.6) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.6) lib/action_view/template.rb:143:in `render'
actionpack (3.2.6) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.6) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.6) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.6) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.6) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.6) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.6) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.6) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.6) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.6) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.6) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.6) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.6) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.6) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.6) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.6) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.6) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/Users/moshark/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.6) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.6) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.6) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.6) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.6) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.6) lib/active_support/callbacks.rb:447:in `_run__3962713512247968028__process_action__3396197975695833499__callbacks'
activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.6) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.6) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.6) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.6) lib/action_controller/metal/params_wrapper.rb:206:in `process_action'
activerecord (3.2.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.6) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.6) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.6) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.6) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.6) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:600:in `call'
sass (3.2.1) lib/sass/plugin/rack.rb:54:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.6) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `_run__2917286435426199189__call__17875809250747617__callbacks'
activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.6) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.0.1) lib/quiet_assets.rb:20:in `call_with_quiet_assets'
actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.6) lib/rails/engine.rb:479:in `call'
railties (3.2.6) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.6) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/Users/moshark/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/moshark/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/moshark/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Try including EventCalendar::CalendarHelper into your helper
You might have to require the event_calendar in addition to including it in your Gemfile.
Use following syntax:
gem 'event-calendar', :require => 'event_calendar'
I'm having problem with form_for, have searched for the problem for the solutions given does not solve my problem.
I'm trying to do up a form to create new recipes:
**app/views/recipes/new.html.erb**
<%= form_for #recipe do |f| %>
<% if #recipe.errors.any? %>
<% end %>
<div class="field">
<%= f.label :recipename %><br />
<%= f.text_area :recipename %>
</div>
<div class="field">
<%= f.label :user_id %><br />
<%= f.number_field :user_id %>
</div>
<div class="actions">
<%= f.submit %>
</div>
**routes.rb**
Baserecipe::Application.routes.draw do
resources :users
resources :recipes
....
match '/createrecipe', to: 'recipes#new'
**recipes_controller.rb**
class RecipesController < ApplicationController
def create
#recipe = Recipe.new(params[:recipe])
end
end
I'm alway getting the error:
undefined method `model_name' for NilClass:Class
Extracted source (around line #1):
1: <%= form_for #recipe do |f| %>
2: <% if #recipe.errors.any? %>
3: <% end %>
class Recipe < ActiveRecord::Base
attr_accessible :recipename, :instruct1, :instruct2, :instruct3, :instruct4, :instruct5,
:instruct6, :instruct7, :instruct8, :instruct9, :instruct10, :instruct11, :instruct12,
:instruct13, :instruct14, :instruct15, :instruct16, :instruct17, :instruct18, :instruct19,
:instruct20, :instruct21, :instruct22, :instruct23, :instruct24, :instruct25, :instruct26,
:instruct27, :instruct28, :instruct29, :instruct30, :preptime, :cooktime
belongs_to :user
has_many :ingredients
has_many :rcomments
validates :recipename, presence: true, length: { maximum: 140 }
validates :user_id, presence: true
validates :preptime, presence: true
validates :cooktime, presence: true
default_scope order: 'recipes.created_at DESC'
end
full trace:
activemodel (3.2.7) lib/active_model/naming.rb:163:in `model_name_from_record_or_class'
activemodel (3.2.7) lib/active_model/naming.rb:158:in `param_key'
actionpack (3.2.7) lib/action_view/helpers/form_helper.rb:369:in `form_for'
app/views/recipes/new.html.erb:3:in `_app_views_recipes_new_html_erb___168565054_39061080'
actionpack (3.2.7) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.7) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.7) lib/action_view/template.rb:143:in `render'
actionpack (3.2.7) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.7) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.7) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.7) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.7) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.7) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.7) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.7) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.7) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.7) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.7) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.7) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.7) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.7) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.7) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.7) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.7) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.7) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.7) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.7) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.7) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.7) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.7) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.7) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.7) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.7) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.7) lib/active_support/callbacks.rb:414:in `_run__22188539__process_action__1016913818__callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.7) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.7) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.7) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.7) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.7) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.7) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.7) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.7) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.7) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.7) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.7) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.7) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:600:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.7) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in `_run__305680696__call__774818341__callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.7) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.7) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.7) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.7) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.7) lib/rails/engine.rb:479:in `call'
railties (3.2.7) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.7) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
try this
# in your recipes_controller.rb
def new
#recipe = Recipe.new
end
and remove
match '/createrecipe', to: 'recipes#new'
#in routes.rb
Baserecipe::Application.routes.draw do
resources :users
resources :recipes
....
see more info about route
your model file look like - recipe.rb
class Recipe < ActiveRecord::Base
...
...
end
i hava a problem with my edit.html.erb if i want to edit something in my ruby app then this errors appears :
undefined method `model_name' for NilClass:Class
<%- model_class = #mytime.class -%>
<h1><%=t '.title', :default => t('helpers.titles.edit', :model =>model_class.model_name.human,
:default => "Edit #{model_class.model_name.human}") %></h1>
<%= render :partial => 'form' %>
My Fulltrace :
app/views/mytimes/edit.html.erb:3:in `_app_views_mytimes_edit_html_erb___308492073099851536_70125215393580'
actionpack (3.2.3) lib/action_view/template.rb:143:in `block in render'
activesupport (3.2.3) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.3) lib/action_view/template.rb:141:in `render'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.3) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.3) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.3) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.3) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.3) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.3) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.3) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/Users/sinaoberle/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.3) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.3) lib/active_support/callbacks.rb:425:in `_run__1584935368947607784__process_action__332388991620009023__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.3) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `_run__344157926311310900__call__3627087792160188865__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/Users/sinaoberle/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/sinaoberle/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/sinaoberle/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
edit.html.erb
<%- model_class = #mytime.class -%>
<h1><%=t '.title', :default => t('helpers.titles.edit', :model => model_class.model_name.human,
:default => "Edit #{model_class.model_name.human}") %></h1>
<%= render :partial => 'form' %>
Iam thankful for your help !
As Highcode said above in comments - seems like #mytime is not set and when you get its class it giving you NilClass. Of course, it doesn't have a model_name method at all.