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
3
votes
2 answers

How to mount other rack apps, such as Grape API's to Padrino application?

I am looking around on how to mount other rack apps such as a grape API to my padrino application. I tried searching around but couldn't possibly find an answer. I tried with the following way: Padrino.mount("API", :app_file => "path_to_api_rb",…
Lester Celestial
  • 1,454
  • 1
  • 16
  • 26
2
votes
1 answer

Padrino: url_for to access project level route from sub app

I have my main application that contains my pages controller. It's just a quick way for me to keep all my static pages in one spot. I have a sub app that is going to be using the same layout (copy and paste for now). The layout is using a…
Mike
  • 33
  • 3
2
votes
1 answer

How to get Padrino match routes when url have periods in it?

In Padrino, if I want a single route to match the following urls: "/does/not/work/for/some.reason" "/does/not/work/for/some.bizarre.reason" How would I do that? I.e. the last part of the url can have an arbitrarily number of periods in it, and I…
wciu
  • 1,183
  • 2
  • 9
  • 24
2
votes
1 answer

Using Paperclip with Padrino

Background: I'm building a simple blog using Padrino, Ruby 1.9.2, HAML, and Heroku. I want the posts index to have a magazine-like look to it. For each post in the index, the user should see titles, content teasers, and images. My problem is with…
1ijk
  • 1,417
  • 2
  • 19
  • 31
2
votes
1 answer

sending emails asynchronously from Padrino via Resque

I'm trying to send emails out of a Padrino app asynchronously - I've tried using Ruby fork command but that doesn't scale very well I think, I tried delayed_job also but have now settled on Resque (mainly because the web interface it comes with is…
2
votes
1 answer

Using Padrino form helpers and formbuilder - getting started

I've jumped into learning Ruby by going straight to Padrino with Haml. Most of the Padrino documentation assumes a high-level of knowledge of Ruby/Sinatra etc... I am looking for samples that I can browse to see how things work. One specific…
tig
  • 3,424
  • 3
  • 32
  • 65
2
votes
1 answer

Selectively using yield_content in Padrino application.haml template

In a Haml based Padrino solution I have an application.haml like this: !!! %html %head %title "blah" %body #header = yield_content :headcontent #container ... For :headcontent, in my page (e.g. index.haml) I have - content_for…
tig
  • 3,424
  • 3
  • 32
  • 65
2
votes
1 answer

Padrino + MongoMapper/Joint Troubles

I'm using MongoMapper with Joint on Padrino, and trying to get the upload working. However, I keep getting thrown a NoMethodError "undefined method 'path' for #". It seems like it can't see the path, but the parameters are…
Ethan Turkeltaub
  • 2,931
  • 8
  • 30
  • 45
2
votes
1 answer

Howto test a sinatra (padrino) controller without testing the view?

is there any good way to test a controller with rspec? Actually, I'm testing the complete output (including the rendered view) with rack/test. Take the following minimal controller for example: MyApp.controllers :cool_controller do get :index do …
udo
  • 1,486
  • 13
  • 18
2
votes
1 answer

How to effectively query the data in Ruby using Sequel

I am trying to effectively get data in my project. I have database (multilanguage). And I need to get all toplevel categories (which has no parent_id in top level) and those which has no record in data table (deepest) in single_article.…
Mlok
  • 155
  • 9
2
votes
0 answers

Padrino rendering json raises template not found

I am using Padrino and facing the next issue. I would like to render jsons, the controller is the following and then the error I always get. I call the end point with: curl -i -H "Accept: application/json" http://localhost:3000/mymodels get :index,…
Mark
  • 5,994
  • 5
  • 42
  • 55
2
votes
1 answer

How to access Sequel result with dot operator in ruby?

I am newbie to Sequel and ruby and I have one thing need your help. In a word, I can't access database query result with dot operator. I am using sequel adapter in padrino ruby project. For example, persons = Person.all persons.each do |p| puts…
Nomura Nori
  • 4,689
  • 8
  • 47
  • 85
2
votes
1 answer

How to run Padrino project in production mode?

I am making a backend api using Padrino ruby framework. And I would like to know how to run project on production mode. Now I run the server with this command. padrino s It is running on development mode. I tried this one. padrino s…
Nomura Nori
  • 4,689
  • 8
  • 47
  • 85
2
votes
2 answers

Run two ruby scripts from rake task

So this is a simple rake task: task :map_reduce do puts 'Running map reduce scripts...' ruby "#{PADRINO_ROOT}/map_reduce/raw_visits_map.rb '03-08-2016' 90" && ruby "#{PADRINO_ROOT}/map_reduce/raw_visits_reducer.rb" end The first script outputs…
Bogdan Popa
  • 1,099
  • 1
  • 16
  • 37
2
votes
1 answer

ActiveRecord + Pry confusion

This is confusing me no end. In a rake task, I am saving new records on the DailyScore model with the following code: def save_record_as_daily_score_object(data) @ds = DailyScore.where(date: data[:date]).first_or_create! @ds.update!(data) …
Jonathan_W
  • 638
  • 9
  • 24