hello!
has somebody from you followed this tutorial?
link text
I really don´t now why, but I got following fault, when I went through the tutorial word by word:
@album[photo_attributes]‘ is not allowed as an instance variable name
somebody an idea why?
...
G'day,
I am developing server application with Ruby on Rails and I'd like to store session token in each request's body. For example {"token":"asdkjahsdoahgfblkasblbag"}.
And I am stuck, really don't know how to configure authlogic to handle token from params, not via cookie. And how to prevent "set-cookie" header sending?
Thanks,
Ale...
i have a spree app generated and a few extensions.
now i´d like to test these extensions with shoulda and machinist, and without rspec.
somebody an idea how to change the testing environment for the extensions without changing the spree core testing environment?
mattherick
...
Hi
I am Having 3 Models
Category /
Issue /
Article
Where Article is taggable_on :topics and :sub_topics Using [acts_as_taggable_on plugin]
So what kind of relationship we have to maintain among these model and how we can retrieve category topics,sub_topics / issues topics and sub_topics
Thanks in advance
...
I'm developing a new rails application which is supposed to be installed several times in order to implement several sites.
There are some things, like the "Site Title" or the "Default Number of Items per Page" that clearly belong to a "global settings" table / config file.
I've made a list of the things I think I'll need:
ActiveReco...
From the book Agile Web Development With Rails
class Order < ActiveRecord::Base
named_scope :last_n_days, lambda { |days| {:conditions =>
['updated < ?' , days] } }
named_scope :checks, :conditions => {:pay_type => :check}
end
The statement
orders = Orders.checks.last_n_days(7)
will result to only one query to the data...
Hello.
I was wondering if people would share their best practices / strategies on handling exceptions & errors. Now I'm not asking when to throw an exception ( it has been throroughly answered here: SO: When to throw an Exception) . And I'm not using this for my application flow - but there are legitimate exceptions that happen all the...
Hi All,
I am creating a login form where username , passowrd and one checkboxed with label " keep me logged in Until I log out " i want to know is it a basic functionality?
what happened if i checked the checkbox and vice-versa?
i am using.
Any help is appreciated.
...
I am using Rails 2.1 to output tables from a database. But the output includes lots of extra lines and tabs. I am using a while loop with lots of nested if statements. I am also wrapping all of my non-output lines in <%- code -%>. Any idea what might be happening and a solution? Thanks,
NOTE: I keep attempting to paste in the code, and ...
How convert a string into a ActiveSupport::TimeWithZone? My dilemma is this. I need to update a field (called updated_at). The field in mysql is datetime, and the class is ActiveSupport::TimeWithZone. But the dates are strings like "10/17/2008". I used "10/17/2008".to_date (And I intend .to_time and to_datetime), and even if in console ...
Hi,
I'm having trouble with getting a named scope working using using an attribute of the associated model other than the id column.
I have a Firm model which has a city_id column.
I also have a City model with a name column.
I want to get restful urls like this so as to make use of the has_scope gem and have skinny controllers
http:...
Is there a cucumber command that will print out just the feature info and the scenario names?
I recently began a project and want to print out the cucumber features and scenarios I wrote to describe the scope of the project and get it confirmed with the client.
...
I run script/generate model query
edit query.rb in models..
class Query < ActiveRecord::Base #I even tried Migrations instead of Base
def sef.up
create table :queries do|t|
t.string :name
end
end
def self.down
drop_table :queries
end
end
,run rake db:migrate.
and what I see in db is this:
mysql> desc quer...
I have a CSV file formatted just like this:
name,color,tasty,qty
apple,red,true,3
orange,orange,false,4
pear,greenish-yellowish,true,1
As you can see, each column in the Ruby OO world represents a mix of types -- string, string, boolean, int.
Now, ultimately, I want to parse each line in the file, determine the appropriate type, and ...
So I'm finally starting to use rest in rails.
I want to have a select_tag with product categories and when one of the categories is selected I want it to update the products on change.
I did this before with
<% form_for :category, :url => { :action => "show" } do |f| %>
<%= select_tag :id, options_from_collection_for_select(Category....
I would like to get some nested params. I have an Order that has many Items and these Items each have a Type. i would like to get the type_id parameter from the controllers create method.
@order = Order.new(params[:order])
@order.items.each do |f|
f.item_type_id = Item_type.find_by_name(f.item_type_id).id
end
The reason is that i wa...
I created a scaffold of named pais (This is a word in Portuguese of Brazil and is the same that country), i created using the follow command:
ruby script\generate scaffold pais name:string abreviattion:string
First I changed the inflections to my local idiom, like that:
inflect.plural /^([a-zA-z]*)s$/i, '\1ses' #The plural of Pais ...
I'm working with some models where a lot of a given model's key attributes are actually stored in a submodel.
Example:
class WikiArticle
has_many :revisions
has_one :current_revision, :class_name => "Revision", :order => "created_at DESC"
end
class Revision
has_one :wiki_article
end
The Revision class has a ton of database fiel...
Autotest will rerun all tests every time my tests start passing when they were failing. I have a lot of tests, and for reasons I won't go into, rerunning all of them is painfully slow.
How can I make it so autotest will never rerun all tests unless I Ctrl-C?
...
Hey folks,
I'm migrating a Website from Rails 2 (latest) to Rails 3 (beta2).
Testing with Ruby 1.9.1p378 and Ruby 1.9.2dev (2010-04-05 trunk 27225)
Stuck in a situation, i don't know which part will work well. Suspect yield is the problem, but don't know exactly.
In my Layout Files I use the following technique quite often:
app/views...