Since the latest Rails 3 release is not auto-loading modules and classes from lib anymore,
what would be the best way to load them?
From github:
A few changes were done in this commit:
Do not autoload code in *lib* for applications (now you need to explicitly
require them). This makes an application behave closer to an engine
(code...
I know this is not best practice, and most likely shouldn't even be used, as thats what migrations are used for, but I was wondering if its possible to execute migration specific commands in a regular rake task. Something like:
namespace :dummy do
task :update => :environment do
add_column :users, :deleted, :boolean, { :null =...
I'm using macvim/vim for most of my Ruby + Ruby on Rails development. Is there currently a way to jump to where a method was defined within a project, even if it's not in the same file as where it's being invoked? Either a language agnostic way or a Ruby/Rails specific way works.
...
I am using table_builder plugin and I am getting the following error
undefined method `safe_concat' for ActionView::Base:0x00000100a81ef0
What is safe_concat method and Can someone please tell me what am I doing incorrectly
View Code
<div id="event">
<% calendar_for @events do |calendar|%>
<%= calendar.head('mon', 'tue',...
Authlogic, by itself, seems to be too active record centric for MongoDB (specifically mongomapper) as per: http://github.com/binarylogic/authlogic/issues#issue/15.
However, there's an interesting authlogic plugin for mongo that looks pretty awesome, and simple.
Has anyone used this, or have any experience/recommendations for an authlo...
I am new to rails and read this guide to get all the info so far.
I have a simple scenario and want to make sure whether or not my associations will work fine.
Scenario:
User logs in -> sets up many groups -> each group has many employees
User model:
class User < ActiveRecord::Base
has_many :groups
end
Group model:
class Gro...
I am working on a search function on RoR that basically just has a cool visual effect when a user clicks the search button.
Here is the code in my view for search.rhtml
<html>
<head>
<title>Tutor</title>
<%= javascript_include_tag :defaults %>
</head>
<body>
<h1></h1>
<%= form_remote_tag :url =>{ :action => :s...
The way this program needs to work is like this:
A person can view an event and then choose to either register directly for an event or for a team (which is registered for an event).
class Event
has_many_polymorphs :registrants, :from => [:users, :teams], :through => :registrations
end
class Team
belongs_to :registrant, :polymorphi...
Background: I have a java library that is accessed by many developers - usually via java. However, a few devs hope to access this via a Ruby API. I am gravitating in the direction of Jruby in order to implement a Java-Ruby API.
Questions:
My main concern is that these developers will not be able to utilize the API in their current, R...
hi,
Course.find(:all, :group =>:id, :order => 'updated_at DESC', :joins=> :students :conditions => { :students => { :first_name=>"John", :status => 1}})
looking this query, passing the conditions as a hash, there is a way to:
construct a where :first_name not null?
construct a where :first_name != "John"?
...
Hi I am trying to understand why I get a syntax error for this:
:conditions => ["rank = ? and primaries.relationship = ?", ['CPT','SFC'], "Spouse"]
I need to check "rank" against an Array of options.
Seems like this should be pretty simple, any suggestions?
...
Using rails, consider:
> p = Post.new
> p.author = Person.find(1)
> p.author_id = 99
> p.author_id
=> 99
> p.author
=> #<Person id:1, name: "Person 1">
What I've never understood: is there a conscious decision cq some reasoning behind not clearing the +author+ value after the +author_id+ is set? Is there a plugin of some sorts that...
Hi,
I'm struggling to get my head around how to implement UJS in Rails (specifically, Rails 3 with jQuery). I've worked through Ryan's Railscast, and can follow what to do when submitting a form via AJAX, but I'm having trouble extending this concept to attaching a javascript function to a html element in my view files. Ultimately, I wo...
I don't really care about testing file uploads, but since I have validates_attachment_presence, etc.. in my model, rspec is complaining.
So now I'm creating my model with these attributes in the spec to try and shut it up:
@attr = {
:name => "value for name",
:title => "value for title",
:content => "value for content",
:pic_fi...
If i have
class User < ActiveRecord::Base
has_many :books
end
.
class Book < ActiveRecord::Base
belongs_to :user
end
Question:
When i save an instance of Book, will it call save on its associated User as well?
In my code base im finding that when i call @somebook.save, 'User's after_save callbacks are being executed.
...
I have a Rails app that includes a JSON API interface. When values are properly specified, the controller handles the happy path just fine and JSON is rendered as output.
However, if there's a problem with the input, an exception is raised and some templates in rescues are rendered instead. I'd really just like to return a JSON error al...
I have a rails form that has a datetime input.
I'd like to make the date input a single text box which the user will input in MM/DD/YYYY format (or via a jQuery datepicker) and then have the time inputs be 12 hour based time drop downs. I found this plugin - http://code.google.com/p/rails-twelve-hour-time-plugin/ - to handle the 12 hou...
Hi,
I've a controller that defines the @projects variables to be displayed in the view.
There is any way to access to that projects in the cucumber step?
Note that this variables contains the paginated results, the idea is to test if the values are being displayed in the page.
I've tried to access the variable through assigns and cont...
So, whenever I run "rake spec" in my application directory, I see this:
admin@nurvus:~/workspace/spec $ rake spec
(in /Users/admin/workspace/)
DEPRECATION WARNING: Rake tasks in vendor/plugins/abingo/tasks, vendor/plugins/delayed_job/tasks, vendor/plugins/funkytown/tasks, vendor/plugins/funkytown/tasks, vendor/plugins/git_helper/tasks, ...
Provided that I have a project factory
Factory.define :project do |p|
p.sequence(:title) { |n| "project #{n} title" }
p.sequence(:subtitle) { |n| "project #{n} subtitle" }
p.sequence(:image) { |n| "../images/content/projects/#{n}.jpg" }
p.sequence(:date) { |n| n.weeks.ago.to_date ...