Skip to content

ShAlexanderGo/blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This README would normally document whatever steps are necessary to get the application up and running.

Things you may want to cover:

  • Ruby version

  • System dependencies

  • Configuration

  • Database creation

  • Database initialization

  • How to run the test suite

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions

Please feel free to use a different markup language if you do not plan to run rake doc:app.

make sign in on top to get routes: sudo rake routes

16 march rails g controller Sessions controller -> session_controller “”“ def new end def create

@email = params[:email]
@user = User.where("upper(email) = upper(?)", @email)
if @user && @user.authenticate(params[:password])
  session[:user_id] = @user.id
  redirect_to @user
else
  flash[:notice] = "Wrong name or password lol
  render new

end “”“ config->routes.rb ”“” 5 get ‘login’ => ‘session#new’, as: :login 6 post ‘login’ => ‘session#create’ “”“ cretate ‘views/sessions/new.html.haml’ ”“” .page-header

%h1 Вход
.form-group
  = label_tag :email, User.human_attribute_name(:email)
  = text_field_tag :email, @email, class: 'form-control'
.form-group
  = label_tag :password, User.human_attribute_name(:password)
  = text_field_tag :password, nil, class: 'form-control'
.actions
  = submit_tag 'enter', class: 'btn btn-primary'

“”“ create ‘views/application/_flash_messages.html.haml’ ”“”

  • if flash.present? .alert.alert-info= flash

“”“ In aplication html in container ”“”

“”“ routes ”“” get ‘logout’ => ‘session#destroy’, as: :logout ??? “”“ sessions_controlles ”“” def destroy

session.delete(:user_id)
redirect_to login_path

end “”“ application_controller ”“” 6 before_action :set_current_user 8 private 10 def set_current_user 11 @current_user = User.where(id: session).first “”“ _navbar.html.haml ”“” 7 %ul.nav.navbar-nav.navbar-right 8 - if @current_user 9 %li 10 %p.navbar-text= @current_user.login

  %li= link_to 'exit', logout_path
- else
  %li= link_to 'login', login_path

“”“ rails g kaminari:views bootstrap3


23 march


Gemfile “”“ gem ‘paperclip’ ”“” rails g scaffold Attachment image:attachment position:integer post:belong_to comment github.com/thoughtbot/paperclip - quickstart rails 4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors