Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- run 'rm public/index.html'
- gem 'paperclip'
- generate :scaffold, 'user first_name:string last_name:string email:string login:string password:string'
- generate :paperclip, 'user avatar'
- route %[map.root :controller => 'users']
- rake 'db:migrate'
- run %[echo "class User < ActiveRecord::Base
- has_attached_file :avatar, :styles => {:thumb => '100x100'}, :url => '/avatars/:id/:style'
- validates_presence_of :first_name, :last_name, :email, :login, :password
- end" > app/models/user.rb]
- run %[echo "<h1>Editing user</h1>
- <%= render 'form' %>
- <%= link_to 'Show', @user %> |
- <%= link_to 'Back', users_path %>
- " > app/views/users/edit.html.erb]
- run %[echo "<h1>New user</h1>
- <%= render 'form' %>
- <%= link_to 'Back', users_path %>
- " > app/views/users/new.html.erb]
- run %[echo "<% form_for @user, :html => { :multipart => true } do |f| %>
- <%= f.error_messages %>
- <p>
- <%= f.label :avatar %><br />
- <%= image_tag @user.avatar.url(:thumb) %><br />
- <%= f.file_field :avatar %>
- </p>
- <p>
- <%= f.label :first_name %><br />
- <%= f.text_field :first_name %>
- </p>
- <p>
- <%= f.label :last_name %><br />
- <%= f.text_field :last_name %>
- </p>
- <p>
- <%= f.label :email %><br />
- <%= f.text_field :email %>
- </p>
- <p>
- <%= f.label :login %><br />
- <%= f.text_field :login %>
- </p>
- <p>
- <%= f.label :password %><br />
- <%= f.text_field :password %>
- </p>
- <p>
- <%= f.submit 'Save' %>
- </p>
- <% end %>
- " > app/views/users/_form.html.erb]
- run %[echo "<p>
- <b>Avatar:</b>
- <%= image_tag @user.avatar.url(:thumb) %>
- </p>
- <p>
- <b>First name:</b>
- <%=h @user.first_name %>
- </p>
- <p>
- <b>Last name:</b>
- <%=h @user.last_name %>
- </p>
- <p>
- <b>Email:</b>
- <%=h @user.email %>
- </p>
- <p>
- <b>Login:</b>
- <%=h @user.login %>
- </p>
- <p>
- <b>Password:</b>
- <%=h @user.password %>
- </p>
- <%= link_to 'Edit', edit_user_path(@user) %> |
- <%= link_to 'Back', users_path %>" > app/views/users/show.html.erb]
- run %[echo "class ApplicationController < ActionController::Base
- helper :all
- end" > app/controllers/application_controller.rb]
Add Comment
Please, Sign In to add comment