GithubHelp home page GithubHelp logo

padrino-docs's People

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

Watchers

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

padrino-docs's Issues

Docs on caching are out of date

Do you want to request a feature or report a bug?

This is a documentation bug.

What is the current behavior?

Visiting the Padrino caching documentation I am told to specify the cache as follows:

Padrino.cache = Padrino::Cache::Store::Memory.new(50)

Following those instructions yields the following error:

NameError: uninitialized constant Padrino::Cache::Store

The above applies to the creation of all different types of store.

What is the expected behavior?

The documentation should tell me to create a cache following the new approach:

Padrino.cache = Padrino::Cache.new(:LRUHash)

The documentation in the padrino-cache module worked for me.

Which versions of Ruby, Padrino, Sinatra, Rack, OS are you using? Did this work in previous versions?

  • Ruby 2.3.1
  • Padrino 0.13.3.2

I've not tested it for other versions, as this is a new development for us.

Documentation enhancements

From @dariocravero on March 18, 2013 19:49

List of features to document

Components

  • Explain .components.
  • How to change ORM,
  • How to change renderer,
  • How to change styles processor,
  • How to change scripts,
  • How to change database adapter?

...

  • Document invoke_hooks (#1098)
  • Cleanup documentation for fields_for (#939)
  • Gemified apps (added to generation docs)
    • Detailed explanation on how to handle gemified apps
  • Performance tools guide
  • Project modules (re 0.11 release)
  • Document padrino-flash better. Particularly what the story is with now and next. Also, add some comments to the code from the original repo (https://github.com/Cirex/padrino-flash).
  • Explain Padrino.dependency_paths.
  • Document how to write rake tasks.
  • Document CSRF, how it relates to post requests, how to disable it (app-wide or controller-level)
  • Document (See #1475) how to access current request controller and action names
  • Document app gemming and starting and the need of special placement for log, tmp, configs

Testing

  • How to set the current account (or the session in general) while testing controllers#1198.

Let's build this list up! :)

Copied from original issue: padrino/padrino-framework#1137

Extract duplication

The how-to-get-in-contact-with-us-part

If you have any questions be sure to contact us at:
[@padrinorb](http://twitter.com/#!/padrinorb), discuss things on
[google groups](https://groups.google.com/forum/?hl=en#!forum/padrino), join us
on IRC at “\#padrino” on freenode or
[open an issue](https://github.com/padrino/padrino-framework/issues) on GitHub.

Try to learn how to do it.

Guide about how to configure the logger

Configuring the logger to suit your needs is totally possible with Padrino.

The easiest way is to set the options in config/boot.rb, anytime before Padrino.load!.

Padrino::Logger::Config[:development] = { :log_level => :devel, :format_datetime => " [%Y-%m-%d %H:%M:%S] ", :stream => :to_file }

If you want to redefine your logger at a later stage in your app you will need to run Padrino::Logger.setup! right after your new logger settings.

TODO: Explain the options.

  • @auto_flush = options.has_key?(:auto_flush) ? options[:auto_flush] : true
  • @Level = options[:log_level] ? Padrino::Logger::Levels[options[:log_level]] : Padrino::Logger::Levels[:debug]
  • @log = options[:stream] || $stdout
  • @log.sync = true
  • @format_datetime = options[:format_datetime] || "%d/%b/%Y %H:%M:%S"
  • @format_message = options[:format_message] || "%s - %s %s"
  • @log_static = options.has_key?(:log_static) ? options[:log_static] : false
  • @colorize_logging = options.has_key?(:colorize_logging) ? options[:colorize_logging] : true

Implementation reference.

Issue with heroku part of Blog tutorial

I just completed the blog tutorial. I had a couple of issue, like those mentioned in the comment below the tutorial itself. But I also had one issue with the heroku part.
heroku run rake ar:migrate would not run (pg didn't seem to be installed).

Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add gem 'pg' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

I installed postgres-dev package locally and ran a bundle --with production, and then checked in that updated Gemfile.lock. (I did not switch :development away from sqlite3.)
Then heroku seemed to get postgresql installed and everything ran as planned.

FAQ page is gone

While fixing some broken links in padrino/pardino-framework's README I came across a broken link to an old FAQ page.

Looking through this repo it appears the FAQ page was removed and I can't tell if that was on purpose or not... If it was please close this issue. If not, then we should investigate building out an extensive list of questions/answers.

For now I've removed the FAQ reference from padrino/pardino-framework's README. PR here: Fixing all the broken links

MAN File

We should use this repo also to generate a Man file (maybe with docco/rocco) among our Padrino binaries ;)

Why page

Lots of good stuff on the old why page.

Have we lost this now?

Also a dead link pointing to it in the getting started section

Guide length and organization

On discussing difficulty in navigation guide pages (from padrino/padrino-web#18):

Rather than discussing issues with the proposed solution, let's discuss problems with the current implementation.

  1. Guides are very long with many sections.
  2. Content width is somewhat narrow, especially for the font size.
  3. Guides are listed all together rather than by type or logical progression.

These are fairly easy problems to solve:

  1. Separate guides into smaller sub-guides. Content would be the same, but broken into multiple pages. See Lotus's docs for an example.
  2. Increase overall maximum page width. Since the CSS is set using Susy and percentages, everything should scale nicely automatically.
  3. Add sub-headers to the guides and break them into logical categories. Again, see Lotus's docs for an example.

These structural solutions should, in theory, make a TOC unnecessary. I feel this is a better solution, but I'd like to hear others' opinions.

The docs were separated from the website in this repository to allow us to maintain documentation without caring about the website's implementation. Thus, we should make these organizational changes here first.

As a side effect, this should allow the docs to remove files like _sidebar.slim as it is website logic.

Generator guide is missing `migration-format`

I figure out that project generator configuration option list is missing --migration-format=timestamp option. I wanted to create a pull request but I don't know neither Default value nor Aliases for migration format.

Blog Tutorial Improvements

I ran through the blog tutorial to verify accuracy, and I made a few observations that could translate into improvements.

Remove: Section on updating database configuration manually from Heroku DATABASE_URL variable

As this step technically isn't needed to complete the tutorial, I can't help but wonder if it should just be removed. As the values won't match up to what the user would be seeing, I wonder if it might be a source of confusion to newcomers.

Remove: Addition to dependency_paths

Looks like default_dependency_paths already includes this path, allowing us to remove this step.

Consistency: Settle on bundle exec rake or padrino rake

I've never seen padrino rake until following the tutorial. Maybe someone else can advise whether one or the other is better suited.

Remove: Tweak to db/seeds.rb

I was prompted for a username and password when seeding. I think this can be safely removed.


I'm willing to take care of these items, barring no objections from the core team.

Deployment section

Deploying your application on heroku

Finally, our basic blog has been built and we should deploy our application so
the world can check it out! The easiest way to do this quickly and for free is
to use a service such as Heroku. Let's deploy our application to Heroku right
now.

The best way to get started using Heroku is by following the
Heroku Quickstart Guide. As explained in the guide, be sure to have Git installed and
setup a Heroku account as
well as
install the Heroku command-line tool before continuing this tutorial.

Now, to deploy to Heroku, the application needs to be set up as a Git
repository:

$ cd sample-blog-updated
$ git init
$ git add .
$ git commit -m "initial commit for app"

This initializes the Git repository, adds all the contents and commit them to
the repo.

Currently Padrino defaults to SQLite but Heroku only supports
PostgreSQL, so we'll need to add pg gem as a dependency for production as well add sqlite3
for development.

# Gemfile
group :development do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

Now you can bundle :

$ bundle

and then commit these changes to your git repository:

$ git add --all
$ git commit -m "added pg dependency"

Next, the application must be set up on Heroku.

$ heroku login
  Enter your Heroku credentials.
  Email: <your-email>
  Password (typing will be hidden):
  Logged in as <your-email>
$ heroku create
  Creating app... done, ⬢ secret-taiga-32690
  https://secret-taiga-32690.herokuapp.com/ | https://git.heroku.com/secret-taiga-32690.git
$ git push heroku master

That's it, your app is now running on Heroku! To see if we have a database addon connected
to out heroku app, run heroku addons:

$ heroku addons
  Add-on                                       Plan       Price
  ───────────────────────────────────────────  ─────────  ─────
  heroku-postgresql (postgresql-taiga-32690)   hobby-dev  free
   └─ as DATABASE

and configure the config/database.rb for production:

# config/database.rb

Sequel::Model.plugin(:schema)
Sequel::Model.raise_on_save_failure = false # Do not throw exceptions on failure
Sequel::Model.db = case Padrino.env
  when :development then Sequel.connect("sqlite://db/blog_tutorial_development.db", :loggers => [logger])
  when :production  then Sequel.connect("<your-url>",  :loggers => [logger])
  when :test        then Sequel.connect("sqlite://db/blog_tutorial_test.db",        :loggers => [logger])
end

You can get the value of <your-url> via heroku config.

Run heroku open to open your site in your default web browser.

Now run our migrations/seeds:

$ heroku run rake sq:migrate
$ heroku run rake sq:seed

You'll see something like:

$ heroku run rake ar:migrate
Running rake ar:migrate on calm-tor-92217.... up, run.7316
== 1 CreateAccounts: migrating ================================================
-- create_table(:accounts)
   -> 0.0162s
== 1 CreateAccounts: migrated (0.0164s) =======================================

== 2 CreatePosts: migrating ===================================================
-- create_table(:posts)
   -> 0.0078s
== 2 CreatePosts: migrated (0.0080s) ==========================================

== 3 AddAccountToPost: migrating ==============================================
-- change_table(:posts)
   -> 0.0048s
== 3 AddAccountToPost: migrated (0.0254s) =====================================

$ heroku run rake seed
Running rake seed on calm-tor-92217.... up, run.9169

Which email do you want use for logging into admin?
Tell me the password to use:

=================================================================
Account has been successfully created, now you can login with:
=================================================================
   email: [email protected]
   password: *****
=================================================================

Now let's open our newly deployed app:

$ heroku open

and surf. You can see posts and the
admin screen.

Enjoy!

Rails 3 Engines are out

"Rails 3 is working towards true fully mountable applications, but Padrino has them right now out of the box and with virtually no extra effort."

Rails 3 is out and so are engines. Is the purpose of this sentence to state that engines are not "fully" mountable applications or was this created when Rails 3 was still in development and it needs to be updated?

Nested forms

From @fgarcia on September 9, 2014 14:37

I am not having the behavior I expected from the fields_for form helper. This is what I am trying to do (Slim template):

= form_tag '/form/posted' do

  = fields_for :model do |f|
    = f.label :email
    = f.text_field :email

The text field above is generated as:

<input type="text" name="object[email]" value="" id="object_email">

I expected the field to be inside 'model', not inside 'object':

<input type="text" name="model[email]" value="" id="object_email">

Also I cannot nest again inside like this:

= f.fields_for :inside do |ff|
  = ff.text_field :bar

With that I get the error undefined method 'inside' and my expected output was:

<input type="text" name="model[inside][bar]"  id="...">

Maybe I am doing something wrong expecting something similar to the rails helpers, so any advice using these helpers to get nested forms (without object) would be welcome.

Copied from original issue: padrino/padrino-framework#1760

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.