ruby-on-rails

A question in rails db:migrate

Now , I execute the command line "rake db:migrate" on the window OS, but I got the problem in the console. it print couldn't find HOME environment -- expanding~/.ruby-uuid'` who can help me to solve this ? Thank you and best regards! I think i should add the home path in the window environment . but i don't know ,which folder should i ...

Using jQuery UI with Rails

Hi, I am using jQuery in my Rails App. But when I try to turn my button to jQueryUI(Cupertino theme) button, it does not appear to be look like a jQuery UI Themed button. jQuery works because I am using it for Ajax and it works properly. I have pasted the code. Please tell me whether I am doing it wrongly <%=stylesheet_link_tag 'jquer...

How do I search for a phrase using search logic?

Imagine case scenario, you have a list of recipes that have ingredients as a text. You want to see how many recipes contain "sesame oil". The problem with default searchlogic searching using Recipe.ingredients_like("sesame oil") is that any recipe with sesame AND oil would come up, when I'm searching for "sesame oil" which is a problem...

how do I create a custom route in rails where I pass the id of an existing Model?

I created the following route: map.todo "todo/today", :controller => "todo", :action => "show_date" Originally, the 'show_date' action and associated view would display all the activities associated for that day for all the Campaigns. This ended up being very slow on the database...it would generate roughly ...

Ruby on Rails - Create Entity with Relationship

I'm new to rails, so be nice. I'm building a "rolodex" type application, and this question is about the best way to handle creating an entity along with several relationship entities at the same time. For (a contrived) example: My application will have a Person model, which has_one Contact_Info model. On the create.html.erb page for P...

How to set session variables with app.get() in Ruby on Rails console?

How can I manually set session while calling app.get() in script/console? For example I want to access an authorised page, but it always redirects me to sign-in page. How can I set the session before calling app.get() so that I can make an authorised call to that page? ...

Rails 3.o MYSQL connection problem

Hi I have installed RVM in my ubunut linux box and configured the Rails 3 app in that ... i can able to start app server... my problem is when i invoke http://localhost:3000 . i getting the follwing error Mysql::Error (Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)): I checked mysqld service...

Features/Projects that exist in RoR but not in Django

I am looking for projects or features that exist in Ruby on Rails but not in Django. ...

What database backends are readily available for Ruby on Rails?

In the introductory tutorials, it talks about MySQL, Postgre and Sqlite3. Is anything else supported out-of-the-box? Are there any plugins to support other databases? I'm mainly interested in NoSQL - Cassandra, CouchDB, etc. Thanks ...

Correct display of a string...

How to display a string in correct format as i enter it in the textarea in ruby on rails? actually i enter some string in the textarea as: my name is jamal. now there is a next line starting after name... but i get the following in the view... my name is jamal which i don't want to be like that... so, how to get the correct format..?...

How can I force the user to fill out a captcha after a specific number of failed login attempts with authlogic?

I'm trying to secure my rails 3 app against brute force login guessing. I'm using authlogic. What's the best way to force a user (or bot) to fill out a captcha after a specific number of failed login attempts? Does authlogic have a built in mechanism for recording how many consecutive failed attempts came from the same ip? I'd appreciate...

Are there any stable solutions for using Rails 3.0 and Facebook together?

I've seen reports that Facebooker doesn't work with Rails 3. I've noticed that there's a Facebooker2 project, but it doesn't seem to have any documentation and there's no information I can find about its Rails 3 compatibility. Are there any good choices for getting Facebook Connect working with a website built on Rails 3.0.0 (beta4)? ...

How do I install forked gems on heroku?

I'm trying to get Heroku working with European buckets on amazon s3 webserivces using the aws-s3 gem. It seems I need to install a forked version of the gem to get around the issue. However, with heroku I can only use the .gems file to install gems. Can I use this .gems file to install forked-gems somehow? ...

Invoke rake task from ActiveRecord observer

Can I do the following? def ModelObserver < ActiveRecord def after_save Rake::Task[name].invoke end end At the moment, this returns the following error: Don't know how to build task 'name' Any idea? ...

how do i get name of the month in ruby on Rails?

so i create in my view: <%=date=Date.today%> How do i get the name of the month out of the date? I was trying to do sth like <%= DATE::ABBR_MONTHNAMES(date.month)%> But without success. I keep getting an error: uninitialized constant ActionView::Base::CompiledTemplates::MONTHNAMES How do i initialise the constant or is the...

Are there any limits on length of string in mysql?

I am using mysql data base with rails. I have created a field of type of string. Are there any limits to its length? What about type text? Also as text is variable sized , I believe there would be extra costs associated with using text objects . How important can they get , if at all ? ...

Lightbox getting open multiple time on enter.

Hi All, I am going through a weird problem while using lightbox . Where ever the new light box is used user is able to open the same light box on same page number of time. For e.g Using tab button go to `Lightbox link`. Press enter --> Light box will open. Press enter --> second light box open below the previous one. and so on....... ...

Log your SQL in Rails application inside unit test

I want to install a logger so that I can dump all executed SQL of my rails application. Problem is, such logger is associated with AbstractAdapter which initialized very soon under test mode, and thus cannot be set by my initializer code. I try to put ActiveRecord::Base.logger = MyCustomLogger.new(STDOUT) in the end of environment.rb...

Rails 3 plugin css

Is it possible to have public directory in my plugin? I want to use css and javascript from my plugin folder, not from /app. ...

how to bind association in RoR

I have two tables, AppTemplate and AppTemplateMeta AppTemplate table has column id, MetaID, name etc. I have associated these two model like this class AppTemplate < ActiveRecord::Base set_table_name 'AppTemplate' belongs_to :app_template_meta, :class_name => "AppTemplateMeta", :foreign_key => 'MetaID' end If we fetch data using...