Hi, Kevid!
Have you tried scaffolding? It shold do the trick, you have only to
delete unnecessary data in index.html.erb and move the link to name.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to
Sure, provide a way for admins to upload a CSS file and support
subdomains/hostnames to load the correct CSS files. If you need to load
different data for each one, simply have a table of supported white label
sites/customers and then have a field in each table (indexed) for that
customer_id.
When I try to add user_3 as a friend using the following code:
= link_to 'Add Friend', friendships_path(:friend_id = user), :method =
:post
#= which generates http://localhost:3000/friendships?friend_id=3
This is what happens in my server console:
Started GET /friendships?friend_id=3 for
If the field is empty, then self.start_date is nil. Try this:
def start_date_should_not_be_greater_than_current_date
if !self.start_date.nil?
if self.start_date Date.today
errors.add(Whatever)
end
end
end
or something similar
On Mar 5, 8:08 am, Hemant Bhargava
On Fri, Mar 5, 2010 at 7:22 AM, M I R m.irfa...@gmail.com wrote:
Hi,
I want to insert data into multiple database tables from a single
form, look at the detail.
tables: patients, patient_history, patient_address,
first i will insert data into patient table and then the patient
primary key
On 4 March 2010 23:36, Gordon Yeong anexi...@gmail.com wrote:
Assuming an online t-shirt sales application, each order catalogue would
have the following statuses throughout the life of the application.
It would be worth your time to look at using a state machine then.
Either roll your own
%= form.input :first_name%
%= form.input :last_name%
%= link_to_function clear, :id = , this.up('li').remove() %
This works fine but the link is located outside of the li tag which
causes the formatting to be weired. How can I generate this link and
position it within the li tag it is
validate :start_date_should_not_be_greater_than_current_date
Personally I'd rename that to:
valid :start_date_before_now
And then I'd do this as the method:
def start_date_before_now
if start_date start_date Date.today
errors.add(Whatever)
end
end
Just check start_date first.
On 4 March 2010 19:51, Hassan Schroeder hassan.schroe...@gmail.com wrote:
So do I -- but migrating down multiple levels and back up has never
entered the picture.
Good for you. So you never need to migrate; so you never have
migration troubles. However, those people that do migrate (and not
Viorel,
Thanks for your response. the array i have is the result of a
webservice. Its a data I pulled from another web site.
my rails application has no model
- just a form {in index.erb} to send specific data to a
webservice (defined in my controller.rb). it is this websevice that
returns
Hi,
I'm in the middle of converting one of my Rails-Apps to a plugin/
engine. Because this new plugin requires a lot of plugins I moved them
to RAILS_ROOT/vender/plugins/my_plugin/plugins and added
config.plugin_paths += %W( #{RAILS_ROOT}/vendor/plugins/my_plugin/
plugins )
to my
Hi, I'm looking for advice on how best to implement a plugin that
contains some CSS. I would like the CSS to be automatically added to any
layout so that the only action I need to perform is installation of the
plugin.
Is this possible?
The reason for this is that the plugin includes some view
There is a bug in prototype.js, therefore method handler dont work
correctly in rails.js
Try to install latest prototype from repository or use jquery.
https://rails.lighthouseapp.com/projects/8994/tickets/4013-link_to-with-method-doesnt-work
--
You received this message because you are
Andy Jeffries wrote:
validate :start_date_should_not_be_greater_than_current_date
Personally I'd rename that to:
valid :start_date_before_now
And then I'd do this as the method:
def start_date_before_now
if start_date start_date Date.today
errors.add(Whatever)
end
end
Let's say I have the following real life objects Books, Authors, Roles. A
Book can have one or many Authors and an Author can have one or many Books.
An Author can also have one or many roles associated with a book (maybe
they're the author, or co-author, or commentator to whatever)
How would you
I would very strongly suggest following the conventions, it will make
your life much easier. Also I think that in this case it may at least
in part be the cause of the problem. Consider the line
@metadata = @content_master.Metadata.build
What is Metadata here? In the model you have
On 5 March 2010 12:45, mac care4u.jodh...@gmail.com wrote:
I suppose their is lots and lots of chaos about rails conventions
defaults.
Not really...
problem still remains unsolved !
Post the new/modified code and we can have a look.
--
You received this message because you are
I would do:
Book
has_many :authorings
has_many :authors, :through = :authorings
Authoring
belongs_to :book
belongs_to :author
has_many :authoring_roles
has_many :roles, :through = :authoring_roles
AuthoringRole
belongs_to :authoring
belongs_to :role
Role
has_many
Post the new/modified code and we can have a look.
1) content_master model
class ContentMaster ActiveRecord::Base
has_one :metadata
end
2) metadata model:
class Metadata ActiveRecord::Base
belongs_to :content_master
end
3) def new
@content_master = ContentMaster.new
Book
Authoring
AuthoringRole
Role
Author
I did this in 3 models, I don't know who models the OP's requirements more
closely, but for now here's my modelling:
http://gist.github.com/322710
Ready for the follow-up :-)
Cheers,
Andy
--
You received this message because you are
hello,
i found this through google
The create and build methods are only available for has_one/
belongs_to if an association already exist. It will not work when it's
nil.
http://dev.rubyonrails.org/ticket/535
though this is really a old post i dont know that it is solved or
not.
thank you
i found this through google
The create and build methods are only available for has_one/
belongs_to if an association already exist. It will not work when it's
nil.
http://dev.rubyonrails.org/ticket/535
though this is really a old post i dont know that it is solved or
not.
Well,
Rakoth, awesome detective work. Friend-adding seems to be working now.
On Fri, Mar 5, 2010 at 2:15 AM, Rakoth rakot...@gmail.com wrote:
There is a bug in prototype.js, therefore method handler dont work
correctly in rails.js
Try to install latest prototype from repository or use jquery.
Hi Andy - why not just post your code here? Saves clicking away, and
it's easier to discuss the code. Anyway, you posted
class Role ActiveRecord::Base
belongs_to :author
belongs_to :book
end
class Book ActiveRecord::Base
has_many :authors, :through = :roles
has_many :roles
end
On 5 March 2010 13:18, mac care4u.jodh...@gmail.com wrote:
The create and build methods are only available for has_one/
belongs_to if an association already exist. It will not work when it's
nil.
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
For a has_one, it
On 5 March 2010 13:26, Andy Jeffries andyjeffr...@gmail.com wrote:
def new
�...@content_master = ContentMaster.new
�...@content_master.metadata = Metadata.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml = @content_master }
end
end
I like
Thanks, Fred. I suppose I'll stick with views and conversions.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To
I'm trying to use Bundler for existing Rails 2.3.5 app and got a very
strange problem.
The problem is that on the very first request only the contents of the
action view file are rendered - i.e. when loading the home page
(controller: home, action: index) I get only contents of the app/views/
Andy Jeffries wrote:
Also by using a string for the role_type you will have many Role
records with MAIN_AUTHOR for example. If you later decided that
Primary Author would be better you would have to change the string
in many records.
I'm not saying MAIN_AUTHOR has to be displayed
Thanks everyone , it turns out that doing the age-old trick of
re-installing the app has solved this problem.
Thanks,
kannav rajeev wrote:
Hey sorry i think first please write yours migration code so i can
help you out. First Do this then else thanks ..
On 3/4/10, kannav rajeev
Rails finds it easier to use foreign keys based on id. Are we talking
about rails or about a person manually searching the database using
their hands and eyes?
A person manually scanning the database (in a MySQL command prompt).
If this was actually a useful table (as opposed to just
thank you @Andy
thank you @Michael
both method work in action new but comming back to problem as i was
following
http://media.railscasts.com/videos/073_complex_forms_part_1.mov
i need to create a virtual function in a model
i tried various combination (for * ) but failed
model:
class
thank you @Andy
thank you @Michael
both method work in action new but comming back to problem as i was
following
http://media.railscasts.com/videos/073_complex_forms_part_1.mov
i need to create a virtual function in a model
i tried various combination (for * ) but failed
model:
class
Hi
I have been trying to fetch the output as an
hash but it is returning string.I am storing the data
in the following format.
---
:input_type:
- text_field
- ride_from
:label: Ride From
:input_type:
- text_field
- ride_from
:label: Ride From
-
I have an application i'm installing on my application server. I've
been
using WEBrick and for now i'd like to just keep using it working in
prototype development mode. This works fine on my development machine
using both http and https, where the host is 'localhost' (ports
3000,3001). It also
Hi,
I'm relatively new to RoR so pardon if this is a really stupid
question. I have a text field where people will be entering a
username. I need to figure out a way to either
1. validate the field so that it will not be accepted unless they've
entered all uppercase letters for their username --
I'd be putting this:
def username=(value)
write_attribute(:username, value.upcase)
end
in my controller right? Sorry for the beginning questions...
On Mar 5, 11:12 am, Michael Pavling pavl...@gmail.com wrote:
On 5 March 2010 16:05, Andy Jeffries andyjeffr...@gmail.com wrote:
2.
When I add this to my model:
def after_initialize
:date = Date.today
end
I get this error -- /home/xxdesmus/timetool/app/models/post.rb:38:
syntax error, unexpected '=', expecting kEND :date = Date.today ^
when I try it this way:
def after_initialize
date = Date.today
end
It
On Thu, Mar 4, 2010 at 10:53 PM, Allan Last li...@ruby-forum.com wrote:
I run into problems where the name is close to the beginning of the
sentence:
Having John Smith over for dinner. --- This will look at Having John
Getting Jane Smith ready for school. --- This will look at Getting
Jane
I have managed to make it work. After changing config/environments/
development.rb to look like:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :sendmail
Now everything works fine on my system. Adding
On Fri, Mar 5, 2010 at 9:07 AM, Jack Shanter li...@ruby-forum.com wrote:
Thanks, Fred. I suppose I'll stick with views and conversions.
Why not
pages = Page.all(:include = :book)
pages.first.book.year
--
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter:
On Fri, Mar 5, 2010 at 8:12 AM, mac care4u.jodh...@gmail.com wrote:
3) def new
�...@content_master = ContentMaster.new
�...@metadata = @content_master.metadata.build
@metadata = @content_master.build_metadata
--
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter:
On Fri, Mar 5, 2010 at 12:16 PM, Hassan Schroeder
hassan.schroe...@gmail.com wrote:
On Thu, Mar 4, 2010 at 10:53 PM, Allan Last li...@ruby-forum.com wrote:
I run into problems where the name is close to the beginning of the
sentence:
Having John Smith over for dinner. --- This will look at
thank you for your reply @RickDeNatale
but solution u provided has allready been suggested.
my problem is now with defination of virtual function according to
has_one relation
thank you anyway
mac
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails:
I am trying to figure out how to create ActiveRecord models with
associations that can yield the same results as this SQL query:
select login, first_name, last_name, email_address from accounts inner
join people on person.id = accounts.person_id inner join
email_address_people on person.id =
So I've never really found a solution I like for making async tcp
connections from inside a running rails app, and was curious if anyone else
has had any luck. When running fairly large scale rails apps we always end
up needing this. The only thing I've tried so far that really works is to
run
On Mar 5, 12:14 pm, Bigos ruby.obj...@googlemail.com wrote:
I have managed to make it work. After changing config/environments/
development.rb to look like:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
Rick Denatale wrote:
Why not
pages = Page.all(:include = :book)
I usually need to filter by, let's say, a certain library:
@pages = Page.all(
:select = 'pages.id, pages.no',
:joins = :book,
:conditions = books.library_id = #{1}
)
AR will generate:
SELECT pages.id, pages.no FROM pages
Never mnddd. Figured it out finally. In the startup script,
the definition of OPTIONS :environment needs to be changed from
'development' to 'production'. (My use of -e isn't actually
implemented by this script.)
On Mar 5, 8:09 am, bob bwor...@keycomputerconsultants.com wrote:
I have an
On 5 March 2010 17:02, xxdesmus xxdes...@gmail.com wrote:
So I have a bunch of form fields that I need to add up their
values, and make sure their sum does not except the value entered in a
new form field. If the sum does exceed the form field value then I
want to alert the user and prevent it
Phoenix Rising wrote:
Here's where agile practices come into play, and where the rub is: I
had an entire system finished and ready to go. Then management
stepped in, and for the third time in two months, changed it all.
Four user types got expanded to 9, and instead of 4-8 sub parts for
I have a 'new' page with a submit for creating stories. On the 'show'
page the submit allows a user to enter comments. I now want a 'edit'
page for the stories with another submit for updates. I have used the
'create' and 'update' methods in the stories_controller on the 'new' and
'show' pages.
On 5 March 2010 20:33, Neil Bye li...@ruby-forum.com wrote:
I have a 'new' page with a submit for creating stories. On the 'show'
page the submit allows a user to enter comments. I now want a 'edit'
page for the stories with another submit for updates. I have used the
'create' and 'update'
Hassan Schroeder wrote:
On Thu, Mar 4, 2010 at 5:18 AM, Marnen Laibow-Koser
li...@ruby-forum.com wrote:
However, your original example is problematic. You appear to be using
migrations for seed data. This is a terrible idea.
Why?
For several reasons. The two most compelling for me are
You can also just add another public method to the controller. For
instance, instead of using StoryController.update for updating the
comments, you could use something like StoryController.add_comment.
On Mar 5, 4:07 pm, Colin Law clan...@googlemail.com wrote:
On 5 March 2010 20:33, Neil Bye
gems is a kind of packet manager for ruby's 3rd party application. we
can download rails with that. but i can download it with that. is
there any other solution?
On Mar 2, 5:59 pm, kannav rajeev rajeevsharm...@gmail.com wrote:
What is Gem ?..
On Tue, Mar 2, 2010 at 2:22 PM, janita kinsi
On Tue, Mar 2, 2010 at 12:52 AM, janita kinsi jki...@gmail.com wrote:
i have install ruby on my computer. but what if i want to install
rails manually without install gem first?!
Hi, you'll need to download the sources from github.com. For example,
you'll need to do the following:
$ git
Hi,
I'd like to conserve the sum total of several text fields on my form,
even as I set them to blank upon a user link action.
The following in-line snippet fails to store the value of my sum total
field locally for eventual reassignment. (I am re-assigning it because
the fields all have an
OK, I figured it out. Though I wonder why it was so hard to do
so... :-)
Here's what I'm doing in case others have the same questions and find
this...
now in my view template I have:
%= select_tag :selected_email,
options_from_collection_for_select(update_request.contact.emails,
'id',
OK, I figured it out. Though I wonder why it was so hard to do
so... :-)
Here's what I'm doing in case others have the same questions and find
this...
now in my view template I have:
%= select_tag :selected_email,
options_from_collection_for_select(update_request.contact.emails,
'id',
On Fri, Mar 5, 2010 at 2:12 PM, Jack Shanter li...@ruby-forum.com wrote:
Rick Denatale wrote:
Why not
pages = Page.all(:include = :book)
I usually need to filter by, let's say, a certain library:
@pages = Page.all(
:select = 'pages.id, pages.no',
:joins = :book,
:conditions =
OK, I figured it out. Though I wonder why it was so hard to do
so... :-)
Here's what I'm doing in case others have the same questions and find
this...
now in my view template I have:
%= select_tag :selected_email,
options_from_collection_for_select(update_request.contact.emails,
'id',
Does is_any has a bug in searchlogic? is_any used to work fine
for me. All of a sudden now, for unknown reasons, when I write for
example :attribute_is_any = [1] , the sql output is where
attribute != 1 which is the opposite of what I want of course.
Curiously, the problem only occurs when
Hi,
I just installed Restful-authentication plugin and tried
rails g authenticated user sessions
and got Could not find generator authenticated.
What is the problem?
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
On Fri, Mar 5, 2010 at 6:03 PM, Ease Bus ease...@gmail.com wrote:
Does is_any has a bug in searchlogic? is_any used to work fine
for me. All of a sudden now, for unknown reasons, when I write for
example :attribute_is_any = [1] , the sql output is where
attribute != 1 which is the
Thanks for the suggestions. I'm going to play around with this.
On the most part, I'm doing detection for scenarios with two names, so
names like Robert De Niro will not come up.
-A
Rick Denatale wrote:
On Fri, Mar 5, 2010 at 12:16 PM, Hassan Schroeder
hassan.schroe...@gmail.com wrote:
You
Hi,
I installed rails3 on my mac and after installing 2.3.5 using gem
install rails -v 2.3.5, if I run gem list rails, I got
*** LOCAL GEMS ***
rails (3.0.0.beta, 2.3.5)
But if I run
rails _3.0.0.beta_ test
got the following error
can't find executable rails for rails-3.0.0.beta
I have two resources, :users and :photos. Users is based on AuthLogic.
Photos has a type set to private or public. I would like configure my
routes to mimic the Flickr URL structure.
The routes I want are:
foo.com/photos = controller = photos, action = index,
This route will display the
Hi,
I am looking for a solution in my application, i want to provide a
personal domain to my users just like del.icio.us do, i don't want a
subdomain, i just want that people can choose to show some information
and give other people a link like www.myapplication.com/name_of_user.
i want to
1. Use subdomains and cname records.
2if name unic, in your model write
def to_param
name
end
Sent from my iPhone
On 06.03.2010, at 10:08, Cristian Vasquez li...@ruby-forum.com wrote:
Hi,
I am looking for a solution in my application, i want to provide a
personal domain to my users just
70 matches
Mail list logo