ruby-on-rails

servers with ruby

Hi, I was doing the following on the terminal: script/server it says the server host:3000 was being used, when I typed it into web browser, the page loads but when I click on my environment the info doesn't show up. I get an error message if I change the server by typing in script/server -p 3001 for example, it works, so my qu...

How to allow customer subdomain sites to use their own domain

I have a rails app where customers sign up and get a custom subdomain site/url like this: customer1.myapp.com customer2.myapp.com customer3.myapp.com What are the steps I need to take to allow a customer to use their own registered domain name such that their domain points to my app? So, in the example above, if "customer1" owns "cu...

Deploy my css and javascripts with capistrano to amazon S3

I have account in amazon S3 and i use this just for my css and javascripts and photos like a CDN. I want a task capistrano for send my javascripts and css and photos to my bucket in amazon s3. How I do ? tahnks. thanks you John Topley Based in your code i did as below. configure you config/s3.yaml access_key_id: secret_access_key: bu...

can we add the file dynamic by using jquery in ror

In my ruby on rails application i have 2 html form (edit,_experiecnce) ,in edit form i have one link whenever i link this link i want to add the _experience form on edit form. this can be done dynamic by using jquery can some write the jquery method.Please ...

Ruby on Rails: I want to remove non letters to create a username

Let's say I have the name "Master Yoda" How would I auto convert it to be lowercase, and replace spaces with underscores... or just get rid of the spaces. so maybe turn it into master_yoda or masteryoda I'm looking for the most concise solution possible. ...

How do I connect a mysql database file to a local ruby on rails application.

I have a database file (name.sql) that was sent to me that I am supposed to connect to a rails app locally hosted on my mac, that I downloaded (forked?) from github. How do I set up my database.yml file to connect with the sql files. ...

nginx + phusion passenger + ree not returning 304 for html

I'm using nginx + passenger + ree to host my web app in a linode vps. The config i'm using is the following: user ***; worker_processes 4; events { worker_connections 1024; } http { passenger_root /opt/passenger-2.2.15; passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/my_ruby.sh; passenger_max_pool_size 10; ...

How to generate a radio button form in a form_for block?

I know how to loop a combo box by using this: <%= f.collection_select(:category_id , Category.all, :id, :name, {:prompt => false})%> and now, I can do radio box using the radio box help: radio_button("user", "receive_newsletter", "yes") But how can I do this in a form helper? thank you. ...

Rails Console: Why does it stop working after backgrounding it?

Hey guys. I'm able to send Rails consoles to the background with CTRL+Z . However, when I bring back the console with "fg", the console's no longer responsive. It doesn't respond to normal commands, or even "quit" or CTRL+C. I have to background it again with CTRL+Z , and then kill it with "kill %1". Here's an example: [nickh@chameleo...

Ruby on Rails: Cucumber: how do I turn off the database cleaner?

The system I'm testing is complex enough where writing separated test cases would be a huge waste of time and resources. So, I need my tests to build off each other. But, for example, whenever I got User.new in one of my step definitions, once the scenario is done, the User is removed from the DB. How do I keep all my information... u...

How do I add an instance variable inside of a link_to ?

For example, I would like to make this : = link_to 'Click this link!", 'http://www.mydomain.com/#{@id}/manage', :target => '_blank' This is getting sent as an email..and the @id is coming from my Notifier model.. Any ideas? ...

Ruby on Rails/Activerecord mySQL modeling

This is a pretty simple question really, but let's say I'm creating a model for Person. Person obviously has first name, last name, age, etc. But the person also has contact info consisting of things like address line 1, address line 2, city, state, zip, country, phone 1, phone 2, etc... Does it make more sense to create a model for P...

Accessing rails routes in javascript

Hi Can anyone explain how i can access the rails routes/names routes in javascript ? The following are some of the things i tried http://github.com/jsierles/js_named_routes. but no luck. ...

NoMethodError In Rails Page

Here's the page template I've got: <h1>Editing user</h1> <% form_for(@user) do |f| %> <%= f.error_messages %> <p> <%= f.label :forename %><br /> <%= f.text_field :forename %> </p> <p> <%= f.label :surname %><br /> <%= f.text_field :surname %> </p> <p> <%= f.label :address ...

Has anyone got any experience using Pfeed? I have several issues to build up a 'recent activity' log.

Hi there, I have started trying to use Pfeed plugin for my Rails app. Apart from four support pages of wiki on the Github, I only found this blog post helpful for me to start using. I have managed to get the simple feeds working like "User bought 12 items about 1 minute ago" etc. But when it comes to customize the feed items, that's w...

RAILS 3RC NoMethodError: undefined method `%' for nil:NilClass

i have following error on Rails 3 RC, I do not understand what was going: Loading development environment (Rails 3.0.0.beta4) >> o = Objekt.new => #<Objekt id: nil, name: nil, email: nil, hash: nil, phone: nil, adress: nil, description: nil, price: nil, lng: nil, lat: nil, klass: 1, created_at: nil, updated_at: nil> >> o.adress = "so...

Building a Rails app from scratch - What should be the ideal workflow ?

Hello, I am going to develop a Rails app pretty soon. Currently I have nothing but an idea + few wireframes. I would like to know how shall I proceed? At what stage should I implement/write the following Cucumber features Rspec tests Code Refactoring code What gems/plugins do you use? [ For common tasks ] ...

Capistrano 'reaper not found'

I'm new to deploying with Capistrano, and I'm trying the following: deploy.rb: set :application, "example.co.uk" # If you aren't deploying to /u/apps/#{application} on the target # servers (which is the default), you can specify the actual location # via the :deploy_to variable: set :deploy_to, "/home/example/#{application}" # SCM Op...

How does Rails handle I18n date validation?

I used validates_timeliness for validating the date in my application. It functions well for English locale. I added this line to initializers: ValidatesTimeliness::Formats.add_formats(:date, "mmm dd, yy") and Rails can then validate date in this format July 04, 2010. But when I change the locale to some other locale, e.g. Chinese zh...

An alternative to useing datetime_select in Rails

I'm not such a fan of using datetime_select. I think it renders ugly and isn't easy to deal with on post back. How do most people deal with it? Wouldn't it be easier to use a plain textbox and use javascript to validate the input as a date? I will be persisting it as a DateTime value. ...