How to Generate Views for Devise in HAML - ruby-on-rails-3

This is mine Gemfile
gem 'haml'
group :development do
gem 'hpricot'
gem 'ruby_parser'
end
I then executed the following statements in a terminal/command window:
bundle install
rails generate devise:views users -e haml
or
rails generate devise:views users -t = haml
But creating devise views in erb. how to fix this issue?

Even simpler solution.
I have erb2haml installed in the development section of my Gemfile, so I just run:
rails generate devise:views
rake haml:erb2haml
# or
rake haml:replace_erbs # outdated
Done!

I have to do this
rails generate devise:views
gem "html2haml"
bundle install
for file in app/views/devise/**/*.erb; do html2haml -e $file ${file%erb}haml && rm $file; done
and now it is perfect.
Also see the devise wiki

Have a quick look here. It gives in details explanation itself from devise documentation
How-To:-Create-Haml-and-Slim-Views

seems that the option to indicate which template engine to use is missing (version 3.0.0). An issue has been open for this. https://github.com/plataformatec/devise/issues/2455

its simply erb to haml conversion case. you may use any sort of haml converter. Like this one
http://htmltohaml.com/

Related

Devise Installation Not Working

I am trying to install the devise gem but when i use the command
rails g devise:install
i get the error message :
Could not find generator 'devise:install'. Maybe you meant 'responders:install', 'simple_form:install' or 'scss:assets'
Run rails generate --help for more options.
can anyone assist me in rectifying this issue?
Try to to solve this by deleting my Gemfile.lock, doing bundle install again and then stopping spring with spring stop I could then call the generator without root privileges
OR
Try command:
sudo rails generate devise:install
This is mostly a typo if you copied it from the github repo.
I had a similar issue.
Make sure you added the gem in the gemfile as gem 'devise'
Run in your project directory: rails generate devise:install

Bundler::GemRequireError when adding gem

When I make a new Rails project, add gem 'reactive-record', and run rails server, I get a Bundler error: There was an error while trying to load the gem 'reactive-record'. (Bundler::GemRequireError).
What gives? I have Rails 4.2.5 and Ruby 2.1.2.
Cheers!
The latest version of the generator should work very well with the help of Mitch. We collaborated together to make a generator in order to simplify greatly the installation of react.rb and reactive-record.
You should be able to get up and running by adding to your gem file :
gem 'reactive_rails_generator'
Then do a bundle install
and finally :
rails g reactrb:install --all
bundle update
Will install you reactrb, reactive-record and reactive-router.
Once installed, you can create components by doing :
rails g reactrb:component Home::Show
I worked around the problem like this:
Set rvm to use Ruby 2.2.2 and Rails 4.2.4.
Download https://codeload.github.com/catprintlabs/reactive-record/zip/master
Edited reactive-record-master/Gemfile to read:
gem 'reactive-ruby'
gem 'opal'
gem 'opal-browser'
gem 'react-rails'
cd reactive-record-master/spec/test_app
bundle install
rails server
This seemed to work.
Then, I made a new Rails 4.2.4 project. Adding only gem 'reactive-record' to the Gemfile resulted in the same error. Then I made the Gemfile read:
gem 'reactive-ruby'
gem 'opal'
gem 'opal-browser'
gem 'react-rails'
gem 'reactive-record'
And voila, rails server works!
Hope this helps someone else.

Seedbank, nothing happens when doing rake db:seed anymore

I just installed seedbank gem : https://github.com/james2m/seedbank which is exactly what I was looking for! (I'm actually surprised this kind of feature is not in the core Rails, but anyway, thanks james2m)
My problem is, nothing happens when doing rake db:seed -v. Not even the former seeds.rb generation.
I guess this is the best place to report the issue.
I don't really know what information will be useful to help me, so here I go, without order:
1- Content of /db:
/db
| candidate.seeds.rb
| item.seeds.rb
| seeds.rb
| user.seeds.rb
2- Gem file extract
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem "seedbank", "~> 0.2.1"
and I've run bundle install with no error.
3- Version numbers
$ rails -v
Rails 3.2.13
$ rake -V
rake, version 10.0.4
Thanks in advance for any help.
Not sure if you sorted this out or not but I think your directory structure was/is incorrect
/db/seeds.rb (runs on all environments)
/db/seeds/candidate.seeds.rb
/db/seeds/item.seeds.rb
/db/seeds/user.seeds.rb
These will run for all environments. If you only want development then do this structure instead
/db/seeds.rb (runs on all environments)
/db/seeds/development/candidate.seeds.rb
/db/seeds/development/item.seeds.rb
/db/seeds/development/user.seeds.rb

How to create a Rails 3.2.* app?

Hurray! Rails 4 is here...
Now, how do I create a 3.2.13 app since
rails new my app
installs rails '4.0.0.rc1'
Also, I already have rails gem 3.2.13 installed
you should do:
gem install 'rails' -v '3.2.13'
You should use a clean gemset, if you are using rvm, you can try:
rvm gemset create <name>
rvm gemset use <name>
Now you have a clean gemset, it's time to install rails,
gem install rails -v '3.2.13'
and then create a rails app,
rails new app_name
rails _3.2.13_ new app
(I'm using rbenv)
You can call specific gem (applies to any gem as far as I know) with following syntax:
rails _3.2.13_ -v
After this, it’s matter of using bundle exec rails instead of just rails, inside the application.

Installation of Cucumber in Rails 3 without helper files

I'm quite new to ruby and ruby on rails and I'm trying to add Cucumber to my new rails 3 application.
My Gemfile contains this section:
group :test, :development do
gem 'rspec-rails', '~>2.5'
end
group :test do
# Pretty printed test output
gem 'cucumber-rails'
gem 'capybara'
gem 'database_cleaner'
end
To install Cucumber first I've run:
bundle install --binstubs
and after all my gems are installed I've run:
rails generate cucumber:install --rspec --capybara
My problem is that during installation of cucumber those changes are made:
create config/cucumber.yml
create script/cucumber
chmod script/cucumber
create features/step_definitions
create features/support
create features/support/env.rb
exist lib/tasks
create lib/tasks/cucumber.rake
gsub config/database.yml
gsub config/database.yml
force config/database.yml
but as I understand more files should be created (some helpers file) - like this:
create config/cucumber.yml
create script/cucumber
chmod script/cucumber
create features/step_definitions
create features/step_definitions/web_steps.rb
create features/support
create features/support/paths.rb
create features/support/selectors.rb
create features/support/env.rb
exist lib/tasks
create lib/tasks/cucumber.rake
gsub config/database.yml
gsub config/database.yml
force config/database.yml
Could somebody tell me what am I doing wrong?
Thanks in advance!
After some searching in the internet I'm able to answer to this question by myself ;)
It turned out that everything is ok with this Cucumber installation. Currently there is a change in 'cucumber-rails' gem and web_steps.rb (and others) file isn't generated anymore. About the reason you can read here: 'The training wheels came off'
The problem has occurred because I learn Ruby on Rails from "Rails 3 in Action" book in which old behavior of 'cucumber-rails' gem is described.