``c`` is undefined in ``<human-collection-name>``
Reported by Tomoaki Hayasaka | October 16th, 2010 @ 01:04 AM | in Hobo 1.3 (Rails 3)
The commit 56ee6ed0205a35c1 removed "c
" in
<human-collection-name>
but a reference to
"c
" is still there.
This causes undefined method `c' for
#<#<Class:0xb56945f0>:0xb56884f8>
.
Test:
class TweetsController < ApplicationController
hobo_model_controller
auto_actions :all
end
class Tweet < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
tweet :string
timestamps
end
belongs_to :user
validates_presence_of :user
def name; "#{created_at} - #{tweet}"; end
def create_permitted?; true; end
def update_permitted?; true; end
def destroy_permitted?; true; end
def view_permitted?(field); true; end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index e3ddcee..f769518 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -9,6 +9,8 @@ class User < ActiveRecord::Base
timestamps
end
+ has_many :tweets
+
# This gives admin rights to the first sign-up.
# Just remove it if you don't want that
before_create { |user| user.administrator = true if !Rails.env.test? && user.class.count == 0 }
diff --git a/app/viewhints/user_hints.rb b/app/viewhints/user_hints.rb
index edd1b77..f8108fa 100644
--- a/app/viewhints/user_hints.rb
+++ b/app/viewhints/user_hints.rb
@@ -1,5 +1,6 @@
class UserHints < Hobo::ViewHints
# children :primary_collection1, :aside_collection1, :aside_collection2
+ children :tweets
end
Do "rails g hobo:migration
", "rails
s
", create a user and login, then go to
"/users/1
" and you'll see "undefined method `c'
for...
".
Fix:
diff --git a/hobo/lib/hobo/rapid/taglibs/rapid_i18n.dryml b/hobo/lib/hobo/rapid/taglibs/rapid_i18n.dryml
index a70a14c..4f63b47 100644
--- a/hobo/lib/hobo/rapid/taglibs/rapid_i18n.dryml
+++ b/hobo/lib/hobo/rapid/taglibs/rapid_i18n.dryml
@@ -115,7 +115,7 @@ With the `your` attribute and in the special case the context is a Hobo::Model::
attrs = {}
all_attributes.each_pair{|k,v| attrs[k.to_sym] = v} -%>
<% if your && belong_class < Hobo::Model::User && this.kind_of?(Hobo::Model::User) && I18n.locale == :en -%>
- <your key="&collection" merge-attrs="&{:count=>c, :name=>this.name}.merge(attrs)" capitalize>
+ <your key="&collection" merge-attrs="&{:name=>this.name}.merge(attrs)" capitalize>
<%= belong_class.human_attribute_name(collection.to_sym, attrs) %>
</your>
<% else -%>
Comments and changes to this ticket
-
Domizio Demichelis October 16th, 2010 @ 03:23 PM
- State changed from new to open
- Milestone set to Hobo 1.3 (Rails 3)
- Assigned user set to Domizio Demichelis
- Milestone order changed from 197911 to 0
oooops... :-)
-
Domizio Demichelis October 16th, 2010 @ 03:26 PM
- State changed from open to resolved
(from [53b1e404809e115a6c5db500d19a4ee5748c5914]) removed ghost :count=>c from human-collection-name tag [#832 state:resolved] http://github.com/tablatom/hobo/commit/53b1e404809e115a6c5db500d19a...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Tags
Referenced by
- 832 ``c`` is undefined in ``<human-collection-name>`` (from [53b1e404809e115a6c5db500d19a4ee5748c5914]) removed...