Skip to content

Instantly share code, notes, and snippets.

@drogus
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drogus/9156090 to your computer and use it in GitHub Desktop.
Save drogus/9156090 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>My Little Webapp: Coding Is Magic</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://rawgithub.com/krzysztofbialek/Rails-Girls-Warsaw-App/master/style.css" />
</head>
<body>
</body>
</html>
<h1>My Rails Girls Diary</h1>
<div>
<h2>Submitted a Rails Girls application</h2>
<p>1.02.2014</p>
<p>Just submitted an application to a Rails Girls workshop. Can’t wait to see whether I’ll get in!</p>
<h2>Got in!</h2>
<p>15.02.2014</p>
<p>Received an email that my application got accepted! I’ll be at a RG workshop next week!</p>
<h2>The first day starts…</h2>
<p>22.02.2014</p>
<p>Today is the first day of the Rails Girls workshop. My coach is quite strange but it seems we all have Rails installed now and can start learning.</p>
</div>
<div>
<h1>My favourite websites</h1>
<ul>
<li><a href="http://railsgirls.com">Rails Girls</a></li>
<li><a href="https://en.wikibooks.org/wiki/Ruby_Programming">Wikibooks</a></li>
<li><a href="http://guides.rubyonrails.org">Ruby on Rails Guides</a></li>
</ul>
</div>
<img src="http://railsgirls.com/images/rg-warsaw.png" />
<%
@websites = [
["http://railsgirls.com", "Rails Girls"],
["https://en.wikibooks.org/wiki/Ruby_Programming", "Wikibooks"],
["http://guides.rubyonrails.org", "Ruby on Rails Guides"],
]
%>
<% for url, name in @websites %>
<li><a href="<%= url %>"><%= name %></a></li>
<% end %>
class WelcomeController < ApplicationController
def index
@websites = [
["http://railsgirls.com", "Rails Girls"],
["https://en.wikibooks.org/wiki/Ruby_Programming", "Wikibooks"],
["http://guides.rubyonrails.org", "Ruby on Rails Guides"],
]
end
end
Entry.create "title" => "Submitted a Rails Girls application", "date" => Date.new(2014, 2, 1), "contents" => "Just submitted an application to a Rails Girls workshop. Can’t wait to see whether I’ll get in!"
Entry.create "title" => "Got in!", "date" => Date.new(2014, 2, 15), "contents" => "Received an email that my application got accepted! I’ll be at a RG workshop next week!"
Entry.create "title" => "The first day starts…", "date" => Date.new(2014, 2, 22), "contents" => "Today is the first day of the Rails Girls workshop. My coach is quite strange but it seems we all have Rails installed now and can start learning."
@entries = Entry.all
<% @entries.each do |entry| %>
<h2><%= entry.title %></h2>
<p><%= entry.date %></p>
<p><%= entry.contents %></p>
<% end %>
def show
@entry = Entry.find(params["id"])
end
<h2><%= @entry.title %></h2>
<p><%= @entry.date %></p>
<p><%= @entry.contents %></p>
<h2><%= link_to(entry.title, entry_path(entry)) %></h2>
<p><%= link_to("Back to all entries", entries_path) %></p>
<%= link_to("New entry", new_entry_path) %>
<%= form_for(Entry.new) do |form| %>
<p><%= form.label("title") %></p>
<p><%= form.text_field("title") %></p>
<p><%= form.label("contents") %></p>
<p><%= form.text_area("contents") %></p>
<p><%= form.submit %></p>
<% end %>
<p><%= link_to("Back to all entries", entries_path) %></p>
def create
render(:text => params.inspect)
end
def create
entry_params = params["entry"].permit("title", "contents")
entry = Entry.create(entry_params)
redirect_to(entries_path)
end
entry_params = params["entry"].permit("title", "contents")
def show
@entry = Entry.find(params["id"])
end
<h2><%= @entry.title %></h2>
<p><%= @entry.date %></p>
<p><%= @entry.contents %></p>
<p><%= link_to("Edit this entry", edit_entry_path(@entry)) %></p>
def edit
@entry = Entry.find(params["id"])
end
<%= form_for(@entry) do |form| %>
<p><%= form.label("title") %></p>
<p><%= form.text_field("title") %></p>
<p><%= form.label("content") %></p>
<p><%= form.text_area("content") %></p>
<p><%= form.submit %></p>
<% end %>
<p><%= link_to("Back to this entry", entry_path(@entry)) %></p>
<p><%= link_to("Back to all entries", entries_path) %></p>
def update
entry_params = params["entry"].permit("title", "content")
entry = Entry.find(params["id"])
entry.update(entry_params)
redirect_to(entry_path(entry))
end
def destroy
@entry = Entry.find params['id']
@entry.destroy
redirect_to entries_path
end
@drogus
Copy link
Author

drogus commented Feb 23, 2014

26:

  def destroy
    @entry = Entry.find params['id']
    @entry.destroy
    redirect_to entries_path
  end

@drogus
Copy link
Author

drogus commented Feb 23, 2014

Wygenerowanie "rusztowania":

rails g scaffold movie title:string year:integer

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