Coder Social home page Coder Social logo

padrinobook / padrinobook Goto Github PK

View Code? Open in Web Editor NEW
150.0 13.0 23.0 4.33 MB

The Guide To Master The Elegant Ruby Web Framework. A practical approach to learn crafting web applications in Padrino. Written by @wikimatze

Home Page: https://padrinobook.com/

Ruby 0.12% TeX 8.74% CSS 2.58% HTML 88.56%
padrino ruby padrinobook

padrinobook's Introduction

PadrinoBook - The Guide To Master The Elegant Ruby Web Framework

This book describes how I developed an application in Padrino. Feel free to fork this project and to correct my grammar. You can find the official page of the book under padrinobook.

Current version

You can find the current preview version under softcover.io.

Repository of the Job Vacancy Application

In this book I'm developing the job vacancy application. You can checkout the sources if you want to see the final result from this book.

Contribute/Contact

Feature requests, bugs, questions, etc. can be sent to [email protected]. You can even fork this project, and create pull requests as you like. I will then add you to the contributor list.

If you like my work, you can let me know how much money you would spend for this book. And don't worry, this book will be free at anytime.

License

This software is licensed under the MIT license.

© Matthias Günther [email protected].

padrinobook's People

Contributors

cpursley avatar emachnic avatar lpmi-13 avatar lucapette avatar manuelkiessling avatar nicopaez avatar ortuna avatar renich avatar rocknrollmarc avatar rosstimson avatar rousisk avatar schappim avatar waydotnet avatar wikimatze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

padrinobook's Issues

Motivation paragraph

First of all thank you very much for starting this project and for opening it up for people to read early versions and contribute. I was hugely disappointed when Peepcode decided not to go ahead with a Padrino screencast (even though it was all time most voted idea), hopefully this book can help fill the void in Padrino documentation.

I'm going to post up a whole bunch of issues / suggestions, please see them as encouragement rather than complaints as I am very excited to see this book come to fruition.


First off, the Motivation paragraph in the Introduction doesn't really say much about your motivation. In my fork I've have removed some of this as second sentence doesn't really make sense. However much of this seems to be further explaining what Padrino is rather than why you are writing - Why do you like Padrino? Is there a lack of docs at the moment?

Why instance variables in controllers?

Any instance variables (variables named with the @
character) will be available in the corresponding view file. So I have to add this piece of information.

Transform info boxes into softcover format

Example:

I> ## What are VALUES (?, ?, ?, ?, ?) in a SQL insert query?
I>
I> These form of inserting data in your database is known as parameterized queries. A parameterized query is a query
I> in which placeholders are used for parameters and the
I> parameter values are supplied at execution time. The most important reason to use parameterized queries is to avoid
I> [SQL injection](http://en.wikipedia.org/wiki/SQL_injection) attacks. SQL injection means that SQL statements are
I> injected into input fields in order to drop tables or getting access on user related data.

Explain the seven actions of a controller

onsider all the possibilities for managing a list. It’s a list of anything: users, inventory,
thingamajigs. We use a web application to manage the list, so we’ll fill out a form to record
each item in our list.
The web application offers seven features to help us manage our records:
• index – display a list of all items
• show – display a record of one item
• new – display an empty form
• create – save a record of a new item
• edit – display a record for editing
• update – save an edited record
• destroy – delete a record

Don't confuse / complicate by talking about OS, editors etc.

I subscribe to Zed Shaw's theory in his Learn X the Hard Way book where he tells any budding authors not to talk too much about operating systems, version control systems or text editors.

There are large sections of the intro dedicated to these, the reader is here to learn Padrino not to hear about all of this extra stuff which is confusing to n00bs and just extra fluff to wade through for more competent geeks. I suggest much of this stuff is removed and to tell the user to simply use whatever machine they have in front of them and a plain text editor.

Recommend a plain text editor which is easy to use, freely available and compatible on all major OSs, Zed Shaw in his Learn X The Hard Way series of books uses Gedit and this seems a reasonable choice IMO. If the reader is already using Vim or Emacs or some other editor then he probably knows what he's doing anyway.

With VCSs, it might be good to VERY briefly mention them and why they are useful plus maybe some links for further learning but I don't think the reader should be forced to install / learn another tool alongside Padrino. Again, if the reader is already a coder then they will be using their preferred VCS anyway.

Hello World assumes Bundler gem is installed.

After generating the Padrino project you tell the reader to use bundler install, if the reader is a n00b then they probably won't have Bundler installed.

Earlier sections explain about OSs, text editors, VCSs etc as if you anticipate that beginners may be reading but then it's assumed that this gem is installed.

Hard coded carriage returns

Not sure of the best solution here but you seem to be hard coding in carriage returns to keep line length short. This makes it a huge PITA to edit / contribute.

How do I get Ruby?

You mention almost every tool from the OS to the text editor and Git etc but you don't actually mention how to get Ruby or how to check if you already have it.

Add table of other generator options

In chapter 2 after detailing what the generator options that are being used do it might be useful to include a table of all other generator options.

Upload pdf to github

After an hour of trying to install and download all the necessary software to run rake pdf, i gave up

Mass-Assignment Vulnerabilities

Rails protects us from a class of security exploits called “mass-assignment vulnerabilities.”
Rails won’t let us initialize a model with just any parameters submitted on a form. Suppose
we were creating a new user and one of the user attributes was a flag allowing administrator
access. A malicious hacker could create a fake form that provides a user name and sets the
administrator status to “true.” Rails forces us to “white list” each of the parameters used to
initialize the model.
We create a method named secure_params to screen the parameters sent from the browser.
The params hash contains two useful methods we use for our screening:
• require(:contact)
– makes sure that
• permit(:name, :email, :content)
params[:contact]
is present
– our “white list”
With this code, we make sure that params[:contact] only contains :name, :email, :content . If
other parameters are present, they are stripped out. Rails will raise an error if a controller
attempts to pass params to a model method without explicitly permitting attributes via
permit .
In older versions of Rails (before Rails 4.0), the mass-assignment exploit was blocked by
using a “white list” of acceptable parameters with the attr_accessible keyword in a model.
You’ll see this code in examples and tutorials that were written before Rails 4.0 introduced
“strong parameters” in the controller.

And the link http://tails4.rssing.com/chan-3895784/latest.php how to do it in Padrino

translations

Are you interested in geting the book translated?
I would be willing to do a french translation.

If so, would you consider transiflex as a platform to do so?
It is not perfect, but I use it for a few project and it is better than the other tool i used so far.

Migrations on production environment

Hey @matthias-guenther, the book looks very promising, thanks for putting it up together! :)

I have a suggestion on this bit: TBD: Find a way to run ar:migrate for all environments (mainly production and test). What about leaving that responsibility to a deployment section in which tools like Mina or Capistrano are introduced? I can write a guide on how to set up, understand and deploy with Mina.

Cheers!

Use flash.now instead of flash

flash.now does not persist through redirects or links. If
you use the simple flash directive before a render directive, the message will appear on the
rendered page and reappear on a subsequent page after the user clicks a link.

Update CSS to Bootstrap 3

Update CSS to Bootstrap 3 (as it has changed since 2.3). For now, I used a CDN for the Bootstrap 2.3 assets instead of the Padrino plugin.

Explain the sprockets files

A Manifest File
It’s not obvious from the name of the app/assets/stylesheets/application.css.scss file that it
serves as a manifest file as well as a location for miscellaneous CSS rules. For most websites,163
you can ignore its role as a manifest file. In the comments at the top of the file, the
*= require_self directive indicates that any CSS in the file should be delivered to the
browser. The *= require_tree . directive (note the Unix “dot operator”) indicates any files in
the same folder, including files in subfolders, should be combined into a single file for
delivery to the browser.
If your website is large and complex, you can remove the *= require_tree . directive and
specify individual files to be included in the file that is generated by the asset pipeline. This
gives you the option of reducing the size of the application-wide CSS file that is delivered to
the browser. For example, you might segregate a file that includes CSS that is used only in
the site’s administrative section. In general, only large and complex sites need this
optimization. The speed of rendering a single large CSS file is faster than fetching multiple
files

Adjust homepage of this Repo

The homepage of this repo is still the leanpub website. In your email newsletter you told us that you replaced that with SoftCover 😉 You should probably adjust the link here!

Why mention Fugitive

You tell the reader to choose which editor works for them but then recommend Fugitive which is Vim specific when talking about additional tools. This might make readers think they have chosen the wrong editor or just frustrate them. If you are including this then why not mention plugins for other editors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.