padrino

Using Paperclip with Padrino

此生再无相见时 提交于 2019-12-06 13:37:32
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 attaching the images. Problem: I've been trying to use the Paperclip gem to attach an image to each post. Heroku will fish the actual image from an Amazon S3 bin. So far, when I try to run a migration, I get the error: $ .../base.rb:1088:in `method_missing': undefined method `has_attached_file' for #<Class:0xa672140> (NoMethodError) It looks like

how to use padrino helper methods in rspec

时光怂恿深爱的人放手 提交于 2019-12-06 09:35:04
问题 I'm using padrino and rspec and I'd like to be able to test a helper method that I wrote. I have spec/app/controllers/sessions_controller_spec.rb describe "POST /sessions" do it "should populate current_user after posting correct user/pass" do u = User.create({:email=>"john@gmail.com", :password=>"helloworld", :password_confirmation=>"helloworld"}) user = { email:"john@gmail.com", password:"hellowolrd" } post '/sessions/new', user current_user.should_not == "null" end end app/controllers

ActiveRecord returns data in ASCII-8Bit Under Ruby 1.9.2-rc1

不想你离开。 提交于 2019-12-05 09:18:57
Further to the title, when loading data from ActiveRecord the encoding is always set to ASCII-8Bit in spite of my best efforts to force the encoding. I have entered as much detail as possible here to try and build a good error report someone could use to help me out! The project is using the following technologies: Padrino Framework Ruby 1.9.2-rc2 (Also 1.9.1 and 1.9.2-preview3) ActiveRecord MySQL (Full List) $ bundle show | ack '(record|padrino)' * activerecord (2.3.8) * padrino (0.9.14) * padrino-admin (0.9.14) * padrino-core (0.9.14) * padrino-gen (0.9.14) * padrino-helpers (0.9.14) *

alias url with sinatra / padrino

让人想犯罪 __ 提交于 2019-12-05 04:57:30
问题 I've this and it works get :about, :map => '/about_us' do render :erb, "<%= 'foo' %>" end get '/:slug' do redirect "/about_us" # <-- end Is possible to do in some way "render" instead of "redirect"? or something like render 'posts/1' 回答1: get :about, :map => '/about_us' do render :erb, "<%= 'foo' %>" end get '/:slug' do call env.merge('PATH_INFO' => '/about_us') end 来源: https://stackoverflow.com/questions/3384134/alias-url-with-sinatra-padrino

How to upgrade ruby version in Amazon Linux system?

强颜欢笑 提交于 2019-12-05 04:06:18
I have developed ruby application using padrino ruby framework. And I would like to deploy it on Amazon. I used this image. Amazon Linux AMI 2017.09.1 (HVM), SSD Volume Type And image description was: "The Amazon Linux AMI is an EBS-backed, AWS-supported image. The default image includes AWS command line tools, Python, Ruby, Perl, and Java. The repositories include Docker, PHP, MySQL, PostgreSQL, and other packages." After launching instance, I tested ruby version and it was ruby 2.0.0p648 (2015-12-16) [x86_64-linux] but I need ruby2.4 to deploy padrino framework. I tried to update ruby

how to use padrino helper methods in rspec

守給你的承諾、 提交于 2019-12-04 16:52:28
I'm using padrino and rspec and I'd like to be able to test a helper method that I wrote. I have spec/app/controllers/sessions_controller_spec.rb describe "POST /sessions" do it "should populate current_user after posting correct user/pass" do u = User.create({:email=>"john@gmail.com", :password=>"helloworld", :password_confirmation=>"helloworld"}) user = { email:"john@gmail.com", password:"hellowolrd" } post '/sessions/new', user current_user.should_not == "null" end end app/controllers/sessions_controller.rb post "/new" do user = User.authenticate(params[:email], params[:password]) if user

Suitability of Rails, Padrino, and Sinatra for building a prepaid mobile service

旧街凉风 提交于 2019-12-04 07:46:18
问题 I am working on an application in the Mobile/VOIP domain. This is really a gray area for me. Here are some details about the application: This is basically like an auto recharge / prepaid mobile service Will have logic of medium complexity compared to previous ERP apps I've written. The Views sections in the response will be plain text, which will be sent as SMS/USSD pull to user and Voice XML (VXML) that will be sent as an IVR Response to users. The routing logic is very simple, as only two

alias url with sinatra / padrino

怎甘沉沦 提交于 2019-12-03 21:57:38
I've this and it works get :about, :map => '/about_us' do render :erb, "<%= 'foo' %>" end get '/:slug' do redirect "/about_us" # <-- end Is possible to do in some way "render" instead of "redirect"? or something like render 'posts/1' get :about, :map => '/about_us' do render :erb, "<%= 'foo' %>" end get '/:slug' do call env.merge('PATH_INFO' => '/about_us') end 来源: https://stackoverflow.com/questions/3384134/alias-url-with-sinatra-padrino

How to access a gemified Padrino Apps Model from outside (not in controller, but e.g. a standalone script)

谁说我不能喝 提交于 2019-12-02 20:49:37
问题 I have a Padrino App called Gusy that specifies (Sequel) Models like # gusy/models/seminar.rb class Seminar < Sequel::Model # hopefully irrelevant stuff defined here end I want to access this Model from either a second gem, or a script in bin/ . Now, e.g. I require Gusy from a second gem "gusy_fill". The Gemfile is put up to set the path to a Gusy git repository. I can successfullly see the Gusy namespace (and e.g. print the apps Version Gusy::VERSION ) if interactively exploring with bundle

How to access a gemified Padrino Apps Model from outside (not in controller, but e.g. a standalone script)

扶醉桌前 提交于 2019-12-02 10:19:32
I have a Padrino App called Gusy that specifies (Sequel) Models like # gusy/models/seminar.rb class Seminar < Sequel::Model # hopefully irrelevant stuff defined here end I want to access this Model from either a second gem, or a script in bin/ . Now, e.g. I require Gusy from a second gem "gusy_fill". The Gemfile is put up to set the path to a Gusy git repository. I can successfullly see the Gusy namespace (and e.g. print the apps Version Gusy::VERSION ) if interactively exploring with bundle console . How can I access the mapped models and where and how do I configure the database connection?