Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chronicle breaks snippets with NoMethodError #48

Open
rca opened this issue Mar 9, 2010 · 6 comments
Open

chronicle breaks snippets with NoMethodError #48

rca opened this issue Mar 9, 2010 · 6 comments

Comments

@rca
Copy link

rca commented Mar 9, 2010

When installing Chronicle, the snippets tab in the admin breaks and any snippets used on a site show up with "Snippet not found". Below is the error when going to /admin/snippets:

NoMethodError in Admin/snippets#index

Showing vendor/extensions/chronicle/app/views/admin/snippets/index.html.haml where line #26 raised:

undefined method `name' for nil:NilClass
Extracted source (around line #26):

23: = image('snippet', :alt => 'snippet-icon')
24: %span= link_to snippet.name, edit_admin_snippet_url(snippet)
25: - tbody.status_cell do
26: %td.status{:class => "#{snippet.status.name.downcase}-status"}
27: = snippet.status.name
28: - if snippet.status_id >= Status[:published].id && snippet.current.status_id < Status[:published].id
29: %span.status{:class => "#{snippet.current.status.name.downcase}-status"}
RAILS_ROOT: /Users/berto/Places/nutricate/smartreceipt.com/radiant

The following extensions are installed; are there, by chance, incompatibilities with one of these:

  • chronicle
  • file_system
  • paperclipped
  • copy_move
  • mailer
  • settings
  • string_manip (personal string manipulation extension; simply adds a couple of tags)

Also, I skipped the last migration that limits the version column to 64kb; not sure if that would cause the problem.

Any ideas?

Thanks.

@jgarber
Copy link
Owner

jgarber commented Mar 10, 2010

Probably it's just a byproduct of that failed PostgreSQL migration. Snippets don't have status in Radiant core; chronicle adds that, so if the migration failed, it would make sense that snippet.status would be nil.

@rca
Copy link
Author

rca commented Mar 10, 2010

But, this is the failed migration; that column exists, but from what I can see is not limited in size:

class AdjustYamlColumnType < ActiveRecord::Migration
def self.up
change_column :versions, :yaml, :text, :limit => 64.kilobytes + 1
end

def self.down
change_column :versions, :yaml, :text
end
end

@rca
Copy link
Author

rca commented Mar 21, 2010

The problem is that the extension was installed after there were snippets in the database. When chronicle created a status_id column in the snippets table, it left the status_id NULL. This is what caused the backtrace.

To fix the problem I updated all Snippets to have a status_id of 100, which is published. Now things are working as expected.

@jgarber
Copy link
Owner

jgarber commented Mar 22, 2010

Great sleuthing! I'll look at fixing it sometime.

@rca
Copy link
Author

rca commented Mar 23, 2010

Same problem with layouts; status_id needs to be set to 100 for all existing layouts.

@jcasimir
Copy link

Just wanted to +1 this -- suggested fix via console worked great.

It should be easily fixed by adding ":default => 100" to the migration that adds the status field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants