Hi, I'm testing the following:
Account
class Account < ActiveRecord::Base
has_many :ownerships
has_many :brands, :through => :ownerships
end
Ownership join model
class Ownership < ActiveRecord::Base
belongs_to :brand
belongs_to :account
end
Test
it "should be able to apply for brand ownership" do
account = Account.cre...
I've got a blogs_controller with a Blog resource, so I've got your typical routes right now as follows:
/blogs/new
/blogs/1
/blogs/1/edit #etc
But here's what I want:
/blogs/new
/blogs/2010/01/08/1-to_param-or-something
/blogs/2010/01/08/1-to_param-or-something/edit #etc
...
/blogs/2010/01 # all posts for January 2010, but how to spe...
Lets say I have two tables.
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :type, :default => 'User'
t.string :user_name, :null => false
t.boolean :is_registered, :default => true
# ... many more fields
end
end
end
class CreateContactInfo < Active...
I am a beginner in Rails,
Can we use :source with named scope?
I am able to use it with has_many and other associations
Thanks
Mark
...
I need to provide some kind of global search over most of the data that my application have. The data is distributed in different tables, like users, comments, etc. in MySQL.
I do want to handle this in the application, not with something like Google Custom Search.
My idea is to create table, which would have columns like source id and...
I'm using the sample extjs status bar, the one with the word count demo. I set the name and id of the text area within my JS file to match the other form items on the page (in this case something like, user_description and user[description]) However when it throws back an error with validation of the description being over my limit, it "...
I've been following quite a bit of tutorials and digging around source code and I finally got the barebones of my application setup and ready, and it worked!
I am doing this all locally so I went ahead and edited my /etc/hosts file to look something like this:
127.0.0.1 dewski.com
I can go to dewski.com and have it show my local site...
now i looking for solution on how to make a drop down select form that will have difference respond to corresponding selection...
for example i make a drop down selector for occupation...
when i choose information technology then it will show another selector which is specify to show only when the user choose informaion technology...that...
I have been trying to connect to a web service that is using digest authentication.
I am able to connect in Safari using user:[email protected]/endpoint
I have tried in Ruby and Rails to connect using HTTParty and Net:HTTP using the "basic"auth" options, but have not had any luck.
Wondering if the HTTParty/Net:HTTP "basic_au...
So I'm doing some screen scraping with this rails app I author, and when I go to insert some text from the page into the database ... rails refuses to do it (inserting empty strings into the db column instead). I looked more closely and realized that it was doing it if the string contains 'weird' characters.
Weird character would be som...
My models produce a lot of values for attributes which the user can not specify in any forms.
Should I be specifying validations for those attributes to prevent any of my model logic creating dodgy values or is that something I should just check for in my tests?
...
I tried do
gem1.8 install passenger
but I get the following error
ERROR: could not find gem passenger locally or in a repository
Which I don't understand, cause it clearly is in the repository
gem1.8 list -r | grep passenger
returns
colouringcode-passenger (0.1)
passenger (2.2.9)
passenger-recipes (0.1.2)
passenger_debugger (0...
Normally I would install phusion passenger via the gem command, but this wouldn't work for me, so I had to install it via a tarball and then run the installer.
My question is, how do I uninstall it?
dpkg -l | grep passenger
doesn't return anything. When I list the installed gems, I don't see anything either.
So i guess I have two q...
I'm building my Rails template right now. Rails template is a way to generate
a skeleton app.
http://railscasts.com/episodes/148-app-templates-in-rails-2-3
http://m.onkey.org/2008/12/4/rails-templates
I would like to add some gems to test.rb and development.rb, but not environment.rb.
But I don't find a way to do so other than manua...
According to (somewhat official) this guide, I can make a radio button's label make the selection for that radio button too. They say,
Always use labels for each checkbox and radio button. They associate text with a specific option and provide a larger clickable region.
Unfortunately, I have not been able to get this functionality...
I would like to do something like github has with nested urls, and like http://stackoverflow.com/questions/1863292/how-do-i-route-user-profile-urls-to-skip-the-controller but not really sure how to go on with it.
For example, looking at a commit they have: ':user/:repo/commit/:sha', with the controller being commit. How would I replica...
Can I use stored procedures with ruby on rails ?
I am using mysql as database and ruby on rails.
please provide me any of the example for this.
...
I'm having a rough time with Apache and my Rails app on my production server. I have everything installed, libraries, gems, the whole get down. The issue is that I get a "Forbidden" error in my browser. I've even chmod'd my app directory with "777" but still no luck.
So my questions are:
What is your ServerName Directive (in your virt...
I install spree version 0.9.4 with gem install spree and run a set up command spree mystore and get this errors messages. Have anybody experienced this whether in spree or not ?
D:\Workspaces>spree mystore
C:/Program Files/BitNami RubyStack/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:280:i
n `activate': can't activate rack (>= 1.0.1, runtim...
What's the cleanest way to convert data (field values) when storing/loading into/from a database.
I usually convert the values the user has entered in the model class:
def date_str
format_date(self.date)
end
def date_str=(str)
self.date = DateParser.parse(str)
end
(Note: The internal date parser is not sufficient, i...