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

undefined method `[]' for nil:NilClass error whith cms 2.2.1 and ecommerce 1.1 version. #428

Closed
mazharoddin opened this issue Jul 14, 2016 · 8 comments

Comments

@mazharoddin
Copy link
Contributor

mazharoddin commented Jul 14, 2016

Hi @owen2345 ,

I am getting "undefined method `[]' for nil:NilClass" error after upgrading camaleon_cms to 2.2.1 and ecommerce to 1.1 version.

undefined method `[]' for nil:NilClass
    if @site.save
      save_metas(@site)
      site_after_install(@site, params[:theme])
      flash[:notice] = "Your site was created successfully. You can check all features by logging into it."
      redirect_to action: :welcome, key: @site.slug
    else
app/controllers/registration_controller.rb:27:in `create'

I am not able to find out why this error is occurring, I am using custom theme as default theme, but still I am getting this error even I reverted back to default theme.

@mazharoddin
Copy link
Contributor Author

@owen2345 ,

I am getting this error if I use config/system.json file.
Here is error on first time installation of camaleon_cms along with system.json file.

undefined method `[]' for nil:NilClass
    @site = CamaleonCms::Site.new(params[:site].permit(:slug, :name )).decorate
    if @site.save
      site_after_install(@site, params[:theme])
      flash[:notice] = t('camaleon_cms.admin.sites.message.created')
      redirect_to action: :welcome
    else
/Users/mazharoddin/.rvm/gems/ruby-2.2.2@rails4.2.5/bundler/gems/camaleon-cms-09fdba458a51/app/helpers/camaleon_cms/plugins_helper.rb:40:in `plugin_install'
/Users/mazharoddin/.rvm/gems/ruby-2.2.2@rails4.2.5/bundler/gems/camaleon-cms-09fdba458a51/app/helpers/camaleon_cms/site_helper.rb:70:in `block in site_after_install'
/Users/mazharoddin/.rvm/gems/ruby-2.2.2@rails4.2.5/bundler/gems/camaleon-cms-09fdba458a51/app/helpers/camaleon_cms/site_helper.rb:70:in `each'
/Users/mazharoddin/.rvm/gems/ruby-2.2.2@rails4.2.5/bundler/gems/camaleon-cms-09fdba458a51/app/helpers/camaleon_cms/site_helper.rb:70:in `site_after_install'
/Users/mazharoddin/.rvm/gems/ruby-2.2.2@rails4.2.5/bundler/gems/camaleon-cms-09fdba458a51/app/controllers/camaleon_cms/admin/installers_controller.rb:25:in `save'

If I remove system.json file, I am able to create the site or subdomain.

@owen2345
Copy link
Owner

Please try using the git version, and confirm me if it works well to publish a new gem version.

@mazharoddin
Copy link
Contributor Author

No, with git version also same error.

    if @site.save
      save_metas(@site)
      site_after_install(@site, @site.get_theme_slug)
      flash[:notice] = t('camaleon_cms.admin.sites.message.created')
      redirect_to action: :index
    else


camaleon_cms (2.2.0) app/helpers/camaleon_cms/plugins_helper.rb:40:in `plugin_install'
camaleon_cms (2.2.0) app/helpers/camaleon_cms/site_helper.rb:70:in `block in site_after_install'
camaleon_cms (2.2.0) app/helpers/camaleon_cms/site_helper.rb:70:in `each'
camaleon_cms (2.2.0) app/helpers/camaleon_cms/site_helper.rb:70:in `site_after_install'
camaleon_cms (2.2.0) app/controllers/camaleon_cms/admin/settings/sites_controller.rb:56:in `create'

@qx
Copy link

qx commented Jul 17, 2016

+1,same error ,but not the same place

@owen2345
Copy link
Owner

I am sorry guys, I tried with this:

gem "camaleon_cms", github: 'owen2345/camaleon-cms'

and works well. please give more details to reproduce this error.
PD: These days I am working in compatibility for rails 5.
Regards,

@mazharoddin
Copy link
Contributor Author

Hi @owen2345,
I am able to recreate this issue with git versions, as I mentioned earlier, this issue can be reproduced by adding system.json file in config directory.
I updated below repository with latest Gemfile.
git@github.com:mazharoddin/camaleon_cms_debug.git

Its really nice to have camaleon_cms with rails5, but I feel it can be postponed for few more months so that rails5 is stable with other gems.
So instead of rails5 compatibility, I feel resolving all camaleon cms and ecommerce etc issues are more helpful.

@qx
Copy link

qx commented Jul 19, 2016

@mazharoddin +1 ,I think so too

@owen2345
Copy link
Owner

Solved, the problem is because you are using a non exist plugin name in your system.json
2016-07-23_0644

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