Ok, thanks. I think I'll put it in an initializer, actually, as
that's where it seems most of the configuration is headed to.
On Sep 2, 3:11 pm, Chris Mear wrote:
> On 2 September 2010 02:32, Kyle wrote:
>
>
>
> > I am upgrading to Rails 3.0, but am having a difficult time getting it
> > to boo
Nevermind turns out my model classname was same as the class name of a
plugin. Wonder why reload! always returned true, never complained or
gave a clue
On Sep 5, 11:15 pm, badnaam wrote:
> This is only happening for one model only!
>
> Here is the model.
>
> If I exit the console then start it ag
This is only happening for one model only!
Here is the model.
If I exit the console then start it again the model updates load just
fine.
On Sep 5, 9:38 pm, badnaam wrote:
> Not sure what happened but all of a sudden reload! stopped loading
> updated model classes in irb. Anyone seen this?
-
Hi Guys,
I'm experimenting with my first rails app currently. One thing I'm
trying to implement is a login system.
I created a model for user.rb I've added a couple of functions to the
class for example:
def self.authenticate(user_info)
find_by_username_and_password(,
self.hashed_passwo
Not sure what happened but all of a sudden reload! stopped loading
updated model classes in irb. Anyone seen this?
--
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 have two modelds
1. loan model belongs_to :borrower
2. borrower model has_many:loans
In my borrower Show method i wrote
<%= link_to 'Request New Loan', :controller => 'loans', :action =>
'new', :id => @borrower.id %>
my loans_controller have this
def new
@borrower = Borrower.f
Kelp Kelp wrote:
> Fernando Perez wrote:
>> You almost have it all correct, just in your view:
>>
>> <%= form_for([...@article, @comment]) do |f| %>
>>
>>
>> --
>>
>> http://digiprof.tv
>
> That worked excellently.
>
> I have one more question about the same set of files. I want to add a
> l
Thanks for the reply, I do have the relationships declared above in
the models... I've been learning and following the rails 3 book here:
http://railstutorial.org/chapters/a-demo-app#sec:microposts_resource
I tried your suggestion "@note = @user ?
@user.notes.find(params[:id]) : nil " and while it
On Sep 5, 10:53 pm, nobosh wrote:
> Ed thanks for the reply. I'd love to hear more... I tried your
> suggestion but it error'd:
>
> "undefined method `Notes' for nil:NilClass"
>
Two possible issues:
1. Do you have the relationship declared in the models?
class Note < ActiveRecord
belongs_t
Ed thanks for the reply. I'd love to hear more... I tried your
suggestion but it error'd:
"undefined method `Notes' for nil:NilClass"
On Sep 5, 6:50 pm, Ed wrote:
> The cleanest method is to scope your notes by user instead of
> searching the whole class:
>
> @note = @user.notes.find(params[:id]
Hello all,
We are about to launch our site. One of the features that is missing
at the moment is a way for users to fill in their credit card details
and click send to purchase our products that we offer on our website.
We are relatively new to this concept, so we do not know where to
start? I am
The cleanest method is to scope your notes by user instead of
searching the whole class:
@note = @user.notes.find(params[:id])
On Sep 5, 7:25 pm, nobosh wrote:
> This hack ends up working. Is there a cleaner, ruby trick to getting
> this to work?
>
> @note = Note.find(pa
On Sep 5, 10:29 am, Pål Bergström wrote:
> Pål Bergström wrote:
>
> It works. But how do I deal with a list as this? How do I set the
> variable?
>
> @tests = Test.find(:all)
> --
brute force:
@tests.each {|test| test.key = cookies[:my_key]}
Might be a more clever way to do it.
--
You rece
Thank you very much.
I will try to install Rails on my own machine.
2010/9/6 jason white
> Welcome!
>Unfortunately in order to develop in Rails you will need to install it
> locally on your machine. There are a couple of options here. You can install
> all of the necessary files native to
Trying to convert my app (and brain) to RESTful routes from the old
style. What is the accepted approach to nesting a resource within 2
other resources?
Example:
Models
Person has_many :scores
Contest has_many :scores
Score belongs_to :person, :contest
Routes
resources :people do
On Sun, Sep 5, 2010 at 5:44 PM, badnaam wrote:
> In my app a user can set the status of a Post to different flags like
> 'v' - visible, 'd' - mark for delete etc.
>
> These flags are set via controller actions.
>
> I have a batch process that runs and cleans all the posts marked for
> delete.
>
>
In my app a user can set the status of a Post to different flags like
'v' - visible, 'd' - mark for delete etc.
These flags are set via controller actions.
I have a batch process that runs and cleans all the posts marked for
delete.
Post.find(:all, :conditions => ['status = ?', 'd']).each do |
Fernando Perez wrote:
> You almost have it all correct, just in your view:
>
> <%= form_for([...@article, @comment]) do |f| %>
>
>
> --
>
> http://digiprof.tv
That worked excellently.
I have one more question about the same set of files. I want to add a
link for editing the comments on the a
Hello,
My comments are currently routed inside of my articles, so my routes
file looks like the following:
resources :articles do
resources :comments
end
I am trying to write an Rspec test that tests whether or not guests
(non-signed-in users) can comment on my articles with the following
This hack ends up working. Is there a cleaner, ruby trick to getting
this to work?
@note = Note.find(params[:id])
@note_userid = @note.user_id
@current_userid = current_user.id
redirect_to(root_path) un
Hi Mark,
Apparently you can only update ruby gems from the repositories. What I
have done was install it from source. Just grab the source and install
it. It will overwrite the existing one.
I don't know if anyone else has another solution, but that is the one I found.
Hope that helps.
Regards,
Hello, I'm a Rails newbie Here's what I'm trying to do
I created a scaffold for notes (t.text :content, t.integer :user_id)
What I want to do now is only allow user's to view notes that they
created. ie (== user_id)
In my /app/controllers/notes_controller.rb
I have the following:
cl
2010/9/5 Pål Bergström :
> Pål Bergström wrote:
>> I'm trying to pass a value from a cookie from the controller into model
>> by using attr_accessor. But it doesn't work and I suspect I do something
>> wrong.
>>
>> Is this on the right path?
>>
>> class Test < ActiveRecord::Base
>>
>> attr_access
Kyle Fox wrote:
> To fix this, specify ARCHFLAGS when you install the 'mysql' gem:
>
> sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-
> config=/usr/local/mysql/bin/mysql_config
>
> On Aug 27, 12:07�pm, Caleb Cullen
Exactly the answer I needed. Thanks!
--
Posted via http:/
Oops, I'm sorry. I thought I answered to some open topic with this,
and didn't know I started a new one.
Well, thank you for you idea, Luke. I though about putting work with
data to model, and I think you are right.
As for empty field, I add validates to model to check that this field
isn't empty,
A. Leek wrote:
> I'm pretty sure I have all the information I need in the program, the
> problem is getting it all together and I'm not sure if that's even
> possible. Does anyone have ideas?
It may be too narrowly supported for what your trying, but you can go to
the HTML5 route. Check out the F
Jeremy McAnally wrote:
> Prepend the username. So in this case:
>
>gem install skippy-ec2onrails
>
> And make sure gems.github.com is a source.
In the past I've pulled down the source, built the gem, installed it and
then unpacked it to vendor/gems. I like this solution *a lot* more.
Grea
Does someone know how to push project into live. Project is written on
Rails 3 and uses ruby 1.9.2?
--
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 unsubscribe fro
On Sun, Sep 5, 2010 at 8:57 AM, Joshua Partogi wrote:
> Hi all,
>
> I am interested to learn more about connection pooling in rails. Is there
> any good articles about this? I want to know specifically how is connection
> pooling in rails works. Does rails open one connection to the database for
>
I have installed jquery-ujs driver and include jquery script in my
view.
In my view I have the following function
$(function () {
$('#alert').click(function () {
$.ajax({
type: "POST",
data: ({ lat: this.getAttribute('data-lat'), lon:
22.3908355 }),
Good call on that find_by_id. Noted to myself :)
On 5 sept., 16:42, Rob Biedenharn wrote:
> On Sep 5, 2010, at 9:30 AM, Simon Macneall wrote:
>
> > On Sun, 05 Sep 2010 21:21:25 +0800, Michael Pavling
> > wrote:
>
> >> @user = User.find(1) if User.exists?(1)
>
> >> I don't like doing two lookup
Veera Sundaravel wrote:
> May be this link will help you.
> http://veerasundaravel.wordpress.com/2010/02/15/rails3-beta-installation/
>
Still receive error installing rails: active model requires i18n
When I try to sudo gem install i18n, it errors out because it requires
RubyGems 1.3.6 or highe
You're not really asking a question, but if you're looking for
feedback on your code, I'm happy to provide my 2 cents.
It appears that image_url just returns a string as a path to an image
under /images/ on your web server.
I would override the default accessor for image_url in your model code
eg
Fernando Perez wrote:
> The thing is to make your rails app communicate with the broker's api.
> Like any other webservice. There is nothing specific to trading except
> the rails app will act as a daemon and will communicate all the time
> with the web service.
Thanks Fernando,
Yeah, I get tha
I haven't tested this in rails3, but this is what I do to capture the
output of a block in rails 2.
#my_helper.rb
if block_given?
block_text = capture(&block)
end
#view_file.html.erb
<% my_helper do %>
##anything output here is captured and returned to block_text
<% end %>
Hope that helps. I w
The thing is to make your rails app communicate with the broker's api.
Like any other webservice. There is nothing specific to trading except
the rails app will act as a daemon and will communicate all the time
with the web service.
--
Posted via http://www.ruby-forum.com/.
--
You received th
Ok, found the problem causig this:
I had to set --> gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
in the Gemfile and comment out:
gem 'sqlite3-ruby', :require => 'sqlite3'
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
Hi Paul. but wouldnt that redirect to users_path on any activerecord
not found event?
--
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 unsubscribe from this group,
Welcome!
Unfortunately in order to develop in Rails you will need to install it
locally on your machine. There are a couple of options here. You can install
all of the necessary files native to your machine, install a packaged
development environment such as Ruby Stack from bitnami, or by us
The solution that is good for me:
<% if controller.action_name == 'new' %>
<%= f.text_field :image_url, :value => 'no image' %>
<% else %>
<%= f.text_field :image_url %>
<% end %>
and then in index.erb set smth like that
<%= product.image_url == 'no image'
Hi all,
I am new to rails and I do not want to install rails on my own machine.
Finally I found that there is cloudy rails server that called heroku.
Could you kindly tell me does that application is good enough for developing
rails?
Is that free?
Does it work well?
Thank you.
Eason
--
You
You can manipulate data before saving it
class User
before_save :do_something
def do_something
// process music_tracks here
end
end
PS: I do not know the purpose of your project, but in general, having
a table of songs referred by id seems a better option to me.
Song 1 => { band => "K
def show
@user = User.find(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_to users_path, :alert => "This user does not exists"
end
--
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 rubyonr
On Sep 3, 2:55 am, proximal wrote:
> On Sep 2, 10:52 pm, Colin Law wrote:
>
> > So in several form_for method calls you call is_disabled as part of
> > building the parameters for the form_for, and you want is_disabled to
> > automatically know the symbol in the first param of the form_for? I
Hi Christian
On Sun, Sep 5, 2010 at 9:38 AM, Christian Fazzini
wrote:
> So this would be the convention right? not by using rescue_from. Is
> this right?
Yes. When possible, avoid begin-rescue by using Ruby / Rails to
return a value you can handle within the normal course of your
application lo
So this would be the convention right? not by using rescue_from. Is
this right?
On Sep 5, 9:42 pm, Rob Biedenharn wrote:
> On Sep 5, 2010, at 9:30 AM, Simon Macneall wrote:
>
> > On Sun, 05 Sep 2010 21:21:25 +0800, Michael Pavling
> > wrote:
>
> >> @user = User.find(1) if User.exists?(1)
>
> >
Pål Bergström wrote:
> I'm trying to pass a value from a cookie from the controller into model
> by using attr_accessor. But it doesn't work and I suspect I do something
> wrong.
>
> Is this on the right path?
>
> class Test < ActiveRecord::Base
>
> attr_accessor :key
>
> key ..
>
> en
Hi all,
I am interested to learn more about connection pooling in rails. Is there
any good articles about this? I want to know specifically how is connection
pooling in rails works. Does rails open one connection to the database for
every user that is connected or does every user share the same da
On Sep 5, 2010, at 9:30 AM, Simon Macneall wrote:
On Sun, 05 Sep 2010 21:21:25 +0800, Michael Pavling
wrote:
@user = User.find(1) if User.exists?(1)
I don't like doing two lookups for one record, but it works
What about
@user = User.find(:first, :conditions => {:id => 1})
if (@user)
blah
Did you find a solution ? , i've the same problem
--
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 unsubscribe from th
What about
@user = User.find(:first, :conditions => {:id => 1})
if (@user)
blah, blah, blah
end
It's longer to type, but returns nil if the user doesn't exist.
On Sun, 05 Sep 2010 21:21:25 +0800, Michael Pavling
wrote:
@user = User.find(1) if User.exists?(1)
I don't like doing two look
@user = User.find(1) if User.exists?(1)
I don't like doing two lookups for one record, but it works
--
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 unsubscribe fr
Hi All,
I'm facing a strange problem. I've configured RA with default account
activation email setting. All works fine but whenever user logs in, an
email is sent saying your account is activated. This happens on each
login. Can somebody help me out with this? I'm using ruby 1.8.7 and
rails 2.3.8.
Yes but, it will never reach "unless." The system fails after @user =
User.find(1) since Active Record is trying to find a record that does
not exists
On Sep 5, 7:28 pm, Ugis Ozols wrote:
> One of the solutions would be to use redirect_to and flash[:notice]
> like:
>
> @user = User.find(1)
> unle
I am getting the following error when I try to install rails on lucid
lynx :-
m...@mark-laptop:~/code/ruby$ sudo gem install rails
ERROR: Error installing rails:
i18n requires RubyGems version >= 1.3.6
I have installed RubyGems1.9.1, but it seems that "gem" is still at
version 1.3.5 :-
m...@m
Hi,
the above appears when I do:
C:\Rails\first_app>rails server
C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.1-x86-mingw32/lib/sqlite3.rb:6:in
`require': no such file to load -- sqlite3/sqlite3_native (LoadError)
Need hep. thanks.
dani
--
Posted via http://www.ruby-forum.com/.
--
Hi,
when running - 'ruby setup.rb' I get the following error message:
C:\rubygems-1.3.7>ruby setup.rb
C:/rubygems-1.3.7/lib/rubygems/source_index.rb:68:in
installed_spec_directories': undefined method `path' for Gem:Module
(NoMethodError)
Ruby version is ruby-1.9.2-p0.
Any idea ?
Thanks.
Dani
-
One of the solutions would be to use redirect_to and flash[:notice]
like:
@user = User.find(1)
unless @user
flash[:notice] = "can't find user with given id"
redirect_to users_path
end
I won't say it's the best but it's still a solution :)
On 5 sept., 13:55, Christian Fazzini
wrote:
> When n
When navigating to: http://localhost:3000/users/12
Whats a good way of avoiding the error: "Couldn't find User with
ID=12", which happens when i try to display a page of user_id 12 that
doesnt exist in the database.
Instead of showing the error. id like to show a page that says: "This
user does n
Does the file exist?
I can't help much on windows, but have resolved similar issues on UNIX
with a full path, not a relative path.
On Sep 5, 7:11 pm, Dani Dani wrote:
> Hi,
> here is some more information. I'm using windows xp, sp3.
> Here is the content of the sqlite3.rb file where the error co
Hi,
here is some more information. I'm using windows xp, sp3.
Here is the content of the sqlite3.rb file where the error comes from:
=
# support multiple ruby version (fat binaries under windows)
begin
RUBY_VERSION =~ /(\d+.\d+)/
requi
This is now resolved.
On Sep 5, 1:23 pm, nktokyo wrote:
> I am trying drag and drop in RoR for the first time.
>
> What I want to achieve, is a list of slots, and a list of entries. You
> should be able to drag an entry onto a slot and slot.entry_id will
> update to match the dragged entry.ent
On 5 September 2010 00:31, Tom Fielding wrote:
> Hello,
> Sorry if this is a noob question.
> I'm trying to store a hash of values (a user's music collection) into a
> single database record without having to have a separate row in the db for
> each music track the user has in his collection.
> e.
Hello,
Sorry if this is a noob question.
I'm trying to store a hash of values (a user's music collection) into a
single database record without having to have a separate row in the db for
each music track the user has in his collection.
e.g. User 9
{ 12319 => "Artist X: Song Name 1",
12198 =>
I am trying drag and drop in RoR for the first time.
What I want to achieve, is a list of slots, and a list of entries. You
should be able to drag an entry onto a slot and slot.entry_id will
update to match the dragged entry.entry_id.
I've spent a lot of time looking in textbooks and online, but
2010/9/4 Pål Bergström :
> I'm trying to pass a value from a cookie from the controller into model
> by using attr_accessor. But it doesn't work and I suspect I do something
> wrong.
>
> Is this on the right path?
>
> class Test < ActiveRecord::Base
>
> attr_accessor :key
>
> key ..
>
> end
On 4 September 2010 19:26, DMaster wrote:
> Is it possible to move the complete ROR install/development directory
> or directories to new PC and continue to work/dev as the original one?
Yes, assuming you are talking about the rails application itself. You
will also have to install the developme
In my view, I've got the following condition:
<% if current_page? :controller => 'deals', :action => 'foobar' %>
woot
<% end %>
My route looks like:
map.fobar '/:city.:format', :controller => 'deals', :action =>
'foobar', :defaults => { :format => 'html' }
However, the conditions su
Fernando Perez wrote:
> It should work. What makes you think it doesn't?
And it hasn't to be a column in the database (it isn't)?
My solution didn't work. But when you say that it should I know I'm on
the right track and that the problem is elsewhere. Thanks.
--
Posted via http://www.ruby-forum
69 matches
Mail list logo