ruby-on-rails

Capistrano + Git : repository local to production server

I am trying to do 'deploy:cold' for my app. The git repo is local to my deployment server (i.e. I only have one server for everything and I don't host my code on github). Here is the transcript (replaced my app name with "myapp" for privacy) executing `deploy:cold' executing `deploy:update' ** transaction: start executing `deploy:upda...

Ruby on Rails: How do I specify a non-relative path to a layout when calling render?

(Rails version 2.3.2) By default the :layout parameter for render takes a relative path and adds this to the default layout directory ("app/views/layout"). Eg: render :file => '../resources/website/home_page.html.erb', :layout => '../../../../resources/website/layout' "If no directory is specified for the template name, the template...

What causes "Neither PUB key nor PRIV key:: nested asn1 error" when building a public key in ruby?

When building a public key using the OpenSSL::PKey::RSA module by passing it a .pem file, what is the cause for a response: OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: nested asn1 error from /Users/Matt/projects/placepop/lib/apn.rb:48:in `initialize' from /Users/Matt/projects/placepop/lib/apn.rb:48:in `new' from /Users/Matt/...

Rails form not saving 'Type:' field [newbie]

I generated a simple 'Post' scaffold which has title:string body:text category:string. I later added type:string (and performed the migration) to the model and added the selection fields in new.html.erb and edit.html.erb. I also added validation for all these fields. <%= f.label :type %> <%= f.select :type, Post::TYPES, :prompt => "Sel...

updating this static page controller code to a newer rails version

I've been trying to use the code here: http://snafu.diarrhea.ch/blog/article/4-serving-static-content-with-rails but I'm getting errors like: undefined method `template_exists?' for #<StaticController:0xb74cbe4c> How can I update this method to Rails 2.5? Probably there are other deprecated things too. ...

Timed Page Caching in Rails

In a project I'm working on, I'm requesting data from an external API in my controller, which is then displayed in the view. I've recently begun running into exceptions being thrown due to rate limits, which are caused from excessive calls to the API. To fix this, I'm assuming that I need to implement some sort of caching system. I've be...

how to import project from github to computer

I have a rails + postgresql project hosted on github. I usually work on it from my laptop and push the changes out. I would like the same project source to come on my desktop as well so I can work on it if I am on my desktop. The project is also deployed to heroku so I'd like to pull the db changes and stuff as well. I already have g...

Rails Image Display Error

My application front page works fine in firefox but when I open the site in any version of IE I get an error for the top banner image, the code in the layout is this: <%= link_to image_tag("logo.jpg", :class => "logo"), root_url %> You can see it live here: http://www.dailytrailer.net Everything seems to be fine, when I load it in IE...

RubyGem version error: rack(1.0.0 not ~> 1.0.1)

I was working on a rails project on my laptop and pushing code to github. Now I cloned the project on my desktop. when running: rake db:migrate I get the following error: rake aborted! RubyGem version error: rack(1.0.0 not ~> 1.0.1) (See full trace by running task with --trace) Before this error I had to run the following comma...

How do I create an admin subdomain to manage subdomains in Rails

I am using AuthLogic and the subdomain method that dhh covered in this blog post, everything is working great, and as expected. What I'm trying to figure out is how to create a subdomain like 'admin' or 'host' that will have a user authenticated from AuthLogic (this may be trivial and unnecessary to mention) that will manage the subdomai...

cloned project from github. heroku does not work

I cloned a project from github over to my desktop. I used to work on it form my laptop. However, on laptop heroku does not seem to work for this app eventhough i have it installed. First problem: heroku open >No app specified. >Run this command from app folder or set it adding --app <app name> I did not have to specify the --app o...

Rails stylesheet problem! stylesheet_link_tag is linking to the wrong place!

Thanks in advance for the help. I'm trying to get my rails app looking even passably nice for the first time, and I'm having a lot of trouble getting stylesheets working. In my application.html.erb layout file, I have the line: <%= stylesheet_link_tag 'application', 'formtastic', 'formtastic_changes', :cache => "base" %> Which, I th...

"sqlite3 not found" error in ruby on rails

I am very new to RoR... I installed Ruby and installed its gems... then downloaded and installed MySql... created my first directory demo. then started the server using ruby script/server entered the http://localhost:3000 url in the browser and get a "welcome aboard" page..all is well till now... now I create a controller using ruby...

I think my rails gem is broken.

So I'm working on one computer with some ruby/rails code and its working fine. On another computer however I'm having a problem when trying to create a model or run the server and it looks like the same problem. look at this output: $>script/generate /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks...

Text editor(FCKEditor) ruby on rails/ PHP

I have an application that is running on Rials so now I want to add the text editor(FCKEditor/TinyMCE) to adit text/uploading images on website. I have google the internet until I got FCKeditor for Rails(http://rubyforge.org/projects/fckeditorp/) "which has a function of uploading pictures but ones you uploaded the images you can't dele...

Rails 2.3 caching by time

Hi guy, I would like to cache my fragment page in my rails application by time. I found this plugin to do this => ici but any download is available. I searched in the rails doc but I don't found how to cache my fragment by time. Are you know another plugin to do this or another method to do this ? Thanks. ...

Where do you keep your web development environment, in your workstation or on a server?

In several years I am using my workstation as development environment. I think that most of web developers use their workstation for running their servers, Apache, Tomcat, Mongrel etc. I have been working in a company that have a Unix development server in another city, with the document root folder share with samba. I am still developin...

observe activerecord relations

hi Stack, I like to observe adding an object to my has_many relation without saving them to the database. So when I add a LineItem to my Order I like to call Order::calculate_total to update the actual total value. o = Order.new o.line_items << LineItem.new # should call calculate_total from order-object but there are no observers for ...

Where does the Rails initializer go in a gem?

I'm trying to extract some functionality from my existing app into a gem. The existing functionality uses an initializer to load up a config file when Rails starts up... config/initalizers/myinitializer.rb Where should this initializer go in the gem? Do I mirror the path structure inside the gem or put it somewhere else? This will be ...

After the page is submited show the selected value in the select box ruby on rails

Hello, I have the following in my view to display a select box with countries in it: @countries = {'United States' => 'US', 'France' => 'FR'} <%= select_tag 'countries', options_for_select(@countries.to_a) %> it works fine. Now in cases I have an error after submitting the form, all of the values in the text field that ...