CultivateLabs/storytime

troubleshooting installation of storytime with existing rails app

Closed this issue · 10 comments

Hi,

I am trying to get storytime running inside an existing rails app that also uses high_voltage.

I can't get my rails server running and it throws the error:

in `detect_enum_conflict!': You tried to define an enum named "root_page_content" on the model "Storytime::Site", but this will generate a class method "page", which is already defined by Active Record. (ArgumentError)

Any tips on troubleshooting this?

Is there a way to override Storytime's use of the the 'page' route?

I'm sorta new to rails and engines, but I followed your directions to mount the storytime engine at "l"

Thanks, Mike

I think the high_voltage conflict is still an outstanding issue. As for the error you're getting with the enum, I don't know off-hand what is causing it, but I do know that in the next version that won't be a problem because we changed the way pages and blogs work. There will be a setting on the Storytime::Site model where you can select either a blog or a page as the homepage. If you are okay with it still being unreleased and possibly still having some bugs, you might want to consider using the multi-line branch and see if it solves some of your issues.  


Sent from Mailbox

On Tue, Mar 10, 2015 at 9:01 PM, mikesmayer notifications@github.com
wrote:

Hi,
I am trying to get storytime running inside an existing rails app that also uses high_voltage.
I can't get my rails server running and it throws the error:
in `detect_enum_conflict!': You tried to define an enum named "root_page_content" on the model "Storytime::Site", but this will generate a class method "page", which is already defined by Active Record. (ArgumentError)
Any tips on troubleshooting this?
Is there a way to override Storytime's use of the the 'page' route?
I'm sorta new to rails and engines, but I followed your directions to mount the storytime engine at "l"

Thanks, Mike

Reply to this email directly or view it on GitHub:
#103

Sorry, the multi-site branch. Aurocorrect. 


Sent from Mailbox

On Tue, Mar 10, 2015 at 9:01 PM, mikesmayer notifications@github.com
wrote:

Hi,
I am trying to get storytime running inside an existing rails app that also uses high_voltage.
I can't get my rails server running and it throws the error:
in `detect_enum_conflict!': You tried to define an enum named "root_page_content" on the model "Storytime::Site", but this will generate a class method "page", which is already defined by Active Record. (ArgumentError)
Any tips on troubleshooting this?
Is there a way to override Storytime's use of the the 'page' route?
I'm sorta new to rails and engines, but I followed your directions to mount the storytime engine at "l"

Thanks, Mike

Reply to this email directly or view it on GitHub:
#103

What if I don't want Storytime to serve the homepage for my Rails app, but rather use it for collateral pages (about, etc)? I should mount at "/blog"? Does it make sense for me?

In the new version, that wouldn't be a problem. You could just leave the site homepage blank. If you mount it at /blog your pages would be at /blog/slug. I don't think v1 would work for that use case


Sent from Mailbox

On Wed, Mar 11, 2015 at 7:21 PM, mikesmayer notifications@github.com
wrote:

What if I don't want Storytime to serve the homepage for my Rails app, but rather use it for collateral pages (about, etc)? I should mount at "/blog"? Does it make sense for me?

Reply to this email directly or view it on GitHub:
#103 (comment)

If you mount the engine at somewhere like /blog, I believe all pages are going to have that prefix (ie. about will be at /blog/about). This is just a rails engine thing and not something we have control over.

The easiest thing to do, IMO, would be to just use Storytime's built in support for overriding a page template. If you create a page in Storytime called "home" and then put a file in your host app at app/views/storytime/pages/home.html.erb, you can put whatever content/code you want in there and Storytime will render that file. You'll have access to the @page variable in that template, but you can just ignore it and not output the page content at all. This would end up operating a lot like a high voltage page. You'll also need to assign "home" as your homepage in the site settings.

Let me know if that makes sense or if I'm not explaining well. Thanks for checking out Storytime!

Hi can't seem to get going with Storytime because of this issue, any progress?

Thanks, looking forward to using the engine!

I tried using the multi-site branch but no joy.

@danieljohnmorris could you try setting up Storytime once more with what's currently on the master branch (Storytime v2.0.0.rc1)? We've made a few updates over the last few days that may fix things for you.

2.0 now supports the primary function of High Voltage. You can stick a template in your pages folder (e.g. app/views/storytime/site-name/pages/my_page.html.erb) and then visit /my_page and Storytime will render the template (with no need to have a page record for it in the db).

Given that, going to close this issue. If anyone runs into any issues with it, just let me know.

Seems like this issue is still exist.

When I run rake db:migrate it is stops on _create_storytime_snippets.storytime.rb:15:in `up' and I get this:

You tried to define an enum named "root_page_content" on the model "Storytime::Site", but this will generate a class method "page", which is already defined by Active Record /.rvm/gems/ruby-2.2.3@b/gems/activerecord-4.2.4/lib/active_record/enum.rb:172:in `detect_enum_conflict!'

I do have another class Page, but I don't see the reason for conflict.

Any ideas I how to fix it.