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

0.10.3 admin generator (sinatra-flash) #690

Closed
EtienneLem opened this Issue Oct 5, 2011 · 12 comments

Comments

Projects
None yet
3 participants
@EtienneLem

EtienneLem commented Oct 5, 2011

So Padrino is now using sinatra-flash instead of rack-flash (#679) and requires the the flash contrib, if I understand correctly (?).

My colleague being newly converted to Padrino had quite a hard time trying to figure out why he couldn't even access his freshly generated admin login page. The flash_tag helper can't find the local flash variable. Once the flash helper contrib is registered, it works like a charm.

I don't mind having to register it all by myself without any clues when building my own app, but I feel like it should be somewhat more explicit or already packaged within the generated admin because once generated you won't be able to start padrino unless you add the gem, require, register and bundle install. One would expect the admin dependencies already included. I must admit that including the flash contrib was kind a guess.

Any thoughts / comments gentlemen? :)

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 5, 2011

Member

Ok, so you actually shouldn't need the contrib flash. sinatra-flash alone should provide all the necessary flash helpers. It's more of a choice between the contrib flash and/or sinatra-flash with sinatra-flash being the default.

I completely agree that the admin should work without having to manually register anything. Are you saying that you can't get flash to work without registering the contrib?

Member

nesquena commented Oct 5, 2011

Ok, so you actually shouldn't need the contrib flash. sinatra-flash alone should provide all the necessary flash helpers. It's more of a choice between the contrib flash and/or sinatra-flash with sinatra-flash being the default.

I completely agree that the admin should work without having to manually register anything. Are you saying that you can't get flash to work without registering the contrib?

@EtienneLem

This comment has been minimized.

Show comment
Hide comment
@EtienneLem

EtienneLem Oct 5, 2011

Oh, I came to that conclusion because yes I did have to register the contrib to make the flash (thus the admin) work.

EtienneLem commented Oct 5, 2011

Oh, I came to that conclusion because yes I did have to register the contrib to make the flash (thus the admin) work.

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 5, 2011

Member

Ok investigating now, thanks. That definitely shouldn't be the case.

Member

nesquena commented Oct 5, 2011

Ok investigating now, thanks. That definitely shouldn't be the case.

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 5, 2011

Member

@EtienneLem Can you walk me through the steps? Here is what I just did on Padrino 0.10.3, from scratch just following the basic steps:

padrino-gen project demo -d activerecord
cd ./demo
bundle install
padrino-gen admin
bundle install
padrino rake ar:migrate
padrino rake seed
pstart -p 3001

Booted up and saw the admin page as expected without any issue with flash. Can you help me reproduce this problem so we can fix it?

Member

nesquena commented Oct 5, 2011

@EtienneLem Can you walk me through the steps? Here is what I just did on Padrino 0.10.3, from scratch just following the basic steps:

padrino-gen project demo -d activerecord
cd ./demo
bundle install
padrino-gen admin
bundle install
padrino rake ar:migrate
padrino rake seed
pstart -p 3001

Booted up and saw the admin page as expected without any issue with flash. Can you help me reproduce this problem so we can fix it?

@EtienneLem

This comment has been minimized.

Show comment
Hide comment
@EtienneLem

EtienneLem Oct 5, 2011

I just did the exact same thing and I still get

DEBUG - Account Load (0.1ms)  SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" IS NULL LIMIT 1
NameError - undefined local variable or method `flash' for #<Admin:0x103c1ba48>:
    /Users/elemay/.rvm/gems/ruby-1.8.7-p334@padrino-0.10.3/gems/padrino-helpers-0.10.3/lib/padrino-helpers/asset_tag_helpers.rb:20:in `flash_tag'

The only thing that may differ from you is that I installed everything into a gemset via rvm so I don't mess up projects on 0.10.2, but I don't see how that could be relevant.

rvm gemset create padrino-0.10.3
rvm gemset use padrino-0.10.3
gem install padrino
[everything you did]

Experienced the same result on 2 different computers.

EtienneLem commented Oct 5, 2011

I just did the exact same thing and I still get

DEBUG - Account Load (0.1ms)  SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" IS NULL LIMIT 1
NameError - undefined local variable or method `flash' for #<Admin:0x103c1ba48>:
    /Users/elemay/.rvm/gems/ruby-1.8.7-p334@padrino-0.10.3/gems/padrino-helpers-0.10.3/lib/padrino-helpers/asset_tag_helpers.rb:20:in `flash_tag'

The only thing that may differ from you is that I installed everything into a gemset via rvm so I don't mess up projects on 0.10.2, but I don't see how that could be relevant.

rvm gemset create padrino-0.10.3
rvm gemset use padrino-0.10.3
gem install padrino
[everything you did]

Experienced the same result on 2 different computers.

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 5, 2011

Member

I used a clean gemset too although on 1.9.2. Can you go into the admin project and ensure that enable :sessions is explicit in the app.rb for it? I would like to try and track this down.

Member

nesquena commented Oct 5, 2011

I used a clean gemset too although on 1.9.2. Can you go into the admin project and ensure that enable :sessions is explicit in the app.rb for it? I would like to try and track this down.

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 5, 2011

Member

If enable :sessions in app.rb isn't enough, Try enable :flash explicitly. If that doesn't work, try a register Sinatra::Flash explicitly (in the admin app). Make sure to restart the app server between each attempt and let me know which one works.

Member

nesquena commented Oct 5, 2011

If enable :sessions in app.rb isn't enough, Try enable :flash explicitly. If that doesn't work, try a register Sinatra::Flash explicitly (in the admin app). Make sure to restart the app server between each attempt and let me know which one works.

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 5, 2011

Member

Also, one more thing to try is to revert to the case that should be working and then see if a gem install bundler --pre into the gemset affects the proper loading of sinatra_flash. An alternate way to test is to go into the Gemfile and change the sinatra-flash line to:

gem "sinatra-flash", :require => "sinatra/flash"

and restart and see if it is then properly loaded. I suspect this is it (either the explicit require or latest bundler pre).

Member

nesquena commented Oct 5, 2011

Also, one more thing to try is to revert to the case that should be working and then see if a gem install bundler --pre into the gemset affects the proper loading of sinatra_flash. An alternate way to test is to go into the Gemfile and change the sinatra-flash line to:

gem "sinatra-flash", :require => "sinatra/flash"

and restart and see if it is then properly loaded. I suspect this is it (either the explicit require or latest bundler pre).

@EtienneLem

This comment has been minimized.

Show comment
Hide comment
@EtienneLem

EtienneLem Oct 5, 2011

There we go!

I edited that Gemfile line. This alone fixed it!

EtienneLem commented Oct 5, 2011

There we go!

I edited that Gemfile line. This alone fixed it!

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 5, 2011

Member

Yeah, looks like I was fooled by having the pre bundler version installed on all my machines. Got fooled into thinking that I didn't need the explicit require since the new bundler was smart enough to require without it. @DAddYE why didn't integration tests fail in that case? I recall they test admin?

Member

nesquena commented Oct 5, 2011

Yeah, looks like I was fooled by having the pre bundler version installed on all my machines. Got fooled into thinking that I didn't need the explicit require since the new bundler was smart enough to require without it. @DAddYE why didn't integration tests fail in that case? I recall they test admin?

@nrichards

This comment has been minimized.

Show comment
Hide comment
@nrichards

nrichards Oct 6, 2011

Thank you both for reporting and identifying a fix for this issue. Was stumped on this while running through the Blog tutorial, no longer.

nrichards commented Oct 6, 2011

Thank you both for reporting and identifying a fix for this issue. Was stumped on this while running through the Blog tutorial, no longer.

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Oct 6, 2011

Member

Fixed for 0.10.4 and added to the blog tutorial: http://www.padrinorb.com/guides/blog-tutorial#admin-dashboard-setup

Member

nesquena commented Oct 6, 2011

Fixed for 0.10.4 and added to the blog tutorial: http://www.padrinorb.com/guides/blog-tutorial#admin-dashboard-setup

@nesquena nesquena closed this Oct 6, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment