Questions for ruby-on-rails


Can't view FILENAME.rhtml but can view FILENAME.html

I receive the following error message:

awesome_nested_set How to not select a parent?

I just got awesome_nested_set put in place and all is working well. I converted over from acts_as_tree using Category.rebuild! listed on the github link.

Create controller tests for Mongoid embedded models

I'm working on a Rails 3 app that allows users to follow movies by adding them to their queue, so that they're notified when the movies are premiering.

Why does this before_filter not execute?

So in my ClientsController.rb I have a before filter that does the following:

rewrite non www to www except subdomain rails 3 and rack

I need to be able to rewrite non www to www but NOT in the case when there is a (non www) subdomain present.

Rails versioning with point-in-time query

Is there a Rails 3 model versioning plugin that supports point-in-time queries (not just recovery) in an SQL database?

Run initializer only for Rake tasks

I'd like a certain initializer to run when executing a Rake task, but not when running the Rails server.

friendly_id and routes.rb - rails

I'm currently using friendly_id gem in rails and noticed that if someone names a post "About" that it overwrites the /about path that I have assigned to a static page in my routes.rb file.

Rails displaying images from a belongs_to model

I need to display multiple images for a a car from a separate linked table, i have the both models sorted with the belongs_to and has_many but on the main car page i need to show images from the li...

Rails 3.2 Rendering Associated Models in Same Form

i'm working through Hartl. Ive got to the microposts section in Chapter 10, but instead of microposts I have introduced Hotels, and now I want to add them to a separate address model, like in this

Rails Newbie: Appending conditions in activerecord?

I have a form which is used to filter queries. Some of the form attributes are optional; I'm just wondering how to append them as activerecord conditions if (and only if) they have a set value?

How should I model these relationships?

I have a post model. Each post has a title and many snippets.

Why is ruby responding that I've already mixed in a module when I haven't included it yet?

I have a class Ryte::Theme. If I call included_modules on the class I get back (abbreviated):

How to reverse an extend migration

I recently ran this migration while installing the fuzzily gem:

Sharing Rspec tests between classes

Hey all; in writing tests from controller to controller with rspec, I've found myself duplicating a few basic tests, such as this check for index:

Rails carrierwave testing - how to remove file after test?

I am testing the carrierwave upload functionality using rspec and capybara. I have something like:

Changing my 'seed' file - Rails

I have already seeded my user into the database, but now I would like to change one of those fields. It seems, like the migrations, I cannot just edit the file and run rake db:seed. That doesnt see...

Fetch COUNT(column) as an integer in a query with group by in Rails 3

I have 2 models Category and Article related like this:

Get foreign key field from associations in Rails

I want to know field name corresponding to table caption for a given model in Rails.

JQuery plugin use gives “undefined” error

Chrome on Rails on Localhost. Here's a trimmed version of the page:

Two models with an association of have_one to have_many possible in Rails?

I am making a rails site where you can schedule an appointment for a service. Currently I have an Appointment and Client model. Now I have decided that in order to get the Client's information (name,

How to choose a single model and persist that choice?

I have a simple model called Party with a corresponding table called parties. There's also a controller with all the usual CRUD actions and so on. This model is used in a website and only one admin...

Rails model without database

I want to create a Rails (2.1 and 2.2) model with ActiveRecord validations, but without a database table. What is the most widely used approach? I've found some plugins that claim to offer this

Rails won't save to database after tiny model manipulation

I'm coding my first Rails app at the moment and can't resolve this annoying error.

how to reduce number of similar queries

I'm making a very basic analytics feature for my Rails app. I want to provide statistics that tell users how many visitors have viewed their profile, and then also break those down according to the

Rails - Show all models that belongs_to this User

If I have a User that has_many :problems, assuming I have set up the necessary association between User and Problem , how can I do something like:

Adding a div element in rails

i am having a helper function as

what the best rails way to do the following

I've rails 3 app which displays records from a DB into table. I want the same method to check if the admin controller is used and if so add edit delete options to the table items.

Rails 3 multiple parameter filtering using scopes

Trying to do a basic filter in rails 3 using the url params. I'd like to have a white list of params that can be filtered by, and return all the items that match. I've set up some scopes (with many...

Kaminari pagination, how to get the number of the current page?

I am using Kaminari to paginate some results from a db query.

Why does Ruby “script/generate” return “No such file or directory”?

I am having trouble using script/generate. I am following the tree based navigation tutorial, which says to use script/plugin install git:// or script/generate

Ruby UTF8 encoding problem

I have a Ruby/Rails app.

Is there a Sublime Text 2 package that can find the call to render of a Rails view partial?

Sometimes I'll open up a partial view file in my Rails project using Sublime Text 2 and want to know where its call(s) to render come from (usually to debug my way through views that call partials ...

What does -> mean in Ruby

I've seen that in spree commerce.

Searching with thinking_sphinx and filtering results

I have this scenario where I thought it would be pretty basic, but found out that I can't really achieve what I need. This is why I have this question for a thinking_sphinx's expert.

Unable to access unescaped html in an RSS feed

I'm using the built in RSS capabilities of Ruby (RSS::Parser.parse) in a new rails app. The app reads several different sources of rss feeds that are outside of my control (public facing, built by

Ruby on Rails: Entering data from another database into a new database

I have two databases in my app. One is Projects, that holds data on projects created in the app and another is User that I made when installing the Devise gem that holds the usernames and passwords...

Cannot rescue error in Rails application

I am creating an application where a user logs into an Oracle Database and runs prepared queries. I would like to use ActiveRecord to help run the queries, but I am running into some issues.

Defining a different primary key in Mongomapper

I am defining a primary key in MongoMapper.

(apparently) identical tests for two rake tasks; only one passes

I'm trying to write tests in rspec for two rake tasks which are defined in the same file (in a Rails 3.0.11 project). For some reason only one of them passes. I've written a small demo to abstract ...

How to identify YML parse error

I'm getting the following error when I boot my rails 3.1.3 application:

Rails with backbone-rails: asset helpers (image_path) in EJS files

I have a Rails 3.1 app that uses the codebrew/backbone-rails. In a .jst.ejs template, I would like to include an image, like so:

Unexpected memcache GETs in rails 3.2 app

My rails 3.2 app is trying to fetch values from the cache (memcached via dalli) that I'm not expecting it to be caching. It's not getting any cache hits, but I'm puzzled about what is going on. This

What indexes should be added for a polymorphic association in Ruby on Rails?

I have a polymorphic association in a Ruby on Rails model. In the migration, I have:

Heroku + Rails + GeoIp = uninitialized constant GeoIP error

I'm trying to deploy my old website to the Heroku.

Rails Devise LDAP Error: NoMethodError in Devise::SessionsController#create

My team has setup my ruby on rails app to work with devise ldap. Whenever a user logs in for the first time, it creates a new entry in the Users model and works completely fine. But whenever a user...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.