Closed mfittko closed 11 years ago
Hey Manuel
The slug is not an attribute in the database. It's just a method in the Page model that uses the urlname attribute.
https://github.com/magiclabs/alchemy_cms/blob/2.6-stable/app/models/alchemy/page/naming.rb#L50
Are you sure that you are using the 2.6-stable branch? Or did you overwrite the page model?
What is the error message you get?
Cheers Robin
Von unterwegs gesendet
Am 27.06.2013 um 01:49 schrieb "Manuel Fittko" notifications@github.com:
Maybe it's a actually not a bug, but in my checkout of the 2.6-stable branch, there is no slug attribute for the Page model, but there are several places, where a "slug" attribute is referenced, such as... /lib/gems/alchemy_cms/app/views/alchemy/admin/pages/configure.html.erb#39 and /lib/gems/alchemy_cms/app/views/alchemy/navigation/_renderer.html.erb#12
I changed these references in my checkout back to "urlname" as a workaround.
— Reply to this email directly or view it on GitHub.
Did you ran the migrations?
I guess you upgraded from 2.5
Please run:
rake alchemy:upgrade
To run the upgrade process from 2.5
Thanks for the quick response but I ran the upgrade task and I am sure to be on the 2.6-stable branch. I also do not understand why it could be a database issue at all. Here is some console output for you...
Manuels-MacBook-Pro:alchemy_cms mfittko$ pwd
/Users/mfittko/Documents/work/fittko.com/mfittko/mischpoke/lib/gems/alchemy_cms
/Users/mfittko/Documents/work/fittko.com/mfittko/mischpoke/lib/gems/alchemy_cms
Manuels-MacBook-Pro:alchemy_cms mfittko$ git branch
2.5-stable
* 2.6-stable
master
Manuels-MacBook-Pro:alchemy_cms mfittko$ cat app/models/alchemy/page/naming.rb | grep "def slug"
def slug
Manuels-MacBook-Pro:mischpoke mfittko$ rails console
Loading development environment (Rails 3.2.13)
1.9.3-p286 :001 > Alchemy::Page.new(urlname:"test").slug
NoMethodError: undefined method `slug' for #<Alchemy::Page:0x007f8117c94ee8>
from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/activemodel-3.2.13/lib/active_model/attribute_methods.rb:407:in `method_missing'
from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/activerecord-3.2.13/lib/active_record/attribute_methods.rb:149:in `method_missing'
from (irb):1
from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
1.9.3-p286 :002 > exit
Manuels-MacBook-Pro:mischpoke mfittko$ cat Gemfile | grep "alchemy"
gem 'alchemy_cms', github: 'magiclabs/alchemy_cms', branch: '2.6-stable' #, path: "lib/gems/alchemy_cms"
Manuels-MacBook-Pro:mischpoke mfittko$ bundle list | grep "alchemy"
* alchemy_cms (2.6.2.1 baa86bf)
Okay you have checked out the 2.6-stable branch of your alchemy repo, but what version does your app use?
For me it seems you app does not load the correct alchemy version.
Could you please show your Gemfile/Gemfile.lock?
If I start a rails console in a app that requires alchemy_cms v2.6-stable, I am able to do what fails for you:
Alchemy.version => "2.6.2.1"
Alchemy::Page.new(urlname: 'test123').slug => "test123"
Thanks :)
Am 27.06.2013 um 13:07 schrieb Manuel Fittko notifications@github.com:
Thanks for the quick response but I ran the upgrade task and I am sure to be on the 2.6-stable branch. I also do not understand why it could be a database issue at all. Here is some console output for you...
Manuels-MacBook-Pro:alchemy_cms mfittko$ pwd /Users/mfittko/Documents/work/fittko.com/mfittko/mischpoke/lib/gems/alchemy_cms /Users/mfittko/Documents/work/fittko.com/mfittko/mischpoke/lib/gems/alchemy_cms Manuels-MacBook-Pro:alchemy_cms mfittko$ git branch 2.5-stable
- 2.6-stable master Manuels-MacBook-Pro:alchemy_cms mfittko$ cat app/models/alchemy/page/naming.rb | grep "def slug" def slug Manuels-MacBook-Pro:mischpoke mfittko$ rails console Loading development environment (Rails 3.2.13) 1.9.3-p286 :001 > Alchemy::Page.new(urlname:"test").slug NoMethodError: undefined method
slug' for #<Alchemy::Page:0x007f8117c94ee8> from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/activemodel-3.2.13/lib/active_model/attribute_methods.rb:407:in
method_missing' from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/activerecord-3.2.13/lib/active_record/attribute_methods.rb:149:inmethod_missing' from (irb):1 from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in
start' from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/railties-3.2.13/lib/rails/commands/console.rb:8:instart' from /Users/mfittko/.rvm/gems/ruby-1.9.3-p286@mischpoke/gems/railties-3.2.13/lib/rails/commands.rb:41:in
<top (required)>' from script/rails:6:inrequire' from script/rails:6:in
' 1.9.3-p286 :002 > exit — Reply to this email directly or view it on GitHub.
that's weird, I definitely have the same version running...
Manuels-MacBook-Pro:mischpoke mfittko$ rails console
Loading development environment (Rails 3.2.13)
1.9.3-p286 :001 > Alchemy.version
=> "2.6.2.1"
1.9.3-p286 :002 > Alchemy::Page.new(urlname: 'test123').slug
NoMethodError: undefined method `slug' for #<Alchemy::Page:0x007f95382e4828>
...
Manuels-MacBook-Pro:mischpoke mfittko$ cat Gemfile.lock | grep "alchemy"
remote: git://github.com/magiclabs/alchemy_cms.git
alchemy_cms (2.6.2.1)
alchemy_cms!
Aaah sorry, damn! Closed. I forgot that I had overridden the Page model some versions ago :D my fault! I knew it was a dumb error of mine but thanks anyway!
Maybe it's a actually not a bug, but in my checkout of the 2.6-stable branch, there is no slug attribute for the Page model, but there are several places, where a "slug" attribute is referenced, such as... /lib/gems/alchemy_cms/app/views/alchemy/admin/pages/configure.html.erb#39 and /lib/gems/alchemy_cms/app/views/alchemy/navigation/_renderer.html.erb#12
I changed these references in my checkout back to "urlname" as a workaround.