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
5
votes
1 answer

Rails (ActiveRecord) coalesce or how to update only empty values in a table

With Mysql I can use COALESCE to update only the values that are emtpy in a table. How can I do this with Rails (ActiveRecord)? I don't want to create if statements for each column in the table and am guessing there has to be a way to do it if I…
kakubei
  • 5,321
  • 4
  • 44
  • 66
5
votes
1 answer

Mock current_account on Padrino for rspec test

I'm trying to test a padrino controller that depends on current_account provided by Padrino::Admin::AccessControl To do so, I need to mock current_account. the code is something like: App.controller :post do post :create, map => '/create' do …
cpereira
  • 155
  • 9
5
votes
0 answers

How can I use admin layout in Padrino for my main app?

I have controller app/controllers/posts.rb How can I use admin layout from admin/views/layouts/application.haml ?
Ivan Linko
  • 966
  • 7
  • 15
5
votes
1 answer

Tutorials to Testing using RSPEC on PADRINO framework on RUBY

I am new to Ruby and have been asked to use it in our new project. We have also been asked to use Padrino (Sinatra) as backend/framework. For testing we have been asked to use Rspec. I have been hunting for tutorials for long that would guide in…
Sandip Agarwal
  • 1,890
  • 5
  • 28
  • 42
4
votes
3 answers

How to access application settings from a model in Padrino

I'm tring to do something basic in Padrino, but lots of searching hasn't come up with any answers. I'm trying to access a global setting from a model. I have added a line to the "development" section of the environments.yaml file called…
kristianp
  • 5,496
  • 37
  • 56
4
votes
1 answer

How to test a Padrino controller from Padrino console

I know in Rails I can do something like app.get 'url' app.response But this does not work in Padrino, nor do any of the regular controller calls because Padrino uses different controller methods than Rails. What I'm trying to do is test my…
kakubei
  • 5,321
  • 4
  • 44
  • 66
4
votes
2 answers

How can I stop Padrino putting compiled SASS in my public/ directory? Or should I?

I'm playing with Padrino, experimenting with a very minimal site at the moment with no DB and just a few HAML and SASS files under the app/ directory. What I've noticed is that each time I render a page which links to a stylesheet that's defined in…
Peter Lewis
  • 97
  • 1
  • 7
4
votes
2 answers

Padrino controller abstraction

I've been trying Padrino framework in one of my project, and there is one thing that really annoys me. I want to implement just for instance a user registration process using OmniAuth and want to break my request handler (controller's action) to…
Nucc
  • 1,031
  • 6
  • 20
4
votes
1 answer

Adding an ORM to an existing padrino application

I'm new to ruby, sinatra and padrino, so it might be a silly question, but: Is there a way to add an orm to an existing application ? My problem is that I have created an application with the following command line: $ padrino-gen project sample_blog…
cyrilchampier
  • 2,207
  • 1
  • 25
  • 39
3
votes
1 answer

Sinatra-Assetpack not serving js files

This should be pretty easy, but it's simply not working. Running Padrino with sinatra-assetpack. All css files serve perfectly like this: serve '/stylesheets', from: '/app/stylesheets' css :shared, [ '/stylesheets/reset.css', …
Ronze
  • 1,544
  • 2
  • 18
  • 33
3
votes
4 answers

padrino && websockets

i'm looking for a way to open and use websockets from within a Padrino application. i know Padrino works with a single thread but i'm looking for a way to open websockets and share variables between its "onopen" "onclose" "onmessage" methods and…
refaelos
  • 7,927
  • 7
  • 36
  • 55
3
votes
2 answers

Getting NoMethodError for Padrino helper methods

I'm new to Padrino and have been running through the sample blog tutorial. I'm getting a NoMethodError when using the sample code below # app/views/posts/index.haml @title = "Welcome" #posts= partial 'posts/post', :collection => @posts I tried…
user511866
3
votes
2 answers

how to easily run a sinatra/padrino application on rails hoster

is there an easy way to run a sinatra (in particular a padrino) application "as a" rails app? i guess, there should be some way to translate "rails server" to "padrino start" or something... (the hoster i'm referring too hosts rails with mod_rails.)
udo
  • 1,486
  • 13
  • 18
3
votes
1 answer

How to avoid duplicate field name in query result

I am developing a padrino web application. I have two tables: User table: Has id, name, address fields Post table: Has id, user_id, content If I join them, User.join(:posts, user_id:, :id) they return two fields with the same name id: id name…
Nomura Nori
  • 4,689
  • 8
  • 47
  • 85
3
votes
2 answers

Notmethod error when padrino start

unfortunately got lost in the begginning. Created first test_app using the official guide http://www.padrinorb.com/ When trying "padrino start" app starts, server is running well in console, but as soon as I try to see it in the borwser this error…
YogiZoli
  • 870
  • 1
  • 9
  • 17
1
2
3
25 26