[Rails] displaying attribute from related table with a collection_select

2011-07-03 Thread @demetriusolsen
I have two tables: Area, AreaType

Area  belongs_to :area_type
AreaType has_many :areas

In my view, I'd like to select from a list of Areas, however, instead
of using the :area_type_id attribute, I would like to use the
associated area_type names. Here's what it looks like now:

%= f.collection_select(:area_id, Area.where(:subject_id =
@search.subject_id), :id, :area_type_id, {:include_blank = true} ) %

What I want is:
%= f.collection_select(:area_id, Area.where(:subject_id =
@search.subject_id), :id, area.area_type.name, {:include_blank =
true} ) %

Anyone know how I would go about creating the area.area_type.name
symbol to user here?

Thanks in advance!

-- 
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: displaying attribute from related table with a collection_select

2011-07-03 Thread @demetriusolsen
Well that was easy! After a little trial and error, I created a new
method in the area.rb and used the name of that method in the
collection select :-) Cheers



On Jul 2, 11:48 pm, @demetriusolsen demetri...@hotmail.com wrote:
 I have two tables: Area, AreaType

 Area  belongs_to :area_type
 AreaType has_many :areas

 In my view, I'd like to select from a list of Areas, however, instead
 of using the :area_type_id attribute, I would like to use the
 associated area_type names. Here's what it looks like now:

 %= f.collection_select(:area_id, Area.where(:subject_id =
 @search.subject_id), :id, :area_type_id, {:include_blank = true} ) %

 What I want is:
 %= f.collection_select(:area_id, Area.where(:subject_id =
 @search.subject_id), :id, area.area_type.name, {:include_blank =
 true} ) %

 Anyone know how I would go about creating the area.area_type.name
 symbol to user here?

 Thanks in advance!

-- 
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: ROR Programmers?

2011-07-03 Thread ct9a
Where is it that you need arora people. I'm one and I'm in Melbourne,
victoria, AUSTRALIA

On Jul 1, 10:31 pm, Brandon bhilliar...@gmail.com wrote:
 Where is the best place to find programmers?  I need a few ROR
 programmers for a quictoria

-- 
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Can't upload files when WEBrick running in daemon mode.

2011-07-03 Thread Jen

Hi,
When running my app in development with WEBrick in daemon mode I get the 
following error when trying to upload a file:



 Errno::ENOENT in UploadController#create

No such file or directory - public/data/upload/google

|Rails.root: /home/resource_portal/website|

Application Trace http://localhost:3000/upload# | Framework Trace 
http://localhost:3000/upload# | Full Trace 
http://localhost:3000/upload#


|app/models/upload.rb:29:in `initialize'
app/models/upload.rb:29:in `open'
app/models/upload.rb:29:in `filesave'
app/controllers/upload_controller.rb:16:in `create'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/implicit_render.rb:4:in
 `send_action'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/abstract_controller/base.rb:151:in
 `process_action'|
...

I do not get this error when not running in daemon mode. I've googled a bit but 
can't find a reason. Does anyone have any ideas?

Also the reason I want to run in Daemon mode is because I have to host my app 
on a uni virtual machine, and start the server after logging in with ssh. When 
I close the ssh connection the server (if not running in background) also seems 
to get killed.

Any ideas as to how I may be able to work around this?

Thanks,
Jen.


--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Web services - json-rcp

2011-07-03 Thread Marketlija Pik
Hello.


I am starting to write a web services in RoR, and considering different 
technologies to use. I am wondering if someone had experience working with 
json-rcp and what are its (dis)advandages over SOAP and REST.


Thank you,
Derek

-- 
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Can't upload files when WEBrick running in daemon mode.

2011-07-03 Thread Hassan Schroeder
On Sun, Jul 3, 2011 at 6:19 AM, Jen jen.bot...@gmail.com wrote:
 When running my app in development with WEBrick in daemon mode I get the
 following error when trying to upload a file:

 Errno::ENOENT in UploadController#create

 No such file or directory - public/data/upload/google

 I do not get this error when not running in daemon mode. I've googled a bit
 but can't find a reason. Does anyone have any ideas?

My guess would be that 'current working directory' doesn't mean the
same thing to a daemonized process; how are you specifying the target
directory? Regardless...

 Also the reason I want to run in Daemon mode is ...

Why Webrick? It's only intended for desktop development work; you
would be better off using e.g. unicorn (my preference) or passenger
in a production environment.

Alternatively, if those aren't an option, see if you have `screen` on the
system you're using (http://www.gnu.org/software/screen/).

HTH,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Does the asset pipeline (RoR 3.1) waste cycles?

2011-07-03 Thread Jeff Pickhardt
With the Ruby on Rails asset pipeline in RoR 3.1, it's unclear if the
.coffee and the //= require files get processed only once or with each asset
request.

For example, I have a file that looks like this:

//= require source/main.js.coffee
//= require source/second.js.coffee
//= require source/third.js.coffee

Ideally, the server would compile these to js ONCE, then bundle them, then
create a static file.  Otherwise it's going to be wasting cycles repeating
effort.

Can someone clarify what happens?

Thanks,
Jeff

--
Jeff Pickhardt
(650) 530-0036
pickha...@gmail.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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] when to add validations to database

2011-07-03 Thread Adrian Caceres

Normally all my validation is done in my models.

Michael Hart in his rails tutorial explains why the uniqueness 
validation should also be done at the database layer ( 
http://ruby.railstutorial.org/chapters/modeling-and-viewing-users-one#sec:the_caveat).


I am curious if people have experienced other validations that should 
also be done at the database layer?


thanks




--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Does the asset pipeline (RoR 3.1) waste cycles?

2011-07-03 Thread Dieter Lunn
In a development environment it recompiles the assets on every
request. When in production it does it once and adds a hash to the
filename for caching.

Dieter Lunn
http://ubiety.ca



On Sun, Jul 3, 2011 at 11:15 AM, Jeff Pickhardt pickha...@gmail.com wrote:
 With the Ruby on Rails asset pipeline in RoR 3.1, it's unclear if the
 .coffee and the //= require files get processed only once or with each asset
 request.

 For example, I have a file that looks like this:

 //= require source/main.js.coffee
 //= require source/second.js.coffee
 //= require source/third.js.coffee

 Ideally, the server would compile these to js ONCE, then bundle them, then
 create a static file.  Otherwise it's going to be wasting cycles repeating
 effort.

 Can someone clarify what happens?

 Thanks,
 Jeff

 --
 Jeff Pickhardt
 (650) 530-0036
 pickha...@gmail.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-talk@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.


-- 
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Why does rendered.should have_field pass when it shouldn't?

2011-07-03 Thread David Zhang
This is my new.html.erb_spec.rb:

  let(:meal) do
mock_model(Meal).as_new_record.as_null_object
  end
  
  before(:each) do
assign(:meal, meal)
  end

  it shows the name text field do
  render
  rendered.should have_field(:name) # checks for both the label and the 
text field... right?
end

it shows the description text area do
  pending This passes when it shouldn't
  render
  rendered.should have_field(:description) # have_field is for text 
fields and text areas (w/labels)... right?
end

it shows the ingredients text area do
  pending This passes when it shouldn't
  render
  rendered.should have_field(:ingredients)
end

==
This is my new.html.erb:
!--admin/meals#new--
div id=meal_new
h3New Meal/h3
%= render :partial = form, :locals = { :meal = @meal, :button_name = 
Create } %
/div
It renders this partial...
==
The partial - _form.html.erb

%= form_for [:admin, meal] do |f| %
%= f.label :name %
%= f.text_field :name %
 !---Nothing about f.text_area :description or ingredients here! --
 %= f.submit button_name %
% end %

=


The problem: rendered.should have_field(:description) and the one for 
ingredients are passing although I never specify the description / 
ingredient text fields or textareas in the form.  Why is this?  It seems 
that the presence of the label and text field for :name is enough to make 
any have_field pass...

(have_field DOES test for text fields or text areas, right?)
(why does the documentation basically tell you /nothing/? no example or 
anything 
http://rubydoc.info/github/jnicklas/capybara/master/Capybara/RSpecMatchers#have_field-instance_method)

Help would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/BqpTVkUheasJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Social Networking

2011-07-03 Thread Amrit Pal Pathak
On Fri, Jun 24, 2011 at 1:52 PM, exelstu...@gmail.com
exelstu...@gmail.comwrote:

  Try some of these:

 https://github.com/insoshi/insoshi#readme

 http://communityengine.org/

 http://lovdbyless.com/

 http://www.enginey.com/

 Lovd by Less looks pretty good, haven’t had a chance to try it yet tho.


 hey
  anybody is using any one from   above  links ?

Thanks

   amritpalpathakgne.wordpress.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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.