ruby-on-rails

polling the server with ajax

I am building a website that has a system where users can send messages to each other. I would like it so that when a logged in user received a message, he would get some update on his screen telling him that. These messages do not have to be in realtime, so I do not think I want to push with comet or juggernaut or anything like that. ...

Gem install errors writable and PATH

These are the two errors I am getting. I am on OS X. Honestly, don't know if I installed via gem or not - if that matters. WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and /usr/bin aren't both writable. WARNING: You don't have /Users/M/.gem/ruby/1.8/bin in your PATH, gem executables will not run. ...

Phusion vs Mongrel for Rails application VPS

I'm working on a Rails application and it is currently hosted on a shared hosting. However, it is getting a lot of features that requires reasonable processing and I'm thinking of move it to a VPS, clouded server. I have no experience on server management, but, since it is a simple application, I'd like to manage it myself. Googling a bi...

textmate railscast theme and font?

where can I get the textmate rails theme and font used on Railscast? ...

Generate new models and schema at runtime

Let's say your app enables users to create their own tables in the database to hold their own, custom data. Each table would have it's own schema. What are some good approaches? My first stab involved dynamically creating migration files and model files bu I'd like to run this on heroku where you can't write to the filesystem. I'm thi...

flash[:notice] not working in Rails

I have the following snippet of code in my controller def create @message = Message.new(params[:message]) @message.message = h(@message.message) if @message.save flash[:message] = "Message Sent. Thank You for Contacting Me" else flash[:message] = "OOps Something went wrong" end redirect_to :action...

incompatible character encodings: ASCII-8BIT and UTF-8 in Ruby 1.9

Hi, I'm getting the following error with my Ruby 1.9 & Rails 2.3.4. This happens when user submits a non-ASCII standard character. I read a lot of online resources but none seems to have a solution that worked! I tried using (as some resources suggested) string.force_encoding('utf-8') But it didn't help! Any ideas how to resolve t...

Security in a Rails app - User submitted data

I'm currently in the process of writing my first Rails app. I'm writing a simple blog app that will allow users to comment on posts. I'm pretty new to Rails, so I'm looking for a bit of guidance on how to address security concerns with user input. On the front end, I am using TinyMCE to accept user input. It is my understanding that ...

NoMethodError in Projects#new

I am following alloy-complex-form-examples from github trying to learn nested forms and I just cannot get this thing to work. http://github.com/alloy/complex-form-examples NoMethodError in Projects#new Showing app/views/projects/_form.html.erb where line #13 raised: You have a nil object when you didn't expect it! You might have expe...

Adding standalone Ruby Files to a Ruby on Rails project

Hi, I have a ruby on rails project with scaffolding , views, layouts, models and such. I also have some standalone ruby (.rb) files which i would like to include in my afforementioned project. Is it possible to simply call these methods defined in these rb files by placing them somewhere and calling them from the controller or so? If ...

rails tagging (tags with special characters)

Hello, I have recently started using RoR acts-as-taggable-on plugin/gem which doesnt seem to support special characters. If I want to use tags within other language other than english (that uses non-standard letters), the plugin wont work as expected (bad urls and characters in tag name). Is there any way to set it so that each tag wi...

git not responding to my rails vendor/plugins directory

My git works fine in my app, except it doesn't respond to my vendor/plugins/paperclip directory. I can make a change in vendor/plugins/whatever and git status will show it, but not in vendor/plugins/paperclip. My .gitignore file only gas log* and public/system in it. I'm pretty stumped...searched google & asked in IRC, but nothing. Any i...

forms in ruby on rails, passing variables between one form to another

Hi, I'm attempting to pass variables between forms and unfortunately i'm not managing in my index.html.erb, i have a text field named SearchInput and i would like to pass this variable to the next form search.html.erb so that i may populate some data accordingly. How may i go about this please? In my index.html.erb i have the following...

Heroku, Problem/Question...

I was referred to Heroku for Ruby on Rails hosting and so far I think I am really going to like it. Just wondering if I anyone out there can help me figure out what is wrong. I follow there instructions for creating an app on there site, create and commit git, push the code and it shows up at http://mylifebattlecry.heroku.com (though t...

Moving the :format attribute in routing from the end to beginning of route

In my application, I am trying to get my API to mimic GitHub's in how it has the (.:format) in the beginning of the route rather than appending it optionally at the end. Here is my code that is "working" but can be ignored: map.namespace :api do |api| api.namespace :v1 do |v1| v1.resource :company, :path_prefix => "api/v1/:format...

postgres - partial column in SELECT/GROUP BY - column must appear in the GROUP BY clause or be used in an aggregate function

Both the following two statements produce an error in Postgres: SELECT substring(start_time,1,8) AS date, count(*) as total from cdrs group by date; SELECT substring(start_time,1,8) AS date, count(*) as total from cdrs group by substring(start_time,1,8); The error is: column "cdrs.start_time" must appear in the GROUP BY clause or ...

How do I create a link to a specific Post object in a Rails view?

I am new to rails so excuse any easy questions. I have developed a blog and I am doing some customization. Just curious, if I want to render a specific post on my index.html.erb page is that possible. For instance if I create a post, title: Cool Post and it has a post_id of 25 in the table, in my index page can I call that specific post ...

rails paperclip default image with S3

I'm trying to use the default_url in my application but I store the images using S3. I'm not sure what URL I need to put in there or if I have to create a fake image just to get everything up there. Since my images always render through S3, I don't know if it would work if I just put in some default images in my public folder. It doesn'...

problem with if statement in Ruby on rails

I know this is probably rather trivial but i have had a lookt at previous questions and i've tried them but they still issued an error unfortunately :s My issue is the following, i have an html.erb file and i want a certain body text to be display given a condition or another if it is false i have <% if [email protected] do %> more cod...

Could not find the association problem in Rails

I am fairly new to Ruby on Rails, and I clearly have an active record association problem, but I can't solve it on my own. Given the three model classes with their associations: # application_form.rb class ApplicationForm < ActiveRecord::Base has_many :questions, :through => :form_questions end # question.rb class Question < ActiveR...