Hi,
I have this ruby on rails code
<%= builder.select(:serving_size_id, '') %>
I have not specified any options on purpose because I set the options in a different way when the page loads (using jQuery and Ajax).
The question: Is there any way I can get the value from the column "serving_size_id" but not change that line? I have a...
Hey there!
screenshot
I'm following a tutorial (book) about building rails apps but i ran into a problem and i can't figure how to solve it.
When i try to edit a product the page simply displays de code (with ruby code) and two question marks at the top. All the other views (create, show...) are correct so I can figure it out.
Any he...
Hi folks,
I've the following code in a _form.html.haml partial, it's used for new and edit actions.
(fyi I use the Ryan Bates' plugin nested_form)
.fields
- f.fields_for :transportations do |builder|
= builder.collection_select :person_id, @people, :id, :name, {:multiple => true}
= builder.link_to_remove 'effacer'
...
I'm a bit confused as to how "relationships" are created/processed in ROR/rake.
Can anyone confirm if the following is correct?
Code the "insert xxx relation" in the DB Migration file. Migrate this once done.
Code in the final relationship (has_xxx...) in the model file.
If so, can ROR autogen the DB Migration file from changes in t...
Is it possible to pass url parameters with this type of redirect_to?
redirect_to contact_path(@contact), :show_family => 'yes'
I want a URL that results in:
/contacts/1?show_family=yes
...
Hi,
I'm looking for a solution allowing me to check periodically if the user session has expired and if so redirect him to the login page.
I'm using Authlogic gem, so what I'm doing is call a function that make a test on current_user.
My USER_SESSION_TIMEOUT is 5minutes so I make this ajax call every 5:10 minutes.
<%= periodically_ca...
I can't work out from looking through the source what the difference is between the cattr_* and mattr_* methods provided in Class and Module respectively. I read this question: http://stackoverflow.com/questions/185573/what-is-mattr-accessor-in-a-rails-module which gives some details about both methods but doesn't highlight the differenc...
model a:
has_many :b, :dependent => :delete_all
model b:
belongs_to :a
belongs_to :c
model c:
has_many :b
When I delete an a, I would also like to have children b's deleted so that they get removed from any c's that may reference them. However, the above isn't working. I'd appreciate any help.
...
I'd like my application to display different data on the frontpage depending on whether the user has been logged in or not.
def index
if current_user
# render another controllers action
else
# render another controllers action
end
end
I can achieve this by using render_component. However it has been obsolete for some t...
I'm using authorize.net and activemerchant in a rails app.
When I make a purchase authorize.net sends back an email with information about the purchase. I should be able to send them the billing and shipping address information and have that returned in the email, but it's not returning any of the information, obviously I've got the va...
I have a very simple Ruby on Rails app which uses acts_as_solr plugin to index and search PDF files.
The basic idea of the app is: all PDF files located in myRoRapp/public/PDFfiles/example.pdf are full-text search-able. Usage of the webapp returns links to all PDFs that meet the search criteria.
The app is user authenticated using nift...
I'm trying to seed my database with the standard db/seeds.rb method. This works fine on my development machine, but on my server, I get:
$ sudo rake db:seed RAILS_ENV=production --trace
** Invoke db:seed (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:seed
rake aborted!
uninitialized constant Permiss...
Hi,
I want my rails app to accept dates for a date field in the format dd/mm/yyyy.
In my model I have tried to convert the date to the American standard which I think the Date.parse method that Rails will call on it is expecting:
before_validation :check_due_at_format
def check_due_at_format
self.due_at = Date.strptime(self....
I have a model, let's say Attachments, that uses attachment_fu to accept file uploads from the user. I want to "deep copy" (or in Ruby-ese, deep clone) an Attachment, thus creating a completely new binary object in the "db_files" table.
I've found that it is not quite a solved problem yet. This blog posting:
http://www.williambharding.c...
I am new to using git and Capistrano. I have setup everything else on my server and pushed my app onto a git repo (http://github.com/tnederlof/daily-trailer). When I go to run cap deploy:cold everything seems to be working until it tries to rake the db. Below is what I get when I run it, this is the last bunch of information I recieve a...
Hi
Just as a disclaimer I am new to rails and programming in general so apologize for misunderstanding something obvious.
I have Authlogic with activation up and running. So for my site I would like my users who are logged in to be able to register other users. The new user would pick their login and password through the activation ema...
I've created simple rails page using 'ruby script/generate scaffold subject name:string desc:string' command.
Now, I can add, edit and delete subject in RESTful way.
What I' like to do is changing above behavior as Ajax way.
Everything can be done in index page. For example...this is the page throw the browser~
screen 1
Listing subje...
Given the following AR models, I would like to sort users alphabetically by last name when given a handle to a task:
#user
has_many :assignments
has_many :tasks, :through => :assignments
#assignment
belongs_to :task
belongs_to :user
#task
has_many :assignments
has_many :users, :through => :assignments
I would like to get a task ...
I am using Netbeans v6.8 on Ubuntu 9.10 for Ruby on Rails development.
My problem is that autocomplete works very inconsistently. For example, when I hit ctrl+space after typing "File.", I get all the methods neatly defined at the top in bold that can be called on the class. This list is demarcated and followed by all the other hundreds...