Sha256: c8e1762864406f8720f037fe770617fc23016f21bf26c5a543c1e388e75445d4

Contents?: true

Size: 1.12 KB

Versions: 58

Compression:

Stored size: 1.12 KB

Contents

# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/home_page_users.rb

after_bundler do

  say_wizard "HomePageUsers recipe running 'after bundler'"

  # Modify the home controller
  gsub_file 'app/controllers/home_controller.rb', /def index/ do
  <<-RUBY
def index
  @users = User.all
RUBY
  end

  # Replace the home page
  if recipes.include? 'haml'
    remove_file 'app/views/home/index.html.haml'
    # There is Haml code in this script. Changing the indentation is perilous between HAMLs.
    # We have to use single-quote-style-heredoc to avoid interpolation.
    create_file 'app/views/home/index.html.haml' do 
    <<-'HAML'
%h3 Home
- @users.each do |user|
  %p User: #{user.name}
HAML
    end
  else
    append_file 'app/views/home/index.html.erb' do <<-ERB
<h3>Home</h3>
<% @users.each do |user| %>
  <p>User: <%= user.name %></p>
<% end %>
ERB
    end
  end

end

__END__

name: HomePageUsers
description: "Display a list of users on the home page."
author: RailsApps

category: other
tags: [utilities, configuration]

Version data entries

58 entries across 58 versions & 2 rubygems

Version Path
rails_apps_composer-1.5.5 recipes/home_page_users.rb
rails_apps_composer-1.5.4 recipes/home_page_users.rb
rails_apps_composer-1.5.3 recipes/home_page_users.rb
rails_apps_composer-1.5.2 recipes/home_page_users.rb
rails_apps_composer-1.5.1 recipes/home_page_users.rb
thyone_creator-0.0.5 recipes/home_page_users.rb
thyone_creator-0.0.4 recipes/home_page_users.rb
thyone_creator-0.0.3 recipes/home_page_users.rb
thyone_creator-0.0.2 recipes/home_page_users.rb
rails_apps_composer-1.5.0 recipes/home_page_users.rb
rails_apps_composer-1.4.15 recipes/home_page_users.rb
rails_apps_composer-1.4.14 recipes/home_page_users.rb
rails_apps_composer-1.4.13 recipes/home_page_users.rb
rails_apps_composer-1.4.12 recipes/home_page_users.rb
rails_apps_composer-1.4.11 recipes/home_page_users.rb
rails_apps_composer-1.4.10 recipes/home_page_users.rb
rails_apps_composer-1.4.9 recipes/home_page_users.rb
rails_apps_composer-1.4.8 recipes/home_page_users.rb
rails_apps_composer-1.4.7 recipes/home_page_users.rb
rails_apps_composer-1.4.6 recipes/home_page_users.rb