For a simple rails application ( 1.86 /2.3.5) , lets say I run a simple scaffold
script/generate scaffold blog title:string content:text published:date
When I open up the new / edit view for the blog controller in index/new.html.erb , I see that the drop down enabler for date select has a date range of 2005 - 2015 , i.e 5 years +/-
...
Does anyone know if activemodel works with 2.3.5? I'm looking for this exact functionality (namely, validations for non-AR objects) and I'm trying to find a clean solution for a Rails 2.3.5 app.
Or if anyone knows of a good gem/plugin to use that can mimic activerecord like validations for non AR objects, I'm all ears
...
NOT a Rails 3 issue
In a Contact model I have a company_name attribute. For reasons that don't matter to this question, I want to prohibit an ampersand character. We have a lot of clients with ampersands in their company name, and users forget they aren't allowed to use this character.
This isn't an html sanitize issue. I don't care ab...
I have 2 models, Users & Accounts. They are in one-to-many relationship, i.e. each accounts have many users.
Accounts
company_id company_name company_website
Users
user_id user_name password company_id email
How can I add these entries to database using ActiveRecord? Supposed I don't is the company existed i...
I am developing an application in Rails 3 using a nosql database. I am trying to add a "Follow" feature similar to twitter or github.
In terms of markup, I have determined that there are three ways to do this.
1) Use a regular anchor. (Github Uses This Method)
<a href="/users/follow?target=Joe">Follow</a>
2) Use a button. (Twitte...
I am trying to figure out how to submit a search query get variables as /search/query instead of /search?search=query. Any ideas?
...
I tried running bundle install in our production server, but I encounter this problem:
Updating
git://github.com/collectiveidea/delayed_job.git
fatal: Refusing to fetch into current
branch refs/heads/master of non-bare
repository An error has occurred in
git. Cannot complete bundling.
I have bundler version 0.9.25 install...
Have a model called contact_email.date_sent
I want to be able to run a report which displays all those where the date_sent range is between date.today and date.today 5 days ago.
I assume I use something like
@send_emails = Contact_Email.find(:conditions=> ???)
But not clear what exactly is the best way. Thanks!
...
Hi guys,
I can't seem to figure this out. I setup my email address in cruisecontrol.rb but no matter how I set it, it always gives me this error.
Current settings are:
project/cruise_config.rb:
project.email_notifier.emails = ['[email protected]']
project.email_notifier.from = '[email protected]'
site_config.rb:
ActionMailer::Base...
I'm using the latest rails 3 beta. The app works fine in development mode, but when I start the server in production mode via rails server -e production, it seems that the public folder can't be found. I get error messages like:
ActionController::RoutingError (No route matches "/javascripts/jquery.js"):
And similar messages for everyt...
I am starting to use some nested routes which is definitely a different way of planning things and I'm really failing to see added benefits.
So what are they?
...
There is good documentation out there on testing ActionMailer send methods which deliver mail.
But I'm unable to figure out how to test a receive method that is used to parse incoming mail.
I want to do something like this:
require 'test_helper'
class ReceiverTest < ActionMailer::TestCase
test "parse incoming mail" do
email = T...
HI
i was wondering if there is a way to check what is the current selected value in a drop down list using selenium ruby?
thanks
...
I'm trying to construct URLs in the format http://servername/find/by/CRITERION/VALUE
CRITERION is a finite set of strings, as is VALUE. Trouble is, VALUE needs to be an IP address in some situations, and it's causing me a routing error.
Here's my route:
map.find 'find/by/:criterion/:query', :controller => "find", :action => "by"
...
I have a rspec mocked object, a value is assign to is property. I am struggleing to have that expectation met in my rspec test. Just wondering what the sytax is? The code:
def create
@new_campaign = AdCampaign.new(params[:new_campaign])
@new_campaign.creationDate = "#{Time.now.year}/#{Time.now.mon}/#{Time.now.day}"
if @new_campaign.save...
For example, I might have an partial something like:
<div>
<%= f.label :some_field %><br/>
<%= f.text_field :some_field %>
</div>
which works for edit AND new actions. I also will have one like:
<div>
<%=h some_field %>
</div>
for the show action. So you would think that all your partials go under one directory like shared or...
Sorry about the vague title, but i didnt know how to ask the question in one line :)
I have an order with nested itemgroups that again have nested items. the user specify the amount of item that he would like to have in each itemgroup. I would like to create these items in the create method of the orders controller when the order itself...
Hello,
I have a Rails application that connects to a legacy database (Oracle) and displays some information from a particular user. Right now the user is passed as a URL parameter, but this has obvious security issues because users should only be able to see their own data.
To solve that, I want to implement a user login, and I did som...
If I'm on a route alias such as /register and I have a form error and I render :new, is it possible for the path to be /register still?
At the moment it is rendering /new
I could do a redirect_to register_path but then I would lose the params?
It's making the following test fail:
Scenario: Try registering with a bad staff number
Gi...
read/write_attribute is a great way to enhance default accessors generated by ActiveRecord. Like this for example:
def price
read_attribute(:price) or "This item is priceless and you are by the way #{User.current.login}"
end
The same however does not seem to be working with associations.
Demonstration:
class Product < ActiveRecord:...