I am actually using Rails 3.0, so it is rails console vs rails runner try.rb. The following code runs well in the console but not as a script with runner. I need runner (instead of using ruby try.rb) because there are some ActiveRecord code for the project.
Update: I couldn't run it inside of myproj\lib\tasks\ (when the current direct...
Hello,
Let's say we have the following pages
clip/show/111
image/show/222
sound/show/333
where 111,222 and 333 are the IDs for different contributions
I developed a new controller called "show" that will detect ID and redirect to the right controller
show/show/111 will redirect to clip/show/111 and so on
what I want is to render the p...
I don't know why but when I run rake commands in my rails project, nothing happens. Also rails server does nothing. Any suggestions?
...
HI ,
i am new to ROR
i am writing Ruby code for calling API blogs
i have written ruby code for
Creating the blog by
require 'net/http'
require 'uri'
url = URI.parse('http://localhost:3000/api/blogs/create.xml')
req = Net::HTTP::Post.new(url.path)
req.basic_auth 'a', 'a'
req.set_form_data({'blogpost[title]'=>'TestingAPIBlogposttitle...
Hey,Guys.
Now i have got a question after i view the index page of rails project.It got the error as this
NameError in HomeController#index
uninitialized constant ActionWebService::Dispatcher::ActionController::Base
In the script/console ,it reproduce the error.
>> ActionWebService
=> ActionWebService
>> ActionWebService::Dispatc...
Hi,
I am having trouble mocking authlogic from shoulda.
I have the following test fixture:
class HomeControllerTest < ActionController::TestCase
context "on GET to index" do
setup do
activate_authlogic
UserSession.stubs(:current_user).returns( user_session )
get :index
end
should respond_with :success
...
Hi,
I'm wondering how to write a cucumber feature and spec to check the following validation
Field email, here is the validation in the model
validates :email, :presence => true,
:length => {:minimum => 3, :maximum => 254},
:uniqueness => true,
:format => {:with => /^([^@\s]+)@((...
I'm trying to upgrade my rails application to Rails3.
When I run functional tests, I get a lot of NameError: uninitialized constant Test::Unit::AssertionFailedError errors. But unit tests and website itself seems to work fine.
Trace looks like this:
NameError: uninitialized constant Test::Unit::AssertionFailedError
/Users/mantas/.rvm/...
Example:
result = ActiveRecord::Base.connection.execute("select 'ABC'")
How can I get the 'ABC' value from result? Tried result.first without success. Thanks
p.s. Gems:
activerecord (2.3.9)
mysql (2.8.1)
...
I’ve scoured the Internet via Google and could not find if it is possible to host ASP .Net and Ruby on Rails on the same server!
Do you know if it is possible?
If not, would I be able to do this?
– www.abc.com – redirects to Page A (hosted on Ruby on Rails server)
– jobs.abc.com OR www.abc.com/jobs - redirects user to Page B (hoste...
Hello I want to write a small blog with Ruby on Rails (3), with posts and comments submitted via a ajax form.
But when I submit a comment it is often shown twice, and I got no idea why.
when I write @post.comments.uniq in the _create.js.rjs file, it works fine but this seems not to be a clean solution.
When I reload the page without aja...
I have a question about Rails database.
Should I add "index" to all the foreign keys like "xxx_id"?
Should I add "index" to the automatically created "id" column?
Should I add "index(unique)" to the automatically created "id" column?
If I add index to two foreign keys at once (add_index (:users, [:category, :state_id]), what happens? H...
According to the documentation on Thinking Sphinx it should be possible to add a filter condition on id, but the following code does not give any results:
User.search(:without => {:id => [1,3]})
What am I doing wrong?
Is there another way of doing this?
...
Hi guys,
I want to execute a simple thing. When the user clicks the link jQuery needs to generate an Ajax request which sends the id of the link item to a method in the controller. Basically I want a nice looking modal dialog window when the user clicks the delete link. That window needs to contain various info about the deleted items.
...
I'm looking for a helper that changes link_to behaviour if the file is a PDF, i.e. displays a tooltip.
How can I write a helper that overrides link_to only if the file is a pdf?
...
I am brand new to Ruby on Rails and I have been trying to get a simple default route set up and working. When I try to run my application I get a blank result (if I do a view source, there is nothing there).
Here are the relevant files (not sure if I am missing something that would be useful).
app/config/routes.rb
Blog::Application.ro...
When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ?
And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ?
...
I am working on Rails 3
If I run my application in IE8, I am getting error as :
"Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience."
I tried few technical solutions but they didn't work.
After wards I removed prototype.js & error was removed. If I again include prototype.js, again er...
Hi, I'm a newbie with rad rails. I wanted to write at same time in two table from one form.
I have a table machine (with nom and role as column) and a table ipvfour (with machine_id and ip as column).
So I created in models the relation has-and-belongs-to-many.
But when I'm trying to add a new machine if failed with
unknown attribut...
Rails 3 newbie here.... I'm looking to build an application that limits a user's viewable data to their company, which is based on their email's domain. Very much like Yammer or basecamp. I'm currently using devise for auth...
I'd like a User's table and then a UserInstance Table... The UserInstance table would look like:
ID | domain ...