How do I tell if rails is running under a web server, as opposed to a script or irb?
For context: I'm tracking an ActiveRecord object, and I want to email alerts if the objects changes, but only if the changes came through the web interface.
...
I have a self join through an intersect table in an app I'm working on like below.
class User < ActiveRecord::Base
has_many :clients, :through => :client_relationships, :conditions => "approved='1'", :source=>:user
end
It's working in the sense that I can say @current_user.clients and get all of the clients. However, I'd like to s...
Im about to turn in to my school library a project which was done on rails.. this project is to be stored in a cd so that the school can have a copy of all my work for future reference if anyone wants to.... I want a simple way for people to install my project.. right now, my app depends on several migrations I made throughout the develo...
I'll preface this with the fact that I'm new to RoR. I have a class that resides in a nested module, ::Physical::Users::User. The code is organized into paths such as app\controllers\physical\users.
My problem comes when I try to use form_for like this:
<% form_for @user do |f| %>
...
<% end %>
I get the error ActionView::Templ...
In an Rails app I want to modify the DOM of a web page using javascript
Can I save the resulting HTML (of the whole page) after each modification to a database?
Thanks.
...
Hello everyone !
I am currently trying to use the Pickle gem for my cucumber test in ruby and rails. I use blueprints.
If I have a User class, with an id as primary key, and a "name" and a "best_friend_id" as attributes. How can I access to the id of the first User "Toto" to fill the best_friend_id field of "Titi" in my Pickle steps?
F...
Let's say I want to trend all comments posted on a site and create dynamic tags. For example, If there are x number of comments that contain the word iPad I would like to create automatically create a tag called "iPad" and put it in a tag cloud.
Is this possible? I checked out the acts_as_taggable gem but it requires one to specify a ta...
So I just started with Rails and right now looking over HABTM. I am reading the DHH book and I see that he has two models namely article and user. They have HABTM relationships. I am wondering however whether I need to create a separate migration for the articles_users model by myself or will Rails do it for me?
If so, what happen if I ...
hi,
in will_paginate, i am using custom pagination.
Here, i am adding image for pagelinks as well as previous_buttons and next_button.
I get same image for both pagelinks and (prev, next buttons)
I want to differ the pagelink images with (prev,next buttons) i.e two different images in all.
i applied code from below link to my applic...
Hi
I am using following versions of Ruby and Rails on arch linux
[hardik@sunshine: kandibank ]$ ruby --version
ruby 1.9.1p429 (2010-07-02 revision 28523) [x86_64-linux]
[hardik@sunshine: kandibank ]$ rails --version
Rails 2.3.8
I am using the sqllite database in development mode.
I can store a string having German special character...
Can anyone suggest some good resources, preferrably free, that I can read to thoroughly understand the basics of getting my web app secure?
It is being written with a Rails back-end, and regular HTML, CSS, jQuery front-end.
For instance, the proper security practices for handling users login. To storing info in the db, to anything else...
Hello, first question, hopefully I don't mess it up :)
A bit of a Ruby on Rails newbie (also Ruby newbie) and have stumbled upon a problem with the intended behavior of the application.
I have a file_column :image in model picture that belongs to model product, which can have many pictures.
The file_column works just fine when used as...
I have just inherited a medium sized Rails application and I want to try to optimize it right away. I want to start with the database to ensure that indexes are placed where they need to be an so forth. I therefore need to quickly find out all possible SQL statements that ActiveRecord might make so that I can compare that with the databa...
I have installed Rails 2.2.3 in Ubuntu 10.04 through the repository. After found that it is not the newest version, I decided to install it through RubyGems. So how do I specify which Rails version to use when I start a project?
...
I have 3 models, say Account, Comment and Status. Each Account will have many Comment and Status, but Comment and Status are not in any kind of relationship.
I would like to query the Account's Comment and Status, and sort these comments and status by time. How can I make this?
Thanks all.
...
Hi,
I'm using a pre-commit hook for Git that checks the syntax of my files before I can commit them.
In a Rails 3 app (I'm using the new form helper's syntax : <%= form_for @article do |f| %> but I get a syntax error, not when I use the app, but when I check for the syntax through the ruby CLI command or the Textmate's bundle command.
...
I would like this custom step:
Then I should see the link 'foo'
and his opposite:
But I should not see the link 'foo'
In the page I can have something like:
lorem foo bar
or alternatively
lorem <a href=''>foo</a> bar
I need to test when 'foo' is a link and when isn't. Thank you.
...
I am reading "Pragmatic Agile Web Development with Rails (2th ed)" and trying examples from this book. But when I am trying one of examples I have got error.
So:
I have created a model for a product
ruby script/generate model product
Filled the fields:
class CreateProducts < ActiveRecord::Migration
def self.up
create_table :p...
Hi,
In my rails app, I am setting up my own admin with the help of http://github.com/linoj/gridify. That works really well with one exception: HTML gets rendered in the table view which blows the cells up like crazy. I use
white-space:nowrap;
in my css which helps against other formatting trouble.
I still need to either get rid of...
I have one model say user, that can live in multiple towns (represented as another model). If I create a new user I have to choose (and edit) the different towns that they live in. Due to time constraints, I often end up with a "hackyier than I would like" solution involving something like: http://blog.hasmanythrough.com/2006/4/20/many-...