HI All,
i am new to ROR
i am writing Ruby code for calling API blogs
i have written ruby code for
creating a attachment xml by
require 'net/http'
require 'uri'
url = URI.parse('https://localhost:3000/api/attachment/create.xml')
req = Net::HTTP::Post.new(url.path)
req.basic_auth 'a', 'a'
res
Given a blog where
Person <->> Comment
Comment <<-> Article
Article <<->> Person (an article may be written by more than one
person - though I don't think this point is important)
I would like to find all the Comments written by Frank associated with
Articles written by Bob.
In person I have
sc
Folks,
I have a simple model hierarchy (reduced to example as below)
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
has_attached_file :photo,
# :url => "/assets/class_cal//:id/:style/:basename.:extension"
:url =>
Ants Pants wrote in post #973159:
> On 7 January 2011 17:31, Marnen Laibow-Koser
> wrote:
>
>> > Having a method that you pass arguments to
>> JS doesn't ever belong in HTML.
>> >
>> mar...@marnen.org
>> To unsubscribe from this group, send email to
>>
>
rubyonrails-talk+unsubscr...@googlegroups.
Is there a way to manipulate the attributes of an ActiveRecord-based
model after it is retrieved from the database but before it is
returned from the finder?
I have tried defining an after_find callback method but was unable to
access attributes that come from the database from this method. I
trie
On Friday, January 7, 2011 7:19:48 PM UTC-5, tashfeen.ekram wrote:
>
> i have been upgrading my app from 2.x to 3.0.3 and in the process i
> must have done something to upset this. i have searched all over and
> only find the answer of installing the rspec gem which has been done.
>
If you've u
while running any rake tasks i get the following:
no such file to load -- spec/rake/spectask
i do have rspec installed via bundler.
i have been upgrading my app from 2.x to 3.0.3 and in the process i
must have done something to upset this. i have searched all over and
only find the answer of ins
Thanks for the pointer to .at.
For the archives:
@product_before = 'tablehead'
@productindex = @products.index(@product)
if @productindex
if @productindex > 0
@product_before = 'product_' + @products.at(@productindex -
1).id.to_s
end
On 7 January 2011 23:25, Vilèlm wrote:
> Have you tried adding the last line?
>
> def create
> �...@supplier = Supplier.new(params[:supplier])
> �...@supplier.durc_expiry_date = @supplier.durc_issue_date + 90.days
>
> �...@suplier.save <---THIS ONE
this is the entire code:
def cr
Have you tried adding the last line?
def create
@supplier = Supplier.new(params[:supplier])
@supplier.durc_expiry_date = @supplier.durc_issue_date + 90.days
@suplier.save <---THIS ONE
.
On Jan 7, 10:55 pm, Mauro wrote:
> On 7 January 2011 22:45, Vilèlm wrote:
>
> > I
>>I think it is not a best practice to update attributes from model.
In MVC architectures business logic typically resides within models,
so setting your expiration date business rule within the Supplier
model would be the recommended practice.
--
You received this message because you are subscr
On 7 January 2011 22:45, Vilèlm wrote:
> IMHO, your first attempt, update attributes in model, is the best
> practice because model is where you keep attention of your data.
> Anyway, to save your data in the controller:
>
> def create
> �...@supplier = Supplier.new(params[:supplier])
> @supplie
IMHO, your first attempt, update attributes in model, is the best
practice because model is where you keep attention of your data.
Anyway, to save your data in the controller:
def create
@supplier = Supplier.new(params[:supplier])
@supplier.durc_expiry_date = @supplier.durc_issue_date + 90.day
In my model I did self.durc_expiry_date = self.durc_issue_date +
90.days but I think it is not a best practice to update attributes
from model.
So I remove that code and put
def create
@supplier = Supplier.new(params[:supplier])
@supplier.durc_expiry_date = @supplier.durc_issue_date + 90.da
Colin Law wrote in post #973053:
> What I don't immediately see is how that links in to update_attributes
> to prevent particular columns being updated.
>
> Colin
You can apply the same authorization on fields within models. If you
have for instance 3 fields that should be updatable based on par
On 7 January 2011 18:09, Ants Pants wrote:
> [...]
> As far I'm aware, I never said JQuery was superior. I am aware of saying
> it's horses for courses. I'm also aware that my comments were opinion and
> not fact, based on my experience with Prototype.
I am afraid that if you make statements such
On 7 January 2011 21:03, Tim Shaffer wrote:
> select_tag does not support prompt, as you have found.
>
> Easiest workaround is probably to just prepend the option manually:
>
> <%= select_tag(:sector_admin_select, "All" +
> options_from_collection_for_select(@sectors, :id, :name, @sector)) %>
I'v
select_tag does not support prompt, as you have found.
Easiest workaround is probably to just prepend the option manually:
<%= select_tag(:sector_admin_select, "All" +
options_from_collection_for_select(@sectors, :id, :name, @sector)) %>
--
You received this message because you are subscribed
Thanks Robert. Your post helped me move forward with this.
I've made good progress and have parsed both XML files into one table to
make it simple, I'm now working on getting that data to my Shopify
store.
Thoroughly impressed with Ruby, and especially ActiveRecord so far.
--
Posted via http:
I used
<% = collection_select: category,: sector_id, @ Sectors,: id,: name,
{: prompt => "All",: selected => @ sector}, {: id =>
'sector_admin_select'}%>
It worked perfectly, but because I don't need to use the model
category, I thought it was more suitable to use:
<% = select_tag: sector_admin_s
Thanks very much for all of the answers.
I went with :departure_datetime => @date...(@date + 1.day) as this was
exactly what I was after.
Thanks also for highlighting the difference between Rails 2 and Rails 3.
I look forward to giving Rails 3 a try.
Best,
Jim
--
Posted via http://www.ruby-forum.
On 7 January 2011 17:31, Marnen Laibow-Koser wrote:
> Please quote when replying.
>
> Ants Pants wrote in post #973055:
> > Why?! Well, Prototype was great to get up and started and do fancy
> > things,
> > but then when I wanted to know how things worked or have more control, I
> > found I didn'
Marnen Laibow-Koser wrote in post #972966:
> James Byrne wrote in post #972964:
>> Interestingly, w3.org indicates that there are only two valid HTTP verbs
>> for the form and the submit elements. Those are GET and POST.
>
> Exactly. Which is why Rails fakes PUT forms as I explained earlier.
> It
Colin Law wrote in post #973150:
> On 7 January 2011 17:30, Robert Walker wrote:
>>> = 1) AND ("flights"."departure_datetime" >= '2011-01-07 17:21:56.932566'
>>> AND "flights"."departure_datetime" < '2011-01-08 17:21:56.932568')
>>
>> Oops, The above statements are actually correct but the resulti
On 7 January 2011 17:39, Peter Bell wrote:
> Hi All,
>
> I'm working with an API that returns me a collection of locations as a hash.
> I could just display things like @places[:feature][:name] etc, but that seems
> pretty ugly (and brittle) to me.
I don't quite understand what you mean by a co
cielo wrote in post #973129:
> I assume /~myid/blog/ will be the base address for every routing that
> will come to this address.
>
> How can I resolve this problem???
You're web server's virtual host should set /~myid/blog/public as the
site's DocumentRoot. You should be able to set this up in t
Hi All,
I'm working with an API that returns me a collection of locations as a hash. I
could just display things like @places[:feature][:name] etc, but that seems
pretty ugly (and brittle) to me.
So I'm tempted to have a non-AR, non-persisted model class called Place.
If I was writing this in
On 7 January 2011 17:30, Robert Walker wrote:
> Robert Walker wrote in post #973147:
>> Rails 2:
>> @flights = Flight.find(:conditions => { :arrival_airport_id =>
>> departure_airport_id, :departure_datetime => @date...(@date + 1.day) })
>>
>> Rails 3:
>> @flights = Flight.where(:arrival_airport_i
Robert Walker wrote in post #973147:
> Rails 2:
> @flights = Flight.find(:conditions => { :arrival_airport_id =>
> departure_airport_id, :departure_datetime => @date...(@date + 1.day) })
>
> Rails 3:
> @flights = Flight.where(:arrival_airport_id => departure_airport_id,
> :departure_datetime => @da
Jim Burgess wrote in post #973132:
> I have a flight model.
> I want to find all flights with a specific arrival airport, a specific
> departure airport and which depart on a certain date.
>
> My problem is that the departure date is a datetime column in the db and
> I wish to search this column by
Please quote when replying.
James Gaston wrote in post #973140:
> Fred,
> Thanks. Yes, I know all of that, so that is why these errors seem so
> odd.
Actually, the errors make a lot of sense. Browsers tend to request
favicon.ico automatically. If it's not there, no harm done. Likewise
with r
On 7 January 2011 16:36, cielo wrote:
> My home address is something like
>
> www.hosting.com/~myid/
>
> I uploaded my rails blog app in the blog folder,
>
> www.hosting.com/~myid/blog/
>
> and I ran 'rails server' to launch server. (in default, it will use
> port 3000)
>
> When I connect to the w
Colin Law wrote in post #973049:
> On 6 January 2011 22:33, Sawan T. wrote:
>>> rails_2.3.5 script/whatever
>>>
>>> But the smart money is on RVM.
>>>
>>> Walter
>>
>> Thanks Walter for your reply, I used the syntax rails_2.3.5
>> script/console nothing happened. Then I tried to see the rails vers
Fred,
Thanks. Yes, I know all of that, so that is why these errors seem so odd.
On Fri, Jan 7, 2011 at 4:33 AM, Frederick Cheung wrote:
>
>
> On Jan 7, 3:20 am, James Gaston wrote:
> > Hello,
> >
> > For those of you who have solved the learning hurdle of rails deployment,
> > all I can say is
At the point
If I stop in the debugger at
self.buyer_id = self.buyer.id # Won't work without this line, seems
un-DRY or worse
Then...
self.buyer has a valid :id
self.buyer_id is nil
On Jan 7, 12:34 pm, Frederick Cheung
wrote:
> On Jan 7, 4:04 pm, IAmNan wrote:
>
> > ordered_by is the ema
On Jan 7, 2011, at 8:48 AM, Jim Burgess wrote:
> Hi,
>
> I have a flight model.
> I want to find all flights with a specific arrival airport, a specific
> departure airport and which depart on a certain date.
>
> My problem is that the departure date is a datetime column in the db and
> I wish
TImbeTImbe wrote in post #973079:
> I have a the great task of migrating the backend of a large multi
> client application to Rails!
>
> I'm pumped for the opportunity to drop PHP, but a LOT of table schemas
> have a very "non-rails" setup. The main hangup is any image urls for
> the site live in a
Hi,
I have a flight model.
I want to find all flights with a specific arrival airport, a specific
departure airport and which depart on a certain date.
My problem is that the departure date is a datetime column in the db and
I wish to search this column by date (not datetime).
I have written the
On 7 January 2011 12:57, Tim Shaffer wrote:
> On Friday, January 7, 2011 6:39:17 AM UTC-5, Colin Law wrote:
>>
>> I have always assumed that when using form_for in erb one should use
>> <%= form_for . %>
>> However having done some tests it appears that it works identically
>> without the '='
For me 'annotate-models' is a must...
On 7 ene, 00:12, msp wrote:
> Hi all
>
> Not started a Rails project from scratch for a while so I'm curious..
> What are your "always in" plugins etc that you'd use for a new Rails
> project?
>
> Guess some people use templates for this task?
>
> Not after a
My home address is something like
www.hosting.com/~myid/
I uploaded my rails blog app in the blog folder,
www.hosting.com/~myid/blog/
and I ran 'rails server' to launch server. (in default, it will use
port 3000)
When I connect to the www.hosting.com:3000/~myid/blog/ It shows the
routing error
Please quote when replying.
Ants Pants wrote in post #973055:
> Why?! Well, Prototype was great to get up and started and do fancy
> things,
> but then when I wanted to know how things worked or have more control, I
> found I didn't know how to.
RTFM?
> Having a method that you pass arguments to
On Jan 7, 4:04 pm, IAmNan wrote:
> ordered_by is the email address on the order#form. You'll notice buyer
> shares the table with user. To head off questions about
> find_or_create_by, I have other things do to the new user where you
> see snip, and it also results in the user being created but
msp wrote in post #973069:
> Thanks for the suggestions all.. gives me a few new angles to
> investigate.
>
> The Ruby Toolbox site looks really interesting.
> HAML/SASS I'm comfortable with but I wasn't aware of the Grid/Blueprint
> stuff.
I don't want to get into a war here, but the reason I don
I have an Order, which belongs to a Buyer. Part of the order#form
allows the user to enter the email address of the buyer. If they email
address doesn't exist in the system, then a Buyer record is created in
a before_save filter.
The weird thing is I have to explicitly set the buyer_id field in a
Hey I'm new to rails, so not sure what I'll end up using, but in
addition to the above I found this:
https://github.com/leshill/rails3-app
Seems to include most things people end up using and a nice way to
start a new rails project.
Also coffeescript + node.js + rails seems to be getting more an
Thank you! I will have a look at it.
On 6 Jan., 17:59, Frederick Cheung wrote:
> On Jan 6, 3:53 pm, Gambo wrote:
>
>
>
> > Hi there,
>
> > i am very new to ror and i want to create a page which does the
> > following:
>
> > The user can register(devise) and can specifiy a page name e.g.
> > jond
On Jan 7, 1:30 pm, rajeevkannav wrote:
> hey all
>
> I have a huge application is there any way to know which gem and plug-
> in is using by my rails application
>
Remove them and see f your tests break :-)
Fred
> that makes me able to remove use less code in vender/plugins and
> requires gem
On Jan 7, 1:27 pm, Commander Johnson
wrote:
> Note: I'm on Rails version 2.3.8
>
> Hello,
>
> I'm running integration tests on my controllers with a Watir-controller
> Firefox. So two processes are running at the same time:
>
> Process 1: Mongrel server in test environment (script/server -e test
Strangely, I am able to get a response if I try accessing an individual
job id as json format:
Started GET "/jobs/4d2325fd35d31015fa01.json" for 127.0.0.1 at
2011-01-07 13:35:57 +
Processing by JobsController#show as JSON
Parameters: {"id"=>"4d2325fd35d31015fa01"}
Completed 200
hey all
I have a huge application is there any way to know which gem and plug-
in is using by my rails application
that makes me able to remove use less code in vender/plugins and
requires gem lines and my application will become easy to reinstall
and upgrade
Thanks
--
You received this messag
Note: I'm on Rails version 2.3.8
Hello,
I'm running integration tests on my controllers with a Watir-controller
Firefox. So two processes are running at the same time:
Process 1: Mongrel server in test environment (script/server -e test)
Process 2: ActionController::IntegrationTest running (also
On Friday, January 7, 2011 6:39:17 AM UTC-5, Colin Law wrote:
>
> I have always assumed that when using form_for in erb one should use
> <%= form_for . %>
> However having done some tests it appears that it works identically
> without the '=' so
> <% form_for ... %> is ok.
>
> Can anyone explai
Thank you for the links.
--
Thuy Nhien DOAN
Mobile phone: +84 923 862 630
OFFSHORING 2.1: http://www.facebook.com/home.php?sk=group_13400954319&ap=1
-
“Your heart is my piñata.”
--
You received this message because you are subscrib
On Jan 7, 3:20 am, James Gaston wrote:
> Hello,
>
> For those of you who have solved the learning hurdle of rails deployment,
> all I can say is congratulations! I'm struggling, frustrated that my app,
> which runs so well on my linux box, generates such odd errors on my vps and
> completely fai
For rails3 there is nothing yet. For rails < 3 there is
https://github.com/xdite/actionwebservice but it doesn't work yet and
I have no idea what to change to make it work. (new to ruby and rails)
it's also darn difficult to find the right fork to start from :(
On Dec 12 2010, 3:49 am, "rails.n...
I have a the great task of migrating the backend of a large multi
client application to Rails!
I'm pumped for the opportunity to drop PHP, but a LOT of table schemas
have a very "non-rails" setup. The main hangup is any image urls for
the site live in a large monolithic table with a column to desi
Hello,
For those of you who have solved the learning hurdle of rails deployment,
all I can say is congratulations! I'm struggling, frustrated that my app,
which runs so well on my linux box, generates such odd errors on my vps and
completely fails to do anything. For example, at the moment my
prod
On Jan 7, 11:39 am, Colin Law wrote:
> I have always assumed that when using form_for in erb one should use
> <%= form_for . %>
> However having done some tests it appears that it works identically
> without the '=' so
> <% form_for ... %> is ok.
>
> Can anyone explain this? I thought that
I have always assumed that when using form_for in erb one should use
<%= form_for . %>
However having done some tests it appears that it works identically
without the '=' so
<% form_for ... %> is ok.
Can anyone explain this? I thought that without the '=' the code
would be run but the result
Thanks for the suggestions all.. gives me a few new angles to investigate.
The Ruby Toolbox site looks really interesting.
HAML/SASS I'm comfortable with but I wasn't aware of the Grid/Blueprint
stuff.
Best
Matt
--
You received this message because you are subscribed to the Google Groups "Rub
On 7 Jan 2011, at 09:40, Ants Pants wrote:
> Why?! Well, Prototype was great to get up and started and do fancy things,
> but then when I wanted to know how things worked or have more control, I
> found I didn't know how to. Having a method that you pass arguments to is
> great but it isn't
On 7 January 2011 06:02, Sathiyaraj Gurusamy wrote:
> Alpha Blue wrote in post #972808:
>> More than likely related to this issue:
>>
>>
> https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/closed/#issue/69
>
>
> Yes. You are correct.. How i am rectify this error?.. Any idea?
Why?! Well, Prototype was great to get up and started and do fancy things,
but then when I wanted to know how things worked or have more control, I
found I didn't know how to. Having a method that you pass arguments to is
great but it isn't enough.
JQuery is a steeper learning curve but you have m
On 6 January 2011 23:30, Alpha Blue wrote:
> ...
> I have a permissions table with action types that have bits assigned. I
> can define permissions for all objects, including users, controllers,
> views, and even models. I'll give you a brief idea:
>
> https://gist.github.com/768843
>
> But, to
On 6 January 2011 22:33, Sawan T. wrote:
> Walter Davis wrote in post #972969:
>> On Jan 6, 2011, at 5:01 PM, Sawan T. wrote:
>>
>>> Thanks
>>> Sawan."
>>
>>
>> I believe you can always force a particular version of rails at the
>> command line by using this syntax:
>>
>> rails_2.3.5 script/whatev
>
> Dumb question: are you sure your changes are actually in use (ie whatever
> needs to be restarted has been restarted)? Can you replicate this on your
> development machine?
All other changes come in use as I expect? What could not be in use?
I tried to debug content of the response object
On 6 January 2011 21:34, Jose tomas R. wrote:
> Colin Law wrote in post #972821:
>> On 6 January 2011 14:25, Jose tomas R. wrote:
>>
>> Please quote the previous message and insert your comments at the
>> appropriate point, this makes it easier to follow the thread.
>>
>>> I dont need @order ar p
Thanks Fred.
Regards,
Bhupendra
On Jan 6, 9:47 pm, Frederick Cheung
wrote:
> On Jan 6, 4:18 pm, Bhupendra wrote:
>
> > # I successfully installed passenger on my window os by running
> > command
>
> > C:\ gem install passenger
>
> > when i run command C:\ passenger-install-apache2-module
> > ge
Great :-)
I will give it a try Robert, thanks for the help
--
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
70 matches
Mail list logo