I'm trying to put some specs around a new rails 3 project I am working on, and my first test doesn't seem to be able to find a model.
I've installed rspec from the command line using:
sudo gem install rspec --pre
and then I put the following in my Gemfile
gem "rspec-rails", ">= 2.0.0.beta.1"
But when I run my test I get
./spec/mo...
Hi All,
I am having problem that when i am trying to submit the form by clicking on the submit button it takes some time to post request during this if i am again click on the Submit button it will again send the all parameters and parametrs get saved twice, thrice ....so on.
I don't know how to limit the the submit button so that form...
Hello everyone!
Newb in Rails
i Have this problem that i cannot figure out. I've followed the sample blog dimostration form the ruby doc but now i have a problem.
Let's say that in the app index page for each post i also want to show the first comment of that post.
sure i need to cycle all the post to get the post id but how can i g...
I'm interested as sometimes I get friends who are developers telling me about their Ruby deployments, and most of them are in large enterprises which are using Java mainly, but have some small projects in Ruby on Rails.
...
I have Bitnami Rails stack installed on my Mac. To better explain my problem i created a simple scaffold based rails app with mysql as the backend. I can get to perform simple POST and GET requests for a while and after a few requests the app just hangs indefinitely. No exception caught or anything worthwhile in the development log to re...
Hy,
My code:
@profile.images
and i would like to get only 10 images at time and with a 10 offset, like this
@profile.images(:limit => 10, :offset => 10)
and not like this
has_many :images, :limit => 10, :offset => 10
Then I would like to count in someway all the images for that profile.
@profile.count_images
Thanks (:
...
I'm building my first website with rails,it consists of a blog, a few static pages and a photo gallery.
The admin section has namespaced controllers.
I also want to create a mailing list, collecting contact info,
(maybe a spree store in the future too.)
Should I just use basic http authentication and check if the user is admin?
Or is a ...
Hi to everyone! I use Netbeans 6.8 with Ror. If i click "AutoDetect Platforms" , IDE detect Ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux], but when i try to create RoR project, it says that Ror not detected.What could be wrong?
...
I'm trying to make a statistics page where it will show several data and charts.
The charts need to be pictures so that the user can save it/drag-and-drop to his/her personal reports.
I'm using Gruff Graphs for Ruby to produce the charts but I don't know the best way to display the results safe and protected.
Some of my ideas/tries are...
I'm using a Observer on my classes. When one of the records is created/updated I need to notfify another service (via a URL call). What is the best way to do this to avoid slowing down my class? Would using a gem liked delayed_job be overkill?
In my Observer's after_update() / after_create() I just want to launch a thread that calls the...
Hi,
I have seen many resources on using jQuery with rails where people recommend having callback functions in .js.erb files, however I have also heard that passing data this way leaves me vulnerable to man in the middle attacks. Is this true? What are the security concerns and is there a way to do it safely?
Thanks
...
c = "(f.profile_id = #{self.id} OR f.friend_id = #{self.id})"
c += AND + "(CASE WHEN f.profile_id=#{self.id} THEN f.friend_id ELSE f.profile_id END = p.id)"
c += AND + "(CASE WHEN f.profile_id=#{self.id} THEN f.profile_rejected ELSE f.friend_rejected END = 1)"
c += AND + "(p.banned = 0)"
I need this to be used in a has_...
When I place this in my base application html.haml file:
= javascript_include_tag :defaults, 'jquery-1.3.2.min', 'highcharts'
<!--[if IE]>
javascript_include_tag 'excanvas.compiled'
<![endif]-->
%script{:type => "text/javascript"}
$(document).ready(function() {
= yield :javascripts
});
I get a textual description of a graph that is su...
I have an Organization that has_many Affiliations
And a mission that has_one Organization
So i can do this:
m = Mission.first
m.organization.affiliations
A user also has_many affiliations so I can do:
u = User.first
u.affiliations
In declarative_authorization I want a user to be able to manage a mission if he is affiliated to the...
I'd like to restrict access to my Rails app (running on Apache/Passenger) to just two IPs, but if the visitor doesn't fall into those two IPs, I would like for him/her to be prompted to enter a password that would allow any user with the proper credentials to access the site from anywhere.
I am new to configuring Apache and would apprec...
I think I'm missing something very obvious and its making my brain hurt.
class User < ActiveRecord::Base
has_one :profile
class Profile < ActiveRecord::Base
has_one :user
belongs_to :team
I have a partial that loops through the users and print some basic info, I'm using this partial in my team show page.
I had originally written thi...
I'm using the activerecord-jdbc-adapter with ActiveRecord to be able to access a SQLServer database for Rails Application running under jRuby and am having trouble inserting binary data. The Exception I am getting is below. Note I just have a blurb for the binary data from the fixtures that was working fine for MySQL.
ActiveRecord::Stat...
A Post belongs_to a User, and a User has_many Posts.
A Post also belongs_to a Topic, and a Topic has_many Posts.
class User < ActiveRecord::Base
has_many :posts
end
class Topic < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :user
belongs_to :topic
end
Well, that's pretty simple and very...
How can I count the table size in MySQL or PosgreSQL using a restriction? for example: WHERE organisation_id=1
...
First time I've come to use collection_select in a project and I've hit a wall with it.
A Profile has_one Team, Team has_many Profile.
In my view for editing profiles I have this.
<td><%= f.collection_select(:team_id, @team, :id, :title) %></td>
Which populates the drop down with titles of teams as expected. The couple of examples I...