[Rails] Re: [Feature idea] Truncating timestamp precision

2014-10-06 Thread Robert Walker
Agis A. wrote in post #1159152:
> Of course I can. I wanted to know if this seems useful to other people
> using Rails so I can start to work on this feature.

This doesn't feel to me like the sort of feature that warrants inclusion 
in ActiveSupport. There are a multitude of possible functions similar to 
this. I don't think it makes sense for ActiveSupport. This might be 
useful as an extension module, along with other similar functions, 
provided by a separate gem, but I'd have to down vote this for inclusion 
in ActiveSupport.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/720c385a8b850031ee62680d76b85b07%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Multiple domains

2014-08-20 Thread Robert Walker
http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-original_url

# get "/articles?page=2"
request.original_url # => "http://www.example.com/articles?page=2";

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/28f02a159b738e2e66064821ecf8f04a%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: SyntaxError on has_many association with block when trying to order

2014-08-18 Thread Robert Walker
Antonio Moreno wrote in post #1155440:
> Now, I want to order the associated records:
>
> has_many :children, dependent: :destroy, -> { order 'id asc' } do
>
> but this raises an error:
>
> SyntaxError in ParentsController#index

> has_many :children, dependent: :destroy, -> { order 'id asc' } do

This line looks wrong to me. You have a lambda arrow (-> with it's block 
{ ... } and immediately trying to open another block with do. Written a 
slightly different way it might look something like:

has_many :children, dependent: :destroy, -> do order 'id asc' end do

Here's an example that maybe shows what you're trying to do:

has_many :tracks, -> { order "position" }, dependent: :destroy

In this case it appear to me the lambda function is in the "scope" 
argument with options following and no block.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/64f8c9a3e29070cdb54c4d41d7e7c421%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: What is the question mark inside this regex doing?

2014-08-14 Thread Robert Walker
'John Merlino' via Ruby on Rails: Talk wrote in post #1155178:
> I thought the ? matches zero or one occurrence of a pattern. However in
> this example:
>
> def show_regexp(string, pattern)
>   match = pattern.match(string)
>   if match
> "#{match.pre_match}->#{match[0]}<-#{match.post_match}"
>   else
> "no match"
>   end
> end
>
> a = "The moon is made of cheese"
> show_regexp(a, /\s.*?\s/) #=> The-> moon <-is made of cheese
>
> What exactly is the ? doing?

*? -- 0 or more, lazy. Matches will be as small as possible.

/\s.*\s/.match(searchText) (not lazy)

/\s.*?\s/.match(searchText) (lazy)

/\s.*\s/ (not lazy)
The-> moon is made of <-cheese (1 match)

/\s.*?\s/ (lazy)
=> The-> moon <-is-> made <-of cheese (2 matches)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/7d945ebed056766f94fbfde72241a560%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: custom button. How to do this ?

2014-08-12 Thread Robert Walker
Roelof Wobben wrote in post #1154953:
> For my project I need a button which produces this in html ;
>
> Submit
>
> I tried already   and  but also that did not
> produce the output as I expected.

The button_tag signature:
button_tag(content_or_options = nil, options = nil, &block)

button_tag("Submit", { class: "btn btn-blue" })
=> Submit

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6fe390873e3430475e6b092ba60ae120%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Where do I place the javascript file that is only required for one (or just a few) view(s)?

2014-08-07 Thread Robert Walker
unknown wrote in post #1154022:
> Hi all,
>
> Sorry if this has already been discussed, but I haven't found any post
> matching what I'm looking for.  (If there is, please point me to it!)
>
> I'd like to include a javascript in the header section, but just for one
> view.  I went through the guides and I understand you can do something
> like
> this inside a particular view:
>
> <% content_for :head do %>
>   
> <% end %>
>
> However, if I add myJavascript.js in app/assets/javascripts, it gets
> loaded
> for every single page.

By default a new Rails application will load all javascript/coffeescript 
files under the app/assets/javascripts directory and all subdirectories.

Look for the following line in your application.js manifest file:

//= require_tree .

That does what it sounds like it would. It loads all javascripts in the 
entire subtree. This might be fine for very simple application, or for 
getting started, but probably not what you want in a more complex 
application.

This is explained in further detail here:
http://guides.rubyonrails.org/asset_pipeline.html#controller-specific-assets

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/e7c9abc39e7ef647c0cb3745f199f1de%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: How increase efficiency in develop

2014-08-05 Thread Robert Walker
Alex Korolev wrote in post #1154236:
> Hello.
>
> May you share your approach to increase efficiency.
> I can do a application on Ror but often I must remind  information in
> help.
> So my speed is very low.
> Do you have some tricks or I must write more code (more projects) and
> remember all?
>
> Many time a spend on front: ajax request and html - is it not enough
> knowledge and experiences?
>
> Thanks and sorry for my English.

There is really no substitute for experience. Tutorials will get you 
started, but they only take you so far. Books are useful, however, at 
least for most of us, we can't hold all their knowledge in our heads at 
once. Reference documentation is highly useful, but only if you already 
have a good enough understanding of the system to know where to look.

How can an author explain how to write a book, how can a sculptor 
explain how to carve a beautiful statue? Unless you experience it for 
yourself you can't really understand the intricacies and complexities of 
the craft.

My best suggestion is to focus your learning. Don't try to take on too 
many things at once. For example; if you can accomplish what you need 
without JavaScript/jQuery then concentrate your efforts there, on server 
side Ruby. Once you get comfortable there only then start to focus your 
efforts on client side code.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2d3dd9248b017888e00c8ea7a25f0730%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Executing ruby script before rails gets loaded

2014-08-04 Thread Robert Walker
Martin Ennemoser wrote in post #1154169:
> I have a ruby script which instruments Net::HTTP requests in Rails
> applications. This works as follows: When Ruby loads the Net::HTTP
> class, I
> alias the request method. At every http request, my instrumented method
> gets executed. So that this works, I need to execute my script BEFORE
> ruby
> loads the standard library and BEFORE Rails gets loaded. So I need the
> earliest possible point in Rails where I can require my instrumentation
> script.

Sound to me like you need to make your own Rack middleware and insert it 
into the stack in the appropriate place.

http://guides.rubyonrails.org/rails_on_rack.html

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/215779e70b54b82829cf9f5244fd80c7%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Session record not getting deleted

2014-08-04 Thread Robert Walker
Bharath Neo wrote in post #1154181:
> Hi,
> I have been asking this question in multiple forums like stackexchange
> but have not received a solution or proper help. Any help here is
> appreciated.
>
> I have a rails app with a session store database (mysql). When I want to
> clear a session, I reset the session variables and call reset_session.
> But then the record in mysql which was added on creating a session does
> not get cleared automatically (which it should).

Do you have reference to documentation stating that it should? To my 
knowledge using ActiveRecord session storage has always required manual 
purging.

This article might help:
http://blog.brightbox.co.uk/posts/clearing-out-rails-sessions

Besides using MySQL for session storage isn't currently recommended in 
the first place:

http://guides.rubyonrails.org/4_0_release_notes.html
---
ActiveRecord session store (commit) - The ActiveRecord session store is 
extracted to a separate gem. Storing sessions in SQL is costly. Instead, 
use cookie sessions, memcache sessions, or a custom session store.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0ac6f765e11e9ae7b9482f6283af234b%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Javascript call in mail Url

2014-07-31 Thread Robert Walker
Walter Davis wrote in post #1153927:
> On Jul 31, 2014, at 8:47 AM, Colin Law wrote:
> Also, if you expect a JavaScript to execute in a mail client (Outlook,
> Gmail, Mail.app) you will be waiting a very long time. That door is
> bolted securely shut for very good reason.

If I'm not mistaken this is also true for most web based mail apps 
running in browsers. Running JavaScript from user provided input (i.e. 
the HTML email body) would very much open up the email viewer page to 
XSS attacks. I'm quite sure the web mail clients would aggressively 
strip all JavaScript from the contents of the email.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cef94a8a4ba524ad579826d7fccb3521%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Your opinion on which technologies to use when building web applications

2014-07-25 Thread Robert Walker
Master Thesis Sqore wrote in post #1153331:
> Hi guys,
>
> I guess most of you usually click ignore when you see an email asking
> for a
> survey.

I couldn't find the "ignore" button so I guess I'll drop by two cents 
opinion...

> Yes, we are doing a survey as well, but very differently :) We are
> asking
> for opinions that will lead to a great value for all of you, with your
> contribution.
>
> Long story short, the goal is to help small medium companies with how to
> make choices from tons of available technologies when it comes to
> building
> web applications. Programming language, framework, database, frontend,
> hosting, developing tools, there are literally hundreds of technologies
> available out there.

Do you think that software writers haven't been asking this question for 
decades? How do you think we ended up with tons of available 
technologies to choose from in the first place?

> For doing that, we need to know what criteria people like you value the
> most while choosing technology stack in Web Development.

Even if we did compile a list of criteria from a wide range of software 
writers, associating those criteria within a wide range of contexts, 
which is the reality of the world of programming, we would end up almost 
exactly where we are today.

You have to realize that great programmers and do amazing things with 
the worst of tools. For example take PHP. There are some really amazing 
web site out on the Internet serving millions of users every day. But, 
at the same time there's this other truth... PHP is a horribly designed 
programming language.

http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

It doesn't matter whether this opinion is true or false. It matters that 
this is an opinion held by a huge percentage of software writers. At the 
same time those same software writers understand that some truly 
incredible things can be build with some of the worst available tools.

This is a reality of this weird world we live in as software 
professionals. We have come to understand over the years that it's the 
stuff in the minds of programmers that's important, their experiences, 
their preferences, and of course their brilliance that matters. Give 
them the tools that they know and are comfortable with and watch amazing 
things happen.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c60d064890a0c90371e3f130dab0cb5f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Regarding fetching the polygon data from google map and save in postgis

2014-07-21 Thread Robert Walker
Logesh m wrote in post #1152814:
> I have a requirement where I would need to create a geo fence and for
> that
> I have used the google map and the drawing tools and I could create a
> polygon using the drawing tool but I am not sure on how to save the data
> in
> postgis and I saw about rgeo but I was not clear on how to use that. So
> please guide me through the process and I also would like to know how
> the
> polygon data from the google map is received i.e., format of the data.
> From
> my understanding I think the postgis can save the WKT format and I don’t
> think google map is presenting the data as WKT. So, how can I get the
> data
> and save it in the postgis and then show the graph again from the table.

RTFM: 
https://developers.google.com/maps/documentation/javascript/shapes#polygon_inspect

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0a28da4fb0776ad0d9fce8c3b977190d%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Nested Iterator

2014-07-15 Thread Robert Walker
Jan Yo wrote in post #1152468:
> Is there a more compact way to do a nested each ?
>
> value.each do |x|
>   x.data.each do |y|
> puts 'x: ' + x + ' y: ' + y
>   end
> end
>
> That is can this be reduced to one or two lines?

value.each { |x| x.data.each { |y| puts 'x: ' + x + ' y: ' + y } }

There, one line...

Seriously though that is already about as compact a form as I'm aware 
of. What makes you think it should be condensed any further? As you can 
see my compacted version is already losing clarity and is harder to 
read, and understand it's purpose, than the original format.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/bf76b55e8576fe75dda49b3ed97aaab0%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Difference between Cookies and Sessions

2014-07-07 Thread Robert Walker
Praveen BK wrote in post #1151760:
> Hello,
>
>  Can anybody please define cookies and sessions and their
> differences in detail with reference to rails.

What may be confusing you, that I've not seen mentioned yet, is that 
session identifiers are stored in cookies. Let me explain by looking at 
the process...

Actors:
- User Agent (Web Browser)
- Local storage (Cookies, Local Storage, etc.)
- User (Person using User Agent)
- Application (Server side Rails, PHP, ect.)

1. User enters URL into address bar of User Agent (e.g. 
http://example.com/).
2. User agent looks up cookies in Local Storage matching domain (e.g. 
example.com).
3. User agent sends request, with attached cookies, to Application.
4. Application parses incoming request, extracting any cookies found in 
request.
5. Application searches for session cookie. Goto to #7 if found.
6. Application creates new session cookie if necessary
7. Application renders response.
8. Application attaches all cookies to response.
9. Application send response to User Agent.
10. User Agent extracts cookies from response.
11. User Agent stores cookies from response in Local Storage.

Noticed #6 says "if necessary". It's possible to have session-less 
requests (i.e session only on demand)

As you can see the "session cookie" is a cookie like any other. It is 
nothing more than an opaque identifier used to track a User between 
requests. Requests in HTTP are stateless, there is no way to know that 
two requests are really part of the same Application session. The 
concept of session is at the application layer and not at the protocol 
layer (HTTP), which has no notion of application session. To work around 
the stateless nature of HTTP we use cookies in order to emulate state.

Session cookies are cookies, but not all cookies are session cookies. 
Sometimes you just want to store arbitrary data in the User Agent's 
Local Storage, and have the User Agent send it back to you on subsequent 
requests.

Session cookies are not to be confused with Rails's cookie based session 
storage. This is also implemented using a cookie, and is separate from 
the session identifier cookie. Session storage cookies, of course, have 
the same limitations as any other cookie (because they ARE just a 
cookie). The limitation of the most concern is the 4K size limit. You 
cannot store more that 4K (total) for each Rails session, including the 
overhead info Rails puts in the session storage cookie.

Normally this is not a problem since you want to minimize the amount 
information you store in a session. A common item for session storage is 
the User, so that you can match a specific session to a specific user of 
your application. It is important to understand that there is no need to 
store the entire User model in the session. All you need to store is the 
"id" of the User model so that you can lookup the actual User model on 
each request. (Example: session['user_id"] = some_user.id NOT 
session["user"] = some_user)

Hope this helps clear thing up for you.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6ebf37cfe2d10b1c4f2f17bd9e898c20%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Best scalable database

2014-07-01 Thread Robert Walker
Tudor Cojocaru wrote in post #1151044:
> I was wondering which is the best database in terms of scalability and
> also which core nosql system is the best (Document Store - Graph
> Database)

This is like asking which car is the best. You ask 5 people and you'll 
get a least 4 different answers along with a laundry list of conditions, 
scenarios and it depends.

For all intents and purposes this is an unanswerable question.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/eeef9c865c346bd6b0e1aef34804e313%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Execute as a service

2014-06-26 Thread Robert Walker
Josu Lazkano wrote in post #1150848:
> Thanks!
>
> I execute as daemon (rails server -d), and it works well.
>
> I read about Passenger, it looks really interesting.

I actually use Passenger standalone for development and Passenger on the 
server for deployment. Works great for me.

I don't, however, typically run my server in development as a daemon 
process. Instead I run it in a separate shell so that I can easily 
monitor the development log as it displays in the terminal window. Then 
I use the other shell to execute commands. So I just have two tabs in my 
Terminal app... well actually three, where the third is running guard so 
I can see the results of my texts as I develop.


https://www.phusionpassenger.com
http://guardgem.org

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a288ef9dd0b11caa281fc99dfeb667e0%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: What is a good practice for storing additional classes

2014-06-26 Thread Robert Walker
Ronald Fischer wrote in post #1150799:
> My Rails application also contains classes which are independent from
> the Rails framework, in that they could be reused unchanged if I would,
> for example, created a  non-web-based, command-line version of my app.
> Such a class could be one which implements business logic, or a simple
> utility class.
>
> The question is: What is a good practice of integrating it?
>
> In a "non-Rails" application, I would create a directory app/lib and put
> the rb files there. I would ensure, that RUBYLIB points to this
> directory, and I would do a "require" in those files where the classes
> are needed.
>
> This should also work within Rails. However, is this good practice? How
> are experienced Rails developers handle this?
>
> Note also, that these classes will be instantiated only inside a
> controller, not in a view or model.

Ruby has a mechanism for this. They are called "gems", libraries of 
shared code. Rails provides a "lib" directory for code more tightly 
coupled with the application in which they are used. If you do have 
model classes that are not subclasses of ActiveRecord there's still no 
reason they can't live inside the models directory along side your 
ActiveRecord subclasses.

Ruby also provides modules and mix-ins for adding functionality to 
existing classes, this can often be a good way to implement utility 
methods.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cef32e2678b9a24af0f4d6ccbb8886ca%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Pass a ruby variable into js within Rails

2014-05-29 Thread Robert Walker
Pierre-Andre M. wrote in post #1147586:
> I have a variable created by some ruby in my controller that looks like
> this:
>
> @begpoint = row["begpoint"]
>
>
> and I want to pass it into some js that is referenced from within my
> view:

There are several way of doing this, but the simplest is to use HTML5 
data- attributes.

Example:

HTML:


... page content


jQuery:

var begpoint;

$(funtion() {
  begpoint = $('body').data('begpoint');
});

So to think of is as "pass it to JavaScript" is sort of inside out. You 
use JavaScript to "get" the value from the DOM. jQuery gives you nice 
syntax for doing just that.

This is good for relatively small amount of data. If you need lots of 
data in your JavaScript there are alternatives to this technique. A good 
place to learn something about those techniques is something like 
Backbone.js, Ember.js or Angular.

http://backbonejs.org
http://emberjs.com
https://angularjs.org

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/714ade55ebdc879859a21aff99b0a140%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Ticketing Gem in Rails

2014-05-22 Thread Robert Walker
Ankur Kumar wrote in post #1146768:
> I am looking for details about any simple ticketing gem which can do
> following:
>
> -Track received and sent notifications between two entities
> -Assign status - (open/closed/resolved) etc to these notifications
> -Update existing ticket status with follow up messages
>
> Can someone suggest if there are good gems to achieve this objective?

I'm not sure if this is exactly what you're looking for, but there are a 
few really nice gems, included with Rails, to do precisely what you 
want. They are called ActiveRecord, ActionPack, ActionView and a few 
other supporting gems. To facilitate their use they are based on this 
thing called Ruby, which can be used to translate your intentions into a 
working information system, like the "Ticketing" system you would like 
to build.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4e5de482b5f42dd73a7448f6e9391609%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: 'rails generate scaffold' is adding an 's'

2014-05-18 Thread Robert Walker
Gerald Vim wrote in post #1146378:
> Using Rails 4.1.1 this command:
>
> rails g scaffold Main home contact events about
>
>  generates:
>
> app/controllers/mains_controller.rb
>
> Why has 's' been appended? This didn't happen with 4.1.0.

Did you mean "rails g controller main home contact event about"?

If you use scaffold Rails with generate based on "Main" being a model 
first then generate a controller and views based on the model name 
pluralized based on inflections database.

It also seems really odd to me your choice of methods to add to your 
controller. Shouldn't "home", "contact", "events" and "about" have their 
own controllers with their own routes?

$ rails g controller main home contact events about
  create  app/controllers/main_controller.rb
   route  get 'main/about'
   route  get 'main/events'
   route  get 'main/contact'
   route  get 'main/home'
  invoke  erb
  createapp/views/main
  createapp/views/main/home.html.erb
  createapp/views/main/contact.html.erb
  createapp/views/main/events.html.erb
  createapp/views/main/about.html.erb
  invoke  test_unit
  createtest/controllers/main_controller_test.rb
  invoke  helper
  createapp/helpers/main_helper.rb
  invoketest_unit
  create  test/helpers/main_helper_test.rb
  invoke  assets
  invokecoffee
  create  app/assets/javascripts/main.js.coffee
  invokescss
  create  app/assets/stylesheets/main.css.scss

$ rake routes
  Prefix Verb URI Pattern Controller#Action
   main_home GET  /main/home(.:format)main#home
main_contact GET  /main/contact(.:format) main#contact
 main_events GET  /main/events(.:format)  main#events
  main_about GET  /main/about(.:format)   main#about

I suppose this would work, but still seems quite add to me.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b9ab11c571f0d2fe348a83d77bf7fc20%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: NeedHELPASAP

2014-05-13 Thread Robert Walker
Joener Preagola wrote in post #1145843:
> Im not familiar on dependency injection
>
> Remove Car's explicit reference to Engine by using dependency injection.

The first question to ask yourself is, "Why is it important to use 
dependency injection in this specific scenario?"

After all this is Ruby, not some lame statically typed language like 
Java or something. In Java Dependency Injection (DI) is uses to solve a 
lots of issues that are mostly due to limitations of the language 
itself. In fact it requires looking outside of the language itself to 
even support DI (i.e. XML configuration files or Java annotations).

There's a tendency to make DI sound like something magical or 
complicated in the Java world, but in Ruby (and other dynamically typed 
languages) you won't here much about it. Mostly because it's a really 
simple concept with a really simple implementation.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9a2d304b6fe164c96217ea1ba5d85969%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: convert json string to hash

2014-05-08 Thread Robert Walker
prabhu wrote in post #1145452:
> I have a string object which is basically in a json format and while
> trying to print it shows in console as
>
>
> item =
>  {
> "id": "4c9f83e4-f479-48d0-9f92-3fff70a8f6ba",
>  "item":
> 
"{"business":"1114","class":"Demo","date":"01-01-2014","version":"","data":"dummy","name":"Finance"}"
>
> }
>
> I need to get the values of business, class, date etc and pass it as
> params
> to my method. So I tried to convert it into hashes as below
>
> hash_item = JSON.parse (item)
>
> and output in console shows as
>
> The converted hash item is
> {"guid"=>"4c9f83e4-f479-48d0-9f92-3fff70a8f6ba",
> 
"item"=>"{"business":"1114","class":"Demo","date":"01-01-2014","version":"","data":"Dummy","name":"Finance"}"}
>
> But when I try to access the hash value for business as
> `hash_item['item']['business']` it shows
>
>> "business"
>
>  since the value of item is a String in the hash_item. I am not sure
> whether my approach is correct or not. So is there any better idea or
> any
> inputs to retrieve the hash values . Please help.

Let me try to explain by example...

JSON demo 1:

{
  "id":  "4c9f83e4-f479-48d0-9f92-3fff70a8f6ba",
  "item": {
"business": "1114",
"class": "Demo",
"date": "01-01-2014"
  }
}

item = "{\"id\":  \"4c9f83e4-f479-48d0-9f92-3fff70a8f6ba\",\"item\": 
{\"business\": \"1114\",\"class\": \"Demo\", \"date\": \"01-01-2014\"}}"

json = JSON.parse(item)
=> {"id"=>"4c9f83e4-f479-48d0-9f92-3fff70a8f6ba", 
"item"=>{"business"=>"1114", "class"=>"Demo", "date"=>"01-01-2014"}}

json['id']
=> "4c9f83e4-f479-48d0-9f92-3fff70a8f6ba"

json['item']
=> {"business"=>"1114", "class"=>"Demo", "date"=>"01-01-2014"}

json['item']['business']
=> "1114"

json['item']['class']
=> "Demo"

JSON Demo 2:

{
  "id":  "4c9f83e4-f479-48d0-9f92-3fff70a8f6ba",
  "item": "{"business": "1114","class": 
"Demo", "date": "01-01-2014""
  }"
}

item = "{\"id\":  \"4c9f83e4-f479-48d0-9f92-3fff70a8f6ba\", \"item\": 
\"{"business": "1114", "class": 
"Demo", "date": "01-01-2014"}\"}"

json = JSON.parse(item)
=> {"id"=>"4c9f83e4-f479-48d0-9f92-3fff70a8f6ba", 
"item"=>"{"business": "1114", "class": 
"Demo", "date": "01-01-2014"}"}

json['id']
=> "4c9f83e4-f479-48d0-9f92-3fff70a8f6ba"

json['item']
=> "{"business": "1114", "class": 
"Demo", "date": "01-01-2014"}"

json['item']['business']
=> "business"

It appears to me you're seeing something like "JSON Demo 2". What you 
want is what you see in "JSON Demo 1".

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cf43e09d59a670d6697fe3019cc02fa7%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Ability for users to insert images into text area

2014-04-28 Thread Robert Walker
Colin Mr. wrote in post #1144182:
> So like many other beginners in Rails I'm following along to Michael
> Hartl's tutorial.  I'm nearing the end, and I'm thinking I would like to
> implement the ability for users (in the social network) to upload pics
> along with their comments and maybe even add a text editor type thing
> (not
> sure the correct term for this either)... ?  Can this be accomplished
> through a gem, and/or is this something a little advanced for a newbie
> like
> myself?  Really appreciate your feedback!

Text area (as in the  tag) has no support for image data. It 
accepts plain text only. In order to upload images you need a  along with adding the enctype="multipart/formdata" 
attribute to the form tag ().

There are gems to help you with this:

http://bcjordan.com/posts/rails-image-uploading-framework-comparison/

I've used Paperclip myself in the past, but have also heard good things 
about Carrierwave.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/70109866ad8b1f93cc691fbbfe642756%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Asset Pipeline without SCSS?

2014-04-24 Thread Robert Walker
Walter Davis wrote in post #1143688:
> Is it possible to configure Rails through a .railsrc directive to not
> use SCSS, but still use the asset pipeline and Sprockets? I know that I
> can rename the files manually, and it does work (the files are
> concatenated and minified without issue), but I'd like to skip the
> entire renaming part of that process if possible. I've read through the
> command-line guide, and the API documentation, but I have not been able
> to locate a flag for this preference yet.

1. Open Gemfile
2. Comment out:
gem 'sass-rails', '~> 4.0.3'

Rails generators will no longer create *.css.scss but instead create 
*.css files.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/be71adcb695d6de5c525b6d183b025bf%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: What's going to explode.

2014-04-23 Thread Robert Walker
Walter Davis wrote in post #1143883:
> ...if I just bump Rails from 4.0.4 to 4.1? How dramatic a jump is this
> update?

My guess is probably not much if you follow this guide:

http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-4-0-to-rails-4-1

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d69f06cff77ba2f843d5b9b416ed011a%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Social Network in RoR

2014-04-18 Thread Robert Walker
Juan Gutiérrez Ortega wrote in post #1143438:
> For this slide and article:
>
>  https://engineering.groupon.com/2013/misc/i-tier-dismantling-the-monoliths/

"In general the single app architecture is the problem, not the 
language/runtime/web framework. I’m sure there are ways that we could 
have improved the monolith, but having apps with limited responsibility 
gave us more value. We could have used Rails to get to this new 
architecture, but we felt Node with our home-grown application stack 
gave us more flexibility."
-- Sean McCullough

This was the key comment that I took from this excellent article. This 
has everything do with moving from a "monolithic" web application to a 
modular service oriented architecture.

Did you actually read though this article yourself?

"We built the Groupon routing service (which we call Grout) as an nginx 
module. It allows us to do lots of cool things like conduct A/B tests 
between different implementations of the same app on different servers."

They essentially build their own "home-grown application stack". If you 
have the time, experience and manpower to do that then fantastic, go for 
it.

I guess what I'm saying is to consider where they started, and how they 
grew (and eventually outgrew) their stack. Imagine if Groupon started 
out saying, "We're going to build our own web stack so that when we have 
millions of visitors per day we can handle the traffic. We have one or 
two developers to get this done, and by the way we have no idea what we 
actually need."

Just consider how far Ruby on Rails has taken Groupon, and the success 
it has afforded them. There's a lot to be said about actually delivering 
a product/service. Rails can often still be one of the best and fastest 
frameworks for delivering real services. There is no "silver bullet" 
framework that perfectly handles everything that anyone might ever need.

Having too much traffic for your web application stack to handle is a 
good thing. It means your existing stack served its purpose and helped 
make your site a success. When you realize that success, and you have a 
reasonable business model, then you will have the resources to consider 
building your own, finely tuned, web stack tailored specifically for 
your needs.

> 
http://www.slideshare.net/pcalcado/from-a-monolithic-ruby-on-rails-app-to-the-jvm

This presentation was clearly written by a Java guy with a Java mindset. 
Yes, he talks in the presentation about how "We, the Java community, 
screwed up," however he clearly still has that Java mindset. An 
indication of this is putting static typing in the "pro" column.

Let's take a close look a reference to one of the slides in the 
presentation:

"Dependency injection is not a virtue in Ruby" -- DHH

Did you actually read the full article by DHH? Not just the out of 
context snippet pasted into the slide? If not then you should.

http://david.heinemeierhansson.com/2012/dependency-injection-is-not-a-virtue.html

I've seen dozens of articles similar to this one, and hear this 
practically ever day in my day job (as a Java developer no less). It's 
all "sour grapes" in my mind. Statements like, "Rails is good for toy 
blog sites" is really off-putting. But, when I hear things like this I 
start to consider those "toy" web sites.

I would certainly not consider sites like Basecamp, Pivotal Tracker, 
GitHub and the thousands of other successful web applications that use 
Ruby and Ruby on Rails, in full or in part, to be anything close to 
"toy" sites. Even sites that decided to move on to other architectures, 
famously Twitter, turned nothing into an extremely popular service, in 
large part due to starting with Ruby on Rails.

To conclude Rails, like any web framework, has its place and is a really 
great way to get something started. In more cases than not its perfectly 
capable of handling traffic and scaling out nicely. Having to worry 
about scaling issues is a good thing. If your current stack can't handle 
it then you should have the resources to address those issues.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d1959a35c1011d46fd1e8250d43e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Database strong structure change: migrations

2014-04-16 Thread Robert Walker
Martin wrote in post #1143301:
> Hi there,
>
> I have some major structure change issues with an ruby on rails
> application, and I'd like to ask you about how i can handle that.  I
> will
> make some dummy problems for you to show what i want to reach:
>
> 1. Having a Client model with first_name and last_name should now come
> together as name:
> For the model it would be easy to have just
>
> def name
>first_name + ' ' + last_name
> end
>
> That works, but now I want to change the database this way, so we dont
> need
> the first_name and last_name anymore:

IMHO that is a bad idea. Chances are likely that you would come to 
regret that decision. If you ever use either first_name or last_name 
separately from each other then you violate First Normal Form (1NF). The 
bigger issue is that once you decide to concatenate these two values in 
to a single field there's no going back. There is no reliable algorithm 
that can separate the two distinct values.

I say if you already have separate first and last names keep it that way 
and add full_name method to the model. That costs you nothing really and 
preserves flexibility in your app.

> I could create a migration having a name:string:index field.
> but after that - how can I make all the first_name and last_name applied
> there, and remove the first_name and last_name fields?

Whatever you decide, you are not limited to the ActiveRecord helpers in 
your migrations. You can run any arbitrary SQL you want using the 
execute method:

http://guides.rubyonrails.org/migrations.html#when-helpers-aren-t-enough

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b4e16f0bfa52e9dd2d103d290a04eecb%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Configure restful web service in rails

2014-04-16 Thread Robert Walker
Colin Law wrote in post #1143272:
> On 16 April 2014 13:34, prabhu  wrote:
>> Hi,
>>
>> I am trying to create a Rest web service in my rails application. I need to
>> configure urls for it as below.
>>
>>
>> localhost:3000/book/book_id/new/param1/param2/param3/param4/...
>
> That might be better as book/id/new?param1=..¶m2=.. etc.
> What is that url supposed to do?  If it makes a new book then why have
> you got an id?

As Colin noted, if this is intended to create a new book then it seems 
more logical to me to send this as a POST with the parameters in the 
body of the request (either supplied as form data or JSON) and not in 
the GET style of appending the parameters to the URI.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6619ce3746b09301e5ae7fab483f44c3%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Push user.id to another Controller

2014-04-15 Thread Robert Walker
Alfredo Barrero wrote in post #1143117:
> Good morning everyone,
>
> I have a question, if anyone can answer it would be great. I'm trying to
> send the user.id from the "users/show.html.erb" to
> "photos_controller.rb",
> but I'm not sure how to do it. I can send the user information to the
> Model
> but I'm not sure is that is correct.

Speaking generally, users are authenticated (login form) and the id of 
the user is stored in the session so that each controller can access the 
user directly from the user's session.

It is certainly possible to pass the user's id along from request to 
request, but that's not typical for most apps.

For an example you can take a look at Devise authentication framework, 
which provides you a "current_user" method that is accessible from any 
controller:

https://github.com/plataformatec/devise

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/34e3d4c2d58a440f1b19c71868d26f0c%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: TextArea Parameter

2014-04-07 Thread Robert Walker
Robert Walker wrote in post #1142180:
> The documentation contains your answer:
>
> 
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_area

In case you didn't get that here's an example:

<%= f.text_area :description, { id: "my_description" } %>
=> 

If you wan't to override any of the defaults you can pass what you want 
in the "options" hash.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a61fc5936143cd0f17c429e57b161b32%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: TextArea Parameter

2014-04-07 Thread Robert Walker
The documentation contains your answer:

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_area

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c1b71f2c2e6ce1eb871ce67e160d676f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: How to add funtionalities to images

2014-04-04 Thread Robert Walker
Elton Yau wrote in post #1142007:
> Hi Guys,
>
> So my friend drew an image of a form and passed it to me as a PNG file.
> I
> have placed those images on my site (as shown in attached image).  How
> do i
> add functionalities to these images (more specifically, i want to make
> buttons and also create the form and drop down menus, etc)
>
> Thanks in advance !
>
> 

> Elton


All of that can be done with basic HTML and CSS, with the exception of 
The picture of the person and the little Facebook icon.

The image is simply for reference to show you basically what to build. 
It's just a mockup.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2a08112e87f351d9d0736de070fdfdd3%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Dependency Management

2014-03-26 Thread Robert Walker
Matthew Riley wrote in post #1141041:
> I understand the code is not specific to Rails, however I am
> specifically
> interested in Rails developer’s perspective. Thanks!

Perspective on what? As you demonstrate, Dependency Injection (DI) is a 
really simple concept, with a really simple implementation, in dynamic 
("Duck Typed") languages like Ruby.

Are you asking to verify what you have shown is "Dependency 
Inject/Inversion of Control?" If so then sure it is.

Are you asking if Rails developers spend a lot of time worrying about 
"Dependency Injection" or creating elaborate frameworks to support DI? 
That would be a pretty resounding "NO".

Given that a high percentage of DI usage is related to testability, it 
might do you good to look at one of the popular testing frameworks used 
by Rails developers, for example:

https://github.com/rspec/rspec

You won't see a lot of talk in there about DI or IoC mumbo-jumbo. You'll 
see the stuff that's actually important, like test doubles, mocks, 
stubs, etc. Ruby is a dynamically typed language without all those pesky 
static type dependencies. Take advantage of that in whatever way makes 
sense.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ffa4e95419882d5fd694e225e0cbd562%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: beginner to ruby programming

2014-03-26 Thread Robert Walker
Jaya Ruhil wrote in post #1141029:
> hi every one ,
> i am beginner to ruby, i don't know a little bit of ruby, but i have to
> learn it bcz i m going to work as a system admin , and for client server
> automation using puppet i required concept of ruby, can any body help in
> in directing me , towards learning it quickly and easily.

http://tryruby.org/

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2965214fba473d6c1d97bd0d1d2c641f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Why does calling .delete_all on has_many relationship nullifies foreign keys.

2014-02-19 Thread Robert Walker
unknown wrote in post #1137005:
> Yes I know I can set :dependant => :delete_all
>
> but what's resoning behind this default behaviour? Is it just a legacy
> stuff?

> anyone knows why the default behaviour here is to nullify keys?

Actually, the Rails documentation explains this rather clearly, so the 
behavior you're seeing is exactly as it was intended.

Excerpt:

delete_all()
Deletes all the records from the collection. For has_many associations, 
the deletion is done according to the strategy specified by the 
:dependent option. Returns an array with the deleted records.

If no :dependent option is given, then it will follow the default 
strategy. The default strategy is :nullify. This sets the foreign keys 
to NULL. For, has_many :through, the default strategy is delete_all.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/989a89a5f722d74560c4b13205361ea5%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: I failed in C language , what about ruby on rails?

2014-02-18 Thread Robert Walker
haytham agbariah wrote in post #1137023:
> Hello , I tried to learn C language , I failed twice in the C
> course(because of Binary trees) ..
> I believe that ruby on rails is the future , Should I give up on
> programming ? or there is no connection between Failing in C and
> Succession
> in ruby on rails ?
> please , don't hesitate to share us , your point and your experience .

I've been programming for many years using many different programming 
languages. I barely consider the syntax of a language to be a major 
barrier to success as a programmer.

The algorithms of a program don't change much between languages. Yes 
some languages have feature that make things more convenient, and some 
are more enjoyable to work with (as is the case with Ruby). However, if 
you can't grasp the basic concepts then the choice of language isn't 
going to suddenly cause everything make sense to you.

Take your example... If you failed to understand binary trees in C then 
you won't understand binary trees in Ruby either. That being said I 
would not give up on your efforts to be a programmer on the basis of not 
understanding binary trees. The fact is that there's much one can 
contribute without knowing a thing about binary trees. That can be 
learned once you get a better overall understanding of programming. In 
fact I'd likely have to go back and review them myself, even after all 
my years of experience, in order to pass that C course.

This is a career that you don't want to choose lightly. If you are not 
enjoying your experience learning to program then you might want to 
think twice about continuing. Most great programmers I know do this 
because they love doing it. If you don't then you're probably going to 
cause yourself a world of frustration, which will bleed into every block 
of code you write. This will eventually lead to frustration for other 
programmers that will be obligated to go back and fix your code.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cf9b9fb96c247114cd75e5f713eb5983%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Rails where clause help

2014-02-18 Thread Robert Walker
Robert Walker wrote in post #1137051:
> @users.where({ name: @request.requester, name:
> @request.regional_sales_mgr }).all
>
> Just note that this would never return any results since "name" can only
> have one value at a time.

Except in the case where @request.requester == 
@request.regional_sales_mgr.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/38ee74318d6cea3b56a871c25882db84%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Rails where clause help

2014-02-18 Thread Robert Walker
Arup Rakshit wrote in post #1137044:
> Hi,
>
> I found one answer from - http://stackoverflow.com/a/20198450/2767755
>
> @users = User.where(name: [@request.requester,
> @request.regional_sales_mgr]).all
>
> Here @users will be having all those users, whose names are either
> `@request.requester` or `@request.regional_sales_mgr`.
>
> But what is the Ruby statement to get the result of -
>
> "@users will be having all those users, whose names are
> `@request.requester` and  `@request.regional_sales_mgr`" ?

I don't see how you're request make sense. Here we have a single 
attribute ("name") so you seem to be asking how to ask something like 
the follow example:

Users where name is "Bob" and "Alice". How can a single attribute 
simultaneously have two different values? It seems to me that you want 
to use the OR condition just like the original statement, which would 
cause you @users to contain all users where the name is either "Bob" or 
"Alice".

But if you really want to see the syntax here's what it might look like:

@users.where({ name: @request.requester, name: 
@request.regional_sales_mgr }).all

Just note that this would never return any results since "name" can only 
have one value at a time.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b647e281274c5a6d4f120eee043fc262%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Help Installing rbenv?

2014-02-12 Thread Robert Walker
John Weiss wrote in post #1136424:
> http://s19.postimg.org/ss009x84z/term.png

Did you also install ruby-build? rbenv does not come with the rbenv 
install command by default. rbenv itself is just a Ruby environment 
manager, and not an Ruby compile and install manage. That's what the 
ruby-build plugin does.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/840e4aae008db85c545fa57832acede2%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Can two Rails versions use one database?

2014-02-05 Thread Robert Walker
Russ Dast wrote in post #1135683:
> Thanks Walter and Jim for your feedback. The Railsconf talk was indeed
> informative, although we are still leaning against an upgrade path and
> are
> more likely to choose a rewrite-based approach. Jim, I hadn't thought
> about
> the flash, so thanks for pointing that out. I think we can probably
> manage
> by limiting flash feedback to one site or the other. We might have to
> make
> some workflows slightly more complicated for that to work.

I think the point was you'll need to deal with session sharing as a 
whole. The flash is really just stored in the session anyway, so if you 
solve the session issue then you solve the flash issue along with it.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/37fab9f5a30d4813aa566650703e905e%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Ruby on Rails based Web IDE

2014-01-27 Thread Robert Walker
Oleksii Zaitsev wrote in post #1134538:
> I am going to create Ruby on Rails application that works like minimal
> web
> based IDE.
>
> I want to implement several components:
>
>1. Web terminal to interact with local unix machine.
>2. Tree view file navigation.
>3. Text editor with syntax highlight.
>
> The main goal of application is to create/edit ruby or python script in
> editor, run it in the terminal and see the output.
>
> I investigated this tool http://codiad.com/ It has good file editor and
> terminal plugin. But it seems too complex and it has php backend.
>
> Is there any tools like web terminal or file editor that are easy to
> integrate into rails application?

You might try asking how these guys do it:
https://www.codeschool.com

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6dcdb609627c791ab2ce8130821a8cb0%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Rails 4 and Ruby 2 on Windows 8.1

2014-01-09 Thread Robert Walker
Eastside Developer wrote in post #1132713:
> Has anyone been able to do this successfully? and what's the best
> equivalent to RVM in the Windows world?

Why would you want to? Throw a Linux VM on there and go to town with 
Rails.

P.S. I know there are some extreme circumstances where this is simply 
not possible, but if it is for you then you'll have FAR AND AWAY less 
trouble developing in Rails and all the cool UNIX'y tool that go along 
with it. Everything related to Rails just works better!

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f92deed99b4b8d74fa8b7a42a147bd11%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Working with JavaScript

2014-01-06 Thread Robert Walker
James Turley wrote in post #1132300:
> 2) Use JQuery or a similar library (JQuery is in your standard Rails
> project gemfile) to add a listener. It would be something like this:

As you might have guessed option 2) is the RIGHT option (as opposed to 
the, "It may be ugly but it works!" option").

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/532a9b5d94170e5bc7b447b4046bda1d%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: ActiveRecord simple question about date

2013-11-19 Thread Robert Walker
Colin Law wrote in post #1127964:
> On 19 November 2013 18:36, rusik  wrote:
>> yes, it is string. I find decision , i am using date without zero's like
>> this:
>
> Just to convince us show us the users table entry from db/schema.rb.

Just a thought, but if the birthday is truly being stored in a string 
(varchar) field, doesn't that make localizing your application somewhat 
more difficult?

05/09/1945 - U.S.A
09.05.1945 - Europe
1945年5月9日 - Japan
Wednesday, May 9, 1945 - U.S.A Long Format

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/54c45be19d24af9049f0baa7f39e7d53%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: has_many question

2013-11-11 Thread Robert Walker
Dave Castellano wrote in post #1126985:
> Hi all,
>
> I need some guidance please.
>
> I have several tables related by "has_many" and I would like to find the
> "distant children".
>
> Tables:
> Subjects
> Books
> Chapters
> Sections
> Subsections
> Minisections
>
> They are all related heirarchichally, so book for example is related to
> subjects and chapters the following way. All are related the same way.
> Book
>  belongs_to :subject
>  has_many :chapters
>
> So if I have the subject id, how can I find all the Minisections
> belonging to that subject?

Database normalization is a good thing... until it isn't. I fear you've 
run into one of those situations where de-normalization might be very 
useful for the sake of efficiency.

Instead of doing a fully hierarchical structure you could flatten parts 
of it. For example your Minisection could have id, subject_id, book_id, 
chapter_id, section_id, subsection_id and then:

Minisection
  belongs_to :subject
  belongs_to :book
  belongs_to :chapter
  belongs_to :section
  belongs_to :subsection

Now you can find any list mini-section without using any joins in any 
way you see fit.

minisections = Minisection.where({ subject: my_subject, book: my_book, 
chapter: my_chapter, section: my_section, subsection: my_subsection }

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c4bf1a0cb88cd96d391cfca4ec5c21a2%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Is it possible with Rails to interact with SVN Server and/or the server's shell?

2013-11-06 Thread Robert Walker
Monserrat Foster wrote in post #1126594:
> Explaining a little further what I need is to set the permissions to
> determined users from the app, however, the files aren't in the same
> server

Keeping in mind that what I'm about to say is completely off the top of 
my head...

Given that your documents are stored on a separate server from the app 
thing get a little more tricky. For sake of reference let's call them 
"Doc Server" and "App Server".

Assuming you have enough control of the Doc Server that you could 
install a service application that's probably the approach I would take. 
I would hide all access to the files behind a service application with 
some sort of HTTP interface. It would be REST based if I were to build 
it returning JSON responses. It would also provide secured access to the 
requested files. So we have JSON for the file metadata and HTTP access 
to the file data.

The service app would have a multi-part form upload used to receive 
incoming files from a user. The service app would need to know the name 
and email of the user, the path in the local git working tree along with 
the file data.

git add --all

Used to add any new (untracked) files to the git repository.

git commit --author="John Doe " -m "Changing a test 
file."

This would commit all change setting the commit author to "John Doe 
".

git log --author="John Doe "

This would filter the log output to just John's commits.

git log --author="John Doe " --name-status

This would also include a list of files changes and the status code for 
the type of change.

All of this power would be available to the service application via the 
Ruby system command (or back tic):

-
#!/usr/bin/env ruby
git_user = "John Doe 
Commit: Robert Walker 

Changing test file.

M  test.txt

Notice I used --pretty-full in this example to illustrate the difference 
in the author vs. the committer of the change. The committer would 
always be the service app, or whatever is configured in your git config. 
The author is provided by the service application.

Now it's just a matter of writing a Ruby class to parse the git output 
and create the JSON metadata that the service application would return 
to the application running on the App Server.

Secure the whole this with some sort of basic single sign-on or API 
token.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d6a57e2d5d36f7af40c9b43b216a39a6%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Is it possible with Rails to interact with SVN Server and/or the server's shell?

2013-11-06 Thread Robert Walker
Robert Walker wrote in post #1126590:
>
> Issuing system commands is as simple as:
>
> system svn 

My apologies, but you need to quote the command part:

system 'svn '

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c2dce19ddeb7f94b3dbfda6fbac8fa01%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Is it possible with Rails to interact with SVN Server and/or the server's shell?

2013-11-06 Thread Robert Walker
Monserrat Foster wrote in post #1126580:
> Hello! I'm fairly new to Ruby and Rails, and currently I don't have any
> knowledge on interacting with the server's shell or a SVN server, but
> now I
> have to develop an app where admins allow/restrict access to files and
> folders from the app and some sort of version control of the files is
> need
> so I thought, to install a SVN server also and from the app allow users
> to
> access files they've been authorized to. I've been searching about this
> but
> I can't seem to find a concrete answer. Could some please tell me if
> this
> is possible and if so, point me in the right direction, what sort of
> stuff
> should i look into first?

Issuing system commands is as simple as:

system svn 

Or when you want to capture the command's standard output into a string:

out = `svn ` # These are back tics

And, if you decide to use a SCM as a backed to store your files what not 
choose a SCM that isn't a steaming pile of sh*t. Like git 
(http://git-scm.com). Just saying...

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/29025eac8521b1bff79a115985c0a4c9%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Turn OFF Daglight saving time in Rails app

2013-11-04 Thread Robert Walker
Dinesh Atoliya wrote in post #1126155:
> Is there any way that we can turn off DayLight saving in rails app?
> Rails uses tzinfo gem for converting time in zones but it does not
> handle
> it  correctly for some timezone. Is there any way we can turn OFF
> DayLight
> saving completely ?

First I would recommend finding out what time zone data is being used 
and make sure it's up-to-date. Turning off daylight saving time doesn't 
seem like the right solution to your problem. Turning off daylight 
savings time might get the time right in one time zone only to make it 
wrong for everyone else. That would only work if you expect all your 
users to live within the "broken" time zone.

There are a couple of options for supplying the tzinfo gem with data as 
described here:

http://tzinfo.github.io

Maybe just using a different time zone database would fix your problem 
rather than using an ugly hack as you're suggesting. You might be able 
to build a database from the IANA database. Or, have your confirmed that 
their data is wrong for the time zones in question?

http://www.iana.org/time-zones

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/e780ce300636a9e893bd5bbe8eca312d%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Use of FCKEDITOR as normal text area

2013-10-30 Thread Robert Walker
keerthi priya wrote in post #1126074:
> Hi all
>
> I am trying to use Fckeditor as text area to send mails.here is my code
> <% remote_form_for :send_sms,
> :before => "Element.show('loader')",
> :success => "Element.hide('loader')" do |sms| %>
> 
> <%= fckeditor_textarea :send_sms, :message,:lang => I18n.locale,:langdir
> =>
> (rtl? ? 'rtl' : 'ltr') %>
> <%= submit_tag "#{t('send_sms')}",:class=>'submit_button' %>
>
> <% end %>
>
> But here as the form name is send_sms I used the same name for fckeditor

In your code :send_sms is not the form name. It is the name of the model 
that remote_form_for expect to interact with.

> I
> am unable to send params to my controller.I got the error like
>
> uninitialized constant SendSms.

You getting this error because there is no model object class named 
SendSms.

> Can someone help me what is going wrong.

The Rails documentation can help you. I have linked to the Rails 4 
documentation describing form_for. Rails 4 removed remote_form_for and 
instead added the remote functionality to form_for as you can see later 
in the docs:

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/04c6c7e56043a236852af1688f4d0a63%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Is it a good idea to use timestamps

2013-10-22 Thread Robert Walker
Matt Jones wrote in post #1125222:
> On Monday, 21 October 2013 13:24:47 UTC-4, desbest wrote:
>>
> Depends on your database - in MySQL the TIMESTAMP column type is limited
> to
> 2038, but in others (Postgres, for one) this isn't the case.
>
> If you declare your columns as :datetime in Rails migrations you'll get
> a
> type (regardless of database adapter) that doesn't have this problem.
>
> --Matt Jones

It's also important to understand the difference in behavior between 
"timestamp" and "datetime" in MySQL. If a timestamp column is not 
specifically specified in an update statement it will update itself to 
the current system time automatically. The "datetime" data type will not 
do that, rather it will keep its current value.

Basically, never use the "timestamp" data type in MySQL, unless you 
really understand, and want its behavior. I never use it myself, and 
Rails has no built-in support for it. If you ask for a date and time in 
Rails migrations you'll get a "datetime" data type when using MySQL. 
Trust the default ActiveRecord mappings.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ad72f8397a0416e3c00e551a6c4b7642%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Is it a good idea to use timestamps

2013-10-21 Thread Robert Walker
desbest wrote in post #1125087:
> Timestamps are a number that counts the number of seconds from the epoch
> date 1/1/1970.
> I read somewhere on the
> internet,
> that timestamps will expire in the year 2038.
> This is why I always use *-mm-dd* and *-mm-dd HH:ss* to show the
> date and I don't use timestamps or time database columns.
>
> Is it a good idea to use timestamps, or should I continue with
> -mm-dd
> HH:ss ?

This is only the case where the timestamp is stored as a 32 bit integer 
value. AFAIK most modern systems use 64 bit integer values for this as 
do not have the year 2038 bug.

I assume by "-mm-dd" you mean that you're storing dates as string 
values. That is significantly less efficient that using datetime fields.

I would not worry about the 2038 bug. This problem will be fixed before 
it becomes a problem if it is not already fixed in your database and 
other related systems.

For example PostgreSQL stores its timestamps in 8 bytes (64 bits) and 
has a range from the year 4713 BC to 294276 AD. So I think one would be 
safe when using PostgreSQL timestamp.

Also of note is that the epoch for PostgreSQL is midnight 2000-01-01 and 
not 1970-01-01. Not all systems use the same epoch.

In fact you'll find there are many different Epochs:

http://en.wikipedia.org/wiki/Epoch_(reference_date)#Notable_epoch_dates_in_computing

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/75d947d37ecf06533531ee37436ed701%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: What if you don't want your model to be from Active Record?

2013-10-12 Thread Robert Walker
Peter wrote in post #1124413:
> By "wrap together", I meant I would write a single function for all the
> functions I would use from the AWS API.
>
> So, I should put this in the models directory, right? I want the
> controller
> to remain a "controller" with respect to rails-isms.
>
> class MyAWSAPI
>   def list_servers
> ... call to AWS API to get list of servers...
>   end
>
>   def show_server(int)
> ... call to AWS API to get info on server int ...
>   end
> end

Yes, that would be a model object and models would be a good place to 
put that. You might even consider implementing ActiveModel with your 
class and gain some ActiveRecord like behavior, but not actually be an 
ActiveRecord subclass. Depends on your needs.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a17825a565ddaa4782ae9aa7c8d8db27%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: What license do you use for your Ruby gems?

2013-10-12 Thread Robert Walker
Jason Hsu, Rubyist wrote in post #1124349:
> On Friday, October 11, 2013 7:21:57 PM UTC-5, Ruby-Forum.com User wrote:
>
>>
>> That's really up to you AFAIK. I typically use the MIT license on my
>> stuff, but choosing a license can be a fairly personal choice. It
>> depends on what you're trying to protect, or not protect, whatever the
>> case may be.
>>
>>
> Why do you use the MIT license?  Under what circumstances would you use
> something else?

I think if you read through the short and simple MIT license it would 
become very clear under what circumstances you would want to use 
something else.

For example if I wanted to prevent others from directly making money 
from my software. MIT specifically allows that.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d1c1e5e1faf424e3008da6bb3b7f85f5%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: What license do you use for your Ruby gems?

2013-10-11 Thread Robert Walker
Jason Hsu, Rubyist wrote in post #1124297:
> I have created two Ruby gems (dvi_scrape and bsf_scrape), and I'm
> planning
> on creating a few more.
>
> What license should I be using for my Ruby gems?  I'm creating these
> gems
> on my own and not on behalf of any particular organization.

That's really up to you AFAIK. I typically use the MIT license on my 
stuff, but choosing a license can be a fairly personal choice. It 
depends on what you're trying to protect, or not protect, whatever the 
case may be.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/e66b6f889bdb83a60dad433a2ae059f1%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Access tocken

2013-10-11 Thread Robert Walker
Daynthan Kabilan wrote in post #1124237:
> hi friends,
>
> i am using omni contacts gem for import friends.
>
> how to get access token on facebook login using omni-contacts gem

Get if from Facebook:

https://developers.facebook.com/docs/facebook-login/access-tokens/

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/200ca0176a2f79bcc194fc16b835a9ab%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Consuming a web service created with Rails, ETL vs Rest?

2013-10-09 Thread Robert Walker
Monserrat Foster wrote in post #1124014:
> I don't want any code. The gem suggested to me to use is
> Activewarehouse-ETL but as far as I know, this gem only allows to manip
> databases and the administrator for the redmine app clearly said no
> databases conections because 'I might damage something' so, my question
> was
> when consuming a webservice, like redmine API, but without handling
> databases, is it better to use REST (httparty) or ETL (ActiveWarehouse)
> and
> why

See, now that's a much more clear and concise question. With the 
information you have provided I would be confident in suggesting to use 
the REST services provided by Redmine over anything that would 
manipulate the database directly. There's no telling what you might 
break.

P.S. I know you didn't ask for code. Apparently, you haven't spent much 
time on developer forums where many people simply want someone to 
provide them the solution without doing any research or trying anything 
themselves. That is probably the most annoying thing to veteran 
developers who frequent developer forums. There is a right and wrong way 
to ask questions on a forum like this one. The primary rules are... 
Research before you post, think before you post, ask a single, concise, 
but complete, question. Tell us what you've tried, any errors you may be 
seeing (with stack traces when possible), and any specific code you may 
be having trouble with. That will get you the answers you seek without 
annoying the people capable of providing good answers.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ed3e4de964b4d47d20b13c045f17582a%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Consuming a web service created with Rails, ETL vs Rest?

2013-10-08 Thread Robert Walker
Monserrat Foster wrote in post #1123885:
> It has do with rails because I'd be using an already existing rails app
> and
> probably another app with a few gems to connect to the already defined
> web
> service (IMO)

http://www.redmine.org/projects/redmine/wiki/Rest_api

That explains the Redmine REST API pretty well.

Have you read the documentation?
What have you tried?
Do you have any specific questions that you need answered?
No I don't have any code to toss your way for you to "customize."

A little preparation before posting to developer forums will get you a 
long way, and will reduced the chances of the types of responses that 
you see in this thread.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6cf7215bdf680ed5ca33612c4cb6dd31%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Omni_auth with Facebook

2013-10-07 Thread Robert Walker
Rosy Catz wrote in post #1123747:
> Hi,
>
>   I've implemented the sample app with omni_auth('0.2.6'). I'm using
> rails 2.3.11 with ruby 1.8.7. I tried to connect with Facebook but
> getting oauth error. I tested it with twitter & google plus account.
> Both are working fine but the FB connects is not working yet. Can you
> please help me out?.

AFAIK Facebook is currently using OAuth 2. Since you're using such an 
old version of Rails and OmniAuth are you sure the are still compatible 
with Facebook?

I use OmniAuth myself, but not with Facebook, and I use the current 
version of OmniAuth on Rails 4.0.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ecf259223db44149e8c952d378c46f50%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Differentiate Client & browser http call

2013-09-26 Thread Robert Walker
Avi wrote in post #1122484:
> Hello All,
>
> How can I differentiate the call between client ios app & browser call?
>
> session_controller - create method is being used by both client & rails
> web
> application.
> I want to restrict for web application to use create method.
>
> how can I achieve this?

Check the user-agent string. Just keep in mind that it's possible for 
clients to change that, but AFAIK that's the only way the web server has 
to identify the client.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/11dfa581fb8289558339c839a82ba10a%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: How to communicate a web app with destkop app?

2013-09-24 Thread Robert Walker
Ricardo do Valle wrote in post #1122365:
> @Colin the rails server is running in a VPS with nginx and unicorn.
>
> @Fernando, thank you very much, but it is not alternative for this
> project,
> i will study the chrome devs API for a future and another project, have
> you
> used already?
>
> I am looking for a way to create sockets and controls (state machine)
> from
> a rails app or another way to do that.

You do realize that what you're talking about here is VERY DANGEROUS. 
Web browsers work very hard to prevent exactly what you're describing 
here. This is the reason why JavaScript is sandboxed and provided no 
access outside of the browser environment.

That being said, you could write your own browser plugin and do whatever 
you want. Of course, you will then be exposing anyone dumb enough to 
install your plugin to all the sorts of security holes that ActiveX 
based browser plugins, among others, became famous for.

If I were in your shoes I would instead write native applications that 
communicate with your Rails application via web services. A good example 
of this is the Pivotal Tracker app for iPhone and iPad.

This way you can ask people, that have some trust in you, to install 
your native application. It will then communicate directly to your Rails 
application and leave the user's browser environment secure and free 
from "drive-by" security vulnerabilities.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a4ddf142d3d4085e1fd1c91c0ce59d74%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Should "sanitize" return an empty string for non-strings?

2013-09-12 Thread Robert Walker
Hassan Schroeder wrote in post #1121316:
> On Wed, Sep 11, 2013 at 3:36 PM, Paul E. G. Lynch 
> wrote:
>> If, in your view, you are expecting params[:name] to be a string, but
>> actually rails has parsed it into {"."=>"1234"} (or something more
>> malicious)
>
> Params are strings by definition; can you provide a test case/code
> that demonstrates where this is not the case?

Not necessarily the case. For example the create and update actions in a 
users_controller will likely contain the user model in the params hash 
as a hash keyed by :user:

params[:user]
=> { :first_name => "John", :last_name => "Doe", age: 25 }

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5610708d401ca245037be4c44a5f58bb%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Should "sanitize" return an empty string for non-strings?

2013-09-11 Thread Robert Walker
Paul Lynch wrote in post #1121214:
> If, in your view, you are expecting params[:name] to be a string, but
> actually rails has parsed it into {"."=>"1234"} (or something more
> malicious), then currently
> <%= sanitize(params[:name]) %> blows up because the hash does not
> respond
> the expected methods from the sanitize call.
>
> I could put in code to check that the params values I am sanitizing are
> strings, but it seems like it would be better for sanitize to handle
> that,
> and perhaps just return the empty string if the processing of the input
> raises an exception.

Hum. It seems to me that "blowing up" is the right thing to do in this 
scenario. More precisely an exception should be raised indicating a 
programmer mistake of passing an illegal argument to a method expecting 
a string.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c54d51850e1948568b77874beb9f21e1%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Algorithm execution with Rails

2013-09-10 Thread Robert Walker
Gab dlm wrote in post #1121158:
> Hello,
>
> I have a doubt , when I develop an app that run a encryption algorithm ,
> this algorithm run first on the client computer and the send the data to
> server , or is executed directly on server , enabling interception of
> the plain text?

I'm sorry, I don't really understand your question. All of the things 
you mention are possible. It depends on where the encryption is 
performed. Encryption can be done on the client using JavaScript or it 
can be done on the server using Ruby.

If you are worried about someone intercepting the page content displayed 
by the browser then that's the exact purpose of SSL/TLS. Everything the 
user would see in their browser window gets encrypted before egress onto 
the Internet and is only decrypted once it reaches the server. No one 
intercepting the traffic sent between the client browser and the web 
server can read anything. All they will capture will be pseudo-random 
noise.

Give us specifics about what you are tying to do and we can tell you the 
best solution for that scenario.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/30e0ada90fdf2825fea9bd19bf8f3976%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Confusion with method call without `.` operator

2013-09-06 Thread Robert Walker
Love U Ruby wrote in post #1120864:
> I am confused on the second call :-
>
> class Foo
>   def <<(param)
> "hi"
>   end
> end
> foo = Foo.new
> foo.<<(1) # => "hi"
>
> foo << 1 # => "hi" # I didn't use `.` method,then how method `<<` has
> been called?

I would image that it works the same as it does for the +, -, *, and / 
methods.

Example:
$ irb
irb(main):001:0> 5 + 7
=> 12
irb(main):002:0> 5.+(7)
=> 12

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/033bdc692487eb5166b61f1c7ee05fe5%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: What is this error

2013-08-19 Thread Robert Walker
keerthi priya wrote in post #1119115:
> Hi all,
>
> I am getting this bellow error

>  No method error undefined method `each' for nil:NilClass

The error is what it says it is. You are sending the message 'each" to a 
nil object reference. Look back through the stack trace until you get to 
the first line containing your own code...

> NoMethodError (undefined method `each' for nil:NilClass):
>
> ... a bunch of framework references
>

Something you should recognize...
>   app/models/exam_report.rb:89:in `generate_normal_report'

Line 89 of exam_report.rb. Find out which object is receiving the 'each' 
message and figure out why the reference is nil.

>
> ... stack trace continues ...
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/803ed00ad9761c59ee27f6b3f890e413%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Line break retention in simple_format

2013-08-17 Thread Robert Walker
simpleton wrote in post #1118613:
> There are quite a lot of line break issues with Rails on StackOverflow
> and
> the web in general. A lot of solutions are ugly and a lot modify
> simple_format so I've created a patch that I'd like to hear thoughts on
> before submitting a PR.

There are a lot of questions about this on Stack Overflow because a lot 
of people don't understand the basic rules of HTML. That's not the fault 
of simple_format, which IMHO works exactly as expected and intended.

> I've made a slight modification to split_paragraphs and how it gsubs the
> newline characters in paragraphs up so that if you pass it a line
> option,
> instead of getting rid of all newlines and return carriage characters,
> it
> can substitute \r\n for an html break element.

I'm not familiar with split_paragraphs, and I don't see it listed when 
searching the Rails documentation, but my guess it that it also works as 
expected and intended.

> This way if a saved chunk of text is the following then it won't be
> stripped down to just the 2 lines of text but will have the  tags
> that were obviously intended:
>
> "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nBig
> gap.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nPlease."

But, that is the expected results for HTML to normalize white space into 
a single character. Changing this behavior would be unexpected and 
unintended, again IMHO.

> This doesn't affect the regular behaviour of simple_format and will
> still
> return the usual result without the option.
>
> I find that this isn't an edge case but is frequent enough to warrant
> this
> and not have people overriding simple_format and split_paragraphs in
> their
> application helper.

I think any behavior change to these helpers should be left up to the 
individual developers to put into their own helper libraries. I don't 
see a place for this in Rails itself. The simple_format helper already 
works as anyone who truly understands HTML expects it to work.

P.S. The proper line ending character is \n (stupid Windows...). That 
was a jest... sort of.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/99345993ded948064c75baf86317bad4%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: other css design framework like bootstrap

2013-08-08 Thread Robert Walker
Dave Aronson wrote in post #1118150:
> On Thu, Aug 8, 2013 at 4:00 PM, mukul saharia 
> wrote:
>
>> i am using twitter bootstrap css designing framwork.. is there other
>> framework like bootstrap.. please suggest.
>
> There are plenty.  Off the top of my head, though I might be
> misunderstanding what some of these are:
>
> - Compass
> - Bourbon
> - Zurb Foundation

I've started experimenting with Zurb Foundation. What attracted me to it 
over bootstrap was that Foundation is built on top of SASS rather than 
LESS, but otherwise the two frameworks are really similar. It just seems 
to me that there maybe slightly less friction using Foundation with 
Rails given both already depend (or rather are integrated with) SASS.

http://foundation.zurb.com

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/de08de07165c0ccb659852b152401dc9%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: What's the proper way to delete all associated children in one SQL statement, with AR 4.0 ?

2013-08-08 Thread Robert Walker
Savater Sebastien wrote in post #1118021:
> class Parent < ActiveRecord::Base
>   has_many :items
> end
>
> class Item < ActiveRecord::Base
>   belongs_to :parent
> end
>
> I need to delete all items associated to one parent, without callback.
> I don't need to call #destroy, but only executing the appropriate SQL
> statement.
>
> First case :
>
>> parent.items.delete_all
> ...
> So.. What's the proper way ?

If I understand correctly your intent is to delete all "items" 
associated to "parent" but not delete the "parent" itself. If that 
assumption is correct you don't have to use the association at all. Just 
delete what you want directly from the Item model as follows:

Item.delete_all([ "parent_id = ?", parent.id ])
or
Item.where([ "parent_id = ?", parent.id ]).delete_all

I would also recommend using the :dependent option on your association. 
It makes no sense for "items" to exist without their owning "parent" 
object. In other words, parent "owns" its items.

class Parent < ActiveRecord::Base
  has_many :items, :dependent => :destroy
end

This way you won't orphan items if a parent were to be destroyed.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8832a2015910a5e3d4c7aaacfd0fec49%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails 4 Turbolinks make js not working as expected

2013-08-07 Thread Robert Walker
William Herry wrote in post #1117842:
> details is here:
> 
http://stackoverflow.com/questions/18068951/rails-4-turbolinks-make-js-not-working-correct
>
> in short, Turbolinks make js form submit multiple times

Are you sure you have complied to the compatibility requirements of 
turbolinks?

https://github.com/rails/turbolinks/

Compatibility

Turbolinks is designed to work with any browser that fully supports 
pushState and all the related APIs. This includes Safari 6.0+ (but not 
Safari 5.1.x!), IE10, and latest Chromes and Firefoxes.

Do note that existing JavaScript libraries may not all be compatible 
with Turbolinks out of the box due to the change in instantiation cycle. 
You might very well have to modify them to work with Turbolinks' new set 
of events. For help with this, check out the Turbolinks Compatibility 
project.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6be24d6456646640e206a433c54faac2%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: File transfer via SOAP

2013-08-05 Thread Robert Walker
"Евгений Куртов"  wrote in post #1117771:
> Hello! Can't find any related data on the subject: how to receive a file
> via SOAP. If anyone have accomplished such a task I'll be very greatful
> for
> any help and info.
> Thanks.

SOAP is actually not a great transport layer for large files. SOAP is an 
XML based protocol, which essentially is just a structured text file.

If you really must use SOAP to transfer large files then you'll need to 
use something like Base64 encoding and embed the file in an XML tag.

Here's a basic example:
http://www.w3.org/2003/05/soap-envelope";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 
 
  5XJ45-3B2
  accident
  
   4f3e9b0...(rest of encoded image)
  
 
 


Notice the xsi:type="base64binary". In this example they are encoding 
the JPEG binary data as base64 ASCII text.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/22617d5bc856165d0d95411030f20b26%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails multistep form with ajax

2013-08-02 Thread Robert Walker
Seth Portman wrote in post #1117487:
> I am following Railscasts #217 and I have been able to make everything
> work
> using html protocol the only issue is that I need it to use ajax
> protocol
> instead. My question and code is very similar to stackoverflow question
> Multistep
> forms in Rails using
> 
AJAX
> .
> I understand how to setup ajax and make the form sumit remotely my
> question
> though is how do I pass over the forms variable i.e. "f" as in "<%=
> form_for @post do |f|>" Any help is appreciated.

I think you're probably making this too complicated. If you're using 
JavaScript anyway then just have one page, with one form. Use JavaScript 
(no AJAX required) to show and hide the fields for the various steps in 
the process. Ryan mentioned, and recommended, this approach at the 
beginning of the episode.

Since have have only a single page with a single form there's nothing to 
pass around. The are no changes required in your controller or model 
classes. As far as Rails is concerned it's no different than a regular 
form submission.

If your multi-step form is extremely complex then I might suggest 
considering one of the single page app solutions such as Ember.js, 
Backbone.js or Angular.js.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/17eb5cb030adee7550a3580b939b0ee3%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Protecting user privacy with CanCan

2013-07-31 Thread Robert Walker
Hi all. I'm using CanCan for my app authorization and need to know how
to protect privacy between users.

Say I have the following three users:

Alice
Bob
Charlie

Alice is an admin and should be able manage everything. Bob and Charlie
are regular users and should be prevented from getting the index of
users, and only be able to manage their own record. For example Bob
should not be able to directly access any information about Charlie nor
Alice.

class Ability
  include CanCan::Ability

  def initialize(user)
user ||= User.new # guest user (not logged in)
if user.admin?
  can :manage, :all
else
  can :read, :all
end
  end
end

Obviously these "default" abilities are not sufficient. Anyone could get
the "index" of users or the "show" of any user. I need to restrict
non-admins to the "show", "edit" & "update" of themselves, but have no
access to anyone else.

I'm just not sure how to define these abilities.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9a5d2ef53e344f2ebcf981893ac2d468%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Lat/Lng boudaries for each reverse geocoded address for google

2013-07-31 Thread Robert Walker
Ajit Teli wrote in post #1117253:
> Hi,
>
>   I would like to get the lat/long boundaries for each reverse Geo-coded
> address. For example,
>
> Lat: 14.32826, Lng: 77.643127 pair gives reverse Geo-coded address as
> "Kanyakumari Road, Andhra Pradesh 515101, India". There will be list of
> other lat/long pairs which will produce same reverse Geo-coded address
> as above. And I assume that for each reverse Geo-coded address there
> will be lat/long boundary.

Why would you assume this? Latitude and longitude describe a precise 
point (within the tolerance provided by the system). Addresses 
(especially as defined by the Google Maps API) are imprecise. For 
example "Georgia" is a valid address, as defined by Google Maps. It is 
also an ambiguous address. Does it mean the United States state of 
Georgia or the country in Asia? The API provides for region biasing to 
disambiguate such addresses.

It would be impractical to provide a list of all Lat/Lon pairs for an 
address. Theoretically that would be an infinitely long list. That is 
like asking to list every point inside a rectangle. That would also 
result in an infinitely long list.

Reverse geocoding a point into an address is a lot more "fuzzy." Google 
Maps attempts to provide reasonable results by retuning the "best" 
address for a given point, along with other addresses within the region 
surrounding the given point. Unlike geo-points, addresses are finite. 
There are only a limited number of them within any given region.

>   So, please let me know how can I get lat/long boundaryies for a pair
> of lat/long which will produce same reverse Geo-coded address.

Taking a quick look at the Google Maps API I didn't see anything that 
would directly give you what you want. As I described above I don't even 
think this makes sense.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8ea13f724683b1e444168f1d5860ec56%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Concerns vs libraries

2013-07-26 Thread Robert Walker
unknown wrote in post #1116591:
> I think I might be a little confused but I cant really understand
> exactly
> when to separate code into a concern, and when to separate it into a
> library.
>
> 1. What's the exact difference?

Concerns is a technique used to either share some behavior between 
models or to break down "chubby" models into smaller, more coherent 
pieces. Notice this is all about model objects.

Library code on the other hand should be self contained, independent 
behaviors that can be use anywhere.

> 2. Where are they available?

Model Concerns: Any model object where you choose to include them. 
Notice that concerns "extend ActiveSupport::Concern" and therefore have 
that direct dependency.

Controller Concerns: Similar to the model concerns except for 
controllers.

Library: Should have no direct dependencies outside of itself (other 
than libraries a library directly depends upon. i.e Rails itself has 
many dependencies managed by RubyGems).

You should (in theory) be able to include a library anywhere, even in 
apps that don't use Rails at all. Notice that many gems (libraries) are 
useful no matter what framework you use them with. You could have a 
Sinatra app and include the same gem as in a Rails app. There's no 
direct dependency there.

> 3. What is their goal? what is the goal of putting code in a concern and
> in
> a library?

This explains concerns pretty well I think:
http://37signals.com/svn/posts/3372-put-chubby-models-on-a-diet-with-concerns

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1d3e3a59a45b3d60db7966150cdee30c%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails migration generation with options or defaults

2013-07-25 Thread Robert Walker
Kirankumar Skk wrote in post #1116632:
> In Rails we have command to add migration that specifies the table name
> column name. For example :
>
> $ rails generate migration AddPartNumberToProducts part_number:string
>
> *Problem: How to specify the options (example :after => :descritpion) on
> command line so that it will add directly on migration file.*

Allowing you to specify the columns on the command line generator is a 
convenience feature. It was never intended to provide the full range of 
options that can be specified in the actual migration.

There is a limited set of additional options you can specify on the 
command line as detailed in section 2.3 of the following guide:

http://guides.rubyonrails.org/migrations.html#model-generators

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cb33e0839821891f17393362890f1607%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: How to move rails application from one server to another server

2013-07-25 Thread Robert Walker
kishan kumar katamala wrote in post #1116674:
> Hi all,
>
> I am newbie to ruby on rails, i want to move rail application from one
> server to another servers.
>
> can you please help me.

You need to investigate a proper application deployment strategy. You 
should not have to "move" an app from one server to another. Instead you 
need a script to deploy your app to the new server.

Many developers use Capistrano to mange their Rails deployments:
https://github.com/capistrano/capistrano

Rails apps should be contained within a single folder, but there's no 
way to guess what all you need to configure on your server to make it 
ready to run your Rails application. You've given no details on what 
technologies (e.g. database server, web server, etc.) you are using to 
run your app.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c5676cb3ca93383021f36c541d7f4a14%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Re: How to create first user for sign in using devise

2013-07-23 Thread Robert Walker
Emil S. wrote in post #1116325:
> The user actually "uses" the email ID and can remember it . I can never
> remember my "usernames" , usually. Also "forgot password" becomes easy
> with
> email ID's . But then again, to each, his own.

Yes "forgot password" is easy that way. It's also easy for the hacker 
who hijacks the email account used to sign into the site. Not only does 
the owner of the email account lose access to their email itself, but to 
any web site that user accesses using their email address as their 
login. Worse yet, it's highly likely there's information available in 
their email that gives the hacker good clues as to what online services 
they actually use.

Convenience is the enemy of security. The trick is to understand the 
risks in order to find the right balance. Ideally multi-factor 
authentication should be used for any sensitive online service, which is 
certainly not convenient, but is vital to protecting online identity.

As for remembering login information, that's what password managers are 
for. I myself have well over 100 logins stored in my password manager 
each one with unique auto-generated passwords. With such a tool I only 
have to remember (and protect) a single password.

Any conveniences employed by online services do nothing for me besides 
reduce the level of security of that given service.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/86ccfaf942fdc8d0a5fdd8fedb188cef%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: How to create first user for sign in using devise

2013-07-22 Thread Robert Walker
Emil S. wrote in post #1116233:
> I use email for login , so I do this in the console/database seed file :
> User.create(email: 't...@test.com', password: 'password123',
> password_confirmation: 'password123')
> Then I log in with the "t...@test.com" and "password123"

Personally speaking, I generally dislike the practice of using email 
addresses as usernames. Yes, it has a certain convenience. Convenience 
will always be in contention with security.

There are a number of reasons for this:

1. If the site gets hacked there is no way to protect email addresses 
from exposure. If email addresses are kept separate from the user 
account information then it is at least possible to protect them from a 
hack against the user login info.

2. If a user changes their email address (or otherwise loses control of 
their email account) they have no way to verify themselves in case they 
need to reset their password.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/109f507533ae30c67151c56b115d7a16%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: How to create Categories in Rails

2013-07-20 Thread Robert Walker
Giannakis P. wrote in post #1116088:
> Hey Ruby on Rails Community
>
> i'm trying to Add Categories to my Rails app, but don't quite know how
> to do this.
>
> I have many Pins(Images) and want the user to be able to assign a
> category on those Pins. ASSIGN not create, edit, or delete a Category,
> just selecting one for their Pin. Meaning that, When a user uploads a
> pin, he can choose from a dropdown list a Category.
>
> Then, another user can choose from the Menu a Category, and ONLY the
> Pins in this Category will be listed.
>
> How do i do this? Where to start ?

Sounds to me like a tagging system such as 
https://github.com/mbleigh/acts-as-taggable-on would work well for your 
needs.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/e70b5e69688c2b90232f828a035aa664%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails 4 "belongs_to: record" association doesn't work

2013-07-19 Thread Robert Walker
Colin Law wrote in post #1116001:
> On 19 July 2013 14:59, David  wrote:
>> Yes exactly. It's specific to the word 'record'. It works when I change it
>> to :foo or :b (or anything else).
>>
>> Are there any reserved words for association names?
>
> It would appear that the answer to that question is yes.

Although that might have been unintentional. I don't know of any 
"official" reserved word list for association names.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2e16d60ddc201bb0feebb1f26f17e76d%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Reusing functional tests with rails 4

2013-07-19 Thread Robert Walker
J. mp wrote in post #1115983:
> I want to run both test for each of the role (Merchant or FrontStore)
> but
> not repeating the test code.
>
> My question is, how best design the test so they are reusable in this
> case?

IMHO you shouldn't. Test code should be DAMP not DRY:

http://stackoverflow.com/questions/6453235/what-does-damp-not-dry-mean-when-talking-about-unit-tests?lq=1

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4d6bca5b37a437db8b636a2fff94fc5b%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: installing rvm in home directory or system-wide?

2013-07-17 Thread Robert Walker
Emil S. wrote in post #1115716:
> I hope you have gone through this : https://rvm.io/rvm/install . System
> wide RVM will let you use the same installation for all users on the
> system. But I've seen many junior devs screw up their dev environment by
> trying a system wide RVM installation but didn't follow the instructions
> correctly. Single user installations look safer and less error prone to
> me. I like to have Single User RVM installations on my systems because I
> am
> more comfortable when I'm not sudo-ing too often :)

I agree. Dev environments can be a very personal thing. For example I 
prefer rbenv over RVM.

That being said, if you're the only user of the dev machine then I see 
no advantage of a system-wide install at all. Plus, I wouldn't want to 
have to deal with another developer coming along and screwing up my dev 
environment.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b5c617bf4e622306461f871e44e1845a%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Hide URL from view

2013-07-11 Thread Robert Walker
hara acharya wrote in post #1115165:
> Hi,
> I have a button as below.
> <%= button_to('On', @userdetail.url + '?value=1', :method => "post",
> :remote => true, :disable_with => 'loading...') %>
> Here @userdetail.url is a external URL, and I don't want to show the url
> in
> view source for users.

What, are you trying to be sneaky and expose the user to web content 
they never intended to visit? Not that this isn't done all the time. 
Especially when talking about inserted ads that are embedded in iframes.

> How can I create a controller action to do the task and point the button
> to
> that controller action? Tried implementing curl in my controller action
> but
> couldn't make it work as this button action is a post method.

The same way to define any controller action. Create a route for it. If 
using a resources route you can add an additional RESTful action as 
described  in the documentation.

http://guides.rubyonrails.org/routing.html#adding-more-restful-actions

You don't need curl. Ruby has a perfectly fine method for accessing 
URIs:

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/OpenURI.html

> Any example help will help.
> I am also trying to expose the button action as a API. Is there anyway I
> can expose the same controller action as a API?

A request is a request. It doen't matter whether you send it with a 
button, or with any other way of sending an HTTP request.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3baf8b13c65c822dbe9597e94fa16ea5%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Face Problem to create a new app

2013-07-10 Thread Robert Walker
Tushar Patil wrote in post #1115001:
> I create a new app => rails new demo
>
> I have a rails3 & ruby 1.9.1
> After that i try  to install bundle, but it will give a error

I thought Ruby 1.9.1 was completely broken when trying to run Rails. Try 
Ruby 1.9.3.

> Bundler could not find compatible versions for gem "bundler":
>   In Gemfile:
> rails (= 4.0.0) ruby depends on
>   bundler (< 2.0, >= 1.3.0) ruby

This is indicating Rails 4.0.0. I'm quite sure that won't work properly 
with Ruby 1.9.1. Compatible versions for Rails 4 are Ruby 1.9.3 and 
2.0.0.

>   Current Bundler version:
> bundler (1.1.4)

The current version of Bundler is 1.3.5 and it compatible with the 
current release of Rails 4.0.0.

> This Gemfile requires a different version of Bundler.
> Perhaps you need to update Bundler by running `gem install bundler`?
>
>
> Please let  me know where i am wrong,

Did you do as suggested and run "gem install bundler"?

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8327c81c3da071290cafee477a720198%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: No ActionView module in Rails Edge API. Did they remove it from the framework?

2013-07-05 Thread Robert Walker
Wins Lin wrote in post #1114551:
> I found that there is no ActionView module in
> http://edgeapi.rubyonrails.org/
> Did they remove it from the framework?

I'm not sure what's up there. Maybe they are reworking that section in 
the edge version of the API docs. ActionView is still listed in the 
release version of the API (currently based on Rails 4.0.0).

http://api.rubyonrails.org

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4b2cf0fabcfaf186c427b10ca53d52f6%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: URL "id" not part of the params objects after post

2013-07-05 Thread Robert Walker
Rodrigo Lueneberg wrote in post #1114538:
> Thanks Robert, You just gave some insight. You're right I should use
> form_for, but I just want to point that the user id is indeed passed in
> the URL above and I can reference a Model object even when not using a
> form_for. But I don't understand why it is not  part of the
> "request" object querystring parameters? Any Framework should be able to
> capture both POST an URL parameters after a form submit action. How
> about environmental parameters such as referrer, etc.? I just doesn't
> make sense to me. I guess I will just keep reading more about rails.

> <%= form_tag('/users/delete') do %>
> <%= submit_tag 'Click here to delete this user' %>
> <% end %>

The form_tag helper defaults to a POST request if method is not 
specified. Form fields will be pass in the request body not in the URL 
query string. I don't see any indication that you're passing any form 
data in your example above. It's not part of the URL and there are no 
hidden fields that might contain any form data.

Example:
form_tag('/posts')
# => 

Check your logs/development.log to see exactly what the params hash 
contains for your request.

As for what you call "environmental parameters" I assume you mean 
request headers. Request headers are available in the request object but 
are not mixed into the params hash. That hash is reserved for user 
submitted data (i.e. form fields and query parameters).

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/072527dac68e973ab16f0e670d0d7862%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: URL "id" not part of the params objects after post

2013-07-05 Thread Robert Walker
Rodrigo Lueneberg wrote in post #1114532:
> <%= form_tag('/users/delete') do %>
> <%= submit_tag 'Click here to delete this user' %>
> <% end %>
>
> When the form is posted, params[:id] does not exist, why?

Because you're using for_tag instead of form_for:

<%= form_for :user, :method => :delete do |f| %>

Note: The above is just an example. Normally you would not use a form at 
all to request that a given model be destroyed. Below is an proper 
example of deleting a given user:

<%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you 
sure?' } %>

Besides that I don't see how your form_tag would ever send anything 
about the current user. It's not passing in the user, nor user id, at 
all. It's just submitting to the /users/delete URL with no other 
information.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/fe271ca6db3b1722518ebea78907023b%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: how to use single login page for users in four models

2013-07-05 Thread Robert Walker
ram kris wrote in post #1114502:
> how to use single login page for users in four models

You have not given enough detail in your question to know what you're 
asking.

Are you saying that you have four different types of users? If so then 
why do you have four models instead of doing role based authorization 
having only one user model?

If you really do have four different types of user then you might want 
to consider Single-Table-Inheritance (STI). I seriously doubt you need 
to go to this extreme though.

I can't give you a definitive answer from such an abstract question. 
There are many ways to solve a problem, but you haven't even described 
the problem you're trying to solve.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/fad9a633098f7b2b5f42973f2379ef70%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Ruby on Rails sessions

2013-07-05 Thread Robert Walker
unknown wrote in post #1114514:
> I'm learning RoR and i would like to know more about the sessions in RoR
>
> Can anyone give me a good example for a session in a web application? or
> good pages for learning?
> (not: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book   :P)

There's really not a lot that you have to know about sessions in Rails. 
You can just think about them as a hash used to store small bits of 
information that you want to make available to all controller actions.

For example if you want to remember the id of the logged in user, then 
in your action that authenticates you would store the user object's id 
in the session hash:

session[:user_id] = current_user.id

By default Rails is configured to store session data in browser cookies. 
Every request included the session cookie. Rails will automatically read 
the cookie and create a Ruby Hash named session.

Browser cookies are limited to 4K of data so it is good practice to keep 
session data as small as possible. Notice above we do not store the 
entire User object in the session, but only store the id of the user. 
Whenever you want the details about the user then you can lookup full 
user object by the stored id.

There are several other option for storing session data. The data could 
be stored in the database using ActiveRecord. Or could be stored in a 
memcached, redis, or other NoSQL persistence service.

Note that if you choose an alternative persistent store for your session 
data then it will be your responsibility to cleanup old sessions. Rails 
will not do that for you automatically. That's one major advantage of 
storing sessions in cookies. It eliminates the need to manage old 
sessions. The only drawback I see is the 4K limit, but that should be 
plenty of space for the types of information you should keep in 
sessions.

Also it's worth noting that Rails 4 will begin encrypting the data in 
session cookies. Rails 3.2.x signs the cookies to prevent tampering, but 
does not encrypt the contents of the cookies.

Just remember that any data stored in a session has to be loaded on 
EVERY request, regardless of whether the data is used by the action or 
not, so keep session data as small as possible.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9442d7c4eaf374f3f9418be60ed3aef0%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Reducing downtime

2013-07-03 Thread Robert Walker
Peter Hickman wrote in post #1114323:
> To reduce the time we lose when we restore a backup we could of course
> just
> take more frequent backups. But this would start to become a performance
> issue, not to mention pulling the backups off the server will start to
> eat
> into our bandwidth.

> Any thoughts?

A robust solution is to use database replication and then run your 
backups off the replica, This way you have at least two servers that are 
kept synchronized constantly, Backups of the replica will also not 
impact the performance of the application accessing the source database.

http://dev.mysql.com/doc/refman/5.0/en/replication.html

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/518aa35b4b284600343f15dbbd6ae070%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Devise auth based on ssl keys

2013-07-03 Thread Robert Walker
lobster lobster wrote in post #1114299:
> I already have a rails 3.1.2 and ruby 1.9.3 vast app with an auth based
> on devise. Now I want to add to the my app a ssl key based auth. As
> web-server it uses thin and nginx as proxy. I have made only ssl on the
> nginx at 443 and only for some app pathes (e.g. /articles, /search etc).
> How I can tell to the my app and devise use the ssl keys and assign them
> to the app users (link users' _session_id and the key together)?

Sorry, but I don't completely understand your question. Your Rails app 
should have nothing to do with SSL/TLS keys in any way. Your Rails app 
should ensure that all URLs that need to be secure use the https 
protocol and nothing more. Any SSL/TLS key exchange should be handled by 
the web server. That should all happen before your Rails app receives 
any request.

You also mention that only some paths use SSL/TLS. I would highly 
recommend against do that. If you need SSL/TLS anywhere in your site, 
then use SSL/TLS everywhere in your site. Force SSL/TLS on the first 
request and have all subsequent requests use that SSL/TLS connection.

It has been shown that any transition from HTTP to HTTPS is vulnerable 
to attack. Notice that many popular sites are now SSL/TLS everywhere 
(e.g. Github, Facebook, Google Mail, Banking, etc.). There is very 
little cost in using SSL/TLS all the time, and the benefits of doing so 
far outweigh the costs. This also eliminates the possibility of mistakes 
in your Rails app that may redirect from a TLS page to an non-TLS page 
since all URLs will be secure.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/11cca9195c105a2d50510ed7d4070ba8%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: rails 4 openid problem

2013-07-02 Thread Robert Walker
Ilya Ishmatov wrote in post #1114007:
> Hi.
>
> After update in Gemfile rails gem from 3.2.6 to 4.0.0.
>
> Registration by openid not working.
>
> Log from console:
>
> I, [2013-06-30T17:56:33.632030 #23279]  INFO -- OpenID: Error attempting
> to
> use stored discovery information: OpenID::TypeURIMismatch
> I, [2013-06-30T17:56:33.632142 #23279]  INFO -- OpenID: Attempting
> discovery to verify endpoint
> I, [2013-06-30T17:56:33.632192 #23279]  INFO -- OpenID: Performing
> discovery on
> https://www.google.com/accounts/o8/id?id=AItOawkWYlFwqPCS-nTqdu3lyDbTX1sGJ07yhbI
> I, [2013-06-30T17:56:33.633248 #23279]  INFO -- OpenID: WARNING: making
> https request to
> https://www.google.com/accounts/o8/id?id=AItOawkWYlFwqPCS-nTqdu3lyDbTX1sGJ07yhbI
> without verifying server certificate; no CA path was specified.

Are you using Ruby 2.0 or Ruby 1.9.3? I had similar problems with OpenID 
via OmniAuth. Rolling back to Ruby 1.9.3 seemed to solve the problem for 
me.

My system:
iMac
OS X 10.8
Ruby 1.9.3
Rails 4.0.0
OmniAuth (including OpenID Strategy)

I know that OS X 10.8 comes bundled with an older OpenSSL than that 
required by Ruby 2.0. Given that OS X 10.9 Mavericks will include Ruby 
2.0 with Xcode 5.0 I've decided to wait to upgrade to Ruby 2.0 until OS 
X 10.9 gets released this Autumn.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/06cc2fd2356f9172e279f65718216bd1%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Hash_Tag Client side Validation

2013-06-28 Thread Robert Walker
Manoj M. wrote in post #1113802:
> Hi
> anybody help me to find suitable validation way for Hash_Tag, My need is
> user should only type hash_tag like below format.
> a) #sports
> b) #sports,#news

There's not enough information here to really know how to help you, but 
the solution will almost certainly involve regular expressions...

http://www.regular-expressions.info

So would the following format be invalid in your app?

"Some random text #sports and some more random text #news #football."

You have not specified enough detail for what you consider valid 
hashtags to formulate a workable regular expression.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b95f2b6c36d2c26a97e979be33bf1e73%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: No more info about dynamic_form in rails guides?

2013-06-28 Thread Robert Walker
Wins Lin wrote in post #1113811:
> I remember for sure there was a explanation with screenshots about
> dynamic_form in Rails Guides. Now I cannot find it, neither in Edge nor
> in standard guide. Have they removed it? Why? Where may I find the info
> again?

https://github.com/joelmoss/dynamic_form

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1880ceaacaac99e70519e1baf0b60876%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Installing gems to user directory - Configurations - How to ?

2013-06-24 Thread Robert Walker
Boopathi Rajaa wrote in post #1113443:
> I compiled Ruby from source, and installed it to /opt/ruby/ .
> The purpose is to have two versions of Ruby 1.9 and Ruby 1.8 ... Certain
> users can use 1.9
>
> After creating a rails app (rails new app) , When a script performs
> `bundle
> install`, the gems are trying to get installed in /opt/ruby/.
> How to configure it to install it in user_home directory ?
>
> I don't want to use the solution, where I install the gems as the root
> user
> to the ruby bin directory.

Are you not able to use one of the Ruby version managers?

https://github.com/sstephenson/rbenv
or
https://rvm.io

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/599e4eb562554a750dd1d79ab1070756%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Ruby On Rails integrate with Object C

2013-06-24 Thread Robert Walker
haxuan lac wrote in post #1113439:
> I want to build Application with ROR
> and this App can integrate with Object same as Client
> But I don't know how to build it
> Please give me some advice for it.
> Thanks.

You might want to try this:

https://github.com/RestKit/RestKit

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5094284d3e540a1e17c9829221a7a5de%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: [HELP ] Call java code / method from Ruby programming

2013-06-21 Thread Robert Walker
Colin Law wrote in post #1113075:
> On 21 June 2013 04:04, Muthu Selvan  wrote:
>>   I have written java code ( This java code will not return any thing but it
>> will do action ) which is required call from ruby , please let me what is
>> best way to achieve this ?
>
> You can use the ruby system method to run a command, which can be any
> language of course.  Or you can use the backtick syntax.

You might also take a look at this:

http://rjb.rubyforge.org

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/dc93b744bd1f0fa94f79cee066a3dd7b%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Hosting ruby application of IIS 7

2013-06-20 Thread Robert Walker
Sasmit Sawant wrote in post #1113034:
> I am new to ruby programming. I have just started creating a simple ruby
> application using ruby on rails. I have installed ruby 1.8.7-p371 and
> DevKit successfully.

If you're just getting started with Ruby on Rails then you may want to 
seriously consider moving to a more current version of Ruby. If you're 
using Rails 3.2.x then use Ruby 1.9.3. If you are using Rails 4.0.rc2 
then use Ruby 2.0.

> I am able to run the application using
> http://localhost:3000 but now my requirement is to host the application
> on
> IIS 7 and this is where I am stuck. Can anyone please help me with the
> steps to configure my ruby code on IIS? And also running the code using
> the
> IP address.

Everything I've seen pertaining to running Rails on IIS is using 
FastCGI. IMHO this is is a really bad choice for deployment of 
production applications. There are many great ways to deploy Rails 
applications using open source web servers.

Personally, I use Phusion Passenger along with the Apache web server 
with great success. I deploy to Ubuntu Linux on a Virtual Private Server 
(VPS).

https://www.phusionpassenger.com

That being said, if you're stuck with IIS for deployment then you may 
want to read up on using FastCGI inside IIS. Good luck with that. I 
tried FastCGI years ago with a Rails deployment and was never happy with 
that setup.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1fddbdc0fb0656aca7a1501bbe39938f%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: [HELP] - Ruby Drag and Drop script on screen element in Mac OS

2013-06-20 Thread Robert Walker
Muthu Selvan wrote in post #1113021:
> On Thursday, 20 June 2013 10:07:21 UTC-7, Walter Lee Davis wrote:
>> You can drag and drop a desktop element into a browser, and after setting
>> up the appropriate JavaScript in that browser, you can detect the drop on a
>> particular element and do something with that dropped file. Look at the
>> Flickr photo uploader for inspiration there. This is definitely not a Ruby
>> thing at all, it's pure JavaScript / Browser tech.

>   Water ,
>
>   Is this is tool or java script .. ? if it script can you please share
> the
> code / link to me ..?

Take a look at this tutorial...

http://www.html5rocks.com/en/tutorials/file/dndfiles/

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/788af505be710ed9c1fa6384d477331e%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




  1   2   3   4   5   6   7   8   9   10   >