Questions tagged [padrino]

Padrino is a ruby framework built upon the excellent Sinatra Microframework. Sinatra is a DSL for quickly creating simple web applications in Ruby. Padrino was created to make it fun and easy to code more advanced web applications while still adhering to the spirit that makes Sinatra great!

Overview

Padrino is a Ruby framework built upon the excellent Sinatra microframework. This framework makes it as fun and easy as possible to code increasingly advanced web applications by expanding upon Sinatra while maintaining the spirit that made it great.

For more overview, please see the Wikipedia article.

Features

Here is a list of major functionality Padrino provides on top of Sinatra:

  • Agnostic: Full support for many popular testing, templating, mocking, and database libraries.
  • Generators: Create Padrino applications, models, controllers i.e: padrino g project.
  • Mountable: Unlike other ruby frameworks, principally designed for mounting multiple apps.
  • Routing: Full url named routes, named params, respond_to support, before/after filter support.
  • Tag Helpers: View helpers such as: tag, content_tag, input_tag.
  • Asset Helpers: View helpers such as: link_to, image_tag, javascript_include_tag.
  • Form Helpers: Builder support such as: form_tag, form_for, field_set_tag, text_field.
  • Text Helpers: Useful formatting like: relative_time_ago, js_escape_html, sanitize_html.
  • Mailer: Fast and simple delivery support for sending emails (akin to ActionMailer).
  • Admin: Builtin Admin interface (like Django).
  • Logging: Provide a unified logger that can interact with your ORM or any library.
  • Reloading: Automatically reloads server code during development.
  • Localization: Full support of I18n.

Note that as a user of Padrino, each of the major components can be pulled in separately to an existing Sinatra application or they can be used altogether for a comprehensive upgrade to Sinatra (a full-stack Padrino application).

To read more about registering certain Padrino functionality into your Sinatra application, check out the Standalone Usage in Sinatra guide.

378 questions
1
vote
2 answers

padrino: sub app and controller with same name produces redundant url

I have a padrino project. I've created a sub app called "users". I also have a model called user and a controller called users to handle the routing. Users.controllers :users do The issue with that is that the urls being produced and being…
Mike
  • 33
  • 3
1
vote
1 answer

Sharing filters between applications

I am building a modular Padrino application to mount mutiple applications. I am mounting a base application to / class BaseApp < Padrino::Application ... end I am then mounting other appilications to other endpoints, such as /clients and these…
Ciaran Archer
  • 12,316
  • 9
  • 38
  • 55
1
vote
1 answer

Padrino mongoid logging

How to view all queries in console to mongodb? Mongoid.logger = Logger.new($stdout) does not help database.rb host = 'localhost' port = Mongo::Connection::DEFAULT_PORT database_name = case Padrino.env when :development then 'blog_development' …
amirka
  • 313
  • 2
  • 12
1
vote
1 answer

How to set content type as plain/text in padrino?

I want to return a string in response with content type as plain/text. This is what I am doing currently. get :index, :map => "/ivr", :provides => [:plain] do "Hello World!" end It says ; RuntimeError - Unknown media type: :plain:
1
vote
2 answers

How to set :autoclose option in Haml

I am actually generating some xml from haml template, using Padrino Framework. There are some tags that are self closing. For that I did add following statement in subapp/app.rb as padrino is based on sinatra set :haml, :autoclose => %w[meta img…
Jai Madhav
  • 603
  • 8
  • 17
1
vote
1 answer

Can't save more than one document in GridFS (with MongoMapper/Joint)

I've written a Padrino application that allows you to upload files. It uses MongoMapper (via Joint) to store these files (images) in GridFS. I am able to store one file with no problems. However, when I go to store another file, it saves, but it is…
Ethan Turkeltaub
  • 2,931
  • 8
  • 30
  • 45
1
vote
1 answer

Object associations using datamapper

I'm trying to assign players to a club. A club has n players and a player belongs to a club. A club can only have less than 23 players and no more than 2 players playing in the same position. clubs = Club.all #Club is a datamapper object. Returns 20…
marcosdsanchez
  • 2,529
  • 2
  • 17
  • 20
1
vote
1 answer

"accepts_nested_attributes_for" does not render fields in _form.haml partial

I've got a problem that is giving me a headache. in my Terminal I see that the Trail table is looked up. There is some dummy stuff in that table. DEBUG - Account Load (0.4ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = 1 LIMIT…
Halakarta
  • 11
  • 3
1
vote
2 answers

How do you add indexes to your Mongoid database in Padrino?

I need to be able to add indexes to my Mongoid database in a Padrino project. I saw that they added rake tasks for this here: https://github.com/padrino/padrino-framework/commit/ec8a267f477ac4dc88a66c84fffb17ac26190a22 And it seems that they should…
Jeremy Smith
  • 14,727
  • 19
  • 67
  • 114
1
vote
1 answer

Moving document between collections in Mongo (via Mongoid)

I'm building a card game (basic 52 card deck of playing cards 4 suits * 13 ranks), and I've decided on MongoDB for this project. My basic model is: --> Game --> Deck --> Cards --> Players --> Hand (as Deck) -->…
Robbie
  • 715
  • 9
  • 19
1
vote
1 answer

Can't modify frozen Array.(FrozenError)

When I start server with padrino start, this error happens: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/padrino-core-0.15.1/lib/padrino-core/application.rb:32:in `concat': can't modify frozen…
aaaa
  • 73
  • 1
  • 6
1
vote
2 answers

Multiple apps in Ruby Padrino: How to name models?

I have a Padrino project, that consists of multiple apps. For example: Website (Models: Site, Page) Blog (Models: Post, Comment) Shop (Models: Category, Product, Order) Tracking (Models: Visitor, Content) Putting all models unmodified into one…
Marc
  • 6,741
  • 3
  • 19
  • 8
1
vote
2 answers

Why does "heroku console" with Padrino give useless error messages?

When using heroku console, I always get "Internal server error" when an exception is raised rather than a stacktrace as I would expect. Here's a transcript of what I mean: $ heroku console Ruby console for myapp.heroku.com >>…
Benjamin Oakes
  • 12,262
  • 12
  • 65
  • 83
1
vote
0 answers

"Couldn't forward the HTTP response back to the HTTP client: It seems the user clicked on the 'Stop' button in his browser."

Take a look at the code on GitHub. What's happening is I try to create a Schedule (one of the models) and it is suddenly failing to do anything. Using the built-in Padrino server, it is not outputting any errors. However, with Passenger, I am…
Ethan Turkeltaub
  • 2,931
  • 8
  • 30
  • 45
1
vote
0 answers

Ruby Padrino framework migration command randomly deleted wrong file, how could this be?

I am building a web application using Padrino and sequel as ORM. I mistyped Padrino migration command for model generation, and as you can see in the screenshot, the wrong command ended up generating a nameless migration file db/migrate/041_g.rb. I…